From 27a4b768714efb8a2b78f4fcb155e267cc1da05a Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 10 Mar 2009 19:21:21 +0000 Subject: allow to hide the rating, comments and tags of the Information Panel svn path=/trunk/KDE/kdebase/apps/; revision=937915 --- src/panels/information/informationpanel.cpp | 40 ++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'src/panels/information/informationpanel.cpp') diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index a28b37a9e..2b3124b3c 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -57,6 +57,7 @@ #include #include +#include "dolphin_informationpanelsettings.h" #include "settings/dolphinsettings.h" #include "metadatawidget.h" #include "metatextlabel.h" @@ -227,7 +228,18 @@ void InformationPanel::contextMenuEvent(QContextMenuEvent* event) } KMenu popup(this); - popup.addTitle(i18nc("@title:menu", "Shown Information")); + + QAction* ratingAction = popup.addAction(i18nc("@action:inmenu", "Rating")); + ratingAction->setCheckable(true); + ratingAction->setChecked(InformationPanelSettings::showRating()); + + QAction* commentAction = popup.addAction(i18nc("@action:inmenu", "Comment")); + commentAction->setCheckable(true); + commentAction->setChecked(InformationPanelSettings::showComment()); + + QAction* tagsAction = popup.addAction(i18nc("@action:inmenu", "Tags")); + tagsAction->setCheckable(true); + tagsAction->setChecked(InformationPanelSettings::showTags()); KConfig config("kmetainformationrc", KConfig::NoGlobals); KConfigGroup settings = config.group("Show"); @@ -275,20 +287,30 @@ void InformationPanel::contextMenuEvent(QContextMenuEvent* event) ++it; } - if (actions.count() == 0) { - return; - } + if (actions.count() > 0) { + popup.addSeparator(); - // add all items alphabetically sorted to the popup - qSort(actions.begin(), actions.end(), lessThan); - foreach (QAction* action, actions) { - popup.addAction(action); + // add all items alphabetically sorted to the popup + qSort(actions.begin(), actions.end(), lessThan); + foreach (QAction* action, actions) { + popup.addAction(action); + } } // Open the popup and adjust the settings for the // selected action. QAction* action = popup.exec(QCursor::pos()); - if (action != 0) { + if (action == 0) { + return; + } + + if (action == ratingAction) { + // TODO + } else if (action == commentAction) { + // TODO + } else if (action == tagsAction) { + // TODO + } else { settings.writeEntry(action->data().toString(), action->isChecked()); settings.sync(); showMetaInfo(); -- cgit v1.3