本文整理汇总了C++中kurl::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addItems
void SoundtrackDialog::addItems(const KUrl::List& fileList)
{
if (fileList.isEmpty())
return;
KUrl::List Files = fileList;
for (KUrl::List::ConstIterator it = Files.constBegin(); it != Files.constEnd(); ++it)
{
KUrl currentFile = *it;
KUrl path = KUrl(currentFile.path().section('/', 0, -1));
m_sharedData->soundtrackPath = path;
SoundItem *item = new SoundItem(m_SoundFilesListBox, path);
item->setName(currentFile.path().section('/', -1));
m_SoundFilesListBox->insertItem(m_SoundFilesListBox->count() - 1, item);
m_soundItems->insert(path, item);
connect(m_soundItems->value(path), SIGNAL(signalTotalTimeReady(const KUrl&, const QTime&)),
this, SLOT(slotAddNewTime(const KUrl&, const QTime&)));
m_urlList.append(path);
}
m_SoundFilesListBox->setCurrentItem(m_SoundFilesListBox->item(m_SoundFilesListBox->count() - 1)) ;
slotSoundFilesSelected(m_SoundFilesListBox->currentRow());
m_SoundFilesListBox->scrollToItem(m_SoundFilesListBox->currentItem());
m_previewButton->setEnabled(true);
}
示例2: sort
void PlaylistModel::sort(int column, Qt::SortOrder order)
{
if (m_tracks.count() < 2)
{
return;
}
QMultiMap<QString, KUrl> keyMap;
QMultiMap<qint64, KUrl> durationMap;
KUrl::List tracks;
const KUrl url = m_tracks.value(m_currentTrack);
if (column == DurationColumn)
{
for (int i = 0; i < m_tracks.count(); ++i)
{
durationMap.insert(MetaDataManager::duration(m_tracks.at(i)), m_tracks.at(i));
}
tracks = durationMap.values();
}
else if (column > FileNameColumn && column < DurationColumn)
{
const MetaDataKey key = translateColumn(column);
for (int i = 0; i < m_tracks.count(); ++i)
{
keyMap.insert(MetaDataManager::metaData(m_tracks.at(i), key), m_tracks.at(i));
}
tracks = keyMap.values();
}
else
{
for (int i = 0; i < m_tracks.count(); ++i)
{
keyMap.insert(m_tracks.at(i).pathOrUrl(), m_tracks.at(i));
}
tracks = keyMap.values();
}
if (order == Qt::AscendingOrder)
{
KUrl::List items;
for (int i = (tracks.count() - 1); i >= 0; --i)
{
items.append(tracks.at(i));
}
tracks = items;
}
m_tracks = tracks;
setCurrentTrack(findTrack(url));
emit tracksChanged();
}
示例3: executeOtherDesktopFile
void KNewFileMenuPrivate::executeOtherDesktopFile(const KNewFileMenuSingleton::Entry& entry)
{
if (!checkSourceExists(entry.templatePath)) {
return;
}
KUrl::List::const_iterator it = m_popupFiles.constBegin();
for (; it != m_popupFiles.constEnd(); ++it)
{
QString text = entry.text;
text.remove("..."); // the ... is fine for the menu item but not for the default filename
text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
// KDE5 TODO: remove the "..." from link*.desktop files and use i18n("%1...") when making
// the action.
KUrl defaultFile(*it);
defaultFile.addPath(KIO::encodeFileName(text));
if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
text = KIO::RenameDialog::suggestName(*it, text);
const KUrl templateUrl(entry.templatePath);
KDialog* dlg = new KPropertiesDialog(templateUrl, *it, text, m_parentWidget);
dlg->setModal(q->isModal());
dlg->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(dlg, SIGNAL(applied()), q, SLOT(_k_slotOtherDesktopFile()));
dlg->show();
}
// We don't set m_src here -> there will be no copy, we are done.
}
示例4: add
void SaverConfig::add()
{
KURL::List files = KFileDialog::getOpenURLs( TQString(), TQString(),
this, i18n("Select Media Files") );
for( unsigned int n=0; n<files.count(); n++ )
m_files->insertItem( files[n].prettyURL(), -1 );
}
示例5: slotAlbumDelete
void AlbumModificationHelper::slotAlbumDelete(PAlbum* album)
{
if (!album || album->isRoot() || album->isAlbumRoot())
{
return;
}
// find subalbums
KUrl::List childrenList;
addAlbumChildrenToList(childrenList, album);
DeleteDialog dialog(d->dialogParent);
// All subalbums will be presented in the list as well
if (!dialog.confirmDeleteList(childrenList,
childrenList.size() == 1 ?
DeleteDialogMode::Albums : DeleteDialogMode::Subalbums,
DeleteDialogMode::UserPreference))
{
return;
}
bool useTrash = !dialog.shouldDelete();
// Currently trash kioslave can handle only full paths.
// pass full folder path to the trashing job
DIO::del(album, useTrash);
}
示例6: convertToLocalUrl
KURL::List K3b::convertToLocalUrls( const KURL::List& urls )
{
KURL::List r;
for( KURL::List::const_iterator it = urls.constBegin(); it != urls.constEnd(); ++it )
r.append( convertToLocalUrl( *it ) );
return r;
}
示例7: dropEvent
void ImageButton::dropEvent( QDropEvent *event )
{
if ( mReadOnly )
return;
const QMimeData *md = event->mimeData();
if ( md->hasImage() ) {
QImage image = qvariant_cast<QImage>(md->imageData());
mPicture.setData( image );
updateGui();
emit changed();
}
KUrl::List urls = KUrl::List::fromMimeData( md );
if ( urls.isEmpty() ) { // oops, no data
event->setAccepted( false );
} else {
if ( mImageLoader ) {
bool ok = false;
KABC::Picture pic = mImageLoader->loadPicture( urls.first(), &ok );
if ( ok ) {
mPicture = pic;
updateGui();
emit changed();
}
}
}
}
示例8: move
bool NetAccess::move( const KUrl& src, const KUrl& target, QWidget* window )
{
KUrl::List srcList;
srcList.append( src );
NetAccess kioNet;
return kioNet.dircopyInternal( srcList, target, window, true /*move*/ );
}
示例9: servURL
SvnHelper::SvnHelper():KApplication() {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
#ifdef Q_WS_X11
m_id=KWindowSystem::activeWindow();
KWindowSystem::activateWindow(m_id);
#else
m_id = 0;
#endif
KUrl::List list;
for ( int i = 0 ; i < args->count() ; i++ )
list << args->url(i);
if (args->isSet("u")) {
kDebug(7128) << "update " << list;
const KUrl servURL("svn+http://this_is_a_fake_URL_and_this_is_normal/");
//FIXME when 1.2 is out (move the loop inside kio_svn's ::update)
for ( QList<KUrl>::const_iterator it = list.constBegin(); it != list.constEnd() ; ++it ) {
QByteArray parms;
QDataStream s( &parms, QIODevice::WriteOnly );
int cmd = 2;
int rev = -1;
kDebug(7128) << "updating : " << (*it).prettyUrl();
s << cmd << *it << rev << QString( "HEAD" );
KIO::SimpleJob * job = KIO::special(servURL, parms);
connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
KIO::NetAccess::synchronousRun( job, 0 );
}
} else if (args->isSet("c")) {
示例10: testSuccessfulImport
void ImporterTest::testSuccessfulImport()
{
KUrl destUrl = KUrl::fromPath(mTempDir->name() + "/foo");
Importer importer(0);
QSignalSpy maximumChangedSpy(&importer, SIGNAL(maximumChanged(int)));
QSignalSpy errorSpy(&importer, SIGNAL(error(QString)));
KUrl::List list = mDocumentList;
QEventLoop loop;
connect(&importer, SIGNAL(importFinished()), &loop, SLOT(quit()));
importer.start(list, destUrl);
loop.exec();
QCOMPARE(maximumChangedSpy.count(), 1);
QCOMPARE(maximumChangedSpy.takeFirst().at(0).toInt(), list.count() * 100);
QCOMPARE(errorSpy.count(), 0);
QCOMPARE(importer.importedUrlList().count(), list.count());
QCOMPARE(importer.importedUrlList(), list);
QCOMPARE(importer.skippedUrlList().count(), 0);
QCOMPARE(importer.renamedCount(), 0);
Q_FOREACH(const KUrl & src, list) {
KUrl dst = destUrl;
dst.addPath(src.fileName());
QVERIFY(FileUtils::contentsAreIdentical(src, dst));
}
示例11: contentsDropEvent
void KonqSidebarTree::contentsDropEvent( QDropEvent *ev )
{
if (d->m_dropMode == SidebarTreeMode) {
m_autoOpenTimer->stop();
if ( !selectedItem() )
{
// KonqOperations::doDrop( 0L, m_dirtreeDir.dir, ev, this );
KURL::List urls;
if ( KURLDrag::decode( ev, urls ) )
{
for(KURL::List::ConstIterator it = urls.begin();
it != urls.end(); ++it)
{
addURL(0, *it);
}
}
}
else
{
KonqSidebarTreeItem *selection = static_cast<KonqSidebarTreeItem *>( selectedItem() );
selection->drop( ev );
}
} else {
KListView::contentsDropEvent(ev);
}
}
示例12: slotUpdateFileList
void PICComponent::slotUpdateFileList()
{
QStringList preFileList = KTechlab::self()->recentFiles();
QStringList fileList;
if ( ProjectInfo * info = ProjectManager::self()->currentProject() )
{
const KUrl::List urls = info->childOutputURLs( ProjectItem::AllTypes, ProjectItem::ProgramOutput );
KUrl::List::const_iterator urlsEnd = urls.end();
for ( KUrl::List::const_iterator it = urls.begin(); it != urlsEnd; ++it )
fileList << (*it).path();
}
const QStringList::iterator end = preFileList.end();
for ( QStringList::iterator it = preFileList.begin(); it != end; ++it )
{
QString file = KUrl(*it).path();
if ( (file.endsWith(".flowcode") || file.endsWith(".asm") || file.endsWith(".cod") || file.endsWith(".basic") || file.endsWith(".microbe") ) && !fileList.contains(file) ) {
fileList.append(file);
}
}
QString fileName = dataString("program");
property("program")->setAllowed(fileList);
property("program")->setValue( fileName.isEmpty() ? _def_PICComponent_fileName : fileName );
}
示例13: setImages
void GPSSyncDialog::setImages(const KUrl::List& images)
{
for ( KUrl::List::ConstIterator it = images.begin(); it != images.end(); ++it )
{
KipiImageItem* const newItem = new KipiImageItem(iface(), *it);
newItem->loadImageData(true, false);
d->imageModel->addItem(newItem);
}
QList<QPersistentModelIndex> imagesToLoad;
for (int i=0; i<d->imageModel->rowCount(); ++i)
{
imagesToLoad << d->imageModel->index(i, 0);
}
slotSetUIEnabled(false);
slotProgressSetup(imagesToLoad.count(), i18n("Loading metadata - %p%"));
// initiate the saving
d->fileIOCountDone = 0;
d->fileIOCountTotal = imagesToLoad.count();
d->fileIOFutureWatcher = new QFutureWatcher<QPair<KUrl, QString> >(this);
connect(d->fileIOFutureWatcher, SIGNAL(resultsReadyAt(int,int)),
this, SLOT(slotFileMetadataLoaded(int,int)));
d->fileIOFuture = QtConcurrent::mapped(imagesToLoad, LoadFileMetadataHelper(d->imageModel));
d->fileIOFutureWatcher->setFuture(d->fileIOFuture);
}
示例14: slotPreviewButtonClicked
void SoundtrackDialog::slotPreviewButtonClicked()
{
KUrl::List urlList;
for (int i = 0 ; i < m_SoundFilesListBox->count() ; ++i)
{
SoundItem *pitem = static_cast<SoundItem*>( m_SoundFilesListBox->item(i) );
QString path = pitem->url().toLocalFile();
if (!QFile::exists(path))
{
KMessageBox::error(this,
i18n("Cannot access file %1. Please check the path is correct.", path));
return;
}
urlList.append(path); // Input sound files.
}
if ( urlList.isEmpty() )
{
KMessageBox::error(this,
i18n("Cannot create a preview of an empty file list."));
return;
}
// Update SharedContainer from interface
saveSettings();
QPointer<SoundtrackPreview> preview = new SoundtrackPreview(this, urlList, m_sharedData);
preview->exec();
delete preview;
return;
}
示例15: f
void K3b::MovixDoc::addUrlsAt( const KUrl::List& urls, int pos )
{
QList<K3b::MovixFileItem*> items;
for( KUrl::List::ConstIterator it = urls.begin(); it != urls.end(); ++it ) {
KUrl url = K3b::convertToLocalUrl( *it );
QFileInfo f( url.toLocalFile() );
if( !f.isFile() || !url.isLocalFile() )
continue;
QString newName = f.fileName();
bool ok = true;
while( ok && nameAlreadyInDir( newName, root() ) ) {
newName = KInputDialog::getText( i18n("Enter New Filename"),
i18n("A file with that name already exists. Please enter a new name:"),
newName, &ok, view() );
}
if( ok ) {
MovixFileItem* newItem = new MovixFileItem( f.absoluteFilePath(), *this, newName );
root()->addDataItem( newItem );
items.append( newItem );
}
}
addMovixItems( items, pos );
}