diff options
Diffstat (limited to 'kmilo')
-rw-r--r-- | kmilo/generic/generic_monitor.cpp | 84 | ||||
-rw-r--r-- | kmilo/generic/generic_monitor.h | 14 | ||||
-rw-r--r-- | kmilo/kmilod/defaultskin.cpp | 32 | ||||
-rw-r--r-- | kmilo/kmilod/defaultskin.h | 1 | ||||
-rw-r--r-- | kmilo/kmilod/defaultwidget.ui | 127 |
5 files changed, 140 insertions, 118 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")) diff --git a/kmilo/generic/generic_monitor.h b/kmilo/generic/generic_monitor.h index c2477c4..1ad5304 100644 --- a/kmilo/generic/generic_monitor.h +++ b/kmilo/generic/generic_monitor.h @@ -29,6 +29,7 @@ #include <kglobalaccel.h> #include <dcopref.h> #include <kapplication.h> +#include <kconfig.h> #include "kmilod.h" #include "monitor.h" @@ -63,6 +64,17 @@ public slots: void fastVolumeUp(); void fastVolumeDown(); void mute(); + void launchMail(); + void launchBrowser(); + void launchSearch(); + void launchHomeFolder(); + void launchMusic(); + void launchCalculator(); + void launchTerminal(); + void launchHelp(); + void eject(); + void lightBulb(); + void pmBattery(); private: bool retrieveKmixDevices(); @@ -70,8 +82,10 @@ private: bool retrieveMute(); bool retrieveVolume(); void displayVolume(); + void launch(QString configKey, QString defaultApplication); KGlobalAccel *ga; + KConfig* config; DCOPRef *kmixClient, *kmixWindow; diff --git a/kmilo/kmilod/defaultskin.cpp b/kmilo/kmilod/defaultskin.cpp index f0324de..a0ef2b0 100644 --- a/kmilo/kmilod/defaultskin.cpp +++ b/kmilo/kmilod/defaultskin.cpp @@ -33,6 +33,7 @@ #include <netwm.h> #include <kglobalsettings.h> #include <kdeversion.h> +#include <kconfig.h> #include "defaultskin.h" @@ -49,6 +50,9 @@ DefaultSkin::DefaultSkin() { KWin::setType(_widget->winId(), NET::Override); _widget->hide(); + + KConfig config("kmilodrc"); + reconfigure( &config ); } @@ -57,6 +61,34 @@ DefaultSkin::~DefaultSkin() { _widget = 0; } +void DefaultSkin::reconfigure( KConfig *config ) { + + config->setGroup("DefaultSkin"); + + QFont *defaultFont = new QFont("Sans", 10, QFont::Bold ); + QSize *defaultSize = new QSize( 80, 30 ); + QColor *defaultpaletteForegroundColor = new QColor( 200, 200, 200 ); + QColor *defaultpaletteBackgroundColor = new QColor( 100, 100, 100 ); + QFont *defaultProgressFont = new QFont("Sans", 8, QFont::Bold ); + + _widget->resize( config->readSizeEntry("Size", defaultSize ) ); + _widget->setFont( config->readFontEntry("Font", defaultFont ) ); + _widget->setPaletteForegroundColor( config->readColorEntry("paletteForegroundColor", defaultpaletteForegroundColor ) ); + _widget->setPaletteBackgroundColor( config->readColorEntry("paletteBackgroundColor", defaultpaletteBackgroundColor ) ); + _widget->_progress->setFont( config->readFontEntry("ProgressFont", defaultProgressFont ) ); + + if ( ! config->hasGroup("DefaultSkin") ) + { + + config->writeEntry("Size", *defaultSize ); + config->writeEntry("Font", *defaultFont ); + config->writeEntry("paletteForegroundColor", *defaultpaletteForegroundColor ); + config->writeEntry("paletteBackgroundColor", *defaultpaletteBackgroundColor ); + config->writeEntry("ProgressFont", *defaultProgressFont ); + + } + +} void DefaultSkin::clear() { _timer.stop(); diff --git a/kmilo/kmilod/defaultskin.h b/kmilo/kmilod/defaultskin.h index 0e01f23..1610152 100644 --- a/kmilo/kmilod/defaultskin.h +++ b/kmilo/kmilod/defaultskin.h @@ -37,6 +37,7 @@ class DefaultSkin : public QObject, public KMilo::DisplaySkin { virtual ~DefaultSkin(); virtual void clear(); + virtual void reconfigure( KConfig *config ); virtual void displayText(const QString& text, const QPixmap& customPixmap=QPixmap()); virtual void displayProgress(const QString& text, diff --git a/kmilo/kmilod/defaultwidget.ui b/kmilo/kmilod/defaultwidget.ui index b4809fe..65c19d8 100644 --- a/kmilo/kmilod/defaultwidget.ui +++ b/kmilo/kmilod/defaultwidget.ui @@ -7,21 +7,6 @@ Released under the terms of the GNU GPL.</comment> <property name="name"> <cstring>DefaultWidget</cstring> </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>566</width> - <height>180</height> - </rect> - </property> - <property name="paletteBackgroundColor"> - <color> - <red>214</red> - <green>213</green> - <blue>212</blue> - </color> - </property> <grid> <property name="name"> <cstring>unnamed</cstring> @@ -30,19 +15,6 @@ Released under the terms of the GNU GPL.</comment> <property name="name"> <cstring>_widgetStack</cstring> </property> - <property name="paletteBackgroundColor"> - <color> - <red>214</red> - <green>213</green> - <blue>212</blue> - </color> - </property> - <property name="frameShape"> - <enum>StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> <widget class="QWidget"> <property name="name"> <cstring>page</cstring> @@ -58,26 +30,6 @@ Released under the terms of the GNU GPL.</comment> <property name="name"> <cstring>_textOnly</cstring> </property> - <property name="paletteForegroundColor"> - <color> - <red>26</red> - <green>69</green> - <blue>198</blue> - </color> - </property> - <property name="paletteBackgroundColor"> - <color> - <red>214</red> - <green>213</green> - <blue>212</blue> - </color> - </property> - <property name="font"> - <font> - <pointsize>28</pointsize> - <bold>1</bold> - </font> - </property> <property name="text"> <string></string> </property> @@ -98,41 +50,18 @@ Released under the terms of the GNU GPL.</comment> <property name="name"> <cstring>unnamed</cstring> </property> - <spacer row="1" column="2"> - <property name="name"> - <cstring>spacer1</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>81</width> - <height>31</height> - </size> - </property> - </spacer> - <spacer row="1" column="0"> + <widget class="QLabel" row="0" column="0"> <property name="name"> - <cstring>spacer1_2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> + <cstring>_progressText</cstring> </property> - <property name="sizeType"> - <enum>Expanding</enum> + <property name="text"> + <string></string> </property> - <property name="sizeHint"> - <size> - <width>81</width> - <height>31</height> - </size> + <property name="alignment"> + <set>AlignCenter</set> </property> - </spacer> - <widget class="QProgressBar" row="1" column="1"> + </widget> + <widget class="QProgressBar" row="0" column="1" colspan="2"> <property name="name"> <cstring>_progress</cstring> </property> @@ -144,52 +73,14 @@ Released under the terms of the GNU GPL.</comment> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="paletteBackgroundColor"> - <color> - <red>214</red> - <green>213</green> - <blue>212</blue> - </color> - </property> <property name="centerIndicator"> <bool>false</bool> </property> </widget> - <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3"> - <property name="name"> - <cstring>_progressText</cstring> - </property> - <property name="paletteForegroundColor"> - <color> - <red>26</red> - <green>69</green> - <blue>198</blue> - </color> - </property> - <property name="paletteBackgroundColor"> - <color> - <red>214</red> - <green>213</green> - <blue>212</blue> - </color> - </property> - <property name="font"> - <font> - <pointsize>28</pointsize> - <bold>1</bold> - </font> - </property> - <property name="text"> - <string></string> - </property> - <property name="alignment"> - <set>AlignCenter</set> - </property> - </widget> </grid> </widget> </widget> </grid> </widget> -<layoutdefaults spacing="6" margin="11"/> +<layoutdefaults spacing="2" margin="2"/> </UI> |