diff options
author | Mavridis Philippe <[email protected]> | 2021-10-08 11:00:07 +0300 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2021-10-08 13:05:53 +0300 |
commit | 10cddab2e38a26d4a2593fcb095fca8230a39486 (patch) | |
tree | ca33a0781334259a35317afd6da36957d1941ff6 /kcontrol/kicker | |
parent | 48077a30f9997448365742e3c7060bb7ad862aa7 (diff) | |
download | tdebase-10cddab2e38a26d4a2593fcb095fca8230a39486.tar.gz tdebase-10cddab2e38a26d4a2593fcb095fca8230a39486.zip |
TDEMenu search shortcut: various fixes
* Better Escape key usage prevention
* Better handling of different shortcut counts (0 vs 1 vs 2)
* Fixed a deprecated function call to setShortcut()
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'kcontrol/kicker')
-rw-r--r-- | kcontrol/kicker/menutab_impl.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp index e00c51e78..fbd15cd8d 100644 --- a/kcontrol/kicker/menutab_impl.cpp +++ b/kcontrol/kicker/menutab_impl.cpp @@ -38,6 +38,7 @@ #include <kstandarddirs.h> #include <tdefontrequester.h> #include <kkeybutton.h> +#include <tdemessagebox.h> #include <kicondialog.h> #include <kiconloader.h> @@ -171,7 +172,7 @@ void MenuTab::load( bool useDefaults ) m_showFrequent->setChecked(true); c->setGroup("KMenu"); - m_searchShortcut->setShortcut(TDEShortcut(c->readEntry("SearchShortcut", "/"))); + m_searchShortcut->setShortcut(TDEShortcut(c->readEntry("SearchShortcut", "/")), false); connect(m_searchShortcut, TQT_SIGNAL(capturedShortcut(const TDEShortcut&)), TQT_SIGNAL(changed())); connect(m_searchShortcut, TQT_SIGNAL(capturedShortcut(const TDEShortcut&)), TQT_SLOT(setSearchShortcut(const TDEShortcut&))); @@ -359,8 +360,19 @@ void MenuTab::kmenuChanged() void MenuTab::setSearchShortcut(const TDEShortcut &cut) { - if( cut == TDEShortcut(TQt::Key_Escape) ) + if( cut.contains( KKeySequence(KKey(TQt::Key_Escape)) ) ) + { + int anotherTry = KMessageBox::warningYesNo( + this, + i18n("Cannot set Escape as menu search shortcut.\nWould you like to set another shortcut?"), + i18n("Invalid shortcut") + ); + + if( anotherTry == KMessageBox::Yes ) + m_searchShortcut->captureShortcut(); + return; + } m_searchShortcut->setShortcut(cut, false); } |