diff options
| author | Peter Penz <[email protected]> | 2012-04-01 16:42:46 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-04-01 16:46:54 +0200 |
| commit | a4ede4e0ebaf0bba57da8fc2924577f1a8ff7b54 (patch) | |
| tree | 954d5394838230f20646f17727460aaae1fbcb34 /src/views/dolphinviewactionhandler.cpp | |
| parent | aced85db1f7c72268860f0368402cf97f34e55c2 (diff) | |
Allow showing Nepomuk metadata inside views
Metadata like image-size, rating, comments, tags, ... can be shown
now in the view (e.g. as column in the Details mode).
Still open: The rating-information needs to be shown as stars.
In the context of this feature also the following bugs have been
fixed:
- Fix visual glitches in the header of the Details mode
- Improve the minimum column width calculation to respect also
the headling and not only the content
BUG: 296782
FIXED-IN: 4.9.0
Diffstat (limited to 'src/views/dolphinviewactionhandler.cpp')
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index aead11d25..eb127e2f7 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -20,6 +20,8 @@ #include "dolphinviewactionhandler.h" +#include <config-nepomuk.h> + #include "settings/viewpropertiesdialog.h" #include "views/dolphinview.h" #include "views/zoomlevelinfo.h" @@ -37,6 +39,10 @@ #include <KRun> #include <KPropertiesDialog> +#ifdef HAVE_NEPOMUK + #include <Nepomuk/ResourceManager> +#endif + #include <KDebug> DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent) : @@ -228,6 +234,16 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt KActionMenu* groupMenu = 0; QActionGroup* groupMenuGroup = 0; + bool nepomukRunning = false; + bool indexingEnabled = false; +#ifdef HAVE_NEPOMUK + nepomukRunning = (Nepomuk::ResourceManager::instance()->init() == 0); + if (nepomukRunning) { + KConfig config("nepomukserverrc"); + indexingEnabled = config.group("Service-nepomukfileindexer").readEntry("autostart", false); + } +#endif + const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation(); foreach (const KFileItemModel::RoleInfo& info, rolesInfo) { if (!isSortGroup && info.role == "name") { @@ -265,6 +281,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt action->setText(info.translation); action->setData(info.role); + const bool enable = (!info.requiresNepomuk && !info.requiresIndexer) || + (info.requiresNepomuk && nepomukRunning) || + (info.requiresIndexer && indexingEnabled); + action->setEnabled(enable); + if (isSortGroup) { m_sortByActions.insert(info.role, action); } else { |
