[kde-doc-english] KDE

Christoph Feck christoph at maxiom.de
Tue Nov 9 20:47:07 CET 2010


SVN commit 1194750 by cfeck:

Allow to hide menu icons

I tested this for three weeks, and when I wanted to revert to the
old behavior, I was really shocked how cluttered the menus look
with icons :)

There are only two places, where I initally missed the icons:
- "Classic" KDE menu
- Konqueror Bookmarks menu

For those places, we could request icons by using the QAction
property, but this probably has to discussed with users.

Actually, I now like the classic menu not showing icons,
because it opens much faster without them. The bookmark
menu never was a problem speedwise.

See http://svn.reviewboard.kde.org/r/5609/
FEATURE: 253339
GUI:


 M  +22 -2     kdebase/workspace/kcontrol/style/finetuning.ui  
 M  +13 -0     kdebase/workspace/kcontrol/style/kcmstyle.cpp  
 M  +2 -0      kdelibs/kdeui/kernel/kglobalsettings.cpp  


--- trunk/KDE/kdebase/workspace/kcontrol/style/finetuning.ui #1194749:1194750
@@ -57,7 +57,27 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="3">
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_5">
+     <property name="text">
+      <string>Show icons in menus:</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+     <property name="buddy">
+      <cstring>cbIconsInMenus</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QCheckBox" name="cbIconsInMenus">
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="3">
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
       <string>Toolbars</string>
@@ -153,7 +173,7 @@
      </layout>
     </widget>
    </item>
-   <item row="3" column="0">
+   <item row="4" column="0">
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
--- trunk/KDE/kdebase/workspace/kcontrol/style/kcmstyle.cpp #1194749:1194750
@@ -255,6 +255,7 @@
 
     connect(cbStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
     connect(fineTuningUi.cbIconsOnButtons,     SIGNAL(toggled(bool)),   this, SLOT(setEffectsDirty()));
+    connect(fineTuningUi.cbIconsInMenus,     SIGNAL(toggled(bool)),   this, SLOT(setEffectsDirty()));
     connect(fineTuningUi.comboGraphicEffectsLevel, SIGNAL(activated(int)),   this, SLOT(setEffectsDirty()));
     connect(fineTuningUi.comboToolbarIcons,    SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
     connect(fineTuningUi.comboSecondaryToolbarIcons,    SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
@@ -375,11 +376,19 @@
     if ( !(m_bStyleDirty | m_bEffectsDirty ) )
         return;
 
+    const bool showMenuIcons = !QApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
+    if (fineTuningUi.cbIconsInMenus->isChecked() != showMenuIcons) {
+        KMessageBox::information(this,
+          i18n("<p>Changes to the visibilty of menu icons will only affect newly started applications.</p>"),
+          i18nc("@title:window", "Menu Icons Changed"), "MenuIconsChanged");
+    }
+
     // Save effects.
         KConfig      _config("kdeglobals", KConfig::NoGlobals);
         KConfigGroup config(&_config, "KDE");
     // Effects page
     config.writeEntry( "ShowIconsOnPushButtons", fineTuningUi.cbIconsOnButtons->isChecked());
+    config.writeEntry( "ShowIconsInMenuItems", fineTuningUi.cbIconsInMenus->isChecked());
     KConfigGroup g( &_config, "KDE-Global GUI Settings" );
     g.writeEntry( "GraphicEffectsLevel", fineTuningUi.comboGraphicEffectsLevel->itemData(fineTuningUi.comboGraphicEffectsLevel->currentIndex()));
 
@@ -479,6 +488,7 @@
     fineTuningUi.comboToolbarIcons->setCurrentIndex(toolbarButtonIndex("TextBesideIcon"));
     fineTuningUi.comboSecondaryToolbarIcons->setCurrentIndex(toolbarButtonIndex("TextBesideIcon"));
     fineTuningUi.cbIconsOnButtons->setChecked(true);
+    fineTuningUi.cbIconsInMenus->setChecked(true);
     fineTuningUi.comboGraphicEffectsLevel->setCurrentIndex(fineTuningUi.comboGraphicEffectsLevel->findData(((int) KGlobalSettings::graphicEffectsLevelDefault())));
     emit changed(true);
 }
@@ -710,6 +720,7 @@
 
     configGroup = config.group("KDE");
     fineTuningUi.cbIconsOnButtons->setChecked(configGroup.readEntry("ShowIconsOnPushButtons", true));
+    fineTuningUi.cbIconsInMenus->setChecked(configGroup.readEntry("ShowIconsInMenuItems", true));
 
     KConfigGroup graphicConfigGroup = config.group("KDE-Global GUI Settings");
     fineTuningUi.comboGraphicEffectsLevel->setCurrentIndex(fineTuningUi.comboGraphicEffectsLevel->findData(graphicConfigGroup.readEntry("GraphicEffectsLevel", ((int) KGlobalSettings::graphicEffectsLevel()))));
@@ -737,6 +748,8 @@
                             "Text is aligned below the icon.") );
     fineTuningUi.cbIconsOnButtons->setWhatsThis( i18n( "If you enable this option, KDE Applications will "
                             "show small icons alongside some important buttons.") );
+    fineTuningUi.cbIconsInMenus->setWhatsThis( i18n( "If you enable this option, KDE Applications will "
+                            "show small icons alongside most menu items.") );
     fineTuningUi.comboGraphicEffectsLevel->setWhatsThis( i18n( "If you enable this option, KDE Applications will "
                             "run internal animations.") );
 }
--- trunk/KDE/kdelibs/kdeui/kernel/kglobalsettings.cpp #1194749:1194750
@@ -1118,6 +1118,8 @@
     QApplication::setStartDragDistance(num);
     num = cg.readEntry("WheelScrollLines", QApplication::wheelScrollLines());
     QApplication::setWheelScrollLines(num);
+    bool showIcons = cg.readEntry("ShowIconsInMenuItems", !QApplication::testAttribute(Qt::AA_DontShowIconsInMenus));
+    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !showIcons);
 
     // KDE5: this seems fairly pointless
     emit q->settingsChanged(SETTINGS_QT);



More information about the kde-doc-english mailing list