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/settings/additionalinfodialog.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/settings') diff --git a/src/settings/additionalinfodialog.cpp b/src/settings/additionalinfodialog.cpp index 9e5f170da..3cac35b7b 100644 --- a/src/settings/additionalinfodialog.cpp +++ b/src/settings/additionalinfodialog.cpp @@ -19,12 +19,18 @@ #include "additionalinfodialog.h" +#include + #include #include "kitemviews/kfileitemmodel.h" #include #include #include +#ifdef HAVE_NEPOMUK + #include +#endif + AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, const QList& visibleRoles) : KDialog(parent), @@ -44,12 +50,30 @@ AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, header->setWordWrap(true); // Add checkboxes + 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 + m_listWidget = new QListWidget(mainWidget); m_listWidget->setSelectionMode(QAbstractItemView::NoSelection); const QList rolesInfo = KFileItemModel::rolesInformation(); foreach (const KFileItemModel::RoleInfo& info, rolesInfo) { QListWidgetItem* item = new QListWidgetItem(info.translation, m_listWidget); item->setCheckState(visibleRoles.contains(info.role) ? Qt::Checked : Qt::Unchecked); + + const bool enable = (!info.requiresNepomuk && !info.requiresIndexer) || + (info.requiresNepomuk && nepomukRunning) || + (info.requiresIndexer && indexingEnabled); + + if (!enable) { + item->setFlags(item->flags() & ~Qt::ItemIsEnabled); + } } QVBoxLayout* layout = new QVBoxLayout(mainWidget); -- cgit v1.3