Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

KeyLauncher.cpp

Go to the documentation of this file.
00001 #include "KeyLauncher.h"
00002 #include "KHUtil.h"
00003 
00004 KeyLauncher::KeyLauncher(const QString& kind) : m_kind(kind)
00005 {
00006         qDebug("KeyLauncher::KeyLauncher()");
00007 }
00008 
00009 KeyLauncher::~KeyLauncher()
00010 {
00011         qDebug("KeyLauncher::~KeyLauncher()");
00012 }
00013 
00014 bool KeyLauncher::onKeyPress(int keycode)
00015 {
00016         QString key;
00017         QStringList args;
00018         ConfigEx& cfg = ConfigEx::getInstance("keyhelper");
00019 
00020         key = KeyNames::getName(keycode);
00021         if(key == QString::null){
00022                 return(false);
00023         }
00024 
00025         QString group = kind();
00026         group[0] = group[0].upper();
00027 
00028         /* read application launcher */
00029         QString app = KHUtil::currentApp();
00030         if(!app.isEmpty()){
00031                 cfg.setGroup(group + "_" + app);
00032                 /* read config */
00033                 args = cfg.readListEntry(key, '\t');
00034         }
00035 
00036         /* read default launcher */
00037         if(args.isEmpty()){
00038                 cfg.setGroup(group);
00039 
00040                 /* read config */
00041                 args = cfg.readListEntry(key, '\t');
00042         }
00043 
00044         if(args.isEmpty()){
00045                 return(false);
00046         }
00047 
00048         /* launch application */
00049         LnkWrapper lnk(args);
00050         if(lnk.isValid()){
00051                 //args.remove(args.begin());
00052                 lnk.instance().execute();
00053         }
00054 
00055         return(true);
00056 }
00057 

Generated on Sat Nov 5 16:16:42 2005 for OPIE by  doxygen 1.4.2