• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeutils
  • Sitemap
  • Contact Us
 

kmilo

thinkpad.h

Go to the documentation of this file.
00001 /*
00002    This file is part of the KDE project
00003 
00004    Copyright (c) 2004 Jonathan Riddell <jr@jriddell.org>
00005 
00006    Based on Demo kmilo service by George Staikos
00007    Copyright (c) 2003 George Staikos <staikos@kde.org>
00008 
00009    And tpb by Markus Braun http://www.nongnu.org/tpb/
00010    Copyright (C) 2002,2003 Markus Braun <markus.braun@krawel.de>
00011 
00012    This library is free software; you can redistribute it and/or
00013    modify it under the terms of the GNU Library General Public
00014    License as published by the Free Software Foundation; either
00015    version 2 of the License, or (at your option) any later version.
00016 
00017    This library is distributed in the hope that it will be useful,
00018    but WITHOUT ANY WARRANTY; without even the implied warranty of
00019    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020    Library General Public License for more details.
00021 
00022    You should have received a copy of the GNU Library General Public License
00023    along with this library; see the file COPYING.LIB.  If not, write to
00024    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00025    Boston, MA 02110-1301, USA.
00026 
00027 */
00028 #ifndef _THINKPAD_H_
00029 #define _THINKPAD_H_
00030 
00031 #include <fcntl.h>
00032 #include <unistd.h>
00033 
00034 #include <kapplication.h>
00035 
00036 #include "monitor.h"
00037 
00038 class QDBusInterface;
00039 namespace KMilo {
00040 
00041 const int defaultVolumeStep = 14;
00042 
00043 // all nvram toggle values are stored in bit 0
00044 // all xevents toggle values are stored in bit 1
00045 // xevent and apm toggles are not used, kept for compatibility with tpb
00046 typedef struct {
00047     unsigned int thinkpad_toggle;     // ThinkPad button
00048     unsigned int zoom_toggle;         // zoom toggle
00049     unsigned int display_toggle;      // display toggle
00050     unsigned int home_toggle;         // Home button
00051     unsigned int search_toggle;       // Search button
00052     unsigned int mail_toggle;         // Mail button
00053     unsigned int favorites_toggle;    // Favorites button (xevent)
00054     unsigned int reload_toggle;       // Reload button (xevent)
00055     unsigned int abort_toggle;        // Abort button (xevent)
00056     unsigned int backward_toggle;     // Backward button (xevent)
00057     unsigned int forward_toggle;      // Forward button (xevent)
00058     unsigned int fn_toggle;           // Fn button (xevent)
00059     unsigned int thinklight_toggle;   // ThinkLight
00060     unsigned int hibernate_toggle;    // hibernation/suspend toggle
00061     unsigned int display_state;       // display state
00062     unsigned int expand_toggle;       // hv expansion state
00063     unsigned int brightness_level;    // brightness level
00064     unsigned int brightness_toggle;   // brightness toggle
00065     unsigned int volume_level;        // volume level
00066     unsigned int volume_toggle;       // volume toggle
00067     unsigned int mute_toggle;         // mute toggle
00068     unsigned int ac_state;            // ac connected (apm)
00069     unsigned int powermgt_ac;         // power management mode ac
00070     unsigned int powermgt_battery;    // power management mode battery
00071     unsigned int wireless_toggle;     // wireless lan toggle
00072     unsigned int bluetooth_toggle;    // bluetooth toggle
00073 } thinkpad_state_struct;
00074 
00083 class ThinkPadMonitor: public KMilo::Monitor {
00084     public:
00085         ThinkPadMonitor(QObject *parent, const QVariantList&);
00086         virtual ~ThinkPadMonitor();
00087 
00092         virtual bool init();
00093 
00098         virtual DisplayType poll();
00099 
00105         virtual int progress() const;
00106 
00111         virtual QString message() const;
00112     protected:
00117         virtual void reconfigure(KConfig*);
00118     private:
00122         bool getNvramState(thinkpad_state_struct* thinkpad_state);
00123 
00127         void setNvramVolume();
00128 
00132         void clearStruct(thinkpad_state_struct& thinkpad_state);
00133 
00138         void showToggleMessage(QString onMessage, QString offMessage, bool state);
00139 
00143         int m_progress;
00144 
00148         QString m_nvramFile;
00149 
00154         bool m_softwareVolume;
00155 
00159         bool m_run;
00160 
00165         int m_volumeStep;
00166 
00170         QString m_buttonThinkpad;
00171 
00175         QString m_buttonHome;
00176 
00180         QString m_buttonSearch;
00181 
00185         QString m_buttonMail;
00186 
00190         QString m_buttonZoom;
00191 
00195         void setVolume(int volume);
00196         bool retrieveVolume();
00197         int m_volume, m_oldVolume;
00198 
00199         thinkpad_state_struct thinkpad_state;
00200         thinkpad_state_struct last_thinkpad_state;
00201                 QDBusInterface *kmixAdaptor;
00202                 QDBusInterface *kmixWindowAdaptor;
00203 };
00204 
00205 }
00206 
00207 #endif

kmilo

Skip menu "kmilo"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal