]> cloud.milkyroute.net Git - dolphin.git/commitdiff
allow to hide the rating, comments and tags of the Information Panel
authorPeter Penz <peter.penz19@gmail.com>
Tue, 10 Mar 2009 19:21:21 +0000 (19:21 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 10 Mar 2009 19:21:21 +0000 (19:21 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=937915

src/CMakeLists.txt
src/panels/information/dolphin_informationpanelsettings.kcfg [new file with mode: 0644]
src/panels/information/dolphin_informationpanelsettings.kcfgc [new file with mode: 0644]
src/panels/information/informationpanel.cpp

index c1daf5e8b9c3d783b21d716be754cfee97dabb99..f2d9032fa416b2799b7366f04ef1c9a617785a39 100644 (file)
@@ -135,7 +135,8 @@ set(dolphin_SRCS
     )
 
 kde4_add_kcfg_files(dolphin_SRCS
-    panels/folders/dolphin_folderspanelsettings.kcfgc)
+    panels/folders/dolphin_folderspanelsettings.kcfgc
+    panels/information/dolphin_informationpanelsettings.kcfgc)
 
 if(Nepomuk_FOUND)
 set(dolphin_SRCS
diff --git a/src/panels/information/dolphin_informationpanelsettings.kcfg b/src/panels/information/dolphin_informationpanelsettings.kcfg
new file mode 100644 (file)
index 0000000..b4c30b2
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
+<kcfg>
+    <kcfgfile name="dolphinrc"/>
+    <group name="InformationPanel">
+        <entry name="showRating" type="Bool">
+            <label context="@label">Show rating</label>
+            <default>true</default>
+        </entry>
+        <entry name="showComment" type="Bool">
+            <label context="@label">Show comment</label>
+            <default>true</default>
+        </entry>
+        <entry name="showTags" type="Bool">
+            <label context="@label">Show tags</label>
+            <default>true</default>
+        </entry>
+    </group>
+</kcfg>
diff --git a/src/panels/information/dolphin_informationpanelsettings.kcfgc b/src/panels/information/dolphin_informationpanelsettings.kcfgc
new file mode 100644 (file)
index 0000000..84a2cff
--- /dev/null
@@ -0,0 +1,4 @@
+File=dolphin_informationpanelsettings.kcfg
+ClassName=InformationPanelSettings
+Singleton=true
+Mutators=true
index a28b37a9e4e75cbc27d0ba95446a5864a2f3fc4d..2b3124b3cff09427867029b6adae886bdd49f4ec 100644 (file)
@@ -57,6 +57,7 @@
 #include <QScrollBar>
 #include <QVBoxLayout>
 
+#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();