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 | |
| 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')
| -rw-r--r-- | src/views/dolphinitemlistcontainer.cpp | 1 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 27 | ||||
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 21 |
3 files changed, 47 insertions, 2 deletions
diff --git a/src/views/dolphinitemlistcontainer.cpp b/src/views/dolphinitemlistcontainer.cpp index 822439948..391dc648f 100644 --- a/src/views/dolphinitemlistcontainer.cpp +++ b/src/views/dolphinitemlistcontainer.cpp @@ -140,6 +140,7 @@ void DolphinItemListContainer::setItemLayout(KFileItemListView::Layout layout) m_fileItemListView->setScrollOrientation(Qt::Vertical); m_fileItemListView->setHeaderVisible(true); m_fileItemListView->setSupportsItemExpanding(DetailsModeSettings::expandableFolders()); + break; case KFileItemListView::CompactLayout: m_fileItemListView->setScrollOrientation(Qt::Horizontal); 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); } 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 { |
