本文整理汇总了C++中kurl::List::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ List::isEmpty方法的具体用法?C++ List::isEmpty怎么用?C++ List::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kurl::List
的用法示例。
在下文中一共展示了List::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contentsDropEvent
void KFileDetailView::contentsDropEvent( TQDropEvent *e )
{
d->dropItem = 0;
d->autoOpenTimer.stop();
if ( ! acceptDrag( e ) ) { // can we decode this ?
e->ignore(); // No
return;
}
e->acceptAction(); // Yes
KFileListViewItem *item = dynamic_cast<KFileListViewItem*>(itemAt( contentsToViewport( e->pos() ) ));
KFileItem * fileItem = 0;
if (item)
fileItem = item->fileInfo();
emit dropped(e, fileItem);
KURL::List urls;
if (KURLDrag::decode( e, urls ) && !urls.isEmpty())
{
emit dropped(e, urls, fileItem ? fileItem->url() : KURL());
sig->dropURLs(fileItem, e, urls);
}
}
示例2: load
void k2send::dropEvent(QDropEvent *event)
{
KURL::List urls;
if (KURLDrag::decode(event, urls) && !urls.isEmpty())
{
const KURL &url = urls.first();
load(url);
}
}
示例3: dlg
int K3bDataUrlAddingDialog::addUrls( const KURL::List& urls,
K3bDirItem* dir,
QWidget* parent )
{
if( urls.isEmpty() )
return 0;
//
// A common mistake by beginners is to try to burn an iso image
// with a data project. Let's warn them
//
if( urls.count() == 1 ) {
K3bIso9660 isoF( urls.first().path() );
if( isoF.open() ) {
if( KMessageBox::warningYesNo( parent,
i18n("<p>The file you are about to add to the project is an ISO9660 image. As such "
"it can be burned to a medium directly since it already contains a file "
"system.<br>"
"Are you sure you want to add this file to the project?"),
i18n("Adding image file to project"),
i18n("Add the file to the project"),
i18n("Burn the image directly") ) == KMessageBox::No ) {
// very rough dvd image size test
if( K3b::filesize( urls.first() ) > 1000*1024*1024 )
k3bappcore->k3bMainWindow()->slotWriteDvdIsoImage( urls.first() );
else
k3bappcore->k3bMainWindow()->slotWriteCdImage( urls.first() );
return 0;
}
}
}
K3bDataUrlAddingDialog dlg( dir->doc(), parent );
dlg.m_urls = urls;
for( KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it )
dlg.m_urlQueue.append( qMakePair( K3b::convertToLocalUrl(*it), dir ) );
dlg.slotAddUrls();
int ret = QDialog::Accepted;
if( !dlg.m_urlQueue.isEmpty() ) {
dlg.m_dirSizeJob->setUrls( urls );
dlg.m_dirSizeJob->setFollowSymlinks( dir->doc()->isoOptions().followSymbolicLinks() );
dlg.m_dirSizeJob->start();
ret = dlg.exec();
}
// make sure the dir size job is finished
dlg.m_dirSizeJob->cancel();
K3bSignalWaiter::waitForJob( dlg.m_dirSizeJob );
QString message = dlg.resultMessage();
if( !message.isEmpty() )
KMessageBox::detailedSorry( parent, i18n("Problems while adding files to the project."), message );
return ret;
}
示例4: slotAddFiles
/** No descriptions */
void ProjectNewLocal::slotAddFiles()
{
QExtFileInfo::createDir(baseURL, this);
KURL::List list = KFileDialog::getOpenURLs(
baseURL.url(), i18n("*"), this, i18n("Insert Files in Project"));
if ( !list.isEmpty() )
{
KURL u = list.first();
u = QExtFileInfo::toRelative( u, baseURL, false );
if ( u.path().startsWith("..") || u.path().startsWith("/"))
{
KURLRequesterDlg *urlRequesterDlg = new KURLRequesterDlg( baseURL.prettyURL(), this, "");
urlRequesterDlg->setCaption(i18n("Files: Copy to Project"));
urlRequesterDlg->urlRequester()->setMode( KFile::Directory | KFile::ExistingOnly);
urlRequesterDlg->exec();
KURL destination = urlRequesterDlg->selectedURL();
delete urlRequesterDlg;
if ( !destination.isEmpty())
{
CopyTo *dlg = new CopyTo( baseURL);
connect(dlg, SIGNAL(addFilesToProject(const KURL::List&)),
SLOT (slotInsertFilesAfterCopying(const KURL::List&)));
connect(dlg, SIGNAL(deleteDialog(CopyTo *)),
SLOT (slotDeleteCopyToDialog(CopyTo *)));
list = dlg->copy( list, destination );
return;
} else
{
return;
}
}
progressBar->setTotalSteps(list.count() - 1);
progressBar->setTextEnabled(true);
for (uint i = 0; i < list.count(); i++)
{
list[i] = QExtFileInfo::toRelative(list[i], baseURL, false);
if (!fileList.contains(list[i]))
{
fileList.append(list[i]);
QListViewItem *it = listView->addItem(list[i], KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
if (it) it->setSelected(true);
progressBar->setValue(i);
}
}
progressBar->setTotalSteps(1);
progressBar->setValue(0);
progressBar->setTextEnabled(false);
}
}
示例5: remove
// the group item itself will be removed automatically,
// when the last child is removed
void KonqSidebarHistoryGroupItem::remove()
{
KURL::List list;
KonqSidebarHistoryItem *child = static_cast<KonqSidebarHistoryItem*>( firstChild() );
while( child ) {
list.append( child->externalURL() );
child = static_cast<KonqSidebarHistoryItem*>( child->nextSibling() );
}
if ( !list.isEmpty() )
KonqHistoryManager::kself()->emitRemoveFromHistory( list );
}
示例6: dropEvent
void TopLevel::dropEvent( QDropEvent * event)
{
KURL::List list;
if (KURLDrag::decode(event, list) && !list.isEmpty())
{
// Load the first file in this window
const KURL &url = list.first();
openNetFile( url );
}
}
示例7: playAudioCD
void PlaylistWindow::playAudioCD() //SLOT
{
KURL::List urls;
if (EngineController::engine()->getAudioCDContents(QString::null, urls)) {
if (!urls.isEmpty()) {
Playlist::instance()->insertMedia(urls, Playlist::Replace);
}
} else { // Default behaviour
m_browsers->showBrowser( "FileBrowser" );
FileBrowser *fb = static_cast<FileBrowser *>( m_browsers->browser("FileBrowser") );
fb->setUrl( KURL("audiocd:/Wav/") );
}
}
示例8: signalChangeStatusbar
void K2sendPlayList::insertDroppedEvent(QDropEvent *event, QListViewItem *p, QListViewItem *after)
{
KURL::List urls;
if (KURLDrag::decode(event, urls) && !urls.isEmpty()){
KURL::List::iterator it;
for ( it = urls.begin(); it != urls.end(); ++it ){
if ((*it).isLocalFile()){
add((*it).path(),(K2sendPlayListItem*)after);
}
}
}
QString msg = QString("%1 Files").arg(this->childCount());
emit signalChangeStatusbar(msg);
}
示例9: dropEvent
void BookmarksListBox::dropEvent( QDropEvent *event )
{
KURL::List urls;
if (KURLDrag::decode(event, urls) && !urls.isEmpty()) {
KBookmarkManager* manager = DolphinSettings::instance().bookmarkManager();
KBookmarkGroup root = manager->root();
KURL::List::iterator it;
for(it=urls.begin(); it!=urls.end(); ++it) {
root.addBookmark(manager, (*it).fileName(), (*it), "", false);
}
manager->emitChanged(root);
}
}
示例10: slotSwitchToTest
void RubySupportPart::slotSwitchToTest()
{
KParts::Part *activePart = partController()->activePart();
if (!activePart)
return;
KParts::ReadOnlyPart *ropart = dynamic_cast<KParts::ReadOnlyPart*>(activePart);
if (!ropart)
return;
QFileInfo file(ropart->url().path());
if (!file.exists())
return;
QString ext = file.extension();
QString name = file.baseName();
QString switchTo = "";
if (ext == "rjs" || ext == "rxml" || ext == "rhtml" || ext == "js.rjs" || ext == "xml.builder" || ext == "html.erb")
{
//this is a view already, let's show the list of all views for this model
switchTo = file.dir().dirName();
}
else if (ext == "rb")
switchTo = name.remove(QRegExp("_controller$")).remove(QRegExp("_controller_test$")).remove(QRegExp("_test$"));
if (switchTo.isEmpty())
return;
if (switchTo.endsWith("s"))
switchTo = switchTo.mid(0, switchTo.length() - 1);
KURL::List urls;
QString testDir = project()->projectDirectory() + "/test/";
QString functionalTestS = testDir + "functional/" + switchTo + "_controller_test.rb";
QString functionalTestP = testDir + "functional/" + switchTo + "s_controller_test.rb";
QString integrationTestS = testDir + "integration/" + switchTo + "_test.rb";
QString integrationTestP = testDir + "integration/" + switchTo + "s_test.rb";
QString unitTestS = testDir + "unit/" + switchTo + "_test.rb";
QString unitTestP = testDir + "unit/" + switchTo + "s_test.rb";
if (QFile::exists(functionalTestP)) urls << KURL::fromPathOrURL(functionalTestP);
if (QFile::exists(integrationTestP)) urls << KURL::fromPathOrURL(integrationTestP);
if (QFile::exists(unitTestP)) urls << KURL::fromPathOrURL(unitTestP);
if (QFile::exists(functionalTestS)) urls << KURL::fromPathOrURL(functionalTestS);
if (QFile::exists(integrationTestS)) urls << KURL::fromPathOrURL(integrationTestS);
if (QFile::exists(unitTestS)) urls << KURL::fromPathOrURL(unitTestS);
KDevQuickOpen *qo = extension<KDevQuickOpen>("KDevelop/QuickOpen");
if (qo && !urls.isEmpty())
qo->quickOpenFile(urls);
}
示例11: KURLDrag
QDragObject *KURLBarListBox::dragObject()
{
KURL::List urls;
KURLBarItem *item = static_cast< KURLBarItem * >(firstItem());
while(item)
{
if(item->isSelected())
urls.append(item->url());
item = static_cast< KURLBarItem * >(item->next());
}
if(!urls.isEmpty()) // ### use custom drag-object with description etc.?
return new KURLDrag(urls, this, "urlbar drag");
return 0L;
}
示例12: dropEvent
void Korrent::dropEvent(QDropEvent *event)
{
// this is a very simplistic implementation of a drop event. we
// will only accept a dropped URL. the Qt dnd code can do *much*
// much more, so please read the docs there
KURL::List urls;
// see if we can decode a URI.. if not, just ignore it
if (KURLDrag::decode(event, urls) && !urls.isEmpty())
{
// okay, we have a URI.. process it
const KURL &url = urls.first();
// load in the file
load(url);
}
}
示例13: dropEvent
void Kooka::dropEvent(QDropEvent *event)
{
// this is a very simplistic implementation of a drop event. we
// will only accept a dropped URL. the Qt dnd code can do *much*
// much more, so please read the docs there
KURL::List uri;
// see if we can decode a URI.. if not, just ignore it
if (KURLDrag::decode(event, uri) && !uri.isEmpty())
{
// okay, we have a URI.. process it
const KURL &url = uri.first();
kdDebug(29000) << "Importing URI " << url.url() << endl;
// TODO: Do something with url
// Waba: See also setAcceptDrops() above
}
}
示例14: newDrag
QDragObject* K3bDataFileView::dragObject()
{
QPtrList<QListViewItem> selectedViewItems = selectedItems();
KURL::List urls;
for( QPtrListIterator<QListViewItem> it( selectedViewItems ); it.current(); ++it ) {
K3bDataViewItem* dataViewItem = dynamic_cast<K3bDataViewItem*>( it.current() );
if( dataViewItem ) {
urls.append( KURL::fromPathOrURL(dataViewItem->dataItem()->localPath()) );
}
else
kdDebug() << "no dataviewitem" << endl;
}
if( urls.isEmpty() )
return 0;
return KURLDrag::newDrag( urls, viewport() );
}
示例15: toMediaURLList
KURL::List MediaDirNotify::toMediaURLList(const KURL::List &list)
{
KURL::List new_list;
KURL::List::const_iterator it = list.begin();
KURL::List::const_iterator end = list.end();
for (; it!=end; ++it)
{
KURL::List urls = toMediaURL(*it);
if (!urls.isEmpty())
{
new_list += urls;
}
}
return new_list;
}