diff options
Diffstat (limited to 'kcontrol/kicker')
-rw-r--r-- | kcontrol/kicker/main.cpp | 12 | ||||
-rw-r--r-- | kcontrol/kicker/main.h | 1 | ||||
-rw-r--r-- | kcontrol/kicker/menutab.ui | 588 | ||||
-rw-r--r-- | kcontrol/kicker/menutab_impl.cpp | 62 | ||||
-rw-r--r-- | kcontrol/kicker/menutab_impl.h | 4 |
5 files changed, 487 insertions, 180 deletions
diff --git a/kcontrol/kicker/main.cpp b/kcontrol/kicker/main.cpp index 4ef0f842f..021cfbdd9 100644 --- a/kcontrol/kicker/main.cpp +++ b/kcontrol/kicker/main.cpp @@ -132,6 +132,18 @@ void KickerConfig::init() configFileWatch->startScan(); } +void KickerConfig::restartKicker() +{ + // Tell kicker to restart + if (!kapp->dcopClient()->isAttached()) + { + kapp->dcopClient()->attach(); + } + QCString appname; + appname = "kicker"; + kapp->dcopClient()->send(appname, appname, "restart", ""); +} + void KickerConfig::notifyKicker() { kdDebug() << "KickerConfig::notifyKicker()" << endl; diff --git a/kcontrol/kicker/main.h b/kcontrol/kicker/main.h index cb585b077..1797f7637 100644 --- a/kcontrol/kicker/main.h +++ b/kcontrol/kicker/main.h @@ -43,6 +43,7 @@ public: QString configName(); void notifyKicker(); + void restartKicker(); QString quickHelp() const; KAboutData *aboutData(); diff --git a/kcontrol/kicker/menutab.ui b/kcontrol/kicker/menutab.ui index 8d49a7965..e64285767 100644 --- a/kcontrol/kicker/menutab.ui +++ b/kcontrol/kicker/menutab.ui @@ -143,6 +143,155 @@ </size> </property> </spacer> + <widget class="QCheckBox" row="0" column="0" colspan="2"> + <property name="name"> + <cstring>kcfg_ShowKMenuText</cstring> + </property> + <property name="text"> + <string>Display text in K Menu button</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>When this option is selected the text below will be shown in the K Menu button.</string> + </property> + </widget> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLineEdit" row="0" column="1" colspan="3"> + <property name="name"> + <cstring>kcfg_KMenuText</cstring> + </property> + <property name="maxLength"> + <number>35</number> + </property> + </widget> + <widget class="QLabel" row="3" column="0" colspan="2"> + <property name="name"> + <cstring>TextLabel1_3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Custom K Menu button icon:</string> + </property> + </widget> + <widget class="KPushButton" row="3" column="3" colspan="2"> + <property name="name"> + <cstring>btnCustomKMenuIcon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>26</width> + <height>26</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>26</width> + <height>26</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Text:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel1_3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Font:</string> + </property> + </widget> + <widget class="KFontRequester" row="2" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kcfg_ButtonFont</cstring> + </property> + </widget> + <spacer row="3" column="3"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>MinimumExpanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> <property name="name"> <cstring>m_editKMenuButton</cstring> @@ -194,187 +343,266 @@ </widget> </hbox> </widget> - <widget class="QGroupBox"> - <property name="name"> - <cstring>m_browserGroup</cstring> - </property> - <property name="title"> - <string>QuickBrowser Menus</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget" row="1" column="0"> - <property name="name"> - <cstring>Layout3</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>m_maxQuickBrowserItemsLabel</cstring> - </property> - <property name="text"> - <string>Ma&ximum number of entries:</string> - </property> - <property name="buddy" stdset="0"> - <cstring>kcfg_MaxEntries2</cstring> - </property> - <property name="whatsThis" stdset="0"> - <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> - </property> - </widget> - <widget class="KIntNumInput"> - <property name="name"> - <cstring>kcfg_MaxEntries2</cstring> - </property> - <property name="value"> - <number>30</number> - </property> - <property name="minValue"> - <number>10</number> - </property> - <property name="maxValue"> - <number>100</number> - </property> - <property name="whatsThis" stdset="0"> - <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> - </property> - </widget> - </hbox> - </widget> - <widget class="QCheckBox" row="0" column="0"> - <property name="name"> - <cstring>kcfg_ShowHiddenFiles</cstring> - </property> - <property name="text"> - <string>Show hidden fi&les</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0"> - <string>If this option is enabled, hidden files (i.e. files beginning with a dot) will be shown in the QuickBrowser menus.</string> - </property> - </widget> - <spacer row="0" column="1" rowspan="2" colspan="1"> - <property name="name"> - <cstring>Spacer7</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </grid> - </widget> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>m_pRecentOrderGroup</cstring> - </property> - <property name="title"> - <string>QuickStart Menu Items</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> </property> - <widget class="QLayoutWidget" row="2" column="0"> - <property name="name"> - <cstring>Layout4</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>TextLabel2</cstring> - </property> - <property name="text"> - <string>Maxim&um number of entries:</string> - </property> - <property name="buddy" stdset="0"> - <cstring>kcfg_NumVisibleEntries</cstring> - </property> - <property name="whatsThis" stdset="0"> - <string>This option allows you to define the maximum number of applications that should be displayed in the QuickStart menu area.</string> - </property> - </widget> - <widget class="KIntNumInput"> - <property name="name"> - <cstring>kcfg_NumVisibleEntries</cstring> - </property> - <property name="value"> - <number>5</number> - </property> - <property name="minValue"> - <number>0</number> - </property> - <property name="maxValue"> - <number>20</number> - </property> - <property name="whatsThis" stdset="0"> - <string>This option allows you to define how many applications should be displayed at most in the QuickStart menu area.</string> - </property> - </widget> - </hbox> - </widget> - <widget class="QRadioButton" row="0" column="0"> - <property name="name"> - <cstring>kcfg_RecentVsOften</cstring> - </property> - <property name="text"> - <string>Show the &applications most recently used</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0"> - <string>When this option is selected the QuickStart menu area will be filled with the applications you have used most recently.</string> - </property> - </widget> - <widget class="QRadioButton" row="1" column="0"> - <property name="name"> - <cstring>m_showFrequent</cstring> - </property> - <property name="text"> - <string>Show the applications most fre&quently used</string> - </property> - <property name="whatsThis" stdset="0"> - <string>When this option is selected the QuickStart menu area will be filled with the applications you use most frequently.</string> - </property> - </widget> - <spacer row="0" column="1" rowspan="3" colspan="1"> - <property name="name"> - <cstring>Spacer8</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </grid> - </widget> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>m_browserGroup</cstring> + </property> + <property name="title"> + <string>QuickBrowser Menus</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_maxQuickBrowserItemsLabel</cstring> + </property> + <property name="text"> + <string>Ma&ximum number of entries:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_MaxEntries2</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>kcfg_MaxEntries2</cstring> + </property> + <property name="value"> + <number>30</number> + </property> + <property name="minValue"> + <number>10</number> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="whatsThis" stdset="0"> + <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>kcfg_ShowHiddenFiles</cstring> + </property> + <property name="text"> + <string>Show hidden fi&les</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>If this option is enabled, hidden files (i.e. files beginning with a dot) will be shown in the QuickBrowser menus.</string> + </property> + </widget> + <spacer row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>m_recentGroup</cstring> + </property> + <property name="title"> + <string>Recent Documents Menu</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_maxRecentDocumentsItemsLabel</cstring> + </property> + <property name="text"> + <string>Ma&ximum number of entries:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_MaxEntries2</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>This sets the maximum number of recently accessed documents stored for fast retrieval.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>maxrecentdocs</cstring> + </property> + <property name="value"> + <number>10</number> + </property> + <property name="minValue"> + <number>10</number> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="whatsThis" stdset="0"> + <string>This sets the maximum number of recently accessed documents stored for fast retrieval.</string> + </property> + </widget> + </hbox> + </widget> + <spacer row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QButtonGroup" row="0" column="1" rowspan="2"> + <property name="name"> + <cstring>m_pRecentOrderGroup</cstring> + </property> + <property name="title"> + <string>QuickStart Menu Items</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Maxim&um number of entries:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_NumVisibleEntries</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>This option allows you to define the maximum number of applications that should be displayed in the QuickStart menu area.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>kcfg_NumVisibleEntries</cstring> + </property> + <property name="value"> + <number>5</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>20</number> + </property> + <property name="whatsThis" stdset="0"> + <string>This option allows you to define how many applications should be displayed at most in the QuickStart menu area.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>kcfg_RecentVsOften</cstring> + </property> + <property name="text"> + <string>Show the &applications most recently used</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>When this option is selected the QuickStart menu area will be filled with the applications you have used most recently.</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>m_showFrequent</cstring> + </property> + <property name="text"> + <string>Show the applications most fre&quently used</string> + </property> + <property name="whatsThis" stdset="0"> + <string>When this option is selected the QuickStart menu area will be filled with the applications you use most frequently.</string> + </property> + </widget> + <spacer row="0" column="1" rowspan="3" colspan="1"> + <property name="name"> + <cstring>Spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> </vbox> </widget> <tabstops> diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp index 55cabaa88..935f04684 100644 --- a/kcontrol/kicker/menutab_impl.cpp +++ b/kcontrol/kicker/menutab_impl.cpp @@ -32,8 +32,13 @@ #include <knuminput.h> #include <kstandarddirs.h> +#include <kicondialog.h> +#include <kiconloader.h> + #include "main.h" +#include "kickerSettings.h" + #include "menutab_impl.h" #include "menutab_impl.moc" @@ -66,6 +71,25 @@ MenuTab::MenuTab( QWidget *parent, const char* name ) { // connections connect(m_editKMenuButton, SIGNAL(clicked()), SLOT(launchMenuEditor())); + connect(btnCustomKMenuIcon, SIGNAL(clicked()), SLOT(launchIconEditor())); + connect(kcfg_KMenuText, SIGNAL(textChanged(QString)), SLOT(kmenuChanged())); + connect(kcfg_ShowKMenuText, SIGNAL(toggled(bool)), SLOT(kmenuChanged())); + //connect(kcfg_ButtonFont, SIGNAL(fontSelected(const QFont &)), SLOT(kmenuChanged())); + connect(maxrecentdocs, SIGNAL(valueChanged(int)), this, SLOT(changed())); + + KIconLoader * ldr = KGlobal::iconLoader(); + QPixmap kmenu_icon; + m_kmenu_icon = KickerSettings::customKMenuIcon(); + if (m_kmenu_icon.isNull() == true) { + m_kmenu_icon = QString("kmenu"); + } + kmenu_icon = ldr->loadIcon(m_kmenu_icon, KIcon::Small, KIcon::SizeSmall); + btnCustomKMenuIcon->setPixmap(kmenu_icon); + + KConfig *config; + config = new KConfig(QString::fromLatin1("kdeglobals"), false, false); + config->setGroup(QString::fromLatin1("RecentDocuments")); + maxrecentdocs->setValue(config->readNumEntry(QString::fromLatin1("MaxEntries"), 10)); m_browserGroupLayout->setColStretch( 1, 1 ); m_pRecentOrderGroupLayout->setColStretch( 1, 1 ); @@ -156,6 +180,22 @@ void MenuTab::save() c->writeEntry("Extensions", ext); c->sync(); + + // Save KMenu settings + c->setGroup("KMenu"); + c->writeEntry("CustomIcon", m_kmenu_icon); + c->sync(); + + // Save recent documents + KConfig *config; + config = new KConfig(QString::fromLatin1("kdeglobals"), false, false); + config->setGroup(QString::fromLatin1("RecentDocuments")); + config->writeEntry("MaxEntries", maxrecentdocs->value()); + config->sync(); + + if (m_kmenu_button_changed == true) { + system("dcop kicker kicker restart &"); + } } void MenuTab::defaults() @@ -179,3 +219,25 @@ void MenuTab::launchMenuEditor() i18n("Application Missing")); } } + +void MenuTab::launchIconEditor() +{ + KIconDialog dlg(this); + QString newIcon = dlg.selectIcon(KIcon::Small, KIcon::Application); + if (newIcon.isEmpty()) + return; + + m_kmenu_icon = newIcon; + KIconLoader * ldr = KGlobal::iconLoader(); + QPixmap kmenu_icon; + kmenu_icon = ldr->loadIcon(m_kmenu_icon, KIcon::Small, KIcon::SizeSmall); + btnCustomKMenuIcon->setPixmap(kmenu_icon); + m_kmenu_button_changed = true; + + emit changed(); +} + +void MenuTab::kmenuChanged() +{ + m_kmenu_button_changed = true; +} diff --git a/kcontrol/kicker/menutab_impl.h b/kcontrol/kicker/menutab_impl.h index 20ed393e1..71c669048 100644 --- a/kcontrol/kicker/menutab_impl.h +++ b/kcontrol/kicker/menutab_impl.h @@ -62,10 +62,14 @@ signals: public slots: void launchMenuEditor(); + void launchIconEditor(); + void kmenuChanged(); protected: kSubMenuItem *m_bookmarkMenu; kSubMenuItem *m_quickBrowserMenu; + QString m_kmenu_icon; + bool m_kmenu_button_changed; }; #endif |