summaryrefslogtreecommitdiffstats
path: root/kmilo
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /kmilo
downloadtdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz
tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmilo')
-rw-r--r--kmilo/Makefile.am18
-rw-r--r--kmilo/README17
-rw-r--r--kmilo/TODO7
-rw-r--r--kmilo/asus/Makefile.am37
-rw-r--r--kmilo/asus/README43
-rw-r--r--kmilo/asus/asus.cpp213
-rw-r--r--kmilo/asus/asus.h88
-rw-r--r--kmilo/asus/kmilo_asus.desktop97
-rw-r--r--kmilo/configure.in.in60
-rw-r--r--kmilo/delli8k/Makefile.am36
-rw-r--r--kmilo/delli8k/README98
-rw-r--r--kmilo/delli8k/delli8k.cpp256
-rw-r--r--kmilo/delli8k/delli8k.h89
-rw-r--r--kmilo/delli8k/i8k.h46
-rw-r--r--kmilo/delli8k/kmilo_delli8k.desktop96
-rw-r--r--kmilo/demo/Makefile.am32
-rw-r--r--kmilo/demo/demo.cpp56
-rw-r--r--kmilo/demo/demo.h39
-rw-r--r--kmilo/demo/kmilo_demo.desktop110
-rw-r--r--kmilo/generic/Makefile.am34
-rw-r--r--kmilo/generic/README38
-rw-r--r--kmilo/generic/generic_monitor.cpp324
-rw-r--r--kmilo/generic/generic_monitor.h94
-rw-r--r--kmilo/generic/kmilo_generic.desktop108
-rw-r--r--kmilo/kmilo_kvaio/Makefile.am39
-rw-r--r--kmilo/kmilo_kvaio/README.sonypi.h18
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/Makefile.am15
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui273
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h15
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop146
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/main.cpp176
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/main.h53
-rw-r--r--kmilo/kmilo_kvaio/kmilo_kvaio.cpp68
-rw-r--r--kmilo/kmilo_kvaio/kmilo_kvaio.desktop106
-rw-r--r--kmilo/kmilo_kvaio/kmilo_kvaio.h66
-rw-r--r--kmilo/kmilo_kvaio/kvaio.cpp606
-rw-r--r--kmilo/kmilo_kvaio/kvaio.h113
-rw-r--r--kmilo/kmilo_kvaio/kvaiodriverinterface.cpp221
-rw-r--r--kmilo/kmilo_kvaio/kvaiodriverinterface.h62
-rw-r--r--kmilo/kmilo_kvaio/sonypi.h158
-rw-r--r--kmilo/kmilod/Makefile.am43
-rw-r--r--kmilo/kmilod/defaultskin.cpp107
-rw-r--r--kmilo/kmilod/defaultskin.h56
-rw-r--r--kmilo/kmilod/defaultwidget.ui195
-rw-r--r--kmilo/kmilod/displayskin.cpp34
-rw-r--r--kmilo/kmilod/displayskin.h47
-rw-r--r--kmilo/kmilod/kmilod.cpp227
-rw-r--r--kmilo/kmilod/kmilod.desktop59
-rw-r--r--kmilo/kmilod/kmilod.h72
-rw-r--r--kmilo/kmilod/kmilointerface.cpp26
-rw-r--r--kmilo/kmilod/kmilointerface.h57
-rw-r--r--kmilo/kmilod/kmilopluginsvc.desktop9
-rw-r--r--kmilo/kmilod/monitor.cpp44
-rw-r--r--kmilo/kmilod/monitor.h98
-rw-r--r--kmilo/powerbook/Makefile.am34
-rw-r--r--kmilo/powerbook/kmilo_powerbook.desktop105
-rw-r--r--kmilo/powerbook/pb_monitor.cpp127
-rw-r--r--kmilo/powerbook/pb_monitor.h42
-rw-r--r--kmilo/powerbook2/Makefile.am34
-rw-r--r--kmilo/powerbook2/kmilo_powerbook.desktop106
-rw-r--r--kmilo/powerbook2/pb_monitor.cpp165
-rw-r--r--kmilo/powerbook2/pb_monitor.h55
-rw-r--r--kmilo/thinkpad/Makefile.am36
-rw-r--r--kmilo/thinkpad/README61
-rw-r--r--kmilo/thinkpad/kcmthinkpad/Makefile.am15
-rw-r--r--kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui307
-rw-r--r--kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui.h36
-rw-r--r--kmilo/thinkpad/kcmthinkpad/main.cpp189
-rw-r--r--kmilo/thinkpad/kcmthinkpad/main.h49
-rw-r--r--kmilo/thinkpad/kcmthinkpad/thinkpad.desktop145
-rw-r--r--kmilo/thinkpad/kmilo_thinkpad.desktop101
-rw-r--r--kmilo/thinkpad/thinkpad.cpp556
-rw-r--r--kmilo/thinkpad/thinkpad.h208
73 files changed, 7616 insertions, 0 deletions
diff --git a/kmilo/Makefile.am b/kmilo/Makefile.am
new file mode 100644
index 0000000..9a0949a
--- /dev/null
+++ b/kmilo/Makefile.am
@@ -0,0 +1,18 @@
+if include_kmilo_powerbook
+POWERBOOK_SUBDIR=powerbook
+endif
+
+if include_kmilo_pbb
+POWERBOOK2_SUBDIR=powerbook2
+endif
+
+if include_kmilo_kvaio
+KVAIO_SUBDIR=kmilo_kvaio
+endif
+
+if include_kmilo_delli8k
+KDELLI8k_SUBDIR=delli8k
+endif
+
+
+SUBDIRS=kmilod $(POWERBOOK_SUBDIR) $(POWERBOOK2_SUBDIR) $(KVAIO_SUBDIR) generic thinkpad asus $(KDELLI8k_SUBDIR)
diff --git a/kmilo/README b/kmilo/README
new file mode 100644
index 0000000..f05588f
--- /dev/null
+++ b/kmilo/README
@@ -0,0 +1,17 @@
+This is a kded module that can be extended to support various types of hardware
+input devices that exist, such as those on keyboards.
+
+It presently supports:
+- Apple PowerBooks
+- Sony Vaio Laptops (tested on Vaio PCG-GRX series)
+- IBM Thinkpads
+- Asus Laptops
+- Dell laptops (see delli8k/README for models)
+
+The output device is skinnable, though not extensible by 3rd parties currently.
+This will come in the future when the API is finalised.
+
+It also lacks very much functionality. Any input is appreciated.
+
+Header files are not presently installed in order to avoid committing to an API.
+
diff --git a/kmilo/TODO b/kmilo/TODO
new file mode 100644
index 0000000..8a31d85
--- /dev/null
+++ b/kmilo/TODO
@@ -0,0 +1,7 @@
+- Configuration
+
+- Pluginify the skins
+
+- Support for more laptops, keyboards, etc.
+
+- Add a debug area
diff --git a/kmilo/asus/Makefile.am b/kmilo/asus/Makefile.am
new file mode 100644
index 0000000..39217c0
--- /dev/null
+++ b/kmilo/asus/Makefile.am
@@ -0,0 +1,37 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+# Copyright (C) 2004 Chris Howells <howells@kde.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+#SUBDIRS = . kcmthinkpad
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_asus.la
+
+kmilo_asus_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_asus_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO)
+kmilo_asus_la_SOURCES = asus.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = asus.h
+
+services_DATA = kmilo_asus.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(asus_thinkpad_la_SOURCES) -o $(podir)/kmilo_asus.pot
diff --git a/kmilo/asus/README b/kmilo/asus/README
new file mode 100644
index 0000000..b375940
--- /dev/null
+++ b/kmilo/asus/README
@@ -0,0 +1,43 @@
+Asus Laptop plugin for KMilo
+
+Chris Howells <howells@kde.org>
+
+About
+-----
+
+This KMilo module, in conjunction with the Asus asus_acpi Linux kernel
+module, allows some of the special keys on the keyboard of an Asus laptop to
+be fully utilised.
+
+The asus_acpi kernel modules exports a control and monitoring interface
+using the Linux kernel's /proc psuedo file system.
+
+The /proc file system
+---------------------
+
+/proc/acpi/asus/brn - Sets/gets the brightness of the LCD backlight
+Values between 0 (most dim) and 15 (most bright)
+
+/proc/acpi/asus/info - Shows information about the laptop
+
+/proc/acpi/asus/lcd - Sets/gets whether the LCD is on or off
+Values of 0 or 1
+
+/proc/acpi/asus/disp - Sets/gets whether the LCD/VGA/TV out is used
+Values of
+0 - no display
+1 - LCD only
+2 - CRT only
+3 - LCD + CRT
+4 - TV out only
+5 - LCD + TV out
+6 - CRT + TV out
+7 - LCD + CRT + TV out
+
+Changes
+-------
+
+Todo
+----
+* Support lcd and disp stuff
+* Maybe support volume stuff
diff --git a/kmilo/asus/asus.cpp b/kmilo/asus/asus.cpp
new file mode 100644
index 0000000..e1fbfa0
--- /dev/null
+++ b/kmilo/asus/asus.cpp
@@ -0,0 +1,213 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2004 Chris Howells <howells@kde.org>
+ Much code and ideas stolen from Jonathan Riddell's ThinkPad plugin
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; version
+ 2 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <kgenericfactory.h>
+#include <kconfig.h>
+#include <krun.h>
+#include <kurl.h>
+
+#include <qfile.h>
+#include <qdir.h>
+
+#include "kmilointerface.h"
+
+#include "asus.h"
+
+#ifdef Q_OS_FREEBSD
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+
+#define ROUND(x) (int(x + 0.5))
+
+namespace KMilo {
+
+AsusMonitor::AsusMonitor(QObject* parent, const char* name, const QStringList& args): Monitor(parent, name, args)
+{
+}
+
+AsusMonitor::~AsusMonitor()
+{
+}
+
+bool AsusMonitor::init()
+{
+ kdDebug() << "loading asus kmilo plugin" << endl;
+
+#ifdef Q_OS_FREEBSD
+ /*
+ * Check if the sysctls are in place by looking up their MIBs.
+ * Caching the MIBs results in a major speedup.
+ */
+ size_t len = 4;
+ if ( sysctlnametomib("hw.acpi.asus.lcd_brightness", brightness_mib, &len) == -1 ||
+ sysctlnametomib("hw.acpi.asus.lcd_backlight", backlight_mib, &len) == -1 ||
+ sysctlnametomib("hw.acpi.asus.video_output", video_mib, &len) == -1 )
+ {
+ kdDebug() << "The driver's sysctls don't seem to exist, check that the acpi_asus module is loaded" << endl;
+ return false;
+ }
+#else
+ // we need to read the /proc file system and store the current values into a struct
+ QDir dir("/proc/acpi/asus");
+ if (!dir.exists())
+ {
+ kdDebug() << "/proc/acpi/asus doesn't exist, check that the asus_acpi module is loaded" << endl;
+ return false;
+ }
+#endif
+ else
+ {
+ clearStruct(asus_state);
+ clearStruct(last_asus_state);
+ if (!readProc(&asus_state))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+Monitor::DisplayType AsusMonitor::poll()
+{
+
+ // save last state and get new one
+ memcpy(&last_asus_state, &asus_state, sizeof(asus_state_struct));
+ readProc(&asus_state);
+
+ Monitor::DisplayType pollResult = None;
+
+ if (last_asus_state.brightness != asus_state.brightness)
+ {
+ pollResult = Brightness;
+ float value = (float)asus_state.brightness / 15;
+ m_progress = ROUND(value * 100);
+ }
+
+ /*if (last_asus_state.lcd != asus_state.lcd)
+ {
+ if (asus_state.lcd == 0)
+ {
+ _interface->displayText(i18n("Display changed: LCD off"));
+ }
+ else
+ {
+ _interface->displayText(i18n("Display changed: LCD on"));
+ }
+ }*/
+
+ if (last_asus_state.display != asus_state.display)
+ {
+ switch (asus_state.display)
+ {
+ case 0:
+ _interface->displayText(i18n("Display changed: off"));
+ break;
+ case 1:
+ _interface->displayText(i18n("Display changed: LCD on"));
+ break;
+ case 2:
+ _interface->displayText(i18n("Display changed: CRT on"));
+ break;
+ case 3:
+ _interface->displayText(i18n("Display changed: LCD and CRT on"));
+ break;
+ case 4:
+ _interface->displayText(i18n("Display changed: TV out on"));
+ break;
+ case 5:
+ _interface->displayText(i18n("Display changed: LCD and TV out on"));
+ break;
+ case 6:
+ _interface->displayText(i18n("Display changed: CRT and TV out on"));
+ break;
+ case 7:
+ _interface->displayText(i18n("Display changed: LCD, CRT and TV out on"));
+ break;
+ }
+ }
+
+ return pollResult;
+}
+
+
+int AsusMonitor::progress() const
+{
+ return m_progress;
+}
+
+bool AsusMonitor::readProc(asus_state_struct* asus_state)
+{
+#ifdef Q_OS_FREEBSD
+ int value;
+ size_t value_len = sizeof(value);
+
+ if ( sysctl(brightness_mib, 4, &value, &value_len, NULL, 0) != -1 )
+ asus_state->brightness = value;
+
+ if ( sysctl(backlight_mib, 4, &value, &value_len, NULL, 0) != -1 )
+ asus_state->lcd = value;
+
+ if ( sysctl(video_mib, 4, &value, &value_len, NULL, 0) != -1 )
+ asus_state->display = value;
+#else
+ asus_state->brightness = readProcEntry(QString("brn"));
+ //asus_state->lcd = readProcEntry(QString("lcd"));
+ //disabled because it does not yet work on my S5200N (asus_acpi bug)
+ //asus_state->display = readProcEntry(QString("disp"));
+ //FIXME
+#endif
+ return true;
+}
+
+int AsusMonitor::readProcEntry(const QString &name)
+{
+ QFile f(QString("/proc/acpi/asus/%1").arg(name).local8Bit());
+
+ if (f.open(IO_ReadOnly))
+ {
+ QString line;
+ if (f.readLine(line, 1024) > 0)
+ {
+ line = line.stripWhiteSpace();
+ int value = line.section(' ', 0, 0).toInt();
+ if (value > 0)
+ {
+ return value;
+ }
+ }
+ }
+ return 0;
+}
+
+void AsusMonitor::clearStruct(asus_state_struct& asus_state)
+{
+ asus_state.brightness = 0;
+ asus_state.lcd = 0;
+ asus_state.display = 0;
+}
+
+}
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_asus, KGenericFactory<KMilo::AsusMonitor>("kmilo_asus"))
diff --git a/kmilo/asus/asus.h b/kmilo/asus/asus.h
new file mode 100644
index 0000000..90361d8
--- /dev/null
+++ b/kmilo/asus/asus.h
@@ -0,0 +1,88 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2004 Chris Howells <howells@kde.org>
+ Much code and ideas stolen from Jonathan Riddell's ThinkPad plugin
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; version
+ 2 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef ASUS_H
+#define ASUS_H
+
+#include <kapplication.h>
+#include <dcopref.h>
+
+#include "monitor.h"
+
+namespace KMilo {
+
+typedef struct
+{
+ unsigned int brightness;
+ unsigned int lcd;
+ unsigned int display;
+} asus_state_struct;
+
+/**
+ * KMilo plugin for Asus Laptops
+ */
+class AsusMonitor: public Monitor {
+ public:
+ AsusMonitor(QObject *parent, const char *name, const QStringList&);
+ virtual ~AsusMonitor();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Loads configuration.
+ */
+ virtual bool init();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Called by KMilo, this checks the /proc file system and acts on any changes
+ */
+ virtual DisplayType poll();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Called by KMilo if poll() returns a brightness change.
+ * Returns the new brightness percentage.
+ */
+ virtual int progress() const;
+
+ private:
+
+ int m_progress;
+
+ asus_state_struct last_asus_state;
+ asus_state_struct asus_state;
+
+ bool readProc(asus_state_struct* );
+ int readProcEntry(const QString &);
+
+ void clearStruct(asus_state_struct& asus_state);
+
+#ifdef Q_OS_FREEBSD
+ int brightness_mib[4];
+ int backlight_mib[4];
+ int video_mib[4];
+#endif
+};
+
+} // close namespace
+
+#endif
diff --git a/kmilo/asus/kmilo_asus.desktop b/kmilo/asus/kmilo_asus.desktop
new file mode 100644
index 0000000..5e662bb
--- /dev/null
+++ b/kmilo/asus/kmilo_asus.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Asus Laptop Plugin
+Name[ar]=ملحق حاسوب Asus المحمول
+Name[br]=Lugent hezoug Asus
+Name[bs]=Dodatak za Asus laptope
+Name[ca]=Connector per portàtils Asus
+Name[cs]=Asus Laptop modul
+Name[da]=Asus bærbar plugin
+Name[de]=Asus Notebook-Plugin
+Name[el]=Πρόσθετο Sony Vaio
+Name[es]=Extensión para el portátil Asus
+Name[et]=Asuse sülearvuti plugin
+Name[eu]=Asus Laptop plugina
+Name[fa]=وصلۀ رایانۀ کیفی Asus
+Name[fi]=Asus-kannettavan liitännäinen
+Name[fr]=Module externe pour les portables Asus
+Name[ga]=Breiseán Ríomhaire Glúine Asus
+Name[he]=תוסף למחשבי ברכיים בעלי ASUS
+Name[hu]=ASUS modul
+Name[is]=Asus ferðatölvuíforrit
+Name[it]=Plugin per portatili Asus
+Name[ja]=Asus ラップトップ プラグイン
+Name[ka]=Asus-ის ლეპტოპის მოდული
+Name[kk]=Asus ноутбуктің модулі
+Name[km]=កម្មវិធី​ជំនួយកុំព្យូទ័រ​យួរដៃ Asus
+Name[lt]=Asus Laptop priedas
+Name[nb]=Asus Laptop tillegg
+Name[nds]=Asus-Klappreeknermoduul
+Name[ne]=एसस ल्यापटप प्लगइन
+Name[nl]=Asus Laptop-plugin
+Name[nn]=Programtillegg for Asus-bærbare
+Name[pa]=Asus ਲੈਪਟਾਪ ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka laptopa Asus
+Name[pt]='Plugin' para Portáteis Asus
+Name[pt_BR]=Plugin para Laptops Asus
+Name[ru]=Ноутбук Asus
+Name[sk]=Modul pre Asus laptop
+Name[sl]=Vstavek za prenosnik Asus
+Name[sr]=Прикључак за Asus-ове лаптопе
+Name[sr@Latn]=Priključak za Asus-ove laptope
+Name[sv]=Insticksprogram för Asus bärbar dator
+Name[ta]=Asus மடிக்கணினி சொருகுப்பொருள்
+Name[tr]=Asus Dizüstü Bilgisayar Eklentisi
+Name[uk]=Втулок лептопа Asus
+Name[uz]=Asus laptopi uchun plagin
+Name[uz@cyrillic]=Asus лаптопи учун плагин
+Name[zh_CN]=华硕笔记本插件
+Name[zh_TW]=華碩筆記型電腦外掛程式
+Comment=Enables support for special Asus laptop keys
+Comment[ar]=تمكّن الدعم لمفاتيح حاسوب Asus المحمول الخاصة
+Comment[bg]=Тази приставка позволява поддръжката на специалните клавиши на Asus
+Comment[bs]=Omogućuje podršku za posebne tipke na Asus laptopima
+Comment[ca]=Habilita el funcionament per a tecles especials dels portàtils Asus
+Comment[cs]=Umožňuje podporu speciálních kláves laptopů Asus
+Comment[da]=Aktiverer støtte for specielle Asus bærbares taster
+Comment[de]=Dieses Plugin aktiviert die Unterstützung für Sondertasten bei Asus-Tastaturen
+Comment[el]=Ενεργοποιεί την υποστήριξη για ειδικά πλήκτρα φορητού Asus
+Comment[es]=Activa el soporte de las teclas especiales del portátil Asus
+Comment[et]=Võimaldab kasutada Asuse sülearvuti eriklahve
+Comment[eu]=Asus eramangarrien tekla berezientzako euskarria gaitzen du
+Comment[fa]=Asus فعال‌سازی پشتیبانی برای کلیدهای ویژۀ رایانۀ کیفی
+Comment[fi]=Tämä liitännäinen mahdollistaa erikoisnäppäinten tuen Asus-merkkisille kannettaville tietokoneille.
+Comment[fr]=Ce module active la gestion des touches spéciales des ordinateurs portables Asus
+Comment[ga]=Tacaigh le heochracha speisialta ar ríomhairí glúine Asus
+Comment[he]=מוסיף תמיכה בשביל מקשים מיוחדים של Asus
+Comment[hu]=Ez a bővítőmodul lehetővé teszi az ASUS noteszgépek speciális billentyűinek használatát
+Comment[is]=Virkjar stuðning fyrir sérhnappa Asus ferðavéla
+Comment[it]=Abilita il supporto per i tasti speciali dei portatili Asus
+Comment[ja]=Asus ラップトップの特殊キーをサポートします
+Comment[ka]=რთავს Asus-ის ლეპტოპის სპეციალური კლავიშების მხარდაჭერას
+Comment[kk]=Asus ноутбугінің арнаулы пернелерін қолдауы
+Comment[km]=បើក​ការគាំទ្រ​គ្រាប់ចុច​កុំព្យូទ័រ​យួរដៃ Asus ពិសេស
+Comment[lt]=Įgalina specialų Asus laptop raktų palaikymą
+Comment[nb]=Muliggjør støtte for spesielle taster på Asus maskiner
+Comment[nds]=Maakt de Sünnertasten-Ünnerstütten för Asus-Klappreekners an
+Comment[ne]=विशेष ल्यापटप कुञ्जीका लागि समर्थन सक्षम पार्दछ
+Comment[nl]=Activeert de ondersteuning voor speciale Asus-laptop-toetsen
+Comment[nn]=Dette programtillegget gjer det mogleg å bruka spesialtastar på Asus-bærbare
+Comment[pa]=ਖਾਸ Asus ਲੈਪਟਾਪ ਸਵਿੱਚਾਂ ਲਈ ਖਾਸ ਸਹਿਯੋਗ
+Comment[pl]=Włącza obsługę specjalnych klawiszy laptopa Asus
+Comment[pt]=Activa o suporte a teclas especiais dos portáteis Asus
+Comment[pt_BR]=Habilita suporte à teclas especiais dos laptops Asus
+Comment[ru]=Этот модуль поддерживает специальные клавиши ноутбука Asus
+Comment[sk]=Povoľuje podporu pre špeciálne klávesy Asus laptopu
+Comment[sl]=Omogoči podporo posebnim tipkam prenosnikov Asus
+Comment[sr]=Подршка за посебне тастере на Asus-овим лаптопима
+Comment[sr@Latn]=Podrška za posebne tastere na Asus-ovim laptopima
+Comment[sv]=Aktiverar stöd för speciella tangenter på Asus bärbar dator
+Comment[ta]=விசேஷ ஆஸ்சஸ் மடிக்கணினி விசைகளுக்கான ஆதரவை செயல்படுத்துகிறது
+Comment[tr]=Asus dizüstü bilgisayarlar için özel tuş desteğini etkinleştirir
+Comment[uk]=Уможливлює підтримку спеціальних клавіш для лептопа Asus
+Comment[zh_CN]=启用华硕笔记本的特殊按键
+Comment[zh_TW]=開啟華碩筆記型電腦特殊鍵支援
+X-KDE-Library=kmilo_asus
diff --git a/kmilo/configure.in.in b/kmilo/configure.in.in
new file mode 100644
index 0000000..048c5b3
--- /dev/null
+++ b/kmilo/configure.in.in
@@ -0,0 +1,60 @@
+
+##################################################################
+##
+## KMilo configure script
+## George Staikos <staikos@kde.org>
+##
+##################################################################
+
+dnl ---------------------------------------------------------------------
+dnl PowerBook IPC Library
+
+AC_ARG_WITH(powerbook,
+ [AC_HELP_STRING(--with-powerbook,
+ [enable support for PPC PowerBook @<:@default=check@:>@])],
+ [], with_powerbook=check)
+
+have_pbbipc=""
+have_pbb=""
+if test "x$with_powerbook" != xno; then
+
+KDE_CHECK_LIB(pbbipc, create_msgport,
+[
+KEYBOARD_LIBS="-lpbbipc $KEYBOARD_LIBS"
+AC_DEFINE(HAVE_POWERBOOK, 1, [If we have Apple PowerBook support])
+have_pbbipc=true
+])
+
+KDE_CHECK_LIB(pbb, init_libpbb,
+[
+KEYBOARD_LIBS="-lpbb $KEYBOARD_LIBS"
+AC_DEFINE(HAVE_POWERBOOK, 1, [If we have Apple PowerBook support])
+have_pbb=true
+])
+
+if test "x$with_powerbook" != xcheck && test -z "$have_pbbipc$have_pbb"; then
+ AC_MSG_ERROR([--with-powerbook was given, but test for libpbb failed])
+fi
+fi
+
+AM_CONDITIONAL(include_kmilo_powerbook, test x$have_pbbipc = xtrue)
+AM_CONDITIONAL(include_kmilo_pbb, test x$have_pbb = xtrue)
+
+dnl -----------------------------------------------------------------------
+dnl Check if Dell I8K module should be compiled (Linux systems only)
+AC_MSG_CHECKING([if dellI8k KMilo module should be compiled])
+case "$host" in
+ *-*-linux*) kmilo_delli8k_compile=yes; UNAME='Linux' ;;
+ *) kmilo_delli8k_compile=no; UNAME='' ;;
+esac
+
+AC_MSG_RESULT($kmilo_delli8k_compile)
+AM_CONDITIONAL(include_kmilo_delli8k, test x$kmilo_delli8k_compile = xyes)
+dnl -----------------------------------------------------------------------
+
+
+
+AC_CHECK_HEADER(linux/sonypi.h, [have_sonypi=true])
+AM_CONDITIONAL(include_kmilo_kvaio, test x$have_sonypi = xtrue)
+
+AC_SUBST(KEYBOARD_LIBS)
diff --git a/kmilo/delli8k/Makefile.am b/kmilo/delli8k/Makefile.am
new file mode 100644
index 0000000..8b495c2
--- /dev/null
+++ b/kmilo/delli8k/Makefile.am
@@ -0,0 +1,36 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+# Copyright (C) 2004 Barry O'Donovan <barry.odonovan@kdemail.net>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_delli8k.la
+
+kmilo_delli8k_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_delli8k_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO)
+kmilo_delli8k_la_SOURCES = delli8k.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = delli8k.h
+
+services_DATA = kmilo_delli8k.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_delli8k_la_SOURCES) -o $(podir)/kmilo_delli8k.pot
+
diff --git a/kmilo/delli8k/README b/kmilo/delli8k/README
new file mode 100644
index 0000000..80ae5b0
--- /dev/null
+++ b/kmilo/delli8k/README
@@ -0,0 +1,98 @@
+Dell Laptop Buttons Plug-in for KMilo
+
+Barry O'Donovan mail@barryodonovan.com, November 2004
+http://www.barryodonovan.com/
+
+KMilo is a service for kded, the KDE daemon. KMilo is new to KDE 3.2.
+It allows plug-ins which interact with the special buttons found on
+some keyboards and laptops.
+
+This plug-in reads the /proc/i8k file that is created by the i8k kernel
+module. If this file does not exist then the plug-in will not load.
+
+The code in this module is heavily based on:
+ - the Asus Laptop plug-in for KMilo by Chris Howells (howells@kde.org)
+ - the Thinkpad plug-in by Jonathan Riddell (jr@jriddell.org)
+
+Also, for the Dell specific implementations, code was taken from the
+i8kutils package of Massimo Dal Zotto <dz@debian.org> which can be
+downloaded from http://www.debian.org/~dz/i8k/
+
+LICENSE:
+
+ delli8k - KMilo plug-in for special volume keys of Dell laptops
+ Copyright (C) 2004 Barry O'Donovan <barry.odonovan@kdemail.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+COMPATIBILITY:
+
+This plug-in should work on any Linux distribution that has the i8k module
+loaded or compiled into the kernel. Compatibility is really dependant on
+the i8kutils package of Massimo Dal Zotto <dz@debian.org> which can be
+downloaded from http://www.debian.org/~dz/i8k/. Currently (20041122), this
+should support:
+
+ Inspiron 1100 (BIOS A06), one fan, no buttons
+ Inspiron 2650 (BIOS A05)
+ Inspiron 3700 (BIOS A15), no fan speed
+ Inspiron 3800 (BIOS A14), no fan speed
+ Inspiron 4000 (BIOS A10), no fan speed
+ Inspiron 4100
+ Inspiron 4150
+ Inspiron 5100 (BIOS A06), one fan, no buttons
+ Inspiron 5150 (BIOS A24), one fan, no buttons
+ Inspiron 8000 (BIOS A17)
+ Inspiron 8100 (BIOS A04)
+ Inspiron 8200 (BIOS A06)
+ Latitude C400 (BIOS A01)
+ Latitude C510 (BIOS A07)
+ Latitude C600 (BIOS A17)
+ Latitude C610
+ Latitude C800 (BIOS A17)
+ Latitude C810 (BIOS A12)
+ Latitude C840 (BIOS A10)
+ Latitude CPiA (BIOS A14), no fan speed
+ Latitude CPx J750GT (BIOS A13), no fan speed
+ Latitude D600 (BIOS A05)
+ Latitude D800 (BIOS A00)
+ Latitude X200 (BIOS A07)
+
+That driver seems *NOT WORKING* on the following models:
+
+ Inspiron 2500 (BIOS A10)
+ Inspiron 3200
+ Inspiron 3500
+ Inspiron 5000e (BIOS A06)
+ Inspiron 5150 (BIOS A23)
+ Inspiron 7000
+ Inspiron 7500
+ Latitude CPx H450GT
+ Latitude LS H500ST
+
+HISTORY:
+
+22 November 2004 - Initial release
+
+TODO:
+
+KCM Module
+ - set volume step size
+ - set dcop mixer device
+ - allow use of special keys
+ (this may require the user to set up key codes under X)
+
+
diff --git a/kmilo/delli8k/delli8k.cpp b/kmilo/delli8k/delli8k.cpp
new file mode 100644
index 0000000..74c0d60
--- /dev/null
+++ b/kmilo/delli8k/delli8k.cpp
@@ -0,0 +1,256 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2004 Barry O'Donovan (barry.odonovan@kdemail.net)
+
+ The code in this module is heavily based on:
+ - the Asus Laptop plug-in for KMilo
+ Copyright (c) 2004 Chris Howells (howells@kde.org)
+ - the Thinkpad plug-in
+ Copyright (c) 2004 Jonathan Riddell (jr@jriddell.org)
+ - the i8k kernel module and utilities (http://www.debian.org/~dz/i8k/)
+ Copyright (c) 2001-2003 Massimo Dal Zotto <dz@debian.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <kgenericfactory.h>
+
+#include "kmilointerface.h"
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include "i8k.h"
+
+/* For compatibilty with i8k kernel driver 1.1 */
+#define I8K_VOL_MUTE_1_1 3
+
+#include "delli8k.h"
+
+namespace KMilo
+{
+
+DellI8kMonitor::DellI8kMonitor( QObject* parent, const char* name, const QStringList& args )
+ : Monitor( parent, name, args )
+{
+}
+
+DellI8kMonitor::~DellI8kMonitor()
+{
+}
+
+bool DellI8kMonitor::init()
+{
+ kdDebug() << "KMilo: loading Dell I8k KMilo plugin" << endl;
+
+ // Ensure the Dell I8k kernel module is installed/loaded
+ if( ( m_fd = open( I8K_PROC, O_RDONLY ) ) < 0 )
+ {
+ kdDebug() << "KMilo: DellI8kMonitor: unable to open i8k proc file: " << I8K_PROC
+ << " in init()" << endl;
+ return false;
+ }
+ else
+ {
+ kmixClient = new DCOPRef( "kmix", "Mixer0" );
+ kmixWindow = new DCOPRef( "kmix", "kmix-mainwindow#1" );
+ retrieveVolume();
+ retrieveMute();
+ }
+
+ return true;
+}
+
+Monitor::DisplayType DellI8kMonitor::poll()
+{
+ Monitor::DisplayType pollResult = None;
+
+ if( ( m_status = fn_status( m_fd ) ) < 0 )
+ {
+ kdDebug() << "KMilo: DellI8kMonitor: unable to read fn status in poll()" << endl;
+ return pollResult;
+ }
+ else
+ {
+ switch( m_status )
+ {
+ case I8K_VOL_UP:
+ pollResult = Volume;
+ retrieveVolume();
+ setVolume( m_volume + DELLI8K_VOLUME_STEPSIZE );
+ m_progress = m_volume;
+ break;
+ case I8K_VOL_DOWN:
+ pollResult = Volume;
+ retrieveVolume();
+ setVolume( m_volume - DELLI8K_VOLUME_STEPSIZE );
+ m_progress = m_volume;
+ break;
+ case I8K_VOL_MUTE:
+ case I8K_VOL_MUTE_1_1:
+ pollResult = None;
+ retrieveMute();
+ setMute( !m_mute );
+ if( m_mute )
+ _interface->displayText( i18n( "Mute On" ) );
+ else
+ _interface->displayText( i18n( "Mute Off" ) );
+ break;
+ case 0:
+ break;
+ default:
+ kdDebug() << "KMile: DellI8kMonitor: invalid button status: " << m_status
+ << " in poll()" << endl;
+ break;
+ }
+ }
+
+ return pollResult;
+}
+
+int DellI8kMonitor::progress() const
+{
+ return m_progress;
+}
+
+bool DellI8kMonitor::retrieveVolume()
+{
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call( "masterVolume");
+
+ if( reply.isValid() )
+ {
+ m_volume = reply;
+ }
+ else
+ {
+ kmix_error = true;
+ }
+
+ if (kmix_error)
+ {
+ // maybe the error occurred because kmix wasn't running
+ if( kapp->startServiceByDesktopName( "kmix" ) == 0 ) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call( "masterVolume");
+ if( reply.isValid() )
+ {
+ m_volume = reply;
+ kmix_error = false;
+ kmixWindow->send( "hide" );
+ }
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdError() << "KMilo: DellI8kMonitor could not access kmix/Mixer0 via dcop" << endl;
+ return false;
+ }
+
+ return true;
+}
+
+void DellI8kMonitor::setVolume(int volume)
+{
+ if( !retrieveVolume() )
+ {
+ return;
+ }
+
+ if( volume > 100 )
+ {
+ m_volume = 100;
+ }
+ else if( volume < 0 )
+ {
+ m_volume = 0;
+ }
+ else
+ {
+ m_volume = volume;
+ }
+
+ kmixClient->send("setMasterVolume", m_volume);
+
+ m_progress = m_volume;
+}
+
+bool DellI8kMonitor::retrieveMute()
+{
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call( "masterMute" );
+
+ if( reply.isValid() )
+ {
+ m_mute = reply;
+ }
+ else
+ {
+ kmix_error = true;
+ }
+
+ if (kmix_error)
+ {
+ // maybe the error occurred because kmix wasn't running
+ if( kapp->startServiceByDesktopName( "kmix" ) == 0 ) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call( "masterVolume" );
+ if( reply.isValid() )
+ {
+ m_volume = reply;
+ kmix_error = false;
+ kmixWindow->send( "hide" );
+ }
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdError() << "KMilo: DellI8kMonitor could not access kmix/Mixer0 via dcop in isMute()" << endl;
+ return false;
+ }
+
+ return true;
+}
+
+void DellI8kMonitor::setMute( bool b )
+{
+ m_mute = b;
+ kmixClient->send( "setMasterMute", m_mute );
+}
+
+int DellI8kMonitor::fn_status( int fd )
+{
+ int args[1];
+ int rc;
+
+ if( ( rc = ioctl( fd, I8K_FN_STATUS, &args ) ) < 0 )
+ {
+ kdError() << "KMilo: DellI8kMonitor: ioctl failed in fn_status()" << endl;
+ return rc;
+ }
+
+ return args[0];
+}
+
+} //close namespace
+
+K_EXPORT_COMPONENT_FACTORY( kmilo_delli8k, KGenericFactory<KMilo::DellI8kMonitor>( "kmilo_delli8k" ) )
diff --git a/kmilo/delli8k/delli8k.h b/kmilo/delli8k/delli8k.h
new file mode 100644
index 0000000..d33f6ff
--- /dev/null
+++ b/kmilo/delli8k/delli8k.h
@@ -0,0 +1,89 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2004 Barry O'Donovan <barry.odonovan@kdemail.net>
+
+ The code in this module is heavily based on:
+ - the Asus Laptop plug-in for KMilo
+ Copyright (c) 2004 Chris Howells (howells@kde.org)
+ - the Thinkpad plug-in
+ Copyright (c) 2004 Jonathan Riddell (jr@jriddell.org)
+ - the i8k kernel module and utilities (http://www.debian.org/~dz/i8k/)
+ Copyright (c) 2001-2003 Massimo Dal Zotto <dz@debian.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef DELLI8K_H
+#define DELLI8K_H
+
+#include <kapplication.h>
+#include <dcopref.h>
+
+#include "monitor.h"
+
+#define DELLI8K_VOLUME_STEPSIZE 5
+
+namespace KMilo {
+
+
+/**
+ * KMilo plugin for Dell Laptops (conforming to the i8k driver)
+ */
+class DellI8kMonitor: public Monitor
+{
+ public:
+ DellI8kMonitor( QObject *parent, const char *name, const QStringList& );
+ virtual ~DellI8kMonitor();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Loads configuration.
+ */
+ virtual bool init();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Called by KMilo, this checks the /proc file system and acts on any changes
+ */
+ virtual DisplayType poll();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Called by KMilo if poll() returns a volume change.
+ * Returns the new volume percentage.
+ */
+ virtual int progress() const;
+
+ private:
+
+ void setVolume( int volume );
+ void setMute( bool b );
+ DCOPRef *kmixClient;
+ DCOPRef *kmixWindow;
+ bool retrieveVolume();
+ bool retrieveMute();
+ int m_status, m_volume;
+ bool m_mute;
+
+ int m_progress;
+ int m_fd;
+
+ int fn_status( int fd );
+};
+
+} //close namespace
+
+#endif
diff --git a/kmilo/delli8k/i8k.h b/kmilo/delli8k/i8k.h
new file mode 100644
index 0000000..1c45ba5
--- /dev/null
+++ b/kmilo/delli8k/i8k.h
@@ -0,0 +1,46 @@
+/*
+ * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops
+ *
+ * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _LINUX_I8K_H
+#define _LINUX_I8K_H
+
+#define I8K_PROC "/proc/i8k"
+#define I8K_PROC_FMT "1.0"
+
+#define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */
+#define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */
+#define I8K_POWER_STATUS _IOR ('i', 0x82, size_t)
+#define I8K_FN_STATUS _IOR ('i', 0x83, size_t)
+#define I8K_GET_TEMP _IOR ('i', 0x84, size_t)
+#define I8K_GET_SPEED _IOWR('i', 0x85, size_t)
+#define I8K_GET_FAN _IOWR('i', 0x86, size_t)
+#define I8K_SET_FAN _IOWR('i', 0x87, size_t)
+
+#define I8K_FAN_LEFT 1
+#define I8K_FAN_RIGHT 0
+#define I8K_FAN_OFF 0
+#define I8K_FAN_LOW 1
+#define I8K_FAN_HIGH 2
+#define I8K_FAN_MAX I8K_FAN_HIGH
+
+#define I8K_VOL_UP 1
+#define I8K_VOL_DOWN 2
+#define I8K_VOL_MUTE 4
+
+#define I8K_AC 1
+#define I8K_BATTERY 0
+
+#endif
diff --git a/kmilo/delli8k/kmilo_delli8k.desktop b/kmilo/delli8k/kmilo_delli8k.desktop
new file mode 100644
index 0000000..4dd7c97
--- /dev/null
+++ b/kmilo/delli8k/kmilo_delli8k.desktop
@@ -0,0 +1,96 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Dell I8k Laptop Plugin
+Name[ar]=ملحق حاسوب Dell I8k المحمول
+Name[br]=Lugent hezoug Dell I8k
+Name[bs]=Dodatak za Dell I8k laptope
+Name[ca]=Connector per portàtils Dell I8k
+Name[cs]=Dell I8k Laptop modul
+Name[da]=Dell I8k bærbar plugin
+Name[de]=Dell I8k Notebook-Plugin
+Name[el]=Πρόσθετο φορητού Dell I8k
+Name[es]=Extensión para el portátil Dell I8k
+Name[et]=Dell I8k sülearvuti plugin
+Name[eu]=Dell I8k Laptop Plugina
+Name[fa]=Dell I8k وصلۀ رایانۀ کیفی
+Name[fi]=Dell I8k -kannettavan liitännäinen
+Name[fr]=Module externe pour les Dell I8k
+Name[ga]=Breiseán Ríomhaire Glúine Dell I8k
+Name[he]=תוסף למחשבי ברכיים בעלי Dell l8k
+Name[hu]=Dell I8k modul
+Name[is]=Dell I8k ferðatölvuíforrit
+Name[it]=Plugin portatili Dell I8k
+Name[ja]=Dell I8k ラップトップ プラグイン
+Name[ka]=Dell I8k ლეპტოპის მოდული
+Name[kk]=Dell I8k ноутбуктің модулі
+Name[km]=កម្មវិធី​ជំនួយកុំព្យូទ័រ​យួរដៃ Dell I8k
+Name[lt]=Dell I8k Laptop priedas
+Name[nb]=Dell I8k Laptop tillegg
+Name[nds]=Dell I8k-Klappreeknermoduul
+Name[ne]=डेल I8k ल्यापटप प्लगइन
+Name[nl]=Dell i8000 Laptop-plugin
+Name[nn]=Programtillegg for Dell I8K-bærbare
+Name[pa]=Dell I8k ਲੈਪਟਾਪ ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka laptopa Dell I8k
+Name[pt]='Plugin' para Portáteis Dell I8k
+Name[pt_BR]=Plugin para Laptops Dell I8k
+Name[ru]=Ноутбук Dell I8k
+Name[sk]=Modul pre Dell l8k laptop
+Name[sl]=Vstavek za prenosnik Dell I8k
+Name[sr]=Прикључак за Dell-ове I8k лаптопе
+Name[sr@Latn]=Priključak za Dell-ove I8k laptope
+Name[sv]=Insticksprogram för Dell I8k bärbar dator
+Name[ta]=டெல் 18கே மடிக்கணினி சொருகுப்பொருள்
+Name[tr]=Dell I8k Laptop Eklentisi
+Name[uk]=Втулок лептопа Dell I8k
+Name[uz]=Dell I8k laptopi uchun plagin
+Name[uz@cyrillic]=Dell I8k лаптопи учун плагин
+Name[zh_CN]=Dell I8k 笔记本插件
+Name[zh_TW]=Dell I8k 筆記型電腦外掛程式
+Comment=Enables support for special Dell laptop keys
+Comment[ar]=تمكّن الدعم لمفاتيح حاسوب Dell المحمول الخاصة
+Comment[bg]=Тази приставка позволява поддръжката на специалните клавиши на Dell
+Comment[bs]=Omogućuje podršku za posebne tipke na Dell laptopima
+Comment[ca]=Habilita el funcionament per a tecles especials dels portàtils Dell
+Comment[cs]=Umožňuje podporu speciálních kláves laptopů Dell
+Comment[da]=Aktiverer støtte for specielle Dell bærbares taster
+Comment[de]=Dieses Plugin aktiviert die Unterstützung für Sondertasten bei Dell-Notebook-Tastaturen
+Comment[el]=Ενεργοποιεί την υποστήριξη για ειδικά πλήκτρα φορητού Dell
+Comment[es]=Activa el soporte de las teclas especiales del portátil Dell
+Comment[et]=Võimaldab kasutada Delli sülearvuti eriklahve
+Comment[eu]=Dell eramangarrien tekla berezientzako euskarria gaitzen du
+Comment[fa]=فعال‌سازی پشتیبانی برای کلیدهای ویژۀ رایانۀ کیفیDell
+Comment[fi]=Tämä liitännäinen mahdollistaa erikoisnäppäinten tuen Dellin kannettaville tietokoneille.
+Comment[fr]=Ce module active la gestion des touches spéciales des ordinateurs portables Dell
+Comment[ga]=Tacaigh le heochracha speisialta ar ríomhairí glúine Dell
+Comment[he]=מוסיף תמיכה בשביל מקשים מיוחדים של Dell
+Comment[hu]=Ez a bővítőmodul lehetővé teszi a Dell noteszgépek speciális billentyűinek használatát
+Comment[is]=Virkjar stuðning fyrir sérhnappa Dell ferðavéla
+Comment[it]=Abilita il supporto per i tasti speciali dei portatili Dell
+Comment[ja]=Dell ラップトップの特殊キーをサポートします
+Comment[ka]=რთავს Dell-ის ლეპტოპის სპეციალური კლავიშების მხარდაჭერას
+Comment[kk]=Dell ноутбуктің арнаулы пернелерін қолдауы
+Comment[km]=បើក​ការគាំទ្រ​សម្រាប់គ្រាប់ចុច​កុំព្យូទ័រ​យួរដៃ Dell
+Comment[lt]=Įgalina specialų Dell nešiojamo kompiuterio raktų palaikymą
+Comment[nb]=Muliggjør støtte for spesielle taster på Dell bærbare maskiner
+Comment[nds]=Maakt de Sünnertasten-Ünnerstütten för Dell-Klappreekners an
+Comment[ne]=विशेष डेल ल्यापटप कुञ्जीका लागि समर्थन सक्षम पार्दछ
+Comment[nl]=Activeert de ondersteuning voor speciale Dell-laptop-toetsen
+Comment[nn]=Dette programtillegget gjer det mogleg å bruka spesialtastar på Dell-bærbare
+Comment[pl]=Włącza obsługę specjalnych klawiszy laptopa Dell
+Comment[pt]=Activa o suporte a teclas especiais dos portáteis Dell
+Comment[pt_BR]=Habilita suporte para teclas especiais nos laptops Dell
+Comment[ru]=Этот модуль поддерживает специальные клавиши ноутбука Dell
+Comment[sk]=Povoľuje podporu pre špeciálne klávesy Dell laptopu
+Comment[sl]=Omogoči podporo posebnim tipkam prenosnikov Dell
+Comment[sr]=Подршка за посебне тастере на Dell-овим лаптопима
+Comment[sr@Latn]=Podrška za posebne tastere na Dell-ovim laptopima
+Comment[sv]=Aktiverar stöd för speciella tangenter på Dell bärbar dator
+Comment[ta]=விசேஷ டெல் மடிக்கணினி விசைகளுக்கான ஆதரவை செயல்படுத்துகிறது
+Comment[tr]=Dell dizüstü bilgisayarların özel tuşları için desteği etkinleştirir
+Comment[uk]=Уможливлює підтримку спеціальних клавіш для лептопа Dell
+Comment[zh_CN]=此插件启用 Dell 笔记本的特殊按键
+Comment[zh_TW]=開啟 Dell 筆記型電腦特殊鍵支援
+X-KDE-Library=kmilo_delli8k
diff --git a/kmilo/demo/Makefile.am b/kmilo/demo/Makefile.am
new file mode 100644
index 0000000..8ac7a46
--- /dev/null
+++ b/kmilo/demo/Makefile.am
@@ -0,0 +1,32 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_demo.la
+
+kmilo_demo_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_demo_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO)
+kmilo_demo_la_SOURCES = demo.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = demo.h
+
+services_DATA = kmilo_demo.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
diff --git a/kmilo/demo/demo.cpp b/kmilo/demo/demo.cpp
new file mode 100644
index 0000000..668d137
--- /dev/null
+++ b/kmilo/demo/demo.cpp
@@ -0,0 +1,56 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <kgenericfactory.h>
+
+#include "demo.h"
+
+namespace KMilo {
+
+Demo::Demo(QObject *parent, const char *name, const QStringList& args)
+: Monitor(parent, name, args) {
+}
+
+
+Demo::~Demo() {
+}
+
+
+bool Demo::init() {
+return true;
+}
+
+
+Monitor::DisplayType Demo::poll() {
+Monitor::DisplayType rc = None;
+return rc;
+}
+
+
+int Demo::progress() const {
+ return 10;
+}
+
+};
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_demo, KGenericFactory<Demo>)
+
diff --git a/kmilo/demo/demo.h b/kmilo/demo/demo.h
new file mode 100644
index 0000000..6f57cfc
--- /dev/null
+++ b/kmilo/demo/demo.h
@@ -0,0 +1,39 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _DEMO_H_
+#define _DEMO_H_
+
+#include "monitor.h"
+
+class Demo : public KMilo::Monitor {
+ public:
+ Demo(QObject *parent, const char *name, const QStringList&);
+ virtual ~Demo();
+
+ virtual bool init();
+ virtual DisplayType poll();
+ virtual int progress() const;
+
+ private:
+};
+
+#endif
diff --git a/kmilo/demo/kmilo_demo.desktop b/kmilo/demo/kmilo_demo.desktop
new file mode 100644
index 0000000..288903f
--- /dev/null
+++ b/kmilo/demo/kmilo_demo.desktop
@@ -0,0 +1,110 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Demo Plugin
+Name[ar]=ملحق للعرض
+Name[bg]=Демонстрационна приставка
+Name[ca]=Connector demo
+Name[cy]=Ategyn Arddangosiad
+Name[da]=Demo-plugin
+Name[de]=Demo-Plugin
+Name[el]=Πρόσθετο επίδειξης
+Name[eo]=Demo-kromaĵo
+Name[es]=Extensión de demostración
+Name[et]=Demoplugin
+Name[eu]=Demo Plugina
+Name[fa]=وصلۀ Demo
+Name[fi]=Esimerkkiliitännäinen
+Name[fr]=Module externe de démonstration
+Name[ga]=Breiseán Taispeána
+Name[he]=תוסף לדוגמה
+Name[hi]=डेमो प्लगइन
+Name[hu]=Mintamodul
+Name[is]=Sýnishorn af íforriti
+Name[it]=Plugin dimostrativo
+Name[ja]=デモプラグイン
+Name[ka]=Demo მოდული
+Name[kk]=Үлгілі модулі
+Name[km]=កម្មវិធី​ជំនួយ​សាកល្បង
+Name[lt]=Demo priedas
+Name[mk]=Демо приклучок
+Name[nb]=Programtillegg for demo
+Name[nds]=Demo-Moduul
+Name[ne]=डेमो प्लगइन
+Name[nl]=Demo-plugin
+Name[nn]=Demo-programtillegg
+Name[pa]=ਫ਼ਰਜੀ ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka demonstracyjna
+Name[pt]='Plugin' de Demonstração
+Name[pt_BR]=Plug-in de Demonstração
+Name[ro]=Modul demonstrativ
+Name[ru]=Демонстрационный модуль
+Name[sk]=Testovací modul
+Name[sl]=Demonstracijski vstavek
+Name[sr]=Демонстрациони прикључак
+Name[sr@Latn]=Demonstracioni priključak
+Name[sv]=Demoinsticksprogram
+Name[ta]= முன்னோட்ட சொருகி
+Name[tg]=Модули Намоиш
+Name[uk]=Демонстраційний втулок
+Name[uz]=Demo plagini
+Name[uz@cyrillic]=Демо плагини
+Name[wa]=Tchôke-divins di mostraedje
+Name[zh_CN]=演示插件
+Name[zh_TW]=示範用外掛程式
+Comment=This plugin does nothing.
+Comment[ar]=لا يفعل هذا الملحق أى شئ..
+Comment[bg]=Тази приставка не прави нищо
+Comment[bs]=Ovaj dodatak ne radi ništa.
+Comment[ca]=Aquest connector no fa res.
+Comment[cy]=Nid yw'r ategyn yma yn gwneud unrhyw beth.
+Comment[da]=Dette plugin gør ingenting.
+Comment[de]=Dieses Plugin macht nichts.
+Comment[el]=Αυτό το πρόσθετο δεν κάνει τίποτα.
+Comment[eo]=Tiu kromaĵo faras nenion.
+Comment[es]=Esta extensión no hace nada.
+Comment[et]=See plugin ei tee mitte kui midagi.
+Comment[eu]=Plugin honek ez du ezer egiten.
+Comment[fa]=این وصله کاری انجام نمی‌دهد.
+Comment[fi]=Tämä liitännäinen ei tee mitään.
+Comment[fr]=Ce module ne fait rien.
+Comment[ga]=Ní dhéanann an breiseán seo faic.
+Comment[he]=התוסף הזה לא עושה כלום
+Comment[hi]=यह प्लगइन कुछ नहीं करता है.
+Comment[hu]=Ez a bővítőmodul nem csinál semmit
+Comment[is]=Þetta íforrit gerir ekki neitt.
+Comment[it]=Questo plugin non fa niente
+Comment[ja]=このプラグインは何もしません
+Comment[ka]=ეს მოდული არაფერს არ აკეთებს
+Comment[kk]=Бұл модуль ештеңе істемейді.
+Comment[km]=កម្មវិធី​ជំនួយ​នេះ​មិន​ធ្វើ​អ្វី ។
+Comment[lt]=Šis priedas nieko nedaro.
+Comment[mk]=Овој приклучок не прави ништо.
+Comment[ms]=Plug masuk ini tidak melakukan apa-apa.
+Comment[nb]=Dette programtillegget utfører ingen funksjoner
+Comment[nds]=Dit Moduul deit nix.
+Comment[ne]=यो प्लगइनले केही गर्दैन ।
+Comment[nl]=Deze plugin doet niets.
+Comment[nn]=Dette programtillegget gjer ikkje noko som helst.
+Comment[pa]=ਇਹ ਪਲੱਗਿੰਨ ਕੁਝ ਨਹੀਂ ਕਰਦੀ ਹੈ।
+Comment[pl]=Ta wtyczka nic nie robi.
+Comment[pt]=Este 'plugin' não faz nada.
+Comment[pt_BR]=Este plug-in não faz coisa alguma.
+Comment[ro]=Acest modul nu face nimic.
+Comment[ru]=Этот модуль ничего не делает.
+Comment[sk]=Tento modul nič nerobí.
+Comment[sl]=Ta vstavek ne naredi ničesar.
+Comment[sr]=Овај прикључак ништа не ради.
+Comment[sr@Latn]=Ovaj priključak ništa ne radi.
+Comment[sv]=Det här insticksprogrammet gör ingenting.
+Comment[ta]= செருகுப்பொருள் செயல்படவில்லை.
+Comment[tg]=Ин модул ҳеҷ чиз намекунад.
+Comment[tr]=Bu plugin birşey yapmaz.
+Comment[uk]=Цей втулок нічого не робить.
+Comment[uz]=Bu plagin hech narsa bajarmaydi.
+Comment[uz@cyrillic]=Бу плагин ҳеч нарса бажармайди.
+Comment[wa]=Ci tchôke-divins chal ni fwait rén do tot.
+Comment[zh_CN]=此插件不完成任何工作。
+Comment[zh_TW]=這個外掛程式不做任何事。
+X-KDE-Library=kmilo_demo
diff --git a/kmilo/generic/Makefile.am b/kmilo/generic/Makefile.am
new file mode 100644
index 0000000..1dd7094
--- /dev/null
+++ b/kmilo/generic/Makefile.am
@@ -0,0 +1,34 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_generic.la
+
+kmilo_generic_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_generic_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO)
+kmilo_generic_la_SOURCES = generic_monitor.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = generic_monitor.h
+
+services_DATA = kmilo_generic.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_generic_la_SOURCES) -o $(podir)/kmilo_generic.pot
diff --git a/kmilo/generic/README b/kmilo/generic/README
new file mode 100644
index 0000000..1727e8e
--- /dev/null
+++ b/kmilo/generic/README
@@ -0,0 +1,38 @@
+This module provides support for the VolumeUp, VolumeDown and Mute Internet
+keys found in many laptops and special keyboards.
+
+Please note that in order this module to work, mentioned special keys have to
+generate appropriate X key symbols (keysyms), namely XF86AudioLowerVolume,
+XF86AudioRaiseVolume, XF86AudioMute. You can use "xev" program to watch events
+generated by X server and "xmodmap" program to assign events (keycodes) to
+keysyms. Also watch kernel log (dmesg) for unknown scancodes.
+
+If you use CTRL in conjunction with volUp/Down it changes the volume by 1%,
+otherwise by 10%.
+
+This module is now configurable (though with no configuration GUI), you can
+change which channels (kmix device indexes) to change volume on, you can also
+tweak volume changing steps. Channels are represented by numeric indexes
+starting from zero, in order to get the right channel, you have to experiment
+a little (keep the kmix mixer window open). ;) Examples:
+
+# Change "fast" step to 5% and "slow" step to 2%:
+kwriteconfig --file kmilodrc --group "generic monitor" --key volumeStepFast 5
+kwriteconfig --file kmilodrc --group "generic monitor" --key volumeStepSlow 2
+
+# Change channel to set volume on to 1 (use -1 to use kmix' master device):
+kwriteconfig --file kmilodrc --group "generic monitor" --key volumeDeviceIdx 1
+
+# You can also specify different mute channel (leave it unset or set it to -1
+# to use the same channel for muting and changing volume):
+kwriteconfig --file kmilodrc --group "generic monitor" --key muteDeviceIdx 2
+
+# KMilo now supports an extra channel, whose volume and mute will be set to
+# whatever your primary channel is set to. (leave it unset or set it to -1 to
+# disable this functionality):
+kwriteconfig --file kmilodrc --group "generic monitor" --key extraDeviceIdx 5
+
+# Use following call to apply these settings without restarting your session:
+dcop kded kmilod reconfigure
+
+Have fun.
diff --git a/kmilo/generic/generic_monitor.cpp b/kmilo/generic/generic_monitor.cpp
new file mode 100644
index 0000000..40e7169
--- /dev/null
+++ b/kmilo/generic/generic_monitor.cpp
@@ -0,0 +1,324 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 Willi Richert <w.richert@gmx.net>
+ Pretty much ripped off from :
+ George Staikos <staikos@kde.org> :)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "generic_monitor.h"
+#include "kmilointerface.h"
+#include <qmessagebox.h>
+#include <qfile.h>
+
+#define CONFIG_FILE "kmilodrc"
+
+
+using namespace KMilo;
+
+GenericMonitor::GenericMonitor(QObject *parent, const char *name, const QStringList& args)
+: Monitor(parent, name, args)
+{
+ _poll = false;
+ m_displayType = Monitor::None;
+
+ m_mute = false;
+ m_progress = 0;
+ m_minVolume = 0;
+ m_maxVolume = 100;
+ m_volume = 50;
+}
+
+GenericMonitor::~GenericMonitor()
+{
+ if(ga) {
+ ga->remove("FastVolumeUp");
+ ga->remove("FastVolumeDown");
+ ga->remove("SlowVolumeUp");
+ ga->remove("SlowVolumeDown");
+ ga->remove("Mute");
+ delete ga;
+ }
+}
+
+bool GenericMonitor::init()
+{
+ KConfig config(CONFIG_FILE);
+ reconfigure(&config);
+
+ if(!m_enabled)
+ return false; // exit early if we are not supposed to run
+
+ static const ShortcutInfo shortcuts[] = {
+ { "FastVolumeUp", Qt::Key_VolumeUp, SLOT(fastVolumeUp()) },
+ { "FastVolumeDown", Qt::Key_VolumeDown, SLOT(fastVolumeDown()) },
+ { "SlowVolumeUp", Qt::CTRL+Qt::Key_VolumeUp, SLOT(slowVolumeUp()) },
+ { "SlowVolumeDown", Qt::CTRL+Qt::Key_VolumeDown, SLOT(slowVolumeDown()) },
+ { "Mute", KShortcut("XF86AudioMute"), SLOT(mute()) }
+ };
+
+ ga = new KGlobalAccel(this, "miloGenericAccel");
+
+ ShortcutInfo si;
+ int len = (int)sizeof(shortcuts)/sizeof(ShortcutInfo);
+ for (int i = 0; i < len; i++) {
+ si = shortcuts[i];
+
+ ga->insert(si.name, QString::null, QString::null,
+ si.symbol, si.symbol,
+ this,
+ si.slot, false);
+ }
+
+ ga->readSettings();
+ ga->updateConnections();
+
+ kmixClient = new DCOPRef("kmix", "Mixer0");
+ kmixWindow = new DCOPRef("kmix", "kmix-mainwindow#1");
+
+ return true;
+}
+
+void GenericMonitor::reconfigure(KConfig *config)
+{
+ config->setGroup("generic monitor");
+
+ m_volumeDeviceIdx = config->readNumEntry("volumeDeviceIdx", -1);
+ m_muteDeviceIdx = config->readNumEntry("muteDeviceIdx", m_volumeDeviceIdx);
+ m_extraDeviceIdx = config->readNumEntry("extraDeviceIdx", -1);
+ m_volumeStepFast = config->readNumEntry("volumeStepFast", 10);
+ m_volumeStepSlow = config->readNumEntry("volumeStepSlow", 1);
+ m_enabled = config->readBoolEntry("enabled", true);
+}
+
+bool GenericMonitor::retrieveKmixDevices()
+{
+ if(m_volumeDeviceIdx != -1 && m_muteDeviceIdx != -1)
+ return true; // both indexes already set
+
+ DCOPReply reply = kmixClient->call("masterDeviceIndex");
+ if (!reply.isValid())
+ { // maybe the error occurred because kmix wasn't running
+ _interface->displayText(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ reply = kmixClient->call("masterDeviceIndex");
+ if (reply.isValid())
+ kmixWindow->send("hide");
+ }
+ }
+
+ if (!reply.isValid())
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ _interface->displayText(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ if (m_volumeDeviceIdx == -1)
+ m_volumeDeviceIdx = reply;
+ if (m_muteDeviceIdx == -1)
+ m_muteDeviceIdx = m_volumeDeviceIdx; // this is the behaviour documented in README
+ return true;
+ }
+}
+
+bool GenericMonitor::retrieveVolume()
+{
+ bool kmix_error = false;
+
+ if(!retrieveKmixDevices())
+ return false;
+
+ DCOPReply reply = kmixClient->call("absoluteVolume", m_volumeDeviceIdx);
+ if (reply.isValid())
+ m_volume = reply;
+ else
+ kmix_error = true;
+
+ if (kmix_error) // maybe the error occurred because kmix wasn't running
+ {
+ _interface->displayText(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call("absoluteVolume", m_volumeDeviceIdx);
+ if (reply.isValid())
+ {
+ m_volume = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ _interface->displayText(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ reply = kmixClient->call("absoluteVolumeMax", m_volumeDeviceIdx);
+ m_maxVolume = reply;
+ reply = kmixClient->call("absoluteVolumeMin", m_volumeDeviceIdx);
+ m_minVolume = reply;
+ return true;
+ }
+}
+
+void GenericMonitor::volumeChange(int direction, int step)
+{
+ if (!retrieveVolume())
+ return;
+
+ /* Following snippet of code may seem to be overcomplicated, but it works for both devices with
+ * volume grain < 100 (32 tested) and devices with volume grain > 100 (256 tested) while preserving
+ * accuracy for devices with fine grain and preserving usability for devices with rough grain. */
+ int userVisibleVolume = qRound(m_volume * 100.0 / (m_maxVolume - m_minVolume));
+ userVisibleVolume += direction * step; // add requested volume step
+ long previousVolume = m_volume;
+ m_volume = qRound(m_minVolume + userVisibleVolume * (m_maxVolume - m_minVolume) / 100.0);
+ if (m_volume == previousVolume) // if the change was rounded to zero
+ m_volume += direction;
+
+ if (m_volume > m_maxVolume)
+ m_volume = m_maxVolume;
+ if (m_volume < m_minVolume)
+ m_volume = m_minVolume;
+
+ displayVolume();
+}
+
+void GenericMonitor::slowVolumeUp() { volumeChange( 1, m_volumeStepSlow); }
+void GenericMonitor::slowVolumeDown() { volumeChange(-1, m_volumeStepSlow); }
+void GenericMonitor::fastVolumeUp() { volumeChange( 1, m_volumeStepFast); }
+void GenericMonitor::fastVolumeDown() { volumeChange(-1, m_volumeStepFast); }
+
+void GenericMonitor::displayVolume()
+{
+ _interface->displayProgress(i18n("Volume"), qRound(m_volume * 100.0 / (m_maxVolume - m_minVolume)));
+
+ // If we got this far, the DCOP communication with kmix works,
+ // so we don't have to test the result.
+ // Also, device indexes are set to their proper values.
+ kmixClient->send("setAbsoluteVolume", m_volumeDeviceIdx, m_volume);
+ if(m_extraDeviceIdx != -1)
+ // for simplicity, use relative volume rather that absolute (extra precision is not needed here)
+ kmixClient->send("setVolume", m_extraDeviceIdx, qRound(m_volume * 100.0 / (m_maxVolume - m_minVolume)));
+
+ // if mute then unmute
+ if (m_mute)
+ {
+ m_mute = false;
+ kmixClient->send("setMute", m_muteDeviceIdx, m_mute);
+ }
+}
+
+bool GenericMonitor::retrieveMute()
+{
+ bool kmix_error = false;
+
+ if(!retrieveKmixDevices())
+ return false;
+
+ DCOPReply reply = kmixClient->call("mute", m_muteDeviceIdx);
+ if (reply.isValid())
+ m_mute = reply;
+ else
+ kmix_error = true;
+
+ if (kmix_error)
+ {
+ // maybe the error occurred because kmix wasn't running
+ _interface->displayText(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call("mute", m_muteDeviceIdx);
+ if (reply.isValid())
+ {
+ m_mute = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ } else
+ {
+ kmixWindow->send("hide");
+ kmix_error = true;
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ _interface->displayText(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void GenericMonitor::mute()
+{
+ if (!retrieveMute())
+ return;
+
+ m_mute = !m_mute;
+ QString muteText;
+ if (m_mute)
+ {
+ muteText = i18n("Mute on");
+ } else {
+ muteText = i18n("Mute off");
+ }
+
+ kmixClient->send("setMute", m_muteDeviceIdx, m_mute);
+ if(m_extraDeviceIdx != -1)
+ kmixClient->send("setMute", m_extraDeviceIdx, m_mute);
+
+ _interface->displayText(muteText);
+}
+
+int GenericMonitor::progress() const
+{
+ return m_progress;
+}
+
+Monitor::DisplayType GenericMonitor::poll()
+{
+ return m_displayType;
+}
+
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_generic, KGenericFactory<GenericMonitor>("kmilo_generic"))
+
+#include "generic_monitor.moc"
diff --git a/kmilo/generic/generic_monitor.h b/kmilo/generic/generic_monitor.h
new file mode 100644
index 0000000..c2477c4
--- /dev/null
+++ b/kmilo/generic/generic_monitor.h
@@ -0,0 +1,94 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 Willi Richert <w.richert@gmx.net>
+ Pretty much ripped of from :
+ George Staikos <staikos@kde.org> :)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _GENERICMONITOR_H_
+#define _GENERICMONITOR_H_
+
+#include <kmainwindow.h>
+#include <kglobalaccel.h>
+#include <dcopref.h>
+#include <kapplication.h>
+
+#include "kmilod.h"
+#include "monitor.h"
+
+namespace KMilo {
+
+// now the key data (from kkeyserver_x11.h and $QTDIR/include/qnamespace.h)
+struct ShortcutInfo
+{
+ const char* name;
+ uint symbol;
+ const char *slot;
+};
+
+
+class GenericMonitor : public Monitor
+{
+ Q_OBJECT
+
+public:
+ GenericMonitor(QObject *parent, const char *name, const QStringList&);
+ virtual ~GenericMonitor();
+
+ virtual bool init();
+ virtual int progress() const;
+ virtual DisplayType poll();
+ virtual void reconfigure(KConfig*);
+
+public slots:
+ void slowVolumeUp();
+ void slowVolumeDown();
+ void fastVolumeUp();
+ void fastVolumeDown();
+ void mute();
+
+private:
+ bool retrieveKmixDevices();
+ void volumeChange(int direction, int step);
+ bool retrieveMute();
+ bool retrieveVolume();
+ void displayVolume();
+
+ KGlobalAccel *ga;
+
+ DCOPRef *kmixClient, *kmixWindow;
+
+ int m_progress;
+ long m_volume;
+ bool m_mute;
+
+ long m_maxVolume, m_minVolume;
+
+ // following properties are read from config file:
+ int m_volumeStepFast, m_volumeStepSlow;
+ int m_volumeDeviceIdx, m_muteDeviceIdx, m_extraDeviceIdx;
+ bool m_enabled;
+
+ Monitor::DisplayType m_displayType;
+};
+
+}
+
+#endif
diff --git a/kmilo/generic/kmilo_generic.desktop b/kmilo/generic/kmilo_generic.desktop
new file mode 100644
index 0000000..89d55d0
--- /dev/null
+++ b/kmilo/generic/kmilo_generic.desktop
@@ -0,0 +1,108 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Generic Keyboard Plugin
+Name[ar]=ملحق عام للوحة المفاتيح
+Name[bg]=Приставка за клавиатурата
+Name[bs]=Opšti dodatak za tastaturu
+Name[ca]=Connector de teclat genèric
+Name[cs]=Obecný modul klávesnice
+Name[cy]=Ategyn Bysellfwrdd Cyffredinol
+Name[da]=Generisk tastatur-plugin
+Name[de]=Allgemeines Tastatur-Plugin
+Name[el]=Γενικευμένο πρόσθετο πληκτρολογίου
+Name[eo]=Komuna klavar-kromprogramo
+Name[es]=Extensión de teclado genérico
+Name[et]=Tavaline klaviatuuriplugin
+Name[eu]=Teklatu Arruntaren Plugina
+Name[fa]=وصلۀ کلی صفحه کلید
+Name[fi]=Yleinen näppäimistöliitännäinen
+Name[fr]=Module externe de clavier générique
+Name[ga]=Breiseán Cineálach Méarchláir
+Name[he]=תוסף גנרי למקלדות
+Name[hi]=जेनेरिक कुंजीपट प्लगइन
+Name[hu]=Általános billentyűzet-bővítőmodul
+Name[is]=Almennt lyklaborðsíforrit
+Name[it]=Plugin tastiera generica
+Name[ja]=一般キーボードプラグイン
+Name[ka]=სტანდარტული კლავიატურა მოდული
+Name[kk]=Негізгі пернетақта модулі
+Name[km]=កម្មវិធី​ជំនួយ​ក្តារចុច​ទូទៅ
+Name[lt]=Bendro pobūdžio klaviatūros priedas
+Name[mk]=Општ приклучок за тастатура
+Name[nb]=Programtillegg for generisk tastatur
+Name[nds]=Allgemeen Tastatuurmoduul
+Name[ne]=जेनेरिक कुञ्जीपाटी प्लगइन
+Name[nl]=Algemene toetsenbord-plugin
+Name[nn]=Programtillegg for generisk tastatur
+Name[pa]=ਸਧਾਰਨ ਕੀ-ਬੋਰਡ ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka zwykłej klawiatury
+Name[pt]='Plugin' de Teclado Genérico
+Name[pt_BR]=Plug-in de Teclado Genérico
+Name[ro]=Modul generic de tastatură
+Name[ru]=Модуль клавиатуры
+Name[sk]=Modul pre generickú klávesnicu
+Name[sl]=Generični vstavek za tipkovnice
+Name[sr]=Генерички прикључак тастатуре
+Name[sr@Latn]=Generički priključak tastature
+Name[sv]=Allmänt insticksprogram för tangentbord
+Name[ta]= பொதுவான விசைப்பலகை சொருகுபொருள்
+Name[tg]=Модули Умумии Забонак
+Name[tr]=Generic Klavye Plugini
+Name[uk]=Загальний втулок клавіатури
+Name[uz]=Umumiy tugmatag plagini
+Name[uz@cyrillic]=Умумий тугматаг плагини
+Name[wa]=Tchôke-divins djenerike di taprece
+Name[zh_CN]=常规键盘插件
+Name[zh_TW]=一般鍵盤外掛程式
+Comment=This plugin enables support for special keys on all sorts of keyboards and laptops.
+Comment[ar]=تمكّن الدعم للمفاتيح الخاصة فى كل أنواع لوحات المفاتيح والحواسيب المحمولة.
+Comment[bg]=Тази приставка позволява поддръжката на специалните клавиши на различните видове лаптопи и специални клавиатури
+Comment[bs]=Ovaj dodatak (plugin) omogućuje podršku za posebne tipke na raznim vrstama tastatura i laptopa.
+Comment[ca]=Aquest connector activa el funcionament per a tecles especials en tot tipus de teclats i portàtils.
+Comment[cs]=Tento modul umožňuje používat zvláštní klávesy na všech typech klávesnic a notebooků.
+Comment[cy]=Mae'r ategyn yn galluogi cynhaliaeth ar gyfer bysyll arbennig ar bob math o bysellfyrdd a gluniaduron.
+Comment[da]=Dette plugin aktivere støtte for specielle taster på alle slags tastaturer og bærbare.
+Comment[de]=Dieses Plugin aktiviert die Unterstützung für die Sondertasten diverser Tastaturen und Notebooks.
+Comment[el]=Αυτό το πρόσθετο ενεργοποιεί την υποστήριξη για ειδικά πλήκτρα σε όλα τα είδη των πληκτρολογίων και φορητών υπολογιστών.
+Comment[es]=Esta extensión activa el soporte de las teclas especiales en todo tipo de teclados y portátiles.
+Comment[et]=See plugin võimaldab kasutada eriklahve igasugustel klaviatuuridel ja sülearvutitel.
+Comment[eu]=Plugin honek tekla berezientzako euskarria gaitzen du teklatu eta magaleko mota guztietan.
+Comment[fa]=این وصله، برای کلیدهای ویژه روی همۀ انواع صفحه کلید و رایانه‌های کیفی، پشتیبانی را فعال می‌سازد.
+Comment[fi]=Tämä liitännäinen mahdollistaa erikoisnäppäinten tuen kaikenlaisille näppäimistöille ja kannettavilla tietokoneille.
+Comment[fr]=Ce module active la gestion des touches spéciales pour toutes sortes de claviers et de portables.
+Comment[ga]=Tacaíonn an breiseán seo le cnaipí speisialta ar neart sóirt méarchlár agus ríomhairí glúine.
+Comment[he]=תוסף זה מאפשר את השימוש בכל המקשים המיוחדים במקלדת ומחשבים ניידים.
+Comment[hi]=यह प्लगइन सभी क़िस्म के कुंजीपट तथा लैपटॉप पर विशिष्ट कुंजी समर्थन सक्षम करता है
+Comment[hu]=Ez a bővítőmodul lehetővé teszi az extra billentyűk használatát speciális billentyűzeteknél és noteszgépeken.
+Comment[is]=Þetta íforrit virkjar sérhnappana sem eru á allskynd gerðum lyklaborða og ferðavéla.
+Comment[it]=Questo plugin abilita il supporto per i tasti speciali su qualsiasi tipo di tastiera e portatile.
+Comment[ja]=このプラグインはあらゆる種類のキーボードとラップトップで特殊キーをサポートします
+Comment[ka]=ეს მოდული რთავს ყველანაერი ტიპის კლავიატურების (მათ შორის ლეპტოპების) სპეციალური კლავიშების მხარდაჭერას.
+Comment[kk]=Бұл модуль барлық пернетақталар мен ноутбуктердегі арнаулы пернелерді қолдайды.
+Comment[km]=កម្មវិធី​ជំនួយ​នេះបើក​ការគាំទ្រ សម្រាប់​គ្រាប់ចុច​ពិសេស​នៅ​លើ​ប្រភេទ​ក្តារចុច និង​កុំព្យូទ័រ​យួរដៃ​ទាំងអស់ ។
+Comment[lt]=Šis priedas įgalina ypatingų klavišų palaikymą įvairių tipų klaviatūrose bei nešiojamuose kompiuteriuose.
+Comment[mk]=Овој приклучок дава поддршка за специјалните копчиња на сите видови на тастатури и лаптопи.
+Comment[nb]=Dette programtillegget muliggjør støtte for spesielle taster på alle tastatur og bærbare maskiner
+Comment[nds]=Dit Moduul maakt de Sünnertasten-Ünnerstütten för all Oorden vun Tastaturen un Klappreekners an.
+Comment[ne]=यो प्लगइनले कुञ्जीपाटी र ल्यापटपको सबै क्रमबद्धतामा विशेष कुञ्जीका लागि समर्थन सक्षम पार्दछ ।
+Comment[nl]=Deze plugin biedt ondersteuning voor allerlei speciale toetsen op laptops en gewone toetsenborden.
+Comment[nn]=Dette programtillegget gjer det mogleg å bruka spesialtastar på alle tastatur og bærbare maskiner.
+Comment[pl]=Ta wtyczka umożliwia używanie klawiszy specjalnych na wszystkich rodzajach klawiatur i laptopach.
+Comment[pt]=Este 'plugin' activa o suporte para as teclas especiais em todos os tipos de teclados e portáteis.
+Comment[pt_BR]=Este plug-in habilita suporte para teclas especiais em todos os tipos de laptops e teclados.
+Comment[ro]=Acest modul activează suportul pentru tastele speciale de pe tot felul de tastaturi şi laptop-uri.
+Comment[ru]=Этот модуль поддерживает специальные клавиши на всех типах клавиатур и ноутбуках.
+Comment[sk]=Tento modul obsahuje podporu pre špeciálne klávesy na rôznych klávesniciach a prenosných počítačoch.
+Comment[sl]=Ta vstavek omogoča podporo za posebne tipke na vseh vrstah tipkovnic in prenosnikov.
+Comment[sr]=Овај прикључак омогућава подршку за специјалне тастере на свакаквим тастатурама и лаптоповима.
+Comment[sr@Latn]=Ovaj priključak omogućava podršku za specijalne tastere na svakakvim tastaturama i laptopovima.
+Comment[sv]=Det här insticksprogrammet aktiverar stöd för speciella tangenter för alla typer av tangentbord och bärbara datorer.
+Comment[ta]=எல்லா அடுக்குகளிலும் உள்ள விசைபலகைகள் மற்றும் மடிக் கணினிகளின் விசேஷ விசைகளுக்கு இந்த சொருகு சாதனம் ஆதரவளிக்கிறது.
+Comment[tg]=Ин модул пуштибонии калидҳои махсусро дар ҳамаи навъҳои забонакҳо ва компютерҳои дастӣ дармегиронад.
+Comment[tr]=Bu plugin tüm klavye ve dizüstülerdeki özel tuşlar için desteği sağlar.
+Comment[uk]=Цей втулок додає підтримку спеціальних клавіш для різних типів клавіатур та лептопів.
+Comment[zh_CN]=此插件启用各种键盘和便携电脑的特殊按键。
+Comment[zh_TW]=這個外掛程式開啟所有鍵盤與筆記型電腦的特殊鍵支援。
+X-KDE-Library=kmilo_generic
diff --git a/kmilo/kmilo_kvaio/Makefile.am b/kmilo/kmilo_kvaio/Makefile.am
new file mode 100644
index 0000000..a711565
--- /dev/null
+++ b/kmilo/kmilo_kvaio/Makefile.am
@@ -0,0 +1,39 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+SUBDIRS = . kcmkvaio
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_kvaio.la
+
+kmilo_kvaio_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_kvaio_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO) -lXext -lXtst
+kmilo_kvaio_la_SOURCES = kmilo_kvaio.cpp kvaiodriverinterface.cpp kvaio.cpp
+
+METASOURCES = AUTO
+
+KDE_OPTIONS = nofinal
+
+noinst_HEADERS = kmilo_kvaio.h kvaiodriverinterface.h kvaio.h
+
+services_DATA = kmilo_kvaio.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_kvaio_la_SOURCES) -o $(podir)/kmilo_kvaio.pot
diff --git a/kmilo/kmilo_kvaio/README.sonypi.h b/kmilo/kmilo_kvaio/README.sonypi.h
new file mode 100644
index 0000000..5940b38
--- /dev/null
+++ b/kmilo/kmilo_kvaio/README.sonypi.h
@@ -0,0 +1,18 @@
+(C) 2003, 2004: Mirko Boehm <mirko@kde.org>
+Licensed under the terms of the LGPL.
+
+This file explains the bad hack of copying the sonypi.h header file into this
+directory:
+-----------------------------------------------------------------------------
+
+Along with glibc, an outdated header snapshot is installed. The event
+definitions in include/linux/sonypi.h in newer kernels differ too much from
+it. Since the code shipped here depends on the proper event definitions, I
+decided to ship a copy of a more up to date include file here.
+
+The solution is not optimal, but it works, and I try to keep the files in this
+directory up to date.
+
+If somebody knows a better solution, please let me know at mirko@kde.org.
+
+
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/Makefile.am b/kmilo/kmilo_kvaio/kcmkvaio/Makefile.am
new file mode 100644
index 0000000..6555b6c
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/Makefile.am
@@ -0,0 +1,15 @@
+kde_module_LTLIBRARIES = kcm_kvaio.la
+
+kcm_kvaio_la_SOURCES = kcmkvaio_general.ui main.cpp
+
+kcm_kvaio_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kcm_kvaio_la_LIBADD = ../kvaiodriverinterface.lo $(LIB_KDEUI)
+
+INCLUDES= $(all_includes)
+
+kcm_kvaio_la_METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kcmkvaio.pot
+
+xdg_apps_DATA = kvaio.desktop
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui
new file mode 100644
index 0000000..ac376f3
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui
@@ -0,0 +1,273 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KCMKVaioGeneral</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KCMKVaioGeneral</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>536</width>
+ <height>226</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KVaio: General Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlOff</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Cannot find the &lt;i&gt;Sony Programmable Interrupt Controller&lt;/i&gt;. If this is a Sony Vaio Laptop, make sure the &lt;b&gt;sonypi&lt;/b&gt; driver module loads without failures.</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frameMain</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>bgBattery</cstring>
+ </property>
+ <property name="title">
+ <string>System Power</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mTLBattery</cstring>
+ </property>
+ <property name="text">
+ <string>Remaining battery capacity:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="KProgress">
+ <property name="name">
+ <cstring>mKPBattery</cstring>
+ </property>
+ </widget>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>kledAC</cstring>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="shape">
+ <enum>Rectangular</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlAC</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>AC</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>kledBat1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="shape">
+ <enum>Rectangular</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlBat1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Bat 1</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>kledBat2</cstring>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="shape">
+ <enum>Rectangular</enum>
+ </property>
+ <property name="look">
+ <enum>Raised</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlBat2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Bat 2</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>bgGeneral</cstring>
+ </property>
+ <property name="title">
+ <string>Other Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>mCbPowerMsgs</cstring>
+ </property>
+ <property name="text">
+ <string>Periodically inform about battery and AC adapter status</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>mCbBackButtonMsg</cstring>
+ </property>
+ <property name="text">
+ <string>Show battery and AC status on Back button press</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cbReportUnknownEvents</cstring>
+ </property>
+ <property name="text">
+ <string>Report unhandled events using On Screen Display</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cbReportUnknownEvents</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMKVaioGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mCbPowerMsgs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMKVaioGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mCbBackButtonMsg</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMKVaioGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">kcmkvaio_general.ui.h</include>
+</includes>
+<signals>
+ <signal>changed();</signal>
+</signals>
+<slots>
+ <slot>slotChanged()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kprogress.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+</includehints>
+</UI>
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h
new file mode 100644
index 0000000..96d4938
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <kdialog.h>
+
+void KCMKVaioGeneral::slotChanged()
+{
+ emit(changed());
+}
+
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop b/kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop
new file mode 100644
index 0000000..12be7eb
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop
@@ -0,0 +1,146 @@
+[Desktop Entry]
+Type=Application
+Exec=kcmshell kvaio
+Icon=laptop
+DocPath=kcontrol/kvaio/index.html
+
+X-KDE-Library=kvaio
+X-KDE-ParentApp=kcontrol
+
+Name=Sony Vaio Laptop
+Name[ar]=حاسوب سونى فايو المحمولة
+Name[bg]=Лаптоп Sony Vaio
+Name[br]=Hezoug Sony Vaio
+Name[bs]=Sony Vaio laptop
+Name[ca]=Portàtil Sony Vaio
+Name[cs]=Sony Vaio notebook
+Name[cy]=Gluniadur Sony Vaio
+Name[da]=Sony Vaio bærbar
+Name[de]=Sony Vaio Notebook
+Name[el]=Φορητός υπολογιστής Sony Vaio
+Name[es]=Portátil Sony Vaio
+Name[et]=Sony Vaio sülearvuti
+Name[eu]=Sony Vaio Magalekoa
+Name[fa]=Sony Vaio رایانۀ کیفی
+Name[fi]=Sony Vaio -liitännäinen
+Name[fr]=Portable Vaio de Sony
+Name[ga]=Ríomhaire Glúine Sony Vaio
+Name[he]=מחשב ברכיים מסוג Sony Vaio
+Name[hu]=Sony Vaio noteszgép
+Name[is]=Sony Vaio kjöltutölva
+Name[it]=Portatile Sony Vaio
+Name[ja]=Sony Vaio ラップトップ
+Name[kk]=Sony Vaio ноутбугі
+Name[km]=កុំព្យូទ័រ​យួរដៃ Sony Vaio
+Name[mk]=Лаптоп Sony Vaio
+Name[nb]=Programtillegg for Sony Vaio
+Name[nds]=Sony Vaio-Klappreekner
+Name[ne]=सोनी भाइयो लयापटप
+Name[nn]=Sony Vaio-bærbar
+Name[pa]=Sony Vaio ਲੈਪਟਾਪ
+Name[pl]=Wtyczka Sony Vaio
+Name[pt]='Plugin' para o Sony Vaio
+Name[pt_BR]=Laptop Sony Vaio
+Name[ro]=Laptop Sony Vaio
+Name[ru]=Ноутбук Sony Vaio
+Name[sk]=Sony Vaio
+Name[sl]=Prenosnik Sony Vaio
+Name[sr]=Sony-јев Vaio лаптоп
+Name[sr@Latn]=Sony-jev Vaio laptop
+Name[sv]=Sony Vaio bärbar dator
+Name[ta]=சோனி வையோ மடிக் கணிப்பொறி
+Name[tr]=Sony Vaio Dizüstü
+Name[uk]=Лептоп Sony Vaio
+Name[uz]=Sony Vaio laptopi
+Name[uz@cyrillic]=Sony Vaio лаптопи
+Name[zh_CN]=索尼 Vaio 插件
+Name[zh_TW]=Sony Vaio 筆記型電腦
+Comment=Configure the KDE Interface to the Sony Programmable Interrupt Controller Driver
+Comment[ar]=إعداد واجهة كدى لجهاز لمشغل التحكّم بالمقاطعة القابل للبرمجة من سونى
+Comment[bg]=Настройване на Sony Programmable Interrupt Controller Driver
+Comment[bs]=Podesite KDE interfejs za Sony Programmable Interrupt Controler drajver
+Comment[ca]=Configura la interfície entre KDE i el controlador d'interrupcions programables Sony
+Comment[cs]=Nastavení KDE rozhraní ovladače programovatelného řadiče přerušení Sony
+Comment[cy]=Ffurfweddu'r Rhyngwyneb KDE i'r Gyrrydd Rheolydd Ymyriadau Rhaglenadwy Sony
+Comment[da]=Indstil KDE's grænseflade til Sony's programmerbare Interrupt Controller Driver
+Comment[de]=Einrichten der KDE-Schnittstelle zum "Sony Programmable Interrupt Controller" Treiber
+Comment[el]=Ρυθμίστε το περιβάλλον χρήσης του KDE για τον Sony Programmable Interrupt Controller Driver
+Comment[es]=Configurar la interfaz de KDE para el controlador programable de interrupciones de Sony
+Comment[et]=KDE liides Sony programmeeritava katkestuskontrolleri draiveri seadistamiseks
+Comment[eu]=Konfiguratu Sonyren Interrupzio Kontrolatzaile Programagarriaren Gidariarentzako KDE Interfazea
+Comment[fa]=پیکربندی واسط KDE در گردانندۀ کنترل‌کنندۀ قابل برنامه‌ریزی دارای وقفه
+Comment[fi]=Aseta KDE:n liityntää Sonyn ohjelmoitavalle keskeytysajurille
+Comment[fr]=Configuration de l'interface KDE pour le pilote du contrôleur d'interruption programmable de Sony
+Comment[ga]=Cumraigh comhéadan KDE do Tiománaí an Rialtóir Idirbhriste Inríomhchláraithe Sony
+Comment[hi]=केडीई इंटरफेस को सोनी प्रोग्रामेबल इंटरप्ट कन्ट्रोलर ड्राइवर के लिए कॉन्फ़िगर करता है
+Comment[hu]=A Sony Vaio noteszgépek speciális kezelőelemeinek beállítása
+Comment[is]=Stilla viðmót KDE á Sony Programmable Interrupt stýringuna
+Comment[it]=Configura l'interfaccia KDE al driver del controller programmabile interrupt Sony
+Comment[ja]=Sony Programmable Interrupt Controller Driver の KDE インターフェースを設定
+Comment[kk]=Sony бағдарламаулы үзілім контроллердің драйверінің KDE интерфейсін баптау
+Comment[km]=កំណត់​រចនា​សម្ព័ន្ធ​ចំណុច​ប្រទាក់ KDE ទៅ​កម្មវិធី​បញ្ជា Sony Programmable Interrupt Controller
+Comment[lt]=KDE sąsaja Sony Programmable Interrupt Controller Driver konfigūravimui
+Comment[ms]= Selaraskan Antaramuka KDE untuk Pemacu Pengawal Gangguan Boleh Aturcara Sony
+Comment[nb]=Sett opp KDE-grensesnitt til Sony Programmable Interrupt Controller Driver
+Comment[nds]=KDE-Koppelsteedinstellen för den programmeerboren Interrupt-Controller-Driever vun Sony
+Comment[ne]=सोनी कार्यक्रमयोग्य अवरोध नियन्त्रक ड्राइभरमा KDE इन्टरफेस कन्फिगर गर्नुहोस्
+Comment[nl]=Voor het instellen van KDE's communicatie met het stuurprogramma van de Sony Programmeerbare Interrupt Controller
+Comment[nn]=Set opp KDE-grensesnittet til Sony Programmable Interrupt Controller Driver
+Comment[pl]=Konfigurujacja sterownika programowalnego kontrolora przerwań Sony w KDE
+Comment[pt]=Configurar a Interface para o KDE do Controlador do Programmable Interrupt Controller da Sony
+Comment[pt_BR]=Configura a Interface do KDE para o Driver Controlador de Interrupção Programável da Sony
+Comment[ro]=Configurează interfaţa KDE către modulul Sony de control al întreruperilor
+Comment[ru]=Настройка интерфейса KDE для драйвера программируемого контроллера прерываний Sony
+Comment[sk]=Nastavenie rozhrania KDE k Sony Programmable Interrupt Controller Driver
+Comment[sl]=Nastavite vmesnik KDE za gonilnik Sony Programmable Interrupt Controller
+Comment[sr]=Подесите KDE-ов интерфејс за управљачки програм Sony-јевог програмабилног контролера прекида
+Comment[sr@Latn]=Podesite KDE-ov interfejs za upravljački program Sony-jevog programabilnog kontrolera prekida
+Comment[sv]=Anpassa KDE:s gränssnitt till Sonys drivrutin för programmerbar avbrottshantering
+Comment[ta]=சோனி நிரல் தடங்கல் கட்டுப்பாட்டு சாதனத்துக்கு கேடிஇ இடைமுகத்தை வடிவமை
+Comment[tg]=Танзимкунии Интерфейси KDE барои Гардонандаи Танзимкунандаи кандашавии барномавии Sony
+Comment[tr]=KDE arayüzünü Sony Programlanabilir Kesilme Kontrolör Sürücüsüne ayarla
+Comment[uk]=Налаштування інтерфейсу KDE до драйвера перепин Sony
+Comment[zh_CN]=配置 KDE 界面使用索尼可编程中断控制器驱动程序
+Comment[zh_TW]=設定 Sony 可編程中斷控制器驅動程式的 KDE 介面
+Keywords=Sony, Vaio, kvaio, brightness, mute, Jog Dial
+Keywords[ca]=Sony, Vaio, kvaio, brillantor, silenci, Jog Dial
+Keywords[cs]=Sony,Vaio,kvaio,jas,ztlumení,Jog Dial
+Keywords[cy]=Sony, Vaio, kvaio, gloywder, mud, Jog Dial
+Keywords[da]=Sony, Vaio, kvaio, lysstyrke, stum, Jog Dial
+Keywords[de]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, stumm, hell, dunkel
+Keywords[el]=Sony, Vaio, kvaio, φωτεινότητα, κλείσιμο ήχου, Jog Dial
+Keywords[es]=Sony, Vaio, kvaio, brillo, mute, Jog Dial
+Keywords[et]=Sony, Vaio, kvaio, heledus, tumm, Jog Dial
+Keywords[eu]=Sony, Vaio, kvaio, distira, mutu, Jog Dial
+Keywords[fa]=Sony،Vaio، kvaio، روشنایی، بدون صدا، Jog Dial
+Keywords[fi]=Sony, Vaio, kvaio, kirkkaus, vaimenna, Jog Dial
+Keywords[fr]=Sony, Vaio, kvaio, luminosité, sourdine, mute, Jog Dial
+Keywords[ga]=Sony, Vaio, kvaio, gile, gan fuaim, Jog Dial
+Keywords[hi]=सोनी,वायो,के-वायो,चमकीलापन,म्यूट,जॉग डायल
+Keywords[hu]=Sony,Vaio,kvaio,fényerő,elnémítás,tárcsagomb
+Keywords[it]=Sony,Vaio,kvaio,luminosità,muto,Jog Dial
+Keywords[ja]=Sony, Vaio, kvaio, 明るさ, ミュート, ジョグダイアル
+Keywords[mk]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, Сони, осветленост, пригушување
+Keywords[ms]= kecerahan,bisu,Sony, Vaio, kvaio, brightness, mute, Jog Dial
+Keywords[nb]=Sony, Vaio, kvaio, lysstyrke, lydsperre, Jog Dial
+Keywords[nds]=Sony, Vaio, kvaio, Helligkeit, stumm, Jog Dial
+Keywords[ne]=सोनी, भाइयो, केभाइयो, चम्किलोपना, चुप लाग्नु, जोग डायल
+Keywords[nl]=Sony,Vaio,kvaio,brightness,helderheid,mute,Jog Dial
+Keywords[nn]=Sony,vaio,kvaio,lysstyrke,lydsperre,hjul
+Keywords[pl]=Sony, Vaio, kvaio, jasność, Jog Dial,jog,jogdial
+Keywords[pt]=Sony, Vaio, kvaio, brilho, sem som, Jog Dial
+Keywords[pt_BR]=Sony, Vaio, kvaio,brilho, mudo, Jog Dial
+Keywords[ro]=Sony,Vaio,kvaio,strălucire,fără sunet,jog dial
+Keywords[ru]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, яркость, звук
+Keywords[sk]=Sony, Vaio, kvaio, jas, potichu, Jog Dial
+Keywords[sl]=Sony, Vaio, kvaio, svetlost, tiho, Jog Dial
+Keywords[sr]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, светлина
+Keywords[sr@Latn]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, svetlina
+Keywords[sv]=Sony, Vaio, kvaio, ljusstyrka, tyst, rullhjul
+Keywords[ta]=சோனி, வையொ, வெளிச்சம்,சத்தமில்லாத,ஜோக் டயல்
+Keywords[tg]=Sony, Vaio, kvaio, равшанӣ, хомӯшӣ, Jog Dial
+Keywords[tr]=Sony, Vaio, kvaio, parlaklık, sessiz, gösterme itmesi
+Keywords[uk]=Sony, Vaio, kvaio, яскравість, вимкнення звуку
+Keywords[zh_CN]=Sony, Vaio, kvaio, brightness, mute, Jog Dial,索尼,亮度,静音
+
+Categories=Qt;KDE;X-KDE-settings-system;
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/main.cpp b/kmilo/kmilo_kvaio/kcmkvaio/main.cpp
new file mode 100644
index 0000000..ce27c94
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/main.cpp
@@ -0,0 +1,176 @@
+/*
+ * main.cpp
+ *
+ * Copyright (C) 2003 Mirko Boehm (mirko@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qtimer.h>
+#include <qslider.h>
+
+#include <dcopclient.h>
+#include <kgenericfactory.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kled.h>
+#include <kprogress.h>
+
+#include "kcmkvaio_general.h"
+
+#include <dcopclient.h>
+
+#include "main.h"
+#include "main.moc"
+
+typedef KGenericFactory<KVaioModule, QWidget> KVaioModuleFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kvaio, KVaioModuleFactory("kcmkvaio"))
+
+#define CONFIG_FILE "kmilodrc"
+
+
+KVaioModule::KVaioModule(QWidget *parent, const char *name, const QStringList &)
+ : KCModule(KVaioModuleFactory::instance(), parent, name)
+{
+ KAboutData *about =
+ new KAboutData(I18N_NOOP("kcmkvaio"),
+ I18N_NOOP("KDE Control Module for Sony "
+ "Vaio Laptop Hardware"),
+ 0, 0, KAboutData::License_GPL,
+ "(c) 2003 Mirko Boehm");
+
+ about->addAuthor("Mirko Boehm",
+ I18N_NOOP("Original author"),
+ "mirko@kde.org");
+ setAboutData( about );
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ mKVaioGeneral = new KCMKVaioGeneral(this);
+ layout->addWidget( mKVaioGeneral );
+ layout->addStretch();
+
+ mDriver = new KVaioDriverInterface(this);
+ mDriverAvailable = mDriver->connectToDriver(false);
+ mTimer = new QTimer(this);
+ mTimer->start(231);
+
+ load();
+ if (! mDriverAvailable)
+ {
+ mKVaioGeneral->tlOff->show();
+ mKVaioGeneral->frameMain->setEnabled(false);
+ setButtons(buttons() & ~Default);
+ } else {
+ mKVaioGeneral->tlOff->hide();
+ // mKVaioGeneral->frameMain->setEnabled (true);
+ }
+
+ connect(mKVaioGeneral, SIGNAL(changed()),
+ SLOT(changed()));
+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout()));
+ connect(mDriver, SIGNAL (vaioEvent(int)), SLOT (vaioEvent(int) ) );
+}
+
+void KVaioModule::save()
+{
+ if (! mDriverAvailable) return;
+ DCOPClient mClient;
+
+ kdDebug() << "KVaioModule: saving." << endl;
+ KConfig config(CONFIG_FILE);
+
+ config.setGroup("KVaio");
+
+ config.writeEntry("Report_Unknown_Events",
+ mKVaioGeneral->cbReportUnknownEvents->isChecked());
+ config.writeEntry("PeriodicallyReportPowerStatus",
+ mKVaioGeneral->mCbPowerMsgs->isChecked() );
+ config.writeEntry("PowerStatusOnBackButton",
+ mKVaioGeneral->mCbBackButtonMsg->isChecked() );
+ config.sync();
+
+ if(mClient.attach())
+ {
+ QByteArray data, replyData;
+ QCString replyType;
+
+ if (!mClient.call("kded", "kmilod", "reconfigure()",
+ data, replyType, replyData))
+ {
+ kdDebug() << "KVaio::showTextMsg: "
+ << "there was some error using DCOP." << endl;
+ }
+ } else {
+ kdDebug() << "KVaioModule: cannot attach to DCOP server, "
+ << "no automatic config update." << endl;
+ }
+}
+
+void KVaioModule::load()
+{
+ load( false );
+}
+
+void KVaioModule::load(bool useDefaults)
+{
+ kdDebug() << "KVaioModule: loading." << endl;
+ KConfig config(CONFIG_FILE);
+
+ config.setReadDefaults( useDefaults );
+
+ config.setGroup("KVaio");
+ mKVaioGeneral->cbReportUnknownEvents->setChecked
+ (config.readBoolEntry("Report_Unknown_Events", false));
+ mKVaioGeneral->mCbPowerMsgs->setChecked
+ (config.readBoolEntry("PeriodicallyReportPowerStatus", false) );
+ mKVaioGeneral->mCbBackButtonMsg->setChecked
+ (config.readBoolEntry("PowerStatusOnBackButton", true) );
+
+ emit changed( useDefaults );
+}
+
+void KVaioModule::defaults()
+{
+ load( true );
+}
+
+void KVaioModule::timeout()
+{
+ bool bat1Avail = false, bat2Avail = false, acConnected = false;
+ int bat1Remaining = 0, bat1Max = 0, bat2Remaining = 0, bat2Max = 0;
+
+ if(mDriver->getBatteryStatus(bat1Avail, bat1Remaining, bat1Max,
+ bat2Avail, bat2Remaining, bat2Max,
+ acConnected) )
+ {
+ }
+ int remaining = (int)(100.0*(bat1Remaining+bat2Remaining)
+ / (bat1Max+bat2Max));
+ mKVaioGeneral->mKPBattery->setValue(remaining);
+ mKVaioGeneral->kledBat1->setState(bat1Avail ? KLed::On : KLed::Off);
+ mKVaioGeneral->kledBat2->setState(bat2Avail ? KLed::On : KLed::Off);
+ mKVaioGeneral->kledAC->setState(acConnected ? KLed::On : KLed::Off);
+}
+
+void KVaioModule::vaioEvent (int e)
+{
+ kdDebug () << "KVaioModule::vaioEvent: event: " << e << endl;
+}
+
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/main.h b/kmilo/kmilo_kvaio/kcmkvaio/main.h
new file mode 100644
index 0000000..c19b648
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/main.h
@@ -0,0 +1,53 @@
+/*
+ * main.h
+ *
+ * Copyright (C) 2003 Mirko Boehm (mirko@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KCMKVAIO_MAIN_H
+#define KCMKVAIO_MAIN_H
+
+#include <kcmodule.h>
+#include "../kvaiodriverinterface.h"
+
+class QTimer;
+class KCMKVaioGeneral;
+
+class KVaioModule : public KCModule
+{
+ Q_OBJECT
+
+public:
+ KVaioModule(QWidget *parent, const char *name, const QStringList &);
+
+ void save();
+ void load();
+ void load(bool useDefaults);
+ void defaults();
+
+protected slots:
+ void timeout();
+ void vaioEvent (int);
+private:
+ KCMKVaioGeneral *mKVaioGeneral;
+ KVaioDriverInterface *mDriver;
+ QTimer *mTimer;
+ bool mDriverAvailable;
+};
+
+#endif // KCMKVAIO_MAIN_H
diff --git a/kmilo/kmilo_kvaio/kmilo_kvaio.cpp b/kmilo/kmilo_kvaio/kmilo_kvaio.cpp
new file mode 100644
index 0000000..6389759
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kmilo_kvaio.cpp
@@ -0,0 +1,68 @@
+/* -*- C++ -*-
+
+ This file implements the KVaio module for KMilo.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#include <kgenericfactory.h>
+
+#include "monitor.h"
+#include "kmilo_kvaio.h"
+#include "kvaio.h"
+#include "kmilointerface.h"
+
+KMiloKVaio::KMiloKVaio(QObject *parent, const char *name,
+ const QStringList& args)
+ : Monitor(parent, name, args),
+ m_kvaio(0)
+{
+ _poll = false;
+ m_displayType = (Monitor::DisplayType)None ;
+}
+
+
+KMiloKVaio::~KMiloKVaio() {
+}
+
+
+bool KMiloKVaio::init()
+{
+ m_kvaio = new KVaio(this);
+
+ return m_kvaio->driver()!=0;
+}
+
+
+KMilo::Monitor::DisplayType KMiloKVaio::poll() {
+// Monitor::DisplayType rc = (Monitor::DisplayType)None;
+// return rc;
+ return m_displayType;
+}
+
+
+int KMiloKVaio::progress() const {
+ return m_kvaio->progress();
+}
+
+void KMiloKVaio::reconfigure(KConfig* k)
+{
+ m_kvaio->loadConfiguration(k);
+}
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_kvaio, KGenericFactory<KMiloKVaio>("kmilo_kvaio"))
+
diff --git a/kmilo/kmilo_kvaio/kmilo_kvaio.desktop b/kmilo/kmilo_kvaio/kmilo_kvaio.desktop
new file mode 100644
index 0000000..5539734
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kmilo_kvaio.desktop
@@ -0,0 +1,106 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Sony Vaio Plugin
+Name[ar]=ملحق سونى فايوة
+Name[br]=Lugent an hezoug Sony Vaio
+Name[bs]=Sony Vaio dodatak
+Name[ca]=Connector Sony Vaio
+Name[cs]=Sony Vaio modul
+Name[cy]=Ategyn Sony Vaio
+Name[da]=Sony Vaio plugin
+Name[el]=Πρόσθετο Sony Vaio
+Name[es]=Extensión para Sony Vaio
+Name[et]=Sony Vaio plugin
+Name[eu]=Sony Vaio Plugina
+Name[fa]=وصلۀ Sony Vaio
+Name[fi]=Sony Vaio -liitännäinen
+Name[fr]=Module externe pour les Vaio de Sony
+Name[ga]=Breiseán Sony Vaio
+Name[he]=תוסף ל-Sony Vaio
+Name[hi]=सोनी वायो प्लगइन
+Name[hu]=Sony Vaio bővítőmodul
+Name[is]=Sony Vaio íforrit
+Name[it]=Plugin per Sony Vaio
+Name[ja]=Sony Vaio プラグイン
+Name[ka]=Sony Vaio მოდული
+Name[kk]=Sony Vaio модулі
+Name[km]=កម្មវិធី​ជំនួយ Sony Vaio
+Name[lt]=Sony Vaio priedas
+Name[mk]=Приклучок за Sony Vaio
+Name[nb]=Programtillegg for Sony Vaio
+Name[nds]=Sony Vaio-Moduul
+Name[ne]=सोनी भाइयो प्लगइन
+Name[nl]=Sony Vaio-plugin
+Name[nn]=Tilleggsprogram for Sony Vaio
+Name[pa]=Sony Vaio ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka Sony Vaio
+Name[pt]='Plugin' para o Sony Vaio
+Name[pt_BR]=Plugin do Sony Vaio
+Name[ro]=Modul Sony Vaio
+Name[ru]=Модуль Sony Vaio
+Name[sk]=Modul pre Sony Vaio
+Name[sl]=Vstavek za Sony Vaio
+Name[sr]=Прикључак за Sony-јев Vaio
+Name[sr@Latn]=Priključak za Sony-jev Vaio
+Name[sv]=Sony Vaio-insticksprogram
+Name[ta]=சோனி வையோ சொருகு சாதனம்
+Name[tg]=Модули Sony Vaio
+Name[tr]=Sony Vaio Eklentisi
+Name[uk]=Втулок Sony Vaio
+Name[uz]=Sony Vaio plagini
+Name[uz@cyrillic]=Sony Vaio плагини
+Name[wa]=Tchôke-divins Sony Vaio
+Name[zh_CN]=索尼 Vaio 插件
+Name[zh_TW]=Sony Vaio 外掛程式
+Comment=KMilo Module for Sony Vaio Laptop support
+Comment[ar]=وحدة KMilo لدعم حاسوب سونى فايو المحمول
+Comment[bg]=Модул за поддръжка на KMilo за лаптопи Sony Vaio
+Comment[bs]=KMilo modul za podršku za Sony Vaio laptope
+Comment[ca]=Mòdul KMilo per funcionar amb portàtils Sony Vaio
+Comment[cs]=KMilo modul pro podporu notebooků Sony Vaio
+Comment[cy]=Cynhaliaeth Modiwl KMilo ar gyfer Gluniadur Sony Vaio
+Comment[da]=KMilo Modul for understøttelse af Sony Vaio bærbare
+Comment[de]=KMilo-Modul für Sony Vaio Notebook-Unterstützung
+Comment[el]=Πρόσθετο KMilo για υποστήριξη του φορητού Sony Vaio
+Comment[es]=Módulo KMilo para el soporte del portátil Sony Vaio
+Comment[et]=KMilo moodul Sony Vaio sülearvuti toega
+Comment[eu]=KMilo Moduloa Sony Vaio Magalekoen euskarriarentzako
+Comment[fa]=پیمانۀ KMilo برای پشتیبانی رایانۀ کیفی Sony Vaio
+Comment[fi]=KMilo-moduuli Sony Vaio -kannettavatuelle
+Comment[fr]=Module KMilo pour la gestion des portables Vaio de Sony
+Comment[ga]=Modúl KMilo a thacaíonn le Sony Vaio
+Comment[he]=KMilo מודול לתמיכה במחשב הברכיים Vaio של Sony
+Comment[hi]=सोनी वायो लेपटॉप समर्थन के लिए के-मिलो मॉड्यूल
+Comment[hu]=KMilo beállítómodul Sony Vaio noteszgépek beállításához
+Comment[is]=KMilo eining fyrir Sony Vaio kjöltutölvur
+Comment[it]=Modulo di KMilo per il supporto dei portatili Sony Vaio
+Comment[ja]=Sony Vaio ラップトップをサポートする KMilo モジュール
+Comment[ka]=Sony Vaio ლეპტოპის მხარდამჭერი KMilo მოდული
+Comment[kk]=Sony Vaio ноутбукті қолдау KMilo модулі
+Comment[km]=ម៉ូឌុល KMilo សម្រាប់​ការគាំទ្រ​កុំព្យូទ័រ​យួរដៃ Sony Vaio
+Comment[lt]=KMilo modulis Sony Vaio Laptop palaikymui
+Comment[mk]=Модул од KMilo за поддршка за лаптопот Sony Vaio
+Comment[nb]=KMilo modul for Sony Vaio bærbar maskin
+Comment[nds]=KMilo-Moduul för Sony-Vaio-Klappreeknerünnerstütten
+Comment[ne]=सोनी भाइयो ल्यापटप समर्थनका लागि केमिलो मोड्युल
+Comment[nl]=KMilo-module met ondersteuning voor de Sony Vaio laptop
+Comment[nn]=KMilo-modul for Sony Vaio bærbar maskin
+Comment[pl]=Moduł KMilo do obsługi laptopów Sony Vaio
+Comment[pt]=Módulo do KMilo para o suporte do portátil Vaio da Sony
+Comment[pt_BR]= Módulo para o suporte ao Sony Vaio
+Comment[ro]=Modul KMilo pentru suport laptop Sony Vaio
+Comment[ru]=Модуль KMilo для ноутбуков Sony Vaio
+Comment[sk]=Module pre podporu Sony Vaio pre KMilo
+Comment[sl]=Modul KMilo za podporo prenosniku Sony Vaio
+Comment[sr]=KMilo, модул за подршку Sony-јевог Vaio лаптопа
+Comment[sr@Latn]=KMilo, modul za podršku Sony-jevog Vaio laptopa
+Comment[sv]=Kmilo-modul för stöd av bärbar Sony Vaio-dator
+Comment[ta]=சோனி வையோ மடிக் கணினி ஆதரவுக்கான கேமிலோ கூறு
+Comment[tg]=Модули KMilo барои пуштибонии Компютери дастии Sony Vaio
+Comment[tr]=Sony Vaio Dizüstüler için KMilo Modül desteği
+Comment[uk]=Модуль KMilo, що додає підтримку лептопів Sony Vaio
+Comment[zh_CN]=索尼 Vaio 便携电脑支持的 KMilo 模块
+Comment[zh_TW]=支援 Sony Vaio 筆記型電腦的 KMilo 模組
+X-KDE-Library=kmilo_kvaio
diff --git a/kmilo/kmilo_kvaio/kmilo_kvaio.h b/kmilo/kmilo_kvaio/kmilo_kvaio.h
new file mode 100644
index 0000000..fccd7e9
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kmilo_kvaio.h
@@ -0,0 +1,66 @@
+/* -*- C++ -*-
+
+ This file declares the KVaio module for KMilo.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#ifndef _KMILO_KVAIO_H_
+#define _KMILO_KVAIO_H_
+
+#include <kmainwindow.h>
+#include <kglobalaccel.h>
+#include <dcopref.h>
+#include <kapplication.h>
+
+#include "kmilod.h"
+#include "monitor.h"
+#include "kmilointerface.h"
+
+class KVaio;
+
+class KMiloKVaio : public KMilo::Monitor {
+// Q_OBJECT
+
+ public:
+ KMiloKVaio(QObject *parent,
+ const char *name, const QStringList&);
+ virtual ~KMiloKVaio();
+
+ virtual bool init();
+ virtual DisplayType poll();
+ virtual int progress() const;
+
+ virtual void reconfigure(KConfig*);
+
+
+ bool showTextMsg(const QString& msg) {
+ _interface->displayText(msg);
+ return true;
+ }
+ bool showProgressMsg(const QString& msg, int progress) {
+ _interface->displayProgress(msg,progress);
+ return true;
+ }
+
+ private:
+ KVaio *m_kvaio;
+ Monitor::DisplayType m_displayType;
+};
+
+
+#endif
diff --git a/kmilo/kmilo_kvaio/kvaio.cpp b/kmilo/kmilo_kvaio/kvaio.cpp
new file mode 100644
index 0000000..8a02098
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaio.cpp
@@ -0,0 +1,606 @@
+/* -*- C++ -*-
+
+ This file implements the KVaio class.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+
+ * Modified by Toan Nguyen <nguyenthetoan@gmail.com>
+ * to include support for
+ * Fn+F2,F3,F4 (Volume)
+ * Fn+F5,F6 (Brightness)
+ * Fn+F1 (blankscreen)
+ * Fn+F12 (suspend to disk)
+*/
+
+#include <kconfig.h>
+
+#include "kvaio.h"
+#include "kmilointerface.h"
+
+#include <qlabel.h>
+#include <qcstring.h>
+#include <qevent.h>
+#include <qdatastream.h>
+#include <kmainwindow.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <dcopclient.h>
+#include <kapplication.h>
+
+extern "C" {
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <getopt.h>
+#include <errno.h>
+
+#include "./sonypi.h"
+}
+
+
+KVaio::KVaio(KMiloKVaio *parent, const char* name)
+ : QObject(parent, name),
+ mDisp(0),
+ mTimer (new QTimer (this) )
+{
+ myparent = parent;
+
+ mDriver = new KVaioDriverInterface(this);
+
+ if(!mDriver->connectToDriver())
+ {
+ delete mDriver; mDriver = 0L;
+ kdDebug() << "KVaio: Cannot connect to driver." << endl;
+ } else {
+ kdDebug() << "KVaio: Connected to SonyPI driver." << endl;
+ connect(mDriver, SIGNAL(vaioEvent(int)), SLOT(slotVaioEvent(int)));
+ connect (mTimer, SIGNAL (timeout ()), SLOT (slotTimeout() ) );
+ mTimer->start (10000, true);
+ }
+
+ mDisp = XOpenDisplay(NULL);
+ if(!mDisp)
+ {
+ kdDebug() << "KVaio ctor: Failed to open display. Very strange."
+ << endl;
+ }
+
+ if(!mClient.attach())
+ {
+ kdDebug() << "KVaio ctor: cannot attach to DCOP server." << endl;
+ }
+
+ KConfig config("kmilodrc");
+
+ loadConfiguration(&config);
+
+ m_mute = false;
+ m_progress = 0;
+ m_minVolume = 0;
+ m_maxVolume = 100;
+ m_volume = 50;
+
+ m_VolumeStep = 10;
+
+ m_brightness = 128;
+ m_minBright = 0;
+ m_maxBright = 255;
+ m_BrightnessStep = 16;
+
+ kmixClient = new DCOPRef("kmix", "Mixer0");
+ kmixWindow = new DCOPRef("kmix", "kmix-mainwindow#1");
+// retrieveVolume();
+// retrieveMute();
+
+}
+
+KVaio::~KVaio()
+{
+ kdDebug() << "KVaio dtor: shutting down." << endl;
+ if(mDriver!=0)
+ {
+ mDriver->disconnectFromDriver();
+ }
+ if(mClient.isAttached())
+ {
+ mClient.detach();
+ }
+}
+
+void KVaio::slotVaioEvent(int event)
+{
+ QString text;
+ QTextStream stream(text, IO_WriteOnly);
+
+ switch(event)
+ {
+ case SONYPI_EVENT_FNKEY_RELEASED:
+ break;
+ case SONYPI_EVENT_FNKEY_F1:
+ blankScreen();
+ break;
+ case SONYPI_EVENT_FNKEY_F2:
+ mute();
+ break;
+ case SONYPI_EVENT_FNKEY_F3:
+ VolumeDown(m_VolumeStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F4:
+ VolumeUp(m_VolumeStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F5:
+ BrightnessDown(m_BrightnessStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F6:
+ BrightnessUp(m_BrightnessStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F12:
+ suspendToDisk();
+ break;
+ case SONYPI_EVENT_MEMORYSTICK_INSERT:
+ showTextMsg( i18n ("Memory Stick inserted") );
+ break;
+ case SONYPI_EVENT_MEMORYSTICK_EJECT:
+ showTextMsg( i18n ("Memory Stick ejected") );
+ break;
+ case SONYPI_EVENT_BACK_PRESSED:
+ if (mShowPowerStatusOnBackButton)
+ {
+ showBatteryStatus (true);
+ }
+ break;
+ default:
+ stream << i18n("Unhandled event: ") << event;
+ if(mReportUnknownEvents) showTextMsg(text);
+ kdDebug() << "KVaio::slotVaioEvent: event not handled."
+ << endl;
+ }
+}
+
+bool KVaio::showTextMsg(const QString& msg)
+{
+ return myparent->showTextMsg(msg);
+}
+
+
+
+bool KVaio::showProgressMsg(const QString& msg, int value)
+{
+ m_progress = value;
+ return myparent->showProgressMsg(msg,value);
+}
+
+void KVaio::blankScreen()
+{
+ bool blankonly;
+
+ if (isKScreensaverAvailable()) {
+
+ QByteArray data, replyData;
+ QDataStream arg(data, IO_WriteOnly);
+ QCString replyType;
+
+ /* Set the screensave to BlankOnly mode */
+ blankonly = true;
+ arg << blankonly;
+ mClient.call("kdesktop","KScreensaverIface","setBlankOnly(bool)",
+ data, replyType, replyData) ;
+
+ /* Save the screen */
+ if ( !mClient.call("kdesktop", "KScreensaverIface", "save()",
+ data, replyType, replyData) )
+ {
+ kdDebug() << "KVaio::blankScreen: there was some error "
+ << "using DCOP." << endl;
+ }
+
+ /* Set the screensave to its original mode */
+ blankonly = false;
+ arg << blankonly;
+ mClient.call("kdesktop","KScreensaverIface","setBlankOnly(bool)",
+ data, replyType, replyData) ;
+
+ }
+
+}
+
+void KVaio::suspendToDisk()
+{
+ QByteArray data, replyData;
+ QDataStream arg(data, IO_WriteOnly);
+ QCString replyType;
+
+ mClient.call("kpowersave","KPowersaveIface","do_suspendToDisk()",
+ data, replyType, replyData) ;
+}
+
+
+bool KVaio::isKScreensaverAvailable()
+{
+ if(mClient.isAttached())
+ {
+ // kdDebug() << "KVaio::showTextMsg: attached to DCOP server." << endl;
+ if(mClient.isApplicationRegistered("kdesktop"))
+ {
+ QCStringList objects;
+
+ // kdDebug() << "KVaio::showTextMsg: kded is registered at dcop server."
+ // << endl;
+ objects = mClient.remoteObjects("kdesktop");
+ if(objects.contains("KScreensaverIface"))
+ {
+ // kdDebug() << "KVaio::showTextMsg: kmilod is available at kded."
+ // << endl;
+ return true;
+ } else {
+ kdDebug() << "KVaio::isKScreensaverAvailable: "
+ << "KScreensaverIface is NOT available at kdesktop." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKScreensaverAvailable: "
+ << "kdesktop is NOT registered at dcop server." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKScreensaverAvailable: "
+ << "kdesktop is NOT registered at dcop server." << endl;
+ return false;
+ }
+}
+
+bool KVaio::isKMiloDAvailable()
+{
+ if(mClient.isAttached())
+ {
+ // kdDebug() << "KVaio::showTextMsg: attached to DCOP server." << endl;
+ if(mClient.isApplicationRegistered("kded"))
+ {
+ QCStringList objects;
+
+ // kdDebug() << "KVaio::showTextMsg: kded is registered at dcop server."
+ // << endl;
+ objects = mClient.remoteObjects("kded");
+ if(objects.contains("kmilod"))
+ {
+ // kdDebug() << "KVaio::showTextMsg: kmilod is available at kded."
+ // << endl;
+ return true;
+ } else {
+ kdDebug() << "KVaio::isKMiloDAvailable: "
+ << "kmilod is NOT available at kded." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKMiloDAvailable: "
+ << "kded is NOT registered at dcop server." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKMiloDAvailable: "
+ << "kded is NOT registered at dcop server." << endl;
+ return false;
+ }
+}
+
+void KVaio::loadConfiguration(KConfig *k)
+{
+ k->setGroup("KVaio");
+
+ mReportUnknownEvents =
+ k->readBoolEntry("Report_Unknown_Events", false);
+ mReportPowerStatus =
+ k->readBoolEntry("PeriodicallyReportPowerStatus", false);
+ mShowPowerStatusOnBackButton =
+ k->readBoolEntry("PowerStatusOnBackButton", true);
+
+ kdDebug() << "KVaio::loadConfiguration: " << endl
+ << " mReportUnknownEvents: "
+ << mReportUnknownEvents << endl
+ << " mReportPowerStatus: "
+ << mReportPowerStatus << endl
+ << "mShowPowerStatusOnBackButton: "
+ << mShowPowerStatusOnBackButton << endl;
+}
+
+const KVaioDriverInterface* KVaio::driver()
+{
+ return mDriver;
+}
+
+void KVaio::slotTimeout ()
+{
+ showBatteryStatus ();
+ mTimer->start (4000, true);
+}
+
+bool KVaio::showBatteryStatus ( bool force )
+{
+ static bool acConnectedCache = false;
+ static int previousChargeCache = -1;
+ bool bat1Avail = false, bat2Avail = false, acConnected = false;
+ int bat1Remaining = 0, bat1Max = 0, bat2Remaining = 0, bat2Max = 0;
+ bool displayBatteryMsg = false;
+ bool displayACStatus = false;
+
+ QString text, acMsg;
+ QTextStream stream(text, IO_WriteOnly);
+
+ // -----
+ // only display on startup if mReportPowerStatus is true:
+ if (mReportPowerStatus==false || !force)
+ {
+ return true;
+ }
+
+ // query all necessary information:
+ (void) mDriver->getBatteryStatus(bat1Avail, bat1Remaining, bat1Max,
+ bat2Avail, bat2Remaining, bat2Max,
+ acConnected);
+
+ int remaining;
+ if ( bat1Avail || bat2Avail )
+ remaining = (int)(100.0*(bat1Remaining+bat2Remaining)
+ / (bat1Max+bat2Max));
+ else
+ remaining = -1; // no battery available
+
+ if (acConnectedCache != acConnected || force)
+ {
+ displayACStatus = true;
+ acConnectedCache = acConnected;
+ }
+
+ displayBatteryMsg = ( previousChargeCache * 100 / remaining > 1000 )
+ || ( previousChargeCache * 100 / remaining > 200 && remaining < 10 )
+ || force;
+
+
+ if (displayBatteryMsg)
+ {
+ previousChargeCache = remaining;
+ }
+
+ // ----- prepare text messages
+ if (displayACStatus || displayBatteryMsg)
+ {
+
+ if (displayACStatus)
+ {
+ acMsg = acConnected ? i18n ("AC Connected") : i18n ("AC Disconnected");
+ }
+
+ switch (remaining)
+ {
+ case 100:
+ stream << i18n("Battery is Fully Charged. ");
+ break;
+ case 5:
+ case 4:
+ case 3:
+ case 2:
+ case 1:
+ stream << i18n("Caution: Battery is Almost Empty (%1% remaining).").arg(remaining);
+ break;
+ case 0:
+ stream << i18n("Alert: Battery is Empty!");
+ break;
+ case -1:
+ stream << i18n("No Battery Inserted.");
+ break;
+ default:
+ stream << i18n("Remaining Battery Capacity: %1%").arg( remaining );
+ };
+
+ // show a message if the battery status changed by more then 10% or on startup
+ if (displayACStatus)
+ {
+ stream << endl << acMsg;
+ }
+
+ return showTextMsg (text);
+ } else {
+ return true;
+ }
+}
+
+void KVaio::BrightnessUp(int step)
+{
+ m_brightness = mDriver->brightness();
+
+ m_brightness += step;
+ if(m_brightness > m_maxBright) {
+ m_brightness = m_maxBright;
+ }
+
+ mDriver->setBrightness(m_brightness);
+ showProgressMsg( i18n("Brightness"), m_brightness*100/255);
+}
+
+void KVaio::BrightnessDown(int step)
+{
+ m_brightness = mDriver->brightness();
+
+ m_brightness -= step;
+ if(m_brightness < m_minBright) {
+ m_brightness = m_minBright;
+ }
+
+ mDriver->setBrightness(m_brightness);
+ showProgressMsg( i18n("Brightness"), m_brightness*100/255);
+}
+
+
+void KVaio::displayVolume()
+{
+// _interface->displayProgress(i18n("Volume"), m_volume);
+
+ showProgressMsg(i18n("Volume"), m_volume);
+ // If we got this far, the DCOP communication with kmix works,
+ // so we don't have to test the result.
+ kmixClient->send("setMasterVolume", m_volume);
+
+ // if mute then unmute
+ if (m_mute)
+ {
+ m_mute = false;
+ kmixClient->send("setMasterMute", m_mute);
+ }
+}
+
+
+bool KVaio::retrieveVolume() {
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call("masterVolume");
+ if (reply.isValid())
+ m_volume = reply;
+ else
+ kmix_error = true;
+
+ if (kmix_error) // maybe the error occurred because kmix wasn't running
+ {
+// _interface->displayText
+ showTextMsg(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call("masterVolume");
+ if (reply.isValid())
+ {
+ m_volume = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ //_interface->displayText
+ showTextMsg(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void KVaio::VolumeUp(int step)
+{
+ if (!retrieveVolume())
+ return;
+
+ // FIXME if the mixer doesn't support steps of the specified size it
+ // could get stuck at one position
+ m_volume += step;
+ if (m_volume > m_maxVolume)
+ m_volume = m_maxVolume;
+
+ displayVolume();
+}
+
+void KVaio::VolumeDown(int step)
+{
+ if (!retrieveVolume())
+ return;
+
+ m_volume -= step;
+ if (m_volume < m_minVolume)
+ m_volume = m_minVolume;
+
+ displayVolume();
+}
+
+bool KVaio::retrieveMute()
+{
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call("masterMute");
+ if (reply.isValid())
+ m_volume = reply;
+ else
+ kmix_error = true;
+
+ if (kmix_error)
+ {
+ // maybe the error occurred because kmix wasn't running
+ //_interface->displayText
+ showTextMsg(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call("masterMute");
+ if (reply.isValid())
+ {
+ m_mute = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ } else
+ {
+ kmixWindow->send("hide");
+ kmix_error = true;
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ //_interface->displayText
+ showTextMsg(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void KVaio::mute()
+{
+ if (!retrieveMute())
+ return;
+
+ m_mute = !m_mute;
+
+ int newVolume;
+ QString muteText;
+ if (m_mute)
+ {
+ m_oldVolume = m_volume;
+ newVolume = 0;
+ muteText = i18n("Mute on");
+ } else {
+ newVolume = m_oldVolume;
+ muteText = i18n("Mute off");
+ }
+
+ kmixClient->send("setMasterMute", m_mute);
+
+ //_interface->displayText(muteText);
+ showTextMsg(muteText);
+
+}
+
+
+#include "kvaio.moc"
diff --git a/kmilo/kmilo_kvaio/kvaio.h b/kmilo/kmilo_kvaio/kvaio.h
new file mode 100644
index 0000000..c16f27e
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaio.h
@@ -0,0 +1,113 @@
+/* -*- C++ -*-
+
+ This file declares the KVaio class.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#ifndef _KVAIO_H
+#define _KVAIO_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtimer.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+#include <kmainwindow.h>
+#include "kvaiodriverinterface.h"
+#include "monitor.h"
+#include "kmilo_kvaio.h"
+
+extern "C" {
+#include <X11/Xlib.h>
+//#include <X11/extensions/XTest.h>
+}
+
+class KVaio;
+class KMiloKVaio;
+
+/**
+ * @short KVaio class
+ * This class provides an interface between the Vaio driver and the
+ * respective application (either the kmilod module or a single
+ * application).
+ * This class provides the application of the events created by the
+ * KVaioDriverInterface class.
+ * @author Mirko Boehm <mirko@hackerbuero.org>
+ * @version 0.2
+ */
+class KVaio : public QObject
+{
+ Q_OBJECT
+public:
+// KVaio(QObject *parent = 0, const char *name =0);
+ KVaio(KMiloKVaio *parent = 0, const char *name =0);
+
+ virtual ~KVaio();
+ const KVaioDriverInterface *driver();
+ void loadConfiguration(KConfig *);
+ const int progress() { return m_progress; }
+
+protected:
+ KVaioDriverInterface *mDriver;
+ Display *mDisp;
+ DCOPClient mClient;
+ bool isKScreensaverAvailable();
+ bool isKMiloDAvailable();
+ bool showTextMsg(const QString& msg);
+ bool showProgressMsg(const QString& msg, int progress);
+ bool showBatteryStatus ( bool force = false);
+protected slots:
+ void slotVaioEvent(int);
+ void slotTimeout();
+public slots:
+ void blankScreen();
+ void suspendToDisk();
+ void BrightnessUp(int step);
+ void BrightnessDown(int step);
+ void VolumeUp(int step);
+ void VolumeDown(int step);
+ void mute();
+private:
+ bool retrieveMute();
+ bool retrieveVolume();
+ void displayVolume();
+
+ KMiloKVaio *myparent;
+
+ DCOPRef *kmixClient, *kmixWindow;
+
+ int m_progress;
+ int m_volume, m_oldVolume, m_brightness;
+ bool m_mute;
+
+ int m_maxVolume, m_minVolume;
+ int m_maxBright, m_minBright;
+
+ int m_VolumeStep;
+ int m_BrightnessStep;
+
+ bool mReportUnknownEvents;
+ bool mReportPowerStatus;
+ bool mShowPowerStatusOnBackButton;
+ QTimer *mTimer;
+};
+
+#endif // _KVAIO_H
diff --git a/kmilo/kmilo_kvaio/kvaiodriverinterface.cpp b/kmilo/kmilo_kvaio/kvaiodriverinterface.cpp
new file mode 100644
index 0000000..32da70a
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaiodriverinterface.cpp
@@ -0,0 +1,221 @@
+/* -*- C++ -*-
+
+ This file implements the KVaioDriverInterface class.
+ It provides an event-oriented wrapper for the kernel sonypi driver.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#include "kvaiodriverinterface.h"
+
+extern "C" {
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <X11/Xlib.h>
+//#include <X11/extensions/XTest.h>
+
+#include "./sonypi.h"
+}
+
+#include <qsocketnotifier.h>
+#include <kdebug.h>
+
+// Taken from Stelian Pop's spicctrl utility:
+
+/* Have our own definition of ioctls... */
+
+/* get/set brightness */
+#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
+#define SONYPI_IOCSBRT _IOW('v', 0, __u8)
+
+/* get battery full capacity/remaining capacity */
+#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16)
+#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16)
+#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16)
+#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16)
+
+/* get battery flags: battery1/battery2/ac adapter present */
+#define SONYPI_BFLAGS_B1 0x01
+#define SONYPI_BFLAGS_B2 0x02
+#define SONYPI_BFLAGS_AC 0x04
+#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8)
+
+/* get/set bluetooth subsystem state on/off */
+#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
+#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
+
+KVaioDriverInterface::KVaioDriverInterface(QObject *parent)
+ : QObject(parent),
+ mFd(0),
+ mNotifier(0)
+{
+}
+
+bool KVaioDriverInterface::connectToDriver(bool listen)
+{
+ const char* DriverFile = "/dev/sonypi";
+
+ mFd = open(DriverFile, O_RDONLY);
+
+ // mFd = open(DriverFile, O_RDWR);
+
+ if(mFd == -1)
+ {
+ kdDebug() << "KVaio: Failed to open /dev/sonypi: "
+ << strerror(errno) << "." << endl;
+ return false;
+ }
+
+ fcntl(mFd, F_SETFL, fcntl(mFd, F_GETFL) | O_ASYNC);
+
+ if(listen)
+ {
+ mNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this);
+ connect(mNotifier, SIGNAL(activated(int)), SLOT(socketActivated(int)));
+ }
+ return true;
+}
+
+void KVaioDriverInterface::disconnectFromDriver()
+{
+ delete mNotifier;
+ mNotifier = 0;
+
+ if(mFd!=0)
+ {
+ close(mFd);
+ mFd = 0;
+ }
+}
+
+void KVaioDriverInterface::socketActivated(int)
+{
+ unsigned char events[8];
+ int count;
+
+ do {
+ count = read(mFd, &events, sizeof(events));
+ for(int index = 0; index<count; index++)
+ {
+ emit(vaioEvent(events[index]));
+ }
+ } while(count==sizeof(events));
+}
+
+int KVaioDriverInterface::brightness()
+{
+ unsigned char value = 0;
+ int result=0;
+
+ result = ioctl(mFd, SONYPI_IOCGBRT, &value);
+
+ if (result >= 0)
+ {
+ return value;
+ } else {
+ return -1;
+ }
+
+}
+
+void KVaioDriverInterface::setBrightness(int value)
+{
+ static unsigned char cache; // to avoid unnecessary updates
+ int result;
+ unsigned char value8 = 0;
+
+ if(value<0) value=0;
+ if(value>255) value=255;
+
+ value8 = __u8(value);
+
+ if(value8 != cache)
+ {
+ result = ioctl(mFd, SONYPI_IOCSBRT, &value8);
+
+ if(result<0)
+ {
+ kdDebug() << "KVaioDriverInterface::setBrightness: ioctl failed."
+ << endl;
+ }
+ cache = value8;
+ }
+}
+
+bool KVaioDriverInterface::getBatteryStatus(
+ bool& bat1Avail, int& bat1Remaining, int& bat1Max,
+ bool& bat2Avail, int& bat2Remaining, int& bat2Max,
+ bool& acConnected)
+{
+ unsigned char batFlags = 0;
+
+ bool retval = true;
+
+ if(ioctl(mFd, SONYPI_IOCGBATFLAGS, &batFlags)<0)
+ {
+ retval = false;
+ } else {
+ __u16 rem1 = 0, rem2 = 0, cap1 = 0, cap2 = 0;
+
+ bat1Avail = batFlags & SONYPI_BFLAGS_B1;
+ bat2Avail = batFlags & SONYPI_BFLAGS_B2;
+ acConnected = batFlags & SONYPI_BFLAGS_AC;
+
+// kdDebug() << "KVaioDriverInterface::getBatteryStatus: battery 1: "
+// << (bat1Avail ? "available" : "not available") << endl
+// << " battery 2: "
+// << (bat2Avail ? "available" : "not available") << endl
+// << " AC adapter: "
+// << (acConnected ? "connected" : "connected")
+// << "." << endl;
+
+ if(bat1Avail
+ && ioctl(mFd, SONYPI_IOCGBAT1CAP, &cap1) >= 0
+ && ioctl(mFd, SONYPI_IOCGBAT1REM, &rem1) >= 0)
+ {
+ bat1Max = cap1;
+ bat1Remaining = rem1;
+ } else {
+ bat1Remaining = 0;
+ bat1Max = 0;
+ retval = false;
+ }
+
+ if(bat2Avail
+ && ioctl(mFd, SONYPI_IOCGBAT2CAP, &cap2) >= 0
+ && ioctl(mFd, SONYPI_IOCGBAT2REM, &rem2) >= 0)
+ {
+ bat2Max = cap2;
+ bat2Remaining = rem2;
+ } else {
+ bat2Remaining = 0;
+ bat2Max = 0;
+ retval = false;
+ }
+ }
+
+ return retval;
+}
+
+#include "kvaiodriverinterface.moc"
+
diff --git a/kmilo/kmilo_kvaio/kvaiodriverinterface.h b/kmilo/kmilo_kvaio/kvaiodriverinterface.h
new file mode 100644
index 0000000..55c32b6
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaiodriverinterface.h
@@ -0,0 +1,62 @@
+/* -*- C++ -*-
+
+ This file declares the KVaioDrierInterface class.
+ It provides an event-oriented wrapper for the kernel sonypi driver.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+*/
+
+#ifndef KVAIO_DRIVERINTERFACE_H
+#define KVAIO_DRIVERINTERFACE_H
+
+#include <qobject.h>
+
+class QTimer;
+
+extern "C"
+{
+#include <fcntl.h>
+
+#include "./sonypi.h"
+}
+
+class QSocketNotifier;
+
+class KVaioDriverInterface : public QObject
+{
+ Q_OBJECT
+public:
+ KVaioDriverInterface(QObject *parent=0);
+ bool connectToDriver(bool listen = true);
+ void disconnectFromDriver();
+ /** Return the current display brightness, a value between 0 and
+ 255. Returns -1 if the setting cannot be retrieved. */
+ int brightness();
+ /** Get the battery status. */
+ bool getBatteryStatus(bool& bat1Avail, int& bat1Remaining, int& bat1Max,
+ bool& bat2Avail, int& bat2Remaining, int& bat2Max,
+ bool& acConnected);
+public slots:
+ /** Set the display brightness. 0<= value <=255. */
+ void setBrightness(int);
+protected:
+ int mFd;
+ fd_set mRfds;
+ QSocketNotifier *mNotifier;
+signals:
+ void vaioEvent(int);
+ // void brightnessChanged(int);
+protected slots:
+ void socketActivated(int);
+};
+
+#endif // KVAIO_DRIVERINTERFACE_H
diff --git a/kmilo/kmilo_kvaio/sonypi.h b/kmilo/kmilo_kvaio/sonypi.h
new file mode 100644
index 0000000..43cfc80
--- /dev/null
+++ b/kmilo/kmilo_kvaio/sonypi.h
@@ -0,0 +1,158 @@
+/*
+ * Sony Programmable I/O Control Device driver for VAIO
+ *
+ * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
+ *
+ * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
+
+ * Copyright (C) 2001-2002 Alcve <www.alcove.com>
+ *
+ * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
+ *
+ * Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp>
+ *
+ * Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp>
+ *
+ * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
+ *
+ * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _SONYPI_H_
+#define _SONYPI_H_
+
+#include <linux/types.h>
+
+/* events the user application reading /dev/sonypi can use */
+
+#define SONYPI_EVENT_JOGDIAL_DOWN 1
+#define SONYPI_EVENT_JOGDIAL_UP 2
+#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
+#define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4
+#define SONYPI_EVENT_JOGDIAL_PRESSED 5
+#define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */
+#define SONYPI_EVENT_CAPTURE_PRESSED 7
+#define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */
+#define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9
+#define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10
+#define SONYPI_EVENT_FNKEY_ESC 11
+#define SONYPI_EVENT_FNKEY_F1 12
+#define SONYPI_EVENT_FNKEY_F2 13
+#define SONYPI_EVENT_FNKEY_F3 14
+#define SONYPI_EVENT_FNKEY_F4 15
+#define SONYPI_EVENT_FNKEY_F5 16
+#define SONYPI_EVENT_FNKEY_F6 17
+#define SONYPI_EVENT_FNKEY_F7 18
+#define SONYPI_EVENT_FNKEY_F8 19
+#define SONYPI_EVENT_FNKEY_F9 20
+#define SONYPI_EVENT_FNKEY_F10 21
+#define SONYPI_EVENT_FNKEY_F11 22
+#define SONYPI_EVENT_FNKEY_F12 23
+#define SONYPI_EVENT_FNKEY_1 24
+#define SONYPI_EVENT_FNKEY_2 25
+#define SONYPI_EVENT_FNKEY_D 26
+#define SONYPI_EVENT_FNKEY_E 27
+#define SONYPI_EVENT_FNKEY_F 28
+#define SONYPI_EVENT_FNKEY_S 29
+#define SONYPI_EVENT_FNKEY_B 30
+#define SONYPI_EVENT_BLUETOOTH_PRESSED 31
+#define SONYPI_EVENT_PKEY_P1 32
+#define SONYPI_EVENT_PKEY_P2 33
+#define SONYPI_EVENT_PKEY_P3 34
+#define SONYPI_EVENT_BACK_PRESSED 35
+#define SONYPI_EVENT_LID_CLOSED 36
+#define SONYPI_EVENT_LID_OPENED 37
+#define SONYPI_EVENT_BLUETOOTH_ON 38
+#define SONYPI_EVENT_BLUETOOTH_OFF 39
+#define SONYPI_EVENT_HELP_PRESSED 40
+#define SONYPI_EVENT_FNKEY_ONLY 41
+#define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42
+#define SONYPI_EVENT_JOGDIAL_FAST_UP 43
+#define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44
+#define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45
+#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46
+#define SONYPI_EVENT_JOGDIAL_VFAST_UP 47
+#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48
+#define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49
+#define SONYPI_EVENT_ZOOM_PRESSED 50
+#define SONYPI_EVENT_THUMBPHRASE_PRESSED 51
+#define SONYPI_EVENT_MEYE_FACE 52
+#define SONYPI_EVENT_MEYE_OPPOSITE 53
+#define SONYPI_EVENT_MEMORYSTICK_INSERT 54
+#define SONYPI_EVENT_MEMORYSTICK_EJECT 55
+#define SONYPI_EVENT_ANYBUTTON_RELEASED 56
+#define SONYPI_EVENT_BATTERY_INSERT 57
+#define SONYPI_EVENT_BATTERY_REMOVE 58
+#define SONYPI_EVENT_FNKEY_RELEASED 59
+
+/* get/set brightness */
+#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
+#define SONYPI_IOCSBRT _IOW('v', 0, __u8)
+
+/* get battery full capacity/remaining capacity */
+#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16)
+#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16)
+#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16)
+#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16)
+
+/* get battery flags: battery1/battery2/ac adapter present */
+#define SONYPI_BFLAGS_B1 0x01
+#define SONYPI_BFLAGS_B2 0x02
+#define SONYPI_BFLAGS_AC 0x04
+#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8)
+
+/* get/set bluetooth subsystem state on/off */
+#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
+#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
+
+/* get/set fan state on/off */
+#define SONYPI_IOCGFAN _IOR('v', 10, __u8)
+#define SONYPI_IOCSFAN _IOW('v', 11, __u8)
+
+/* get temperature (C) */
+#define SONYPI_IOCGTEMP _IOR('v', 12, __u8)
+
+#ifdef __KERNEL__
+
+/* used only for communication between v4l and sonypi */
+
+#define SONYPI_COMMAND_GETCAMERA 1 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERA 2
+#define SONYPI_COMMAND_GETCAMERABRIGHTNESS 3 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERABRIGHTNESS 4
+#define SONYPI_COMMAND_GETCAMERACONTRAST 5 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERACONTRAST 6
+#define SONYPI_COMMAND_GETCAMERAHUE 7 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERAHUE 8
+#define SONYPI_COMMAND_GETCAMERACOLOR 9 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERACOLOR 10
+#define SONYPI_COMMAND_GETCAMERASHARPNESS 11 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERASHARPNESS 12
+#define SONYPI_COMMAND_GETCAMERAPICTURE 13 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERAPICTURE 14
+#define SONYPI_COMMAND_GETCAMERAAGC 15 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERAAGC 16
+#define SONYPI_COMMAND_GETCAMERADIRECTION 17 /* obsolete */
+#define SONYPI_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */
+#define SONYPI_COMMAND_GETCAMERAREVISION 19 /* obsolete */
+
+int sonypi_camera_command(int command, u8 value);
+
+#endif /* __KERNEL__ */
+
+#endif /* _SONYPI_H_ */
diff --git a/kmilo/kmilod/Makefile.am b/kmilo/kmilod/Makefile.am
new file mode 100644
index 0000000..72662db
--- /dev/null
+++ b/kmilo/kmilod/Makefile.am
@@ -0,0 +1,43 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES=$(all_includes)
+
+kde_module_LTLIBRARIES = kded_kmilod.la
+kded_kmilod_la_LDFLAGS = -module -avoid-version $(all_libraries)
+kded_kmilod_la_LIBADD = $(LIB_KIO) libkmilo.la
+kded_kmilod_la_SOURCES = kmilod.cpp kmilod.skel defaultskin.cpp \
+ defaultwidget.ui kmilointerface.cpp
+
+lib_LTLIBRARIES = libkmilo.la
+libkmilo_la_SOURCES = monitor.cpp displayskin.cpp
+libkmilo_la_LDFLAGS = -version-info 1:0:0 -no-undefined $(all_libraries)
+libkmilo_la_LIBADD = $(LIB_QT)
+
+METASOURCES = AUTO
+
+noinst_HEADERS = kmilod.h monitor.h displayskin.h defaultskin.h
+
+services_DATA = kmilod.desktop
+servicesdir = $(kde_servicesdir)/kded
+
+servicetypes_DATA = kmilopluginsvc.desktop
+servicetypesdir = $(kde_servicetypesdir)/kmilo
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kmilod.pot
diff --git a/kmilo/kmilod/defaultskin.cpp b/kmilo/kmilod/defaultskin.cpp
new file mode 100644
index 0000000..f0324de
--- /dev/null
+++ b/kmilo/kmilod/defaultskin.cpp
@@ -0,0 +1,107 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "defaultwidget.h"
+
+#include <qprogressbar.h>
+#include <qwidget.h>
+#include <qwidgetstack.h>
+#include <qlabel.h>
+#include <qapplication.h>
+
+#include <kwin.h>
+#include <netwm.h>
+#include <kglobalsettings.h>
+#include <kdeversion.h>
+
+#include "defaultskin.h"
+
+
+DefaultSkin::DefaultSkin() {
+ connect(&_timer, SIGNAL(timeout()), this, SLOT(timeout()));
+
+ _widget = new DefaultWidget(0, "Screen Indicator", Qt::WX11BypassWM);
+ _widget->setFocusPolicy(QWidget::NoFocus);
+
+ KWin::setOnAllDesktops(_widget->winId(), true);
+ KWin::setState( _widget->winId(), NET::StaysOnTop | NET::Sticky
+ | NET::SkipTaskbar | NET::SkipPager );
+ KWin::setType(_widget->winId(), NET::Override);
+
+ _widget->hide();
+}
+
+
+DefaultSkin::~DefaultSkin() {
+ delete _widget;
+ _widget = 0;
+}
+
+
+void DefaultSkin::clear() {
+ _timer.stop();
+ _widget->hide();
+}
+
+
+void DefaultSkin::show() {
+#if KDE_IS_VERSION(3,1,90)
+ QRect r = KGlobalSettings::splashScreenDesktopGeometry();
+#else
+ QRect r = QApplication::desktop()->geometry();
+#endif
+ // _label->resize(_label->minimumSizeHint());
+ // _widget->resize(_label->minimumSizeHint());
+ _widget->move(r.center() -
+ QPoint(_widget->width()/2, _widget->height()/2));
+ _widget->show();
+ _timer.start(750, true);
+}
+
+
+void DefaultSkin::displayText(const QString& text, const QPixmap& customPixmap) {
+ Q_UNUSED(customPixmap)
+ _timer.stop();
+ _widget->_widgetStack->raiseWidget(0);
+ _widget->_textOnly->setText(text);
+ show();
+}
+
+
+void DefaultSkin::displayProgress(const QString& text, int percent, const QPixmap& customPixmap) {
+ Q_UNUSED(customPixmap)
+ _timer.stop();
+ _widget->_progressText->setText(text);
+ _widget->_progress->setProgress(percent);
+ _widget->_widgetStack->raiseWidget(1);
+ show();
+}
+
+
+void DefaultSkin::timeout() {
+ clear();
+}
+
+
+#include "defaultskin.moc"
+
diff --git a/kmilo/kmilod/defaultskin.h b/kmilo/kmilod/defaultskin.h
new file mode 100644
index 0000000..0e01f23
--- /dev/null
+++ b/kmilo/kmilod/defaultskin.h
@@ -0,0 +1,56 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _DEFAULTSKIN_H_
+#define _DEFAULTSKIN_H_
+
+#include <qstring.h>
+#include <qobject.h>
+#include <qtimer.h>
+#include "displayskin.h"
+
+class DefaultWidget;
+
+class DefaultSkin : public QObject, public KMilo::DisplaySkin {
+ Q_OBJECT
+ public:
+ DefaultSkin();
+ virtual ~DefaultSkin();
+
+ virtual void clear();
+
+ virtual void displayText(const QString& text, const QPixmap& customPixmap=QPixmap());
+ virtual void displayProgress(const QString& text,
+ int percent, const QPixmap& customPixmap=QPixmap());
+
+ private slots:
+ void timeout();
+
+ private:
+ void show();
+
+ DefaultWidget *_widget;
+ QTimer _timer;
+};
+
+
+#endif
diff --git a/kmilo/kmilod/defaultwidget.ui b/kmilo/kmilod/defaultwidget.ui
new file mode 100644
index 0000000..b4809fe
--- /dev/null
+++ b/kmilo/kmilod/defaultwidget.ui
@@ -0,0 +1,195 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>DefaultWidget</class>
+<comment>Default widget for the default display for kmilod
+Released under the terms of the GNU GPL.</comment>
+<author>George Staikos &lt;staikos@kde.org</author>
+<widget class="QWidget">
+ <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>
+ </property>
+ <widget class="QWidgetStack" row="0" column="0">
+ <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>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <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>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>page</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <grid>
+ <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">
+ <property name="name">
+ <cstring>spacer1_2</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>
+ <widget class="QProgressBar" row="1" column="1">
+ <property name="name">
+ <cstring>_progress</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <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"/>
+</UI>
diff --git a/kmilo/kmilod/displayskin.cpp b/kmilo/kmilod/displayskin.cpp
new file mode 100644
index 0000000..f0fd422
--- /dev/null
+++ b/kmilo/kmilod/displayskin.cpp
@@ -0,0 +1,34 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "displayskin.h"
+
+namespace KMilo {
+
+DisplaySkin::DisplaySkin() {
+}
+
+DisplaySkin::~DisplaySkin() {
+}
+
+}
+
diff --git a/kmilo/kmilod/displayskin.h b/kmilo/kmilod/displayskin.h
new file mode 100644
index 0000000..4e74e0c
--- /dev/null
+++ b/kmilo/kmilod/displayskin.h
@@ -0,0 +1,47 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _DISPLAYSKIN_H_
+#define _DISPLAYSKIN_H_
+
+#include <kdemacros.h>
+
+#include <qstring.h>
+#include <qpixmap.h>
+
+namespace KMilo {
+
+class KDE_EXPORT DisplaySkin {
+ public:
+ DisplaySkin();
+ virtual ~DisplaySkin();
+
+ virtual void clear() = 0;
+
+ virtual void displayText(const QString& text,const QPixmap& customPixmap=QPixmap()) = 0;
+ virtual void displayProgress(const QString& text,
+ int percent, const QPixmap& customPixmap=QPixmap()) = 0;
+};
+
+}
+
+#endif
diff --git a/kmilo/kmilod/kmilod.cpp b/kmilo/kmilod/kmilod.cpp
new file mode 100644
index 0000000..98203b1
--- /dev/null
+++ b/kmilo/kmilod/kmilod.cpp
@@ -0,0 +1,227 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "kmilod.h"
+#include "monitor.h"
+
+#include <qfile.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <kservicetype.h>
+#include <kservice.h>
+#include <kconfig.h>
+#include <kparts/componentfactory.h>
+
+#include "kmilointerface.h"
+#include "defaultskin.h"
+
+using namespace KMilo;
+
+extern "C" {
+ KDE_EXPORT KDEDModule *create_kmilod(const QCString &name) {
+ return new KMiloD(name);
+ }
+}
+
+
+KMiloD::KMiloD(const QCString &name) : KDEDModule(name), _interval(100)
+{
+ _monitors.setAutoDelete(true);
+ _miface = new KMiloInterface(this);
+
+ // Create the display skin object
+ _display = new DefaultSkin;
+
+ bool shouldPoll = false;
+
+ // Load the modules
+ KService::List plugs = KServiceType::offers("KMilo Plugin");
+ for (KService::List::ConstIterator it = plugs.begin();
+ it != plugs.end(); ++it) {
+ KService::Ptr service = *it;
+ KMilo::Monitor *m = KParts::ComponentFactory::createInstanceFromService<KMilo::Monitor>(service, 0, service->desktopEntryName().latin1());
+ if (m) {
+ m->setInterface(_miface);
+ if (m->init()) {
+ _monitors.append(m);
+ kdDebug() << "KMilo loaded module "
+ << service->property("Name").toString()
+ << endl;
+ shouldPoll = shouldPoll || m->shouldPoll();
+ } else {
+ delete m;
+ }
+ }
+ }
+
+ // Start the timer
+ QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(doTimer()));
+ if (shouldPoll) {
+ _timer.start(_interval);
+ }
+}
+
+
+KMiloD::~KMiloD()
+{
+ _timer.stop();
+
+ // Modules are automatically cleaned up when this is done. It has
+ // to be done before delete _display to avoid a race though.
+ _monitors.clear();
+
+ delete _display;
+ _display = 0L;
+
+ delete _miface;
+ _miface = 0L;
+}
+
+
+void KMiloD::setEnabled(bool enabled) {
+ if (enabled) {
+ enable();
+ } else {
+ disable();
+ }
+}
+
+
+void KMiloD::enable() {
+ if (!_monitors.isEmpty()) {
+ _timer.start(_interval, false);
+ }
+}
+
+
+void KMiloD::disable() {
+ _timer.stop();
+}
+
+
+bool KMiloD::enabled() const {
+ return _timer.isActive();
+}
+
+
+int KMiloD::pollMilliSeconds() const {
+ return _interval;
+}
+
+
+bool KMiloD::setPollMilliSeconds(int ms) {
+ if (ms > 1000 || ms < 0) {
+ return false;
+ }
+
+ if (!_monitors.isEmpty()) {
+ _timer.start(_interval, false);
+ }
+
+ _interval = ms;
+
+return true;
+}
+
+
+void KMiloD::doTimer() {
+ // Iterate through all the modules we have and poll
+ for (KMilo::Monitor *m = _monitors.first(); m; m = _monitors.next()) {
+ if (!m->shouldPoll()) {
+ continue;
+ }
+
+ KMilo::Monitor::DisplayType dt = m->poll();
+ switch (dt) {
+ case KMilo::Monitor::Volume:
+ displayProgress(i18n("Volume"), m->progress());
+ break;
+ case KMilo::Monitor::Brightness:
+ displayProgress(i18n("Brightness"), m->progress());
+ break;
+ case KMilo::Monitor::Mute:
+ displayText(i18n("Muted"));
+ break;
+ case KMilo::Monitor::Tap:
+ displayText(m->message());
+ break;
+ case KMilo::Monitor::Sleep:
+ displayText(m->message());
+ break;
+ case KMilo::Monitor::None:
+ // Do nothing
+ break;
+ case KMilo::Monitor::Error:
+ {
+ // On error, remove the monitor and continue
+ KMilo::Monitor *n = _monitors.next();
+ _monitors.remove(m); // deletes m
+ m = n;
+ }
+ break;
+ default:
+ kdWarning() << "Error in KMiloD. Please report." << endl;
+ break;
+ }
+ }
+}
+
+
+void KMiloD::displayText(const QString& text) {
+ _display->displayText(text, QPixmap());
+}
+
+
+void KMiloD::displayText(const QString& text, const QPixmap& customPixmap) {
+ _display->displayText(text, customPixmap);
+}
+
+
+void KMiloD::displayProgress(const QString& text, int progress) {
+ _display->displayProgress(text, progress, QPixmap());
+}
+
+void KMiloD::displayProgress(const QString& text, int progress, const QPixmap& customPixmap ) {
+ _display->displayProgress(text, progress, customPixmap);
+}
+
+void KMiloD::reconfigure()
+{
+ // load the kmilo configuration file:
+ KConfig config("kmilodrc");
+
+ KMilo::Monitor *monitor;
+
+ for(monitor = _monitors.first(); monitor; monitor = _monitors.next())
+ {
+ monitor->reconfigure(&config);
+ }
+}
+
+#include "kmilod.moc"
+
diff --git a/kmilo/kmilod/kmilod.desktop b/kmilo/kmilod/kmilod.desktop
new file mode 100644
index 0000000..d31dacb
--- /dev/null
+++ b/kmilo/kmilod/kmilod.desktop
@@ -0,0 +1,59 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KDEDModule
+X-KDE-ModuleType=Library
+X-KDE-Library=kmilod
+X-KDE-FactoryName=kmilod
+X-KDE-Kded-autoload=true
+X-KDE-Kded-load-on-demand=false
+Name=KMilo
+Name[de]=KMilo Sondertasten
+Name[hi]=के-मिलो
+Name[ne]=केमिलो
+Name[sv]=Kmilo
+Name[ta]= கேமிலோ
+Comment=KDE special key notifier
+Comment[ar]=مبلغ كدى للمفاتيح الخاصة
+Comment[bg]=Известяване при натискане на специалните клавиши на някои модели лаптопи
+Comment[bs]=KDE obavještenje o posebnim tipkama
+Comment[ca]=Notificador de tecles especials de KDE
+Comment[cs]=Hlášení speciálních kláves
+Comment[da]=KDE Speciel tast bekendtgørelse
+Comment[de]=Unterstützung für Sonder- und Multimediatasten in KDE
+Comment[el]=Ειδοποιητής ειδικών πλήκτρων του KDE
+Comment[eo]=KDE-specialklavatentigilo
+Comment[es]=Notificador de teclas especiales de KDE
+Comment[et]=KDE eriklahvide märkija
+Comment[eu]=KDE tekla berezien jakinarazlea
+Comment[fa]=اخطار دهندۀ ویژۀ کلید KDE
+Comment[fi]=KDE:n erikoisnäppäinhuomauttaja
+Comment[fr]=Notificateur de touche spéciale pour KDE
+Comment[hu]=KDE-s kezelőprogram a speciális billentyűkhöz
+Comment[is]=KDE sérhnappatólið
+Comment[it]=Gestione KDE dei tasti speciali
+Comment[ja]=KDE の特殊キー通知
+Comment[kk]=KDE-ның арнаулы пернелерді қолдауы
+Comment[km]=កម្មវិធី​ជូនដំណឹង​គ្រាប់ចុច KDE ពិសេស
+Comment[lt]=KDE specialiųjų raktų pranešiklis
+Comment[mk]=Известувач за спец. копчиња во KDE
+Comment[nb]=Beskjedgiver KDE spesialtaster
+Comment[nds]=KDE-Sünnertastenmellen
+Comment[ne]=KDE विशेष कुञ्जी सूचनाकर्ता
+Comment[nl]=KDE-notificatie van speciale toetsen
+Comment[nn]=KDE-verktøy for spesialtastar
+Comment[pa]=KDE ਖਾਸ ਸਵਿੱਚ ਸੂਚਕ
+Comment[pl]=Obsługa klawiszy specjalnych
+Comment[pt]=Notificação de teclas especiais do KDE
+Comment[pt_BR]=Notificador de tecla especial do KDE
+Comment[ro]=Notificare taste speciale pentru KDE
+Comment[ru]=Поддержка специальных клавиш
+Comment[sk]=KDE upozornenie na špeciálne klávesy
+Comment[sl]=Opomnik posebnih ključev v KDE
+Comment[sr]=KDE-ов обаваштавач о посебним тастерима
+Comment[sr@Latn]=KDE-ov obavaštavač o posebnim tasterima
+Comment[sv]=Underrättelse om KDE specialtangent
+Comment[ta]= கேடிஇ சிறப்பு விசை குறிப்பான்
+Comment[tr]=KDE özel tuş bildirici
+Comment[uk]=Сповіщувач про натискання спеціальних клавіш для KDE
+Comment[zh_CN]=KDE 特殊按键通知程序
+Comment[zh_TW]=KDE 特殊鍵通知
diff --git a/kmilo/kmilod/kmilod.h b/kmilo/kmilod/kmilod.h
new file mode 100644
index 0000000..d97027b
--- /dev/null
+++ b/kmilo/kmilod/kmilod.h
@@ -0,0 +1,72 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _KMILOD_H_
+#define _KMILOD_H_
+
+#include <kdedmodule.h>
+#include <qstring.h>
+#include <qtimer.h>
+#include <qptrlist.h>
+#include "monitor.h"
+#include "displayskin.h"
+
+namespace KMilo {
+
+class KMiloInterface;
+
+class KMiloD : public KDEDModule {
+ Q_OBJECT
+ K_DCOP
+ public:
+ KMiloD(const QCString &name);
+ virtual ~KMiloD();
+
+ k_dcop:
+ virtual void setEnabled(bool enabled);
+ virtual void enable();
+ virtual void disable();
+ virtual bool enabled() const;
+ virtual int pollMilliSeconds() const;
+ virtual bool setPollMilliSeconds(int ms);
+
+ virtual void displayText(const QString& text);
+ virtual void displayText(const QString& text, const QPixmap& customPixmap);
+ virtual void displayProgress(const QString& text, int progress, const QPixmap& customPixmap);
+ virtual void displayProgress(const QString& text, int progress);
+
+ virtual void reconfigure();
+
+ private slots:
+ virtual void doTimer();
+
+ private:
+ QTimer _timer;
+ int _interval;
+ QPtrList<Monitor> _monitors;
+ DisplaySkin *_display;
+ KMiloInterface *_miface;
+};
+
+}
+
+#endif
diff --git a/kmilo/kmilod/kmilointerface.cpp b/kmilo/kmilod/kmilointerface.cpp
new file mode 100644
index 0000000..21a6430
--- /dev/null
+++ b/kmilo/kmilod/kmilointerface.cpp
@@ -0,0 +1,26 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "kmilointerface.h"
+#include "kmilointerface.moc"
+
diff --git a/kmilo/kmilod/kmilointerface.h b/kmilo/kmilod/kmilointerface.h
new file mode 100644
index 0000000..d1edbb9
--- /dev/null
+++ b/kmilo/kmilod/kmilointerface.h
@@ -0,0 +1,57 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _KMILOI_H_
+#define _KMILOI_H_
+
+#include <qobject.h>
+#include <qstring.h>
+#include "kmilod.h"
+
+namespace KMilo {
+
+// FIXME: make put the methods into .cpp file when the header is installed.
+class KMiloInterface : public QObject {
+ Q_OBJECT
+ public:
+ KMiloInterface(KMiloD *p) : QObject() { _p = p; }
+ virtual ~KMiloInterface() {}
+
+ public slots:
+ int pollMilliSeconds() const { return _p->pollMilliSeconds(); }
+ bool setPollMilliSeconds(int ms) { return _p->setPollMilliSeconds(ms); }
+
+ void displayText(const QString& text) { _p->displayText(text); }
+ void displayText(const QString& text, const QPixmap& customPixmap) { _p->displayText(text, customPixmap); }
+
+ void displayProgress(const QString& text, int progress, const QPixmap& customPixmap) { _p->displayProgress(text, progress, customPixmap); }
+ void displayProgress(const QString& text, int progress) { _p->displayProgress(text, progress); }
+
+ void reconfigure() { _p->reconfigure(); }
+
+ private:
+ KMiloD *_p;
+};
+
+}
+
+#endif
diff --git a/kmilo/kmilod/kmilopluginsvc.desktop b/kmilo/kmilod/kmilopluginsvc.desktop
new file mode 100644
index 0000000..bccb599
--- /dev/null
+++ b/kmilo/kmilod/kmilopluginsvc.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KMilo Plugin
+
+[PropertyDef::X-KMilo-Plugin-Author]
+Type=QString
+[PropertyDef::X-KMilo-Default-Enabled]
+Type=bool
+
diff --git a/kmilo/kmilod/monitor.cpp b/kmilo/kmilod/monitor.cpp
new file mode 100644
index 0000000..f427ce4
--- /dev/null
+++ b/kmilo/kmilod/monitor.cpp
@@ -0,0 +1,44 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "monitor.h"
+
+KMilo::Monitor::Monitor(QObject *parent, const char *name, const QStringList&)
+: QObject(parent, name) {
+ _poll = true;
+}
+
+KMilo::Monitor::~Monitor() {
+}
+
+void KMilo::Monitor::reconfigure(KConfig*)
+{
+}
+
+KMilo::Monitor::DisplayType KMilo::Monitor::poll() { return None; }
+
+int KMilo::Monitor::progress() const { return 42; }
+
+QString KMilo::Monitor::message() const { return QString::null; }
+QPixmap KMilo::Monitor::customPixmap() const { return QPixmap(); }
+bool KMilo::Monitor::init() { return true; }
+
diff --git a/kmilo/kmilod/monitor.h b/kmilo/kmilod/monitor.h
new file mode 100644
index 0000000..ee1581c
--- /dev/null
+++ b/kmilo/kmilod/monitor.h
@@ -0,0 +1,98 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _MONITOR_H_
+#define _MONITOR_H_
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qpixmap.h>
+#include <qobject.h>
+
+#include <kdemacros.h>
+
+class KConfig;
+
+namespace KMilo {
+class KMiloInterface;
+
+class KDE_EXPORT Monitor : public QObject {
+ public:
+ Monitor(QObject *parent, const char *name, const QStringList&);
+ virtual ~Monitor();
+
+ /**
+ * Called by kmilod to initialise this plugin. The plugin
+ * must return true if its hardware is present and it should
+ * be loaded. If it returns false, it will be unloaded.
+ */
+ virtual bool init();
+
+ enum DisplayType { None, //!
+ Error, //! Error
+ Volume, //! Volume level changed
+ Mute, //! Volume has been muted
+ Brightness, //! Brighteness of the screen has changed
+ Tap, //! Mousttracker tap mode has changed
+ Sleep //! laptop will sleep in progress() seconds
+ };
+
+ /**
+ * This is called by KMiloD when it polls. Must return
+ * the type of event that has occurred, or None.
+ */
+ virtual DisplayType poll();
+
+ /**
+ * If poll() returns stating that a value has changed, this
+ * will be called by kmilod to determine the value (0..100)
+ * for the slider in the display, if necessary.
+ */
+ virtual int progress() const;
+
+ /**
+ * Message displayed for DisplayType's that are not int
+ * measurable ( DisplayType::Tap for example )
+ */
+ virtual QString message() const;
+
+ /**
+ * Custom pixmap that can be displayed be the themes
+ * when displaying the DisplayType.
+ */
+ virtual QPixmap customPixmap() const;
+
+ bool shouldPoll() const { return _poll; }
+
+ virtual void reconfigure(KConfig*);
+
+ protected:
+ bool _poll; // set to false to disable polling.
+ friend class KMiloD;
+ void setInterface(KMiloInterface *i) { _interface = i; }
+
+ KMiloInterface *_interface;
+};
+
+}
+
+#endif
diff --git a/kmilo/powerbook/Makefile.am b/kmilo/powerbook/Makefile.am
new file mode 100644
index 0000000..5c3f467
--- /dev/null
+++ b/kmilo/powerbook/Makefile.am
@@ -0,0 +1,34 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_powerbook.la
+
+kmilo_powerbook_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_powerbook_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO) $(KEYBOARD_LIBS)
+kmilo_powerbook_la_SOURCES = pb_monitor.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = pb_monitor.h
+
+services_DATA = kmilo_powerbook.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_powerbook_la_SOURCES) -o $(podir)/kmilo_powerbook.pot
diff --git a/kmilo/powerbook/kmilo_powerbook.desktop b/kmilo/powerbook/kmilo_powerbook.desktop
new file mode 100644
index 0000000..842d276
--- /dev/null
+++ b/kmilo/powerbook/kmilo_powerbook.desktop
@@ -0,0 +1,105 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Apple (R) PowerBook (R) Plugin
+Name[ar]=ملحق Apple (R) PowerBook (R)ة
+Name[br]=Lugent Apple (R) PowerBook (R)
+Name[bs]=Apple (R) PowerBook (R) dodatak
+Name[ca]=Connector Apple (R) PowerBook (R)
+Name[cs]=Apple (R) PowerBook (R) modul
+Name[cy]=Ategyn Apple (R) PowerBook (R)
+Name[da]=Apple (R) PowerBook (R) plugin
+Name[el]=Πρόσθετο Apple (R) PowerBook (R)
+Name[es]=Extensión para Apple ® PowerBook ®
+Name[et]=Apple (R) PowerBook (R) plugin
+Name[eu]=Apple (R) PowerBook (R) Plugina
+Name[fa]=Apple (R) PowerBook (R) وصلۀ
+Name[fi]=Apple (R) PowerBook (R) -liitännäinen
+Name[fr]=Module externe Apple (R) PowerBook (R)
+Name[ga]=Breiseán Apple® PowerBook®
+Name[he]=תוסף למחשבי Apple (R) PowerBook (R)
+Name[hi]=एप्पल (R) पावरबुक (R) प्लगइन
+Name[hu]=Apple (R) PowerBook (R) bővítőmodul
+Name[is]=Apple (R) PowerBook (R) íforrit
+Name[it]=Plugin per Apple (R) PowerBook (R)
+Name[ja]=Apple (R) PowerBook (R) プラグイン
+Name[ka]=Apple (R) PowerBook (R) მოდული
+Name[kk]=Apple (R) PowerBook (R) модулі
+Name[km]=កម្មវិធី​ជំនួយ Apple (R) PowerBook (R)
+Name[lt]=Apple (R) PowerBook (R) priedas
+Name[mk]=Приклучок за Apple (R) PowerBook (R)
+Name[nb]=Programtillegg for Apple (R) PowerBook (R)
+Name[nds]=Apple(R) PowerBook(R)-Moduul
+Name[ne]=एप्पल (R) पावरबुक (R) प्लगइन
+Name[nl]=Apple (R) PowerBook (R)-Plugin
+Name[nn]=Tilleggsprogram for Apple ® PowerBook ®
+Name[pa]=Apple (R) PowerBook (R) ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka Apple (R) PowerBook (R)
+Name[pt]='Plugin' para Apple (R) PowerBook (R)
+Name[pt_BR]=Plug-in para Apple (R) PowerBook (R)
+Name[ro]=Modul Apple (R) PowerBook (R)
+Name[ru]=Модуль Apple® PowerBook®
+Name[sk]=Modul pre Apple (R) PowerBook (R)
+Name[sl]=Vstavek za Apple (R) PowerBook (R)
+Name[sr]=Прикључак за Apple-ов PowerBook
+Name[sr@Latn]=Priključak za Apple-ov PowerBook
+Name[sv]=Apple ® PowerBook ®-insticksprogram
+Name[ta]=ஆப்பிள் (R) பவர்புக் (R) சொருகுப்பொருள்
+Name[tg]=Модули Apple (R) PowerBook (R)
+Name[tr]=Apple (R) PowerBook (R) Eklentisi
+Name[uk]=Втулок Apple (R) PowerBook (R)
+Name[uz]=Apple (R) PowerBook (R) plagini
+Name[uz@cyrillic]=Apple (R) PowerBook (R) плагини
+Name[zh_CN]=Apple(R) PowerBook(R) 插件
+Name[zh_TW]=Apple (R) PowerBook (R) 外掛程式
+Comment=This plugin enables support for special keys on Apple (R) PowerBook (R) laptops via pbbuttonsd.
+Comment[ar]=تمكّن الدعم لمفاتيح حاسوب Apple (R) PowerBook (R) المحمول الخاصة عن طريق pbbuttonsd.
+Comment[bg]=Тази приставка позволява поддръжката на специалните клавиши на Apple (R) PowerBook (R) laptops.
+Comment[bs]=Ovaj dodatak (plugin) omogućuje podršku za posebne tipke na Apple (R) PowerBook (R) laptopima koristeći pbbuttonsd.
+Comment[ca]=Aquest connector activa el funcionament per a tecles especials dels Apple (R) PowerBooks (R) via pbbuttonsd.
+Comment[cs]=Tento modul umožňuje používat zvláštní klávesy notebooků Apple (R) PowerBook (R) přes pbbuttonsd.
+Comment[cy]=Galluoga'r ategyn yma gynhaliaeth ar gyfer bysyll arbennig ar luniaduron Apple (R) PowerBook (R) drwy pbbuttonsd.
+Comment[da]=Dette plugin aktivere støtte for specielle taster på Apple (R) PowerBook (R) bærbare via pbbuttonsd.
+Comment[de]=Dieses Plugin schaltet die Unterstützung für Sondertasten des Apple (R) Powerbooks (R) via pbbuttonsd ein.
+Comment[el]=Αυτό το πρόσθετο ενεργοποιεί την υποστήριξη για ειδικά πλήκτρα στα φορητά Apple (R) PowerBook (R) μέσω του pbbuttonsd.
+Comment[es]=Esta extensión activa el soporte de las teclas especiales en los portátiles Apple ® PowerBook ® mediante pbbuttonsd.
+Comment[et]=See plugin võimaldab pbbuttonsd vahendusel kasutada eriklahve Apple (R) PowerBook (R) sülearvutil.
+Comment[eu]=Plugin honek tekla berezientzako euskarria gaitzen du Apple (R) PowerBook (R) magalekoetan pbbuttonsd bitartez.
+Comment[fa]=این وصله، برای کلیدهای ویژۀ روی رایانه‌های کیفی Apple (R) PowerBook (R) via pbbuttonsd پشتیبانی را فعال می‌کند.
+Comment[fi]=Tänmä liitännäinen mahdollistaa tuen Apple (R) PowerBook (R) kannettavien erikoisnäppäimille pbbuttonsd-ohjelman kautta.
+Comment[fr]=Ce module active la gestion des touches spéciales des Apple (R)PowerBook (R) via pbbuttonsd.
+Comment[ga]=Tacaíonn an breiseán seo le cnaipí speisialta ar ríomhairí glúine Apple® PowerBook® trí pbbuttonsd.
+Comment[he]=התוסף הזה מאפשר תמיכה במקשים מיוחדים על מחשבים הברכיים של Apple (R) PowerBook (R)
+Comment[hi]=यह प्लगइन एपल (R) पावर-बुक (R) लैपटॉप पर pbbuttonsd के द्वारा विशिष्ट कुंजी समर्थन सक्षम करता है
+Comment[hu]=Ez a bővítőmodul lehetővé teszi az extra billentyűk használatát Apple (R) PowerBook (R) noteszgépeken (a pbbuttonsd szolgáltatáson keresztül).
+Comment[is]=Þetta íforrit gerir þér kleyft að nota sérhnappana á Apple (R) PowerBook (R) með pbbuttonsd þjóninum.
+Comment[it]=Questo plugin abilita il supporto per i tasti speciali sui portatili Apple (R) PowerBook (R) tramite pbbuttonsd.
+Comment[ja]=このプラグインは pbbuttonsd を通して Apple (R) PowerBook (R) ラップトップの特殊キーをサポートします
+Comment[ka]=.ეს მოდული რთავს Apple (R) PowerBook (R) ლეპტოპის სპეციალური კლავიშების მხარდაჭერას pbbuttonsd-ის მეშვეობით.
+Comment[kk]=Бұл модуль Apple (R) PowerBook (R) ноутбуктерінде pbbuttonsd арқылы арнаулы пернелерді қолдау үшін.
+Comment[km]=កម្មវិធី​ជំនួយនេះបើក​ការគាំទ្រ​សម្រាប់​គ្រាប់ចុច​ពិសេសនៅ​លើកុំព្យូទ័រ​យួរដៃ Apple (R) PowerBook (R) តាម​រយៈ pbbuttonsd ។
+Comment[lt]=Šis priedas įgalina specialiųjų raktų Apple (R) PowerBook (R) nešiojamuose kompiuteriuose palaikymą per pbbuttonsd.
+Comment[mk]=Овој приклучок дава поддршка за специјалните копчиња на лаптопите Apple (R) PowerBook (R) преку pbbuttonsd.
+Comment[nb]=Dette programtilleggmet muliggjør støtte for spesielle taster på Apple (R) PowerBook (R) bærbare maskiner via pbbuttonsd.
+Comment[nds]=Dit Moduul maakt de Sünnertasten-Ünnerstütten för PowerBook(R)-Klappreekners vun Apple(R) via pbbuttonsd an.
+Comment[ne]=यो प्लगइनले pbbuttonsd द्वारा एप्पल (R) पावरबुक (R) ल्यापटपका विशेष कुञ्जीका लागि समर्थन सक्षम पार्दछ ।
+Comment[nl]=Maakt het mogelijk speciale toetsen op Apple (R) PowerBook (R) laptops te gebruiken via pbbuttonsd.
+Comment[nn]=Dette programtillegget gjer at du kan bruka spesialtastane på Apple® PowerBook® gjennom pbbuttonsd.
+Comment[pl]=Ta wtyczka umożliwia obsługę klawiszy specjalnych na laptopach Apple (R) PowerBook (R) za pomocą pbbuttonsd.
+Comment[pt]=Este 'plugin' activa o suporte para as teclas especiais nos portáteis Apple (R) PowerBook (R) através do 'pbbuttonsd'.
+Comment[pt_BR]=Este plug-in habilita suporte para teclas especiais nos Apple (R) PowerBooks (R) via pbbuttonsd.
+Comment[ro]=Acest modul activează suportul pentru tastele speciale din laptop-urile Apple (R) PowerBook (R), utilizînd "pbbuttonsd".
+Comment[ru]=Этот модуль поддерживает специальные клавиши на ноутбуках Apple® PowerBook® через pbbuttonsd.
+Comment[sk]=Tento modul obsahuje podporu špeciálnych kláves pre Apple (R) PowerBook (R) pomocou pbbuttonsd.
+Comment[sl]=Ta vstavek vam omogoča podboro posebnim ključem na prenosnikih Apple (R) PowerBook (R) preko pbbuttonsd.
+Comment[sr]=Овај прикључак омогућава подршку за специјалне тастере на Apple-овим PowerBook лаптопима преко pbbuttonsd.
+Comment[sr@Latn]=Ovaj priključak omogućava podršku za specijalne tastere na Apple-ovim PowerBook laptopima preko pbbuttonsd.
+Comment[sv]=Det här insticksprogrammet aktiverar stöd för speciella tangenter för Apple ® PowerBook ® via pbbuttonsd.
+Comment[ta]=ஆப்பிள் (R) பவர்புக் (R) மடிக் கணினி மூலமாக பிபிபட்டன்எஸ்டி போன்றவைக்கு இந்த சொருகு பொருள் ஆதரிக்கிறது.
+Comment[tg]=Ин модул пуштибонии калидҳои махсусро дар компютери дастии Apple (R) PowerBook (R) ба воситаи pbbuttonsd дармегиронад.
+Comment[tr]=Bu plugin pbbuttonsd aracılığı ile Apple(R) PowerBook(R) dizüstüler için özel tuş desteğini açar.
+Comment[uk]=Цей втулок дозволяє користуватися спеціальними клавішами на лептопах Apple (R) PowerBook (R) за допомогою pbbuttonsd.
+Comment[zh_CN]=此插件启用 Apple(R) PowerBook(R) 便携电脑上的特殊按键。
+Comment[zh_TW]=這個外掛程式透過 pbbuttonsd 開啟 Apple(R) PowerBook(R) 筆記型電腦的特殊鍵支援。
+X-KDE-Library=kmilo_powerbook
diff --git a/kmilo/powerbook/pb_monitor.cpp b/kmilo/powerbook/pb_monitor.cpp
new file mode 100644
index 0000000..6279854
--- /dev/null
+++ b/kmilo/powerbook/pb_monitor.cpp
@@ -0,0 +1,127 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "pb_monitor.h"
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <kgenericfactory.h>
+
+extern "C" {
+#include <pbbipc.h>
+}
+
+namespace KMilo {
+
+PowerBookMonitor::PowerBookMonitor(QObject *parent, const char *name, const QStringList& args)
+: Monitor(parent, name, args) {
+ _serverPort = -1;
+ _clientPort = -1;
+ _progress = 0;
+}
+
+
+PowerBookMonitor::~PowerBookMonitor() {
+struct pbb_message msg;
+ if (_serverPort >= 0) {
+ msg.code = UNREGISTERCLIENT;
+ msg.value = _clientPort;
+ put_message(_serverPort, &msg);
+ }
+
+ if (_clientPort >= 0) {
+ remove_msgport(_clientPort);
+ }
+}
+
+
+bool PowerBookMonitor::init() {
+ _serverPort = find_msgport(SERVERPORTKEY);
+ if (_serverPort < 0) {
+ return false;
+ }
+
+ _clientPort = create_msgport(getpid());
+ if (_clientPort < 0) {
+ _serverPort = -1;
+ return false;
+ }
+
+ // Register
+ struct pbb_message msg;
+ msg.code = REGISTERCLIENT;
+ msg.value = _clientPort;
+ if (put_message(_serverPort, &msg) < 0) {
+ remove_msgport(_clientPort);
+ _clientPort = -1;
+ _serverPort = -1;
+ return false;
+ }
+
+return true;
+}
+
+
+Monitor::DisplayType PowerBookMonitor::poll() {
+Monitor::DisplayType rc = None;
+struct pbb_message msg;
+
+ if (_serverPort < 0 || _clientPort < 0)
+ return Error;
+
+ // Drain the queue, send the last message
+ while (0 == get_message(_clientPort, 0, &msg)) {
+ switch (msg.code) {
+ case DISPLAYVOLUME:
+ rc = Monitor::Volume;
+ _progress = msg.value;
+ break;
+ case DISPLAYMUTE:
+ rc = Monitor::Mute;
+ _progress = msg.value;
+ break;
+ case DISPLAYBRIGHTNESS:
+ rc = Monitor::Brightness;
+ _progress = msg.value*100/15;
+ break;
+ case REGFAILED:
+ case CLIENTEXIT:
+ rc = Monitor::Error;
+ break;
+ default:
+ break;
+ }
+ }
+
+return rc;
+}
+
+
+int PowerBookMonitor::progress() const {
+ return _progress;
+}
+
+};
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_powerbook, KGenericFactory<PowerBookMonitor>("kmilo_powerbook"))
+
diff --git a/kmilo/powerbook/pb_monitor.h b/kmilo/powerbook/pb_monitor.h
new file mode 100644
index 0000000..6d2736d
--- /dev/null
+++ b/kmilo/powerbook/pb_monitor.h
@@ -0,0 +1,42 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _PBMONITOR_H_
+#define _PBMONITOR_H_
+
+#include "monitor.h"
+
+class PowerBookMonitor : public KMilo::Monitor {
+ public:
+ PowerBookMonitor(QObject *parent, const char *name, const QStringList&);
+ virtual ~PowerBookMonitor();
+
+ virtual bool init();
+ virtual DisplayType poll();
+ virtual int progress() const;
+
+ private:
+ int _clientPort;
+ int _serverPort;
+ int _progress;
+};
+
+#endif
diff --git a/kmilo/powerbook2/Makefile.am b/kmilo/powerbook2/Makefile.am
new file mode 100644
index 0000000..5c3f467
--- /dev/null
+++ b/kmilo/powerbook2/Makefile.am
@@ -0,0 +1,34 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_powerbook.la
+
+kmilo_powerbook_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_powerbook_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO) $(KEYBOARD_LIBS)
+kmilo_powerbook_la_SOURCES = pb_monitor.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = pb_monitor.h
+
+services_DATA = kmilo_powerbook.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_powerbook_la_SOURCES) -o $(podir)/kmilo_powerbook.pot
diff --git a/kmilo/powerbook2/kmilo_powerbook.desktop b/kmilo/powerbook2/kmilo_powerbook.desktop
new file mode 100644
index 0000000..9aff481
--- /dev/null
+++ b/kmilo/powerbook2/kmilo_powerbook.desktop
@@ -0,0 +1,106 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Apple PowerBook Plugin
+Name[ar]=ملحق Apple PowerBook
+Name[br]=Lugent Apple PowerBook
+Name[bs]=Apple PowerBook dodatak
+Name[ca]=Connector Apple PowerBook
+Name[cs]=Apple PowerBook modul
+Name[cy]=Ategyn Apple PowerBook
+Name[el]=Πρόσθετο Apple PowerBook
+Name[es]=Extensión del PowerBook de Apple
+Name[et]=Apple PowerBooki plugin
+Name[eu]=Apple PowerBook Plugina
+Name[fa]=Apple PowerBook وصلۀ
+Name[fi]=Apple PowerBook -liitännäinen
+Name[fr]=Module externe Apple PowerBook
+Name[ga]=Breiseán Apple® PowerBook®
+Name[he]=תוסף ל-Apple PowerBook
+Name[hi]=एपल पावर-बुक प्लगइन
+Name[hu]=Apple PowerBook bővítőmodul
+Name[is]=Apple PowerBook íforrit
+Name[it]=Plugin per Apple PowerBook
+Name[ja]=Apple PowerBook プラグイン
+Name[ka]=Apple PowerBook მოდული
+Name[kk]=Apple PowerBook модулі
+Name[km]=កម្មវិធីជំនួយ Apple PowerBook
+Name[lt]=Apple PowerBook priedas
+Name[mk]=Приклучок за Apple PowerBook
+Name[ms]= Plug masuk Apple PowerBook
+Name[nb]=Programtillegg for Apple PowerBook
+Name[nds]=Apple PowerBook-Moduul
+Name[ne]=एप्पल पावरबुक प्लगइन
+Name[nl]=Apple PowerBook-plugin
+Name[nn]=Programtillegg for Apple PowerBook
+Name[pa]=Apple PowerBook ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka Apple PowerBook
+Name[pt]='Plugin' para Apple PowerBook
+Name[pt_BR]=Plug-in para Apple PowerBook
+Name[ro]=Modul Apple PowerBook
+Name[ru]=Модуль Apple PowerBook
+Name[sk]=Module pre Applet PowerBook
+Name[sl]=Vstavek za Apple PowerBook
+Name[sr]=Прикључак за Apple-ов PowerBook
+Name[sr@Latn]=Priključak za Apple-ov PowerBook
+Name[sv]=Apple PowerBook-insticksprogram
+Name[ta]=ஆப்பிள் பவர்புக் சொருகுப்பொருள்
+Name[tg]=Модули Apple PowerBook
+Name[tr]=Apple PowerBook Eklentisi
+Name[uk]=Втулок Apple PowerBook
+Name[uz]=Apple PowerBook plagini
+Name[uz@cyrillic]=Apple PowerBook плагини
+Name[zh_CN]=Apple PowerBook 插件
+Name[zh_TW]=Apple Powerbook 外掛程式
+Comment=This plugin enabled support for special keys on Apple PowerBooks via pbbuttonsd.
+Comment[ar]=تمكّن الدعم لمفاتيح حاسوب Apple PowerBook المحمول الخاصة عن طريق pbbuttonsd.
+Comment[bg]=Тази приставка позволява поддръжката на специалните клавиши на Apple PowerBooks.
+Comment[bs]=Ovaj dodatak (plugin) omogućuje podršku za posebne tipke na Apple PowerBooks laptopima koristeći pbbuttonsd.
+Comment[ca]=Aquest connector activa el funcionament per a tecles especials dels Apple PowerBooks via pbbuttonsd.
+Comment[cs]=Tento modul umožňuje používat zvláštní klávesy notebooků Apple PowerBook přes pbbuttonsd.
+Comment[cy]=Galluoga'r ategyn yma gynhaliaeth ar gyfer bysyll arbennig ar yr Apple PowerBook drwy pbbuttonsd.
+Comment[da]=Dette plugin aktivere støtte for specielle taster på Apple PowerBooks via pbbuttonsd.
+Comment[de]=Dieses Plugin schaltet die Unterstützung für Sondertasten des Apple Powerbooks via pbbuttonsd ein.
+Comment[el]=Αυτό το πρόσθετο ενεργοποιεί την υποστήριξη για ειδικά πλήκτρα στα Apple PowerBooks μέσω του pbbuttonsd.
+Comment[es]=Esta extensión activa el soporte de las teclas especiales en los PowerBooks de Apple mediante «pbbuttonsd».
+Comment[et]=See plugin võimaldab pbbuttonsd vahendusel kasutada eriklahve Apple PowerBooksil
+Comment[eu]=Plugin honek tekla berezientzako euskarria gaitu du Apple PowerBook magalekoetan pbbuttonsd bitartez.
+Comment[fa]=این وصله، برای کلیدهای ویژۀ Apple PowerBooks via pbbuttonsd، پشتیبانی را فعال می‌کند.
+Comment[fi]=Tämä sovelma mahdollisti tuen Apple Powerbook kannettavien erikoisnäppäimille pbbuttonsd-ohjelman kautta.
+Comment[fr]=Ce module active la gestion des touches spéciales des Apple PowerBook via pbbuttonsd.
+Comment[ga]=Tacaíonn an breiseán seo le cnaipí speisialta ar ríomhairí glúine Apple® PowerBook® trí pbbuttonsd.
+Comment[he]=התוסף הזה מאפשר תמיכה במקשים מיוחדים על מחשבים הברכיים של Apple PowerBook
+Comment[hi]=यह प्लगइन एपल पावर-बुक पर pbbuttonsd के द्वारा विशिष्ट कुंजी समर्थन सक्षम करता है
+Comment[hu]=Az Apple PowerBook noteszgépek speciális kezelőelemeinek beállítása (a pbbuttonsd szolgáltatáson keresztül)
+Comment[is]=Þetta íforrit gerir þér kleyft að nota sérhnappana á Apple PowerBook með pbbuttonsd þjóninum.
+Comment[it]=Questo plugin abilita il supporto per i tasti speciali sui portatili Apple PowerBook tramite pbbuttonsd.
+Comment[ja]=このプラグインは pbbuttonsd を通して Apple PowerBook の特殊キーをサポートします
+Comment[ka]= ეს მოდული რთავს Apple PowerBooks-ის სპეციალური კლავიშების მხარდაჭერას pbbuttonsd-ის მეშვეობით.
+Comment[kk]=Бұл модуль Apple PowerBook ноутбуктерінде pbbuttonsd арқылы арнаулы пернелерді қолдау үшін.
+Comment[km]=កម្មវិធី​ជំនួយ​នេះបើក​ការគាំទ្រ​សម្រាប់​គ្រាប់ចុច​ពិសេសនៅលើ Apple PowerBooks តាមរយៈ pbbuttonsd ។
+Comment[lt]=Šis priedas įgalina specialiųjų raktų Apple PowerBook nešiojamuose kompiuteriuose palaikymą per pbbuttonsd.
+Comment[mk]=Овој приклучок дава поддршка за специјалните копчиња на Apple PowerBooks преку pbbuttonsd.
+Comment[ms]=Plug masuk membolehkan sokongan untuk kekunci khas Apple PowerBooks menerusi pbbuttonsd.
+Comment[nb]=Dette programtillegget muliggjør støtte for spesille taster på Apple PowerBooks via pbbuttonsd.
+Comment[nds]=Dit Moduul maakt de Sünnertasten-Ünnerstütten för Apple-PowerBooks via pbbuttonsd an.
+Comment[ne]=यो प्लगइनले pbbuttonsd द्वारा एप्पल पावरबुक विशेष कुञ्जीका लागि समर्थन सक्षम पार्दछ ।
+Comment[nl]=Maakt het mogelijk speciale toetsen op Apple (R) PowerBook (R) laptops te gebruiken via pbbuttonsd.
+Comment[nn]=Dette programtillegget gjer at du kan bruka spesialtastane på Apple PowerBook gjennom pbbuttonsd.
+Comment[pl]=Ta wtyczka umożliwia obsługę klawiszy specjalnych na laptopach Apple PowerBook za pomocą pbbuttonsd.
+Comment[pt]=Este 'plugin' activa o suporte para as teclas especiais nos portáteis Apple PowerBook através do 'pbbuttonsd'.
+Comment[pt_BR]=Este plug-in habilita suporte para teclas especiais nos Apple PowerBooks via pbbuttonsd.
+Comment[ro]=Acest modul activează suportul pentru tastele speciale din laptop-urile Apple PowerBook, utilizînd "pbbuttonsd".
+Comment[ru]=Этот модуль поддерживает специальные клавиши на Apple PowerBooks через pbbuttonsd.
+Comment[sk]=Tento modul obsahuje podporu špeciálnych kláves pre Apple (R) PowerBook (R) pomocou pbbuttonsd.
+Comment[sl]=Ta vstavek vam omogoča podboro posebnim ključem na prenosnikih Apple PowerBook preko pbbuttonsd.
+Comment[sr]=Овај прикључак омогућава подршку за специјалне тастере на Apple-овим PowerBook-овима преко pbbuttonsd.
+Comment[sr@Latn]=Ovaj priključak omogućava podršku za specijalne tastere na Apple-ovim PowerBook-ovima preko pbbuttonsd.
+Comment[sv]=Det här insticksprogrammet aktiverar stöd för speciella tangenter för Apple PowerBook via pbbuttonsd.
+Comment[ta]=ஆப்பிள் பவர்புக்ஸ் மூலமாக பிபிபட்டன்எஸ்டிக்கு இந்த சொருகுப் பொருள் ஆதரவளிக்கிறது
+Comment[tg]=Ин модул пуштибонии калидҳои махсусро дар компютери дастии Apple PowerBooks ба воситаи pbbuttonsd дармегиронад.
+Comment[tr]=Bu plugin pbbuttonsd aracılığı ile Apple PowerBook dizüstüler için özel tuş desteğini açar.
+Comment[uk]=Цей втулок дозволив користуватися спеціальними клавішами на лептопах Apple PowerBook за допомогою pbbuttonsd.
+Comment[zh_CN]=此插件启用 Apple PowerBook 电源按钮的特殊按键支持。
+Comment[zh_TW]=這個外掛程式透過 pbbuttonsd 開啟 Apple Powerbooks 特殊鍵支援。
+X-KDE-Library=kmilo_powerbook
diff --git a/kmilo/powerbook2/pb_monitor.cpp b/kmilo/powerbook2/pb_monitor.cpp
new file mode 100644
index 0000000..84c72d5
--- /dev/null
+++ b/kmilo/powerbook2/pb_monitor.cpp
@@ -0,0 +1,165 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 Zack Rusin <staikos@kde.org>
+ Pretty much ripped of from :
+ George Staikos <staikos@kde.org> :)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include "pb_monitor.h"
+
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+extern "C" {
+//Hack because of the fact that pbb author is using C++ keywords in the code
+//among which is "template"...
+#undef template
+#include <pbb.h>
+
+// TAG_BRIGHTNESS was renamed to TAG_LCDBRIGHTNESS in pbbuttons
+// 0.6.1-2
+#ifndef TAG_LCDBRIGHTNESS
+#define TAG_LCDBRIGHTNESS TAG_BRIGHTNESS
+#endif
+}
+
+#define BUFFERLEN 200
+const QString tpmodes[] = { I18N_NOOP("No Tap"), I18N_NOOP("Tap"), I18N_NOOP("Drag"), I18N_NOOP("Lock") };
+
+namespace KMilo {
+
+PowerBookMonitor::PowerBookMonitor(QObject *parent, const char *name,
+ const QStringList& args)
+ : Monitor(parent, name, args),
+ m_progress( 0 )
+{
+ init_libpbb();
+}
+
+PowerBookMonitor::~PowerBookMonitor()
+{
+ ipc_exit();
+}
+
+
+bool PowerBookMonitor::init()
+{
+// pbbuttons 0.6.7 or newer
+#ifdef CLIENT_REGISTER
+ return ( ipc_init( "kmilo", LIBMODE_CLIENT, CLIENT_REGISTER ) == 0 );
+#else
+ return ( ipc_init( LIBMODE_CLIENT, 1 ) == 0 );
+#endif
+}
+
+
+Monitor::DisplayType PowerBookMonitor::poll()
+{
+ Monitor::DisplayType rc = None;
+ // Drain the queue, send the last message
+ struct tagitem* tag = readMessage();
+ m_message = QString::null;
+ while ( tag && tag->tag != TAG_END ) {
+ switch ( tag->tag ) {
+ case TAG_VOLUME:
+ rc = Monitor::Volume;
+ m_progress = (int)tag->data;
+ break;
+ case TAG_MUTE:
+ rc = Monitor::Mute;
+ m_progress = (int)tag->data;
+ break;
+ case TAG_LCDBRIGHTNESS:
+ rc = Monitor::Brightness;
+ m_progress = ((int)tag->data)*100/15;
+ break;
+ case TAG_TPMODE:
+ {
+ rc = Monitor::Tap;
+ QString marg = tpmodes[ tag->data & 3 ];
+ m_message = i18n( "Operating mode set to: %1." ).arg( marg );
+ }
+ break;
+ default:
+ break;
+ }
+ ++tag;
+ }
+
+ if ( m_sleep ) {
+ rc = Monitor::Sleep;
+ }
+
+ return rc;
+}
+
+
+int PowerBookMonitor::progress() const
+{
+ return m_progress;
+}
+
+QString PowerBookMonitor::message() const
+{
+ return m_message;
+}
+
+struct tagitem* PowerBookMonitor::readMessage()
+{
+ char buffer[BUFFERLEN];
+ m_sleep = false;
+ if ( (ipc_receive(buffer, BUFFERLEN)) >=0 ) {
+ if ( buffer ) {
+ struct pbbmessage *msg = reinterpret_cast<struct pbbmessage*>( buffer );
+ switch ( msg->action ) {
+ case REGFAILED:
+ kdDebug()<<"PBB registration failed"<<endl;
+ break;
+ case CLIENTEXIT:
+ kdDebug()<<"PBB client exited"<<endl;
+ break;
+ case CHANGEVALUE:
+ return msg->taglist;
+ break;
+ case WARNING:
+ if ( msg->taglist->data == 0 ) {
+ m_message = i18n( "The computer will sleep now." );
+ } else {
+ m_message = i18n( "The computer will sleep in %n second.",
+ "The computer will sleep in %n seconds.",
+ msg->taglist->data );
+ }
+ m_sleep = true;
+ kdDebug()<<"PBB Warning"<<endl;
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+}
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_powerbook, KGenericFactory<KMilo::PowerBookMonitor>("kmilo_powerbook"))
+
diff --git a/kmilo/powerbook2/pb_monitor.h b/kmilo/powerbook2/pb_monitor.h
new file mode 100644
index 0000000..a6bf651
--- /dev/null
+++ b/kmilo/powerbook2/pb_monitor.h
@@ -0,0 +1,55 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2003 Zack Rusin <staikos@kde.org>
+ Pretty much ripped of from :
+ George Staikos <staikos@kde.org> :)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _PBMONITOR_H_
+#define _PBMONITOR_H_
+
+#include "monitor.h"
+
+struct tagitem;
+
+namespace KMilo {
+
+class PowerBookMonitor : public KMilo::Monitor
+{
+public:
+ PowerBookMonitor(QObject *parent, const char *name, const QStringList&);
+ virtual ~PowerBookMonitor();
+
+ virtual bool init();
+ virtual DisplayType poll();
+ virtual int progress() const;
+ virtual QString message() const;
+
+private:
+ struct tagitem* readMessage();
+private:
+ int m_progress;
+ QString m_message;
+ bool m_sleep;
+};
+
+}
+
+#endif
diff --git a/kmilo/thinkpad/Makefile.am b/kmilo/thinkpad/Makefile.am
new file mode 100644
index 0000000..e82c26b
--- /dev/null
+++ b/kmilo/thinkpad/Makefile.am
@@ -0,0 +1,36 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+SUBDIRS = . kcmthinkpad
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_thinkpad.la
+
+kmilo_thinkpad_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_thinkpad_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO)
+kmilo_thinkpad_la_SOURCES = thinkpad.cpp
+METASOURCES = AUTO
+
+noinst_HEADERS = thinkpad.h
+
+services_DATA = kmilo_thinkpad.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_thinkpad_la_SOURCES) -o $(podir)/kmilo_thinkpad.pot
diff --git a/kmilo/thinkpad/README b/kmilo/thinkpad/README
new file mode 100644
index 0000000..56b5da0
--- /dev/null
+++ b/kmilo/thinkpad/README
@@ -0,0 +1,61 @@
+Thinkpad Buttons KMilo Plugin
+
+Jonathan Riddell jr@jriddell.org, January 2004
+
+A port of tpb ( http://www.nongnu.org/tpb/ ) to KMilo.
+
+KMilo is a service for kded, the KDE daemon. KMilo is new to KDE 3.2.
+It allows plugins which interact with the special buttons found on
+some keyboards and laptops.
+
+This KMilo plugin reads the nvram used in IBM Thinkpads. You need the
+Linux nvram module ('insmod nvram') and to create a device node
+('mknod /dev/nvram c 10 144').
+
+Thinkpad R30/R31 models do not have a hardware volume control and so
+require software volume control. Other models need software volume
+control only if you want a volume change step different from the
+builtin value (14). This required write access to nvram ('chmod 666
+/dev/nvram') and could potentially damage the machine.
+
+A KControl Centre module is included to configure the values including
+whether this service is run or not (by default it is not).
+
+INSTALL:
+
+Download kdeutils source for kde 3.2 or newer. Then compile as
+usual starting from the kdeutils directory:
+
+ make -f Makefile.cvs
+ ./configure
+ cd kmilo
+ make
+ sudo make install
+
+Restarting kded is probably needed:
+
+ kdekillall kded
+ kded
+
+HISTORY:
+
+05 January 2004, Initial release, most things working
+
+21 January 2004, Bug fix, stop it crashing if starting without kmix
+ runningdisplay rounded min and max volume levels, pda icon for
+ KControl module
+
+24 January 2004, Stopped it start kmix on kded startup even when set not to run
+
+28 January 2004, Added to KDE CVS
+
+TODO:
+
+ - Need a better icon for the KControl module
+ - Test on machines other than my R31, which only has volume,
+ brightness buttons, light and 'Thinkpad' buttons
+ - Add options for the 'Thinkpad' and other action buttons to do something (e.g. bring up Konqueror)
+ For this sort of thing we really want integration with KHotKeys but I'm not sure how
+
+
+
diff --git a/kmilo/thinkpad/kcmthinkpad/Makefile.am b/kmilo/thinkpad/kcmthinkpad/Makefile.am
new file mode 100644
index 0000000..4e70c40
--- /dev/null
+++ b/kmilo/thinkpad/kcmthinkpad/Makefile.am
@@ -0,0 +1,15 @@
+kde_module_LTLIBRARIES = kcm_thinkpad.la
+
+kcm_thinkpad_la_SOURCES = kcmthinkpad_general.ui main.cpp
+
+kcm_thinkpad_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kcm_thinkpad_la_LIBADD = $(LIB_KIO)
+
+INCLUDES= $(all_includes) -DKDE_BINDIR="\"$(bindir)\""
+
+kcm_thinkpad_la_METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kcmthinkpad.pot
+
+xdg_apps_DATA = thinkpad.desktop
diff --git a/kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui b/kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui
new file mode 100644
index 0000000..771b7bf
--- /dev/null
+++ b/kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui
@@ -0,0 +1,307 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KCMThinkpadGeneral</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KCMThinkpadGeneral</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>559</width>
+ <height>548</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KVaio: General Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>tlOff</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Could not read /dev/nvram. If you have an IBM Thinkpad load the nvram Linux module &lt;em&gt;insmod nvram&lt;/em&gt; and create the node &lt;em&gt;mknod /dev/nvram c 10 144&lt;/em&gt; then make the device readable &lt;em&gt;chmod 664 /dev/nvram&lt;/em&gt; or writable &lt;em&gt;chmod 666 /dev/nvram&lt;/em&gt;.&lt;p&gt; nvram must be writable for software volume control required for R30/R31 models and for using a custom volume change step.</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>bgGeneral</cstring>
+ </property>
+ <property name="title">
+ <string>Thinkpad Button Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>mCbRun</cstring>
+ </property>
+ <property name="text">
+ <string>Run Thinkpad Buttons KMilo plugin</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>mCbSoftwareVolume</cstring>
+ </property>
+ <property name="text">
+ <string>Change volume in software (required by R30/R31)</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout27</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel2_5</cstring>
+ </property>
+ <property name="text">
+ <string>Command for Mail button:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel2_6</cstring>
+ </property>
+ <property name="text">
+ <string>Command for FN-Zoom button:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>commandExecHome</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>Command for Search button:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>commandExec</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>volumeStepLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Volume step (out of 100):</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="5" column="1">
+ <property name="name">
+ <cstring>commandExecZoom</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Command for Home button:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>mSpinboxVolumeStep</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>30</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="3" column="1">
+ <property name="name">
+ <cstring>commandExecSearch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Command for Thinkpad button:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="4" column="1">
+ <property name="name">
+ <cstring>commandExecMail</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>mCbRun</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mCbSoftwareVolume</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mSpinboxVolumeStep</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>commandExec</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>commandExecHome</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>commandExecMail</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>commandExecSearch</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>commandExecZoom</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KCMThinkpadGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>mCbRun</tabstop>
+ <tabstop>mCbSoftwareVolume</tabstop>
+ <tabstop>mSpinboxVolumeStep</tabstop>
+ <tabstop>commandExec</tabstop>
+ <tabstop>commandExecHome</tabstop>
+ <tabstop>commandExecSearch</tabstop>
+ <tabstop>commandExecMail</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">kcmthinkpad_general.ui.h</include>
+</includes>
+<signals>
+ <signal>changed();</signal>
+</signals>
+<slots>
+ <slot>slotChanged()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui.h b/kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui.h
new file mode 100644
index 0000000..6ccc675
--- /dev/null
+++ b/kmilo/thinkpad/kcmthinkpad/kcmthinkpad_general.ui.h
@@ -0,0 +1,36 @@
+/*
+ * kcmthinkpad_general.uih
+ *
+ * Copyright (C) 2004 Jonathan Riddell <jr@jriddell.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <kdialog.h>
+
+void KCMThinkpadGeneral::slotChanged() {
+ emit(changed());
+}
+
+
+
diff --git a/kmilo/thinkpad/kcmthinkpad/main.cpp b/kmilo/thinkpad/kcmthinkpad/main.cpp
new file mode 100644
index 0000000..1b8b4bd
--- /dev/null
+++ b/kmilo/thinkpad/kcmthinkpad/main.cpp
@@ -0,0 +1,189 @@
+/*
+ * main.cpp
+ *
+ * Copyright (C) 2004 Jonathan Riddell <jr@jriddell.org>
+ *
+ * Based on kcm_kvaio
+ * Copyright (C) 2003 Mirko Boehm (mirko@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <qfile.h>
+#include <qbuttongroup.h>
+
+#include <dcopclient.h>
+#include <kgenericfactory.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kurlrequester.h>
+#include <kcmodule.h>
+
+#ifdef Q_OS_FREEBSD
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+
+#include "kcmthinkpad_general.h"
+
+#include <dcopclient.h>
+
+#include "main.h"
+#include "main.moc"
+
+typedef KGenericFactory<KCMThinkpadModule, QWidget> KCMThinkpadModuleFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_thinkpad, KCMThinkpadModuleFactory("kcmthinkpad"))
+
+#define CONFIG_FILE "kmilodrc"
+
+KCMThinkpadModule::KCMThinkpadModule(QWidget* parent, const char* name, const QStringList&)
+ : KCModule(KCMThinkpadModuleFactory::instance(), parent, name) {
+ KAboutData* about =
+ new KAboutData(I18N_NOOP("kcmthinkpad"),
+ I18N_NOOP("KDE Control Module for IBM Thinkpad "
+ "Laptop Hardware"),
+ 0, 0, KAboutData::License_GPL,
+ "(c) 2004 Jonathan Riddell");
+
+ about->addAuthor("Jonathan Riddell",
+ I18N_NOOP("Original author"),
+ "jr@jriddell.org");
+ setAboutData( about );
+
+ QVBoxLayout* layout = new QVBoxLayout(this);
+ m_KCMThinkpadGeneral = new KCMThinkpadGeneral(this);
+ layout->addWidget( m_KCMThinkpadGeneral );
+ layout->addStretch();
+
+ load();
+
+ //try and open /dev/nvram
+ m_nvramReadable = false;
+ m_nvramWriteable = false;
+
+#ifdef Q_OS_FREEBSD
+ // Look if the sysctl tree of acpi_ibm is in place
+ u_int n = 0;
+ size_t len = sizeof(n);
+ if (m_nvramReadable = ( sysctlbyname("dev.acpi_ibm.0.volume", &n, &len, NULL, 0) != -1 ))
+ m_nvramWriteable = ( sysctlbyname("dev.acpi_ibm.0.volume", NULL, NULL, &n, len) != -1 );
+
+ if (!m_nvramReadable) {
+ setButtons(buttons() & ~Default);
+ m_KCMThinkpadGeneral->bgGeneral->setEnabled(false);
+ m_KCMThinkpadGeneral->tlOff->setText(i18n("In order to use the Thinkpad Buttons KMilo Plugin, "
+ "you have to load the acpi_ibm(4) driver."));
+ } else if (!m_nvramWriteable) {
+ m_KCMThinkpadGeneral->tlOff->setText(i18n("Could not write to dev.acpi_ibm.0.volume. "
+ "Using software volume, required for "
+ "R30/R31 models, or using a custom volume "
+ "change step is disabled."));
+#else
+ QFile nvramFile(m_nvramFile);
+ if ( nvramFile.open(IO_ReadOnly) ) {
+ m_nvramReadable = true;
+ nvramFile.close();
+ }
+ if ( nvramFile.open(IO_WriteOnly) ) {
+ m_nvramWriteable = true;
+ nvramFile.close();
+ }
+
+ if (!m_nvramReadable) {
+ setButtons(buttons() & ~Default);
+ m_KCMThinkpadGeneral->bgGeneral->setEnabled(false);
+ } else if (!m_nvramWriteable) {
+ m_KCMThinkpadGeneral->tlOff->setText(i18n("Could not write to %1. "
+ "To use the software volume, required for "
+ "R30/R31 models and to use a custom volume "
+ "change step, set the nvram device to world "
+ "writeable: <em>chmod 666 "
+ "/dev/nvram</em>").arg(m_nvramFile));
+#endif
+ } else {
+ m_KCMThinkpadGeneral->tlOff->setText(i18n("Thinkpad Buttons KMilo Plugin Ready For Configuration"));
+ }
+
+ connect( m_KCMThinkpadGeneral, SIGNAL(changed()), SLOT(changed()));
+
+}
+
+void KCMThinkpadModule::save() {
+ if (!m_nvramReadable) {
+ return;
+ }
+ DCOPClient client;
+
+ KConfig config(CONFIG_FILE);
+ config.setGroup("thinkpad");
+
+ config.writeEntry("run", m_KCMThinkpadGeneral->mCbRun->isChecked());
+ config.writeEntry("softwareVolume", m_KCMThinkpadGeneral->mCbSoftwareVolume->isChecked());
+ config.writeEntry("volumeStep", m_KCMThinkpadGeneral->mSpinboxVolumeStep->value());
+ config.writeEntry("buttonThinkpad", m_KCMThinkpadGeneral->commandExec->url());
+ config.writeEntry("buttonHome", m_KCMThinkpadGeneral->commandExecHome->url());
+ config.writeEntry("buttonSearch", m_KCMThinkpadGeneral->commandExecSearch->url());
+ config.writeEntry("buttonMail", m_KCMThinkpadGeneral->commandExecMail->url());
+ config.writeEntry("buttonZoom", m_KCMThinkpadGeneral->commandExecZoom->url());
+ config.sync();
+
+ if (client.attach()) {
+ QByteArray data, replyData;
+ QCString replyType;
+
+ if (!client.call("kded", "kmilod", "reconfigure()", data, replyType, replyData)) {
+ kdDebug() << "KCMThinkpad::showTextMsg: "
+ << "there was an error using DCOP on kmilod::reconfigure()." << endl;
+ }
+ } else {
+ kdDebug() << "KCMThinkpadModule: cannot attach to DCOP server, "
+ << "no automatic config update." << endl;
+ }
+}
+
+void KCMThinkpadModule::load() {
+ load( false );
+}
+
+void KCMThinkpadModule::load(bool useDefaults) {
+ KConfig config(CONFIG_FILE);
+
+ config.setReadDefaults( useDefaults );
+
+ config.setGroup("thinkpad");
+
+ m_KCMThinkpadGeneral->mCbRun->setChecked(config.readBoolEntry("run", false));
+ m_KCMThinkpadGeneral->mCbSoftwareVolume->setChecked(config.readBoolEntry("softwareVolume", true));
+ m_KCMThinkpadGeneral->mSpinboxVolumeStep->setValue(config.readNumEntry("volumeStep", 14));
+ m_KCMThinkpadGeneral->commandExec->setURL(config.readEntry("buttonThinkpad", KDE_BINDIR "/konsole"));
+ m_KCMThinkpadGeneral->commandExecHome->setURL(config.readEntry("buttonHome", KDE_BINDIR "/konqueror"));
+ m_KCMThinkpadGeneral->commandExecSearch->setURL(config.readEntry("buttonSearch", KDE_BINDIR "/kfind"));
+ m_KCMThinkpadGeneral->commandExecMail->setURL(config.readEntry("buttonMail", KDE_BINDIR "/kmail"));
+ m_KCMThinkpadGeneral->commandExecZoom->setURL(config.readEntry("buttonZoom", KDE_BINDIR "/ksnapshot"));
+ m_nvramFile = config.readEntry("nvram", "/dev/nvram");
+
+ emit changed( useDefaults );
+}
+
+void KCMThinkpadModule::defaults() {
+ load( true );
+}
+
diff --git a/kmilo/thinkpad/kcmthinkpad/main.h b/kmilo/thinkpad/kcmthinkpad/main.h
new file mode 100644
index 0000000..53534ed
--- /dev/null
+++ b/kmilo/thinkpad/kcmthinkpad/main.h
@@ -0,0 +1,49 @@
+/*
+ * main.h
+ *
+ * Copyright (C) 2004 Jonathan Riddell <jr@jriddell.org>
+ *
+ * Based on kcm_kvaio
+ * Copyright (C) 2003 Mirko Boehm (mirko@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KCMTHINKPAD_MAIN_H
+#define KCMTHINKPAD_MAIN_H
+
+#include <kcmodule.h>
+
+class KCMThinkPadGeneral;
+
+class KCMThinkpadModule : public KCModule {
+ Q_OBJECT
+
+ public:
+ KCMThinkpadModule(QWidget* parent, const char* name, const QStringList&);
+
+ void save();
+ void load();
+ void load(bool useDefaults);
+ void defaults();
+ private:
+ KCMThinkpadGeneral* m_KCMThinkpadGeneral;
+ QString m_nvramFile;
+ bool m_nvramReadable;
+ bool m_nvramWriteable;
+};
+
+#endif
diff --git a/kmilo/thinkpad/kcmthinkpad/thinkpad.desktop b/kmilo/thinkpad/kcmthinkpad/thinkpad.desktop
new file mode 100644
index 0000000..720a69f
--- /dev/null
+++ b/kmilo/thinkpad/kcmthinkpad/thinkpad.desktop
@@ -0,0 +1,145 @@
+[Desktop Entry]
+Type=Application
+Exec=kcmshell thinkpad
+Icon=laptop
+DocPath=kcontrol/thinkpad/index.html
+
+X-KDE-Library=thinkpad
+X-KDE-ParentApp=kcontrol
+
+Name=IBM Thinkpad Laptop
+Name[ar]=حاسوب IBM Thinkpad المحمول
+Name[bg]=Лаптоп IBM Thinkpad
+Name[br]=Hezoug IBM Thinkpad
+Name[bs]=IBM Thinkpad laptop
+Name[ca]=Portàtil IBM Thinkpad
+Name[cy]=Gliniadur IBM Thinkpad
+Name[da]=IBM Thinkpad bærbar
+Name[de]=IBM Thinkpad Notebook
+Name[el]=Φορητός υπολογιστής IBM Thinkpad
+Name[es]=Portátil IBM Thinkpad
+Name[et]=IBM Thinkpadi sülearvuti
+Name[eu]=IBM Thinkpad Magalekoa
+Name[fa]=IBM Thinkpad رایانۀ کیفی
+Name[fi]=IBM Thinkpad -kannettava
+Name[fr]=Portable Thinkpad d'IBM
+Name[ga]=Ríomhaire Glúine IBM Thinkpad
+Name[he]=מחשב ברכיים מסוג IBM Thinkpad
+Name[hu]=IBM Thinkpad noteszgép
+Name[is]=IBM ferðavél
+Name[it]=Portatile IBM Thinkpad
+Name[ja]=IBM シンクパッド ラップトップ
+Name[kk]=IBM Thinkpad ноутбугі
+Name[km]=កុំព្យូទ័រ​យួរដៃ IBM Thinkpad
+Name[mk]=Лаптоп IBM Thinkpad
+Name[nb]=IBM Thinkpad Bærbar PC
+Name[nds]=IBM Thinkpad-Klappreekner
+Name[ne]=IBM थिङ्कप्याड ल्यापटप
+Name[nn]=IBM Thinkpad-bærbar
+Name[pa]=IBM Thinkpad ਲੈਪਟਾਪ
+Name[pl]=Laptop IBM Thinkpad
+Name[pt]=Portátil IBM Thinkpad
+Name[pt_BR]=Laptop IBM Thinkpad
+Name[ro]=Laptop IBM Thinkpad
+Name[ru]=Ноутбук IBM Thinkpad
+Name[sk]=IBM Thinkpad
+Name[sl]=Prenosnik IBM Thinkpad
+Name[sr]=IBM-ов Thinkpad лаптоп
+Name[sr@Latn]=IBM-ov Thinkpad laptop
+Name[sv]=IBM Thinkpad bärbar dator
+Name[ta]=ஐபிஎம் திங்க்பாட் மடிக்கணினி
+Name[tr]=IBM Thinkpad Dizüstü
+Name[uk]=Лептоп IBM Thinkpad
+Name[uz]=IBM Thinkpad laptopi
+Name[uz@cyrillic]=IBM Thinkpad лаптопи
+Name[zh_CN]=ThinkPad 便携电脑
+Name[zh_TW]=IBM Thinkpad 筆記型電腦
+Comment=Configure the KDE Interface to the IBM Thinkpad Special Controls
+Comment[ar]=إعداد واجهة كدى لمُتَحكّمات IBM Thinkpad الخاصة
+Comment[bg]=Настройване на IBM Thinkpad
+Comment[bs]=Podesite KDE interfejs za IBM Thinkpad posebne kontrole
+Comment[ca]=Configura la interfície entre KDE i els controls especials de IBM Thinkpad
+Comment[cs]=Nastavení KDE rozhraní ovládání notebooků IBM Thinkpad
+Comment[cy]=Ffurfweddu'r Rhyngwyneb KDE i'r Rheolau Arbennig IBM Thinkpad
+Comment[da]=Indstil KDE's grænseflade til IBM Thinkpads specielle kontroller
+Comment[de]=KDE Schnittstelle zu den Sonderfunktionen von IBM Thinkpads einrichten
+Comment[el]=Ρυθμίστε το περιβάλλον χρήσης του KDE για τα ειδικά χειριστήρια του IBM Thinkpad
+Comment[es]=Configurar la interfaz de KDE para los controles especiales del IBM Thinkpad
+Comment[et]=KDE liides IBM Thinkpadi eriklahvide seadistamiseks
+Comment[eu]=IBM Thinkpad-en Aginte Berezientzako KDE Interfazea Konfiguratu
+Comment[fa]=پیکربندی واسط KDEدر کلیدهای مهار ویژۀ IBM Thinkpad
+Comment[fi]=Aseta KDE:n liityntää IBM Thinkpadin ohjelmoitavalle keskeytysajurille
+Comment[fr]=Configuration de l'interface KDE pour le paramètrage des Thinkpad d'IBM
+Comment[ga]=Cumraigh comhéadan KDE do Rialtáin Speisialta IBM Thinkpad
+Comment[he]=הגדר את המנשק של KDE להתאים למקשים המיוחדים של IBM Thinkpad
+Comment[hu]=Az IBM Thinkpad noteszgépek speciális kezelőelemeinek beállítása
+Comment[is]=Stilla viðmót KDE á IBM Thinkpad stýringuna
+Comment[it]=Configura l'interfaccia KDE ai controlli speciali dei Thinkpad IBM
+Comment[ja]=IBM シンクパッド特殊コントロールの KDE インターフェースを設定
+Comment[ka]= KDE ინტერფეისის IBM Thinkpad-ის სპეციალური კონტროლებისთვის კონფიგურაცია
+Comment[kk]=IBM Thinkpad арнаулы тетіктерінің KDE интерфейсін баптау
+Comment[km]=កំណត់​រចនា​សម្ព័ន្ធ​ចំណុច​ប្រទាក់ KDE ទៅ​ការត្រួតពិនិត្យ IBM Thinkpad ពិសេស
+Comment[lt]=IBM Thinkpad ypatingiems valdymo moduliams KDE sąsaja
+Comment[mk]=Го конфигурира интерфејсот на KDE за спец. контроли на IBM Thinkpad
+Comment[nb]=Sett opp KDE-grensesnitt til IBM Thinkpad spesial kontroller
+Comment[nds]=KDE-Koppelsteedinstellen för de IBM Thinkpad-Sünnerfunkschonenkuntrull
+Comment[ne]=IBM थिङ्कप्याड विशेष नियन्त्रणका लागि KDE इन्टरफेस कन्फिगर गर्नुहोस्
+Comment[nl]=Voor het instellen van KDE's communicatie met de IBM Thinkpad Special Controls
+Comment[nn]=Set opp KDE-grensesnittet til spesialfunksjonar på IBM Thinkpad
+Comment[pa]=IBM ਥਿੰਕਪੈਂਡ ਕੰਟਰੋਲਾਂ ਲਈ KDE ਇੰਟਰਫੇਸ ਸੰਰਚਨਾ
+Comment[pl]=Konfiguracja specjalnych funkcji IBM Thinkpad
+Comment[pt]=Configurar a Interface para o KDE dos Comandos Especiais do IBM Thinkpad
+Comment[pt_BR]=Configura a Interface do KDE para os Controles Especiais do IBM Thinkpad
+Comment[ro]=Configurează interfaţa KDE către laptop-uri IBM Thinkpad
+Comment[ru]=Настройка интерфейса KDE для специальных клавиш ноутбука IBM Thinkpad
+Comment[sk]=Nastavenie rozhrania KDE k špeciálnym ovládacím prvkom notebooku IBM Thinkpad
+Comment[sl]=Nastavite vmesnik KDE za posebne kontrole IBM Thinkpada
+Comment[sr]=Подесите KDE-ов интерфејс за посебне контроле IBM-ових Thinkpad-ова
+Comment[sr@Latn]=Podesite KDE-ov interfejs za posebne kontrole IBM-ovih Thinkpad-ova
+Comment[sv]=Anpassa KDE:s gränssnitt till IBM Thinkpads specialstyrning
+Comment[ta]=ஐபிஎம் திங்க்பேட் விசேஷ கட்டுப்பாட்டிற்கு கேடிஇ இடைமுகத்தை வடிவமை
+Comment[tr]=KDE Arayüzünü Sony IBM Thinkpad Özel Denetimlerine Ayarla
+Comment[uk]=Налаштування інтерфейсу KDE до спеціальних функцій IBM Thinkpad
+Comment[zh_CN]=配置 KDE 界面使用 ThinkPad 特殊控制
+Comment[zh_TW]=設定 IBM Thinkpad 特殊控制的 KDE 介面
+Keywords=IBM, Thinkpad, brightness, mute, Jog Dial
+Keywords[bs]=IBM, Thinkpad, brightness, mute, Jog Dial, svjetlost
+Keywords[ca]=IBM, Thinkpad, brillantor, silenci, Jog Dial
+Keywords[cs]=IBM,Thinkpad,jas,ztlumení,Jog Dial
+Keywords[cy]=IBM,Thinkpad,gloywder, mud, Jog Dial
+Keywords[da]=IBM. Thinkpad, lysstyrke, stum, Jog Dial
+Keywords[de]=IBM, Thinkpad, Helligkeit, Abschalten, Jog Dial
+Keywords[el]=IBM, Thinkpad, φωτεινότητα, κλείσιμο ήχου, Jog Dial
+Keywords[es]=IBM, Thinkpad, brillo, mute, Jog Dial
+Keywords[et]=IDM, Thinkpad, heledus, tumm, Jog Dial
+Keywords[eu]=IBM, Thinkpad, distira, mutu, Jog Dial
+Keywords[fa]=IBM، Thinkpad، روشنایی، بدون صدا، Jog Dial
+Keywords[fi]=IBM, Thinkpad, kirkkaus, vaimenna, Jog Dial
+Keywords[fr]=IBM, Thinkpad, luminosité, sourdine, mute, Jog Dial
+Keywords[ga]=IBM, Thinkpad, gile, gan fuaim, Jog Dial
+Keywords[hu]=IBM,Thinkpad,fényerő,elnémítás,tárcsagomb
+Keywords[it]=IBM,Thinkpad,luminosità,muto,Jog Dial
+Keywords[ja]=IBM, シンクパッド, 明るさ, ミュート, ジョグダイアル
+Keywords[mk]=IBM, Thinkpad, brightness, mute, Jog Dial, осветленост, пригушување
+Keywords[nb]=IBM, Thinkpad, lysstyrke, dempet, Jog Dial
+Keywords[nds]=IBM, Thinkpad, Helligkeit, stumm, Jog Dial
+Keywords[ne]=IBM, थिङ्कप्याड, चम्किलोपना, चुप लाग्नु, जोग डायल
+Keywords[nl]=IBM, Thinkpad, brightness, mute, Jog Dial, Helderheid, dempen
+Keywords[nn]=IBM,Thinkpad,lysstyrke,demping,snurrehjul
+Keywords[pa]=IBM, Thinkpad, brightness, mute, Jog Dial, ਲੈਪਟਾਪ
+Keywords[pl]=IBM, Thinkpad, jasność, wycisz, Jog Dial
+Keywords[pt]=IBM, Thinkpad, brilho, sem som, Jog Dial
+Keywords[pt_BR]=IBM,Thinkpad,brilho, mudo, Jog Dial
+Keywords[ro]=IBM,Thinkpad,strălucire,fără sunet,jog dial
+Keywords[ru]=IBM, Thinkpad, brightness, mute, Jog Dial, яркость, звук
+Keywords[sk]=IBM, Thinkpad,jas,potichu
+Keywords[sl]=IBM, Thinkpad, svetlost, tiho, Jog Dial
+Keywords[sr]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, светлина
+Keywords[sr@Latn]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, svetlina
+Keywords[sv]=IBM, Thinkpad, ljusstyrka, tyst, rullhjul
+Keywords[ta]=ஐபிஎம், திங்க்பேட்,ஒளித்தன்மை,ஓசையற்ற,ஜோக் டையல்
+Keywords[tr]=IBM, Thinkpad, parlaklık, sessiz, gösterme itmesi
+Keywords[uk]=IBM, Thinkpad, яскравість, вимкнення звуку, Jog Dial
+Keywords[zh_CN]=IBM, Lenovo, Thinkpad, brightness, mute, Jog Dial,亮度,静音,联想,导航键
+
+Categories=Qt;KDE;X-KDE-settings-system;
diff --git a/kmilo/thinkpad/kmilo_thinkpad.desktop b/kmilo/thinkpad/kmilo_thinkpad.desktop
new file mode 100644
index 0000000..1d957c4
--- /dev/null
+++ b/kmilo/thinkpad/kmilo_thinkpad.desktop
@@ -0,0 +1,101 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Thinkpad Plugin
+Name[ar]=ملحق Thinkpad
+Name[br]=Lugent Thinkpad
+Name[bs]=Thinkpad dodatak
+Name[ca]=Connector Thinkpad
+Name[cs]=Thinkpad modul
+Name[cy]=Ategyn Thinkpad
+Name[de]=Thinkpad-Plugin
+Name[el]=Πρόσθετο Thinkpad
+Name[eo]=Thinkpad-kromaĵo
+Name[es]=Extensión para Thinkpad
+Name[et]=Thinkpadi plugin
+Name[eu]=Thikpad Plugina
+Name[fa]=Thinkpad وصلۀ
+Name[fi]=Thinkpad-liitännäinen
+Name[fr]=Module externe pour les Thinkpad
+Name[ga]=Breiseán Thinkpad
+Name[he]=תוסף ל-Thinkpad
+Name[hu]=Thinkpad bővítőmodul
+Name[is]=Thinkpad íforrit
+Name[it]=Plugin Thinkpad
+Name[ja]=シンクパッド プラグイン
+Name[ka]=Thinkpad-ის მოდული
+Name[kk]=Thinkpad модулі
+Name[km]=កម្មវិធី​ជំនួយ Thinkpad Plugin
+Name[lt]=Thinkpad priedas
+Name[mk]=Приклучок за Thinkpad
+Name[nb]=Thinkpad tilleggs program
+Name[nds]=Thinkpad-Moduul
+Name[ne]=थिङ्कप्याड प्लगइन
+Name[nn]=Programtillegg for Thinkpad
+Name[pa]=Thinkpad ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka Thinkpad
+Name[pt]='Plugin' para Thinkpad
+Name[pt_BR]=Plugin do Thinkpad
+Name[ro]=Modul Thinkpad
+Name[ru]=Модуль Thinkpad
+Name[sk]=Modul pre Thinkpad
+Name[sl]=Vstavek za Thinkpad
+Name[sr]=Прикључак за Thinkpad
+Name[sr@Latn]=Priključak za Thinkpad
+Name[sv]=Thinkpad-insticksprogram
+Name[ta]=திங்க்பேட் செருகி
+Name[tr]=Thinkpad Eklentisi
+Name[uk]=Втулок Thinkpad
+Name[uz]=Thinkpad plagini
+Name[uz@cyrillic]=Thinkpad плагини
+Name[zh_CN]=Thinkpad 插件
+Name[zh_TW]=Thinkpad 外掛程式
+Comment=Enables support for special Thinkpad keys
+Comment[ar]=تمكّن الدعم لمفاتيح Thinkpad الخاصة
+Comment[bg]=Тази приставка позволява поддръжката на специалните клавиши на IBM Thinkpad
+Comment[bs]=Omogućuje podršku za posebne tipke na Thinkpadu
+Comment[ca]=Habilita el funcionament per a tecles especials de Thinkpad
+Comment[cs]=Umožňuje podporu speciálních kláves Thinkpadu
+Comment[cy]=Yn galluogi cynhaliaeth ar gyfer bysyll arbennig Thinkpad
+Comment[da]=Aktiverer støtte for specielle Thinkpad taster
+Comment[de]=Dieses Plugin aktiviert die Unterstützung für Sondertasten von Thinkpad-Tastaturen
+Comment[el]=Ενεργοποιεί την υποστήριξη για ειδικά πλήκτρα του Thinkpad
+Comment[es]=Activa el soporte de las teclas especiales del Thinkpad
+Comment[et]=See plugin võimaldab kasutada Thinkpadi eriklahve.
+Comment[eu]=Thinkpad-en tekla berezientzako euskarria gaitzen du
+Comment[fa]=فعال‌سازی پشتیبانی برای کلیدهای ویژۀ Thinkpad .
+Comment[fi]=Tämä liitännäinen mahdollistaa erikoisnäppäinten tuen IBM Thinkpad kannettaville tietokoneille.
+Comment[fr]=Ce module active la gestion des touches spéciales des Thinkpad.
+Comment[ga]=Tacaigh le heochracha speisialta Thinkpad
+Comment[he]=מאפשר תמיכה במקשים מיוחדים של Thinkpad
+Comment[hu]=Ez a bővítőmodul lehetővé teszi az IBM Thinkpad noteszgépek speciális billentyűinek használatát
+Comment[is]=Virkjar stuðning fyrir sérhnappa Thinkpad véla
+Comment[it]=Abilita il supporto per i tasti speciali Thinkpad
+Comment[ja]=シンクパッドの特殊キーをサポートします
+Comment[ka]=რთავს Thinkpad-ის სპეციალური კლავიშების მხარდაჭერას
+Comment[kk]=Thinkpad-тың арнаулы пернелерін қолдауы
+Comment[km]=បើក​ការគាំទ្រ​សម្រាប់​គ្រាប់ចុច Thinkpad ពិសេស
+Comment[lt]=įgalina ypatingų Thinkpad raktų paramą
+Comment[mk]=Овозможува поддршка за спец. копчиња на Thinkpad
+Comment[nb]=Dette programtillegget muliggjør støtte for spesielle taster på alle tastatur og bærbare maskiner
+Comment[nds]=Maakt de Sünnertasten-Ünnerstütten för Thinkpads an
+Comment[ne]=विशेष थिङ्कप्याड कुञ्जीका लागि समर्थन सक्षम पार्दछ
+Comment[nl]=Activeert de ondersteuning voor spciale Thinkpad-toetsen
+Comment[nn]=Dette programtillegget gjer det mogleg å bruka spesialtastar på Thinkpad
+Comment[pl]=Włącza obsługę specjalnych klawiszy Thinkpada
+Comment[pt]=Activa o suporte a teclas especiais do Thinkpad
+Comment[pt_BR]=Habilita suporte para teclas especiais no Thinkpad
+Comment[ro]=Activează suportul pentru tastele speciale Thinkpad
+Comment[ru]=Этот модуль поддерживает специальные клавиши Thinkpad
+Comment[sk]=Zapína podporu pre špeciálne klávesy notebookov Thinkpad
+Comment[sl]=Omogoči podporo posebnim tipkam Thinkpada
+Comment[sr]=Подршку за посебне Thinkpad-ове тастере
+Comment[sr@Latn]=Podršku za posebne Thinkpad-ove tastere
+Comment[sv]=Aktiverar stöd för speciella Thinkpad-tangenter
+Comment[ta]=விசேஷ திங்க்பேட் விசைகளுக்கான ஆதரவை செயல்படுத்துகிறது
+Comment[tr]=Özel Thinkpad tuşları için desteği etkinleştirir
+Comment[uk]=Уможливлює підтримку спеціальних клавіш для Thinkpad.
+Comment[zh_CN]=此插件启用各种键盘和便携电脑的特殊按键
+Comment[zh_TW]=開啟特殊 Thinkpad 按鍵支援
+X-KDE-Library=kmilo_thinkpad
diff --git a/kmilo/thinkpad/thinkpad.cpp b/kmilo/thinkpad/thinkpad.cpp
new file mode 100644
index 0000000..74770cf
--- /dev/null
+++ b/kmilo/thinkpad/thinkpad.cpp
@@ -0,0 +1,556 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2004 Jonathan Riddell <jr@jriddell.org>
+
+ Based on Demo kmilo service by George Staikos
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ And tpb by Markus Braun
+ Copyright (C) 2002,2003 Markus Braun <markus.braun@krawel.de>
+
+ FreeBSD support by Markus Brueffer
+ Copyright (C) 2005 Markus Brueffer <markus@FreeBSD.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+
+#include <kgenericfactory.h>
+#include <kconfig.h>
+#include <krun.h>
+#include <kurl.h>
+#include "kmilointerface.h"
+
+#ifdef Q_OS_FREEBSD
+#include <sys/sysctl.h>
+#endif
+
+#include "thinkpad.h"
+
+namespace KMilo {
+
+ThinkPadMonitor::ThinkPadMonitor(QObject* parent, const char* name, const QStringList& args): Monitor(parent, name, args) {
+ m_progress = 0;
+ m_volume = 50; //set in retrieveVolume()
+}
+
+ThinkPadMonitor::~ThinkPadMonitor() {
+}
+
+bool ThinkPadMonitor::init() {
+
+ KConfig config("kmilodrc");
+ reconfigure(&config);
+
+ if (m_run) {
+ clearStruct(thinkpad_state);
+ clearStruct(last_thinkpad_state);
+ if ( getNvramState(&thinkpad_state) == false ) {
+ return false;
+ }
+
+ if (m_softwareVolume || m_volumeStep != defaultVolumeStep) {
+ kmixClient = new DCOPRef("kmix", "Mixer0");
+ kmixWindow = new DCOPRef("kmix", "kmix-mainwindow#1");
+ retrieveVolume();
+ setNvramVolume();
+ }
+ }
+
+ return m_run;
+}
+
+Monitor::DisplayType ThinkPadMonitor::poll() {
+
+ // save last state and get new one
+ memcpy(&last_thinkpad_state, &thinkpad_state, sizeof(thinkpad_state_struct));
+ getNvramState(&thinkpad_state);
+
+ Monitor::DisplayType pollResult = None;
+
+ // determine the state of the mute button
+ if (thinkpad_state.mute_toggle != last_thinkpad_state.mute_toggle ||
+ (thinkpad_state.volume_toggle != last_thinkpad_state.volume_toggle
+ && last_thinkpad_state.mute_toggle == 1)) {
+
+ showToggleMessage(i18n("Mute on"), i18n("Mute off"), thinkpad_state.mute_toggle == 1);
+ if (m_softwareVolume || m_volumeStep != defaultVolumeStep) {
+ kmixClient->send("setMasterMute", thinkpad_state.mute_toggle == 1);
+ }
+ }
+
+ // determine the state of the Thinkpad button
+ if (thinkpad_state.thinkpad_toggle != last_thinkpad_state.thinkpad_toggle &&
+ thinkpad_state.hibernate_toggle == last_thinkpad_state.hibernate_toggle) {
+ _interface->displayText(i18n("Thinkpad Button Pressed"));
+
+ KURL url(m_buttonThinkpad);
+ (void) new KRun(url, 0, true, true);
+ }
+
+ // determine the state of ThinkLight
+ if (thinkpad_state.thinklight_toggle != last_thinkpad_state.thinklight_toggle) {
+ showToggleMessage(i18n("ThinkLight is on"), i18n("ThinkLight is off"), thinkpad_state.thinklight_toggle == 1);
+ }
+
+ // determine the state of the volume buttons
+ if (thinkpad_state.volume_level != last_thinkpad_state.volume_level) {
+
+ pollResult = Volume;
+
+ if (m_volumeStep == defaultVolumeStep && m_softwareVolume == false) {
+ //no need to write to nvram or set volume in software
+ m_progress = thinkpad_state.volume_level * 100 / defaultVolumeStep;
+ } else {
+ if (thinkpad_state.volume_level > last_thinkpad_state.volume_level) {
+ m_progress = m_volume + m_volumeStep;
+ } else {
+ m_progress = m_volume - m_volumeStep;
+ }
+ setVolume(m_progress);
+ }
+
+ }
+
+ // determine the state of the brightness buttons
+ if (thinkpad_state.brightness_level != last_thinkpad_state.brightness_level) {
+ pollResult = Brightness;
+ m_progress = thinkpad_state.brightness_level * 100 / 7;
+ }
+
+ // Buttons below here are untested because they do not exist on my R31
+
+ // determine the state of zoom
+ if (thinkpad_state.zoom_toggle != last_thinkpad_state.zoom_toggle) {
+ // showToggleMessage(i18n("Zoom is on"), i18n("Zoom is off"), thinkpad_state.zoom_toggle == 1);
+
+ // Use as button since an Zooming is implemented
+ _interface->displayText(i18n("Zoom button pressed"));
+
+ KURL url(m_buttonZoom);
+ (void) new KRun(url, 0, true, true);
+ }
+
+ // determine the state of the home button
+ if (thinkpad_state.home_toggle != last_thinkpad_state.home_toggle &&
+ thinkpad_state.hibernate_toggle == last_thinkpad_state.hibernate_toggle) {
+ _interface->displayText(i18n("Home button pressed"));
+ KURL url(m_buttonHome);
+ (void) new KRun(url, 0, true, true);
+ }
+
+ // determine the state of the search button
+ if (thinkpad_state.search_toggle != last_thinkpad_state.search_toggle &&
+ thinkpad_state.hibernate_toggle == last_thinkpad_state.hibernate_toggle) {
+ _interface->displayText(i18n("Search button pressed"));
+ KURL url(m_buttonSearch);
+ (void) new KRun(url, 0, true, true);
+ }
+
+ // determine the state of the mail button
+ if (thinkpad_state.mail_toggle != last_thinkpad_state.mail_toggle &&
+ thinkpad_state.hibernate_toggle == last_thinkpad_state.hibernate_toggle) {
+ _interface->displayText(i18n("Mail button pressed"));
+ KURL url(m_buttonMail);
+ (void) new KRun(url, 0, true, true);
+ }
+
+ // determine the state of display
+ if (thinkpad_state.display_toggle != last_thinkpad_state.display_toggle &&
+ thinkpad_state.hibernate_toggle == last_thinkpad_state.hibernate_toggle) {
+
+ // Some thinkpads have no hardware support to switch lcd/crt. They also
+ // don't reflect the current state in thinkpad_state.display_state. So, if
+ // thinkpad_state.display_toggle changes, but thinkpad_state.display_state does
+ // not change, simulate the display state.
+
+ unsigned int display_state = 1;
+ if (thinkpad_state.display_state == last_thinkpad_state.display_state) {
+ display_state = display_state % 3 + 1;
+ } else {
+ display_state = thinkpad_state.display_state;
+ }
+
+ switch (display_state & 0x03) {
+ case 0x1:
+ _interface->displayText(i18n("Display changed: LCD on, CRT off"));
+ break;
+
+ case 0x2:
+ _interface->displayText(i18n("Display changed: LCD off, CRT on"));
+ break;
+
+ case 0x3:
+ _interface->displayText(i18n("Display changed: LCD on, CRT on"));
+ break;
+ }
+ }
+
+ // determine the state of hv expansion
+ if (thinkpad_state.expand_toggle != last_thinkpad_state.expand_toggle) {
+ showToggleMessage(i18n("HV Expansion is on"), i18n("HV Expansion is off"), (thinkpad_state.expand_toggle & 0x01) == 1);
+ }
+
+ // determine power management mode AC
+ if (thinkpad_state.powermgt_ac != last_thinkpad_state.powermgt_ac) {
+ switch(thinkpad_state.powermgt_ac) {
+ case 0x4:
+ _interface->displayText(i18n("Power management mode AC changed: PM AC high"));
+ break;
+
+ case 0x2:
+ _interface->displayText(i18n("Power management mode AC changed: PM AC auto"));
+ break;
+
+ case 0x1:
+ _interface->displayText(i18n("Power management mode AC changed: PM AC manual"));
+ break;
+
+ default:
+ _interface->displayText(i18n("Power management mode AC changed: PM AC unknown"));
+ break;
+ }
+ }
+
+ // determine power management mode battery
+ if (thinkpad_state.powermgt_battery != last_thinkpad_state.powermgt_battery) {
+ switch(thinkpad_state.powermgt_battery) {
+ case 0x4:
+ _interface->displayText(i18n("Power management mode battery changed: PM battery high"));
+ break;
+
+ case 0x2:
+ _interface->displayText(i18n("Power management mode battery changed: PM battery auto"));
+ break;
+
+ case 0x1:
+ _interface->displayText(i18n("Power management mode battery changed: PM battery manual"));
+ break;
+
+ default:
+ _interface->displayText(i18n("Power management mode battery changed: PM battery unknown"));
+ break;
+ }
+ }
+
+ // determine the state of wireless lan
+ if (thinkpad_state.wireless_toggle != last_thinkpad_state.wireless_toggle) {
+ showToggleMessage(i18n("Wireless LAN is enabled"), i18n("Wireless LAN is disabled"), thinkpad_state.wireless_toggle == 1);
+ }
+
+ // determine the state of bluetooth
+ if (thinkpad_state.bluetooth_toggle != last_thinkpad_state.bluetooth_toggle) {
+ showToggleMessage(i18n("Bluetooth is enabled"), i18n("Bluetooth is disabled"), thinkpad_state.bluetooth_toggle == 1);
+ }
+
+ return pollResult;
+}
+
+
+int ThinkPadMonitor::progress() const {
+ return m_progress;
+}
+
+QString ThinkPadMonitor::message() const {
+ //unused
+ //return i18n("yer maw!");
+ return "";
+}
+
+bool ThinkPadMonitor::getNvramState(thinkpad_state_struct* thinkpad_state) {
+#ifndef Q_OS_FREEBSD
+ int file;
+ unsigned char buffer[114];
+
+ // open nvram for reading
+ // must use open/close because seek is not supported by nvram
+ if ((file=open(m_nvramFile.latin1(), O_RDONLY|O_NONBLOCK)) == -1) {
+ kdError() << "Unable to open device: " << m_nvramFile << endl;
+ return false;
+ }
+
+ // read nvram
+ if (read(file, buffer, sizeof(buffer)) != sizeof(buffer)) {
+ kdError() << "Unable to read from device: " << m_nvramFile << endl;
+ return false;
+ }
+
+ // close nvram device
+ if (close(file) == -1) {
+ kdError() << "Unable to close device %s: " << m_nvramFile << endl;
+ return false;
+ }
+
+ thinkpad_state->thinkpad_toggle
+ = (thinkpad_state->thinkpad_toggle & ~0x01) | (( buffer[0x57] & 0x08) >> 3);
+ thinkpad_state->zoom_toggle
+ = (thinkpad_state->zoom_toggle & ~0x01) | ((~buffer[0x57] & 0x20) >> 5);
+ thinkpad_state->display_toggle
+ = (thinkpad_state->display_toggle & ~0x01) | (( buffer[0x57] & 0x40) >> 6);
+ thinkpad_state->home_toggle
+ = (thinkpad_state->home_toggle & ~0x01) | (( buffer[0x56] & 0x01) );
+ thinkpad_state->search_toggle
+ = (thinkpad_state->search_toggle & ~0x01) | (( buffer[0x56] & 0x02) >> 1);
+ thinkpad_state->mail_toggle
+ = (thinkpad_state->mail_toggle & ~0x01) | (( buffer[0x56] & 0x04) >> 2);
+ thinkpad_state->thinklight_toggle
+ = (thinkpad_state->thinklight_toggle & ~0x01) | (( buffer[0x58] & 0x10) >> 4);
+ thinkpad_state->hibernate_toggle
+ = (thinkpad_state->hibernate_toggle & ~0x01) | (( buffer[0x58] & 0x01) );
+ thinkpad_state->display_state
+ = (( buffer[0x59] & 0x03) );
+ thinkpad_state->expand_toggle
+ = (thinkpad_state->expand_toggle & ~0x01) | (( buffer[0x59] & 0x10) >> 4);
+ thinkpad_state->brightness_level
+ = (( buffer[0x5E] & 0x07) );
+ thinkpad_state->brightness_toggle
+ = (thinkpad_state->brightness_toggle & ~0x01) | (( buffer[0x5E] & 0x20) >> 5);
+ thinkpad_state->volume_level
+ = (( buffer[0x60] & 0x0f) );
+ thinkpad_state->volume_toggle
+ = (thinkpad_state->volume_toggle & ~0x01) | (( buffer[0x60] & 0x80) >> 7);
+ thinkpad_state->mute_toggle
+ = (thinkpad_state->mute_toggle & ~0x01) | (( buffer[0x60] & 0x40) >> 6);
+ thinkpad_state->powermgt_ac
+ = (( buffer[0x39] & 0x07) );
+ thinkpad_state->powermgt_battery
+ = (( buffer[0x39] & 0x38) >> 3);
+#else
+ u_int n = 0;
+ size_t len = sizeof(n);
+
+ if ( sysctlbyname("dev.acpi_ibm.0.hotkey", &n, &len, NULL, 0) == -1 ) {
+ kdError() << "Unable to read sysctl: dev.acpi_ibm.0.hotkey" << endl;
+ return false;
+ }
+
+ thinkpad_state->thinkpad_toggle
+ = (thinkpad_state->thinkpad_toggle & ~0x01) | (( n & (1<<3)) >> 3);
+ thinkpad_state->zoom_toggle
+ = (thinkpad_state->zoom_toggle & ~0x01) | (( n & (1<<4)) >> 4);
+ thinkpad_state->display_toggle
+ = (thinkpad_state->display_toggle & ~0x01) | (( n & (1<<6)) >> 6);
+ thinkpad_state->home_toggle
+ = (thinkpad_state->home_toggle & ~0x01) | (( n & (1<<0)) );
+ thinkpad_state->search_toggle
+ = (thinkpad_state->search_toggle & ~0x01) | (( n & (1<<1)) >> 1);
+ thinkpad_state->mail_toggle
+ = (thinkpad_state->mail_toggle & ~0x01) | (( n & (1<<2)) >> 2);
+ thinkpad_state->hibernate_toggle
+ = (thinkpad_state->hibernate_toggle & ~0x01) | (( n & (1<<7)) >> 7);
+ thinkpad_state->expand_toggle
+ = (thinkpad_state->expand_toggle & ~0x01) | (( n & (1<<9)) >> 9);
+ thinkpad_state->brightness_toggle
+ = (thinkpad_state->brightness_toggle & ~0x01) | (( n & (1<<10)) >> 10);
+ thinkpad_state->volume_toggle
+ = (thinkpad_state->volume_toggle & ~0x01) | (( n & (1<<11)) >> 11);
+
+ // Don't fail if the thinklight sysctl is not present. It is generated dynamically
+ if ( sysctlbyname("dev.acpi_ibm.0.thinklight", &n, &len, NULL, 0) != -1 )
+ thinkpad_state->thinklight_toggle = n;
+ else
+ kdWarning() << "Unable to read sysctl: dev.acpi_ibm.0.thinklight" << endl;
+
+ if ( sysctlbyname("dev.acpi_ibm.0.lcd_brightness", &n, &len, NULL, 0) == -1 ) {
+ kdError() << "Unable to read sysctl: dev.acpi_ibm.0.lcd_brightness" << endl;
+ return false;
+ }
+ thinkpad_state->brightness_level = n;
+
+ if ( sysctlbyname("dev.acpi_ibm.0.volume", &n, &len, NULL, 0) == -1 ) {
+ kdError() << "Unable to read sysctl: dev.acpi_ibm.0.volume" << endl;
+ return false;
+ }
+ thinkpad_state->volume_level = n;
+
+ if ( sysctlbyname("dev.acpi_ibm.0.mute", &n, &len, NULL, 0) == -1 ) {
+ kdError() << "Unable to read sysctl: dev.acpi_ibm.0.mute" << endl;
+ return false;
+ }
+ thinkpad_state->mute_toggle = n;
+
+ // Don't fail if wlan or bluetooth sysctls are not present. They are generated dynamically
+ if ( sysctlbyname("dev.acpi_ibm.0.wlan", &n, &len, NULL, 0) != -1 )
+ thinkpad_state->wireless_toggle = n;
+ else
+ kdWarning() << "Unable to read sysctl: dev.acpi_ibm.0.wlan" << endl;
+
+ if ( sysctlbyname("dev.acpi_ibm.0.bluetooth", &n, &len, NULL, 0) != -1 )
+ thinkpad_state->bluetooth_toggle = n;
+ else
+ kdWarning() << "Unable to read sysctl: dev.acpi_ibm.0.bluetooth" << endl;
+#endif
+ return true;
+}
+
+void ThinkPadMonitor::clearStruct(thinkpad_state_struct& thinkpad_state) {
+ thinkpad_state.thinkpad_toggle = 0;
+ thinkpad_state.zoom_toggle = 0;
+ thinkpad_state.display_toggle = 0;
+ thinkpad_state.home_toggle = 0;
+ thinkpad_state.search_toggle = 0;
+ thinkpad_state.mail_toggle = 0;
+ thinkpad_state.favorites_toggle = 0;
+ thinkpad_state.reload_toggle = 0;
+ thinkpad_state.abort_toggle = 0;
+ thinkpad_state.backward_toggle = 0;
+ thinkpad_state.forward_toggle = 0;
+ thinkpad_state.fn_toggle = 0;
+ thinkpad_state.thinklight_toggle = 0;
+ thinkpad_state.hibernate_toggle = 0;
+ thinkpad_state.display_state = 0;
+ thinkpad_state.expand_toggle = 0;
+ thinkpad_state.brightness_level = 0;
+ thinkpad_state.brightness_toggle = 0;
+ thinkpad_state.volume_level = 0;
+ thinkpad_state.volume_toggle = 0;
+ thinkpad_state.mute_toggle = 0;
+ thinkpad_state.ac_state = 0;
+ thinkpad_state.powermgt_ac = 0;
+ thinkpad_state.powermgt_battery = 0;
+ thinkpad_state.wireless_toggle = 0;
+ thinkpad_state.bluetooth_toggle = 0;
+}
+
+void ThinkPadMonitor::showToggleMessage(QString onMessage, QString offMessage, bool state) {
+ QString message;
+ if (state) {
+ message = onMessage;
+ } else {
+ message = offMessage;
+ }
+ _interface->displayText(message);
+}
+
+void ThinkPadMonitor::reconfigure(KConfig* config) {
+ config->setGroup("thinkpad");
+
+ m_nvramFile = config->readEntry("nvram", "/dev/nvram");
+ m_softwareVolume = config->readBoolEntry("softwareVolume", true);
+ m_run = config->readBoolEntry("run", false);
+ m_volumeStep = config->readNumEntry("volumeStep", defaultVolumeStep);
+ m_buttonThinkpad = config->readEntry("buttonThinkpad", "/usr/bin/konsole");
+ m_buttonHome = config->readEntry("buttonHome", "/usr/bin/konqueror");
+ m_buttonSearch = config->readEntry("buttonSearch", "/usr/bin/kfind");
+ m_buttonMail = config->readEntry("buttonMail", "/usr/bin/kmail");
+ m_buttonZoom = config->readEntry("buttonZoom", "/usr/bin/ksnapshot");
+}
+
+bool ThinkPadMonitor::retrieveVolume() {
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call("masterVolume");
+ if (reply.isValid()) {
+ m_volume = reply;
+ } else {
+ kmix_error = true;
+ }
+
+ if (kmix_error) { // maybe the error occurred because kmix wasn't running
+ if (kapp->startServiceByDesktopName("kmix")==0) { // trying to start kmix
+ // trying again
+ reply = kmixClient->call("masterVolume");
+ if (reply.isValid()) {
+ m_volume = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ }
+ }
+
+ if (kmix_error) {
+ kdError() << "KMilo: ThinkPadMonitor could not access kmix/Mixer0 via dcop" << endl;
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void ThinkPadMonitor::setVolume(int volume) {
+ if (!retrieveVolume()) {
+ return;
+ }
+
+ if (volume > 100) {
+ m_volume = 100;
+ } else if (volume < 0) {
+ m_volume = 0;
+ } else {
+ m_volume = volume;
+ }
+ kmixClient->send("setMasterVolume", m_volume);
+
+ //write back to nvram but only if volume steps is not default
+ if (m_volumeStep != defaultVolumeStep) {
+ setNvramVolume();
+ }
+ m_progress = m_volume;
+}
+
+void ThinkPadMonitor::setNvramVolume() {
+#ifndef Q_OS_FREEBSD
+ int file;
+ char buffer;
+
+ //open nvram
+ if ((file = open(m_nvramFile.latin1(), O_RDWR|O_NONBLOCK)) == -1) {
+ kdError() << "Unable to open device " << m_nvramFile << endl;
+ return;
+ }
+
+ // jump to volume section
+ if (lseek(file, 0x60, SEEK_SET) == -1 ) {
+ kdError() << "Unable to seek device " << m_nvramFile << endl;
+ return;
+ }
+
+ // read nvram
+ if (read(file, &buffer, sizeof(buffer)) != sizeof(buffer)) {
+ kdError() << "Unable to read from device " << m_nvramFile << endl;
+ return;
+ }
+
+ // set volume_level to the value we write back to nvram
+ // taken from tpb, unfortunatly I'm not sure why it works
+ thinkpad_state.volume_level = 0x07;
+ buffer &= 0xf0;
+ buffer |= thinkpad_state.volume_level;
+
+ // jump to volume section
+ if (lseek(file, 0x60, SEEK_SET) == -1 ) {
+ kdError() << "Unable to seek device " << m_nvramFile << endl;
+ return;
+ }
+
+ // write std value for volume
+ if (write(file, &buffer, sizeof(buffer)) != sizeof(buffer)) {
+ kdError() << "Unable to write to device " << m_nvramFile << endl;
+ return;
+ }
+
+ close(file);
+#else
+ u_int n = thinkpad_state.volume_level;
+
+ if (sysctlbyname("dev.acpi_ibm.0.volume", NULL, NULL, &n, sizeof(n)))
+ kdError() << "Unable to write sysctl: dev.acpi_ibm.0.volume" << endl;
+#endif
+}
+
+}
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_thinkpad, KGenericFactory<KMilo::ThinkPadMonitor>("kmilo_thinkpad"))
diff --git a/kmilo/thinkpad/thinkpad.h b/kmilo/thinkpad/thinkpad.h
new file mode 100644
index 0000000..f195b2e
--- /dev/null
+++ b/kmilo/thinkpad/thinkpad.h
@@ -0,0 +1,208 @@
+/*
+ This file is part of the KDE project
+
+ Copyright (c) 2004 Jonathan Riddell <jr@jriddell.org>
+
+ Based on Demo kmilo service by George Staikos
+ Copyright (c) 2003 George Staikos <staikos@kde.org>
+
+ And tpb by Markus Braun http://www.nongnu.org/tpb/
+ Copyright (C) 2002,2003 Markus Braun <markus.braun@krawel.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+*/
+#ifndef _THINKPAD_H_
+#define _THINKPAD_H_
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <kapplication.h>
+#include <dcopref.h>
+
+#include "monitor.h"
+
+namespace KMilo {
+
+
+const int defaultVolumeStep = 14;
+
+// all nvram toggle values are stored in bit 0
+// all xevents toggle values are stored in bit 1
+// xevent and apm toggles are not used, kept for compatibility with tpb
+typedef struct {
+ unsigned int thinkpad_toggle; // ThinkPad button
+ unsigned int zoom_toggle; // zoom toggle
+ unsigned int display_toggle; // display toggle
+ unsigned int home_toggle; // Home button
+ unsigned int search_toggle; // Search button
+ unsigned int mail_toggle; // Mail button
+ unsigned int favorites_toggle; // Favorites button (xevent)
+ unsigned int reload_toggle; // Reload button (xevent)
+ unsigned int abort_toggle; // Abort button (xevent)
+ unsigned int backward_toggle; // Backward button (xevent)
+ unsigned int forward_toggle; // Forward button (xevent)
+ unsigned int fn_toggle; // Fn button (xevent)
+ unsigned int thinklight_toggle; // ThinkLight
+ unsigned int hibernate_toggle; // hibernation/suspend toggle
+ unsigned int display_state; // display state
+ unsigned int expand_toggle; // hv expansion state
+ unsigned int brightness_level; // brightness level
+ unsigned int brightness_toggle; // brightness toggle
+ unsigned int volume_level; // volume level
+ unsigned int volume_toggle; // volume toggle
+ unsigned int mute_toggle; // mute toggle
+ unsigned int ac_state; // ac connected (apm)
+ unsigned int powermgt_ac; // power management mode ac
+ unsigned int powermgt_battery; // power management mode battery
+ unsigned int wireless_toggle; // wireless lan toggle
+ unsigned int bluetooth_toggle; // bluetooth toggle
+} thinkpad_state_struct;
+
+/**
+ * KMilo plugin for IBM Thinkpads
+ * Requires read access of nvram: insmod nvram; mknod /dev/nvram c 10 144; chmod 664 /dev/nvram
+ *
+ * Models R31 and R30 do not have hardware mixers, other models
+ * probably want a smaller volume change than thinkpad's default, for
+ * this you need write access to nvram: chmod 666 /dev/nvram
+ */
+class ThinkPadMonitor : public Monitor {
+ public:
+ ThinkPadMonitor(QObject *parent, const char *name, const QStringList&);
+ virtual ~ThinkPadMonitor();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Loads configuration, clears struct, sets volume if necessary.
+ */
+ virtual bool init();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Called by KMilo, this checks the nvram and acts on any changes
+ */
+ virtual DisplayType poll();
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Called by KMilo if poll() returns a volume or brightness change.
+ * Returns the new volume or brightness percentage.
+ */
+ virtual int progress() const;
+
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Not used, we just set the message ourselves using _interface->displayText()
+ */
+ virtual QString message() const;
+ protected:
+ /**
+ * Reimplemented from KMilo::Monitor.
+ * Loads configuration from kmilorc
+ */
+ virtual void reconfigure(KConfig*);
+ private:
+ /**
+ * get the current state from the nvram
+ */
+ bool getNvramState(thinkpad_state_struct* thinkpad_state);
+
+ /**
+ * get the current state from the nvram
+ */
+ void setNvramVolume();
+
+ /**
+ * set all values of thinkpad_state to zero
+ */
+ void clearStruct(thinkpad_state_struct& thinkpad_state);
+
+ /**
+ * Displays paramater message followed by 'on' or
+ * 'off' depending on state
+ */
+ void showToggleMessage(QString onMessage, QString offMessage, bool state);
+
+ /**
+ * Returned by progress()
+ */
+ int m_progress;
+
+ /**
+ * The file to read data from, default is /dev/nvram
+ */
+ QString m_nvramFile;
+
+ /**
+ * Some thinkpads change volume in hardware, others we
+ * have to do it ourselves
+ */
+ bool m_softwareVolume;
+
+ /**
+ * Config variable determines if this kmilo service is run or not
+ */
+ bool m_run;
+
+ /**
+ * Amount to change volume by each time, default is 14
+ * (as builtin to thinkpads)
+ */
+ int m_volumeStep;
+
+ /**
+ * Thinkpad button
+ */
+ QString m_buttonThinkpad;
+
+ /**
+ * Home button
+ */
+ QString m_buttonHome;
+
+ /**
+ * Search button
+ */
+ QString m_buttonSearch;
+
+ /**
+ * Mail button
+ */
+ QString m_buttonMail;
+
+ /**
+ * Zoom button
+ */
+ QString m_buttonZoom;
+
+ /**
+ * Used for changing the volume if m_softwareVolume is true
+ */
+ void setVolume(int volume);
+ DCOPRef* kmixClient;
+ DCOPRef* kmixWindow;
+ bool retrieveVolume();
+ int m_volume, m_oldVolume;
+
+ thinkpad_state_struct thinkpad_state;
+ thinkpad_state_struct last_thinkpad_state;
+};
+
+} //close namespace
+
+#endif