┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/viewproperties.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-05-06 12:31:21 +0200
committerPeter Penz <[email protected]>2012-05-06 12:33:28 +0200
commit7f96282e41012a367b956f8a36758c32c51767c8 (patch)
tree7bfa9576d3ca06bacfce8543512a5cc5b95008ab /src/views/viewproperties.cpp
parent37bd2116cb1f30a8c465ece41f53ba099c2331a0 (diff)
Allow to remember view-properties for search-results
Until now it was only possible to adjust the view-properties for searching in general. Now the view-properties can be adjusted dependent on the query (e.g. images, documents, ...).
Diffstat (limited to 'src/views/viewproperties.cpp')
-rw-r--r--src/views/viewproperties.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp
index d19b3bfda..8dadf4e49 100644
--- a/src/views/viewproperties.cpp
+++ b/src/views/viewproperties.cpp
@@ -28,6 +28,7 @@
#include <KStandardDirs>
#include <KUrl>
+#include <QCryptographicHash>
#include <QDate>
#include <QFile>
#include <QFileInfo>
@@ -58,7 +59,7 @@ ViewProperties::ViewProperties(const KUrl& url) :
if (useGlobalViewProps) {
m_filePath = destinationDir("global");
} else if (url.protocol().contains("search")) {
- m_filePath = destinationDir("search");
+ m_filePath = destinationDir("search/") + directoryHashForUrl(url);
useDetailsViewWithPath = true;
} else if (url.protocol() == QLatin1String("trash")) {
m_filePath = destinationDir("trash");
@@ -436,3 +437,12 @@ bool ViewProperties::isPartOfHome(const QString& filePath)
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;
+}