[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/kickoff/applet
From:       Christian Loose <christian.loose () hamburg ! de>
Date:       2009-03-23 21:18:17
Message-ID: 1237843097.566522.18770.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 943463 by cloose:

Support to change the icon of the kickoff applet.

FEATURE: 182342
REVIEWED: http://reviewboard.kde.org/r/404/



 M  +23 -5     applet.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/applet/applet.cpp #943462:943463
@@ -31,6 +31,7 @@
 
 // KDE
 #include <KIcon>
+#include <KIconButton>
 #include <KDebug>
 #include <KConfigDialog>
 #include <KProcess>
@@ -57,6 +58,7 @@
 
     Kickoff::Launcher *launcher;
 
+    KIconButton *iconButton;
     QCheckBox *switchOnHoverCheckBox;
     QList<QAction*> actions;
     QAction* switcher;
@@ -93,7 +95,6 @@
 {
     KGlobal::locale()->insertCatalog("plasma_applet_launcher");
     setHasConfigurationInterface(true);
-    setPopupIcon("start-here-kde");
 }
 
 LauncherApplet::~LauncherApplet()
@@ -103,6 +104,9 @@
 
 void LauncherApplet::init()
 {
+    KConfigGroup cg = globalConfig();
+    setPopupIcon(cg.readEntry("icon", "start-here-kde"));
+
     if (KService::serviceByStorageId("kde4-kmenuedit.desktop")) {
         QAction* menueditor = new QAction(i18n("Menu Editor"), this);
         d->actions.append(menueditor);
@@ -141,14 +145,19 @@
 void LauncherApplet::createConfigurationInterface(KConfigDialog *parent)
 {
     QWidget *widget = new QWidget(parent);
-    QVBoxLayout *widgetLayout = new QVBoxLayout(widget);
+    QGridLayout *widgetLayout = new QGridLayout(widget);
     widget->setLayout(widgetLayout);
 
+    QLabel *iconLabel = new QLabel(i18n("Icon:"), widget);
+    widgetLayout->addWidget(iconLabel, 0, 0, Qt::AlignRight);
+    d->iconButton = new KIconButton(widget);
+    d->iconButton->setIcon(popupIcon());
+    iconLabel->setBuddy(d->iconButton);
+    widgetLayout->addWidget(d->iconButton, 0, 1);
+
     d->switchOnHoverCheckBox = new QCheckBox(i18n("Switch tabs on hover"), widget);
-    widgetLayout->addWidget(d->switchOnHoverCheckBox);
+    widgetLayout->addWidget(d->switchOnHoverCheckBox, 1, 0);
 
-    widgetLayout->addStretch();
-
     connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
     connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
     parent->addPage(widget, i18n("General"), icon());
@@ -179,13 +188,22 @@
 {
     bool switchTabsOnHover = d->switchOnHoverCheckBox->isChecked();
 
+    const QString iconname = d->iconButton->icon();
+
     // TODO: should this be moved into Launcher as well? perhaps even the config itself?
     KConfigGroup cg = globalConfig();
     cg.writeEntry("SwitchTabsOnHover", switchTabsOnHover);
+    if (!iconname.isEmpty()) {
+        cg.writeEntry("icon", iconname);
+    }
     emit configNeedsSaving();
 
     d->createLauncher();
     d->launcher->setSwitchTabsOnHover(switchTabsOnHover);
+    if (!iconname.isEmpty()) {
+        setPopupIcon(iconname);
+        d->initToolTip();
+    }
 }
 
 QList<QAction*> LauncherApplet::contextualActions()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic