-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 34 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.h | 21 |
2 files changed, 35 insertions, 20 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 5b73e59..0068d88 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp @@ -37,51 +37,77 @@ /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> /* OPIE */ #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> /* STD */ #include <fcntl.h> #include <math.h> #include <stdlib.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/time.h> #include <unistd.h> #ifndef QT_NO_SOUND #include <linux/soundcard.h> #endif -const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; +namespace Opie { +namespace Core { -using namespace Opie::Core; +static const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; + + +/* STATIC and common implementation */ +/* EXPORT */ ODistribution distributions[] = { + { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, + { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, + { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, + { System_Unknown, "Linux", "/etc/issue" }, +}; + + +/* EXPORT */ bool isQWS(){ + return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; +} + +/* EXPORT */ QCString makeChannel ( const char *str ){ + if ( str && !::strchr ( str, '/' )) + return QCString ( "QPE/Application/" ) + str; + else + return str; +} + + + +/* Now the default implementation of ODevice */ struct default_button default_buttons [] = { { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), "devicebuttons/z_calendar", "datebook", "nextView()", "today", "raise()" }, { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), "devicebuttons/z_contact", "addressbook", "raise()", "addressbook", "beamBusinessCard()" }, { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), "devicebuttons/z_home", "QPE/Launcher", "home()", "buttonsettings", "raise()" }, { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), "devicebuttons/z_menu", "QPE/TaskBar", "toggleMenu()", "QPE/TaskBar", "toggleStartMenu()" }, { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), "devicebuttons/z_mail", "opiemail", "raise()", "opiemail", "newMail()" }, }; @@ -664,24 +690,28 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) ODeviceButton &b = ( *d->m_buttons ) [button]; b. setHeldAction ( action ); Config buttonFile ( "ButtonSettings" ); buttonFile. setGroup ( "Button" + QString::number ( button )); buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); // buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); } void ODevice::virtual_hook(int, void* ){ } void ODevice::sendSuspendmsg() { if ( isQWS() ) return; QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); } + + +} +} diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 474d792..0465d7e 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h @@ -113,56 +113,50 @@ enum OVendor { Vendor_MundN, Vendor_GMate, Vendor_MasterIA, }; /** * The System used */ enum OSystem { System_Unknown, System_Familiar, System_Zaurus, System_OpenZaurus, System_Linupy, System_OpenEmbedded, }; typedef struct { OSystem system; char* sysstr; char* sysvfile; } ODistribution; -static ODistribution distributions[] = -{ - { System_Familiar, "FamiliarLinux", "/etc/familiar-version" }, - { System_OpenZaurus, "OpenZaurus", "/etc/oz_version" }, - { System_OpenEmbedded, "OpenEmbedded", "/etc/oe-version" }, - { System_Unknown, "Linux", "/etc/issue" }, +extern ODistribution distributions[]; -}; enum OLedState { Led_Off, Led_On, Led_BlinkSlow, Led_BlinkFast }; enum OLed { Led_Mail, Led_Power, Led_BlueTooth }; enum OHardKey { HardKey_Datebook = Qt::Key_F9, HardKey_Contacts = Qt::Key_F10, HardKey_Menu = Qt::Key_F11, HardKey_Home = Qt::Key_F12, HardKey_Mail = Qt::Key_F13, HardKey_Record = Qt::Key_F24, HardKey_Suspend = Qt::Key_F34, HardKey_Backlight = Qt::Key_F35, HardKey_Action = Qt::Key_F10, @@ -331,43 +325,34 @@ protected: }; class ODeviceData { public: QString m_vendorstr; OVendor m_vendor; QString m_modelstr; OModel m_model; QString m_systemstr; OSystem m_system; QString m_sysverstr; Transformation m_rotation; ODirection m_direction; QValueList <ODeviceButton> *m_buttons; uint m_holdtime; QStrList *m_cpu_frequencies; }; +extern bool isQWS(); +extern QCString makeChannel ( const char *str ); } } -static inline bool isQWS() -{ - return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; -} -static QCString makeChannel ( const char *str ) -{ - if ( str && !::strchr ( str, '/' )) - return QCString ( "QPE/Application/" ) + str; - else - return str; -} #endif |