connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl)));
+ connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
// Apply default roles that should be determined
resetRoles();
m_requestRole[NameRole] = true;
m_requestRole[IsDirRole] = true;
+ m_requestRole[IsLinkRole] = true;
m_roles.insert("text");
m_roles.insert("isDir");
+ m_roles.insert("isLink");
// For slow KIO-slaves like used for searching it makes sense to show results periodically even
// before the completed() or canceled() signal has been emitted.
}
m_itemData[index]->values = currentValues;
+ if (changedRoles.contains("text")) {
+ KUrl url = m_itemData[index]->item.url();
+ url.setFileName(currentValues["text"].toString());
+ m_itemData[index]->item.setUrl(url);
+ }
+
emit itemsChanged(KItemRangeList() << KItemRange(index, 1), changedRoles);
if (changedRoles.contains(sortRole())) {
const KFileItem item = it.next();
if (m_filter.matches(item)) {
newVisibleItems.append(item);
- m_filteredItems.remove(item);
+ it.remove();
}
}
// Note that the parent folder must be expanded before any of its subfolders become visible.
// Therefore, some URLs in m_restoredExpandedUrls might not be visible yet
// -> we expand the first visible URL we find in m_restoredExpandedUrls.
- foreach(const KUrl& url, m_urlsToExpand) {
+ foreach (const KUrl& url, m_urlsToExpand) {
const int index = m_items.value(url, -1);
if (index >= 0) {
m_urlsToExpand.remove(url);
insertedCount = 0;
}
- // Insert item at the position targetIndex by transfering
+ // Insert item at the position targetIndex by transferring
// the ownership of the item-data from sortedItems to m_itemData.
// m_items will be inserted after the loop (see comment below)
m_itemData.insert(targetIndex, sortedItems.at(sourceIndex));
// Insert internal roles (take care to synchronize the implementation
// with KFileItemModel::roleForType() in case if a change is done).
roles.insert("isDir", IsDirRole);
+ roles.insert("isLink", IsLinkRole);
roles.insert("isExpanded", IsExpandedRole);
roles.insert("isExpandable", IsExpandableRole);
roles.insert("expandedParentsCount", ExpandedParentsCountRole);
// Insert internal roles (take care to synchronize the implementation
// with KFileItemModel::typeForRole() in case if a change is done).
roles.insert(IsDirRole, "isDir");
+ roles.insert(IsLinkRole, "isLink");
roles.insert(IsExpandedRole, "isExpanded");
roles.insert(IsExpandableRole, "isExpandable");
roles.insert(ExpandedParentsCountRole, "expandedParentsCount");
data.insert("isDir", isDir);
}
+ if (m_requestRole[IsLinkRole]) {
+ const bool isLink = item.isLink();
+ data.insert("isLink", isLink);
+ }
+
if (m_requestRole[NameRole]) {
data.insert("text", item.text());
}
if (item.url().protocol() == QLatin1String("trash")) {
path = item.entry().stringValue(KIO::UDSEntry::UDS_EXTRA);
} else {
+ // For performance reasons cache the home-path in a static QString
+ // (see QDir::homePath() for more details)
+ static QString homePath;
+ if (homePath.isEmpty()) {
+ homePath = QDir::homePath();
+ }
+
path = item.localPath();
+ if (path.startsWith(homePath)) {
+ path.replace(0, homePath.length(), QLatin1Char('~'));
+ }
}
const int index = path.lastIndexOf(item.text());
{
QElapsedTimer timer;
timer.start();
- foreach (KFileItem item, items) {
+ foreach (KFileItem item, items) { // krazy:exclude=foreach
item.determineMimeType();
if (timer.elapsed() > timeout) {
// Don't block the user interface, let the remaining items