summaryrefslogtreecommitdiff
authorchicken <chicken>2004-05-21 19:16:16 (UTC)
committer chicken <chicken>2004-05-21 19:16:16 (UTC)
commit91fcb5849e61a39336ae1ae06a41b4eac501fbf5 (patch) (side-by-side diff)
treeeeb63644fe18c091d1a0507017d9a8ef74bd9621
parent265c43b58186a7527144038f113501a8329ff8e7 (diff)
downloadopie-91fcb5849e61a39336ae1ae06a41b4eac501fbf5.zip
opie-91fcb5849e61a39336ae1ae06a41b4eac501fbf5.tar.gz
opie-91fcb5849e61a39336ae1ae06a41b4eac501fbf5.tar.bz2
correct jornada 56x button handling for opie
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp63
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h13
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
@@ -68,58 +68,112 @@ typedef struct {
unsigned char OffTime; /* units of 100m/s */
} LED_IN;
typedef struct {
unsigned char mode;
unsigned char pwr;
unsigned char brightness;
} FLITE_IN;
#define LED_ON OD_IOW( 'f', 5, LED_IN )
#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
+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&)
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
d->m_modelstr = "Jornada 56x";
d->m_model = Model_Jornada_56x;
d->m_systemstr = "Familiar";
d->m_system = System_Familiar;
d->m_rotation = Rot0;
QFile f ( "/etc/familiar-version" );
f.setName ( "/etc/familiar-version" );
if ( f.open ( IO_ReadOnly )) {
QTextStream ts ( &f );
d->m_sysverstr = ts.readLine().mid( 10 );
f. close();
}
}
+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&)));
+}
int Jornada::displayBrightnessResolution() const
{
return 255;
}
bool Jornada::setDisplayBrightness( int bright )
{
bool res = false;
- int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
QString cmdline;
int value = 255 - bright;
if ( !bright )
cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power");
else
@@ -134,33 +188,32 @@ bool Jornada::setDisplayBrightness( int bright )
bool Jornada::suspend( )
{
qDebug("ODevice::suspend");
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
- struct timeval tvs, tvn;
+ struct timeval tvs;
::gettimeofday ( &tvs, 0 );
::sync(); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
return res;
}
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" );
res = ( ::system( (const char*) cmdline ) == 0 );
return res;
}
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
@@ -31,24 +31,37 @@
#define ODEVICE_JORNADA
#include <opie2/odevice.h>
namespace Opie {
namespace Core {
namespace Internal {
class Jornada : public ODevice
{
protected:
virtual void init(const QString&);
+ virtual void initButtons();
public:
virtual bool suspend ( );
virtual bool setDisplayBrightness ( int b );
virtual bool setDisplayStatus ( bool on);
virtual int displayBrightnessResolution() const;
};
+
+struct j_button {
+ uint model;
+ Qt::Key code;
+ char *utext;
+ char *pix;
+ char *fpressedservice;
+ char *fpressedaction;
+ char *fheldservice;
+ char *fheldaction;
+};
+
}
}
}
#endif