X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/2b951edfdf0fd3460c595ecb8aed180e1da920f7..2c689ca4f7c8dfe62c75dc3c93ac9df2f31c0a8c:/src/viewproperties.cpp diff --git a/src/viewproperties.cpp b/src/viewproperties.cpp index 9c4554e7a..319a06bc2 100644 --- a/src/viewproperties.cpp +++ b/src/viewproperties.cpp @@ -18,29 +18,42 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ -#include +#include "viewproperties.h" -#include -#include -#include +#include "dolphinsettings.h" +#include "dolphin_directoryviewpropertysettings.h" +#include "dolphin_generalsettings.h" #include #include #include #include -#include "viewproperties.h" -#include "dolphinsettings.h" -#include "dolphin_directoryviewpropertysettings.h" -#include "dolphin_generalsettings.h" +#ifdef HAVE_NEPOMUK + #include +#endif + +#include +#include +#include + +bool ViewProperties::m_nepomukSupport = false; #define FILE_NAME "/.directory" ViewProperties::ViewProperties(const KUrl& url) : - m_changedProps(false), - m_autoSave(true), - m_node(0) + m_changedProps(false), + 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(); @@ -160,7 +173,15 @@ void ViewProperties::setSorting(DolphinView::Sorting sorting) DolphinView::Sorting ViewProperties::sorting() const { - return static_cast(m_node->sorting()); + // If Nepomuk is not available, return SortByName as fallback if SortByRating + // or SortByTags is stored. + DolphinView::Sorting sorting = static_cast(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)