diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 20:21:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 20:21:27 +0000 |
commit | 10e41144596fc9ced40fc349d9ecd099b1c2ea19 (patch) | |
tree | 88ab04e475ff5a4cd889cb082f5760b6e0bf5e4e /kcontrol/keys/shortcuts.cpp | |
parent | 4aed2c8219774f5d797760606b8489a92ddc5163 (diff) | |
download | tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.tar.gz tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.zip |
Initial import of Trinity 3.5.11 to kdebase
Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes
Will need to check for commit warnings and repair as encountered
Also needs full compile test
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/keys/shortcuts.cpp')
-rw-r--r-- | kcontrol/keys/shortcuts.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/kcontrol/keys/shortcuts.cpp b/kcontrol/keys/shortcuts.cpp index e65364f4c..2ceceb46a 100644 --- a/kcontrol/keys/shortcuts.cpp +++ b/kcontrol/keys/shortcuts.cpp @@ -24,9 +24,12 @@ #include "shortcuts.h" +#include <stdlib.h> + #include <qdir.h> #include <qlayout.h> #include <qwhatsthis.h> +#include <qcheckbox.h> #include <kapplication.h> #include <kdebug.h> @@ -101,6 +104,8 @@ QString ShortcutsModule::quickHelp() const void ShortcutsModule::initGUI() { + QString kde_winkeys_env_dir = KGlobal::dirs()->localkdedir() + "/env/"; + kdDebug(125) << "A-----------" << endl; KAccelActions* keys = &m_actionsGeneral; // see also KShortcutsModule::init() below !!! @@ -172,8 +177,27 @@ void ShortcutsModule::initGUI() m_pTab->setMargin( KDialog::marginHint() ); pVLayout->addWidget( m_pTab ); + // See if ~/.kde3/env/win-key.sh exists + QFile f( kde_winkeys_env_dir + "win-key.sh" ); + if ( f.exists() == false ) { + // No, it does not, so Win is a modifier + m_bUseRmWinKeys = true; + } + else { + // Yes, it does, so Win is a key + m_bUseRmWinKeys = false; + } m_pListGeneral = new KAccelShortcutList( m_actionsGeneral, true ); + m_pkcGeneral = new KKeyChooser( m_pListGeneral, this, KKeyChooser::Global, false ); + m_pkcGeneral->resize (m_pkcGeneral->sizeHint() ); + if (system("xmodmap 1> /dev/null 2> /dev/null") == 0) { + m_useRmWinKeys = new QCheckBox( i18n("Use Win key as modifier (uncheck to bind Win key to Menu)"), this ); + m_useRmWinKeys->resize( m_useRmWinKeys->sizeHint() ); + m_useRmWinKeys->setChecked( m_bUseRmWinKeys ); + pVLayout->addWidget( m_useRmWinKeys, 1, 0 ); + connect( m_useRmWinKeys, SIGNAL(clicked()), SLOT(slotUseRmWinKeysClicked()) ); + } m_pTab->addTab( m_pkcGeneral, i18n("&Global Shortcuts") ); connect( m_pkcGeneral, SIGNAL(keyChange()), SLOT(slotKeyChange()) ); @@ -432,4 +456,37 @@ void ShortcutsModule::slotRemoveScheme() { } +void ShortcutsModule::slotUseRmWinKeysClicked() +{ + QString kde_winkeys_env_dir = KGlobal::dirs()->localkdedir() + "/env/"; + + // See if ~/.kde3/env/win-key.sh exists + QFile f( kde_winkeys_env_dir + "win-key.sh" ); + if ( f.exists() == false ) { + // No, it does not, so Win is currently a modifier + if (m_useRmWinKeys->isChecked() == false) { + // Create the file + if ( f.open( IO_WriteOnly ) ) { + QTextStream stream( &f ); + stream << "xmodmap -e 'keycode 133=Menu'" << "\n"; + stream << "xmodmap -e 'keycode 134=Menu'" << "\n"; + f.close(); + system("xmodmap -e 'keycode 133=Menu'"); + system("xmodmap -e 'keycode 134=Menu'"); + } + } + } + else { + // Yes, it does, so Win is currently a key + m_bUseRmWinKeys = false; + if (m_useRmWinKeys->isChecked() == true) { + // Remove the file + f.remove(); + // Update key mappings + system("xmodmap -e 'keycode 133=Super_L'"); + system("xmodmap -e 'keycode 134=Super_R'"); + } + } +} + #include "shortcuts.moc" |