-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 780d130..a59e799 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp @@ -31,16 +31,17 @@ /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> /* OPIE */ +#include <opie2/oinputsystem.h> #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> /* STD */ #include <fcntl.h> #include <math.h> @@ -95,17 +96,26 @@ struct z_button z_buttons_c700 [] = { { 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()" }, - { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), + + { Qt::Key_F15, QT_TRANSLATE_NOOP("Button", "Display Rotate"), + "devicebuttons/z_hinge", + "QPE/Rotation", "rotateDefault()", + "QPE/Dummy", "doNothing()" }, + { Qt::Key_F16, QT_TRANSLATE_NOOP("Button", "Display Rotate"), + "devicebuttons/z_hinge", + "QPE/Rotation", "rotateDefault()", + "QPE/Dummy", "doNothing()" }, + { Qt::Key_F17, QT_TRANSLATE_NOOP("Button", "Display Rotate"), "devicebuttons/z_hinge", "QPE/Rotation", "rotateDefault()", "QPE/Dummy", "doNothing()" }, }; // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus // class up into individual classes. We need three classes // @@ -502,17 +512,17 @@ bool Zaurus::suspend() QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); return res; } Transformation Zaurus::rotation() const { Transformation rot; - + switch ( d->m_model ) { case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: { OHingeStatus hs = readHingeSensor(); if ( hs == CASE_PORTRAIT ) rot = Rot0; else if ( hs == CASE_UNKNOWN ) rot = Rot0; else rot = Rot270; } @@ -527,17 +537,17 @@ Transformation Zaurus::rotation() const break; } return rot; } ODirection Zaurus::direction() const { ODirection dir; - + switch ( d->m_model ) { case Model_Zaurus_SLC3000: // fallthrough case Model_Zaurus_SLC7x0: { OHingeStatus hs = readHingeSensor(); if ( hs == CASE_PORTRAIT ) dir = CCW; else if ( hs == CASE_UNKNOWN ) dir = CCW; else dir = CW; } @@ -582,12 +592,17 @@ OHingeStatus Zaurus::readHingeSensor() const { qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); return CASE_UNKNOWN; } } } else { - qDebug( "Zaurus::readHingeSensor: ODevice handling for non-embedix kernels not yet implemented" ); + // corgi keyboard is event source 0 in OZ kernel 2.6 + OInputDevice* keyboard = OInputSystem::instance()->device( "event0" ); + if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP0 ) ) return CASE_LANDSCAPE; + else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP1 ) ) return CASE_PORTRAIT; + else if ( keyboard && keyboard->isHeld( OInputDevice::Key_KP2 ) ) return CASE_CLOSED; + qWarning("Zaurus::readHingeSensor() - couldn't compute hinge status!" ); return CASE_UNKNOWN; } } |