本文整理汇总了C++中KFileItem::name方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItem::name方法的具体用法?C++ KFileItem::name怎么用?C++ KFileItem::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItem
的用法示例。
在下文中一共展示了KFileItem::name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterAcceptsRow
bool SortedDirModel::filterAcceptsRow(int row, const QModelIndex& parent) const
{
QModelIndex index = d->mSourceModel->index(row, 0, parent);
KFileItem fileItem = d->mSourceModel->itemForIndex(index);
MimeTypeUtils::Kinds kind = MimeTypeUtils::fileItemKind(fileItem);
if (d->mKindFilter != MimeTypeUtils::Kinds() && !(d->mKindFilter & kind)) {
return false;
}
if (kind != MimeTypeUtils::KIND_DIR && kind != MimeTypeUtils::KIND_ARCHIVE) {
int dotPos = fileItem.name().lastIndexOf('.');
if (dotPos >= 1) {
QString extension = fileItem.name().mid(dotPos + 1).toLower();
if (d->mBlackListedExtensions.contains(extension)) {
return false;
}
}
#ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE
if (!d->mSourceModel->semanticInfoAvailableForIndex(index)) {
Q_FOREACH(const AbstractSortedDirModelFilter * filter, d->mFilters) {
// Make sure we have semanticinfo, otherwise retrieve it and
// return false, we will be called again later when it is
// there.
if (filter->needsSemanticInfo()) {
d->mSourceModel->retrieveSemanticInfoForIndex(index);
return false;
}
}
}
示例2: KDialog
HgRenameDialog::HgRenameDialog(const KFileItem &source, QWidget *parent):
KDialog(parent, Qt::Dialog),
m_source(source.name()),
m_source_dir(source.url().directory())
{
this->setCaption(i18nc("@title:window",
"<application>Hg</application> Rename"));
this->setButtons(KDialog::Ok | KDialog::Cancel);
this->setDefaultButton(KDialog::Ok);
this->setButtonText(KDialog::Ok, i18nc("@action:button", "Rename"));
QFrame *frame = new QFrame(this);
QGridLayout *mainLayout = new QGridLayout(frame);
QLabel *sourceLabel = new QLabel(i18nc("@label:label to source file",
"Source "), frame);
QLabel *sourceFileLabel = new QLabel("<b>" + m_source + "</b>");
mainLayout->addWidget(sourceLabel, 0, 0);
mainLayout->addWidget(sourceFileLabel, 0, 1);
QLabel *destinationLabel
= new QLabel(i18nc("@label:rename", "Rename to "), frame);
m_destinationFile = new KLineEdit(m_source, frame);
mainLayout->addWidget(destinationLabel, 1, 0);
mainLayout->addWidget(m_destinationFile, 1, 1);
frame->setLayout(mainLayout);
setMainWidget(frame);
m_destinationFile->setFocus();
m_destinationFile->selectAll();
connect(m_destinationFile, SIGNAL(textChanged(const QString &)),
this, SLOT(slotTextChanged(const QString &)));
}
示例3: setCurrentItem
void KFileView::setCurrentItem(const QString &filename )
{
if (!filename.isNull()) {
KFileItem *item;
for ( (item = firstFileItem()); item; item = nextItem( item ) ) {
if (item->name() == filename) {
setCurrentItem( item );
return;
}
}
}
kdDebug(kfile_area) << "setCurrentItem: no match found: " << filename << endl;
}
示例4: doExport
//
// private methods
//
void ExportSymlinks::doExport()
{
KFileItem * currentFile;
for ( currentFile = m_sourceFiles->first(); currentFile; currentFile = m_sourceFiles->next() ) {
QString symlink = QString("%1/%2").arg(*m_destinationDir).arg(currentFile->name());
m_progressDialog->setLabel(symlink);
kapp->processEvents();
createSymlink(currentFile->url().path(), symlink);
// in any case increase progress
m_progressDialog->progressBar()->advance(1);
// exit loop if cancel was called
if (m_cancelling) {
break;
}
}
m_progressDialog->hide();
}
示例5: filterAcceptsRow
bool
DirPlaylistTrackFilterProxyModel::filterAcceptsRow( int source_row,
const QModelIndex& source_parent ) const
{
QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
QVariant qvar = index.data( KDirModel::FileItemRole );
if( !qvar.canConvert<KFileItem>() )
return false;
KFileItem item = qvar.value<KFileItem>();
if( item.name() == "." )
return false;
if( item.isDir() ||
Playlists::isPlaylist( item.url() ) ||
MetaFile::Track::isTrack( item.url() ) )
{
return QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent );
}
return false;
}