本文整理汇总了C++中kurl::List::append方法的典型用法代码示例。如果您正苦于以下问题:C++ List::append方法的具体用法?C++ List::append怎么用?C++ List::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kurl::List
的用法示例。
在下文中一共展示了List::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testMostLocalUrlList
void KUrlMimeTest::testMostLocalUrlList()
{
QMimeData* mimeData = new QMimeData;
KUrl::List urls;
urls.append(KUrl("desktop:/foo"));
urls.append(KUrl("desktop:/bar"));
KUrl::List localUrls;
localUrls.append(KUrl("file:/home/dfaure/Desktop/foo"));
localUrls.append(KUrl("file:/home/dfaure/Desktop/bar"));
urls.populateMimeData(localUrls, mimeData);
QVERIFY(KUrl::List::canDecode(mimeData));
QVERIFY(mimeData->hasUrls());
QVERIFY(mimeData->hasText());
QVERIFY(mimeData->hasFormat("text/plain"));
// KUrl decodes the real "kde" urls by default
KUrl::List decodedURLs = KUrl::List::fromMimeData(mimeData);
QVERIFY(!decodedURLs.isEmpty());
QCOMPARE(decodedURLs.toStringList().join(" "), urls.toStringList().join(" ") );
// KUrl can also be told to decode the "most local" urls
decodedURLs = KUrl::List::fromMimeData(mimeData, 0, KUrl::List::PreferLocalUrls);
QVERIFY(!decodedURLs.isEmpty());
QCOMPARE(decodedURLs.toStringList().join(" "), localUrls.toStringList().join(" ") );
// QMimeData decodes the "most local" urls
const QList<QUrl> qurls = mimeData->urls();
QCOMPARE(qurls.count(), localUrls.count());
for (int i = 0; i < qurls.count(); ++i )
QCOMPARE(qurls[i], static_cast<QUrl>(localUrls[i]));
}
示例2: tempFileForAttachment
QMimeData *mimeData()
{
// create a list of the URL:s that we want to drag
KUrl::List urls;
QStringList labels;
for ( Q3IconViewItem *it = firstItem(); it; it = it->nextItem() ) {
if ( it->isSelected() ) {
AttachmentIconItem *item = static_cast<AttachmentIconItem *>( it );
if ( item->isBinary() ) {
urls.append( tempFileForAttachment( item->attachment() ) );
} else {
urls.append( item->uri() );
}
labels.append( KUrl::toPercentEncoding( item->label() ) );
}
}
if ( selectionMode() == Q3IconView::NoSelection ) {
AttachmentIconItem *item = static_cast<AttachmentIconItem *>( currentItem() );
if ( item ) {
urls.append( item->uri() );
labels.append( KUrl::toPercentEncoding( item->label() ) );
}
}
QMap<QString, QString> metadata;
metadata["labels"] = labels.join( ":" );
QMimeData *mimeData = new QMimeData;
urls.populateMimeData( mimeData, metadata );
return mimeData;
}
示例3: getAssociatedUrls
void CJobRunner::getAssociatedUrls(const KUrl &url, KUrl::List &list, bool afmAndPfm, QWidget *widget)
{
QString ext(url.path());
int dotPos(ext.lastIndexOf('.'));
bool check(false);
if(-1==dotPos) // Hmm, no extension - check anyway...
check=true;
else // Cool, got an extension - see if it is a Type1 font...
{
ext=ext.mid(dotPos+1);
check=0==ext.compare("pfa", Qt::CaseInsensitive) ||
0==ext.compare("pfb", Qt::CaseInsensitive);
}
if(check)
{
const char *afm[]={"afm", "AFM", "Afm", NULL},
*pfm[]={"pfm", "PFM", "Pfm", NULL};
bool gotAfm(false),
localFile(url.isLocalFile());
int e;
for(e=0; afm[e]; ++e)
{
KUrl statUrl(url);
KIO::UDSEntry uds;
statUrl.setPath(Misc::changeExt(url.path(), afm[e]));
if(localFile ? Misc::fExists(statUrl.toLocalFile()) : KIO::NetAccess::stat(statUrl, uds, widget))
{
list.append(statUrl);
gotAfm=true;
break;
}
}
if(afmAndPfm || !gotAfm)
for(e=0; pfm[e]; ++e)
{
KUrl statUrl(url);
KIO::UDSEntry uds;
statUrl.setPath(Misc::changeExt(url.path(), pfm[e]));
if(localFile ? Misc::fExists(statUrl.toLocalFile()) : KIO::NetAccess::stat(statUrl, uds, widget))
{
list.append(statUrl);
break;
}
}
}
}
示例4: mouseMoveEvent
void QuickButton::mouseMoveEvent(QMouseEvent *e)
{
if((e->state() & LeftButton) == 0)
return;
QPoint p(e->pos() - _dragPos);
if(p.manhattanLength() <= KGlobalSettings::dndEventDelay())
return;
DEBUGSTR << "dragstart" << endl << flush;
setDown(false);
if(_dragEnabled)
{
KURL::List uris;
uris.append(_qurl->kurl());
DEBUGSTR << "creating KURLDrag" << endl << flush;
KURLDrag *dd = new KURLDrag(uris, this);
dd->setPixmap(_icon); // PIX
DEBUGSTR << "ready to drag" << endl << flush;
grabKeyboard();
dd->drag();
releaseKeyboard();
}
else
{
setCursor(Qt::ForbiddenCursor);
}
}
示例5: mouseMoveEvent
void MrmlViewItem::mouseMoveEvent( QMouseEvent *e )
{
if ( hitsPixmap( e->pos() ) ) {
if ( !ownCursor() ) { // nice hacklet :)
setCursor( KCursor::handCursor() );
emit view()->onItem( m_url );
}
}
else {
if ( ownCursor() ) {
unsetCursor();
emit view()->onItem( KURL() );
}
}
if ( (e->state() & LeftButton) && !pressedPos.isNull() ) {
QPoint dist = e->pos() - pressedPos;
if ( dist.manhattanLength() > KGlobalSettings::dndEventDelay() ) {
// start drag here
KURL::List urls;
// ### support multiple files?
urls.append( m_url );
KURLDrag *drag = new KURLDrag( urls, this );
drag->setPixmap( KMimeType::pixmapForURL( m_url ) );
drag->drag();
}
}
}
示例6: urlSelected
bool DocumentationViewer::urlSelected(const QString &url, int button, int state, const QString &_target, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments & /* browserArgs */)
{
KUrl cURL = completeURL(url);
QString mime = KMimeType::findByUrl(cURL).data()->name();
//load this URL in the embedded viewer if KHTML can handle it, or when mimetype detection failed
KService::Ptr service = KService::serviceByDesktopName("khtml");
if(( mime == KMimeType::defaultMimeType() ) || (service && service->hasServiceType(mime))) {
KHTMLPart::urlSelected(url, button, state, _target, args);
openUrl(cURL);
addToHistory(cURL.url());
}
//KHTML can't handle it, look for an appropriate application
else {
KService::List offers = KMimeTypeTrader::self()->query(mime, "Type == 'Application'");
if(offers.isEmpty()) {
KMessageBox::error(view(), i18n("No KDE service found for the MIME type \"%1\".", mime));
return false;
}
KUrl::List lst;
lst.append(cURL);
KRun::run(*(offers.first()), lst, view());
}
return true;
}
示例7: selectedItems
TQDragObject * KfindWindow::dragObject()
{
KURL::List uris;
TQPtrList<TQListViewItem> selected = selectedItems();
// create a list of URIs from selection
for ( uint i = 0; i < selected.count(); i++ )
{
KfFileLVI *item = (KfFileLVI *) selected.at( i );
if (item)
{
uris.append( item->fileitem.url() );
}
}
if ( uris.count() <= 0 )
return 0;
TQUriDrag *ud = new KURLDrag( uris, (TQWidget *) this, "kfind uridrag" );
const TQPixmap *pix = currentItem()->pixmap(0);
if ( pix && !pix->isNull() )
ud->setPixmap( *pix );
return ud;
}
示例8: toMediaURL
KURL::List MediaDirNotify::toMediaURL(const KURL &url)
{
kdDebug(1219) << "MediaDirNotify::toMediaURL(" << url << ")" << endl;
KURL::List result;
const TQPtrList<Medium> list = m_mediaList.list();
TQPtrList<Medium>::const_iterator it = list.begin();
TQPtrList<Medium>::const_iterator end = list.end();
for (; it!=end; ++it)
{
const Medium *m = *it;
KURL base = m->prettyBaseURL();
if ( base.isParentOf(url) )
{
TQString path = KURL::relativePath(base.path(),
url.path());
KURL new_url("media:/"+m->name()+"/"+path );
new_url.cleanPath();
result.append(new_url);
}
}
kdDebug(1219) << result << endl;
return result;
}
示例9: slotOpenWithMenuAction
void KateFileTree::slotOpenWithMenuAction(QAction* a)
{
KUrl::List list;
KTextEditor::Document *doc = model()->data(m_indexContextMenu, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
if (!doc) return;
list.append( doc->url() );
const QString openWith = a->data().toString();
if (openWith.isEmpty())
{
// display "open with" dialog
KOpenWithDialog dlg(list);
if (dlg.exec())
KRun::run(*dlg.service(), list, this);
return;
}
KService::Ptr app = KService::serviceByDesktopPath(openWith);
if (app)
{
KRun::run(*app, list, this);
}
else
{
KMessageBox::error(this, i18n("Application '%1' not found.", openWith), i18n("Application not found"));
}
}
示例10: 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*/ );
}
示例11: 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();
}
示例12: 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;
}
示例13: files
KURL::List ProjectNewLocal::files()
{
//return fileList;
KURL::List r;
QListViewItem *item;
QListViewItemIterator it(listView);
for ( ; it.current(); ++it )
{
item = it.current();
if ( listView->isSelected( item ))
{
KURL u;
if (dynamic_cast<UploadTreeFolder*>(item))
{
u = dynamic_cast<UploadTreeFolder*>(item)->url();
} else
{
u = dynamic_cast<UploadTreeFile*>(item)->url();
}
if (!u.isEmpty()) r.append(u);
}
}
return r;
}
示例14: 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;
}
示例15: selectedItems
KURL::List FileBrowser::selectedItems()
{
KURL::List list;
for( KFileItemListIterator it( m_dir->selectedItems()->count() ? *m_dir->selectedItems() : *m_dir->view()->items() ); *it; ++it )
list.append( (*it)->url() );
return list;
}