From a4ede4e0ebaf0bba57da8fc2924577f1a8ff7b54 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sun, 1 Apr 2012 16:42:46 +0200 Subject: 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 --- src/views/dolphinview.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/views/dolphinview.cpp') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index ab81316e1..78fd56d50 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -20,6 +20,8 @@ #include "dolphinview.h" +#include + #include #include #include @@ -70,6 +72,10 @@ #include "views/tooltips/tooltipmanager.h" #include "zoomlevelinfo.h" +#ifdef HAVE_NEPOMUK + #include +#endif + namespace { const int MaxModeEnum = DolphinView::CompactView; }; @@ -784,6 +790,16 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) KItemListView* view = m_container->controller()->view(); const QSet visibleRolesSet = view->visibleRoles().toSet(); + 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 + QString groupName; QMenu* groupMenu = 0; @@ -811,6 +827,11 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) action->setCheckable(true); action->setChecked(visibleRolesSet.contains(info.role)); action->setData(info.role); + + const bool enable = (!info.requiresNepomuk && !info.requiresIndexer) || + (info.requiresNepomuk && nepomukRunning) || + (info.requiresIndexer && indexingEnabled); + action->setEnabled(enable); } menu->addSeparator(); @@ -861,8 +882,10 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) props.setVisibleRoles(visibleRoles); QList columnWidths; - foreach (const QByteArray& role, view->visibleRoles()) { - columnWidths.append(header->columnWidth(role)); + if (!header->automaticColumnResizing()) { + foreach (const QByteArray& role, view->visibleRoles()) { + columnWidths.append(header->columnWidth(role)); + } } props.setHeaderColumnWidths(columnWidths); } -- cgit v1.3