author | alwin <alwin> | 2005-02-28 09:40:30 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-02-28 09:40:30 (UTC) |
commit | 2b64a84d39eeed5681d0ee5068c7d11a01527750 (patch) (unidiff) | |
tree | c8693340dbc5ef5e2f9afa90b690829ddff2c4bd /noncore/applets/keyhelper/keyhelperapplet/extension/KeyLauncher.cpp | |
parent | 61fa699140c5efbb6ba0bf2a62f7e8fbf62976be (diff) | |
download | opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.zip opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.tar.gz opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.tar.bz2 |
other keymapping tool - not working this moment, I have to check it out
- the reason is that the config file is somewhat easier to understand than
from zkbapplet and has a nice config tool.
Please don't put it into any repositories this moment.
Diffstat (limited to 'noncore/applets/keyhelper/keyhelperapplet/extension/KeyLauncher.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/keyhelper/keyhelperapplet/extension/KeyLauncher.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/extension/KeyLauncher.cpp b/noncore/applets/keyhelper/keyhelperapplet/extension/KeyLauncher.cpp new file mode 100644 index 0000000..7a0b88c --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/extension/KeyLauncher.cpp | |||
@@ -0,0 +1,57 @@ | |||
1 | #include "KeyLauncher.h" | ||
2 | #include "KHUtil.h" | ||
3 | |||
4 | KeyLauncher::KeyLauncher(const QString& kind) : m_kind(kind) | ||
5 | { | ||
6 | qDebug("KeyLauncher::KeyLauncher()"); | ||
7 | } | ||
8 | |||
9 | KeyLauncher::~KeyLauncher() | ||
10 | { | ||
11 | qDebug("KeyLauncher::~KeyLauncher()"); | ||
12 | } | ||
13 | |||
14 | bool KeyLauncher::onKeyPress(int keycode) | ||
15 | { | ||
16 | QString key; | ||
17 | QStringList args; | ||
18 | ConfigEx& cfg = ConfigEx::getInstance("keyhelper"); | ||
19 | |||
20 | key = KeyNames::getName(keycode); | ||
21 | if(key == QString::null){ | ||
22 | return(false); | ||
23 | } | ||
24 | |||
25 | QString group = kind(); | ||
26 | group[0] = group[0].upper(); | ||
27 | |||
28 | /* read application launcher */ | ||
29 | QString app = KHUtil::currentApp(); | ||
30 | if(!app.isEmpty()){ | ||
31 | cfg.setGroup(group + "_" + app); | ||
32 | /* read config */ | ||
33 | args = cfg.readListEntry(key, '\t'); | ||
34 | } | ||
35 | |||
36 | /* read default launcher */ | ||
37 | if(args.isEmpty()){ | ||
38 | cfg.setGroup(group); | ||
39 | |||
40 | /* read config */ | ||
41 | args = cfg.readListEntry(key, '\t'); | ||
42 | } | ||
43 | |||
44 | if(args.isEmpty()){ | ||
45 | return(false); | ||
46 | } | ||
47 | |||
48 | /* launch application */ | ||
49 | LnkWrapper lnk(args); | ||
50 | if(lnk.isValid()){ | ||
51 | //args.remove(args.begin()); | ||
52 | lnk.instance().execute(); | ||
53 | } | ||
54 | |||
55 | return(true); | ||
56 | } | ||
57 | |||