diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-18 02:32:16 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-18 02:32:16 +0000 |
commit | 2abe1e6f4022109b1e179242aa9765810d7f680c (patch) | |
tree | 408f52f8bc6e4ae2a1c093439be5404fbbce56be /kmilo/generic/generic_monitor.cpp | |
parent | 2bda8f7717adf28da4af0d34fb82f63d2868c31d (diff) | |
download | tdeutils-2abe1e6f4022109b1e179242aa9765810d7f680c.tar.gz tdeutils-2abe1e6f4022109b1e179242aa9765810d7f680c.zip |
* ark context un[tar/zip/bz] crash repair
* gcc4.4 compilation fixes
* superkaramba xmms sensor addition
* automake updates
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1063396 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmilo/generic/generic_monitor.cpp')
-rw-r--r-- | kmilo/generic/generic_monitor.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/kmilo/generic/generic_monitor.cpp b/kmilo/generic/generic_monitor.cpp index 40e7169..bc104dc 100644 --- a/kmilo/generic/generic_monitor.cpp +++ b/kmilo/generic/generic_monitor.cpp @@ -25,6 +25,7 @@ #include <kgenericfactory.h> #include <kdebug.h> +#include <kprocess.h> #include <kconfig.h> #include <sys/types.h> @@ -34,6 +35,7 @@ #include "kmilointerface.h" #include <qmessagebox.h> #include <qfile.h> +#include <qdir.h> #define CONFIG_FILE "kmilodrc" @@ -70,10 +72,25 @@ bool GenericMonitor::init() KConfig config(CONFIG_FILE); reconfigure(&config); + //config = new KConfig("kmilodrc"); + config.setGroup("kubuntu"); + if(!m_enabled) return false; // exit early if we are not supposed to run static const ShortcutInfo shortcuts[] = { + { "Search", KShortcut("XF86Search"), SLOT(launchSearch()) }, + { "Home Folder", KShortcut("XF86MyComputer"), SLOT(launchHomeFolder()) }, + { "Mail", KShortcut("XF86Mail"), SLOT(launchMail()) }, + { "Audio Media", KShortcut("XF86AudioMedia"), SLOT(launchMusic()) }, + { "Music", KShortcut("XF86Music"), SLOT(launchMusic()) }, + { "Browser", KShortcut("XF86WWW"), SLOT(launchBrowser()) }, + { "Calculator", KShortcut("XF86Calculator"), SLOT(launchCalculator()) }, + { "Terminal", KShortcut("XF86Terminal"), SLOT(launchTerminal()) }, + { "Eject", KShortcut("XF86Eject"), SLOT(eject()) }, + { "Help", KShortcut("XF86Launch0"), SLOT(launchHelp()) }, + { "Light Bulb", KShortcut("XF86LightBulb"), SLOT(lightBulb()) }, + { "Battery", KShortcut("XF86LaunchB"), SLOT(pmBattery()) }, { "FastVolumeUp", Qt::Key_VolumeUp, SLOT(fastVolumeUp()) }, { "FastVolumeDown", Qt::Key_VolumeDown, SLOT(fastVolumeDown()) }, { "SlowVolumeUp", Qt::CTRL+Qt::Key_VolumeUp, SLOT(slowVolumeUp()) }, @@ -318,6 +335,73 @@ Monitor::DisplayType GenericMonitor::poll() return m_displayType; } +void GenericMonitor::launch(QString configKey, QString defaultApplication) +{ + QString application = config->readEntry(configKey, defaultApplication); + KProcess proc; + proc << application; + proc.start(KProcess::DontCare); +} + +void GenericMonitor::launchMail() +{ + kdDebug() << "launchMail" << endl; + kapp->invokeMailer("", "", "", "", "", "", "", ""); +} + +void GenericMonitor::launchBrowser() +{ + kapp->invokeBrowser(""); +} + +void GenericMonitor::launchSearch() +{ + launch("search", "kfind"); +} + +void GenericMonitor::launchHomeFolder() +{ + QString home = QDir::home().path(); + KProcess proc; + proc << "kfmclient" << "exec" << home; + proc.start(KProcess::DontCare); +} + +void GenericMonitor::launchMusic() +{ + launch("search", "amarok"); +} + +void GenericMonitor::launchCalculator() +{ + launch("search", "speedcrunch"); +} + +void GenericMonitor::launchTerminal() +{ + launch("search", "konsole"); +} + +void GenericMonitor::launchHelp() +{ + launch("search", "khelpcenter"); +} + +void GenericMonitor::eject() +{ + launch("search", "eject"); +} + +void GenericMonitor::lightBulb() +{ + kdDebug() << "lightBulb()" << endl; + _interface->displayText("Screen Light"); +} + +void GenericMonitor::pmBattery() +{ + DCOPRef("guidance*", "power-manager").send("showTip"); +} K_EXPORT_COMPONENT_FACTORY(kmilo_generic, KGenericFactory<GenericMonitor>("kmilo_generic")) |