From 4e428e11c5858b5a2485af135cbb2fabd8a3522f Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Thu, 1 Jun 2023 12:53:38 +0300 Subject: kxkb: re-add custom TDE switching shortcut This commit fixes issue #342. Signed-off-by: Mavridis Philippe (cherry picked from commit 22bb398b3ba83142bf49f6abf47081e5e9e11bef) --- kxkb/kxkb.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'kxkb/kxkb.cpp') diff --git a/kxkb/kxkb.cpp b/kxkb/kxkb.cpp index 0764aff41..4bc5bdbd7 100644 --- a/kxkb/kxkb.cpp +++ b/kxkb/kxkb.cpp @@ -74,6 +74,10 @@ KXKBApp::KXKBApp(bool allowStyles, bool GUIenabled) m_layoutOwnerMap = new LayoutMap(kxkbConfig); + // keep in sync with kcmlayout.cpp + keys = new TDEGlobalAccel(TQT_TQOBJECT(this)); +#include "kxkbbindings.cpp" + connect( this, TQT_SIGNAL(settingsChanged(int)), TQT_SLOT(slotSettingsChanged(int)) ); addKipcEventMask( KIPC::SettingsChanged ); } @@ -81,11 +85,12 @@ KXKBApp::KXKBApp(bool allowStyles, bool GUIenabled) KXKBApp::~KXKBApp() { - delete m_tray; - delete m_rules; - delete m_extension; + delete m_tray; + delete m_rules; + delete m_extension; delete m_layoutOwnerMap; delete kWinModule; + delete keys; } int KXKBApp::newInstance() @@ -151,6 +156,8 @@ bool KXKBApp::settingsRead() initTray(); TDEGlobal::config()->reparseConfiguration(); // kcontrol modified kdeglobals + keys->readSettings(); + keys->updateConnections(); return true; } @@ -235,6 +242,13 @@ void KXKBApp::nextLayout() setLayout(layout); } +void KXKBApp::prevLayout() +{ + const LayoutUnit& layout = m_layoutOwnerMap->getPrevLayout().layoutUnit; + setLayout(layout); +} + + void KXKBApp::menuActivated(int id) { if( KxkbLabelController::START_MENU_ID <= id @@ -297,10 +311,11 @@ void KXKBApp::windowChanged(WId winId) void KXKBApp::slotSettingsChanged(int category) { - if ( category != TDEApplication::SETTINGS_SHORTCUTS) - return; - - TDEGlobal::config()->reparseConfiguration(); // kcontrol modified kdeglobals + if (category == TDEApplication::SETTINGS_SHORTCUTS) { + TDEGlobal::config()->reparseConfiguration(); // kcontrol modified kdeglobals + keys->readSettings(); + keys->updateConnections(); + } } bool KXKBApp::x11EventFilter(XEvent *e) { @@ -309,8 +324,7 @@ bool KXKBApp::x11EventFilter(XEvent *e) { return TDEApplication::x11EventFilter(e); } -const char * DESCRIPTION = - I18N_NOOP("A utility to switch keyboard maps"); +const char *DESCRIPTION = I18N_NOOP("A utility to switch keyboard maps"); extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) { -- cgit v1.2.1