-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 63 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.h | 13 |
2 files changed, 71 insertions, 5 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 75c9fc5..526f9cb 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp @@ -79,4 +79,33 @@ typedef struct { +using namespace Opie::Core; using namespace Opie::Core::Internal; +struct j_button jornada56x_buttons [] = { + { Model_Jornada_56x, + Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Calendar Button"), + "devicebuttons/jornada56x_calendar", + "datebook", "nextView()", + "today", "raise()" }, + { Model_Jornada_56x, + Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Contacts Button"), + "devicebuttons/jornada56x_contact", + "addressbook", "raise()", + "addressbook", "beamBusinessCard()" }, + { Model_Jornada_56x, + Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Todo Button"), + "devicebuttons/jornada56x_todo", + "todolist", "raise()", + "todolist", "create()" }, + { Model_Jornada_56x, + Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Home Button"), + "devicebuttons/jornada56x_home", + "QPE/Launcher", "home()", + "buttonsettings", "raise()" }, + { Model_Jornada_56x, + Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Record Button"), + "devicebuttons/jornada56x_record", + "QPE/VMemo", "toggleRecord()", + "sound", "raise()" }, +}; + void Jornada::init(const QString&) @@ -102,2 +131,28 @@ void Jornada::init(const QString&) +void Jornada::initButtons() +{ + if ( d->m_buttons ) + return; + + d->m_buttons = new QValueList <ODeviceButton>; + + for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { + j_button *ib = jornada56x_buttons + i; + ODeviceButton b; + + if (( ib->model & d->m_model ) == d->m_model ) { + b. setKeycode ( ib->code ); + b. setUserText ( QObject::tr ( "Button", ib->utext )); + b. setPixmap ( Resource::loadPixmap ( ib->pix )); + b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); + b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); + + d->m_buttons->append ( b ); + } + } + reloadButtonMapping(); + + QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); + connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); +} @@ -112,3 +167,2 @@ bool Jornada::setDisplayBrightness( int bright ) bool res = false; - int fd; @@ -145,3 +199,3 @@ bool Jornada::suspend( ) - struct timeval tvs, tvn; + struct timeval tvs; ::gettimeofday ( &tvs, 0 ); @@ -157,5 +211,4 @@ bool Jornada::setDisplayStatus ( bool on ) bool res = false; - int fd; - - QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "1" : "0",on ? "1" : "0" ); + + QString cmdline = QString().sprintf( "echo %d > /sys/class/lcd/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/power", on ? "1" : "0", on ? "1" : "0" ); diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h index 2a9e821..b17fa8b 100644 --- a/libopie2/opiecore/device/odevice_jornada.h +++ b/libopie2/opiecore/device/odevice_jornada.h @@ -42,2 +42,3 @@ class Jornada : public ODevice virtual void init(const QString&); + virtual void initButtons(); @@ -49,2 +50,14 @@ class Jornada : public ODevice }; + +struct j_button { + uint model; + Qt::Key code; + char *utext; + char *pix; + char *fpressedservice; + char *fpressedaction; + char *fheldservice; + char *fheldaction; +}; + } |