本文整理汇总了C++中KFileItemList::targetUrlList方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItemList::targetUrlList方法的具体用法?C++ KFileItemList::targetUrlList怎么用?C++ KFileItemList::targetUrlList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItemList
的用法示例。
在下文中一共展示了KFileItemList::targetUrlList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
}