diff options
-rw-r--r-- | kcontrol/kicker/menutab.ui | 36 | ||||
-rw-r--r-- | kcontrol/kicker/menutab_impl.cpp | 14 | ||||
-rw-r--r-- | kcontrol/kicker/menutab_impl.h | 3 | ||||
-rw-r--r-- | kicker/kicker/ui/k_mnu.cpp | 33 | ||||
-rw-r--r-- | kicker/kicker/ui/k_mnu.h | 1 | ||||
-rw-r--r-- | kicker/libkicker/kickerSettings.kcfg | 5 |
6 files changed, 83 insertions, 9 deletions
diff --git a/kcontrol/kicker/menutab.ui b/kcontrol/kicker/menutab.ui index fa3868004..460c82c0d 100644 --- a/kcontrol/kicker/menutab.ui +++ b/kcontrol/kicker/menutab.ui @@ -705,7 +705,40 @@ <string><qt>When this option is selected a text-based search field will appear in the TDE Menu.</qt></string> </property> </widget> - <spacer row="0" column="1" rowspan="3" colspan="1"> + + <widget class="TQLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>m_searchShortcutLayout</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + + <widget class="TQLabel"> + <property name="name"> + <cstring>searchShortcutLabel</cstring> + </property> + <property name="text"> + <string>Search shortcut:</string> + </property> + <property name="whatsThis" stdset="0"> + <string>From here you can change the keyboard shortcut which triggers the search line in the TDE Menu.</string> + </property> + </widget> + + <widget class="KKeyButton"> + <property name="name"> + <cstring>m_searchShortcut</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>From here you can change the keyboard shortcut which triggers the search line in the TDE Menu.</string> + </property> + </widget> + </hbox> + </widget> + + <spacer row="0" column="1" rowspan="3" colspan="2"> <property name="name"> <cstring>Spacer8</cstring> </property> @@ -749,6 +782,7 @@ <include location="global" impldecl="in implementation">kpushbutton.h</include> <include location="global" impldecl="in implementation">tdefontrequester.h</include> <include location="global" impldecl="in implementation">tdelistview.h</include> + <include location="global" impldecl="in implementation">kkeybutton.h</include> </includes> <layoutdefaults spacing="6" margin="11"/> <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp index fe20f2302..7a3bc768b 100644 --- a/kcontrol/kicker/menutab_impl.cpp +++ b/kcontrol/kicker/menutab_impl.cpp @@ -37,6 +37,7 @@ #include <knuminput.h> #include <kstandarddirs.h> #include <tdefontrequester.h> +#include <kkeybutton.h> #include <kicondialog.h> #include <kiconloader.h> @@ -168,7 +169,12 @@ void MenuTab::load( bool useDefaults ) connect(m_openOnHover, TQT_SIGNAL(clicked()), TQT_SIGNAL(changed())); m_showFrequent->setChecked(true); - + + c->setGroup("KMenu"); + m_searchShortcut->setShortcut(TDEShortcut(c->readEntry("SearchShortcut", "/"))); + connect(m_searchShortcut, TQT_SIGNAL(capturedShortcut(const TDEShortcut&)), TQT_SIGNAL(changed())); + connect(m_searchShortcut, TQT_SIGNAL(capturedShortcut(const TDEShortcut&)), TQT_SLOT(setSearchShortcut(const TDEShortcut&))); + if ( useDefaults ) emit changed(); } @@ -288,6 +294,7 @@ void MenuTab::save() // Save KMenu settings c->setGroup("KMenu"); c->writeEntry("CustomIcon", m_kmenu_icon); + c->writeEntry("SearchShortcut", (m_searchShortcut->shortcut()).toString()); c->sync(); // Save recent documents @@ -349,3 +356,8 @@ void MenuTab::kmenuChanged() //m_kmenu_button_changed = true; emit changed(); } + +void MenuTab::setSearchShortcut(const TDEShortcut &cut) +{ + m_searchShortcut->setShortcut(cut, false); +} diff --git a/kcontrol/kicker/menutab_impl.h b/kcontrol/kicker/menutab_impl.h index b143b0072..509623d61 100644 --- a/kcontrol/kicker/menutab_impl.h +++ b/kcontrol/kicker/menutab_impl.h @@ -21,6 +21,7 @@ #include <tqlistview.h> #include <stdlib.h> +#include <tdeshortcut.h> #include <kpushbutton.h> #include "menutab.h" @@ -68,12 +69,14 @@ public slots: void menuStyleChanged(); void launchIconEditor(); void kmenuChanged(); + void setSearchShortcut(const TDEShortcut &cut); protected: kSubMenuItem *m_bookmarkMenu; kSubMenuItem *m_quickBrowserMenu; TQString m_kmenu_icon; bool m_kmenu_button_changed; + }; #endif diff --git a/kicker/kicker/ui/k_mnu.cpp b/kicker/kicker/ui/k_mnu.cpp index 4362e91f1..a4a1f6d58 100644 --- a/kicker/kicker/ui/k_mnu.cpp +++ b/kicker/kicker/ui/k_mnu.cpp @@ -52,6 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tdetoolbarbutton.h> #include <twin.h> #include <popupmenutop.h> +#include <tdeaccel.h> #include "client_mnu.h" #include "container_base.h" @@ -245,6 +246,8 @@ void PanelKMenu::initialize() return; } + TDEAccel *accel = new TDEAccel(this); + if (loadSidePixmap()) { // in case we've been through here before, let's disconnect @@ -265,7 +268,16 @@ void PanelKMenu::initialize() if (KickerSettings::useSearchBar()) { TQHBox* hbox = new TQHBox( this ); TDEToolBarButton *clearButton = new TDEToolBarButton( "locationbar_erase", 0, hbox ); - searchEdit = new KPIM::ClickLineEdit(hbox, " "+i18n("Press '/' to search...")); + + TQStringList cuts = TQStringList::split(";", KickerSettings::searchShortcut()); + searchEdit = new KPIM::ClickLineEdit( + hbox, + ( cuts.count() == 2 + ? i18n(" Press '%1' or '%2' to search...").arg(cuts[0], cuts[1]) + : i18n(" Press '%1' to search...").arg(cuts[0]) + ) + ); + hbox->setFocusPolicy(TQ_StrongFocus); hbox->setFocusProxy(searchEdit); hbox->setSpacing( 3 ); @@ -273,6 +285,10 @@ void PanelKMenu::initialize() connect(this, TQT_SIGNAL(aboutToHide()), this, TQT_SLOT(slotClearSearch())); connect(searchEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT( slotUpdateSearch( const TQString&))); + accel->insert("search", i18n("Search"), i18n("TDE Menu search"), + TDEShortcut(KickerSettings::searchShortcut()), + this, TQT_SLOT(slotFocusSearch())); + insertItem(hbox, searchLineID, 0); } else { searchEdit = NULL; @@ -709,6 +725,13 @@ void PanelKMenu::slotClearSearch() } } +void PanelKMenu::slotFocusSearch() +{ + if (indexOf(searchLineID) >=0 ) { + setActiveItem(indexOf(searchLineID)); + } +} + void PanelKMenu::keyPressEvent(TQKeyEvent* e) { // We move the focus to the search field if the @@ -719,12 +742,8 @@ void PanelKMenu::keyPressEvent(TQKeyEvent* e) // we follow konqueror. if (!searchEdit) return KPanelMenu::keyPressEvent(e); - if (e->key() == TQt::Key_Slash && !searchEdit->hasFocus()) { - if (indexOf(searchLineID) >=0 ) { - setActiveItem(indexOf(searchLineID)); - } - } - else if (e->key() == TQt::Key_Escape && searchEdit->text().isEmpty() == false) { + + if (e->key() == TQt::Key_Escape && searchEdit->text().isEmpty() == false) { searchEdit->clear(); } else if (e->key() == TQt::Key_Delete && !searchEdit->hasFocus() && diff --git a/kicker/kicker/ui/k_mnu.h b/kicker/kicker/ui/k_mnu.h index 7c76f55ed..cf5a1917b 100644 --- a/kicker/kicker/ui/k_mnu.h +++ b/kicker/kicker/ui/k_mnu.h @@ -83,6 +83,7 @@ protected slots: void slotEditUserContact(); void slotUpdateSearch(const TQString &searchtext); void slotClearSearch(); + void slotFocusSearch(); void paletteChanged(); virtual void configChanged(); void updateRecent(); diff --git a/kicker/libkicker/kickerSettings.kcfg b/kicker/libkicker/kickerSettings.kcfg index 5ab6880aa..dfdf501e4 100644 --- a/kicker/libkicker/kickerSettings.kcfg +++ b/kicker/libkicker/kickerSettings.kcfg @@ -419,6 +419,11 @@ <default code="true">QString("kmenu")</default> </entry> + <entry name="SearchShortcut" type="String" > + <label>Search shortcut</label> + <default>/</default> + </entry> + </group> <group name="buttons" > |