┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-04-01 16:42:46 +0200
committerPeter Penz <[email protected]>2012-04-01 16:46:54 +0200
commita4ede4e0ebaf0bba57da8fc2924577f1a8ff7b54 (patch)
tree954d5394838230f20646f17727460aaae1fbcb34 /src/views/dolphinview.cpp
parentaced85db1f7c72268860f0368402cf97f34e55c2 (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/dolphinview.cpp')
-rw-r--r--src/views/dolphinview.cpp27
1 files changed, 25 insertions, 2 deletions
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 <config-nepomuk.h>
+
#include <QAbstractItemView>
#include <QApplication>
#include <QBoxLayout>
@@ -70,6 +72,10 @@
#include "views/tooltips/tooltipmanager.h"
#include "zoomlevelinfo.h"
+#ifdef HAVE_NEPOMUK
+ #include <Nepomuk/ResourceManager>
+#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<QByteArray> 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<int> 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);
}