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 | |||
@@ -61,5 +61,5 @@ _;:, .> :=|. This program is free software; you can | |||
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() |
@@ -82,9 +82,9 @@ ODevice *ODevice::inst() | |||
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; |
@@ -188,5 +188,5 @@ bool ODevice::suspend() | |||
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 ); |
@@ -625,4 +625,7 @@ void ODevice::virtual_hook(int, void* ){ | |||
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 | |||
@@ -41,6 +41,7 @@ _;:, .> :=|. This program is free software; you can | |||
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 | /** |
@@ -251,5 +252,5 @@ public: | |||
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 | * |
@@ -315,4 +316,5 @@ class ODeviceData { | |||
315 | 316 | ||
316 | } | 317 | } |
318 | } | ||
317 | 319 | ||
318 | static inline bool isQWS() | 320 | static inline bool isQWS() |
@@ -329,4 +331,5 @@ static QCString makeChannel ( const char *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 | |||
@@ -54,4 +54,8 @@ | |||
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 )) |
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 | |||
@@ -36,5 +36,7 @@ | |||
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 |
@@ -82,3 +84,7 @@ struct i_button { | |||
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 | |||
@@ -78,5 +78,5 @@ typedef struct { | |||
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() |
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 | |||
@@ -33,6 +33,7 @@ | |||
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 | { |
@@ -46,5 +47,7 @@ class Jornada : public ODevice | |||
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 | |||
@@ -54,4 +54,7 @@ | |||
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, |
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 | |||
@@ -35,5 +35,7 @@ | |||
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 |
@@ -69,4 +71,7 @@ struct r_button { | |||
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 | |||
@@ -54,5 +54,6 @@ _;:, .> :=|. This program is free software; you can | |||
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 [] = { |
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 | |||
@@ -36,5 +36,7 @@ | |||
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 |
@@ -79,3 +81,7 @@ struct s_button { | |||
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 | |||
@@ -54,5 +54,6 @@ _;:, .> :=|. This program is free software; you can | |||
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 [] = { |
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 | |||
@@ -33,6 +33,7 @@ _;:, .> :=|. This program is free software; you can | |||
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 | { |
@@ -60,3 +61,7 @@ struct yopy_button | |||
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 | |||
@@ -54,5 +54,6 @@ _;:, .> :=|. This program is free software; you can | |||
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 [] = { |
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 | |||
@@ -46,6 +46,8 @@ | |||
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 | { |
@@ -93,4 +95,6 @@ struct z_button { | |||
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 | |||
@@ -34,5 +34,8 @@ | |||
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 |
@@ -43,5 +46,8 @@ class OQCopMessageData | |||
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() |
@@ -125,6 +131,6 @@ void OQCopMessage::setData ( const QByteArray &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 |
@@ -245,2 +251,5 @@ void ODeviceButton::setHeldAction(const OQCopMessage& action) | |||
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 | |||
@@ -24,8 +24,10 @@ | |||
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 |
@@ -53,5 +55,5 @@ 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; |
@@ -105,4 +107,5 @@ class ODeviceButton | |||
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 | |||
@@ -35,4 +35,7 @@ | |||
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 | ||
@@ -41,4 +44,7 @@ OApplication* OApplication::_instance = 0; | |||
41 | **************************************************************************************************/ | 44 | **************************************************************************************************/ |
42 | 45 | ||
46 | namespace Opie { | ||
47 | namespace Core { | ||
48 | namespace Private { | ||
43 | class OApplicationPrivate | 49 | class OApplicationPrivate |
44 | { | 50 | { |
@@ -47,4 +53,5 @@ class OApplicationPrivate | |||
47 | ~OApplicationPrivate() {}; | 53 | ~OApplicationPrivate() {}; |
48 | }; | 54 | }; |
55 | } | ||
49 | 56 | ||
50 | /************************************************************************************************** | 57 | /************************************************************************************************** |
@@ -85,5 +92,5 @@ OConfig* OApplication::config() | |||
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 | { |
@@ -126,2 +133,4 @@ void OApplication::setTitle( const QString& title ) const | |||
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 | |||
@@ -31,11 +31,15 @@ | |||
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 | ||
@@ -99,6 +103,9 @@ class OApplication : public QPEApplication | |||
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 | |||
@@ -39,4 +39,6 @@ | |||
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 ) |
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 | |||
@@ -41,4 +41,7 @@ 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 |
@@ -63,4 +66,5 @@ class OConfig : public Config | |||
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(); }; |
@@ -73,4 +77,8 @@ class OConfig : public Config | |||
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 | ||
@@ -137,5 +145,10 @@ class OConfigGroupSaver | |||
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 | |||
@@ -66,5 +66,6 @@ | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | 68 | namespace Opie { | |
69 | namespace Core { | ||
69 | /*====================================================================================== | 70 | /*====================================================================================== |
70 | * debug levels | 71 | * debug levels |
@@ -615,6 +616,10 @@ void odClearDebugConfig() | |||
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 | |||
@@ -48,4 +48,7 @@ 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; |
@@ -395,4 +398,8 @@ class ondbgstream { | |||
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 | ||
@@ -473,2 +480,4 @@ void odClearDebugConfig(); | |||
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 | |||
@@ -39,4 +39,6 @@ | |||
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 | { |
@@ -313,5 +315,5 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) { | |||
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 | } |
@@ -324,5 +326,5 @@ bool OGlobal::isAppLnkFileName( const QString& str ) | |||
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; |
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 | |||
@@ -53,4 +53,9 @@ 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 |
@@ -147,5 +152,8 @@ 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 | |||
@@ -45,4 +45,7 @@ | |||
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; |
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 | |||
@@ -37,4 +37,7 @@ | |||
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 |
@@ -50,4 +53,7 @@ | |||
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. |
@@ -369,5 +375,11 @@ private: | |||
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 | |||
@@ -10,6 +10,5 @@ HEADERS = oapplication.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 \ |
@@ -20,6 +19,5 @@ SOURCES = oapplication.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 ) |
@@ -27,5 +25,5 @@ include ( device/device.pro ) | |||
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 |
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 | |||
@@ -42,4 +42,6 @@ | |||
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 | ||
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 | |||
@@ -35,7 +35,12 @@ | |||
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 |
@@ -116,4 +121,7 @@ private: | |||
116 | }; | 121 | }; |
117 | 122 | ||
123 | } | ||
124 | } | ||
125 | } | ||
118 | 126 | ||
119 | 127 | ||
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 | |||
@@ -62,4 +62,9 @@ _;:, .> :=|. This program is free software; you can | |||
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 | { |
@@ -73,5 +78,5 @@ public: | |||
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 ) |
@@ -942,2 +947,5 @@ int OProcess::processPID( const QString& process ) | |||
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 | |||
@@ -44,5 +44,11 @@ _;:, .> :=|. This program is free software; you can | |||
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 | /** |
@@ -398,4 +404,5 @@ public: | |||
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 | ||
@@ -717,5 +724,5 @@ protected: | |||
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: |
@@ -746,6 +753,8 @@ private: | |||
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 |
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 | |||
@@ -41,4 +41,5 @@ _;:, .> :=|. This program is free software; you can | |||
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | namespace Core { | ||
43 | 44 | ||
44 | //! simple reference counter class | 45 | //! simple reference counter class |
@@ -141,4 +142,5 @@ public: | |||
141 | 142 | ||
142 | } | 143 | } |
144 | } | ||
143 | 145 | ||
144 | #endif | 146 | #endif |
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 | |||
@@ -30,4 +30,6 @@ | |||
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 ) |
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 | |||
@@ -33,4 +33,7 @@ | |||
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 | { |
@@ -57,6 +60,11 @@ class OStorageInfo : public StorageInfo | |||
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 | ||