summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Unidiff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp10
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.h2
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h2
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_ramses.h2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_yopy.h2
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp10
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h2
-rw-r--r--libopie2/opiecore/device/odevicebutton.cpp8
-rw-r--r--libopie2/opiecore/device/odevicebutton.h4
-rw-r--r--libopie2/opiecore/oapplication.cpp4
-rw-r--r--libopie2/opiecore/oapplication.h4
-rw-r--r--libopie2/opiecore/oconfig.h6
-rw-r--r--libopie2/opiecore/odebug.cpp11
-rw-r--r--libopie2/opiecore/oprocctrl.cpp8
-rw-r--r--libopie2/opiecore/oprocctrl.h8
-rw-r--r--libopie2/opiecore/oprocess.cpp4
-rw-r--r--libopie2/opiecore/oprocess.h6
23 files changed, 57 insertions, 48 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp
index 1ad0327..ee66d95 100644
--- a/libopie2/opiecore/device/odevice.cpp
+++ b/libopie2/opiecore/device/odevice.cpp
@@ -36,101 +36,101 @@ _;:, .> :=|. This program is free software; you can
36 36
37/* QT */ 37/* QT */
38#include <qapplication.h> 38#include <qapplication.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qwindowsystem_qws.h> 41#include <qwindowsystem_qws.h>
42 42
43/* OPIE */ 43/* OPIE */
44#include <qpe/config.h> 44#include <qpe/config.h>
45#include <qpe/resource.h> 45#include <qpe/resource.h>
46#include <qpe/sound.h> 46#include <qpe/sound.h>
47#include <qpe/qcopenvelope_qws.h> 47#include <qpe/qcopenvelope_qws.h>
48 48
49/* STD */ 49/* STD */
50#include <fcntl.h> 50#include <fcntl.h>
51#include <math.h> 51#include <math.h>
52#include <stdlib.h> 52#include <stdlib.h>
53#include <signal.h> 53#include <signal.h>
54#include <sys/ioctl.h> 54#include <sys/ioctl.h>
55#include <sys/time.h> 55#include <sys/time.h>
56#include <unistd.h> 56#include <unistd.h>
57#ifndef QT_NO_SOUND 57#ifndef QT_NO_SOUND
58#include <linux/soundcard.h> 58#include <linux/soundcard.h>
59#endif 59#endif
60 60
61const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; 61const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
62 62
63using namespace Opie::Core; 63using namespace Opie::Core;
64 64
65ODevice *ODevice::inst() 65ODevice *ODevice::inst()
66{ 66{
67 static ODevice *dev = 0; 67 static ODevice *dev = 0;
68 68
69 // rewrite this to only use /proc/cpuinfo or so 69 // rewrite this to only use /proc/cpuinfo or so
70 70
71 if ( !dev ) 71 if ( !dev )
72 { 72 {
73 QFile f( PATH_PROC_CPUINFO ); 73 QFile f( PATH_PROC_CPUINFO );
74 if ( f.open( IO_ReadOnly ) ) 74 if ( f.open( IO_ReadOnly ) )
75 { 75 {
76 QTextStream s( &f ); 76 QTextStream s( &f );
77 while ( !s.atEnd() ) 77 while ( !s.atEnd() )
78 { 78 {
79 QString line; 79 QString line;
80 line = s.readLine(); 80 line = s.readLine();
81 if ( line.startsWith( "Hardware" ) ) 81 if ( line.startsWith( "Hardware" ) )
82 { 82 {
83 qDebug( "ODevice() - found '%s'", (const char*) line ); 83 qDebug( "ODevice() - found '%s'", (const char*) line );
84 if ( line.contains( "sharp", false ) ) dev = new Private::Zaurus(); 84 if ( line.contains( "sharp", false ) ) dev = new Internal::Zaurus();
85 else if ( line.contains( "ipaq", false ) ) dev = new Private::iPAQ(); 85 else if ( line.contains( "ipaq", false ) ) dev = new Internal::iPAQ();
86 else if ( line.contains( "simpad", false ) ) dev = new Private::SIMpad(); 86 else if ( line.contains( "simpad", false ) ) dev = new Internal::SIMpad();
87 else if ( line.contains( "jornada", false ) ) dev = new Private::Jornada(); 87 else if ( line.contains( "jornada", false ) ) dev = new Internal::Jornada();
88 else if ( line.contains( "ramses", false ) ) dev = new Private::Ramses(); 88 else if ( line.contains( "ramses", false ) ) dev = new Internal::Ramses();
89 else qWarning( "ODevice() - unknown hardware - using default." ); 89 else qWarning( "ODevice() - unknown hardware - using default." );
90 break; 90 break;
91 } 91 }
92 } 92 }
93 } 93 }
94 else 94 else
95 { 95 {
96 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO ); 96 qWarning( "ODevice() - can't open '%s' - unknown hardware - using default.", PATH_PROC_CPUINFO );
97 } 97 }
98 if ( !dev ) dev = new ODevice(); 98 if ( !dev ) dev = new ODevice();
99 dev->init(); 99 dev->init();
100 } 100 }
101 return dev; 101 return dev;
102} 102}
103 103
104ODevice::ODevice() 104ODevice::ODevice()
105{ 105{
106 d = new ODeviceData; 106 d = new ODeviceData;
107 107
108 d->m_modelstr = "Unknown"; 108 d->m_modelstr = "Unknown";
109 d->m_model = Model_Unknown; 109 d->m_model = Model_Unknown;
110 d->m_vendorstr = "Unknown"; 110 d->m_vendorstr = "Unknown";
111 d->m_vendor = Vendor_Unknown; 111 d->m_vendor = Vendor_Unknown;
112 d->m_systemstr = "Unknown"; 112 d->m_systemstr = "Unknown";
113 d->m_system = System_Unknown; 113 d->m_system = System_Unknown;
114 d->m_sysverstr = "0.0"; 114 d->m_sysverstr = "0.0";
115 d->m_rotation = Rot0; 115 d->m_rotation = Rot0;
116 d->m_direction = CW; 116 d->m_direction = CW;
117 117
118 d->m_holdtime = 1000; // 1000ms 118 d->m_holdtime = 1000; // 1000ms
119 d->m_buttons = 0; 119 d->m_buttons = 0;
120 d->m_cpu_frequencies = new QStrList; 120 d->m_cpu_frequencies = new QStrList;
121} 121}
122 122
123void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 123void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
124{ 124{
125 if ( msg == "deviceButtonMappingChanged()" ) { 125 if ( msg == "deviceButtonMappingChanged()" ) {
126 reloadButtonMapping(); 126 reloadButtonMapping();
127 } 127 }
128} 128}
129 129
130void ODevice::init() 130void ODevice::init()
131{ 131{
132} 132}
133 133
134/** 134/**
135* This method initialises the button mapping 135* This method initialises the button mapping
136*/ 136*/
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp
index 177fd4c..2efcd3a 100644
--- a/libopie2/opiecore/device/odevice_ipaq.cpp
+++ b/libopie2/opiecore/device/odevice_ipaq.cpp
@@ -10,97 +10,97 @@
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_ipaq.h" 30#include "odevice_ipaq.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56 56
57using namespace Opie::Core; 57using namespace Opie::Core;
58using namespace Opie::Core::Private; 58using namespace Opie::Core::Internal;
59 59
60/* KERNEL */ 60/* KERNEL */
61#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 61#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
62 62
63#define OD_IO(type,number) OD_IOC(0,type,number,0) 63#define OD_IO(type,number) OD_IOC(0,type,number,0)
64#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 64#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
65#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 65#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
66#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 66#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
67 67
68typedef struct { 68typedef struct {
69 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 69 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
70 unsigned char TotalTime; /* Units of 5 seconds */ 70 unsigned char TotalTime; /* Units of 5 seconds */
71 unsigned char OnTime; /* units of 100m/s */ 71 unsigned char OnTime; /* units of 100m/s */
72 unsigned char OffTime; /* units of 100m/s */ 72 unsigned char OffTime; /* units of 100m/s */
73} LED_IN; 73} LED_IN;
74 74
75typedef struct { 75typedef struct {
76 unsigned char mode; 76 unsigned char mode;
77 unsigned char pwr; 77 unsigned char pwr;
78 unsigned char brightness; 78 unsigned char brightness;
79} FLITE_IN; 79} FLITE_IN;
80 80
81#define LED_ON OD_IOW( 'f', 5, LED_IN ) 81#define LED_ON OD_IOW( 'f', 5, LED_IN )
82#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 82#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
83 83
84struct i_button ipaq_buttons [] = { 84struct i_button ipaq_buttons [] = {
85 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 85 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
86 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 86 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
87 "devicebuttons/ipaq_calendar", 87 "devicebuttons/ipaq_calendar",
88 "datebook", "nextView()", 88 "datebook", "nextView()",
89 "today", "raise()" }, 89 "today", "raise()" },
90 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 90 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
91 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 91 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
92 "devicebuttons/ipaq_contact", 92 "devicebuttons/ipaq_contact",
93 "addressbook", "raise()", 93 "addressbook", "raise()",
94 "addressbook", "beamBusinessCard()" }, 94 "addressbook", "beamBusinessCard()" },
95 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 95 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
96 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 96 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
97 "devicebuttons/ipaq_menu", 97 "devicebuttons/ipaq_menu",
98 "QPE/TaskBar", "toggleMenu()", 98 "QPE/TaskBar", "toggleMenu()",
99 "QPE/TaskBar", "toggleStartMenu()" }, 99 "QPE/TaskBar", "toggleStartMenu()" },
100 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 100 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
101 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 101 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
102 "devicebuttons/ipaq_mail", 102 "devicebuttons/ipaq_mail",
103 "mail", "raise()", 103 "mail", "raise()",
104 "mail", "newMail()" }, 104 "mail", "newMail()" },
105 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 105 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
106 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 106 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h
index 4f4af46..968f715 100644
--- a/libopie2/opiecore/device/odevice_ipaq.h
+++ b/libopie2/opiecore/device/odevice_ipaq.h
@@ -1,88 +1,88 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_IPAQ 30#ifndef ODEVICE_IPAQ
31#define ODEVICE_IPAQ 31#define ODEVICE_IPAQ
32 32
33#include "odevice.h" 33#include "odevice.h"
34 34
35/* QT */ 35/* QT */
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38namespace Opie { 38namespace Opie {
39namespace Core { 39namespace Core {
40namespace Private { 40namespace Internal {
41 41
42class iPAQ : public ODevice, public QWSServer::KeyboardFilter 42class iPAQ : public ODevice, public QWSServer::KeyboardFilter
43{ 43{
44 44
45 protected: 45 protected:
46 virtual void init(); 46 virtual void init();
47 virtual void initButtons(); 47 virtual void initButtons();
48 48
49 public: 49 public:
50 virtual bool setSoftSuspend( bool soft ); 50 virtual bool setSoftSuspend( bool soft );
51 51
52 virtual bool setDisplayBrightness( int b ); 52 virtual bool setDisplayBrightness( int b );
53 virtual int displayBrightnessResolution() const; 53 virtual int displayBrightnessResolution() const;
54 54
55 virtual void playAlarmSound(); 55 virtual void playAlarmSound();
56 56
57 virtual QValueList <OLed> ledList() const; 57 virtual QValueList <OLed> ledList() const;
58 virtual QValueList <OLedState> ledStateList( OLed led ) const; 58 virtual QValueList <OLedState> ledStateList( OLed led ) const;
59 virtual OLedState ledState( OLed led ) const; 59 virtual OLedState ledState( OLed led ) const;
60 virtual bool setLedState( OLed led, OLedState st ); 60 virtual bool setLedState( OLed led, OLedState st );
61 61
62 virtual bool hasLightSensor() const; 62 virtual bool hasLightSensor() const;
63 virtual int readLightSensor(); 63 virtual int readLightSensor();
64 virtual int lightSensorResolution() const; 64 virtual int lightSensorResolution() const;
65 65
66 protected: 66 protected:
67 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 67 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
68 virtual void timerEvent( QTimerEvent *te ); 68 virtual void timerEvent( QTimerEvent *te );
69 69
70 int m_power_timer; 70 int m_power_timer;
71 71
72 OLedState m_leds [2]; 72 OLedState m_leds [2];
73}; 73};
74 74
75struct i_button { 75struct i_button {
76 uint model; 76 uint model;
77 Qt::Key code; 77 Qt::Key code;
78 char *utext; 78 char *utext;
79 char *pix; 79 char *pix;
80 char *fpressedservice; 80 char *fpressedservice;
81 char *fpressedaction; 81 char *fpressedaction;
82 char *fheldservice; 82 char *fheldservice;
83 char *fheldaction; 83 char *fheldaction;
84}; 84};
85 85
86} 86}
87} 87}
88} 88}
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index b79b0b5..eaa93ca 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -32,97 +32,97 @@
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56/* KERNEL */ 56/* KERNEL */
57#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 57#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
58 58
59#define OD_IO(type,number) OD_IOC(0,type,number,0) 59#define OD_IO(type,number) OD_IOC(0,type,number,0)
60#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 60#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
61#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 61#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
62#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 62#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
63 63
64typedef struct { 64typedef struct {
65 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 65 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
66 unsigned char TotalTime; /* Units of 5 seconds */ 66 unsigned char TotalTime; /* Units of 5 seconds */
67 unsigned char OnTime; /* units of 100m/s */ 67 unsigned char OnTime; /* units of 100m/s */
68 unsigned char OffTime; /* units of 100m/s */ 68 unsigned char OffTime; /* units of 100m/s */
69} LED_IN; 69} LED_IN;
70 70
71typedef struct { 71typedef struct {
72 unsigned char mode; 72 unsigned char mode;
73 unsigned char pwr; 73 unsigned char pwr;
74 unsigned char brightness; 74 unsigned char brightness;
75} FLITE_IN; 75} FLITE_IN;
76 76
77#define LED_ON OD_IOW( 'f', 5, LED_IN ) 77#define LED_ON OD_IOW( 'f', 5, LED_IN )
78#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 78#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
79 79
80using namespace Opie::Core::Private; 80using namespace Opie::Core::Internal;
81 81
82void Jornada::init() 82void Jornada::init()
83{ 83{
84 d->m_vendorstr = "HP"; 84 d->m_vendorstr = "HP";
85 d->m_vendor = Vendor_HP; 85 d->m_vendor = Vendor_HP;
86 d->m_modelstr = "Jornada 56x"; 86 d->m_modelstr = "Jornada 56x";
87 d->m_model = Model_Jornada_56x; 87 d->m_model = Model_Jornada_56x;
88 d->m_systemstr = "Familiar"; 88 d->m_systemstr = "Familiar";
89 d->m_system = System_Familiar; 89 d->m_system = System_Familiar;
90 d->m_rotation = Rot0; 90 d->m_rotation = Rot0;
91 91
92 QFile f ( "/etc/familiar-version" ); 92 QFile f ( "/etc/familiar-version" );
93 f.setName ( "/etc/familiar-version" ); 93 f.setName ( "/etc/familiar-version" );
94 if ( f.open ( IO_ReadOnly )) { 94 if ( f.open ( IO_ReadOnly )) {
95 95
96 QTextStream ts ( &f ); 96 QTextStream ts ( &f );
97 d->m_sysverstr = ts.readLine().mid( 10 ); 97 d->m_sysverstr = ts.readLine().mid( 10 );
98 98
99 f. close(); 99 f. close();
100 } 100 }
101} 101}
102 102
103 103
104int Jornada::displayBrightnessResolution() const 104int Jornada::displayBrightnessResolution() const
105{ 105{
106 return 0; 106 return 0;
107} 107}
108 108
109 109
110bool Jornada::setDisplayBrightness( int bright ) 110bool Jornada::setDisplayBrightness( int bright )
111{ 111{
112 bool res = false; 112 bool res = false;
113 int fd; 113 int fd;
114 114
115 if ( bright > 255 ) 115 if ( bright > 255 )
116 bright = 255; 116 bright = 255;
117 if ( bright < 0 ) 117 if ( bright < 0 )
118 bright = 0; 118 bright = 0;
119 119
120 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 120 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
121 FLITE_IN bl; 121 FLITE_IN bl;
122 bl. mode = 1; 122 bl. mode = 1;
123 bl. pwr = bright ? 1 : 0; 123 bl. pwr = bright ? 1 : 0;
124 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255; 124 bl. brightness = ( bright * ( displayBrightnessResolution() - 1 ) + 127 ) / 255;
125 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 125 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
126 ::close ( fd ); 126 ::close ( fd );
127 } 127 }
128 return res; 128 return res;
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h
index c37d75e..e2e67af 100644
--- a/libopie2/opiecore/device/odevice_jornada.h
+++ b/libopie2/opiecore/device/odevice_jornada.h
@@ -1,53 +1,53 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_JORNADA 30#ifndef ODEVICE_JORNADA
31#define ODEVICE_JORNADA 31#define ODEVICE_JORNADA
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35namespace Opie { 35namespace Opie {
36namespace Core { 36namespace Core {
37namespace Private { 37namespace Internal {
38class Jornada : public ODevice 38class Jornada : public ODevice
39{ 39{
40 40
41 protected: 41 protected:
42 virtual void init(); 42 virtual void init();
43 43
44 public: 44 public:
45 virtual bool setSoftSuspend ( bool soft ); 45 virtual bool setSoftSuspend ( bool soft );
46 virtual bool setDisplayBrightness ( int b ); 46 virtual bool setDisplayBrightness ( int b );
47 virtual int displayBrightnessResolution() const; 47 virtual int displayBrightnessResolution() const;
48}; 48};
49} 49}
50} 50}
51} 51}
52#endif 52#endif
53 53
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp
index 77de8c5..10b7b61 100644
--- a/libopie2/opiecore/device/odevice_ramses.cpp
+++ b/libopie2/opiecore/device/odevice_ramses.cpp
@@ -9,97 +9,97 @@
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_ramses.h" 30#include "odevice_ramses.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56using namespace Opie::Core; 56using namespace Opie::Core;
57using namespace Opie::Core::Private; 57using namespace Opie::Core::Internal;
58 58
59struct r_button ramses_buttons [] = { 59struct r_button ramses_buttons [] = {
60 { Model_Ramses_MNCI, 60 { Model_Ramses_MNCI,
61 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 61 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
62 "devicebuttons/z_menu", 62 "devicebuttons/z_menu",
63 "QPE/TaskBar", "toggleMenu()", 63 "QPE/TaskBar", "toggleMenu()",
64 "QPE/TaskBar", "toggleStartMenu()" }, 64 "QPE/TaskBar", "toggleStartMenu()" },
65 { Model_Ramses_MNCI, 65 { Model_Ramses_MNCI,
66 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 66 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
67 "devicebuttons/ipaq_home", 67 "devicebuttons/ipaq_home",
68 "QPE/Launcher", "home()", 68 "QPE/Launcher", "home()",
69 "buttonsettings", "raise()" }, 69 "buttonsettings", "raise()" },
70}; 70};
71 71
72void Ramses::init() 72void Ramses::init()
73{ 73{
74 d->m_vendorstr = "M und N"; 74 d->m_vendorstr = "M und N";
75 d->m_vendor = Vendor_MundN; 75 d->m_vendor = Vendor_MundN;
76 76
77 QFile f("/proc/sys/board/ramses"); 77 QFile f("/proc/sys/board/ramses");
78 78
79 d->m_modelstr = "Ramses"; 79 d->m_modelstr = "Ramses";
80 d->m_model = Model_Ramses_MNCI; 80 d->m_model = Model_Ramses_MNCI;
81 81
82 d->m_rotation = Rot0; 82 d->m_rotation = Rot0;
83 d->m_holdtime = 1000; 83 d->m_holdtime = 1000;
84 84
85 f.setName("/etc/oz_version"); 85 f.setName("/etc/oz_version");
86 86
87 if (f.open(IO_ReadOnly)) { 87 if (f.open(IO_ReadOnly)) {
88 d->m_systemstr = "OpenEmbedded/Ramses"; 88 d->m_systemstr = "OpenEmbedded/Ramses";
89 d->m_system = System_OpenZaurus; 89 d->m_system = System_OpenZaurus;
90 90
91 QTextStream ts(&f); 91 QTextStream ts(&f);
92 ts.setDevice(&f); 92 ts.setDevice(&f);
93 d->m_sysverstr = ts.readLine(); 93 d->m_sysverstr = ts.readLine();
94 f.close(); 94 f.close();
95 } 95 }
96 96
97 m_power_timer = 0; 97 m_power_timer = 0;
98 98
99#ifdef QT_QWS_ALLOW_OVERCLOCK 99#ifdef QT_QWS_ALLOW_OVERCLOCK
100#warning *** Overclocking enabled - this may fry your hardware - you have been warned *** 100#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
101#define OC(x...) x 101#define OC(x...) x
102#else 102#else
103#define OC(x...) 103#define OC(x...)
104#endif 104#endif
105 105
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h
index e673b1a..aea9e2a 100644
--- a/libopie2/opiecore/device/odevice_ramses.h
+++ b/libopie2/opiecore/device/odevice_ramses.h
@@ -1,77 +1,77 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_RAMSES 30#ifndef ODEVICE_RAMSES
31#define ODEVICE_RAMSES 31#define ODEVICE_RAMSES
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34/* QT */ 34/* QT */
35#include <qwindowsystem_qws.h> 35#include <qwindowsystem_qws.h>
36 36
37namespace Opie { 37namespace Opie {
38namespace Core { 38namespace Core {
39namespace Private { 39namespace Internal {
40 40
41class Ramses : public ODevice, public QWSServer::KeyboardFilter 41class Ramses : public ODevice, public QWSServer::KeyboardFilter
42{ 42{
43 protected: 43 protected:
44 virtual void init(); 44 virtual void init();
45 45
46 public: 46 public:
47 virtual bool setSoftSuspend( bool soft ); 47 virtual bool setSoftSuspend( bool soft );
48 virtual bool suspend(); 48 virtual bool suspend();
49 49
50 virtual bool setDisplayStatus( bool on ); 50 virtual bool setDisplayStatus( bool on );
51 virtual bool setDisplayBrightness( int b ); 51 virtual bool setDisplayBrightness( int b );
52 virtual int displayBrightnessResolution() const; 52 virtual int displayBrightnessResolution() const;
53 virtual bool setDisplayContrast( int b ); 53 virtual bool setDisplayContrast( int b );
54 virtual int displayContrastResolution() const; 54 virtual int displayContrastResolution() const;
55 55
56 protected: 56 protected:
57 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 57 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
58 virtual void timerEvent ( QTimerEvent *te ); 58 virtual void timerEvent ( QTimerEvent *te );
59 59
60 int m_power_timer; 60 int m_power_timer;
61}; 61};
62 62
63struct r_button { 63struct r_button {
64 uint model; 64 uint model;
65 Qt::Key code; 65 Qt::Key code;
66 char *utext; 66 char *utext;
67 char *pix; 67 char *pix;
68 char *fpressedservice; 68 char *fpressedservice;
69 char *fpressedaction; 69 char *fpressedaction;
70 char *fheldservice; 70 char *fheldservice;
71 char *fheldaction; 71 char *fheldaction;
72}; 72};
73} 73}
74} 74}
75} 75}
76 76
77#endif 77#endif
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp
index 80d40a3..7d79ef5 100644
--- a/libopie2/opiecore/device/odevice_simpad.cpp
+++ b/libopie2/opiecore/device/odevice_simpad.cpp
@@ -9,97 +9,97 @@ _;:, .> :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21: = ...= . :.=- 21: = ...= . :.=-
22-. .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_simpad.h" 30#include "odevice_simpad.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56using namespace Opie::Core; 56using namespace Opie::Core;
57using namespace Opie::Core::Private; 57using namespace Opie::Core::Internal;
58 58
59struct s_button simpad_buttons [] = { 59struct s_button simpad_buttons [] = {
60 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 60 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
61 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), 61 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
62 "devicebuttons/simpad_lower_up", 62 "devicebuttons/simpad_lower_up",
63 "datebook", "nextView()", 63 "datebook", "nextView()",
64 "today", "raise()" }, 64 "today", "raise()" },
65 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 65 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
66 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), 66 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
67 "devicebuttons/simpad_lower_down", 67 "devicebuttons/simpad_lower_down",
68 "addressbook", "raise()", 68 "addressbook", "raise()",
69 "addressbook", "beamBusinessCard()" }, 69 "addressbook", "beamBusinessCard()" },
70 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 70 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
71 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), 71 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
72 "devicebuttons/simpad_lower_right", 72 "devicebuttons/simpad_lower_right",
73 "QPE/TaskBar", "toggleMenu()", 73 "QPE/TaskBar", "toggleMenu()",
74 "QPE/TaskBar", "toggleStartMenu()" }, 74 "QPE/TaskBar", "toggleStartMenu()" },
75 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 75 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
76 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), 76 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
77 "devicebuttons/simpad_lower_left", 77 "devicebuttons/simpad_lower_left",
78 "mail", "raise()", 78 "mail", "raise()",
79 "mail", "newMail()" }, 79 "mail", "newMail()" },
80 80
81 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 81 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
82 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), 82 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"),
83 "devicebuttons/simpad_upper_up", 83 "devicebuttons/simpad_upper_up",
84 "QPE/Launcher", "home()", 84 "QPE/Launcher", "home()",
85 "buttonsettings", "raise()" }, 85 "buttonsettings", "raise()" },
86 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 86 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
87 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), 87 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"),
88 "devicebuttons/simpad_upper_down", 88 "devicebuttons/simpad_upper_down",
89 "addressbook", "raise()", 89 "addressbook", "raise()",
90 "addressbook", "beamBusinessCard()" }, 90 "addressbook", "beamBusinessCard()" },
91 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 91 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
92 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), 92 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"),
93 "devicebuttons/simpad_upper_right", 93 "devicebuttons/simpad_upper_right",
94 "QPE/TaskBar", "toggleMenu()", 94 "QPE/TaskBar", "toggleMenu()",
95 "QPE/TaskBar", "toggleStartMenu()" }, 95 "QPE/TaskBar", "toggleStartMenu()" },
96 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 96 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
97 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), 97 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"),
98 "devicebuttons/simpad_upper_left", 98 "devicebuttons/simpad_upper_left",
99 "QPE/Rotation", "flip()", 99 "QPE/Rotation", "flip()",
100 "QPE/Rotation", "flip()" }, 100 "QPE/Rotation", "flip()" },
101 /* 101 /*
102 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 102 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
103 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 103 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
104 "devicebuttons/simpad_lower_upper", 104 "devicebuttons/simpad_lower_upper",
105 "QPE/Launcher", "home()", 105 "QPE/Launcher", "home()",
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h
index 1848151..3d5acb5 100644
--- a/libopie2/opiecore/device/odevice_simpad.h
+++ b/libopie2/opiecore/device/odevice_simpad.h
@@ -1,87 +1,87 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_SIMPAD 30#ifndef ODEVICE_SIMPAD
31#define ODEVICE_SIMPAD 31#define ODEVICE_SIMPAD
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35/* QT */ 35/* QT */
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38namespace Opie { 38namespace Opie {
39namespace Core { 39namespace Core {
40namespace Private { 40namespace Internal {
41 41
42class SIMpad : public ODevice, public QWSServer::KeyboardFilter 42class SIMpad : public ODevice, public QWSServer::KeyboardFilter
43{ 43{
44 protected: 44 protected:
45 virtual void init(); 45 virtual void init();
46 virtual void initButtons(); 46 virtual void initButtons();
47 47
48 public: 48 public:
49 virtual bool setSoftSuspend( bool soft ); 49 virtual bool setSoftSuspend( bool soft );
50 virtual bool suspend(); 50 virtual bool suspend();
51 51
52 virtual bool setDisplayStatus( bool on ); 52 virtual bool setDisplayStatus( bool on );
53 virtual bool setDisplayBrightness( int b ); 53 virtual bool setDisplayBrightness( int b );
54 virtual int displayBrightnessResolution() const; 54 virtual int displayBrightnessResolution() const;
55 55
56 virtual void playAlarmSound(); 56 virtual void playAlarmSound();
57 57
58 virtual QValueList <OLed> ledList() const; 58 virtual QValueList <OLed> ledList() const;
59 virtual QValueList <OLedState> ledStateList( OLed led ) const; 59 virtual QValueList <OLedState> ledStateList( OLed led ) const;
60 virtual OLedState ledState( OLed led ) const; 60 virtual OLedState ledState( OLed led ) const;
61 virtual bool setLedState( OLed led, OLedState st ); 61 virtual bool setLedState( OLed led, OLedState st );
62 62
63 protected: 63 protected:
64 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 64 virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
65 virtual void timerEvent( QTimerEvent *te ); 65 virtual void timerEvent( QTimerEvent *te );
66 66
67 int m_power_timer; 67 int m_power_timer;
68 68
69 OLedState m_leds [1]; 69 OLedState m_leds [1];
70}; 70};
71 71
72struct s_button { 72struct s_button {
73 uint model; 73 uint model;
74 Qt::Key code; 74 Qt::Key code;
75 char *utext; 75 char *utext;
76 char *pix; 76 char *pix;
77 char *fpressedservice; 77 char *fpressedservice;
78 char *fpressedaction; 78 char *fpressedaction;
79 char *fheldservice; 79 char *fheldservice;
80 char *fheldaction; 80 char *fheldaction;
81}; 81};
82 82
83} 83}
84} 84}
85} 85}
86 86
87#endif 87#endif
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp
index f7a4025..4e9f227 100644
--- a/libopie2/opiecore/device/odevice_yopy.cpp
+++ b/libopie2/opiecore/device/odevice_yopy.cpp
@@ -9,97 +9,97 @@ _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11- .   .-<_>     .<> Foundation; either version 2 of the License, 11- .   .-<_>     .<> Foundation; either version 2 of the License,
12    ._= =}       : or (at your option) any later version. 12    ._= =}       : or (at your option) any later version.
13   .%`+i>       _;_. 13   .%`+i>       _;_.
14   .i_,=:_.      -<s. This program is distributed in the hope that 14   .i_,=:_.      -<s. This program is distributed in the hope that
15    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16   : ..    .:,     . . . without even the implied warranty of 16   : ..    .:,     . . . without even the implied warranty of
17   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21:     =  ...= . :.=- 21:     =  ...= . :.=-
22-.   .:....=;==+<; You should have received a copy of the GNU 22-.   .:....=;==+<; You should have received a copy of the GNU
23 -_. . .   )=.  = Library General Public License along with 23 -_. . .   )=.  = Library General Public License along with
24   --        :-=` this library; see the file COPYING.LIB. 24   --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_yopy.h" 30#include "odevice_yopy.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56using namespace Opie::Core; 56using namespace Opie::Core;
57using namespace Opie::Core::Private; 57using namespace Opie::Core::Internal;
58 58
59struct yopy_button yopy_buttons [] = { 59struct yopy_button yopy_buttons [] = {
60 { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), 60 { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ),
61 "devicebuttons/yopy_action", 61 "devicebuttons/yopy_action",
62 "datebook", "nextView()", 62 "datebook", "nextView()",
63 "today", "raise()" }, 63 "today", "raise()" },
64 { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), 64 { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ),
65 "devicebuttons/yopy_ok", 65 "devicebuttons/yopy_ok",
66 "addressbook", "raise()", 66 "addressbook", "raise()",
67 "addressbook", "beamBusinessCard()" }, 67 "addressbook", "beamBusinessCard()" },
68 { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), 68 { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ),
69 "devicebuttons/yopy_end", 69 "devicebuttons/yopy_end",
70 "QPE/Launcher", "home()", 70 "QPE/Launcher", "home()",
71 "buttonsettings", "raise()" }, 71 "buttonsettings", "raise()" },
72}; 72};
73 73
74void Yopy::init() 74void Yopy::init()
75{ 75{
76 d->m_vendorstr = "G.Mate"; 76 d->m_vendorstr = "G.Mate";
77 d->m_vendor = Vendor_GMate; 77 d->m_vendor = Vendor_GMate;
78 d->m_modelstr = "Yopy3700"; 78 d->m_modelstr = "Yopy3700";
79 d->m_model = Model_Yopy_3700; 79 d->m_model = Model_Yopy_3700;
80 d->m_rotation = Rot0; 80 d->m_rotation = Rot0;
81 81
82 d->m_systemstr = "Linupy"; 82 d->m_systemstr = "Linupy";
83 d->m_system = System_Linupy; 83 d->m_system = System_Linupy;
84 84
85 QFile f ( "/etc/issue" ); 85 QFile f ( "/etc/issue" );
86 if ( f. open ( IO_ReadOnly ) ) 86 if ( f. open ( IO_ReadOnly ) )
87 { 87 {
88 QTextStream ts ( &f ); 88 QTextStream ts ( &f );
89 ts.readLine(); 89 ts.readLine();
90 d->m_sysverstr = ts. readLine(); 90 d->m_sysverstr = ts. readLine();
91 f. close(); 91 f. close();
92 } 92 }
93} 93}
94 94
95 95
96void Yopy::initButtons() 96void Yopy::initButtons()
97{ 97{
98 if ( d->m_buttons ) 98 if ( d->m_buttons )
99 return ; 99 return ;
100 100
101 d->m_buttons = new QValueList <ODeviceButton>; 101 d->m_buttons = new QValueList <ODeviceButton>;
102 102
103 for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) 103 for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ )
104 { 104 {
105 105
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h
index 7d85479..6e1db88 100644
--- a/libopie2/opiecore/device/odevice_yopy.h
+++ b/libopie2/opiecore/device/odevice_yopy.h
@@ -1,67 +1,67 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3             Copyright (C) The Opie Team <opie-devel@handhelds.org> 3             Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6          .>+-= 6          .>+-=
7_;:,     .>    :=|. This program is free software; you can 7_;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11- .   .-<_>     .<> Foundation; either version 2 of the License, 11- .   .-<_>     .<> Foundation; either version 2 of the License,
12    ._= =}       : or (at your option) any later version. 12    ._= =}       : or (at your option) any later version.
13   .%`+i>       _;_. 13   .%`+i>       _;_.
14   .i_,=:_.      -<s. This program is distributed in the hope that 14   .i_,=:_.      -<s. This program is distributed in the hope that
15    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16   : ..    .:,     . . . without even the implied warranty of 16   : ..    .:,     . . . without even the implied warranty of
17   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21:     =  ...= . :.=- 21:     =  ...= . :.=-
22-.   .:....=;==+<; You should have received a copy of the GNU 22-.   .:....=;==+<; You should have received a copy of the GNU
23 -_. . .   )=.  = Library General Public License along with 23 -_. . .   )=.  = Library General Public License along with
24   --        :-=` this library; see the file COPYING.LIB. 24   --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_YOPY 30#ifndef ODEVICE_YOPY
31#define ODEVICE_YOPY 31#define ODEVICE_YOPY
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35namespace Opie { 35namespace Opie {
36namespace Core { 36namespace Core {
37namespace Private { 37namespace Internal {
38class Yopy : public ODevice 38class Yopy : public ODevice
39{ 39{
40 protected: 40 protected:
41 41
42 virtual void init(); 42 virtual void init();
43 virtual void initButtons(); 43 virtual void initButtons();
44 44
45 public: 45 public:
46 virtual bool suspend(); 46 virtual bool suspend();
47 47
48 virtual bool setDisplayBrightness ( int b ); 48 virtual bool setDisplayBrightness ( int b );
49 virtual int displayBrightnessResolution() const; 49 virtual int displayBrightnessResolution() const;
50}; 50};
51 51
52struct yopy_button 52struct yopy_button
53{ 53{
54 Qt::Key code; 54 Qt::Key code;
55 char *utext; 55 char *utext;
56 char *pix; 56 char *pix;
57 char *fpressedservice; 57 char *fpressedservice;
58 char *fpressedaction; 58 char *fpressedaction;
59 char *fheldservice; 59 char *fheldservice;
60 char *fheldaction; 60 char *fheldaction;
61}; 61};
62 62
63} 63}
64} 64}
65} 65}
66 66
67#endif 67#endif
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp
index 0d21f26..000d29c 100644
--- a/libopie2/opiecore/device/odevice_zaurus.cpp
+++ b/libopie2/opiecore/device/odevice_zaurus.cpp
@@ -9,97 +9,97 @@ _;:, .> :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21: = ...= . :.=- 21: = ...= . :.=-
22-. .:....=;==+<; You should have received a copy of the GNU 22-. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "odevice_zaurus.h" 30#include "odevice_zaurus.h"
31 31
32/* QT */ 32/* QT */
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37 37
38/* OPIE */ 38/* OPIE */
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43 43
44/* STD */ 44/* STD */
45#include <fcntl.h> 45#include <fcntl.h>
46#include <math.h> 46#include <math.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <signal.h> 48#include <signal.h>
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <unistd.h> 51#include <unistd.h>
52#ifndef QT_NO_SOUND 52#ifndef QT_NO_SOUND
53#include <linux/soundcard.h> 53#include <linux/soundcard.h>
54#endif 54#endif
55 55
56using namespace Opie::Core; 56using namespace Opie::Core;
57using namespace Opie::Core::Private; 57using namespace Opie::Core::Internal;
58 58
59struct z_button z_buttons [] = { 59struct z_button z_buttons [] = {
60 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 60 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
61 "devicebuttons/z_calendar", 61 "devicebuttons/z_calendar",
62 "datebook", "nextView()", 62 "datebook", "nextView()",
63 "today", "raise()" }, 63 "today", "raise()" },
64 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 64 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
65 "devicebuttons/z_contact", 65 "devicebuttons/z_contact",
66 "addressbook", "raise()", 66 "addressbook", "raise()",
67 "addressbook", "beamBusinessCard()" }, 67 "addressbook", "beamBusinessCard()" },
68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 68 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
69 "devicebuttons/z_home", 69 "devicebuttons/z_home",
70 "QPE/Launcher", "home()", 70 "QPE/Launcher", "home()",
71 "buttonsettings", "raise()" }, 71 "buttonsettings", "raise()" },
72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 72 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
73 "devicebuttons/z_menu", 73 "devicebuttons/z_menu",
74 "QPE/TaskBar", "toggleMenu()", 74 "QPE/TaskBar", "toggleMenu()",
75 "QPE/TaskBar", "toggleStartMenu()" }, 75 "QPE/TaskBar", "toggleStartMenu()" },
76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 76 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
77 "devicebuttons/z_mail", 77 "devicebuttons/z_mail",
78 "mail", "raise()", 78 "mail", "raise()",
79 "mail", "newMail()" }, 79 "mail", "newMail()" },
80}; 80};
81 81
82struct z_button z_buttons_c700 [] = { 82struct z_button z_buttons_c700 [] = {
83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 83 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
84 "devicebuttons/z_calendar", 84 "devicebuttons/z_calendar",
85 "datebook", "nextView()", 85 "datebook", "nextView()",
86 "today", "raise()" }, 86 "today", "raise()" },
87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 87 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
88 "devicebuttons/z_contact", 88 "devicebuttons/z_contact",
89 "addressbook", "raise()", 89 "addressbook", "raise()",
90 "addressbook", "beamBusinessCard()" }, 90 "addressbook", "beamBusinessCard()" },
91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 91 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
92 "devicebuttons/z_home", 92 "devicebuttons/z_home",
93 "QPE/Launcher", "home()", 93 "QPE/Launcher", "home()",
94 "buttonsettings", "raise()" }, 94 "buttonsettings", "raise()" },
95 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 95 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
96 "devicebuttons/z_menu", 96 "devicebuttons/z_menu",
97 "QPE/TaskBar", "toggleMenu()", 97 "QPE/TaskBar", "toggleMenu()",
98 "QPE/TaskBar", "toggleStartMenu()" }, 98 "QPE/TaskBar", "toggleStartMenu()" },
99 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 99 { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
100 "devicebuttons/z_hinge", 100 "devicebuttons/z_hinge",
101 "QPE/Rotation", "rotateDefault()", 101 "QPE/Rotation", "rotateDefault()",
102 "QPE/Dummy", "doNothing()" }, 102 "QPE/Dummy", "doNothing()" },
103}; 103};
104 104
105// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus 105// FIXME This gets unnecessary complicated. We should think about splitting the Zaurus
@@ -342,105 +342,105 @@ void Zaurus::buzzer ( int sound )
342 case SHARP_BUZ_TOUCHSOUND: 342 case SHARP_BUZ_TOUCHSOUND:
343 soundname = "touchsound"; 343 soundname = "touchsound";
344 break; 344 break;
345 case SHARP_BUZ_KEYSOUND: 345 case SHARP_BUZ_KEYSOUND:
346 soundname = "keysound"; 346 soundname = "keysound";
347 break; 347 break;
348 default: 348 default:
349 soundname = "alarm"; 349 soundname = "alarm";
350 350
351 } 351 }
352 } 352 }
353 353
354 // If a soundname is defined, we expect that this device has 354 // If a soundname is defined, we expect that this device has
355 // sound capabilities.. Otherwise we expect to have the buzzer 355 // sound capabilities.. Otherwise we expect to have the buzzer
356 // device.. 356 // device..
357 if ( !soundname.isEmpty() ){ 357 if ( !soundname.isEmpty() ){
358 int fd; 358 int fd;
359 int vol; 359 int vol;
360 bool vol_reset = false; 360 bool vol_reset = false;
361 361
362 Sound snd ( soundname ); 362 Sound snd ( soundname );
363 363
364 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 364 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
365 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 365 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
366 Config cfg ( "qpe" ); 366 Config cfg ( "qpe" );
367 cfg. setGroup ( "Volume" ); 367 cfg. setGroup ( "Volume" );
368 368
369 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 369 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
370 if ( volalarm < 0 ) 370 if ( volalarm < 0 )
371 volalarm = 0; 371 volalarm = 0;
372 else if ( volalarm > 100 ) 372 else if ( volalarm > 100 )
373 volalarm = 100; 373 volalarm = 100;
374 volalarm |= ( volalarm << 8 ); 374 volalarm |= ( volalarm << 8 );
375 375
376 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 376 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
377 vol_reset = true; 377 vol_reset = true;
378 } 378 }
379 } 379 }
380 380
381 snd. play(); 381 snd. play();
382 while ( !snd. isFinished()) 382 while ( !snd. isFinished())
383 qApp->processEvents(); 383 qApp->processEvents();
384 384
385 if ( fd >= 0 ) { 385 if ( fd >= 0 ) {
386 if ( vol_reset ) 386 if ( vol_reset )
387 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 387 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
388 ::close ( fd ); 388 ::close ( fd );
389 } 389 }
390 } else { 390 } else {
391 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 391 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
392 392
393 if ( fd >= 0 ) { 393 if ( fd >= 0 ) {
394 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 394 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
395 ::close ( fd ); 395 ::close ( fd );
396 } 396 }
397 397
398 } 398 }
399#endif 399#endif
400} 400}
401 401
402 402
403void Zaurus::playAlarmSound() 403void Zaurus::playAlarmSound()
404{ 404{
405 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 405 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
406} 406}
407 407
408void Zaurus::playTouchSound() 408void Zaurus::playTouchSound()
409{ 409{
410 buzzer ( SHARP_BUZ_TOUCHSOUND ); 410 buzzer ( SHARP_BUZ_TOUCHSOUND );
411} 411}
412 412
413void Zaurus::playKeySound() 413void Zaurus::playKeySound()
414{ 414{
415 buzzer ( SHARP_BUZ_KEYSOUND ); 415 buzzer ( SHARP_BUZ_KEYSOUND );
416} 416}
417 417
418 418
419QValueList <OLed> Zaurus::ledList() const 419QValueList <OLed> Zaurus::ledList() const
420{ 420{
421 QValueList <OLed> vl; 421 QValueList <OLed> vl;
422 vl << Led_Mail; 422 vl << Led_Mail;
423 return vl; 423 return vl;
424} 424}
425 425
426QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 426QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const
427{ 427{
428 QValueList <OLedState> vl; 428 QValueList <OLedState> vl;
429 429
430 if ( l == Led_Mail ) 430 if ( l == Led_Mail )
431 vl << Led_Off << Led_On << Led_BlinkSlow; 431 vl << Led_Off << Led_On << Led_BlinkSlow;
432 return vl; 432 return vl;
433} 433}
434 434
435OLedState Zaurus::ledState ( OLed which ) const 435OLedState Zaurus::ledState ( OLed which ) const
436{ 436{
437 if ( which == Led_Mail ) 437 if ( which == Led_Mail )
438 return m_leds [0]; 438 return m_leds [0];
439 else 439 else
440 return Led_Off; 440 return Led_Off;
441} 441}
442 442
443bool Zaurus::setLedState ( OLed which, OLedState st ) 443bool Zaurus::setLedState ( OLed which, OLedState st )
444{ 444{
445 if (!m_embedix) // Currently not supported on non_embedix kernels 445 if (!m_embedix) // Currently not supported on non_embedix kernels
446 return false; 446 return false;
@@ -561,99 +561,99 @@ bool Zaurus::suspend()
561{ 561{
562 qDebug("ODevice::suspend"); 562 qDebug("ODevice::suspend");
563 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 563 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
564 return false; 564 return false;
565 565
566 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 566 if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
567 return false; 567 return false;
568 568
569 bool res = false; 569 bool res = false;
570 ODevice::sendSuspendmsg(); 570 ODevice::sendSuspendmsg();
571 571
572 struct timeval tvs, tvn; 572 struct timeval tvs, tvn;
573 ::gettimeofday ( &tvs, 0 ); 573 ::gettimeofday ( &tvs, 0 );
574 574
575 ::sync(); // flush fs caches 575 ::sync(); // flush fs caches
576 res = ( ::system ( "apm --suspend" ) == 0 ); 576 res = ( ::system ( "apm --suspend" ) == 0 );
577 577
578 // This is needed because the iPAQ apm implementation is asynchronous and we 578 // This is needed because the iPAQ apm implementation is asynchronous and we
579 // can not be sure when exactly the device is really suspended 579 // can not be sure when exactly the device is really suspended
580 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 580 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
581 581
582 if ( res ) { 582 if ( res ) {
583 do { // Yes, wait 15 seconds. This APM bug sucks big time. 583 do { // Yes, wait 15 seconds. This APM bug sucks big time.
584 ::usleep ( 200 * 1000 ); 584 ::usleep ( 200 * 1000 );
585 ::gettimeofday ( &tvn, 0 ); 585 ::gettimeofday ( &tvn, 0 );
586 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 ); 586 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 15000 );
587 } 587 }
588 588
589 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" ); 589 QCopEnvelope ( "QPE/Rotation", "rotateDefault()" );
590 return res; 590 return res;
591} 591}
592 592
593 593
594Transformation Zaurus::rotation() const 594Transformation Zaurus::rotation() const
595{ 595{
596 Transformation rot; 596 Transformation rot;
597 int handle = 0; 597 int handle = 0;
598 int retval = 0; 598 int retval = 0;
599 599
600 switch ( d->m_model ) { 600 switch ( d->m_model ) {
601 case Model_Zaurus_SLC7x0: 601 case Model_Zaurus_SLC7x0:
602 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 602 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
603 if (handle == -1) { 603 if (handle == -1) {
604 return Rot270; 604 return Rot270;
605 } else { 605 } else {
606 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 606 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
607 ::close (handle); 607 ::close (handle);
608 608
609 if (retval == 2 ) 609 if (retval == 2 )
610 rot = Rot0; 610 rot = Rot0;
611 else 611 else
612 rot = Rot270; 612 rot = Rot270;
613 } 613 }
614 break; 614 break;
615 case Model_Zaurus_SLA300: 615 case Model_Zaurus_SLA300:
616 case Model_Zaurus_SLB600: 616 case Model_Zaurus_SLB600:
617 case Model_Zaurus_SL5500: 617 case Model_Zaurus_SL5500:
618 case Model_Zaurus_SL5000: 618 case Model_Zaurus_SL5000:
619 default: 619 default:
620 rot = d->m_rotation; 620 rot = d->m_rotation;
621 break; 621 break;
622 } 622 }
623 623
624 return rot; 624 return rot;
625} 625}
626ODirection Zaurus::direction() const 626ODirection Zaurus::direction() const
627{ 627{
628 ODirection dir; 628 ODirection dir;
629 int handle = 0; 629 int handle = 0;
630 int retval = 0; 630 int retval = 0;
631 switch ( d->m_model ) { 631 switch ( d->m_model ) {
632 case Model_Zaurus_SLC7x0: 632 case Model_Zaurus_SLC7x0:
633 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK); 633 handle = ::open("/dev/apm_bios", O_RDWR|O_NONBLOCK);
634 if (handle == -1) { 634 if (handle == -1) {
635 dir = CW; 635 dir = CW;
636 } else { 636 } else {
637 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION); 637 retval = ::ioctl(handle, SHARP_IOCTL_GET_ROTATION);
638 ::close (handle); 638 ::close (handle);
639 if (retval == 2 ) 639 if (retval == 2 )
640 dir = CCW; 640 dir = CCW;
641 else 641 else
642 dir = CW; 642 dir = CW;
643 } 643 }
644 break; 644 break;
645 case Model_Zaurus_SLA300: 645 case Model_Zaurus_SLA300:
646 case Model_Zaurus_SLB600: 646 case Model_Zaurus_SLB600:
647 case Model_Zaurus_SL5500: 647 case Model_Zaurus_SL5500:
648 case Model_Zaurus_SL5000: 648 case Model_Zaurus_SL5000:
649 default: 649 default:
650 dir = d->m_direction; 650 dir = d->m_direction;
651 break; 651 break;
652 } 652 }
653 return dir; 653 return dir;
654 654
655} 655}
656 656
657int Zaurus::displayBrightnessResolution() const 657int Zaurus::displayBrightnessResolution() const
658{ 658{
659 if (m_embedix) 659 if (m_embedix)
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h
index ffb648f..a0b1787 100644
--- a/libopie2/opiecore/device/odevice_zaurus.h
+++ b/libopie2/opiecore/device/odevice_zaurus.h
@@ -3,97 +3,97 @@
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef ODEVICE_ZAURUS 30#ifndef ODEVICE_ZAURUS
31#define ODEVICE_ZAURUS 31#define ODEVICE_ZAURUS
32 32
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34 34
35#ifndef ARRAY_SIZE 35#ifndef ARRAY_SIZE
36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
37#endif 37#endif
38 38
39// _IO and friends are only defined in kernel headers ... 39// _IO and friends are only defined in kernel headers ...
40 40
41#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 41#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
42 42
43#define OD_IO(type,number) OD_IOC(0,type,number,0) 43#define OD_IO(type,number) OD_IOC(0,type,number,0)
44#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 44#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
45#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 45#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
46#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 46#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
47 47
48 48
49namespace Opie { 49namespace Opie {
50namespace Core { 50namespace Core {
51namespace Private { 51namespace Internal {
52class Zaurus : public ODevice 52class Zaurus : public ODevice
53{ 53{
54 54
55 protected: 55 protected:
56 virtual void init(); 56 virtual void init();
57 virtual void initButtons(); 57 virtual void initButtons();
58 58
59 public: 59 public:
60 virtual bool setSoftSuspend ( bool soft ); 60 virtual bool setSoftSuspend ( bool soft );
61 61
62 virtual bool setDisplayBrightness ( int b ); 62 virtual bool setDisplayBrightness ( int b );
63 virtual int displayBrightnessResolution() const; 63 virtual int displayBrightnessResolution() const;
64 64
65 virtual void playAlarmSound(); 65 virtual void playAlarmSound();
66 virtual void playKeySound(); 66 virtual void playKeySound();
67 virtual void playTouchSound(); 67 virtual void playTouchSound();
68 68
69 virtual QValueList <OLed> ledList() const; 69 virtual QValueList <OLed> ledList() const;
70 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 70 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
71 virtual OLedState ledState( OLed led ) const; 71 virtual OLedState ledState( OLed led ) const;
72 virtual bool setLedState( OLed led, OLedState st ); 72 virtual bool setLedState( OLed led, OLedState st );
73 73
74 virtual bool hasHingeSensor() const; 74 virtual bool hasHingeSensor() const;
75 virtual OHingeStatus readHingeSensor(); 75 virtual OHingeStatus readHingeSensor();
76 76
77 virtual bool suspend(); 77 virtual bool suspend();
78 virtual Transformation rotation() const; 78 virtual Transformation rotation() const;
79 virtual ODirection direction() const; 79 virtual ODirection direction() const;
80 80
81 protected: 81 protected:
82 virtual void buzzer ( int snd ); 82 virtual void buzzer ( int snd );
83 83
84 OLedState m_leds [1]; 84 OLedState m_leds [1];
85 bool m_embedix; 85 bool m_embedix;
86}; 86};
87 87
88struct z_button { 88struct z_button {
89 Qt::Key code; 89 Qt::Key code;
90 char *utext; 90 char *utext;
91 char *pix; 91 char *pix;
92 char *fpressedservice; 92 char *fpressedservice;
93 char *fpressedaction; 93 char *fpressedaction;
94 char *fheldservice; 94 char *fheldservice;
95 char *fheldaction; 95 char *fheldaction;
96}; 96};
97} 97}
98} 98}
99} 99}
diff --git a/libopie2/opiecore/device/odevicebutton.cpp b/libopie2/opiecore/device/odevicebutton.cpp
index a081b7f..6974b30 100644
--- a/libopie2/opiecore/device/odevicebutton.cpp
+++ b/libopie2/opiecore/device/odevicebutton.cpp
@@ -1,189 +1,189 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) The Opie Team <opie-devel@handhelds.org> 3              Copyright (C) The Opie Team <opie-devel@handhelds.org>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qstring.h> 31#include <qstring.h>
32 32
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35 35
36 36
37namespace Opie { 37namespace Opie {
38namespace Core { 38namespace Core {
39namespace Private { 39namespace Internal {
40 40
41class OQCopMessageData 41class OQCopMessageData
42{ 42{
43 public: 43 public:
44 QCString m_channel; 44 QCString m_channel;
45 QCString m_message; 45 QCString m_message;
46 QByteArray m_data; 46 QByteArray m_data;
47}; 47};
48} 48}
49 49
50using namespace Opie::Core; 50using namespace Opie::Core;
51using namespace Opie::Core::Private; 51using Opie::Core::Internal::OQCopMessageData;
52 52
53OQCopMessage::OQCopMessage() 53OQCopMessage::OQCopMessage()
54 : d ( 0 ) 54 : d ( 0 )
55{ 55{
56 init ( QCString(), QCString(), QByteArray()); 56 init ( QCString(), QCString(), QByteArray());
57} 57}
58 58
59OQCopMessage::OQCopMessage ( const OQCopMessage &copy ) 59OQCopMessage::OQCopMessage ( const OQCopMessage &copy )
60 : d ( 0 ) 60 : d ( 0 )
61{ 61{
62 init ( copy. channel(), copy. message(), copy. data()); 62 init ( copy. channel(), copy. message(), copy. data());
63} 63}
64 64
65OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) 65OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign )
66{ 66{
67 init ( assign. channel(), assign. message(), assign. data()); 67 init ( assign. channel(), assign. message(), assign. data());
68 return *this; 68 return *this;
69} 69}
70 70
71OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg ) 71OQCopMessage::OQCopMessage ( const QCString &ch, const QCString &m, const QByteArray &arg )
72 : d ( 0 ) 72 : d ( 0 )
73{ 73{
74 init ( ch, m, arg ); 74 init ( ch, m, arg );
75} 75}
76 76
77void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg ) 77void OQCopMessage::init ( const QCString &ch, const QCString &m, const QByteArray &arg )
78{ 78{
79 if ( !d ) 79 if ( !d )
80 d = new OQCopMessageData(); 80 d = new OQCopMessageData();
81 d->m_channel = ch; 81 d->m_channel = ch;
82 d->m_message = m; 82 d->m_message = m;
83 d->m_data = arg; 83 d->m_data = arg;
84} 84}
85 85
86bool OQCopMessage::send() 86bool OQCopMessage::send()
87{ 87{
88 if ( d->m_channel. isEmpty() || d->m_message. isEmpty() ) 88 if ( d->m_channel. isEmpty() || d->m_message. isEmpty() )
89 return false; 89 return false;
90 90
91 QCopEnvelope e ( d->m_channel, d->m_message ); 91 QCopEnvelope e ( d->m_channel, d->m_message );
92 92
93 if ( d->m_data. size()) 93 if ( d->m_data. size())
94 e. writeRawBytes ( d->m_data. data(), d->m_data. size()); 94 e. writeRawBytes ( d->m_data. data(), d->m_data. size());
95 95
96 return true; 96 return true;
97} 97}
98 98
99QCString OQCopMessage::channel() const 99QCString OQCopMessage::channel() const
100{ 100{
101 return d->m_channel; 101 return d->m_channel;
102} 102}
103 103
104QCString OQCopMessage::message() const 104QCString OQCopMessage::message() const
105{ 105{
106 return d->m_message; 106 return d->m_message;
107} 107}
108 108
109QByteArray OQCopMessage::data() const 109QByteArray OQCopMessage::data() const
110{ 110{
111 return d->m_data; 111 return d->m_data;
112} 112}
113 113
114bool OQCopMessage::isNull() const 114bool OQCopMessage::isNull() const
115{ 115{
116 return d->m_message.isNull() || d->m_channel.isNull(); 116 return d->m_message.isNull() || d->m_channel.isNull();
117} 117}
118void OQCopMessage::setChannel ( const QCString &ch ) 118void OQCopMessage::setChannel ( const QCString &ch )
119{ 119{
120 d->m_channel = ch; 120 d->m_channel = ch;
121} 121}
122 122
123void OQCopMessage::setMessage ( const QCString &m ) 123void OQCopMessage::setMessage ( const QCString &m )
124{ 124{
125 d->m_message = m; 125 d->m_message = m;
126} 126}
127 127
128void OQCopMessage::setData ( const QByteArray &data ) 128void OQCopMessage::setData ( const QByteArray &data )
129{ 129{
130 d->m_data = data; 130 d->m_data = data;
131} 131}
132 132
133/*! \class Opie::Core::ODeviceButton 133/*! \class Opie::Core::ODeviceButton
134 \brief The Opie::Core::ODeviceButton class represents a physical user mappable button on a Qtopia device. 134 \brief The Opie::Core::ODeviceButton class represents a physical user mappable button on a Qtopia device.
135 135
136 This class represents a physical button on a Qtopia device. A 136 This class represents a physical button on a Qtopia device. A
137 device may have "user programmable" buttons. 137 device may have "user programmable" buttons.
138 The location and number of buttons will vary from device to 138 The location and number of buttons will vary from device to
139 device. userText() and pixmap() may be used to describe this button 139 device. userText() and pixmap() may be used to describe this button
140 to the user in help documentation. 140 to the user in help documentation.
141 141
142 \ingroup qtopiaemb 142 \ingroup qtopiaemb
143 \internal 143 \internal
144*/ 144*/
145 145
146ODeviceButton::ODeviceButton() 146ODeviceButton::ODeviceButton()
147{} 147{}
148 148
149ODeviceButton::~ODeviceButton() 149ODeviceButton::~ODeviceButton()
150{} 150{}
151 151
152/*! 152/*!
153Returns the button's keycode. 153Returns the button's keycode.
154*/ 154*/
155ushort ODeviceButton::keycode() const 155ushort ODeviceButton::keycode() const
156{ 156{
157 return m_Keycode; 157 return m_Keycode;
158} 158}
159 159
160 160
161/*! 161/*!
162This function returns a human readable, translated description of the button. 162This function returns a human readable, translated description of the button.
163*/ 163*/
164QString ODeviceButton::userText() const 164QString ODeviceButton::userText() const
165{ 165{
166 return m_UserText; 166 return m_UserText;
167} 167}
168 168
169/*! 169/*!
170This function returns the pixmap for this button. If there isn't one 170This function returns the pixmap for this button. If there isn't one
171it will return an empty (null) pixmap. 171it will return an empty (null) pixmap.
172*/ 172*/
173QPixmap ODeviceButton::pixmap() const 173QPixmap ODeviceButton::pixmap() const
174{ 174{
175 return m_Pixmap; 175 return m_Pixmap;
176} 176}
177 177
178/*! 178/*!
179This function returns the factory preset (default) action for when this button 179This function returns the factory preset (default) action for when this button
180is pressed. The return value is a legal QCop message. 180is pressed. The return value is a legal QCop message.
181*/ 181*/
182OQCopMessage ODeviceButton::factoryPresetPressedAction() const 182OQCopMessage ODeviceButton::factoryPresetPressedAction() const
183{ 183{
184 return m_FactoryPresetPressedAction; 184 return m_FactoryPresetPressedAction;
185} 185}
186 186
187/*! 187/*!
188This function returns the user assigned action for when this button is pressed. 188This function returns the user assigned action for when this button is pressed.
189If no action is assigned, factoryPresetAction() is returned. 189If no action is assigned, factoryPresetAction() is returned.
diff --git a/libopie2/opiecore/device/odevicebutton.h b/libopie2/opiecore/device/odevicebutton.h
index 4000144..e3f9ba9 100644
--- a/libopie2/opiecore/device/odevicebutton.h
+++ b/libopie2/opiecore/device/odevicebutton.h
@@ -1,105 +1,105 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef DEVICE_BUTTON_H 20#ifndef DEVICE_BUTTON_H
21#define DEVICE_BUTTON_H 21#define DEVICE_BUTTON_H
22 22
23#include <qpixmap.h> 23#include <qpixmap.h>
24#include <qstring.h> 24#include <qstring.h>
25 25
26 26
27namespace Opie{ 27namespace Opie{
28namespace Core{ 28namespace Core{
29namespace Private { 29namespace Internal {
30class OQCopMessageData; 30class OQCopMessageData;
31} 31}
32 32
33class OQCopMessage 33class OQCopMessage
34{ 34{
35public: 35public:
36 OQCopMessage ( ); 36 OQCopMessage ( );
37 OQCopMessage ( const OQCopMessage &copy ); 37 OQCopMessage ( const OQCopMessage &copy );
38 OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( )); 38 OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( ));
39 39
40 OQCopMessage &operator = ( const OQCopMessage &assign ); 40 OQCopMessage &operator = ( const OQCopMessage &assign );
41 41
42 void setChannel ( const QCString &channel ); 42 void setChannel ( const QCString &channel );
43 void setMessage ( const QCString &message ); 43 void setMessage ( const QCString &message );
44 void setData ( const QByteArray &ba ); 44 void setData ( const QByteArray &ba );
45 45
46 QCString channel ( ) const; 46 QCString channel ( ) const;
47 QCString message ( ) const; 47 QCString message ( ) const;
48 QByteArray data ( ) const; 48 QByteArray data ( ) const;
49 49
50 bool isNull()const; 50 bool isNull()const;
51 51
52 bool send ( ); 52 bool send ( );
53 53
54private: 54private:
55 void init ( const QCString &m_channel, const QCString &message, const QByteArray &args ); 55 void init ( const QCString &m_channel, const QCString &message, const QByteArray &args );
56 56
57 Private::OQCopMessageData *d; 57 Internal::OQCopMessageData *d;
58 class Private; 58 class Private;
59 Private* m_data; 59 Private* m_data;
60}; 60};
61 61
62 62
63/** 63/**
64 * This class represents a physical button on a Qtopia device. A device may 64 * This class represents a physical button on a Qtopia device. A device may
65 * have n "user programmable" buttons, which are number 1..n. The location 65 * have n "user programmable" buttons, which are number 1..n. The location
66 * and number of buttons will vary from device to device. userText() and pixmap() 66 * and number of buttons will vary from device to device. userText() and pixmap()
67 * may be used to describe this button to the user in help documentation. 67 * may be used to describe this button to the user in help documentation.
68 * 68 *
69 * @version 1.0 69 * @version 1.0
70 * @author Trolltech 70 * @author Trolltech
71 * @short A representation of buttons 71 * @short A representation of buttons
72 */ 72 */
73 73
74class ODeviceButton 74class ODeviceButton
75{ 75{
76 public: 76 public:
77 ODeviceButton(); 77 ODeviceButton();
78 virtual ~ODeviceButton(); 78 virtual ~ODeviceButton();
79 79
80 ushort keycode ( ) const; 80 ushort keycode ( ) const;
81 QString userText ( ) const; 81 QString userText ( ) const;
82 QPixmap pixmap ( ) const; 82 QPixmap pixmap ( ) const;
83 OQCopMessage factoryPresetPressedAction ( ) const; 83 OQCopMessage factoryPresetPressedAction ( ) const;
84 OQCopMessage pressedAction ( ) const; 84 OQCopMessage pressedAction ( ) const;
85 OQCopMessage factoryPresetHeldAction ( ) const; 85 OQCopMessage factoryPresetHeldAction ( ) const;
86 OQCopMessage heldAction ( ) const; 86 OQCopMessage heldAction ( ) const;
87 87
88 void setKeycode ( ushort keycode ); 88 void setKeycode ( ushort keycode );
89 void setUserText ( const QString& text ); 89 void setUserText ( const QString& text );
90 void setPixmap ( const QPixmap& picture ); 90 void setPixmap ( const QPixmap& picture );
91 void setFactoryPresetPressedAction ( const OQCopMessage& qcopMessage ); 91 void setFactoryPresetPressedAction ( const OQCopMessage& qcopMessage );
92 void setPressedAction ( const OQCopMessage& qcopMessage ); 92 void setPressedAction ( const OQCopMessage& qcopMessage );
93 void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage ); 93 void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage );
94 void setHeldAction ( const OQCopMessage& qcopMessage ); 94 void setHeldAction ( const OQCopMessage& qcopMessage );
95 95
96 private: 96 private:
97 ushort m_Keycode; 97 ushort m_Keycode;
98 QString m_UserText; 98 QString m_UserText;
99 QPixmap m_Pixmap; 99 QPixmap m_Pixmap;
100 OQCopMessage m_FactoryPresetPressedAction; 100 OQCopMessage m_FactoryPresetPressedAction;
101 OQCopMessage m_PressedAction; 101 OQCopMessage m_PressedAction;
102 OQCopMessage m_FactoryPresetHeldAction; 102 OQCopMessage m_FactoryPresetHeldAction;
103 OQCopMessage m_HeldAction; 103 OQCopMessage m_HeldAction;
104 class Private; 104 class Private;
105 Private *d; 105 Private *d;
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp
index e2f6e82..ac7cd5a 100644
--- a/libopie2/opiecore/oapplication.cpp
+++ b/libopie2/opiecore/oapplication.cpp
@@ -1,136 +1,136 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include <opie2/oapplication.h> 30#include <opie2/oapplication.h>
31#include <opie2/oconfig.h> 31#include <opie2/oconfig.h>
32#include <opie2/odebug.h> 32#include <opie2/odebug.h>
33 33
34#include <signal.h> 34#include <signal.h>
35#include <stdio.h> 35#include <stdio.h>
36 36
37using namespace Opie::Core; 37using namespace Opie::Core;
38 38
39 39
40OApplication* OApplication::_instance = 0; 40OApplication* OApplication::_instance = 0;
41 41
42/************************************************************************************************** 42/**************************************************************************************************
43 * OApplicationPrivate 43 * OApplicationPrivate
44 **************************************************************************************************/ 44 **************************************************************************************************/
45 45
46namespace Opie { 46namespace Opie {
47namespace Core { 47namespace Core {
48namespace Private { 48namespace Internal {
49class OApplicationPrivate 49class OApplicationPrivate
50{ 50{
51 public: 51 public:
52 OApplicationPrivate() {}; 52 OApplicationPrivate() {};
53 ~OApplicationPrivate() {}; 53 ~OApplicationPrivate() {};
54}; 54};
55} 55}
56 56
57/************************************************************************************************** 57/**************************************************************************************************
58 * OApplication 58 * OApplication
59 **************************************************************************************************/ 59 **************************************************************************************************/
60 60
61 61
62OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) 62OApplication::OApplication( int& argc, char** argv, const QCString& rAppName )
63 :QPEApplication( argc, argv ), 63 :QPEApplication( argc, argv ),
64 _appname( rAppName ), 64 _appname( rAppName ),
65 _config( 0 ) 65 _config( 0 )
66{ 66{
67 init(); 67 init();
68} 68}
69 69
70 70
71OApplication::~OApplication() 71OApplication::~OApplication()
72{ 72{
73 delete d; 73 delete d;
74 if ( _config ) 74 if ( _config )
75 delete _config; 75 delete _config;
76 OApplication::_instance = 0; 76 OApplication::_instance = 0;
77 // after deconstruction of the one-and-only application object, 77 // after deconstruction of the one-and-only application object,
78 // the construction of another object is allowed 78 // the construction of another object is allowed
79} 79}
80 80
81 81
82OConfig* OApplication::config() 82OConfig* OApplication::config()
83{ 83{
84 if ( !_config ) 84 if ( !_config )
85 { 85 {
86 _config = new OConfig( _appname ); 86 _config = new OConfig( _appname );
87 } 87 }
88 return _config; 88 return _config;
89} 89}
90 90
91 91
92void OApplication::init() 92void OApplication::init()
93{ 93{
94 d = new Private::OApplicationPrivate(); 94 d = new Internal::OApplicationPrivate();
95 if ( !OApplication::_instance ) 95 if ( !OApplication::_instance )
96 { 96 {
97 OApplication::_instance = this; 97 OApplication::_instance = this;
98 98
99 /* register SIGSEGV handler to give programs an option 99 /* register SIGSEGV handler to give programs an option
100 * to exit gracefully, e.g. save or close devices or files. 100 * to exit gracefully, e.g. save or close devices or files.
101 struct sigaction sa; 101 struct sigaction sa;
102 sa.sa_handler = ( void (*)(int) ) &segv_handler; 102 sa.sa_handler = ( void (*)(int) ) &segv_handler;
103 sa.sa_flags = SA_SIGINFO | SA_RESTART; 103 sa.sa_flags = SA_SIGINFO | SA_RESTART;
104 sigemptyset(&sa.sa_mask); 104 sigemptyset(&sa.sa_mask);
105 sigaction(SIGSEGV, &sa, NULL); 105 sigaction(SIGSEGV, &sa, NULL);
106 */ 106 */
107 } 107 }
108 else 108 else
109 { 109 {
110 ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl; 110 ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl;
111 //FIXME exit gracefully ? 111 //FIXME exit gracefully ?
112 ::exit( -1 ); 112 ::exit( -1 );
113 } 113 }
114} 114}
115 115
116 116
117void OApplication::showMainWidget( QWidget* widget, bool nomax ) 117void OApplication::showMainWidget( QWidget* widget, bool nomax )
118{ 118{
119 QPEApplication::showMainWidget( widget, nomax ); 119 QPEApplication::showMainWidget( widget, nomax );
120 widget->setCaption( _appname ); 120 widget->setCaption( _appname );
121} 121}
122 122
123 123
124void OApplication::setTitle( const QString& title ) const 124void OApplication::setTitle( const QString& title ) const
125{ 125{
126 if ( mainWidget() ) 126 if ( mainWidget() )
127 { 127 {
128 if ( !title.isNull() ) 128 if ( !title.isNull() )
129 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); 129 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title );
130 else 130 else
131 mainWidget()->setCaption( _appname ); 131 mainWidget()->setCaption( _appname );
132 } 132 }
133} 133}
134 134
135} 135}
136} 136}
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h
index c1e32a6..337fe5e 100644
--- a/libopie2/opiecore/oapplication.h
+++ b/libopie2/opiecore/oapplication.h
@@ -1,111 +1,111 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#ifndef OAPPLICATION_H 30#ifndef OAPPLICATION_H
31#define OAPPLICATION_H 31#define OAPPLICATION_H
32 32
33#define oApp Opie::Core::OApplication::oApplication() 33#define oApp Opie::Core::OApplication::oApplication()
34 34
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37 37
38namespace Opie { 38namespace Opie {
39namespace Core { 39namespace Core {
40namespace Private { 40namespace Internal {
41class OApplicationPrivate; 41class OApplicationPrivate;
42} // private class 42} // private class
43 43
44class OConfig; 44class OConfig;
45 45
46 46
47class OApplication : public QPEApplication 47class OApplication : public QPEApplication
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 50
51 public: 51 public:
52 /** 52 /**
53 * Constructor. Parses command-line arguments and sets the window caption. 53 * Constructor. Parses command-line arguments and sets the window caption.
54 * 54 *
55 * @param rAppName application name. Will be used for finding the 55 * @param rAppName application name. Will be used for finding the
56 * associated message, icon and configuration files 56 * associated message, icon and configuration files
57 * 57 *
58 */ 58 */
59 OApplication( int& argc, char** argv, const QCString& rAppName ); 59 OApplication( int& argc, char** argv, const QCString& rAppName );
60 /** 60 /**
61 * Destructor. Destroys the application object and its children. 61 * Destructor. Destroys the application object and its children.
62 */ 62 */
63 virtual ~OApplication(); 63 virtual ~OApplication();
64 /** 64 /**
65 * @returns the process-wide application object 65 * @returns the process-wide application object
66 * 66 *
67 * This is similar to the global @ref QApplication pointer qApp. It 67 * This is similar to the global @ref QApplication pointer qApp. It
68 * allows access to the single global OApplication object, since 68 * allows access to the single global OApplication object, since
69 * more than one cannot be created in the same application. It 69 * more than one cannot be created in the same application. It
70 * saves you the trouble of having to pass the pointer explicitly 70 * saves you the trouble of having to pass the pointer explicitly
71 * to every function that may require it. 71 * to every function that may require it.
72 */ 72 */
73 static OApplication* oApplication() { return _instance; }; 73 static OApplication* oApplication() { return _instance; };
74 /** 74 /**
75 * Returns the application name as given during creation. 75 * Returns the application name as given during creation.
76 * 76 *
77 * @returns a reference to the application name 77 * @returns a reference to the application name
78 */ 78 */
79 const QCString& appName() const { return _appname; }; 79 const QCString& appName() const { return _appname; };
80 /** 80 /**
81 * @returns the application session config object. 81 * @returns the application session config object.
82 * 82 *
83 * @see OConfig 83 * @see OConfig
84 */ 84 */
85 OConfig* config(); 85 OConfig* config();
86 /** 86 /**
87 * Shows the main @a widget and sets the name of the application as window caption. 87 * Shows the main @a widget and sets the name of the application as window caption.
88 */ 88 */
89 virtual void showMainWidget( QWidget* widget, bool nomax = false ); 89 virtual void showMainWidget( QWidget* widget, bool nomax = false );
90 /** 90 /**
91 * Set the application title. The application title will be concatenated 91 * Set the application title. The application title will be concatenated
92 * to the application name given in the constructor. 92 * to the application name given in the constructor.
93 * 93 *
94 * @param title the title. If not given, resets caption to appname 94 * @param title the title. If not given, resets caption to appname
95 */ 95 */
96 virtual void setTitle( const QString& title = QString::null ) const; 96 virtual void setTitle( const QString& title = QString::null ) const;
97 97
98 protected: 98 protected:
99 void init(); 99 void init();
100 100
101 private: 101 private:
102 const QCString _appname; 102 const QCString _appname;
103 static OApplication* _instance; 103 static OApplication* _instance;
104 OConfig* _config; 104 OConfig* _config;
105 Private::OApplicationPrivate* d; 105 Internal::OApplicationPrivate* d;
106}; 106};
107 107
108} // Core 108} // Core
109} // Opie 109} // Opie
110 110
111#endif // OAPPLICATION_H 111#endif // OAPPLICATION_H
diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h
index 29c1f86..8c3060c 100644
--- a/libopie2/opiecore/oconfig.h
+++ b/libopie2/opiecore/oconfig.h
@@ -22,133 +22,133 @@
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30*/ 30*/
31 31
32#ifndef OCONFIG_H 32#ifndef OCONFIG_H
33#define OCONFIG_H 33#define OCONFIG_H
34 34
35//FIXME: Implement for X11 or reuse libqpe/Config there also? 35//FIXME: Implement for X11 or reuse libqpe/Config there also?
36//FIXME: Or rather use QSettings also for libqpe? 36//FIXME: Or rather use QSettings also for libqpe?
37 37
38#include <qpe/config.h> 38#include <qpe/config.h>
39 39
40class QColor; 40class QColor;
41class QFont; 41class QFont;
42 42
43namespace Opie { 43namespace Opie {
44namespace Core { 44namespace Core {
45 45
46/** 46/**
47 * A Configuration class based on the Qtopia @ref Config class 47 * A Configuration class based on the Qtopia @ref Config class
48 * featuring additional handling of color and font entries 48 * featuring additional handling of color and font entries
49 */ 49 */
50 50
51class OConfig : public Config 51class OConfig : public Config
52{ 52{
53 public: 53 public:
54 /** 54 /**
55 * Constructs a OConfig object with a @a name. 55 * Constructs a OConfig object with a @a name.
56 */ 56 */
57 OConfig( const QString &name, Domain domain = User ); 57 OConfig( const QString &name, Domain domain = User );
58 /** 58 /**
59 * Destructs the OConfig object. 59 * Destructs the OConfig object.
60 * 60 *
61 * Writes back any dirty configuration entries, and destroys 61 * Writes back any dirty configuration entries, and destroys
62 * dynamically created objects. 62 * dynamically created objects.
63 */ 63 */
64 virtual ~OConfig(); 64 virtual ~OConfig();
65 /** 65 /**
66 * @returns the name of the current group. 66 * @returns the name of the current group.
67 * The current group is used for searching keys and accessing entries. 67 * The current group is used for searching keys and accessing entries.
68 * @todo make const 68 * @todo make const
69 */ 69 */
70 const QString& group() { return git.key(); }; 70 const QString& group()const { return git.key(); };
71 /** 71 /**
72 * @returns a @ref QColor entry or a @a default value if the key is not found. 72 * @returns a @ref QColor entry or a @a default value if the key is not found.
73 */ 73 */
74 QColor readColorEntry( const QString& key, const QColor* pDefault ) const; 74 QColor readColorEntry( const QString& key, const QColor* pDefault ) const;
75 /** 75 /**
76 * @returns a @ref QFont value or a @a default value if the key is not found. 76 * @returns a @ref QFont value or a @a default value if the key is not found.
77 */ 77 */
78 QFont readFontEntry( const QString& key, const QFont* pDefault ) const; 78 QFont readFontEntry( const QString& key, const QFont* pDefault ) const;
79 79
80private: 80private:
81 class Private; 81 class Private;
82 Private *d; 82 Private *d;
83}; 83};
84 84
85/** 85/**
86 * @brief Helper class for easier use of OConfig groups. 86 * @brief Helper class for easier use of OConfig groups.
87 * 87 *
88 * Careful programmers always set the group of a 88 * Careful programmers always set the group of a
89 * @ref OConfig object to the group they want to read from 89 * @ref OConfig object to the group they want to read from
90 * and set it back to the old one of afterwards. This is usually 90 * and set it back to the old one of afterwards. This is usually
91 * written as: 91 * written as:
92 * <pre> 92 * <pre>
93 * 93 *
94 * QString oldgroup config()->group(); 94 * QString oldgroup config()->group();
95 * config()->setGroup( "TheGroupThatIWant" ); 95 * config()->setGroup( "TheGroupThatIWant" );
96 * ... 96 * ...
97 * config()->writeEntry( "Blah", "Blubb" ); 97 * config()->writeEntry( "Blah", "Blubb" );
98 * 98 *
99 * config()->setGroup( oldgroup ); 99 * config()->setGroup( oldgroup );
100 * </pre> 100 * </pre>
101 * 101 *
102 * In order to facilitate this task, you can use 102 * In order to facilitate this task, you can use
103 * OConfigGroupSaver. Simply construct such an object ON THE STACK 103 * OConfigGroupSaver. Simply construct such an object ON THE STACK
104 * when you want to switch to a new group. Then, when the object goes 104 * when you want to switch to a new group. Then, when the object goes
105 * out of scope, the group will automatically be restored. If you 105 * out of scope, the group will automatically be restored. If you
106 * want to use several different groups within a function or method, 106 * want to use several different groups within a function or method,
107 * you can still use OConfigGroupSaver: Simply enclose all work with 107 * you can still use OConfigGroupSaver: Simply enclose all work with
108 * one group (including the creation of the OConfigGroupSaver object) 108 * one group (including the creation of the OConfigGroupSaver object)
109 * in one block. 109 * in one block.
110 * 110 *
111 * @author Matthias Kalle Dalheimer <Kalle@kde.org> 111 * @author Matthias Kalle Dalheimer <Kalle@kde.org>
112 * @version $Id$ 112 * @version $Id$
113 * @see OConfig 113 * @see OConfig
114 */ 114 */
115 115
116class OConfigGroupSaver 116class OConfigGroupSaver
117{ 117{
118 public: 118 public:
119 /** 119 /**
120 * Constructor. 120 * Constructor.
121 * Create the object giving a @config object and a @a group to become 121 * Create the object giving a @config object and a @a group to become
122 * the current group. 122 * the current group.
123 */ 123 */
124 OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() ) 124 OConfigGroupSaver( OConfig* config, QString group ) :_config(config), _oldgroup(config->group() )
125 { _config->setGroup( group ); } 125 { _config->setGroup( group ); }
126 126
127 OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group()) 127 OConfigGroupSaver( OConfig* config, const char *group ) :_config(config), _oldgroup(config->group())
128 { _config->setGroup( group ); } 128 { _config->setGroup( group ); }
129 129
130 OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group()) 130 OConfigGroupSaver( OConfig* config, const QCString &group ) : _config(config), _oldgroup(config->group())
131 { _config->setGroup( group ); } 131 { _config->setGroup( group ); }
132 /** 132 /**
133 * Destructor. 133 * Destructor.
134 * Restores the last current group. 134 * Restores the last current group.
135 * @todo make it not inline for bc reasons. See KDE BC guide 135 * @todo make it not inline for bc reasons. See KDE BC guide
136 */ 136 */
137 ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } 137 ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); }
138 138
139 OConfig* config() { return _config; }; 139 OConfig* config() { return _config; };
140 140
141 private: 141 private:
142 OConfig* _config; 142 OConfig* _config;
143 QString _oldgroup; 143 QString _oldgroup;
144 144
145 OConfigGroupSaver( const OConfigGroupSaver& ); 145 OConfigGroupSaver( const OConfigGroupSaver& );
146 OConfigGroupSaver& operator=( const OConfigGroupSaver& ); 146 OConfigGroupSaver& operator=( const OConfigGroupSaver& );
147 147
148 class Private; 148 class Private;
149 Private *d; 149 Private *d;
150}; 150};
151} 151}
152} 152}
153 153
154#endif // OCONFIG_H 154#endif // OCONFIG_H
diff --git a/libopie2/opiecore/odebug.cpp b/libopie2/opiecore/odebug.cpp
index cac985b..f258faa 100644
--- a/libopie2/opiecore/odebug.cpp
+++ b/libopie2/opiecore/odebug.cpp
@@ -22,96 +22,105 @@
22++=   -.     .`     .: details. 22++=   -.     .`     .: details.
23 :     =  ...= . :.=- 23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU 24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with 25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB. 26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation, 27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330, 28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA. 29 Boston, MA 02111-1307, USA.
30*/ 30*/
31 31
32// Include this header without OPIE_NO_DEBUG defined to avoid having the oDebugInfo 32// Include this header without OPIE_NO_DEBUG defined to avoid having the oDebugInfo
33// functions inlined to noops (which would then conflict with their definition here). 33// functions inlined to noops (which would then conflict with their definition here).
34 34
35#include <opie2/odebug.h> 35#include <opie2/odebug.h>
36 36
37#ifdef OPIE_NO_DEBUG 37#ifdef OPIE_NO_DEBUG
38#undef odDebug 38#undef odDebug
39#undef odBacktrace 39#undef odBacktrace
40#endif 40#endif
41 41
42/* OPIE */ 42/* OPIE */
43 43
44#include <opie2/oapplication.h> 44#include <opie2/oapplication.h>
45#include <opie2/oglobalsettings.h> 45#include <opie2/oglobalsettings.h>
46#include <opie2/oconfig.h> 46#include <opie2/oconfig.h>
47 47
48/* QT */ 48/* QT */
49 49
50#include <qfile.h> 50#include <qfile.h>
51#include <qmessagebox.h> 51#include <qmessagebox.h>
52#include <qsocketdevice.h> 52#include <qsocketdevice.h>
53 53
54/* UNIX */ 54/* UNIX */
55 55
56#include <stdlib.h> // abort 56#include <stdlib.h> // abort
57#include <unistd.h> // getpid 57#include <unistd.h> // getpid
58#include <stdarg.h> // vararg stuff 58#include <stdarg.h> // vararg stuff
59#include <ctype.h> // isprint 59#include <ctype.h> // isprint
60#include <syslog.h> 60#include <syslog.h>
61#include <errno.h> 61#include <errno.h>
62#include <string.h> 62#include <string.h>
63 63
64#ifndef OPIE_NO_BACKTRACE 64#ifndef OPIE_NO_BACKTRACE
65#include <execinfo.h> 65#include <execinfo.h>
66#endif 66#endif
67 67
68namespace Opie { 68namespace Opie {
69namespace Core { 69namespace Core {
70namespace Internal {
71class DebugBackend {
72};
73
74static DebugBackend *backEnd = 0;
75}
76static void clean_up_routine() {
77 delete Internal::backEnd;
78}
70/*====================================================================================== 79/*======================================================================================
71 * debug levels 80 * debug levels
72 *======================================================================================*/ 81 *======================================================================================*/
73 82
74enum DebugLevels { 83enum DebugLevels {
75 ODEBUG_INFO = 0, 84 ODEBUG_INFO = 0,
76 ODEBUG_WARN = 1, 85 ODEBUG_WARN = 1,
77 ODEBUG_ERROR = 2, 86 ODEBUG_ERROR = 2,
78 ODEBUG_FATAL = 3 87 ODEBUG_FATAL = 3
79}; 88};
80 89
81/*====================================================================================== 90/*======================================================================================
82 * oDebug private data 91 * oDebug private data
83 *======================================================================================*/ 92 *======================================================================================*/
84 93
85/*====================================================================================== 94/*======================================================================================
86 * the main debug function 95 * the main debug function
87 *======================================================================================*/ 96 *======================================================================================*/
88 97
89static void oDebugBackend( unsigned short level, unsigned int area, const char *data) 98static void oDebugBackend( unsigned short level, unsigned int area, const char *data)
90{ 99{
91 //qDebug( "oDebugBackend: Level=%d, Area=%d, Data=%s", level, area, data ); 100 //qDebug( "oDebugBackend: Level=%d, Area=%d, Data=%s", level, area, data );
92 101
93 // ML: OPIE doesn't use areacodes at the moment. See the KDE debug classes for an 102 // ML: OPIE doesn't use areacodes at the moment. See the KDE debug classes for an
94 // ML: example use. I think it's not necessary to implement such a strategy here. 103 // ML: example use. I think it's not necessary to implement such a strategy here.
95 // ML: Comments? 104 // ML: Comments?
96 105
97 int priority = 0; 106 int priority = 0;
98 QString caption; 107 QString caption;
99 QString lev; 108 QString lev;
100 switch( level ) 109 switch( level )
101 { 110 {
102 case ODEBUG_INFO: lev = "(Info)"; caption = "Info"; priority = LOG_INFO; break; 111 case ODEBUG_INFO: lev = "(Info)"; caption = "Info"; priority = LOG_INFO; break;
103 case ODEBUG_WARN: lev = "(Warn)"; caption = "Warning"; priority = LOG_WARNING; break; 112 case ODEBUG_WARN: lev = "(Warn)"; caption = "Warning"; priority = LOG_WARNING; break;
104 case ODEBUG_FATAL: lev = "(Fatal)"; caption = "Fatal Error"; priority = LOG_CRIT; break; 113 case ODEBUG_FATAL: lev = "(Fatal)"; caption = "Fatal Error"; priority = LOG_CRIT; break;
105 default: qDebug( "oDebugBackend: Warning: Unknown debug level! - defaulting to ODEBUG_ERROR." ); 114 default: qDebug( "oDebugBackend: Warning: Unknown debug level! - defaulting to ODEBUG_ERROR." );
106 case ODEBUG_ERROR: lev = "(Error)"; caption = "Error"; priority = LOG_ERR; break; 115 case ODEBUG_ERROR: lev = "(Error)"; caption = "Error"; priority = LOG_ERR; break;
107 } 116 }
108 117
109 short output = OGlobalSettings::debugMode(); 118 short output = OGlobalSettings::debugMode();
110 if (!oApp && (output == 1)) 119 if (!oApp && (output == 1))
111 { 120 {
112 qDebug( "oDebugBackend: Warning: no oapplication object - can't use MsgBox" ); 121 qDebug( "oDebugBackend: Warning: no oapplication object - can't use MsgBox" );
113 output = 2; // need an application object to use MsgBox 122 output = 2; // need an application object to use MsgBox
114 } 123 }
115 124
116 // gcc 2.9x is dumb and sucks... can you hear it? 125 // gcc 2.9x is dumb and sucks... can you hear it?
117 //QString areaName = (oApp) ? oApp->appName() : "<unknown>"; 126 //QString areaName = (oApp) ? oApp->appName() : "<unknown>";
@@ -577,49 +586,49 @@ odbgstream& odbgstream::operator<<( const QBrush& b)
577 *this <<b.color().name() ; 586 *this <<b.color().name() ;
578 else 587 else
579 *this <<"(invalid/default)"; 588 *this <<"(invalid/default)";
580 if ( b.pixmap() ) 589 if ( b.pixmap() )
581 *this <<" has a pixmap"; 590 *this <<" has a pixmap";
582 *this <<" ]"; 591 *this <<" ]";
583 return *this; 592 return *this;
584} 593}
585 594
586 595
587 596
588QString odBacktrace( int levels ) 597QString odBacktrace( int levels )
589{ 598{
590 QString s; 599 QString s;
591#ifndef OPIE_NO_BACKTRACE 600#ifndef OPIE_NO_BACKTRACE
592 void* trace[256]; 601 void* trace[256];
593 int n = backtrace(trace, 256); 602 int n = backtrace(trace, 256);
594 char** strings = backtrace_symbols (trace, n); 603 char** strings = backtrace_symbols (trace, n);
595 604
596 if ( levels != -1 ) 605 if ( levels != -1 )
597 n = QMIN( n, levels ); 606 n = QMIN( n, levels );
598 s = "[\n"; 607 s = "[\n";
599 608
600 for (int i = 0; i < n; ++i) 609 for (int i = 0; i < n; ++i)
601 s += QString::number(i) + 610 s += QString::number(i) +
602 QString::fromLatin1(": ") + 611 QString::fromLatin1(": ") +
603 QString::fromLatin1(strings[i]) + QString::fromLatin1("\n"); 612 QString::fromLatin1(strings[i]) + QString::fromLatin1("\n");
604 s += "]\n"; 613 s += "]\n";
605 free (strings); 614 free (strings);
606#endif 615#endif
607 return s; 616 return s;
608} 617}
609 618
610void odClearDebugConfig() 619void odClearDebugConfig()
611{ 620{
612 /* 621 /*
613 delete oDebug_data->config; 622 delete oDebug_data->config;
614 oDebug_data->config = 0; 623 oDebug_data->config = 0;
615 */ 624 */
616} 625}
617 626
618 627
619#ifdef OPIE_NO_DEBUG 628#ifdef OPIE_NO_DEBUG
620#define odDebug ondDebug 629#define odDebug ondDebug
621#define odBacktrace ondBacktrace 630#define odBacktrace ondBacktrace
622#endif 631#endif
623 632
624} 633}
625} \ No newline at end of file 634}
diff --git a/libopie2/opiecore/oprocctrl.cpp b/libopie2/opiecore/oprocctrl.cpp
index 46708ba..404e0b3 100644
--- a/libopie2/opiecore/oprocctrl.cpp
+++ b/libopie2/opiecore/oprocctrl.cpp
@@ -1,92 +1,92 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) 2 Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19// 19//
20// KPROCESSCONTROLLER -- A helper class for KProcess 20// KPROCESSCONTROLLER -- A helper class for KProcess
21// 21//
22// version 0.3.1, Jan, 8th 1997 22// version 0.3.1, Jan, 8th 1997
23// 23//
24// (C) Christian Czezatke 24// (C) Christian Czezatke
25// e9025461@student.tuwien.ac.at 25// e9025461@student.tuwien.ac.at
26// Ported by Holger Freyther 26// Ported by Holger Freyther
27// 27//
28 28
29//#include <config.h> 29//#include <config.h>
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/socket.h> 32#include <sys/socket.h>
33 33
34#include <errno.h> 34#include <errno.h>
35#include <fcntl.h> 35#include <fcntl.h>
36#include <stdio.h> 36#include <stdio.h>
37#include <string.h> 37#include <string.h>
38#include <unistd.h> 38#include <unistd.h>
39#include <assert.h> 39#include <assert.h>
40 40
41#include <qsocketnotifier.h> 41#include <qsocketnotifier.h>
42#include "oprocctrl.h" 42#include "oprocctrl.h"
43 43
44using namespace Opie::Core::Private; 44using namespace Opie::Core::Internal;
45 45
46OProcessController *OProcessController::theOProcessController = 0; 46OProcessController *OProcessController::theOProcessController = 0;
47 47
48struct sigaction OProcessController::oldChildHandlerData; 48struct sigaction OProcessController::oldChildHandlerData;
49bool OProcessController::handlerSet = false; 49bool OProcessController::handlerSet = false;
50 50
51OProcessController::OProcessController() 51OProcessController::OProcessController()
52{ 52{
53 assert( theOProcessController == 0 ); 53 assert( theOProcessController == 0 );
54 54
55 if (0 > pipe(fd)) 55 if (0 > pipe(fd))
56 printf(strerror(errno)); 56 printf(strerror(errno));
57 57
58 notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read); 58 notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read);
59 notifier->setEnabled(true); 59 notifier->setEnabled(true);
60 QObject::connect(notifier, SIGNAL(activated(int)), 60 QObject::connect(notifier, SIGNAL(activated(int)),
61 this, SLOT(slotDoHousekeeping(int))); 61 this, SLOT(slotDoHousekeeping(int)));
62 connect( &delayedChildrenCleanupTimer, SIGNAL( timeout()), 62 connect( &delayedChildrenCleanupTimer, SIGNAL( timeout()),
63 SLOT( delayedChildrenCleanup())); 63 SLOT( delayedChildrenCleanup()));
64 64
65 theOProcessController = this; 65 theOProcessController = this;
66 66
67 setupHandlers(); 67 setupHandlers();
68} 68}
69 69
70 70
71void OProcessController::setupHandlers() 71void OProcessController::setupHandlers()
72{ 72{
73 if( handlerSet ) 73 if( handlerSet )
74 return; 74 return;
75 struct sigaction act; 75 struct sigaction act;
76 act.sa_handler=theSigCHLDHandler; 76 act.sa_handler=theSigCHLDHandler;
77 sigemptyset(&(act.sa_mask)); 77 sigemptyset(&(act.sa_mask));
78 sigaddset(&(act.sa_mask), SIGCHLD); 78 sigaddset(&(act.sa_mask), SIGCHLD);
79 // Make sure we don't block this signal. gdb tends to do that :-( 79 // Make sure we don't block this signal. gdb tends to do that :-(
80 sigprocmask(SIG_UNBLOCK, &(act.sa_mask), 0); 80 sigprocmask(SIG_UNBLOCK, &(act.sa_mask), 0);
81 81
82 act.sa_flags = SA_NOCLDSTOP; 82 act.sa_flags = SA_NOCLDSTOP;
83 83
84 // CC: take care of SunOS which automatically restarts interrupted system 84 // CC: take care of SunOS which automatically restarts interrupted system
85 // calls (and thus does not have SA_RESTART) 85 // calls (and thus does not have SA_RESTART)
86 86
87#ifdef SA_RESTART 87#ifdef SA_RESTART
88 act.sa_flags |= SA_RESTART; 88 act.sa_flags |= SA_RESTART;
89#endif 89#endif
90 90
91 sigaction( SIGCHLD, &act, &oldChildHandlerData ); 91 sigaction( SIGCHLD, &act, &oldChildHandlerData );
92 92
diff --git a/libopie2/opiecore/oprocctrl.h b/libopie2/opiecore/oprocctrl.h
index 4922ba2..ea00859 100644
--- a/libopie2/opiecore/oprocctrl.h
+++ b/libopie2/opiecore/oprocctrl.h
@@ -1,90 +1,90 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) 2 Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19// 19//
20// KPROCESSCONTROLLER -- A helper class for KProcess 20// KPROCESSCONTROLLER -- A helper class for KProcess
21// 21//
22// version 0.3.1, Jan 8th 1997 22// version 0.3.1, Jan 8th 1997
23// 23//
24// (C) Christian Czezatke 24// (C) Christian Czezatke
25// e9025461@student.tuwien.ac.at 25// e9025461@student.tuwien.ac.at
26// Ported by Holger Freyther 26// Ported by Holger Freyther
27// 27//
28 28
29#ifndef __KPROCCTRL_H__ 29#ifndef __KPROCCTRL_H__
30#define __KPROCCTRL_H__ 30#define __KPROCCTRL_H__
31 31
32#include <qvaluelist.h> 32#include <qvaluelist.h>
33#include <qtimer.h> 33#include <qtimer.h>
34 34
35#include "oprocess.h" 35#include "oprocess.h"
36 36
37class QSocketNotifier; 37class QSocketNotifier;
38 38
39 39
40namespace Opie { 40namespace Opie {
41namespace Core { 41namespace Core {
42namespace Private { 42namespace Internal {
43class OProcessControllerPrivate; 43class OProcessControllerPrivate;
44 44
45/** 45/**
46 * @short Used internally by @ref OProcess 46 * @short Used internally by @ref OProcess
47 * @internal 47 * @internal
48 * @author Christian Czezakte <e9025461@student.tuwien.ac.at> 48 * @author Christian Czezakte <e9025461@student.tuwien.ac.at>
49 * 49 *
50 * A class for internal use by OProcess only. -- Exactly one instance 50 * A class for internal use by OProcess only. -- Exactly one instance
51 * of this class is generated by the first instance of OProcess that is 51 * of this class is generated by the first instance of OProcess that is
52 * created (a pointer to it gets stored in @ref theOProcessController ). 52 * created (a pointer to it gets stored in @ref theOProcessController ).
53 * 53 *
54 * This class takes care of the actual (UN*X) signal handling. 54 * This class takes care of the actual (UN*X) signal handling.
55*/ 55*/
56class OProcessController : public QObject 56class OProcessController : public QObject
57{ 57{
58 Q_OBJECT 58 Q_OBJECT
59 59
60public: 60public:
61 OProcessController(); 61 OProcessController();
62 ~OProcessController(); 62 ~OProcessController();
63 //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...) 63 //CC: WARNING! Destructor Not virtual (but you don't derive classes from this anyhow...)
64 64
65public: 65public:
66 66
67 /** 67 /**
68 * Only a single instance of this class is allowed at a time, 68 * Only a single instance of this class is allowed at a time,
69 * and this static variable is used to track the one instance. 69 * and this static variable is used to track the one instance.
70 */ 70 */
71 static OProcessController *theOProcessController; 71 static OProcessController *theOProcessController;
72 72
73 /** 73 /**
74 * Automatically called upon SIGCHLD. 74 * Automatically called upon SIGCHLD.
75 * 75 *
76 * Normally you do not need to do anything with this function but 76 * Normally you do not need to do anything with this function but
77 * if your application needs to disable SIGCHLD for some time for 77 * if your application needs to disable SIGCHLD for some time for
78 * reasons beyond your control, you should call this function afterwards 78 * reasons beyond your control, you should call this function afterwards
79 * to make sure that no SIGCHLDs where missed. 79 * to make sure that no SIGCHLDs where missed.
80 */ 80 */
81 static void theSigCHLDHandler(int signal); 81 static void theSigCHLDHandler(int signal);
82 // handler for sigchld 82 // handler for sigchld
83 83
84 /** 84 /**
85 * @internal 85 * @internal
86 */ 86 */
87 static void setupHandlers(); 87 static void setupHandlers();
88 /** 88 /**
89 * @internal 89 * @internal
90 */ 90 */
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp
index dfde74a..b3f9724 100644
--- a/libopie2/opiecore/oprocess.cpp
+++ b/libopie2/opiecore/oprocess.cpp
@@ -16,101 +16,101 @@ _;:,     .>    :=|. This program is free software; you can
16    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17   : ..    .:,     . . . without even the implied warranty of 17   : ..    .:,     . . . without even the implied warranty of
18   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22:     =  ...= . :.=- 22:     =  ...= . :.=-
23-.   .:....=;==+<; You should have received a copy of the GNU 23-.   .:....=;==+<; You should have received a copy of the GNU
24 -_. . .   )=.  = Library General Public License along with 24 -_. . .   )=.  = Library General Public License along with
25   --        :-=` this library; see the file COPYING.LIB. 25   --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include "oprocctrl.h" 31#include "oprocctrl.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/oprocess.h> 34#include <opie2/oprocess.h>
35 35
36/* QT */ 36/* QT */
37 37
38#include <qapplication.h> 38#include <qapplication.h>
39#include <qdir.h> 39#include <qdir.h>
40#include <qmap.h> 40#include <qmap.h>
41#include <qsocketnotifier.h> 41#include <qsocketnotifier.h>
42#include <qtextstream.h> 42#include <qtextstream.h>
43 43
44/* STD */ 44/* STD */
45#include <errno.h> 45#include <errno.h>
46#include <fcntl.h> 46#include <fcntl.h>
47#include <pwd.h> 47#include <pwd.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <signal.h> 49#include <signal.h>
50#include <stdio.h> 50#include <stdio.h>
51#include <string.h> 51#include <string.h>
52#include <sys/time.h> 52#include <sys/time.h>
53#include <sys/types.h> 53#include <sys/types.h>
54#include <sys/stat.h> 54#include <sys/stat.h>
55#include <sys/socket.h> 55#include <sys/socket.h>
56#include <unistd.h> 56#include <unistd.h>
57#ifdef HAVE_SYS_SELECT_H 57#ifdef HAVE_SYS_SELECT_H
58#include <sys/select.h> 58#include <sys/select.h>
59#endif 59#endif
60#ifdef HAVE_INITGROUPS 60#ifdef HAVE_INITGROUPS
61#include <grp.h> 61#include <grp.h>
62#endif 62#endif
63 63
64using namespace Opie::Core::Private; 64using namespace Opie::Core::Internal;
65 65
66namespace Opie { 66namespace Opie {
67namespace Core { 67namespace Core {
68namespace Private { 68namespace Internal {
69class OProcessPrivate 69class OProcessPrivate
70{ 70{
71public: 71public:
72 OProcessPrivate() : useShell( false ) 72 OProcessPrivate() : useShell( false )
73 { } 73 { }
74 74
75 bool useShell; 75 bool useShell;
76 QMap<QString, QString> env; 76 QMap<QString, QString> env;
77 QString wd; 77 QString wd;
78 QCString shell; 78 QCString shell;
79}; 79};
80} 80}
81 81
82OProcess::OProcess( QObject *parent, const char *name ) 82OProcess::OProcess( QObject *parent, const char *name )
83 : QObject( parent, name ) 83 : QObject( parent, name )
84{ 84{
85 init ( ); 85 init ( );
86} 86}
87 87
88OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) 88OProcess::OProcess( const QString &arg0, QObject *parent, const char *name )
89 : QObject( parent, name ) 89 : QObject( parent, name )
90{ 90{
91 init ( ); 91 init ( );
92 *this << arg0; 92 *this << arg0;
93} 93}
94 94
95OProcess::OProcess( const QStringList &args, QObject *parent, const char *name ) 95OProcess::OProcess( const QStringList &args, QObject *parent, const char *name )
96 : QObject( parent, name ) 96 : QObject( parent, name )
97{ 97{
98 init ( ); 98 init ( );
99 *this << args; 99 *this << args;
100} 100}
101 101
102void OProcess::init ( ) 102void OProcess::init ( )
103{ 103{
104 run_mode = NotifyOnExit; 104 run_mode = NotifyOnExit;
105 runs = false; 105 runs = false;
106 pid_ = 0; 106 pid_ = 0;
107 status = 0; 107 status = 0;
108 keepPrivs = false; 108 keepPrivs = false;
109 innot = 0; 109 innot = 0;
110 outnot = 0; 110 outnot = 0;
111 errnot = 0; 111 errnot = 0;
112 communication = NoCommunication; 112 communication = NoCommunication;
113 input_data = 0; 113 input_data = 0;
114 input_sent = 0; 114 input_sent = 0;
115 input_total = 0; 115 input_total = 0;
116 d = 0; 116 d = 0;
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h
index e23f98c..be1436c 100644
--- a/libopie2/opiecore/oprocess.h
+++ b/libopie2/opiecore/oprocess.h
@@ -1,97 +1,97 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3             Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org> 3             Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org>
4 Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) 5 =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at)
6 .=l. 6 .=l.
7          .>+-= 7          .>+-=
8_;:,     .>    :=|. This program is free software; you can 8_;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12- .   .-<_>     .<> Foundation; either version 2 of the License, 12- .   .-<_>     .<> Foundation; either version 2 of the License,
13    ._= =}       : or (at your option) any later version. 13    ._= =}       : or (at your option) any later version.
14   .%`+i>       _;_. 14   .%`+i>       _;_.
15   .i_,=:_.      -<s. This program is distributed in the hope that 15   .i_,=:_.      -<s. This program is distributed in the hope that
16    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17   : ..    .:,     . . . without even the implied warranty of 17   : ..    .:,     . . . without even the implied warranty of
18   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22:     =  ...= . :.=- 22:     =  ...= . :.=-
23-.   .:....=;==+<; You should have received a copy of the GNU 23-.   .:....=;==+<; You should have received a copy of the GNU
24 -_. . .   )=.  = Library General Public License along with 24 -_. . .   )=.  = Library General Public License along with
25   --        :-=` this library; see the file COPYING.LIB. 25   --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#ifndef OPROCESS_H 31#ifndef OPROCESS_H
32#define OPROCESS_H 32#define OPROCESS_H
33 33
34/* QT */ 34/* QT */
35#include <qcstring.h> 35#include <qcstring.h>
36#include <qobject.h> 36#include <qobject.h>
37#include <qvaluelist.h> 37#include <qvaluelist.h>
38 38
39/* STD */ 39/* STD */
40#include <sys/types.h> // for pid_t 40#include <sys/types.h> // for pid_t
41#include <sys/wait.h> 41#include <sys/wait.h>
42#include <signal.h> 42#include <signal.h>
43#include <unistd.h> 43#include <unistd.h>
44 44
45class QSocketNotifier; 45class QSocketNotifier;
46 46
47namespace Opie { 47namespace Opie {
48namespace Core { 48namespace Core {
49namespace Private { 49namespace Internal {
50class OProcessController; 50class OProcessController;
51class OProcessPrivate; 51class OProcessPrivate;
52} 52}
53 53
54/** 54/**
55 * Child process invocation, monitoring and control. 55 * Child process invocation, monitoring and control.
56 * 56 *
57 * @sect General usage and features 57 * @sect General usage and features
58 * 58 *
59 *This class allows a KDE and OPIE application to start child processes without having 59 *This class allows a KDE and OPIE application to start child processes without having
60 *to worry about UN*X signal handling issues and zombie process reaping. 60 *to worry about UN*X signal handling issues and zombie process reaping.
61 * 61 *
62 *@see KProcIO 62 *@see KProcIO
63 * 63 *
64 *Basically, this class distinguishes three different ways of running 64 *Basically, this class distinguishes three different ways of running
65 *child processes: 65 *child processes:
66 * 66 *
67 *@li OProcess::DontCare -- The child process is invoked and both the child 67 *@li OProcess::DontCare -- The child process is invoked and both the child
68 *process and the parent process continue concurrently. 68 *process and the parent process continue concurrently.
69 * 69 *
70 *Starting a DontCare child process means that the application is 70 *Starting a DontCare child process means that the application is
71 *not interested in any notification to determine whether the 71 *not interested in any notification to determine whether the
72 *child process has already exited or not. 72 *child process has already exited or not.
73 * 73 *
74 *@li OProcess::NotifyOnExit -- The child process is invoked and both the 74 *@li OProcess::NotifyOnExit -- The child process is invoked and both the
75 *child and the parent process run concurrently. 75 *child and the parent process run concurrently.
76 * 76 *
77 *When the child process exits, the OProcess instance 77 *When the child process exits, the OProcess instance
78 *corresponding to it emits the Qt signal @ref processExited(). 78 *corresponding to it emits the Qt signal @ref processExited().
79 * 79 *
80 *Since this signal is @em not emitted from within a UN*X 80 *Since this signal is @em not emitted from within a UN*X
81 *signal handler, arbitrary function calls can be made. 81 *signal handler, arbitrary function calls can be made.
82 * 82 *
83 *Be aware: When the OProcess objects gets destructed, the child 83 *Be aware: When the OProcess objects gets destructed, the child
84 *process will be killed if it is still running! 84 *process will be killed if it is still running!
85 *This means in particular, that you cannot use a OProcess on the stack 85 *This means in particular, that you cannot use a OProcess on the stack
86 *with OProcess::NotifyOnExit. 86 *with OProcess::NotifyOnExit.
87 * 87 *
88 *@li OProcess::Block -- The child process starts and the parent process 88 *@li OProcess::Block -- The child process starts and the parent process
89 *is suspended until the child process exits. (@em Really not recommended 89 *is suspended until the child process exits. (@em Really not recommended
90 *for programs with a GUI.) 90 *for programs with a GUI.)
91 * 91 *
92 *OProcess also provides several functions for determining the exit status 92 *OProcess also provides several functions for determining the exit status
93 *and the pid of the child process it represents. 93 *and the pid of the child process it represents.
94 * 94 *
95 *Furthermore it is possible to supply command-line arguments to the process 95 *Furthermore it is possible to supply command-line arguments to the process
96 *in a clean fashion (no null -- terminated stringlists and such...) 96 *in a clean fashion (no null -- terminated stringlists and such...)
97 * 97 *
@@ -678,84 +678,84 @@ protected:
678 */ 678 */
679 virtual void commClose(); 679 virtual void commClose();
680 680
681 681
682 /** 682 /**
683 * the socket descriptors for stdin/stdout/stderr. 683 * the socket descriptors for stdin/stdout/stderr.
684 */ 684 */
685 int out[ 2 ]; 685 int out[ 2 ];
686 int in[ 2 ]; 686 int in[ 2 ];
687 int err[ 2 ]; 687 int err[ 2 ];
688 688
689 /** 689 /**
690 * The socket notifiers for the above socket descriptors. 690 * The socket notifiers for the above socket descriptors.
691 */ 691 */
692 QSocketNotifier *innot; 692 QSocketNotifier *innot;
693 QSocketNotifier *outnot; 693 QSocketNotifier *outnot;
694 QSocketNotifier *errnot; 694 QSocketNotifier *errnot;
695 695
696 /** 696 /**
697 * Lists the communication links that are activated for the child 697 * Lists the communication links that are activated for the child
698 * process. Should not be modified from derived classes. 698 * process. Should not be modified from derived classes.
699 */ 699 */
700 Communication communication; 700 Communication communication;
701 701
702 /** 702 /**
703 * Called by "slotChildOutput" this function copies data arriving from the 703 * Called by "slotChildOutput" this function copies data arriving from the
704 * child process's stdout to the respective buffer and emits the signal 704 * child process's stdout to the respective buffer and emits the signal
705 * "@ref receivedStderr". 705 * "@ref receivedStderr".
706 */ 706 */
707 int childOutput( int fdno ); 707 int childOutput( int fdno );
708 708
709 /** 709 /**
710 * Called by "slotChildOutput" this function copies data arriving from the 710 * Called by "slotChildOutput" this function copies data arriving from the
711 * child process's stdout to the respective buffer and emits the signal 711 * child process's stdout to the respective buffer and emits the signal
712 * "@ref receivedStderr" 712 * "@ref receivedStderr"
713 */ 713 */
714 int childError( int fdno ); 714 int childError( int fdno );
715 715
716 // information about the data that has to be sent to the child: 716 // information about the data that has to be sent to the child:
717 717
718 const char *input_data; // the buffer holding the data 718 const char *input_data; // the buffer holding the data
719 int input_sent; // # of bytes already transmitted 719 int input_sent; // # of bytes already transmitted
720 int input_total; // total length of input_data 720 int input_total; // total length of input_data
721 721
722 /** 722 /**
723 * @ref OProcessController is a friend of OProcess because it has to have 723 * @ref OProcessController is a friend of OProcess because it has to have
724 * access to various data members. 724 * access to various data members.
725 */ 725 */
726 friend class Private::OProcessController; 726 friend class Internal::OProcessController;
727 727
728private: 728private:
729 /** 729 /**
730 * Searches for a valid shell. 730 * Searches for a valid shell.
731 * Here is the algorithm used for finding an executable shell: 731 * Here is the algorithm used for finding an executable shell:
732 * 732 *
733 * @li Try the executable pointed to by the "SHELL" environment 733 * @li Try the executable pointed to by the "SHELL" environment
734 * variable with white spaces stripped off 734 * variable with white spaces stripped off
735 * 735 *
736 * @li If your process runs with uid != euid or gid != egid, a shell 736 * @li If your process runs with uid != euid or gid != egid, a shell
737 * not listed in /etc/shells will not used. 737 * not listed in /etc/shells will not used.
738 * 738 *
739 * @li If no valid shell could be found, "/bin/sh" is used as a last resort. 739 * @li If no valid shell could be found, "/bin/sh" is used as a last resort.
740 */ 740 */
741 QCString searchShell(); 741 QCString searchShell();
742 742
743 /** 743 /**
744 * Used by @ref searchShell in order to find out whether the shell found 744 * Used by @ref searchShell in order to find out whether the shell found
745 * is actually executable at all. 745 * is actually executable at all.
746 */ 746 */
747 bool isExecutable( const QCString &filename ); 747 bool isExecutable( const QCString &filename );
748 748
749 // Disallow assignment and copy-construction 749 // Disallow assignment and copy-construction
750 OProcess( const OProcess& ); 750 OProcess( const OProcess& );
751 OProcess& operator= ( const OProcess& ); 751 OProcess& operator= ( const OProcess& );
752 752
753private: 753private:
754 void init ( ); 754 void init ( );
755 Private::OProcessPrivate *d; 755 Internal::OProcessPrivate *d;
756}; 756};
757} 757}
758} 758}
759 759
760#endif 760#endif
761 761