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/settings | |
| 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/settings')
| -rw-r--r-- | src/settings/additionalinfodialog.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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 <config-nepomuk.h> + #include <KLocale> #include "kitemviews/kfileitemmodel.h" #include <QCheckBox> #include <QLabel> #include <QVBoxLayout> +#ifdef HAVE_NEPOMUK + #include <Nepomuk/ResourceManager> +#endif + AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, const QList<QByteArray>& 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<KFileItemModel::RoleInfo> 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); |
