summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp33
-rw-r--r--libopie2/opiecore/device/odevice.h15
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp4
5 files changed, 54 insertions, 6 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index ee66d95..62a2e03 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -41,48 +41,71 @@ _;:, .> :=|. This program is free software; you can
#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";
using namespace Opie::Core;
+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()" },
+};
+
ODevice *ODevice::inst()
{
static ODevice *dev = 0;
// rewrite this to only use /proc/cpuinfo or so
if ( !dev )
{
QFile f( PATH_PROC_CPUINFO );
if ( f.open( IO_ReadOnly ) )
{
QTextStream s( &f );
while ( !s.atEnd() )
{
QString line;
line = s.readLine();
if ( line.startsWith( "Hardware" ) )
{
qDebug( "ODevice() - found '%s'", (const char*) line );
if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
@@ -120,48 +143,58 @@ ODevice::ODevice()
d->m_cpu_frequencies = new QStrList;
}
void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
{
if ( msg == "deviceButtonMappingChanged()" ) {
reloadButtonMapping();
}
}
void ODevice::init()
{
}
/**
* This method initialises the button mapping
*/
void ODevice::initButtons()
{
if ( d->m_buttons )
return;
qDebug ( "init Buttons" );
d->m_buttons = new QValueList <ODeviceButton>;
+ for ( uint i = 0; i < ( sizeof( default_buttons ) / sizeof( default_button )); i++ ) {
+ default_button *db = default_buttons + i;
+ ODeviceButton b;
+ b. setKeycode ( db->code );
+ b. setUserText ( QObject::tr ( "Button", db->utext ));
+ b. setPixmap ( Resource::loadPixmap ( db->pix ));
+ b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( db->fpressedservice ), db->fpressedaction ));
+ b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( db->fheldservice ), db->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&)));
}
ODevice::~ODevice()
{
// we leak m_devicebuttons and m_cpu_frequency
// but it's a singleton and it is not so importantant
// -zecke
delete d;
}
bool ODevice::setSoftSuspend ( bool /*soft*/ )
{
return false;
}
//#include <linux/apm_bios.h>
#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index 5ee9cca..0ba58f0 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -139,48 +139,63 @@ enum OHardKey {
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,
HardKey_OK = Qt::Key_F11,
HardKey_End = Qt::Key_F12,
};
enum ODirection {
CW = 0,
CCW = 1,
Flip = 2,
};
enum OHingeStatus {
CASE_CLOSED = 3,
CASE_PORTRAIT = 2,
CASE_LANDSCAPE = 0,
CASE_UNKNOWN = 1,
};
+/* default button for qvfb or such
+ * see odevice.cpp for details.
+ * hint: manage a user defined button for qvfb?
+ * alwin
+ */
+struct default_button {
+ Qt::Key code;
+ char *utext;
+ char *pix;
+ char *fpressedservice;
+ char *fpressedaction;
+ char *fheldservice;
+ char *fheldaction;
+};
+
/**
* A singleton which gives informations about device specefic option
* like the Hardware used, LEDs, the Base Distribution and
* hardware key mappings.
*
* @short A small class for device specefic options
* @see QObject
* @author Robert Griebl
* @version 1.0
*/
class ODevice : public QObject
{
Q_OBJECT
private:
/* disable copy */
ODevice ( const ODevice & );
protected:
ODevice();
virtual void init();
virtual void initButtons();
static void sendSuspendmsg();
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 2efcd3a..98e2ffa 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -79,50 +79,50 @@ typedef struct {
} FLITE_IN;
#define LED_ON OD_IOW( 'f', 5, LED_IN )
#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
struct i_button ipaq_buttons [] = {
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
"devicebuttons/ipaq_calendar",
"datebook", "nextView()",
"today", "raise()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
"devicebuttons/ipaq_contact",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/ipaq_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
"devicebuttons/ipaq_mail",
- "mail", "raise()",
- "mail", "newMail()" },
+ "opiemail", "raise()",
+ "opiemail", "newMail()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/ipaq_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
{ Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
"devicebuttons/ipaq_record",
"QPE/VMemo", "toggleRecord()",
"sound", "raise()" },
};
void iPAQ::init()
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
QFile f ( "/proc/hal/model" );
if ( f. open ( IO_ReadOnly )) {
QTextStream ts ( &f );
d->m_modelstr = "H" + ts. readLine();
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 7d79ef5..e9481bb 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -54,50 +54,50 @@ _;:, .> :=|. This program is free software; you can
#endif
using namespace Opie::Core;
using namespace Opie::Core::Internal;
struct s_button simpad_buttons [] = {
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
"devicebuttons/simpad_lower_up",
"datebook", "nextView()",
"today", "raise()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
"devicebuttons/simpad_lower_down",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
"devicebuttons/simpad_lower_right",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
"devicebuttons/simpad_lower_left",
- "mail", "raise()",
- "mail", "newMail()" },
+ "opiemail", "raise()",
+ "opiemail", "newMail()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"),
"devicebuttons/simpad_upper_up",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"),
"devicebuttons/simpad_upper_down",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"),
"devicebuttons/simpad_upper_right",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"),
"devicebuttons/simpad_upper_left",
"QPE/Rotation", "flip()",
"QPE/Rotation", "flip()" },
/*
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 000d29c..1434e69 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -54,50 +54,50 @@ _;:, .> :=|. This program is free software; you can
#endif
using namespace Opie::Core;
using namespace Opie::Core::Internal;
struct z_button z_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",
- "mail", "raise()",
- "mail", "newMail()" },
+ "opiemail", "raise()",
+ "opiemail", "newMail()" },
};
struct z_button z_buttons_c700 [] = {
{ 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_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
"devicebuttons/z_hinge",
"QPE/Rotation", "rotateDefault()",
"QPE/Dummy", "doNothing()" },
};