本文整理汇总了C++中KFileItemList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItemList::append方法的具体用法?C++ KFileItemList::append怎么用?C++ KFileItemList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItemList
的用法示例。
在下文中一共展示了KFileItemList::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: delayedPreview
void DirModel::delayedPreview()
{
QHash<QUrl, QPersistentModelIndex>::const_iterator i = m_filesToPreview.constBegin();
KFileItemList list;
while (i != m_filesToPreview.constEnd()) {
QUrl file = i.key();
QPersistentModelIndex index = i.value();
if (!m_previewJobs.contains(file) && file.isValid()) {
list.append(KFileItem(file, QString(), 0));
m_previewJobs.insert(file, QPersistentModelIndex(index));
}
++i;
}
if (list.size() > 0) {
KIO::PreviewJob* job = KIO::filePreview(list, m_screenshotSize);
job->setIgnoreMaximumSize(true);
// qDebug() << "Created job" << job;
connect(job, &KIO::PreviewJob::gotPreview,
this, &DirModel::showPreview);
connect(job, &KIO::PreviewJob::failed,
this, &DirModel::previewFailed);
}
m_filesToPreview.clear();
}
示例2: slotImageSelected
void BatchProcessImagesDialog::slotImageSelected(QTreeWidgetItem * item)
{
if (!item || m_listFiles->topLevelItemCount() == 0)
{
m_ui->m_imageLabel->clear();
return;
}
BatchProcessImagesItem *pitem = static_cast<BatchProcessImagesItem*>(item);
m_ui->m_imageLabel->clear();
QString IdemIndexed = "file:" + pitem->pathSrc();
KUrl url(IdemIndexed);
if ( !url.isValid() )
return;
#if KDE_IS_VERSION(4,7,0)
KFileItemList items;
items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true));
KIO::PreviewJob* m_thumbJob = KIO::filePreview(items, QSize(m_ui->m_imageLabel->height(), m_ui->m_imageLabel->height()));
#else
KIO::PreviewJob* m_thumbJob = KIO::filePreview(url, m_ui->m_imageLabel->height());
#endif
connect(m_thumbJob, SIGNAL(gotPreview(KFileItem,QPixmap)),
this, SLOT(slotGotPreview(KFileItem,QPixmap)));
}
示例3: slImageChanged
void ThumbView::slImageChanged( KFileItem *kfit )
{
if( ! kfit ) return;
// kdDebug(28000) << "changes to one thumbnail!" << endl;
KURL thumbDir = currentDir();
KURL itemUrl = kfit->url();
/* delete filename */
itemUrl.setFileName( QString());
if( !itemUrl.equals( thumbDir, true ))
{
// kdDebug(28000) << "returning, because directory does not match: " << itemUrl.prettyURL() << endl;
// kdDebug(28000) << "and my URL: " << thumbDir.prettyURL() << endl;
return;
}
if( deleteImage( kfit ))
{
kdDebug(28000) << "was changed, deleted first!" << endl;
}
/* Trigger a new reading */
KFileItemList li;
li.append( kfit );
slNewFileItems( li );
}
示例4: slotStartJob
void KrPreviewJob::slotStartJob()
{
ASSERT(_job == 0);
ASSERT(!_scheduled.isEmpty());
_hash.clear();
sort();
int size = _parent->_view->fileIconSize();
KFileItemList list;
for(int i = 0; i < _scheduled.count() && i < MAX_CHUNK_SIZE; i++) {
KFileItem fi(_scheduled[i]->getVfile()->vfile_getUrl(), 0, 0);
list.append(fi);
_hash.insert(fi, _scheduled[i]);
}
QStringList allPlugins = KIO::PreviewJob::availablePlugins();
_job = new KIO::PreviewJob(list, QSize(size, size), &allPlugins);
_job->setOverlayIconAlpha(0);
_job->setOverlayIconSize(0);
_job->setScaleType(KIO::PreviewJob::ScaledAndCached);
connect(_job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)), SLOT(slotGotPreview(const KFileItem&, const QPixmap&)));
connect(_job, SIGNAL(failed(const KFileItem&)), SLOT(slotFailed(const KFileItem&)));
connect(_job, SIGNAL(result(KJob*)), SLOT(slotJobResult(KJob*)));
}
示例5: slCheckForUpdate
void ThumbView::slCheckForUpdate( KFileItem *kfit )
{
if( ! kfit ) return;
kdDebug(28000) << "Checking for update of thumbview!" << endl;
KURL searchUrl = kfit->url();
bool haveItem = false;
/* iterate over all icon items and compare urls.
* TODO: Check the parent url to avoid iteration over all */
for ( QIconViewItem *item = m_iconView->firstItem(); item && !haveItem;
item = item->nextItem() )
{
if( searchUrl == static_cast<ThumbViewItem*>(item)->itemUrl() )
{
haveItem = true;
}
}
/* if we still do not have the item, it is not in the thumbview. */
if( ! haveItem )
{
KFileItemList kfiList;
kfiList.append( kfit );
slNewFileItems( kfiList );
}
}
示例6: imageSelected
void UploadDialog::imageSelected(QTreeWidgetItem* item)
{
if( !item || m_transferring )
{
m_imagePreview->clear();
return;
}
ImageListItem* pitem = static_cast<ImageListItem*>( item );
if ( !pitem ) return;
m_imagePreview->clear();
QString IdemIndexed = "file:" + pitem->pathSrc();
KUrl url( IdemIndexed );
if ( !url.isValid() )
return;
#if KDE_IS_VERSION(4,7,0)
KFileItemList items;
items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true));
KIO::PreviewJob* m_thumbJob = KIO::filePreview(items, QSize(m_imagePreview->height(), m_imagePreview->height()));
#else
KIO::PreviewJob* m_thumbJob = KIO::filePreview(url, m_imagePreview->height());
#endif
connect(m_thumbJob, SIGNAL(gotPreview(const KFileItem*,QPixmap)),
this, SLOT(gotImagePreview(const KFileItem*,QPixmap)) );
}
示例7: synchronousDel
bool TrashImpl::synchronousDel( const TQString& path, bool setLastErrorCode, bool isDir )
{
const int oldErrorCode = m_lastErrorCode;
const TQString oldErrorMsg = m_lastErrorMessage;
KURL url;
url.setPath( path );
// First ensure that all dirs have u+w permissions,
// otherwise we won't be able to delete files in them (#130780).
if ( isDir ) {
kdDebug() << k_funcinfo << "chmod'ing " << url << endl;
KFileItem fileItem( url, "inode/directory", KFileItem::Unknown );
KFileItemList fileItemList;
fileItemList.append( &fileItem );
TDEIO::ChmodJob* chmodJob = TDEIO::chmod( fileItemList, 0200, 0200, TQString::null, TQString::null, true /*recursive*/, false /*showProgressInfo*/ );
connect( chmodJob, TQT_SIGNAL( result(TDEIO::Job *) ),
this, TQT_SLOT( jobFinished(TDEIO::Job *) ) );
tqApp->eventLoop()->enterLoop();
}
kdDebug() << k_funcinfo << "deleting " << url << endl;
TDEIO::DeleteJob *job = TDEIO::del( url, false, false );
connect( job, TQT_SIGNAL( result(TDEIO::Job *) ),
this, TQT_SLOT( jobFinished(TDEIO::Job *) ) );
tqApp->eventLoop()->enterLoop();
bool ok = m_lastErrorCode == 0;
if ( !setLastErrorCode ) {
m_lastErrorCode = oldErrorCode;
m_lastErrorMessage = oldErrorMsg;
}
return ok;
}
示例8: fileItemList
// caller needs to delete the returned list!
static KFileItemList * fileItemList( const TDECmdLineArgs *args )
{
KFileItemList * items = new KFileItemList();
items->setAutoDelete( true );
for ( int i = 0; i < args->count(); i++ )
items->append( new KFileItem( KFileItem::Unknown,
KFileItem::Unknown,
args->url( i ) ));
return items;
}
示例9: slotGenerate
void PreviewTest::slotGenerate()
{
KFileItemList items;
items.append(KFileItem(QUrl::fromUserInput(m_url->text())));
KIO::PreviewJob *job = KIO::filePreview(items, QSize(m_preview->width(), m_preview->height()));
connect(job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), SLOT(slotPreview(KFileItem,QPixmap)));
connect(job, SIGNAL(failed(KFileItem)), SLOT(slotFailed()));
}
示例10: slotResult
void KSysinfoPart::slotResult( KIO::Job *job )
{
KIO::StatJob *sjob = dynamic_cast<KIO::StatJob*>( job );
if (!job)
return;
KFileItem item(sjob->statResult(), sjob->url());
KFileItemList list;
list.append(&item);
emit browserExtension()->popupMenu( 0, QCursor::pos(), list );
}
示例11: contextMenuEvent
void IconView::contextMenuEvent( QContextMenuEvent* event )
{
QModelIndex index = indexAt( event->pos() );
if ( !index.isValid() || m_selectionModel->selectedIndexes().isEmpty() ) {
QMenu* menu = new QMenu;
menu->addAction( m_actionCollection.action( "new_menu" ) );
menu->addSeparator();
menu->addAction( m_actionCollection.action( "undo" ) );
menu->addAction( m_actionCollection.action( "paste" ) );
menu->addSeparator();
menu->addAction( m_actionCollection.action( "refresh" ) );
menu->addSeparator();
menu->addAction( m_actionCollection.action( "wallpaper" ) );
if ( event->reason() == QContextMenuEvent::Keyboard )
menu->exec( QPoint( 0, 0 ) );
else
menu->exec( event->pos() );
delete menu;
return;
}
KFileItemList items;
foreach ( const QModelIndex &index, m_selectionModel->selectedIndexes() ) {
KFileItem item = m_model->itemForIndex( m_proxyModel->mapToSource( index ) );
if ( !item.isNull() )
items.append( item );
}
QAction* pasteTo = m_actionCollection.action( "pasteto" );
if ( pasteTo ) {
pasteTo->setEnabled( m_actionCollection.action( "paste" )->isEnabled() );
pasteTo->setText( m_actionCollection.action( "paste" )->text() );
}
QList<QAction*> editActions;
editActions.append( m_actionCollection.action( "rename" ) );
editActions.append( m_actionCollection.action( "trash" ) );
KConfigGroup configGroup( KGlobal::config(), "KDE" );
bool showDeleteCommand = configGroup.readEntry( "ShowDeleteCommand", false );
if ( showDeleteCommand )
editActions.append( m_actionCollection.action( "del" ) );
KParts::BrowserExtension::ActionGroupMap actionGroups;
actionGroups.insert( "editactions", editActions );
KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::ShowProperties;
flags |= KParts::BrowserExtension::ShowUrlOperations;
KonqPopupMenu* contextMenu = new KonqPopupMenu( items, KUrl(QDir::homePath()), m_actionCollection, m_newMenu,
KonqPopupMenu::ShowNewWindow, flags,
QApplication::desktop(),
KBookmarkManager::userBookmarksManager(),
actionGroups );
contextMenu->exec( event->pos() );
delete contextMenu;
}
示例12: properties
void CFontFileListView::properties()
{
QList<QTreeWidgetItem *> items(selectedItems());
QTreeWidgetItem *item;
KFileItemList files;
foreach(item, items)
if(item->parent())
files.append(KFileItem(KUrl::fromPath(item->text(0)),
KMimeType::findByPath(item->text(0))->name(),
item->text(COL_LINK).isEmpty() ? S_IFREG : S_IFLNK));
if(files.count())
{
KPropertiesDialog dlg(files, this);
dlg.exec();
}
}
示例13: updatePreviews
void IconManager::updatePreviews()
{
if (!m_showPreview) {
return;
}
killPreviewJobs();
m_pendingItems.clear();
m_dispatchedItems.clear();
KFileItemList itemList;
const int rowCount = m_model->rowCount();
for (int row = 0; row < rowCount; ++row) {
const QModelIndex index = m_model->index(row, 0);
KFileItem item = m_model->itemForIndex(index);
itemList.append(item);
}
generatePreviews(itemList);
}
示例14: thumbnails
void Interface::thumbnails(const KUrl::List& list, int size)
{
PrintWarningMessageFeature("HostSupportsThumbnails");
#if KDE_IS_VERSION(4,7,0)
KFileItemList items;
for (KUrl::List::ConstIterator it = list.begin() ; it != list.end() ; ++it)
{
if ((*it).isValid())
items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, *it, true));
}
KIO::PreviewJob* job = KIO::filePreview(items, QSize(size, size));
#else
KIO::PreviewJob *job = KIO::filePreview(list, size);
#endif
connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)),
this, SLOT(gotKDEPreview(KFileItem,QPixmap)));
connect(job, SIGNAL(failed(KFileItem)),
this, SLOT(failedKDEPreview(KFileItem)));
}
示例15: performDeleteCurrentImage
void KuickShow::performDeleteCurrentImage(QWidget *parent)
{
assert(fileWidget != 0L);
KFileItemList list;
KFileItem *item = fileWidget->getCurrentItem(false);
list.append (item);
if (KMessageBox::warningContinueCancel(
parent,
i18n("<qt>Do you really want to delete\n <b>'%1'</b>?</qt>").arg(item->url().pathOrURL()),
i18n("Delete File"),
KStdGuiItem::del(),
"Kuick_delete_current_image")
!= KMessageBox::Continue)
{
return;
}
tryShowNextImage();
fileWidget->del(list, false, false);
}