diff options
Diffstat (limited to 'kmilo/kmilo_kvaio/kcmkvaio')
-rw-r--r-- | kmilo/kmilo_kvaio/kcmkvaio/Makefile.am | 15 | ||||
-rw-r--r-- | kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui | 273 | ||||
-rw-r--r-- | kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h | 15 | ||||
-rw-r--r-- | kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop | 146 | ||||
-rw-r--r-- | kmilo/kmilo_kvaio/kcmkvaio/main.cpp | 176 | ||||
-rw-r--r-- | kmilo/kmilo_kvaio/kcmkvaio/main.h | 53 |
6 files changed, 678 insertions, 0 deletions
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 <i>Sony Programmable Interrupt Controller</i>. If this is a Sony Vaio Laptop, make sure the <b>sonypi</b> 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 |