本文整理汇总了C++中kurl::List::first方法的典型用法代码示例。如果您正苦于以下问题:C++ List::first方法的具体用法?C++ List::first怎么用?C++ List::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kurl::List
的用法示例。
在下文中一共展示了List::first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2:
void K3bIsoImageWritingDialog::dropEvent( QDropEvent* e )
{
KURL::List urls;
KURLDrag::decode( e, urls );
#if KDE_IS_VERSION(3,4,0)
m_editImagePath->setKURL( urls.first() );
#else
m_editImagePath->setURL( urls.first().path() );
#endif
}
示例3: dropEvent
void BGMonitor::dropEvent(QDropEvent *e)
{
if (!KURLDrag::canDecode(e))
return;
KURL::List uris;
if (KURLDrag::decode(e, uris) && (uris.count() > 0)) {
// TODO: Download remote file
if (uris.first().isLocalFile())
emit imageDropped(uris.first().path());
}
}
示例4: playlistFromURLs
void FSBrowser::playlistFromURLs( const KURL::List &urls )
{
QString suggestion;
if( urls.count() == 1 && QFileInfo( urls.first().path() ).isDir() )
suggestion = urls.first().fileName();
else
suggestion = i18n( "Untitled" );
const QString path = PlaylistDialog::getSaveFileName( suggestion );
if( path.isEmpty() )
return;
if( PlaylistBrowser::savePlaylist( path, urls ) )
PlaylistWindow::self()->showBrowser( "PlaylistBrowser" );
}
示例5: slotUrlsDropped
void ScanGallery::slotUrlsDropped(QDropEvent *ev, FileTreeViewItem *item)
{
KUrl::List urls = ev->mimeData()->urls();
if (urls.isEmpty()) return;
kDebug() << "onto" << (item==NULL ? "NULL" : item->url().prettyUrl())
<< "srcs" << urls.count() << "first" << urls.first();
if (item==NULL) return;
KUrl dest = item->url();
// Check whether the drop is on top of a directory (in which case we
// want to move/copy into it) or a file (move/copy into its containing
// directory).
if (!item->isDir()) dest.setFileName(QString::null);
dest.adjustPath(KUrl::AddTrailingSlash);
kDebug() << "resolved destination" << dest;
// Make the last URL to copy the one to select next
KUrl nextSel = dest;
nextSel.addPath(urls.back().fileName(KUrl::ObeyTrailingSlash));
m_nextUrlToShow = nextSel;
KIO::Job *job;
// TODO: top level window as 3rd parameter?
if (ev->dropAction()==Qt::MoveAction) job = KIO::move(urls, dest);
else job = KIO::copy(urls, dest);
connect(job, SIGNAL(result(KJob *)), SLOT(slotJobResult(KJob *)));
}
示例6: 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();
}
}
}
}
示例7: viewportDropEvent
void DrawZone::viewportDropEvent( QDropEvent* e) {
KURL::List urlList;
// A file from konqueror was dropped
if (KURLDrag::decode(e,urlList)) {
imageMapEditor->openFile(urlList.first());
}
}
示例8: KURL
KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg)
{
KURL::List uris;
if (KURLDrag::decode(e, uris) && (uris.count() > 0)) {
KURL *url = new KURL(uris.first());
KImageIO::registerFormats();
if( KImageIO::canRead(KImageIO::type(url->fileName())) )
return url;
QStringList qs = QStringList::split('\n', KImageIO::pattern());
qs.remove(qs.begin());
QString msg = i18n( "%1 "
"does not appear to be an image file.\n"
"Please use files with these extensions:\n"
"%2")
.arg(url->fileName())
.arg(qs.join("\n"));
KMessageBox::sorry( wdg, msg);
delete url;
}
return 0;
}
示例9: playlistFromURLs
void FileBrowser::playlistFromURLs( const KURL::List &urls )
{
QString suggestion;
if( urls.count() == 1 && QFileInfo( urls.first().path() ).isDir() )
suggestion = urls.first().fileName();
else
suggestion = i18n( "Untitled" );
const QString path = PlaylistDialog::getSaveFileName( suggestion );
if( path.isEmpty() )
return;
if( PlaylistBrowser::savePlaylist( path, urls ) )
{
//FIXME: uncomment after string freeze
//Pana::StatusBar::instance()->shortMessage( "Playlist saved to playlist browser" );
}
}
示例10: load
void k2send::dropEvent(QDropEvent *event)
{
KURL::List urls;
if (KURLDrag::decode(event, urls) && !urls.isEmpty())
{
const KURL &url = urls.first();
load(url);
}
}
示例11: giveMeTreeFor
void
RadialMap::Widget::dropEvent( QDropEvent *e )
{
DEBUG_ANNOUNCE
KURL::List urls;
if (KURLDrag::decode( e, urls ) && urls.count())
emit giveMeTreeFor( urls.first() );
}
示例12: executeRealFileOrDir
void KNewFileMenuPrivate::executeRealFileOrDir(const KNewFileMenuSingleton::Entry& entry)
{
// The template is not a desktop file
// Show the small dialog for getting the destination filename
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
m_strategy.m_src = entry.templatePath;
KUrl defaultFile(m_popupFiles.first());
defaultFile.addPath(KIO::encodeFileName(text));
if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
text = KIO::RenameDialog::suggestName(m_popupFiles.first(), text);
KDialog* fileDialog = new KDialog(m_parentWidget);
fileDialog->setAttribute(Qt::WA_DeleteOnClose);
fileDialog->setModal(q->isModal());
fileDialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget* mainWidget = new QWidget(fileDialog);
QVBoxLayout *layout = new QVBoxLayout(mainWidget);
QLabel *label = new QLabel(entry.comment);
// We don't set the text of lineEdit in its constructor because the clear button would not be shown then.
// It seems that setClearButtonShown(true) must be called *before* the text is set to make it work.
// TODO: should probably be investigated and fixed in KLineEdit.
KLineEdit *lineEdit = new KLineEdit;
lineEdit->setClearButtonShown(true);
lineEdit->setText(text);
_k_slotTextChanged(text);
QObject::connect(lineEdit, SIGNAL(textChanged(const QString &)), q, SLOT(_k_slotTextChanged(const QString &)));
layout->addWidget(label);
layout->addWidget(lineEdit);
fileDialog->setMainWidget(mainWidget);
QObject::connect(fileDialog, SIGNAL(accepted()), q, SLOT(_k_slotRealFileOrDir()));
QObject::connect(fileDialog, SIGNAL(rejected()), q, SLOT(_k_slotAbortDialog()));
fileDialog->show();
lineEdit->selectAll();
lineEdit->setFocus();
}
示例13: dropEvent
void MonthWidget::dropEvent(QDropEvent* event)
{
KUrl::List srcURLs = KUrl::List::fromMimeData( event->mimeData() );
if ( srcURLs.isEmpty() )
return;
KUrl url = srcURLs.first();
setImage( url );
}
示例14: contentsDropEvent
void MyEditor::contentsDropEvent( TQDropEvent *e )
{
///////////////// decode dropped file
KURL::List list;
TQString text;
if ( KURLDrag::decode( e, list ) )
slotDroppedFile(list.first());
else if ( TQTextDrag::decode(e, text) )
insert(text);
}
示例15: switch
inline void
FSBrowser::contextMenuActivated( int id )
{
switch( id )
{
case MakePlaylist:
Playlist::instance()->insertMedia( selectedItems(), Playlist::Replace );
break;
case SavePlaylist:
playlistFromURLs( selectedItems() );
break;
case AppendToPlaylist:
Playlist::instance()->insertMedia( selectedItems() );
break;
case EditTags:
{
KURL::List list = selectedItems();
TagDialog *dialog = NULL;
if( list.count() == 1 )
{
dialog = new TagDialog( list.first(), this );
}
else
{
dialog = new TagDialog( list, this );
}
dialog->show();
}
break;
case CopyToCollection:
CollectionView::instance()->organizeFiles( selectedItems(), i18n( "Copy Files To Collection" ), true );
break;
case MoveToCollection:
CollectionView::instance()->organizeFiles( selectedItems(), i18n( "Move Files To Collection" ), false );
break;
case CopyMediaDevice:
MediaBrowser::queue()->addURLs( selectedItems() );
break;
case SelectAllFiles:
selectAll();
break;
case BurnCd:
K3bExporter::instance()->exportTracks( selectedItems() );
break;
}
}