本文整理汇总了C++中KFileItemList::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItemList::isEmpty方法的具体用法?C++ KFileItemList::isEmpty怎么用?C++ KFileItemList::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItemList
的用法示例。
在下文中一共展示了KFileItemList::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelection
void InformationPanel::setSelection(const KFileItemList& selection)
{
if (!isVisible()) {
return;
}
if (selection.isEmpty() && m_selection.isEmpty()) {
// The selection has not really changed, only the current index.
// QItemSelectionModel emits a signal in this case and it is less
// expensive doing the check this way instead of patching
// DolphinView::emitSelectionChanged().
return;
}
m_selection = selection;
m_fileItem = KFileItem();
const int count = selection.count();
if (count == 0) {
if (!isEqualToShownUrl(url())) {
m_shownUrl = url();
showItemInfo();
}
} else {
if ((count == 1) && !selection.first().url().isEmpty()) {
m_urlCandidate = selection.first().url();
}
m_infoTimer->start();
}
}
示例2: determineMimeTypeAndGroup
void KFileItemListPropertiesPrivate::determineMimeTypeAndGroup() const
{
if (!m_items.isEmpty()) {
m_mimeType = m_items.first().mimetype();
m_mimeGroup = m_mimeType.left(m_mimeType.indexOf('/'));
}
foreach (const KFileItem &item, m_items) {
const QString itemMimeType = item.mimetype();
// Determine if common mimetype among all items
if (m_mimeType != itemMimeType) {
m_mimeType.clear();
if (m_mimeGroup != itemMimeType.left(itemMimeType.indexOf('/'))) {
m_mimeGroup.clear(); // mimetype groups are different as well!
}
}
}
}
示例3: insertNewFiles
void HiddenFileView::insertNewFiles(const KFileItemList &newone)
{
if ( newone.isEmpty() )
return;
KFileItem *tmp;
int j=0;
for (KFileItemListIterator it(newone); (tmp = it.current()); ++it)
{
j++;
bool hidden = matchHidden(tmp->text());
bool veto = matchVeto(tmp->text());
bool vetoOplock = matchVetoOplock(tmp->text());
new HiddenListViewItem( _dlg->hiddenListView, tmp, hidden, veto, vetoOplock );
}
}
示例4: setItems
void KFileItemListPropertiesPrivate::setItems(const KFileItemList &items)
{
const bool initialValue = !items.isEmpty();
m_items = items;
m_urlList = items.targetUrlList();
m_supportsReading = initialValue;
m_supportsDeleting = initialValue;
m_supportsWriting = initialValue;
m_supportsMoving = initialValue;
m_isDirectory = initialValue;
m_isLocal = true;
m_mimeType.clear();
m_mimeGroup.clear();
QFileInfo parentDirInfo;
foreach (const KFileItem &item, items) {
const QUrl url = item.url();
m_isLocal = m_isLocal && url.isLocalFile();
m_supportsReading = m_supportsReading && KProtocolManager::supportsReading(url);
m_supportsDeleting = m_supportsDeleting && KProtocolManager::supportsDeleting(url);
m_supportsWriting = m_supportsWriting && KProtocolManager::supportsWriting(url) && item.isWritable();
m_supportsMoving = m_supportsMoving && KProtocolManager::supportsMoving(url);
// For local files we can do better: check if we have write permission in parent directory
// TODO: if we knew about the parent KFileItem, we could even do that for remote protocols too
if (m_isLocal && (m_supportsDeleting || m_supportsMoving)) {
const QString directory = url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).path();
if (parentDirInfo.filePath() != directory) {
parentDirInfo.setFile(directory);
}
if (!parentDirInfo.isWritable()) {
m_supportsDeleting = false;
m_supportsMoving = false;
}
}
if (m_isDirectory && !item.isDir()) {
m_isDirectory = false;
}
}
}