+ QString sortRole = m_node->sortRole();
+ if (sortRole == QLatin1String("name")) {
+ sortRole = QLatin1String("text");
+ }
+
+ m_node->setVisibleRoles(visibleRoles);
+ m_node->setSortRole(sortRole);
+ m_node->setVersion(NameRolePropertiesVersion);
+ update();
+}
+
+bool ViewProperties::isPartOfHome(const QString& filePath)
+{
+ // For performance reasons cache the path in a static QString
+ // (see QDir::homePath() for more details)
+ static QString homePath;
+ if (homePath.isEmpty()) {
+ homePath = QDir::homePath();
+ Q_ASSERT(!homePath.isEmpty());
+ }
+
+ return filePath.startsWith(homePath);
+}
+
+QString ViewProperties::directoryHashForUrl(const KUrl& url)
+{
+ const QByteArray hashValue = QCryptographicHash::hash(url.prettyUrl().toLatin1(),
+ QCryptographicHash::Sha1);
+ QString hashString = hashValue.toBase64();
+ hashString.replace('/', '-');
+ return hashString;
+}
+
+KUrl ViewProperties::mirroredDirectory()
+{
+ QString basePath = KGlobal::mainComponent().componentName();
+ basePath.append("/view_properties/");
+ return KUrl(KStandardDirs::locateLocal("data", basePath));