36 files changed, 212 insertions, 490 deletions
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index 27b0e53..f3e2cfb 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -51,50 +51,50 @@ _;:, .> :=|. This program is free software; you can | |||
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 | ||
61 | const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 61 | const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
62 | 62 | ||
63 | using namespace Opie; | 63 | using namespace Opie::Core; |
64 | 64 | ||
65 | ODevice *ODevice::inst() | 65 | ODevice *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 Zaurus(); | 84 | if ( line.contains( "sharp", false ) ) dev = new Private::Zaurus(); |
85 | else if ( line.contains( "ipaq", false ) ) dev = new iPAQ(); | 85 | else if ( line.contains( "ipaq", false ) ) dev = new Private::iPAQ(); |
86 | else if ( line.contains( "simpad", false ) ) dev = new SIMpad(); | 86 | else if ( line.contains( "simpad", false ) ) dev = new Private::SIMpad(); |
87 | else if ( line.contains( "jornada", false ) ) dev = new Jornada(); | 87 | else if ( line.contains( "jornada", false ) ) dev = new Private::Jornada(); |
88 | else if ( line.contains( "ramses", false ) ) dev = new Ramses(); | 88 | else if ( line.contains( "ramses", false ) ) dev = new Private::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." ); | 96 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." ); |
97 | } | 97 | } |
98 | if ( !dev ) dev = new ODevice(); | 98 | if ( !dev ) dev = new ODevice(); |
99 | dev->init(); | 99 | dev->init(); |
100 | } | 100 | } |
@@ -178,25 +178,25 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ ) | |||
178 | */ | 178 | */ |
179 | bool ODevice::suspend() | 179 | bool ODevice::suspend() |
180 | { | 180 | { |
181 | qDebug("ODevice::suspend"); | 181 | qDebug("ODevice::suspend"); |
182 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 182 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
183 | return false; | 183 | return false; |
184 | 184 | ||
185 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 185 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | bool res = false; | 188 | bool res = false; |
189 | ODevice::sendSuspendmsg(); | 189 | ODevice::sendSuspendmsg(); |
190 | 190 | ||
191 | struct timeval tvs, tvn; | 191 | struct timeval tvs, tvn; |
192 | ::gettimeofday ( &tvs, 0 ); | 192 | ::gettimeofday ( &tvs, 0 ); |
193 | 193 | ||
194 | ::sync(); // flush fs caches | 194 | ::sync(); // flush fs caches |
195 | res = ( ::system ( "apm --suspend" ) == 0 ); | 195 | res = ( ::system ( "apm --suspend" ) == 0 ); |
196 | 196 | ||
197 | // This is needed because the iPAQ apm implementation is asynchronous and we | 197 | // This is needed because the iPAQ apm implementation is asynchronous and we |
198 | // can not be sure when exactly the device is really suspended | 198 | // can not be sure when exactly the device is really suspended |
199 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 199 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
200 | 200 | ||
201 | if ( res ) { | 201 | if ( res ) { |
202 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 202 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
@@ -615,14 +615,17 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | |||
615 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); | 615 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); |
616 | 616 | ||
617 | //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); | 617 | //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); |
618 | 618 | ||
619 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 619 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
620 | } | 620 | } |
621 | void ODevice::virtual_hook(int, void* ){ | 621 | void ODevice::virtual_hook(int, void* ){ |
622 | 622 | ||
623 | } | 623 | } |
624 | 624 | ||
625 | void ODevice::sendSuspendmsg() | 625 | void ODevice::sendSuspendmsg() |
626 | { | 626 | { |
627 | if ( isQWS() ) | ||
628 | return; | ||
629 | |||
627 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); | 630 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); |
628 | } | 631 | } |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index bccb449..5ee9cca 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -31,26 +31,27 @@ _;:, .> :=|. This program is free software; you can | |||
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qstrlist.h> | 41 | #include <qstrlist.h> |
42 | 42 | ||
43 | namespace Opie | 43 | namespace Opie{ |
44 | { | 44 | namespace Core{ |
45 | |||
45 | class ODeviceData; | 46 | class ODeviceData; |
46 | /** | 47 | /** |
47 | * The available devices | 48 | * The available devices |
48 | */ | 49 | */ |
49 | enum OModel { | 50 | enum OModel { |
50 | Model_Unknown, // = 0 | 51 | Model_Unknown, // = 0 |
51 | 52 | ||
52 | Model_Series_Mask = 0xff000000, | 53 | Model_Series_Mask = 0xff000000, |
53 | 54 | ||
54 | Model_iPAQ = ( 1 << 24 ), | 55 | Model_iPAQ = ( 1 << 24 ), |
55 | 56 | ||
56 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 57 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
@@ -241,25 +242,25 @@ public: | |||
241 | 242 | ||
242 | virtual bool hasHingeSensor() const; | 243 | virtual bool hasHingeSensor() const; |
243 | virtual OHingeStatus readHingeSensor(); | 244 | virtual OHingeStatus readHingeSensor(); |
244 | 245 | ||
245 | const QStrList &allowedCpuFrequencies() const; | 246 | const QStrList &allowedCpuFrequencies() const; |
246 | bool setCurrentCpuFrequency(uint index); | 247 | bool setCurrentCpuFrequency(uint index); |
247 | 248 | ||
248 | /** | 249 | /** |
249 | * Returns the available buttons on this device. The number and location | 250 | * Returns the available buttons on this device. The number and location |
250 | * of buttons will vary depending on the device. Button numbers will be assigned | 251 | * of buttons will vary depending on the device. Button numbers will be assigned |
251 | * by the device manufacturer and will be from most preferred button to least preffered | 252 | * by the device manufacturer and will be from most preferred button to least preffered |
252 | * button. Note that this list only contains "user mappable" buttons. | 253 | * button. Note that this list only contains "user mappable" buttons. |
253 | * | 254 | * |
254 | * @todo Make method const and take care of calling initButtons or make that const too | 255 | * @todo Make method const and take care of calling initButtons or make that const too |
255 | * | 256 | * |
256 | */ | 257 | */ |
257 | const QValueList<ODeviceButton> &buttons(); | 258 | const QValueList<ODeviceButton> &buttons(); |
258 | 259 | ||
259 | /** | 260 | /** |
260 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 261 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
261 | * returns 0L | 262 | * returns 0L |
262 | */ | 263 | */ |
263 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 264 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
264 | 265 | ||
265 | /** | 266 | /** |
@@ -305,28 +306,30 @@ class ODeviceData { | |||
305 | 306 | ||
306 | QString m_sysverstr; | 307 | QString m_sysverstr; |
307 | 308 | ||
308 | Transformation m_rotation; | 309 | Transformation m_rotation; |
309 | ODirection m_direction; | 310 | ODirection m_direction; |
310 | 311 | ||
311 | QValueList <ODeviceButton> *m_buttons; | 312 | QValueList <ODeviceButton> *m_buttons; |
312 | uint m_holdtime; | 313 | uint m_holdtime; |
313 | QStrList *m_cpu_frequencies; | 314 | QStrList *m_cpu_frequencies; |
314 | }; | 315 | }; |
315 | 316 | ||
316 | } | 317 | } |
318 | } | ||
317 | 319 | ||
318 | static inline bool isQWS() | 320 | static inline bool isQWS() |
319 | { | 321 | { |
320 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 322 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
321 | } | 323 | } |
322 | 324 | ||
323 | static QCString makeChannel ( const char *str ) | 325 | static QCString makeChannel ( const char *str ) |
324 | { | 326 | { |
325 | if ( str && !::strchr ( str, '/' )) | 327 | if ( str && !::strchr ( str, '/' )) |
326 | return QCString ( "QPE/Application/" ) + str; | 328 | return QCString ( "QPE/Application/" ) + str; |
327 | else | 329 | else |
328 | return str; | 330 | return str; |
329 | } | 331 | } |
330 | 332 | ||
333 | |||
331 | #endif | 334 | #endif |
332 | 335 | ||
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 8ecea1b..177fd4c 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -44,24 +44,28 @@ | |||
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 | |||
57 | using namespace Opie::Core; | ||
58 | using namespace Opie::Core::Private; | ||
59 | |||
56 | /* KERNEL */ | 60 | /* KERNEL */ |
57 | #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 )) |
58 | 62 | ||
59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 63 | #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)) | 64 | #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)) | 65 | #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)) | 66 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
63 | 67 | ||
64 | typedef struct { | 68 | typedef struct { |
65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 69 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
66 | unsigned char TotalTime; /* Units of 5 seconds */ | 70 | unsigned char TotalTime; /* Units of 5 seconds */ |
67 | unsigned char OnTime; /* units of 100m/s */ | 71 | unsigned char OnTime; /* units of 100m/s */ |
diff --git a/libopie2/opiecore/device/odevice_ipaq.h b/libopie2/opiecore/device/odevice_ipaq.h index f512344..4f4af46 100644 --- a/libopie2/opiecore/device/odevice_ipaq.h +++ b/libopie2/opiecore/device/odevice_ipaq.h | |||
@@ -26,25 +26,27 @@ | |||
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 | ||
38 | using namespace Opie; | 38 | namespace Opie { |
39 | namespace Core { | ||
40 | namespace Private { | ||
39 | 41 | ||
40 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter | 42 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter |
41 | { | 43 | { |
42 | 44 | ||
43 | protected: | 45 | protected: |
44 | virtual void init(); | 46 | virtual void init(); |
45 | virtual void initButtons(); | 47 | virtual void initButtons(); |
46 | 48 | ||
47 | public: | 49 | public: |
48 | virtual bool setSoftSuspend( bool soft ); | 50 | virtual bool setSoftSuspend( bool soft ); |
49 | 51 | ||
50 | virtual bool setDisplayBrightness( int b ); | 52 | virtual bool setDisplayBrightness( int b ); |
@@ -72,13 +74,17 @@ class iPAQ : public ODevice, public QWSServer::KeyboardFilter | |||
72 | 74 | ||
73 | struct i_button { | 75 | struct i_button { |
74 | uint model; | 76 | uint model; |
75 | Qt::Key code; | 77 | Qt::Key code; |
76 | char *utext; | 78 | char *utext; |
77 | char *pix; | 79 | char *pix; |
78 | char *fpressedservice; | 80 | char *fpressedservice; |
79 | char *fpressedaction; | 81 | char *fpressedaction; |
80 | char *fheldservice; | 82 | char *fheldservice; |
81 | char *fheldaction; | 83 | char *fheldaction; |
82 | }; | 84 | }; |
83 | 85 | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
84 | #endif | 90 | #endif |
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 37bd6e9..b79b0b5 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -68,25 +68,25 @@ typedef struct { | |||
68 | unsigned char OffTime; /* units of 100m/s */ | 68 | unsigned char OffTime; /* units of 100m/s */ |
69 | } LED_IN; | 69 | } LED_IN; |
70 | 70 | ||
71 | typedef struct { | 71 | typedef 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 | ||
80 | using namespace Opie; | 80 | using namespace Opie::Core::Private; |
81 | 81 | ||
82 | void Jornada::init() | 82 | void 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" ); |
diff --git a/libopie2/opiecore/device/odevice_jornada.h b/libopie2/opiecore/device/odevice_jornada.h index 59be8da..c37d75e 100644 --- a/libopie2/opiecore/device/odevice_jornada.h +++ b/libopie2/opiecore/device/odevice_jornada.h | |||
@@ -23,28 +23,31 @@ | |||
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 | ||
35 | using namespace Opie; | 35 | namespace Opie { |
36 | 36 | namespace Core { | |
37 | namespace Private { | ||
37 | class Jornada : public ODevice | 38 | class Jornada : public ODevice |
38 | { | 39 | { |
39 | 40 | ||
40 | protected: | 41 | protected: |
41 | virtual void init(); | 42 | virtual void init(); |
42 | 43 | ||
43 | public: | 44 | public: |
44 | virtual bool setSoftSuspend ( bool soft ); | 45 | virtual bool setSoftSuspend ( bool soft ); |
45 | virtual bool setDisplayBrightness ( int b ); | 46 | virtual bool setDisplayBrightness ( int b ); |
46 | virtual int displayBrightnessResolution() const; | 47 | virtual int displayBrightnessResolution() const; |
47 | }; | 48 | }; |
48 | 49 | } | |
50 | } | ||
51 | } | ||
49 | #endif | 52 | #endif |
50 | 53 | ||
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp index 5bcf6a9..77de8c5 100644 --- a/libopie2/opiecore/device/odevice_ramses.cpp +++ b/libopie2/opiecore/device/odevice_ramses.cpp | |||
@@ -44,24 +44,27 @@ | |||
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 | using namespace Opie::Core; | ||
57 | using namespace Opie::Core::Private; | ||
58 | |||
56 | struct r_button ramses_buttons [] = { | 59 | struct r_button ramses_buttons [] = { |
57 | { Model_Ramses_MNCI, | 60 | { Model_Ramses_MNCI, |
58 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 61 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
59 | "devicebuttons/z_menu", | 62 | "devicebuttons/z_menu", |
60 | "QPE/TaskBar", "toggleMenu()", | 63 | "QPE/TaskBar", "toggleMenu()", |
61 | "QPE/TaskBar", "toggleStartMenu()" }, | 64 | "QPE/TaskBar", "toggleStartMenu()" }, |
62 | { Model_Ramses_MNCI, | 65 | { Model_Ramses_MNCI, |
63 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 66 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
64 | "devicebuttons/ipaq_home", | 67 | "devicebuttons/ipaq_home", |
65 | "QPE/Launcher", "home()", | 68 | "QPE/Launcher", "home()", |
66 | "buttonsettings", "raise()" }, | 69 | "buttonsettings", "raise()" }, |
67 | }; | 70 | }; |
diff --git a/libopie2/opiecore/device/odevice_ramses.h b/libopie2/opiecore/device/odevice_ramses.h index 1b660ab..e673b1a 100644 --- a/libopie2/opiecore/device/odevice_ramses.h +++ b/libopie2/opiecore/device/odevice_ramses.h | |||
@@ -25,25 +25,27 @@ | |||
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 | ||
37 | using namespace Opie; | 37 | namespace Opie { |
38 | namespace Core { | ||
39 | namespace Private { | ||
38 | 40 | ||
39 | class Ramses : public ODevice, public QWSServer::KeyboardFilter | 41 | class Ramses : public ODevice, public QWSServer::KeyboardFilter |
40 | { | 42 | { |
41 | protected: | 43 | protected: |
42 | virtual void init(); | 44 | virtual void init(); |
43 | 45 | ||
44 | public: | 46 | public: |
45 | virtual bool setSoftSuspend( bool soft ); | 47 | virtual bool setSoftSuspend( bool soft ); |
46 | virtual bool suspend(); | 48 | virtual bool suspend(); |
47 | 49 | ||
48 | virtual bool setDisplayStatus( bool on ); | 50 | virtual bool setDisplayStatus( bool on ); |
49 | virtual bool setDisplayBrightness( int b ); | 51 | virtual bool setDisplayBrightness( int b ); |
@@ -59,14 +61,17 @@ class Ramses : public ODevice, public QWSServer::KeyboardFilter | |||
59 | }; | 61 | }; |
60 | 62 | ||
61 | struct r_button { | 63 | struct r_button { |
62 | uint model; | 64 | uint model; |
63 | Qt::Key code; | 65 | Qt::Key code; |
64 | char *utext; | 66 | char *utext; |
65 | char *pix; | 67 | char *pix; |
66 | char *fpressedservice; | 68 | char *fpressedservice; |
67 | char *fpressedaction; | 69 | char *fpressedaction; |
68 | char *fheldservice; | 70 | char *fheldservice; |
69 | char *fheldaction; | 71 | char *fheldaction; |
70 | }; | 72 | }; |
73 | } | ||
74 | } | ||
75 | } | ||
71 | 76 | ||
72 | #endif | 77 | #endif |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 90aca2f..80d40a3 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -44,25 +44,26 @@ _;:, .> :=|. This program is free software; you can | |||
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 | using namespace Opie; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Private; | ||
57 | 58 | ||
58 | struct s_button simpad_buttons [] = { | 59 | struct s_button simpad_buttons [] = { |
59 | { 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, |
60 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 61 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
61 | "devicebuttons/simpad_lower_up", | 62 | "devicebuttons/simpad_lower_up", |
62 | "datebook", "nextView()", | 63 | "datebook", "nextView()", |
63 | "today", "raise()" }, | 64 | "today", "raise()" }, |
64 | { 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, |
65 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), | 66 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
66 | "devicebuttons/simpad_lower_down", | 67 | "devicebuttons/simpad_lower_down", |
67 | "addressbook", "raise()", | 68 | "addressbook", "raise()", |
68 | "addressbook", "beamBusinessCard()" }, | 69 | "addressbook", "beamBusinessCard()" }, |
diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index 3287ee8..1848151 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h | |||
@@ -26,25 +26,27 @@ | |||
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 | ||
38 | using namespace Opie; | 38 | namespace Opie { |
39 | namespace Core { | ||
40 | namespace Private { | ||
39 | 41 | ||
40 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter | 42 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter |
41 | { | 43 | { |
42 | protected: | 44 | protected: |
43 | virtual void init(); | 45 | virtual void init(); |
44 | virtual void initButtons(); | 46 | virtual void initButtons(); |
45 | 47 | ||
46 | public: | 48 | public: |
47 | virtual bool setSoftSuspend( bool soft ); | 49 | virtual bool setSoftSuspend( bool soft ); |
48 | virtual bool suspend(); | 50 | virtual bool suspend(); |
49 | 51 | ||
50 | virtual bool setDisplayStatus( bool on ); | 52 | virtual bool setDisplayStatus( bool on ); |
@@ -69,13 +71,17 @@ class SIMpad : public ODevice, public QWSServer::KeyboardFilter | |||
69 | 71 | ||
70 | struct s_button { | 72 | struct s_button { |
71 | uint model; | 73 | uint model; |
72 | Qt::Key code; | 74 | Qt::Key code; |
73 | char *utext; | 75 | char *utext; |
74 | char *pix; | 76 | char *pix; |
75 | char *fpressedservice; | 77 | char *fpressedservice; |
76 | char *fpressedaction; | 78 | char *fpressedaction; |
77 | char *fheldservice; | 79 | char *fheldservice; |
78 | char *fheldaction; | 80 | char *fheldaction; |
79 | }; | 81 | }; |
80 | 82 | ||
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||
81 | #endif | 87 | #endif |
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index d241db8..f7a4025 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp | |||
@@ -44,25 +44,26 @@ _;:, .> :=|. This program is free software; you can | |||
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 | using namespace Opie; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Private; | ||
57 | 58 | ||
58 | struct yopy_button yopy_buttons [] = { | 59 | struct yopy_button yopy_buttons [] = { |
59 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), | 60 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), |
60 | "devicebuttons/yopy_action", | 61 | "devicebuttons/yopy_action", |
61 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
62 | "today", "raise()" }, | 63 | "today", "raise()" }, |
63 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), | 64 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), |
64 | "devicebuttons/yopy_ok", | 65 | "devicebuttons/yopy_ok", |
65 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
66 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
67 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), |
68 | "devicebuttons/yopy_end", | 69 | "devicebuttons/yopy_end", |
diff --git a/libopie2/opiecore/device/odevice_yopy.h b/libopie2/opiecore/device/odevice_yopy.h index be8f62c..7d85479 100644 --- a/libopie2/opiecore/device/odevice_yopy.h +++ b/libopie2/opiecore/device/odevice_yopy.h | |||
@@ -23,26 +23,27 @@ _;:, .> :=|. This program is free software; you can | |||
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 | ||
35 | using namespace Opie; | 35 | namespace Opie { |
36 | 36 | namespace Core { | |
37 | namespace Private { | ||
37 | class Yopy : public ODevice | 38 | class Yopy : public ODevice |
38 | { | 39 | { |
39 | protected: | 40 | protected: |
40 | 41 | ||
41 | virtual void init(); | 42 | virtual void init(); |
42 | virtual void initButtons(); | 43 | virtual void initButtons(); |
43 | 44 | ||
44 | public: | 45 | public: |
45 | virtual bool suspend(); | 46 | virtual bool suspend(); |
46 | 47 | ||
47 | virtual bool setDisplayBrightness ( int b ); | 48 | virtual bool setDisplayBrightness ( int b ); |
48 | virtual int displayBrightnessResolution() const; | 49 | virtual int displayBrightnessResolution() const; |
@@ -50,13 +51,17 @@ class Yopy : public ODevice | |||
50 | 51 | ||
51 | struct yopy_button | 52 | struct yopy_button |
52 | { | 53 | { |
53 | Qt::Key code; | 54 | Qt::Key code; |
54 | char *utext; | 55 | char *utext; |
55 | char *pix; | 56 | char *pix; |
56 | char *fpressedservice; | 57 | char *fpressedservice; |
57 | char *fpressedaction; | 58 | char *fpressedaction; |
58 | char *fheldservice; | 59 | char *fheldservice; |
59 | char *fheldaction; | 60 | char *fheldaction; |
60 | }; | 61 | }; |
61 | 62 | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | |||
62 | #endif | 67 | #endif |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 8ab3cbe..0d21f26 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -44,25 +44,26 @@ _;:, .> :=|. This program is free software; you can | |||
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 | using namespace Opie; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Private; | ||
57 | 58 | ||
58 | struct z_button z_buttons [] = { | 59 | struct z_button z_buttons [] = { |
59 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 60 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
60 | "devicebuttons/z_calendar", | 61 | "devicebuttons/z_calendar", |
61 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
62 | "today", "raise()" }, | 63 | "today", "raise()" }, |
63 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 64 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
64 | "devicebuttons/z_contact", | 65 | "devicebuttons/z_contact", |
65 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
66 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
67 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
68 | "devicebuttons/z_home", | 69 | "devicebuttons/z_home", |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index f5c5172..ffb648f 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -36,26 +36,28 @@ | |||
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 | using namespace Opie; | ||
49 | 48 | ||
49 | namespace Opie { | ||
50 | namespace Core { | ||
51 | namespace Private { | ||
50 | class Zaurus : public ODevice | 52 | class Zaurus : public ODevice |
51 | { | 53 | { |
52 | 54 | ||
53 | protected: | 55 | protected: |
54 | virtual void init(); | 56 | virtual void init(); |
55 | virtual void initButtons(); | 57 | virtual void initButtons(); |
56 | 58 | ||
57 | public: | 59 | public: |
58 | virtual bool setSoftSuspend ( bool soft ); | 60 | virtual bool setSoftSuspend ( bool soft ); |
59 | 61 | ||
60 | virtual bool setDisplayBrightness ( int b ); | 62 | virtual bool setDisplayBrightness ( int b ); |
61 | virtual int displayBrightnessResolution() const; | 63 | virtual int displayBrightnessResolution() const; |
@@ -83,14 +85,16 @@ class Zaurus : public ODevice | |||
83 | bool m_embedix; | 85 | bool m_embedix; |
84 | }; | 86 | }; |
85 | 87 | ||
86 | struct z_button { | 88 | struct z_button { |
87 | Qt::Key code; | 89 | Qt::Key code; |
88 | char *utext; | 90 | char *utext; |
89 | char *pix; | 91 | char *pix; |
90 | char *fpressedservice; | 92 | char *fpressedservice; |
91 | char *fpressedaction; | 93 | char *fpressedaction; |
92 | char *fheldservice; | 94 | char *fheldservice; |
93 | char *fheldaction; | 95 | char *fheldaction; |
94 | }; | 96 | }; |
95 | 97 | } | |
98 | } | ||
99 | } | ||
96 | #endif | 100 | #endif |
diff --git a/libopie2/opiecore/device/odevicebutton.cpp b/libopie2/opiecore/device/odevicebutton.cpp index 0b593d5..a081b7f 100644 --- a/libopie2/opiecore/device/odevicebutton.cpp +++ b/libopie2/opiecore/device/odevicebutton.cpp | |||
@@ -24,34 +24,40 @@ | |||
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 | using namespace Opie; | 36 | |
37 | namespace Opie { | ||
38 | namespace Core { | ||
39 | namespace Private { | ||
37 | 40 | ||
38 | class OQCopMessageData | 41 | class OQCopMessageData |
39 | { | 42 | { |
40 | public: | 43 | public: |
41 | QCString m_channel; | 44 | QCString m_channel; |
42 | QCString m_message; | 45 | QCString m_message; |
43 | QByteArray m_data; | 46 | QByteArray m_data; |
44 | }; | 47 | }; |
48 | } | ||
45 | 49 | ||
50 | using namespace Opie::Core; | ||
51 | using namespace Opie::Core::Private; | ||
46 | 52 | ||
47 | OQCopMessage::OQCopMessage() | 53 | OQCopMessage::OQCopMessage() |
48 | : d ( 0 ) | 54 | : d ( 0 ) |
49 | { | 55 | { |
50 | init ( QCString(), QCString(), QByteArray()); | 56 | init ( QCString(), QCString(), QByteArray()); |
51 | } | 57 | } |
52 | 58 | ||
53 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) | 59 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) |
54 | : d ( 0 ) | 60 | : d ( 0 ) |
55 | { | 61 | { |
56 | init ( copy. channel(), copy. message(), copy. data()); | 62 | init ( copy. channel(), copy. message(), copy. data()); |
57 | } | 63 | } |
@@ -115,26 +121,26 @@ void OQCopMessage::setChannel ( const QCString &ch ) | |||
115 | } | 121 | } |
116 | 122 | ||
117 | void OQCopMessage::setMessage ( const QCString &m ) | 123 | void OQCopMessage::setMessage ( const QCString &m ) |
118 | { | 124 | { |
119 | d->m_message = m; | 125 | d->m_message = m; |
120 | } | 126 | } |
121 | 127 | ||
122 | void OQCopMessage::setData ( const QByteArray &data ) | 128 | void OQCopMessage::setData ( const QByteArray &data ) |
123 | { | 129 | { |
124 | d->m_data = data; | 130 | d->m_data = data; |
125 | } | 131 | } |
126 | 132 | ||
127 | /*! \class Opie::ODeviceButton | 133 | /*! \class Opie::Core::ODeviceButton |
128 | \brief The Opie::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. |
129 | 135 | ||
130 | This class represents a physical button on a Qtopia device. A | 136 | This class represents a physical button on a Qtopia device. A |
131 | device may have "user programmable" buttons. | 137 | device may have "user programmable" buttons. |
132 | The location and number of buttons will vary from device to | 138 | The location and number of buttons will vary from device to |
133 | device. userText() and pixmap() may be used to describe this button | 139 | device. userText() and pixmap() may be used to describe this button |
134 | to the user in help documentation. | 140 | to the user in help documentation. |
135 | 141 | ||
136 | \ingroup qtopiaemb | 142 | \ingroup qtopiaemb |
137 | \internal | 143 | \internal |
138 | */ | 144 | */ |
139 | 145 | ||
140 | ODeviceButton::ODeviceButton() | 146 | ODeviceButton::ODeviceButton() |
@@ -235,12 +241,15 @@ void ODeviceButton::setPressedAction(const OQCopMessage& action) | |||
235 | m_PressedAction = action; | 241 | m_PressedAction = action; |
236 | } | 242 | } |
237 | 243 | ||
238 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) | 244 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) |
239 | { | 245 | { |
240 | m_FactoryPresetHeldAction = action; | 246 | m_FactoryPresetHeldAction = action; |
241 | } | 247 | } |
242 | 248 | ||
243 | void ODeviceButton::setHeldAction(const OQCopMessage& action) | 249 | void ODeviceButton::setHeldAction(const OQCopMessage& action) |
244 | { | 250 | { |
245 | m_HeldAction = action; | 251 | m_HeldAction = action; |
246 | } | 252 | } |
253 | |||
254 | } | ||
255 | } | ||
diff --git a/libopie2/opiecore/device/odevicebutton.h b/libopie2/opiecore/device/odevicebutton.h index a66b88f..4000144 100644 --- a/libopie2/opiecore/device/odevicebutton.h +++ b/libopie2/opiecore/device/odevicebutton.h | |||
@@ -14,28 +14,30 @@ | |||
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 | class OQCopMessageData; | ||
27 | 26 | ||
28 | namespace Opie | 27 | namespace Opie{ |
29 | { | 28 | namespace Core{ |
29 | namespace Private { | ||
30 | class OQCopMessageData; | ||
31 | } | ||
30 | 32 | ||
31 | class OQCopMessage | 33 | class OQCopMessage |
32 | { | 34 | { |
33 | public: | 35 | public: |
34 | OQCopMessage ( ); | 36 | OQCopMessage ( ); |
35 | OQCopMessage ( const OQCopMessage © ); | 37 | OQCopMessage ( const OQCopMessage © ); |
36 | 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 ( )); |
37 | 39 | ||
38 | OQCopMessage &operator = ( const OQCopMessage &assign ); | 40 | OQCopMessage &operator = ( const OQCopMessage &assign ); |
39 | 41 | ||
40 | void setChannel ( const QCString &channel ); | 42 | void setChannel ( const QCString &channel ); |
41 | void setMessage ( const QCString &message ); | 43 | void setMessage ( const QCString &message ); |
@@ -43,25 +45,25 @@ public: | |||
43 | 45 | ||
44 | QCString channel ( ) const; | 46 | QCString channel ( ) const; |
45 | QCString message ( ) const; | 47 | QCString message ( ) const; |
46 | QByteArray data ( ) const; | 48 | QByteArray data ( ) const; |
47 | 49 | ||
48 | bool isNull()const; | 50 | bool isNull()const; |
49 | 51 | ||
50 | bool send ( ); | 52 | bool send ( ); |
51 | 53 | ||
52 | private: | 54 | private: |
53 | 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 ); |
54 | 56 | ||
55 | OQCopMessageData *d; | 57 | Private::OQCopMessageData *d; |
56 | class Private; | 58 | class Private; |
57 | Private* m_data; | 59 | Private* m_data; |
58 | }; | 60 | }; |
59 | 61 | ||
60 | 62 | ||
61 | /** | 63 | /** |
62 | * 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 |
63 | * 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 |
64 | * 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() |
65 | * 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. |
66 | * | 68 | * |
67 | * @version 1.0 | 69 | * @version 1.0 |
@@ -95,14 +97,15 @@ class ODeviceButton | |||
95 | ushort m_Keycode; | 97 | ushort m_Keycode; |
96 | QString m_UserText; | 98 | QString m_UserText; |
97 | QPixmap m_Pixmap; | 99 | QPixmap m_Pixmap; |
98 | OQCopMessage m_FactoryPresetPressedAction; | 100 | OQCopMessage m_FactoryPresetPressedAction; |
99 | OQCopMessage m_PressedAction; | 101 | OQCopMessage m_PressedAction; |
100 | OQCopMessage m_FactoryPresetHeldAction; | 102 | OQCopMessage m_FactoryPresetHeldAction; |
101 | OQCopMessage m_HeldAction; | 103 | OQCopMessage m_HeldAction; |
102 | class Private; | 104 | class Private; |
103 | Private *d; | 105 | Private *d; |
104 | }; | 106 | }; |
105 | 107 | ||
106 | } | 108 | } |
109 | } | ||
107 | 110 | ||
108 | #endif | 111 | #endif |
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index d340c0e..e2f6e82 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp | |||
@@ -25,36 +25,43 @@ | |||
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 | ||
37 | using namespace Opie::Core; | ||
38 | |||
39 | |||
37 | OApplication* OApplication::_instance = 0; | 40 | OApplication* OApplication::_instance = 0; |
38 | 41 | ||
39 | /************************************************************************************************** | 42 | /************************************************************************************************** |
40 | * OApplicationPrivate | 43 | * OApplicationPrivate |
41 | **************************************************************************************************/ | 44 | **************************************************************************************************/ |
42 | 45 | ||
46 | namespace Opie { | ||
47 | namespace Core { | ||
48 | namespace Private { | ||
43 | class OApplicationPrivate | 49 | class OApplicationPrivate |
44 | { | 50 | { |
45 | public: | 51 | public: |
46 | OApplicationPrivate() {}; | 52 | OApplicationPrivate() {}; |
47 | ~OApplicationPrivate() {}; | 53 | ~OApplicationPrivate() {}; |
48 | }; | 54 | }; |
55 | } | ||
49 | 56 | ||
50 | /************************************************************************************************** | 57 | /************************************************************************************************** |
51 | * OApplication | 58 | * OApplication |
52 | **************************************************************************************************/ | 59 | **************************************************************************************************/ |
53 | 60 | ||
54 | 61 | ||
55 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) | 62 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) |
56 | :QPEApplication( argc, argv ), | 63 | :QPEApplication( argc, argv ), |
57 | _appname( rAppName ), | 64 | _appname( rAppName ), |
58 | _config( 0 ) | 65 | _config( 0 ) |
59 | { | 66 | { |
60 | init(); | 67 | init(); |
@@ -75,25 +82,25 @@ OApplication::~OApplication() | |||
75 | OConfig* OApplication::config() | 82 | OConfig* OApplication::config() |
76 | { | 83 | { |
77 | if ( !_config ) | 84 | if ( !_config ) |
78 | { | 85 | { |
79 | _config = new OConfig( _appname ); | 86 | _config = new OConfig( _appname ); |
80 | } | 87 | } |
81 | return _config; | 88 | return _config; |
82 | } | 89 | } |
83 | 90 | ||
84 | 91 | ||
85 | void OApplication::init() | 92 | void OApplication::init() |
86 | { | 93 | { |
87 | d = new OApplicationPrivate(); | 94 | d = new Private::OApplicationPrivate(); |
88 | if ( !OApplication::_instance ) | 95 | if ( !OApplication::_instance ) |
89 | { | 96 | { |
90 | OApplication::_instance = this; | 97 | OApplication::_instance = this; |
91 | 98 | ||
92 | /* register SIGSEGV handler to give programs an option | 99 | /* register SIGSEGV handler to give programs an option |
93 | * to exit gracefully, e.g. save or close devices or files. | 100 | * to exit gracefully, e.g. save or close devices or files. |
94 | struct sigaction sa; | 101 | struct sigaction sa; |
95 | sa.sa_handler = ( void (*)(int) ) &segv_handler; | 102 | sa.sa_handler = ( void (*)(int) ) &segv_handler; |
96 | sa.sa_flags = SA_SIGINFO | SA_RESTART; | 103 | sa.sa_flags = SA_SIGINFO | SA_RESTART; |
97 | sigemptyset(&sa.sa_mask); | 104 | sigemptyset(&sa.sa_mask); |
98 | sigaction(SIGSEGV, &sa, NULL); | 105 | sigaction(SIGSEGV, &sa, NULL); |
99 | */ | 106 | */ |
@@ -116,12 +123,14 @@ void OApplication::showMainWidget( QWidget* widget, bool nomax ) | |||
116 | 123 | ||
117 | void OApplication::setTitle( const QString& title ) const | 124 | void OApplication::setTitle( const QString& title ) const |
118 | { | 125 | { |
119 | if ( mainWidget() ) | 126 | if ( mainWidget() ) |
120 | { | 127 | { |
121 | if ( !title.isNull() ) | 128 | if ( !title.isNull() ) |
122 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); | 129 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); |
123 | else | 130 | else |
124 | mainWidget()->setCaption( _appname ); | 131 | mainWidget()->setCaption( _appname ); |
125 | } | 132 | } |
126 | } | 133 | } |
127 | 134 | ||
135 | } | ||
136 | } | ||
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index cc506a2..c1e32a6 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h | |||
@@ -21,31 +21,35 @@ | |||
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 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 | ||
38 | 38 | namespace Opie { | |
39 | namespace Core { | ||
40 | namespace Private { | ||
39 | class OApplicationPrivate; | 41 | class OApplicationPrivate; |
42 | } // private class | ||
43 | |||
40 | class OConfig; | 44 | class OConfig; |
41 | 45 | ||
42 | 46 | ||
43 | class OApplication : public QPEApplication | 47 | class OApplication : public QPEApplication |
44 | { | 48 | { |
45 | Q_OBJECT | 49 | Q_OBJECT |
46 | 50 | ||
47 | public: | 51 | public: |
48 | /** | 52 | /** |
49 | * Constructor. Parses command-line arguments and sets the window caption. | 53 | * Constructor. Parses command-line arguments and sets the window caption. |
50 | * | 54 | * |
51 | * @param rAppName application name. Will be used for finding the | 55 | * @param rAppName application name. Will be used for finding the |
@@ -89,16 +93,19 @@ class OApplication : public QPEApplication | |||
89 | * | 93 | * |
90 | * @param title the title. If not given, resets caption to appname | 94 | * @param title the title. If not given, resets caption to appname |
91 | */ | 95 | */ |
92 | virtual void setTitle( const QString& title = QString::null ) const; | 96 | virtual void setTitle( const QString& title = QString::null ) const; |
93 | 97 | ||
94 | protected: | 98 | protected: |
95 | void init(); | 99 | void init(); |
96 | 100 | ||
97 | private: | 101 | private: |
98 | const QCString _appname; | 102 | const QCString _appname; |
99 | static OApplication* _instance; | 103 | static OApplication* _instance; |
100 | OConfig* _config; | 104 | OConfig* _config; |
101 | OApplicationPrivate* d; | 105 | Private::OApplicationPrivate* d; |
102 | }; | 106 | }; |
103 | 107 | ||
108 | } // Core | ||
109 | } // Opie | ||
110 | |||
104 | #endif // OAPPLICATION_H | 111 | #endif // OAPPLICATION_H |
diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp index fb5eabb..05d8070 100644 --- a/libopie2/opiecore/oconfig.cpp +++ b/libopie2/opiecore/oconfig.cpp | |||
@@ -29,24 +29,26 @@ | |||
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | 33 | ||
34 | #include <qfont.h> | 34 | #include <qfont.h> |
35 | #include <qcolor.h> | 35 | #include <qcolor.h> |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | 38 | ||
39 | #include <opie2/oconfig.h> | 39 | #include <opie2/oconfig.h> |
40 | 40 | ||
41 | using namespace Opie::Core; | ||
42 | |||
41 | OConfig::OConfig( const QString &name, Domain domain ) | 43 | OConfig::OConfig( const QString &name, Domain domain ) |
42 | :Config( name, domain ) | 44 | :Config( name, domain ) |
43 | { | 45 | { |
44 | qDebug( "OConfig::OConfig()" ); | 46 | qDebug( "OConfig::OConfig()" ); |
45 | } | 47 | } |
46 | 48 | ||
47 | OConfig::~OConfig() | 49 | OConfig::~OConfig() |
48 | { | 50 | { |
49 | qDebug( "OConfig::~OConfig()" ); | 51 | qDebug( "OConfig::~OConfig()" ); |
50 | } | 52 | } |
51 | 53 | ||
52 | QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const | 54 | QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const |
diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h index becf70d..29c1f86 100644 --- a/libopie2/opiecore/oconfig.h +++ b/libopie2/opiecore/oconfig.h | |||
@@ -31,56 +31,64 @@ | |||
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 | ||
40 | class QColor; | 40 | class QColor; |
41 | class QFont; | 41 | class QFont; |
42 | 42 | ||
43 | namespace Opie { | ||
44 | namespace Core { | ||
45 | |||
43 | /** | 46 | /** |
44 | * A Configuration class based on the Qtopia @ref Config class | 47 | * A Configuration class based on the Qtopia @ref Config class |
45 | * featuring additional handling of color and font entries | 48 | * featuring additional handling of color and font entries |
46 | */ | 49 | */ |
47 | 50 | ||
48 | class OConfig : public Config | 51 | class OConfig : public Config |
49 | { | 52 | { |
50 | public: | 53 | public: |
51 | /** | 54 | /** |
52 | * Constructs a OConfig object with a @a name. | 55 | * Constructs a OConfig object with a @a name. |
53 | */ | 56 | */ |
54 | OConfig( const QString &name, Domain domain = User ); | 57 | OConfig( const QString &name, Domain domain = User ); |
55 | /** | 58 | /** |
56 | * Destructs the OConfig object. | 59 | * Destructs the OConfig object. |
57 | * | 60 | * |
58 | * Writes back any dirty configuration entries, and destroys | 61 | * Writes back any dirty configuration entries, and destroys |
59 | * dynamically created objects. | 62 | * dynamically created objects. |
60 | */ | 63 | */ |
61 | virtual ~OConfig(); | 64 | virtual ~OConfig(); |
62 | /** | 65 | /** |
63 | * @returns the name of the current group. | 66 | * @returns the name of the current group. |
64 | * 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 | ||
65 | */ | 69 | */ |
66 | const QString& group() { return git.key(); }; | 70 | const QString& group() { return git.key(); }; |
67 | /** | 71 | /** |
68 | * @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. |
69 | */ | 73 | */ |
70 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; | 74 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; |
71 | /** | 75 | /** |
72 | * @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. |
73 | */ | 77 | */ |
74 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; | 78 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; |
79 | |||
80 | private: | ||
81 | class Private; | ||
82 | Private *d; | ||
75 | }; | 83 | }; |
76 | 84 | ||
77 | /** | 85 | /** |
78 | * @brief Helper class for easier use of OConfig groups. | 86 | * @brief Helper class for easier use of OConfig groups. |
79 | * | 87 | * |
80 | * Careful programmers always set the group of a | 88 | * Careful programmers always set the group of a |
81 | * @ref OConfig object to the group they want to read from | 89 | * @ref OConfig object to the group they want to read from |
82 | * 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 |
83 | * written as: | 91 | * written as: |
84 | * <pre> | 92 | * <pre> |
85 | * | 93 | * |
86 | * QString oldgroup config()->group(); | 94 | * QString oldgroup config()->group(); |
@@ -127,15 +135,20 @@ class OConfigGroupSaver | |||
127 | * @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 |
128 | */ | 136 | */ |
129 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } | 137 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } |
130 | 138 | ||
131 | OConfig* config() { return _config; }; | 139 | OConfig* config() { return _config; }; |
132 | 140 | ||
133 | private: | 141 | private: |
134 | OConfig* _config; | 142 | OConfig* _config; |
135 | QString _oldgroup; | 143 | QString _oldgroup; |
136 | 144 | ||
137 | OConfigGroupSaver( const OConfigGroupSaver& ); | 145 | OConfigGroupSaver( const OConfigGroupSaver& ); |
138 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); | 146 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); |
147 | |||
148 | class Private; | ||
149 | Private *d; | ||
139 | }; | 150 | }; |
151 | } | ||
152 | } | ||
140 | 153 | ||
141 | #endif // OCONFIG_H | 154 | #endif // OCONFIG_H |
diff --git a/libopie2/opiecore/odebug.cpp b/libopie2/opiecore/odebug.cpp index a40ef53..cac985b 100644 --- a/libopie2/opiecore/odebug.cpp +++ b/libopie2/opiecore/odebug.cpp | |||
@@ -56,25 +56,26 @@ | |||
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 | ||
68 | 68 | namespace Opie { | |
69 | namespace Core { | ||
69 | /*====================================================================================== | 70 | /*====================================================================================== |
70 | * debug levels | 71 | * debug levels |
71 | *======================================================================================*/ | 72 | *======================================================================================*/ |
72 | 73 | ||
73 | enum DebugLevels { | 74 | enum DebugLevels { |
74 | ODEBUG_INFO = 0, | 75 | ODEBUG_INFO = 0, |
75 | ODEBUG_WARN = 1, | 76 | ODEBUG_WARN = 1, |
76 | ODEBUG_ERROR = 2, | 77 | ODEBUG_ERROR = 2, |
77 | ODEBUG_FATAL = 3 | 78 | ODEBUG_FATAL = 3 |
78 | }; | 79 | }; |
79 | 80 | ||
80 | /*====================================================================================== | 81 | /*====================================================================================== |
@@ -605,16 +606,20 @@ QString odBacktrace( int levels ) | |||
605 | #endif | 606 | #endif |
606 | return s; | 607 | return s; |
607 | } | 608 | } |
608 | 609 | ||
609 | void odClearDebugConfig() | 610 | void odClearDebugConfig() |
610 | { | 611 | { |
611 | /* | 612 | /* |
612 | delete oDebug_data->config; | 613 | delete oDebug_data->config; |
613 | oDebug_data->config = 0; | 614 | oDebug_data->config = 0; |
614 | */ | 615 | */ |
615 | } | 616 | } |
616 | 617 | ||
618 | |||
617 | #ifdef OPIE_NO_DEBUG | 619 | #ifdef OPIE_NO_DEBUG |
618 | #define odDebug ondDebug | 620 | #define odDebug ondDebug |
619 | #define odBacktrace ondBacktrace | 621 | #define odBacktrace ondBacktrace |
620 | #endif | 622 | #endif |
623 | |||
624 | } | ||
625 | } \ No newline at end of file | ||
diff --git a/libopie2/opiecore/odebug.h b/libopie2/opiecore/odebug.h index 85941fd..a5c9ded 100644 --- a/libopie2/opiecore/odebug.h +++ b/libopie2/opiecore/odebug.h | |||
@@ -38,24 +38,27 @@ | |||
38 | class QWidget; | 38 | class QWidget; |
39 | class QDateTime; | 39 | class QDateTime; |
40 | class QDate; | 40 | class QDate; |
41 | class QTime; | 41 | class QTime; |
42 | class QPoint; | 42 | class QPoint; |
43 | class QSize; | 43 | class QSize; |
44 | class QRect; | 44 | class QRect; |
45 | class QRegion; | 45 | class QRegion; |
46 | class QStringList; | 46 | class QStringList; |
47 | class QColor; | 47 | class QColor; |
48 | class QBrush; | 48 | class QBrush; |
49 | 49 | ||
50 | namespace Opie { | ||
51 | namespace Core { | ||
52 | |||
50 | class odbgstream; | 53 | class odbgstream; |
51 | class ondbgstream; | 54 | class ondbgstream; |
52 | 55 | ||
53 | #ifdef __GNUC__ | 56 | #ifdef __GNUC__ |
54 | #define o_funcinfo "[" << __PRETTY_FUNCTION__ << "] " | 57 | #define o_funcinfo "[" << __PRETTY_FUNCTION__ << "] " |
55 | #else | 58 | #else |
56 | #define o_funcinfo "[" << __FILE__ << ":" << __LINE__ << "] " | 59 | #define o_funcinfo "[" << __FILE__ << ":" << __LINE__ << "] " |
57 | #endif | 60 | #endif |
58 | 61 | ||
59 | #define o_lineinfo "[" << __FILE__ << ":" << __LINE__ << "] " | 62 | #define o_lineinfo "[" << __FILE__ << ":" << __LINE__ << "] " |
60 | 63 | ||
61 | #define owarn odWarning() | 64 | #define owarn odWarning() |
@@ -385,24 +388,28 @@ class ondbgstream { | |||
385 | ondbgstream &form(const char *, ...) { return *this; } | 388 | ondbgstream &form(const char *, ...) { return *this; } |
386 | 389 | ||
387 | ondbgstream& operator<<( const QDateTime& ) { return *this; } | 390 | ondbgstream& operator<<( const QDateTime& ) { return *this; } |
388 | ondbgstream& operator<<( const QDate& ) { return *this; } | 391 | ondbgstream& operator<<( const QDate& ) { return *this; } |
389 | ondbgstream& operator<<( const QTime& ) { return *this; } | 392 | ondbgstream& operator<<( const QTime& ) { return *this; } |
390 | ondbgstream& operator<<( const QPoint & ) { return *this; } | 393 | ondbgstream& operator<<( const QPoint & ) { return *this; } |
391 | ondbgstream& operator<<( const QSize & ) { return *this; } | 394 | ondbgstream& operator<<( const QSize & ) { return *this; } |
392 | ondbgstream& operator<<( const QRect & ) { return *this; } | 395 | ondbgstream& operator<<( const QRect & ) { return *this; } |
393 | ondbgstream& operator<<( const QRegion & ) { return *this; } | 396 | ondbgstream& operator<<( const QRegion & ) { return *this; } |
394 | ondbgstream& operator<<( const QStringList & ) { return *this; } | 397 | ondbgstream& operator<<( const QStringList & ) { return *this; } |
395 | ondbgstream& operator<<( const QColor & ) { return *this; } | 398 | ondbgstream& operator<<( const QColor & ) { return *this; } |
396 | ondbgstream& operator<<( const QBrush & ) { return *this; } | 399 | ondbgstream& operator<<( const QBrush & ) { return *this; } |
400 | |||
401 | private: | ||
402 | class Private; | ||
403 | Private *d; | ||
397 | }; | 404 | }; |
398 | 405 | ||
399 | /*====================================================================================== | 406 | /*====================================================================================== |
400 | * related functions | 407 | * related functions |
401 | *======================================================================================*/ | 408 | *======================================================================================*/ |
402 | 409 | ||
403 | /** | 410 | /** |
404 | * Does nothing. | 411 | * Does nothing. |
405 | * @param a stream | 412 | * @param a stream |
406 | * @return the given @p s | 413 | * @return the given @p s |
407 | */ | 414 | */ |
408 | inline ondbgstream& endl( ondbgstream & s) { return s; } | 415 | inline ondbgstream& endl( ondbgstream & s) { return s; } |
@@ -463,12 +470,14 @@ odbgstream odFatal(bool cond, int area = 0); | |||
463 | * Deletes the odebugrc cache and therefore forces KDebug to reread the | 470 | * Deletes the odebugrc cache and therefore forces KDebug to reread the |
464 | * config file | 471 | * config file |
465 | */ | 472 | */ |
466 | void odClearDebugConfig(); | 473 | void odClearDebugConfig(); |
467 | 474 | ||
468 | #ifdef OPIE_NO_DEBUG | 475 | #ifdef OPIE_NO_DEBUG |
469 | #define odDebug ondDebug | 476 | #define odDebug ondDebug |
470 | #define odBacktrace ondBacktrace | 477 | #define odBacktrace ondBacktrace |
471 | #endif | 478 | #endif |
472 | 479 | ||
473 | #endif | 480 | #endif |
474 | 481 | ||
482 | } | ||
483 | } | ||
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp index 1aa206e..ea02058 100644 --- a/libopie2/opiecore/oglobal.cpp +++ b/libopie2/opiecore/oglobal.cpp | |||
@@ -29,24 +29,26 @@ | |||
29 | 29 | ||
30 | #include <opie2/oglobal.h> | 30 | #include <opie2/oglobal.h> |
31 | 31 | ||
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qdir.h> | 33 | #include <qdir.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
37 | 37 | ||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | 40 | ||
41 | using namespace Opie::Core; | ||
42 | |||
41 | static const char Base64EncMap[64] = | 43 | static const char Base64EncMap[64] = |
42 | { | 44 | { |
43 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, | 45 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, |
44 | 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, | 46 | 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, |
45 | 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | 47 | 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, |
46 | 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, | 48 | 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, |
47 | 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, | 49 | 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, |
48 | 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, | 50 | 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, |
49 | 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, | 51 | 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, |
50 | 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F | 52 | 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F |
51 | }; | 53 | }; |
52 | 54 | ||
@@ -303,36 +305,36 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) { | |||
303 | if (++didx < len ) | 305 | if (++didx < len ) |
304 | out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); | 306 | out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); |
305 | 307 | ||
306 | // Resize the output buffer | 308 | // Resize the output buffer |
307 | if ( len == 0 || len < out.size() ) | 309 | if ( len == 0 || len < out.size() ) |
308 | out.resize(len); | 310 | out.resize(len); |
309 | 311 | ||
310 | return out; | 312 | return out; |
311 | } | 313 | } |
312 | 314 | ||
313 | bool OGlobal::isAppLnkFileName( const QString& str ) | 315 | bool OGlobal::isAppLnkFileName( const QString& str ) |
314 | { | 316 | { |
315 | if (str.length()==0||str.at(str.length()-1)==QDir::separator()) return false; | 317 | if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false; |
316 | return str.startsWith(MimeType::appsFolderName()+QDir::separator()); | 318 | return str.startsWith(MimeType::appsFolderName()+QDir::separator()); |
317 | } | 319 | } |
318 | 320 | ||
319 | /* ToDo: | 321 | /* ToDo: |
320 | * This fun should check the document-path value for the mounted media | 322 | * This fun should check the document-path value for the mounted media |
321 | * which has to be implemented later. this moment we just check for a | 323 | * which has to be implemented later. this moment we just check for a |
322 | * mounted media name. | 324 | * mounted media name. |
323 | */ | 325 | */ |
324 | bool OGlobal::isDocumentFileName( const QString& file ) | 326 | bool OGlobal::isDocumentFileName( const QString& file ) |
325 | { | 327 | { |
326 | if (file.length()==0||file.at(file.length()-1)==QDir::separator()) return false; | 328 | if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false; |
327 | if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; | 329 | if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; |
328 | StorageInfo si; | 330 | StorageInfo si; |
329 | QList< FileSystem > fl = si.fileSystems(); | 331 | QList< FileSystem > fl = si.fileSystems(); |
330 | FileSystem*fs; | 332 | FileSystem*fs; |
331 | for (fs = fl.first();fs!=0;fs=fl.next()) { | 333 | for (fs = fl.first();fs!=0;fs=fl.next()) { |
332 | if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) | 334 | if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) |
333 | return true; | 335 | return true; |
334 | } | 336 | } |
335 | if (file.startsWith(homeDirPath())+"/Documents/") return true; | 337 | if (file.startsWith(homeDirPath())+"/Documents/") return true; |
336 | return false; | 338 | return false; |
337 | } | 339 | } |
338 | 340 | ||
diff --git a/libopie2/opiecore/oglobal.h b/libopie2/opiecore/oglobal.h index aeee75e..e6a6c46 100644 --- a/libopie2/opiecore/oglobal.h +++ b/libopie2/opiecore/oglobal.h | |||
@@ -43,24 +43,29 @@ | |||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
46 | 46 | ||
47 | //FIXME Is it wise or even necessary to inherit OGlobal from Global? | 47 | //FIXME Is it wise or even necessary to inherit OGlobal from Global? |
48 | // once we totally skip libqpe it should ideally swallow Global -zecke | 48 | // once we totally skip libqpe it should ideally swallow Global -zecke |
49 | // You're right. I deleted global as the base class. -mickeyl | 49 | // You're right. I deleted global as the base class. -mickeyl |
50 | 50 | ||
51 | 51 | ||
52 | class QFile; | 52 | class QFile; |
53 | class QString; | 53 | class QString; |
54 | class DateFormat; | 54 | class DateFormat; |
55 | |||
56 | |||
57 | |||
58 | namespace Opie { | ||
59 | namespace Core { | ||
55 | /** | 60 | /** |
56 | *\brief OGlobal contains a list of generic functions | 61 | *\brief OGlobal contains a list of generic functions |
57 | * | 62 | * |
58 | * The class OGlobal contains small utility functions | 63 | * The class OGlobal contains small utility functions |
59 | * which might be useful for other applications to use. It features access | 64 | * which might be useful for other applications to use. It features access |
60 | * to the global device config and specialized functions to get information | 65 | * to the global device config and specialized functions to get information |
61 | * out of this config like Weekstart or Owner name. | 66 | * out of this config like Weekstart or Owner name. |
62 | * | 67 | * |
63 | * @todo ODP implement the things from Global which are good | 68 | * @todo ODP implement the things from Global which are good |
64 | * @author mickey,alwin,zecke | 69 | * @author mickey,alwin,zecke |
65 | * @version 0.1 | 70 | * @version 0.1 |
66 | */ | 71 | */ |
@@ -137,15 +142,18 @@ public: | |||
137 | static void setWeekStartsOnMonday( bool ); | 142 | static void setWeekStartsOnMonday( bool ); |
138 | static void setUseAMPM( bool ); | 143 | static void setUseAMPM( bool ); |
139 | //@} | 144 | //@} |
140 | 145 | ||
141 | //@{ | 146 | //@{ |
142 | static Global::Command* builtinCommands(); | 147 | static Global::Command* builtinCommands(); |
143 | static QGuardedPtr<QWidget>* builtinRunning(); | 148 | static QGuardedPtr<QWidget>* builtinRunning(); |
144 | //@} | 149 | //@} |
145 | 150 | ||
146 | private: | 151 | private: |
147 | static OConfig* _config; | 152 | static OConfig* _config; |
148 | static OConfig* _qpe_config; | 153 | static OConfig* _qpe_config; |
154 | class Private; | ||
155 | Private *d; | ||
149 | }; | 156 | }; |
150 | 157 | } | |
158 | } | ||
151 | #endif // OGLOBAL_H | 159 | #endif // OGLOBAL_H |
diff --git a/libopie2/opiecore/oglobalsettings.cpp b/libopie2/opiecore/oglobalsettings.cpp index 192e55b..f34c531 100644 --- a/libopie2/opiecore/oglobalsettings.cpp +++ b/libopie2/opiecore/oglobalsettings.cpp | |||
@@ -35,24 +35,27 @@ | |||
35 | #include <opie2/oglobalsettings.h> | 35 | #include <opie2/oglobalsettings.h> |
36 | #include <opie2/oconfig.h> | 36 | #include <opie2/oconfig.h> |
37 | #include <opie2/oglobal.h> | 37 | #include <opie2/oglobal.h> |
38 | 38 | ||
39 | /* QT */ | 39 | /* QT */ |
40 | 40 | ||
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | 42 | ||
43 | /* UNIX */ | 43 | /* UNIX */ |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | |||
48 | using namespace Opie::Core; | ||
49 | |||
47 | QString* OGlobalSettings::s_desktopPath = 0; | 50 | QString* OGlobalSettings::s_desktopPath = 0; |
48 | QString* OGlobalSettings::s_autostartPath = 0; | 51 | QString* OGlobalSettings::s_autostartPath = 0; |
49 | QString* OGlobalSettings::s_trashPath = 0; | 52 | QString* OGlobalSettings::s_trashPath = 0; |
50 | QString* OGlobalSettings::s_documentPath = 0; | 53 | QString* OGlobalSettings::s_documentPath = 0; |
51 | QFont *OGlobalSettings::_generalFont = 0; | 54 | QFont *OGlobalSettings::_generalFont = 0; |
52 | QFont *OGlobalSettings::_fixedFont = 0; | 55 | QFont *OGlobalSettings::_fixedFont = 0; |
53 | QFont *OGlobalSettings::_toolBarFont = 0; | 56 | QFont *OGlobalSettings::_toolBarFont = 0; |
54 | QFont *OGlobalSettings::_menuFont = 0; | 57 | QFont *OGlobalSettings::_menuFont = 0; |
55 | QFont *OGlobalSettings::_windowTitleFont = 0; | 58 | QFont *OGlobalSettings::_windowTitleFont = 0; |
56 | QFont *OGlobalSettings::_taskbarFont = 0; | 59 | QFont *OGlobalSettings::_taskbarFont = 0; |
57 | 60 | ||
58 | QColor *OGlobalSettings::OpieGray = 0; | 61 | QColor *OGlobalSettings::OpieGray = 0; |
diff --git a/libopie2/opiecore/oglobalsettings.h b/libopie2/opiecore/oglobalsettings.h index e3ac148..8eea709 100644 --- a/libopie2/opiecore/oglobalsettings.h +++ b/libopie2/opiecore/oglobalsettings.h | |||
@@ -27,37 +27,43 @@ | |||
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 OGLOBALSETTINGS_H | 32 | #ifndef OGLOBALSETTINGS_H |
33 | #define OGLOBALSETTINGS_H | 33 | #define OGLOBALSETTINGS_H |
34 | 34 | ||
35 | #include <qstring.h> | 35 | #include <qstring.h> |
36 | #include <qcolor.h> | 36 | #include <qcolor.h> |
37 | #include <qfont.h> | 37 | #include <qfont.h> |
38 | 38 | ||
39 | /** | ||
40 | * \todo make real const values | ||
41 | */ | ||
39 | #define OPIE_DEFAULT_SINGLECLICK true | 42 | #define OPIE_DEFAULT_SINGLECLICK true |
40 | #define OPIE_DEFAULT_INSERTTEAROFFHANDLES true | 43 | #define OPIE_DEFAULT_INSERTTEAROFFHANDLES true |
41 | #define OPIE_DEFAULT_AUTOSELECTDELAY -1 | 44 | #define OPIE_DEFAULT_AUTOSELECTDELAY -1 |
42 | #define OPIE_DEFAULT_CHANGECURSOR true | 45 | #define OPIE_DEFAULT_CHANGECURSOR true |
43 | #define OPIE_DEFAULT_LARGE_CURSOR false | 46 | #define OPIE_DEFAULT_LARGE_CURSOR false |
44 | #define OPIE_DEFAULT_VISUAL_ACTIVATE true | 47 | #define OPIE_DEFAULT_VISUAL_ACTIVATE true |
45 | #define OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED 50 | 48 | #define OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED 50 |
46 | 49 | ||
47 | //FIXME: There's still a whole lot of stuff in here which has to be revised | 50 | //FIXME: There's still a whole lot of stuff in here which has to be revised |
48 | //FIXME: before public usage... lack of time to do it at once - so it will | 51 | //FIXME: before public usage... lack of time to do it at once - so it will |
49 | //FIXME: happen step-by-step. ML. | 52 | //FIXME: happen step-by-step. ML. |
50 | // we should not habe too much configure options!!!!!! -zecke | 53 | // we should not habe too much configure options!!!!!! -zecke |
51 | 54 | ||
55 | namespace Opie { | ||
56 | namespace Core { | ||
57 | |||
52 | /** | 58 | /** |
53 | * Access the OPIE global configuration settings. | 59 | * Access the OPIE global configuration settings. |
54 | * | 60 | * |
55 | */ | 61 | */ |
56 | class OGlobalSettings | 62 | class OGlobalSettings |
57 | { | 63 | { |
58 | public: | 64 | public: |
59 | 65 | ||
60 | /** | 66 | /** |
61 | * Returns a threshold in pixels for drag & drop operations. | 67 | * Returns a threshold in pixels for drag & drop operations. |
62 | * As long as the mouse movement has not exceeded this number | 68 | * As long as the mouse movement has not exceeded this number |
63 | * of pixels in either X or Y direction no drag operation may | 69 | * of pixels in either X or Y direction no drag operation may |
@@ -359,15 +365,21 @@ private: | |||
359 | static QFont *_taskbarFont; | 365 | static QFont *_taskbarFont; |
360 | static QColor * kde2Gray; | 366 | static QColor * kde2Gray; |
361 | static QColor * kde2Blue; | 367 | static QColor * kde2Blue; |
362 | static QColor * kde2AlternateColor; | 368 | static QColor * kde2AlternateColor; |
363 | static OMouseSettings *s_mouseSettings; | 369 | static OMouseSettings *s_mouseSettings; |
364 | 370 | ||
365 | static QColor * OpieGray; | 371 | static QColor * OpieGray; |
366 | static QColor * OpieBlue; | 372 | static QColor * OpieBlue; |
367 | static QColor * OpieAlternate; | 373 | static QColor * OpieAlternate; |
368 | static QColor * OpieHighlight; | 374 | static QColor * OpieHighlight; |
369 | 375 | ||
370 | friend class OApplication; | 376 | friend class OApplication; |
377 | private: | ||
378 | class Private; | ||
379 | Private *d; | ||
371 | }; | 380 | }; |
372 | 381 | ||
382 | } | ||
383 | } | ||
384 | |||
373 | #endif | 385 | #endif |
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro index 523d6a7..ff3c036 100644 --- a/libopie2/opiecore/opiecore.pro +++ b/libopie2/opiecore/opiecore.pro | |||
@@ -1,41 +1,39 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = oapplication.h \ | 4 | HEADERS = oapplication.h \ |
5 | oconfig.h \ | 5 | oconfig.h \ |
6 | odebug.h \ | 6 | odebug.h \ |
7 | oglobal.h \ | 7 | oglobal.h \ |
8 | oglobalsettings.h \ | 8 | oglobalsettings.h \ |
9 | oprocess.h \ | 9 | oprocess.h \ |
10 | oprocctrl.h \ | 10 | oprocctrl.h \ |
11 | osmartpointer.h \ | 11 | osmartpointer.h \ |
12 | ostorageinfo.h \ | 12 | ostorageinfo.h |
13 | xmltree.h | ||
14 | 13 | ||
15 | SOURCES = oapplication.cpp \ | 14 | SOURCES = oapplication.cpp \ |
16 | oconfig.cpp \ | 15 | oconfig.cpp \ |
17 | odebug.cpp \ | 16 | odebug.cpp \ |
18 | oglobal.cpp \ | 17 | oglobal.cpp \ |
19 | oglobalsettings.cpp \ | 18 | oglobalsettings.cpp \ |
20 | oprocess.cpp \ | 19 | oprocess.cpp \ |
21 | oprocctrl.cpp \ | 20 | oprocctrl.cpp \ |
22 | ostorageinfo.cpp \ | 21 | ostorageinfo.cpp |
23 | xmltree.cc | ||
24 | 22 | ||
25 | include ( device/device.pro ) | 23 | include ( device/device.pro ) |
26 | 24 | ||
27 | INTERFACES = | 25 | INTERFACES = |
28 | TARGET = opiecore2 | 26 | TARGET = opiecore2 |
29 | VERSION = 1.8.5 | 27 | VERSION = 1.9.0 |
30 | INCLUDEPATH += $(OPIEDIR)/include | 28 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH += $(OPIEDIR)/include | 29 | DEPENDPATH += $(OPIEDIR)/include |
32 | 30 | ||
33 | !contains( platform, x11 ) { | 31 | !contains( platform, x11 ) { |
34 | LIBS = -lqpe | 32 | LIBS = -lqpe |
35 | include ( $(OPIEDIR)/include.pro ) | 33 | include ( $(OPIEDIR)/include.pro ) |
36 | } | 34 | } |
37 | 35 | ||
38 | contains( platform, x11 ) { | 36 | contains( platform, x11 ) { |
39 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 37 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
40 | } | 38 | } |
41 | 39 | ||
diff --git a/libopie2/opiecore/oprocctrl.cpp b/libopie2/opiecore/oprocctrl.cpp index 0403526..46708ba 100644 --- a/libopie2/opiecore/oprocctrl.cpp +++ b/libopie2/opiecore/oprocctrl.cpp | |||
@@ -32,24 +32,26 @@ | |||
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 | ||
44 | using namespace Opie::Core::Private; | ||
45 | |||
44 | OProcessController *OProcessController::theOProcessController = 0; | 46 | OProcessController *OProcessController::theOProcessController = 0; |
45 | 47 | ||
46 | struct sigaction OProcessController::oldChildHandlerData; | 48 | struct sigaction OProcessController::oldChildHandlerData; |
47 | bool OProcessController::handlerSet = false; | 49 | bool OProcessController::handlerSet = false; |
48 | 50 | ||
49 | OProcessController::OProcessController() | 51 | OProcessController::OProcessController() |
50 | { | 52 | { |
51 | assert( theOProcessController == 0 ); | 53 | assert( theOProcessController == 0 ); |
52 | 54 | ||
53 | if (0 > pipe(fd)) | 55 | if (0 > pipe(fd)) |
54 | printf(strerror(errno)); | 56 | printf(strerror(errno)); |
55 | 57 | ||
diff --git a/libopie2/opiecore/oprocctrl.h b/libopie2/opiecore/oprocctrl.h index 44b8a48..4922ba2 100644 --- a/libopie2/opiecore/oprocctrl.h +++ b/libopie2/opiecore/oprocctrl.h | |||
@@ -25,27 +25,32 @@ | |||
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 | ||
37 | class OProcessControllerPrivate; | ||
38 | class QSocketNotifier; | 37 | class QSocketNotifier; |
39 | 38 | ||
39 | |||
40 | namespace Opie { | ||
41 | namespace Core { | ||
42 | namespace Private { | ||
43 | class OProcessControllerPrivate; | ||
44 | |||
40 | /** | 45 | /** |
41 | * @short Used internally by @ref OProcess | 46 | * @short Used internally by @ref OProcess |
42 | * @internal | 47 | * @internal |
43 | * @author Christian Czezakte <e9025461@student.tuwien.ac.at> | 48 | * @author Christian Czezakte <e9025461@student.tuwien.ac.at> |
44 | * | 49 | * |
45 | * A class for internal use by OProcess only. -- Exactly one instance | 50 | * A class for internal use by OProcess only. -- Exactly one instance |
46 | * 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 |
47 | * created (a pointer to it gets stored in @ref theOProcessController ). | 52 | * created (a pointer to it gets stored in @ref theOProcessController ). |
48 | * | 53 | * |
49 | * This class takes care of the actual (UN*X) signal handling. | 54 | * This class takes care of the actual (UN*X) signal handling. |
50 | */ | 55 | */ |
51 | class OProcessController : public QObject | 56 | class OProcessController : public QObject |
@@ -106,16 +111,19 @@ private: | |||
106 | static struct sigaction oldChildHandlerData; | 111 | static struct sigaction oldChildHandlerData; |
107 | static bool handlerSet; | 112 | static bool handlerSet; |
108 | QValueList<OProcess*> processList; | 113 | QValueList<OProcess*> processList; |
109 | QTimer delayedChildrenCleanupTimer; | 114 | QTimer delayedChildrenCleanupTimer; |
110 | 115 | ||
111 | // Disallow assignment and copy-construction | 116 | // Disallow assignment and copy-construction |
112 | OProcessController( const OProcessController& ); | 117 | OProcessController( const OProcessController& ); |
113 | OProcessController& operator= ( const OProcessController& ); | 118 | OProcessController& operator= ( const OProcessController& ); |
114 | 119 | ||
115 | OProcessControllerPrivate *d; | 120 | OProcessControllerPrivate *d; |
116 | }; | 121 | }; |
117 | 122 | ||
123 | } | ||
124 | } | ||
125 | } | ||
118 | 126 | ||
119 | 127 | ||
120 | #endif | 128 | #endif |
121 | 129 | ||
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp index 6349c83..dfde74a 100644 --- a/libopie2/opiecore/oprocess.cpp +++ b/libopie2/opiecore/oprocess.cpp | |||
@@ -52,36 +52,41 @@ _;:, .> :=|. This program is free software; you can | |||
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 | ||
64 | using namespace Opie::Core::Private; | ||
65 | |||
66 | namespace Opie { | ||
67 | namespace Core { | ||
68 | namespace Private { | ||
64 | class OProcessPrivate | 69 | class OProcessPrivate |
65 | { | 70 | { |
66 | public: | 71 | public: |
67 | OProcessPrivate() : useShell( false ) | 72 | OProcessPrivate() : useShell( false ) |
68 | { } | 73 | { } |
69 | 74 | ||
70 | bool useShell; | 75 | bool useShell; |
71 | QMap<QString, QString> env; | 76 | QMap<QString, QString> env; |
72 | QString wd; | 77 | QString wd; |
73 | QCString shell; | 78 | QCString shell; |
74 | }; | 79 | }; |
75 | 80 | } | |
76 | 81 | ||
77 | OProcess::OProcess( QObject *parent, const char *name ) | 82 | OProcess::OProcess( QObject *parent, const char *name ) |
78 | : QObject( parent, name ) | 83 | : QObject( parent, name ) |
79 | { | 84 | { |
80 | init ( ); | 85 | init ( ); |
81 | } | 86 | } |
82 | 87 | ||
83 | OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) | 88 | OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) |
84 | : QObject( parent, name ) | 89 | : QObject( parent, name ) |
85 | { | 90 | { |
86 | init ( ); | 91 | init ( ); |
87 | *this << arg0; | 92 | *this << arg0; |
@@ -932,12 +937,15 @@ int OProcess::processPID( const QString& process ) | |||
932 | } | 937 | } |
933 | if ( line.contains( process ) ) | 938 | if ( line.contains( process ) ) |
934 | { | 939 | { |
935 | //qDebug( "found process id #%d", (*it).toInt() ); | 940 | //qDebug( "found process id #%d", (*it).toInt() ); |
936 | return (*it).toInt(); | 941 | return (*it).toInt(); |
937 | } | 942 | } |
938 | else | 943 | else |
939 | { | 944 | { |
940 | //qDebug( "process '%s' not found", (const char*) process ); | 945 | //qDebug( "process '%s' not found", (const char*) process ); |
941 | return 0; | 946 | return 0; |
942 | } | 947 | } |
943 | } | 948 | } |
949 | |||
950 | } | ||
951 | } | ||
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index 1a2472d..eb56b03 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h | |||
@@ -34,25 +34,31 @@ _;:, .> :=|. This program is free software; you can | |||
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 | ||
45 | class QSocketNotifier; | 45 | class QSocketNotifier; |
46 | |||
47 | namespace Opie { | ||
48 | namespace Core { | ||
49 | namespace Private { | ||
50 | class OProcessController; | ||
46 | class OProcessPrivate; | 51 | class OProcessPrivate; |
52 | } | ||
47 | 53 | ||
48 | /** | 54 | /** |
49 | * Child process invocation, monitoring and control. | 55 | * Child process invocation, monitoring and control. |
50 | * | 56 | * |
51 | * @sect General usage and features | 57 | * @sect General usage and features |
52 | * | 58 | * |
53 | *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 |
54 | *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. |
55 | * | 61 | * |
56 | *@see KProcIO | 62 | *@see KProcIO |
57 | * | 63 | * |
58 | *Basically, this class distinguishes three different ways of running | 64 | *Basically, this class distinguishes three different ways of running |
@@ -388,24 +394,25 @@ public: | |||
388 | 394 | ||
389 | /** | 395 | /** |
390 | * This causes the stderr file descriptor of the child process to be | 396 | * This causes the stderr file descriptor of the child process to be |
391 | * closed. | 397 | * closed. |
392 | * | 398 | * |
393 | * @return @p false if no communication to the process's stderr | 399 | * @return @p false if no communication to the process's stderr |
394 | * had been specified in the call to @ref start(). | 400 | * had been specified in the call to @ref start(). |
395 | */ | 401 | */ |
396 | bool closeStderr(); | 402 | bool closeStderr(); |
397 | 403 | ||
398 | /** | 404 | /** |
399 | * Lets you see what your arguments are for debugging. | 405 | * Lets you see what your arguments are for debugging. |
406 | * \todo make const | ||
400 | */ | 407 | */ |
401 | 408 | ||
402 | const QValueList<QCString> &args() | 409 | const QValueList<QCString> &args() |
403 | { | 410 | { |
404 | return arguments; | 411 | return arguments; |
405 | } | 412 | } |
406 | 413 | ||
407 | /** | 414 | /** |
408 | * Controls whether the started process should drop any | 415 | * Controls whether the started process should drop any |
409 | * setuid/segid privileges or whether it should keep them | 416 | * setuid/segid privileges or whether it should keep them |
410 | * | 417 | * |
411 | * The default is @p false : drop privileges | 418 | * The default is @p false : drop privileges |
@@ -707,25 +714,25 @@ protected: | |||
707 | int childError( int fdno ); | 714 | int childError( int fdno ); |
708 | 715 | ||
709 | // 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: |
710 | 717 | ||
711 | const char *input_data; // the buffer holding the data | 718 | const char *input_data; // the buffer holding the data |
712 | int input_sent; // # of bytes already transmitted | 719 | int input_sent; // # of bytes already transmitted |
713 | int input_total; // total length of input_data | 720 | int input_total; // total length of input_data |
714 | 721 | ||
715 | /** | 722 | /** |
716 | * @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 |
717 | * access to various data members. | 724 | * access to various data members. |
718 | */ | 725 | */ |
719 | friend class OProcessController; | 726 | friend class Private::OProcessController; |
720 | 727 | ||
721 | private: | 728 | private: |
722 | /** | 729 | /** |
723 | * Searches for a valid shell. | 730 | * Searches for a valid shell. |
724 | * Here is the algorithm used for finding an executable shell: | 731 | * Here is the algorithm used for finding an executable shell: |
725 | * | 732 | * |
726 | * @li Try the executable pointed to by the "SHELL" environment | 733 | * @li Try the executable pointed to by the "SHELL" environment |
727 | * variable with white spaces stripped off | 734 | * variable with white spaces stripped off |
728 | * | 735 | * |
729 | * @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 |
730 | * not listed in /etc/shells will not used. | 737 | * not listed in /etc/shells will not used. |
731 | * | 738 | * |
@@ -736,17 +743,19 @@ private: | |||
736 | /** | 743 | /** |
737 | * 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 |
738 | * is actually executable at all. | 745 | * is actually executable at all. |
739 | */ | 746 | */ |
740 | bool isExecutable( const QCString &filename ); | 747 | bool isExecutable( const QCString &filename ); |
741 | 748 | ||
742 | // Disallow assignment and copy-construction | 749 | // Disallow assignment and copy-construction |
743 | OProcess( const OProcess& ); | 750 | OProcess( const OProcess& ); |
744 | OProcess& operator= ( const OProcess& ); | 751 | OProcess& operator= ( const OProcess& ); |
745 | 752 | ||
746 | private: | 753 | private: |
747 | void init ( ); | 754 | void init ( ); |
748 | OProcessPrivate *d; | 755 | Private::OProcessPrivate *d; |
749 | }; | 756 | }; |
757 | } | ||
758 | } | ||
750 | 759 | ||
751 | #endif | 760 | #endif |
752 | 761 | ||
diff --git a/libopie2/opiecore/osmartpointer.h b/libopie2/opiecore/osmartpointer.h index 9000e71..8f9da7f 100644 --- a/libopie2/opiecore/osmartpointer.h +++ b/libopie2/opiecore/osmartpointer.h | |||
@@ -31,24 +31,25 @@ _;:, .> :=|. This program is free software; you can | |||
31 | 31 | ||
32 | #ifndef _OSmartPointer_h | 32 | #ifndef _OSmartPointer_h |
33 | #define _OSmartPointer_h | 33 | #define _OSmartPointer_h |
34 | 34 | ||
35 | /*! | 35 | /*! |
36 | * \file OSmartPointer.h | 36 | * \file OSmartPointer.h |
37 | * \brief smart pointer and reference counter | 37 | * \brief smart pointer and reference counter |
38 | * \author Rajko Albrecht | 38 | * \author Rajko Albrecht |
39 | * | 39 | * |
40 | */ | 40 | */ |
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | namespace Core { | ||
43 | 44 | ||
44 | //! simple reference counter class | 45 | //! simple reference counter class |
45 | class ORefCount { | 46 | class ORefCount { |
46 | protected: | 47 | protected: |
47 | //! reference count member | 48 | //! reference count member |
48 | long m_RefCount; | 49 | long m_RefCount; |
49 | public: | 50 | public: |
50 | //! first reference must be added after "new" via Pointer() | 51 | //! first reference must be added after "new" via Pointer() |
51 | ORefCount() : m_RefCount(0) | 52 | ORefCount() : m_RefCount(0) |
52 | {} | 53 | {} |
53 | virtual ~ORefCount() {} | 54 | virtual ~ORefCount() {} |
54 | //! add a reference | 55 | //! add a reference |
@@ -131,15 +132,16 @@ public: | |||
131 | //! supports "if (pointer)" | 132 | //! supports "if (pointer)" |
132 | operator bool () const { return (ptr != NULL); } | 133 | operator bool () const { return (ptr != NULL); } |
133 | //! "if (pointer)" as non const | 134 | //! "if (pointer)" as non const |
134 | operator bool () { return ptr != NULL;} | 135 | operator bool () { return ptr != NULL;} |
135 | 136 | ||
136 | //! support if (!pointer)" | 137 | //! support if (!pointer)" |
137 | bool operator! () const { return (ptr == NULL); } | 138 | bool operator! () const { return (ptr == NULL); } |
138 | //! support if (!pointer)" as non const | 139 | //! support if (!pointer)" as non const |
139 | bool operator! () { return (ptr == NULL); } | 140 | bool operator! () { return (ptr == NULL); } |
140 | }; | 141 | }; |
141 | 142 | ||
142 | } | 143 | } |
144 | } | ||
143 | 145 | ||
144 | #endif | 146 | #endif |
145 | 147 | ||
diff --git a/libopie2/opiecore/ostorageinfo.cpp b/libopie2/opiecore/ostorageinfo.cpp index aa8d2fc..8fcf5fc 100644 --- a/libopie2/opiecore/ostorageinfo.cpp +++ b/libopie2/opiecore/ostorageinfo.cpp | |||
@@ -20,24 +20,26 @@ | |||
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/ostorageinfo.h> | 30 | #include <opie2/ostorageinfo.h> |
31 | 31 | ||
32 | using namespace Opie::Core; | ||
33 | |||
32 | OStorageInfo::OStorageInfo( QObject *parent ) | 34 | OStorageInfo::OStorageInfo( QObject *parent ) |
33 | : StorageInfo( parent ) | 35 | : StorageInfo( parent ) |
34 | { | 36 | { |
35 | } | 37 | } |
36 | 38 | ||
37 | OStorageInfo::~OStorageInfo() | 39 | OStorageInfo::~OStorageInfo() |
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | QString OStorageInfo::cfPath()const | 43 | QString OStorageInfo::cfPath()const |
42 | { | 44 | { |
43 | QString r = ""; | 45 | QString r = ""; |
diff --git a/libopie2/opiecore/ostorageinfo.h b/libopie2/opiecore/ostorageinfo.h index 740fa85..4e1097f 100644 --- a/libopie2/opiecore/ostorageinfo.h +++ b/libopie2/opiecore/ostorageinfo.h | |||
@@ -23,40 +23,48 @@ | |||
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 OSTORAGE_H | 30 | #ifndef OSTORAGE_H |
31 | #define OSTORAGE_H | 31 | #define OSTORAGE_H |
32 | 32 | ||
33 | #include <qpe/storage.h> | 33 | #include <qpe/storage.h> |
34 | 34 | ||
35 | namespace Opie { | ||
36 | namespace Core { | ||
37 | |||
35 | class OStorageInfo : public StorageInfo | 38 | class OStorageInfo : public StorageInfo |
36 | { | 39 | { |
37 | Q_OBJECT | 40 | Q_OBJECT |
38 | 41 | ||
39 | public: | 42 | public: |
40 | 43 | ||
41 | OStorageInfo( QObject *parent=0 ); | 44 | OStorageInfo( QObject *parent=0 ); |
42 | ~OStorageInfo(); | 45 | ~OStorageInfo(); |
43 | 46 | ||
44 | /** | 47 | /** |
45 | * @returns the mount path of the CF (Compact Flash) card | 48 | * @returns the mount path of the CF (Compact Flash) card |
46 | * | 49 | * |
47 | **/ | 50 | **/ |
48 | QString cfPath() const; | 51 | QString cfPath() const; |
49 | /** | 52 | /** |
50 | * @returns the mount path of the SD (Secure Digital) card | 53 | * @returns the mount path of the SD (Secure Digital) card |
51 | * | 54 | * |
52 | **/ | 55 | **/ |
53 | QString sdPath() const; | 56 | QString sdPath() const; |
54 | /** | 57 | /** |
55 | * @returns the mount path of the MMC (MultiMedia) card | 58 | * @returns the mount path of the MMC (MultiMedia) card |
56 | * | 59 | * |
57 | **/ | 60 | **/ |
58 | QString mmcPath() const; | 61 | QString mmcPath() const; |
62 | private: | ||
63 | class Private; | ||
64 | Private *d; | ||
59 | }; | 65 | }; |
60 | 66 | ||
67 | } | ||
68 | } | ||
61 | #endif // OSTORAGE_H | 69 | #endif // OSTORAGE_H |
62 | 70 | ||
diff --git a/libopie2/opiecore/xmltree.cc b/libopie2/opiecore/xmltree.cc deleted file mode 100644 index 059791b..0000000 --- a/libopie2/opiecore/xmltree.cc +++ b/dev/null | |||
@@ -1,323 +0,0 @@ | |||
1 | /* This file is part of the KDE project | ||
2 | Copyright (C) 2001 Simon Hausmann <hausmann@kde.org> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | ||
13 | |||
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 | ||
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #include <opie2/xmltree.h> | ||
21 | |||
22 | #include <qpe/stringutil.h> | ||
23 | |||
24 | #include <qxml.h> | ||
25 | |||
26 | #include <assert.h> | ||
27 | |||
28 | using namespace Opie; | ||
29 | |||
30 | XMLElement::XMLElement() | ||
31 | : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | XMLElement::~XMLElement() | ||
36 | { | ||
37 | XMLElement *n = m_first; | ||
38 | |||
39 | while ( n ) | ||
40 | { | ||
41 | XMLElement *tmp = n; | ||
42 | n = n->m_next; | ||
43 | delete tmp; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | void XMLElement::appendChild( XMLElement *child ) | ||
48 | { | ||
49 | if ( child->m_parent ) | ||
50 | child->m_parent->removeChild( child ); | ||
51 | |||
52 | child->m_parent = this; | ||
53 | |||
54 | if ( m_last ) | ||
55 | m_last->m_next = child; | ||
56 | |||
57 | child->m_prev = m_last; | ||
58 | |||
59 | if ( !m_first ) | ||
60 | m_first = child; | ||
61 | |||
62 | m_last = child; | ||
63 | } | ||
64 | |||
65 | void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild ) | ||
66 | { | ||
67 | assert( newChild != refChild ); | ||
68 | |||
69 | if ( refChild == m_last ) | ||
70 | { | ||
71 | appendChild( newChild ); | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | assert( refChild ); | ||
76 | assert( refChild->m_parent ); | ||
77 | assert( refChild->m_parent == this ); | ||
78 | |||
79 | if ( newChild->m_parent && newChild != refChild ) | ||
80 | newChild->m_parent->removeChild( newChild ); | ||
81 | |||
82 | newChild->m_parent = this; | ||
83 | |||
84 | XMLElement *next = refChild->m_next; | ||
85 | |||
86 | refChild->m_next = newChild; | ||
87 | |||
88 | newChild->m_prev = refChild; | ||
89 | newChild->m_next = next; | ||
90 | |||
91 | if ( next ) | ||
92 | next->m_prev = newChild; | ||
93 | } | ||
94 | |||
95 | QString XMLElement::attribute( const QString &attr ) const | ||
96 | { | ||
97 | AttributeMap::ConstIterator it = m_attributes.find( attr ); | ||
98 | if ( it == m_attributes.end() ) | ||
99 | return QString::null; | ||
100 | return it.data(); | ||
101 | } | ||
102 | |||
103 | void XMLElement::setAttribute( const QString &attr, const QString &value ) | ||
104 | { | ||
105 | m_attributes.replace( attr, value ); | ||
106 | } | ||
107 | |||
108 | void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild ) | ||
109 | { | ||
110 | assert( refChild ); | ||
111 | assert( refChild->m_parent ); | ||
112 | assert( refChild->m_parent == this ); | ||
113 | assert( newChild != refChild ); | ||
114 | |||
115 | if ( newChild->m_parent && newChild != refChild ) | ||
116 | newChild->m_parent->removeChild( newChild ); | ||
117 | |||
118 | newChild->m_parent = this; | ||
119 | |||
120 | XMLElement *prev = refChild->m_prev; | ||
121 | |||
122 | refChild->m_prev = newChild; | ||
123 | |||
124 | newChild->m_prev = prev; | ||
125 | newChild->m_next = refChild; | ||
126 | |||
127 | if ( prev ) | ||
128 | prev->m_next = newChild; | ||
129 | |||
130 | if ( refChild == m_first ) | ||
131 | m_first = newChild; | ||
132 | } | ||
133 | |||
134 | void XMLElement::removeChild( XMLElement *child ) | ||
135 | { | ||
136 | if ( child->m_parent != this ) | ||
137 | return; | ||
138 | |||
139 | if ( m_first == child ) | ||
140 | m_first = child->m_next; | ||
141 | |||
142 | if ( m_last == child ) | ||
143 | m_last = child->m_prev; | ||
144 | |||
145 | if ( child->m_prev ) | ||
146 | child->m_prev->m_next = child->m_next; | ||
147 | |||
148 | if ( child->m_next ) | ||
149 | child->m_next->m_prev = child->m_prev; | ||
150 | |||
151 | child->m_parent = 0; | ||
152 | child->m_prev = 0; | ||
153 | child->m_next = 0; | ||
154 | } | ||
155 | |||
156 | void XMLElement::save( QTextStream &s, uint indent ) | ||
157 | { | ||
158 | if ( !m_value.isEmpty() ) | ||
159 | { | ||
160 | s << Qtopia::escapeString( m_value ); | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | for ( uint i = 0; i < indent; ++i ) | ||
165 | s << " "; | ||
166 | |||
167 | s << "<" << m_tag; | ||
168 | |||
169 | if ( !m_attributes.isEmpty() ) | ||
170 | { | ||
171 | s << " "; | ||
172 | AttributeMap::ConstIterator it = m_attributes.begin(); | ||
173 | AttributeMap::ConstIterator end = m_attributes.end(); | ||
174 | for (; it != end; ++it ) | ||
175 | { | ||
176 | s << it.key() << "=\"" << Qtopia::escapeString( it.data() ) << "\""; | ||
177 | s << " "; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | if ( m_last ) | ||
182 | { | ||
183 | if ( ( m_first && !m_first->value().isEmpty() ) || !m_parent ) | ||
184 | s << ">"; | ||
185 | else | ||
186 | s << ">" << endl; | ||
187 | |||
188 | int newIndent = indent; | ||
189 | if ( m_parent ) | ||
190 | newIndent++; | ||
191 | |||
192 | XMLElement *n = m_first; | ||
193 | while ( n ) | ||
194 | { | ||
195 | n->save( s, newIndent ); | ||
196 | n = n->nextChild(); | ||
197 | } | ||
198 | |||
199 | if ( m_last && m_last->value().isEmpty() && m_parent ) | ||
200 | for ( uint i = 0; i < indent; ++i ) | ||
201 | s << " "; | ||
202 | |||
203 | if ( m_parent ) | ||
204 | s << "</" << m_tag << ">" << endl; | ||
205 | } | ||
206 | else | ||
207 | s << "/>" << endl; | ||
208 | } | ||
209 | |||
210 | class Handler : public QXmlDefaultHandler | ||
211 | { | ||
212 | public: | ||
213 | Handler() : m_node( 0 ), m_root( 0 ) {} | ||
214 | |||
215 | XMLElement *root() const { return m_root; } | ||
216 | |||
217 | virtual bool startDocument(); | ||
218 | virtual bool endDocument(); | ||
219 | virtual bool startElement( const QString &ns, const QString &ln, const QString &qName, | ||
220 | const QXmlAttributes &attr ); | ||
221 | virtual bool endElement( const QString &ns, const QString &ln, const QString &qName ); | ||
222 | virtual bool characters( const QString &ch ); | ||
223 | |||
224 | private: | ||
225 | XMLElement *m_node; | ||
226 | XMLElement *m_root; | ||
227 | }; | ||
228 | |||
229 | bool Handler::startDocument() | ||
230 | { | ||
231 | m_root = m_node = new XMLElement; | ||
232 | |||
233 | return true; | ||
234 | } | ||
235 | |||
236 | bool Handler::endDocument() | ||
237 | { | ||
238 | return m_root == m_node; | ||
239 | } | ||
240 | |||
241 | bool Handler::startElement( const QString &, const QString &, const QString &qName, | ||
242 | const QXmlAttributes &attr ) | ||
243 | { | ||
244 | XMLElement *bm = new XMLElement; | ||
245 | |||
246 | XMLElement::AttributeMap attributes; | ||
247 | for ( int i = 0; i < attr.length(); ++i ) | ||
248 | attributes[ attr.qName( i ) ] = attr.value( i ); | ||
249 | |||
250 | bm->setAttributes( attributes ); | ||
251 | |||
252 | bm->setTagName( qName ); | ||
253 | |||
254 | m_node->appendChild( bm ); | ||
255 | m_node = bm; | ||
256 | |||
257 | return true; | ||
258 | } | ||
259 | |||
260 | bool Handler::endElement( const QString &, const QString &, const QString & ) | ||
261 | { | ||
262 | if ( m_node == m_root ) | ||
263 | return false; | ||
264 | |||
265 | m_node = m_node->parent(); | ||
266 | return true; | ||
267 | } | ||
268 | |||
269 | bool Handler::characters( const QString &ch ) | ||
270 | { | ||
271 | XMLElement *textNode = new XMLElement; | ||
272 | textNode->setValue( ch ); | ||
273 | m_node->appendChild( textNode ); | ||
274 | return true; | ||
275 | } | ||
276 | |||
277 | XMLElement *XMLElement::namedItem( const QString &name ) | ||
278 | { | ||
279 | XMLElement *e = m_first; | ||
280 | |||
281 | for (; e; e = e->nextChild() ) | ||
282 | if ( e->tagName() == name ) | ||
283 | return e; | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | XMLElement *XMLElement::clone() const | ||
289 | { | ||
290 | XMLElement *res = new XMLElement; | ||
291 | |||
292 | res->setTagName( m_tag ); | ||
293 | res->setValue( m_value ); | ||
294 | res->setAttributes( m_attributes ); | ||
295 | |||
296 | XMLElement *e = m_first; | ||
297 | for (; e; e = e->m_next ) | ||
298 | res->appendChild( e->clone() ); | ||
299 | |||
300 | return res; | ||
301 | } | ||
302 | |||
303 | XMLElement *XMLElement::load( const QString &fileName ) | ||
304 | { | ||
305 | QFile f( fileName ); | ||
306 | if ( !f.open( IO_ReadOnly ) ) | ||
307 | return 0; | ||
308 | |||
309 | QTextStream stream( &f ); | ||
310 | stream.setEncoding( QTextStream::UnicodeUTF8 ); | ||
311 | QXmlInputSource src( stream ); | ||
312 | QXmlSimpleReader reader; | ||
313 | Handler handler; | ||
314 | |||
315 | reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false ); | ||
316 | reader.setContentHandler( &handler ); | ||
317 | reader.parse( src ); | ||
318 | |||
319 | return handler.root();; | ||
320 | } | ||
321 | |||
322 | /* vim: et sw=4 | ||
323 | */ | ||
diff --git a/libopie2/opiecore/xmltree.h b/libopie2/opiecore/xmltree.h deleted file mode 100644 index 4b6bdfa..0000000 --- a/libopie2/opiecore/xmltree.h +++ b/dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* This file is part of the KDE project | ||
2 | Copyright (C) 2000,2001 Simon Hausmann <hausmann@kde.org> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | ||
13 | |||
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 | ||
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #ifndef __bookmarks_h__ | ||
22 | #define __bookmarks_h__ | ||
23 | |||
24 | #include <qstring.h> | ||
25 | #include <qmap.h> | ||
26 | #include <qtextstream.h> | ||
27 | |||
28 | namespace Opie | ||
29 | { | ||
30 | |||
31 | /** | ||
32 | * A small xml lib written by Simon Hausmann. | ||
33 | */ | ||
34 | class XMLElement | ||
35 | { | ||
36 | public: | ||
37 | typedef QMap<QString, QString> AttributeMap; | ||
38 | |||
39 | /** | ||
40 | * The constructor of XMLElement | ||
41 | */ | ||
42 | XMLElement(); | ||
43 | ~XMLElement(); | ||
44 | |||
45 | /** appendChild appends a child to the XMLElement behind the last element. | ||
46 | * The ownership of the child get's transfered to the | ||
47 | * this XMLElement. | ||
48 | * If child is already the child of another parent | ||
49 | * it's get removed from the other parent first. | ||
50 | */ | ||
51 | void appendChild( XMLElement *child ); | ||
52 | |||
53 | /** inserts newChild after refChild. If newChild is the child | ||
54 | * of another parent the child will get removed. | ||
55 | * The ownership of child gets transfered. | ||
56 | * | ||
57 | */ | ||
58 | void insertAfter( XMLElement *newChild, XMLElement *refChild ); | ||
59 | |||
60 | /** same as insertAfter but the element get's inserted before refChild. | ||
61 | * | ||
62 | */ | ||
63 | void insertBefore( XMLElement *newChild, XMLElement *refChild ); | ||
64 | |||
65 | /** removeChild removes the child from the XMLElement. | ||
66 | * The ownership gets dropped. You need to delete the | ||
67 | * child yourself. | ||
68 | */ | ||
69 | void removeChild( XMLElement *child ); | ||
70 | |||
71 | /** parent() returns the parent of this XMLElement | ||
72 | * If there is no parent 0l gets returned | ||
73 | */ | ||
74 | XMLElement *parent() const { return m_parent; } | ||
75 | XMLElement *firstChild() const { return m_first; } | ||
76 | XMLElement *nextChild() const { return m_next; } | ||
77 | XMLElement *prevChild() const { return m_prev; } | ||
78 | XMLElement *lastChild() const { return m_last; } | ||
79 | |||
80 | void setTagName( const QString &tag ) { m_tag = tag; } | ||
81 | QString tagName() const { return m_tag; } | ||
82 | |||
83 | void setValue( const QString &val ) { m_value = val; } | ||
84 | QString value() const { return m_value; } | ||
85 | |||
86 | void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; } | ||
87 | AttributeMap attributes() const { return m_attributes; } | ||
88 | AttributeMap &attributes() { return m_attributes; } | ||
89 | |||
90 | QString attribute( const QString & ) const; | ||
91 | void setAttribute( const QString &attr, const QString &value ); | ||
92 | void save( QTextStream &stream, uint indent = 0 ); | ||
93 | |||
94 | XMLElement *namedItem( const QString &name ); | ||
95 | |||
96 | XMLElement *clone() const; | ||
97 | |||
98 | static XMLElement *load( const QString &fileName ); | ||
99 | |||
100 | private: | ||
101 | QString m_tag; | ||
102 | QString m_value; | ||
103 | AttributeMap m_attributes; | ||
104 | |||
105 | XMLElement *m_parent; | ||
106 | XMLElement *m_next; | ||
107 | XMLElement *m_prev; | ||
108 | XMLElement *m_first; | ||
109 | XMLElement *m_last; | ||
110 | |||
111 | XMLElement( const XMLElement &rhs ); | ||
112 | XMLElement &operator=( const XMLElement &rhs ); | ||
113 | class Private; | ||
114 | Private* d; | ||
115 | }; | ||
116 | |||
117 | } // namespace Opie | ||
118 | |||
119 | #endif | ||