┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-09-19 06:24:14 +0000
committerPeter Penz <[email protected]>2007-09-19 06:24:14 +0000
commitad2facc493dbed42a22385d5a26b1f960d06c1f6 (patch)
tree39163f99c335a6119364111b597c189b1a7bb66f /src
parent9ed99a5ebb93eb4730da5ff0b1f4d54e579b1aeb (diff)
If Nepomuk is (temporary) not available use SortByName as fallback for SortByTags/SortByRating. Thanks to Rafael for pointing this out...
svn path=/trunk/KDE/kdebase/apps/; revision=714289
Diffstat (limited to 'src')
-rw-r--r--src/viewproperties.cpp24
-rw-r--r--src/viewproperties.h2
2 files changed, 25 insertions, 1 deletions
diff --git a/src/viewproperties.cpp b/src/viewproperties.cpp
index 835be2aad..319a06bc2 100644
--- a/src/viewproperties.cpp
+++ b/src/viewproperties.cpp
@@ -29,10 +29,16 @@
#include <kstandarddirs.h>
#include <kurl.h>
+#ifdef HAVE_NEPOMUK
+ #include <nepomuk/resourcemanager.h>
+#endif
+
#include <QDate>
#include <QFile>
#include <QFileInfo>
+bool ViewProperties::m_nepomukSupport = false;
+
#define FILE_NAME "/.directory"
ViewProperties::ViewProperties(const KUrl& url) :
@@ -40,6 +46,14 @@ ViewProperties::ViewProperties(const KUrl& url) :
m_autoSave(true),
m_node(0)
{
+#ifdef HAVE_NEPOMUK
+ static bool checkedNepomukSupport = false;
+ if (!checkedNepomukSupport) {
+ m_nepomukSupport = !Nepomuk::ResourceManager::instance()->init();
+ checkedNepomukSupport = true;
+ }
+#endif
+
KUrl cleanUrl(url);
cleanUrl.cleanPath();
m_filepath = cleanUrl.path();
@@ -159,7 +173,15 @@ void ViewProperties::setSorting(DolphinView::Sorting sorting)
DolphinView::Sorting ViewProperties::sorting() const
{
- return static_cast<DolphinView::Sorting>(m_node->sorting());
+ // If Nepomuk is not available, return SortByName as fallback if SortByRating
+ // or SortByTags is stored.
+ DolphinView::Sorting sorting = static_cast<DolphinView::Sorting>(m_node->sorting());
+ const bool sortByName = !m_nepomukSupport &&
+ ((sorting == DolphinView::SortByRating) || (sorting == DolphinView::SortByTags));
+ if (sortByName) {
+ sorting = DolphinView::SortByName;
+ }
+ return sorting;
}
void ViewProperties::setSortOrder(Qt::SortOrder sortOrder)
diff --git a/src/viewproperties.h b/src/viewproperties.h
index 64a2fad25..cba68ad3c 100644
--- a/src/viewproperties.h
+++ b/src/viewproperties.h
@@ -124,6 +124,8 @@ private:
bool m_autoSave;
QString m_filepath;
ViewPropertySettings* m_node;
+
+ static bool m_nepomukSupport;
};
#endif