- previewAction->setChecked(InformationPanelSettings::showPreview());
-
- const bool metaDataAvailable = MetaDataWidget::metaDataAvailable();
-
- QAction* ratingAction = popup.addAction(i18nc("@action:inmenu", "Rating"));
- ratingAction->setIcon(KIcon("rating"));
- ratingAction->setCheckable(true);
- ratingAction->setChecked(InformationPanelSettings::showRating());
- ratingAction->setEnabled(metaDataAvailable);
-
- QAction* commentAction = popup.addAction(i18nc("@action:inmenu", "Comment"));
- commentAction->setIcon(KIcon("text-plain"));
- commentAction->setCheckable(true);
- commentAction->setChecked(InformationPanelSettings::showComment());
- commentAction->setEnabled(metaDataAvailable);
-
- QAction* tagsAction = popup.addAction(i18nc("@action:inmenu", "Tags"));
- tagsAction->setCheckable(true);
- tagsAction->setChecked(InformationPanelSettings::showTags());
- tagsAction->setEnabled(metaDataAvailable);
-
- KConfig config("kmetainformationrc", KConfig::NoGlobals);
- KConfigGroup settings = config.group("Show");
- initMetaInfoSettings(settings);
-
- QList<QAction*> actions;
-
- // Get all meta information labels that are available for
- // the currently shown file item and add them to the popup.
- Nepomuk::Resource res(m_item.url());
- QHash<QUrl, Nepomuk::Variant> properties = res.properties();
- QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin();
- while (it != properties.constEnd()) {
- Nepomuk::Types::Property prop(it.key());
- const QString key = prop.name();
-
- // Meta information provided by Nepomuk that is already
- // available from KFileItem should not be configurable.
- bool skip = (key == "fileExtension") ||
- (key == "name") ||
- (key == "sourceModified") ||
- (key == "size") ||
- (key == "mime type");
- if (!skip) {
- // Check whether there is already a meta information
- // having the same label. In this case don't show it
- // twice in the menu.
- foreach (const QAction* action, actions) {
- if (action->data().toString() == key) {
- skip = true;
- break;
- }
- }
- }
-
- if (!skip) {
- const QString label = tunedLabel(prop.label());
- QAction* action = new QAction(label, &popup);
- action->setCheckable(true);
- action->setChecked(settings.readEntry(key, true));
- action->setData(key);
- actions.append(action);
- }
-
- ++it;
- }