summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.cpp17
-rw-r--r--libopie2/opiecore/device/odevice.h9
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.cpp4
-rw-r--r--libopie2/opiecore/device/odevice_ipaq.h8
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp2
-rw-r--r--libopie2/opiecore/device/odevice_jornada.h9
-rw-r--r--libopie2/opiecore/device/odevice_ramses.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_ramses.h7
-rw-r--r--libopie2/opiecore/device/odevice_simpad.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_simpad.h8
-rw-r--r--libopie2/opiecore/device/odevice_yopy.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_yopy.h9
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.cpp3
-rw-r--r--libopie2/opiecore/device/odevice_zaurus.h8
-rw-r--r--libopie2/opiecore/device/odevicebutton.cpp15
-rw-r--r--libopie2/opiecore/device/odevicebutton.h11
-rw-r--r--libopie2/opiecore/oapplication.cpp11
-rw-r--r--libopie2/opiecore/oapplication.h13
-rw-r--r--libopie2/opiecore/oconfig.cpp2
-rw-r--r--libopie2/opiecore/oconfig.h13
-rw-r--r--libopie2/opiecore/odebug.cpp7
-rw-r--r--libopie2/opiecore/odebug.h9
-rw-r--r--libopie2/opiecore/oglobal.cpp6
-rw-r--r--libopie2/opiecore/oglobal.h10
-rw-r--r--libopie2/opiecore/oglobalsettings.cpp3
-rw-r--r--libopie2/opiecore/oglobalsettings.h12
-rw-r--r--libopie2/opiecore/opiecore.pro8
-rw-r--r--libopie2/opiecore/oprocctrl.cpp2
-rw-r--r--libopie2/opiecore/oprocctrl.h10
-rw-r--r--libopie2/opiecore/oprocess.cpp10
-rw-r--r--libopie2/opiecore/oprocess.h13
-rw-r--r--libopie2/opiecore/osmartpointer.h2
-rw-r--r--libopie2/opiecore/ostorageinfo.cpp2
-rw-r--r--libopie2/opiecore/ostorageinfo.h8
-rw-r--r--libopie2/opiecore/xmltree.cc323
-rw-r--r--libopie2/opiecore/xmltree.h119
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
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
const char* PATH_PROC_CPUINFO = "/proc/cpuinfo";
-using namespace Opie;
+using namespace Opie::Core;
ODevice *ODevice::inst()
{
static ODevice *dev = 0;
// rewrite this to only use /proc/cpuinfo or so
if ( !dev )
{
QFile f( PATH_PROC_CPUINFO );
if ( f.open( IO_ReadOnly ) )
{
QTextStream s( &f );
while ( !s.atEnd() )
{
QString line;
line = s.readLine();
if ( line.startsWith( "Hardware" ) )
{
qDebug( "ODevice() - found '%s'", (const char*) line );
- if ( line.contains( "sharp", false ) ) dev = new Zaurus();
- else if ( line.contains( "ipaq", false ) ) dev = new iPAQ();
- else if ( line.contains( "simpad", false ) ) dev = new SIMpad();
- else if ( line.contains( "jornada", false ) ) dev = new Jornada();
- else if ( line.contains( "ramses", false ) ) dev = new Ramses();
+ if ( line.contains( "sharp", false ) ) dev = new Private::Zaurus();
+ else if ( line.contains( "ipaq", false ) ) dev = new Private::iPAQ();
+ else if ( line.contains( "simpad", false ) ) dev = new Private::SIMpad();
+ else if ( line.contains( "jornada", false ) ) dev = new Private::Jornada();
+ else if ( line.contains( "ramses", false ) ) dev = new Private::Ramses();
else qWarning( "ODevice() - unknown hardware - using default." );
break;
}
}
}
else
{
qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." );
}
if ( !dev ) dev = new ODevice();
dev->init();
}
@@ -178,25 +178,25 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ )
*/
bool ODevice::suspend()
{
qDebug("ODevice::suspend");
if ( !isQWS( ) ) // only qwsserver is allowed to suspend
return false;
if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
return false;
bool res = false;
ODevice::sendSuspendmsg();
-
+
struct timeval tvs, tvn;
::gettimeofday ( &tvs, 0 );
::sync(); // flush fs caches
res = ( ::system ( "apm --suspend" ) == 0 );
// This is needed because the iPAQ apm implementation is asynchronous and we
// can not be sure when exactly the device is really suspended
// This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
if ( res ) {
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 )
buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message());
// buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data()));
QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
}
void ODevice::virtual_hook(int, void* ){
}
void ODevice::sendSuspendmsg()
{
+ if ( isQWS() )
+ return;
+
QCopEnvelope ( "QPE/System", "aboutToSuspend()" );
}
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
#define ODEVICE_H_
/* OPIE */
#include <opie2/odevicebutton.h>
#include <qpe/qpeapplication.h> /* for Transformation enum.. */
/* QT */
#include <qnamespace.h>
#include <qobject.h>
#include <qstring.h>
#include <qstrlist.h>
-namespace Opie
-{
+namespace Opie{
+namespace Core{
+
class ODeviceData;
/**
* The available devices
*/
enum OModel {
Model_Unknown, // = 0
Model_Series_Mask = 0xff000000,
Model_iPAQ = ( 1 << 24 ),
Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
@@ -241,25 +242,25 @@ public:
virtual bool hasHingeSensor() const;
virtual OHingeStatus readHingeSensor();
const QStrList &allowedCpuFrequencies() const;
bool setCurrentCpuFrequency(uint index);
/**
* Returns the available buttons on this device. The number and location
* of buttons will vary depending on the device. Button numbers will be assigned
* by the device manufacturer and will be from most preferred button to least preffered
* button. Note that this list only contains "user mappable" buttons.
- *
+ *
* @todo Make method const and take care of calling initButtons or make that const too
*
*/
const QValueList<ODeviceButton> &buttons();
/**
* Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
* returns 0L
*/
const ODeviceButton *buttonForKeycode ( ushort keyCode );
/**
@@ -305,28 +306,30 @@ class ODeviceData {
QString m_sysverstr;
Transformation m_rotation;
ODirection m_direction;
QValueList <ODeviceButton> *m_buttons;
uint m_holdtime;
QStrList *m_cpu_frequencies;
};
}
+}
static inline bool isQWS()
{
return qApp ? ( qApp->type() == QApplication::GuiServer ) : false;
}
static QCString makeChannel ( const char *str )
{
if ( str && !::strchr ( str, '/' ))
return QCString ( "QPE/Application/" ) + str;
else
return str;
}
+
#endif
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 @@
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
+
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
+
/* KERNEL */
#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
#define OD_IO(type,number) OD_IOC(0,type,number,0)
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
typedef struct {
unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
unsigned char TotalTime; /* Units of 5 seconds */
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 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_IPAQ
#define ODEVICE_IPAQ
#include "odevice.h"
/* QT */
#include <qwindowsystem_qws.h>
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class iPAQ : public ODevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool setDisplayBrightness( int b );
@@ -72,13 +74,17 @@ class iPAQ : public ODevice, public QWSServer::KeyboardFilter
struct i_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
+
#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 {
unsigned char OffTime; /* units of 100m/s */
} LED_IN;
typedef struct {
unsigned char mode;
unsigned char pwr;
unsigned char brightness;
} FLITE_IN;
#define LED_ON OD_IOW( 'f', 5, LED_IN )
#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
-using namespace Opie;
+using namespace Opie::Core::Private;
void Jornada::init()
{
d->m_vendorstr = "HP";
d->m_vendor = Vendor_HP;
d->m_modelstr = "Jornada 56x";
d->m_model = Model_Jornada_56x;
d->m_systemstr = "Familiar";
d->m_system = System_Familiar;
d->m_rotation = Rot0;
QFile f ( "/etc/familiar-version" );
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 @@
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_JORNADA
#define ODEVICE_JORNADA
#include <opie2/odevice.h>
-using namespace Opie;
-
+namespace Opie {
+namespace Core {
+namespace Private {
class Jornada : public ODevice
{
protected:
virtual void init();
public:
virtual bool setSoftSuspend ( bool soft );
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
};
-
+}
+}
+}
#endif
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 @@
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
+
struct r_button ramses_buttons [] = {
{ Model_Ramses_MNCI,
Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
"devicebuttons/z_menu",
"QPE/TaskBar", "toggleMenu()",
"QPE/TaskBar", "toggleStartMenu()" },
{ Model_Ramses_MNCI,
Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/ipaq_home",
"QPE/Launcher", "home()",
"buttonsettings", "raise()" },
};
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 @@
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_RAMSES
#define ODEVICE_RAMSES
#include <opie2/odevice.h>
/* QT */
#include <qwindowsystem_qws.h>
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class Ramses : public ODevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool suspend();
virtual bool setDisplayStatus( bool on );
virtual bool setDisplayBrightness( int b );
@@ -59,14 +61,17 @@ class Ramses : public ODevice, public QWSServer::KeyboardFilter
};
struct r_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
#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
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
-using namespace Opie;
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
struct s_button simpad_buttons [] = {
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
"devicebuttons/simpad_lower_up",
"datebook", "nextView()",
"today", "raise()" },
{ Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
"devicebuttons/simpad_lower_down",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
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 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_SIMPAD
#define ODEVICE_SIMPAD
#include <opie2/odevice.h>
/* QT */
#include <qwindowsystem_qws.h>
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class SIMpad : public ODevice, public QWSServer::KeyboardFilter
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool setSoftSuspend( bool soft );
virtual bool suspend();
virtual bool setDisplayStatus( bool on );
@@ -69,13 +71,17 @@ class SIMpad : public ODevice, public QWSServer::KeyboardFilter
struct s_button {
uint model;
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
+
#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
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
-using namespace Opie;
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
struct yopy_button yopy_buttons [] = {
{ Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ),
"devicebuttons/yopy_action",
"datebook", "nextView()",
"today", "raise()" },
{ Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ),
"devicebuttons/yopy_ok",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ),
"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
-_. . .   )=.  = Library General Public License along with
  --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ODEVICE_YOPY
#define ODEVICE_YOPY
#include <opie2/odevice.h>
-using namespace Opie;
-
+namespace Opie {
+namespace Core {
+namespace Private {
class Yopy : public ODevice
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool suspend();
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
@@ -50,13 +51,17 @@ class Yopy : public ODevice
struct yopy_button
{
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
+}
+}
+}
+
#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
/* STD */
#include <fcntl.h>
#include <math.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifndef QT_NO_SOUND
#include <linux/soundcard.h>
#endif
-using namespace Opie;
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
struct z_button z_buttons [] = {
{ Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
"devicebuttons/z_calendar",
"datebook", "nextView()",
"today", "raise()" },
{ Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
"devicebuttons/z_contact",
"addressbook", "raise()",
"addressbook", "beamBusinessCard()" },
{ Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
"devicebuttons/z_home",
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 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
// _IO and friends are only defined in kernel headers ...
#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
#define OD_IO(type,number) OD_IOC(0,type,number,0)
#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
-using namespace Opie;
+namespace Opie {
+namespace Core {
+namespace Private {
class Zaurus : public ODevice
{
protected:
virtual void init();
virtual void initButtons();
public:
virtual bool setSoftSuspend ( bool soft );
virtual bool setDisplayBrightness ( int b );
virtual int displayBrightnessResolution() const;
@@ -83,14 +85,16 @@ class Zaurus : public ODevice
bool m_embedix;
};
struct z_button {
Qt::Key code;
char *utext;
char *pix;
char *fpressedservice;
char *fpressedaction;
char *fheldservice;
char *fheldaction;
};
-
+}
+}
+}
#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 @@
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpixmap.h>
#include <qstring.h>
#include <qpe/qcopenvelope_qws.h>
#include <opie2/odevicebutton.h>
-using namespace Opie;
+
+namespace Opie {
+namespace Core {
+namespace Private {
class OQCopMessageData
{
public:
QCString m_channel;
QCString m_message;
QByteArray m_data;
};
+}
+using namespace Opie::Core;
+using namespace Opie::Core::Private;
OQCopMessage::OQCopMessage()
: d ( 0 )
{
init ( QCString(), QCString(), QByteArray());
}
OQCopMessage::OQCopMessage ( const OQCopMessage &copy )
: d ( 0 )
{
init ( copy. channel(), copy. message(), copy. data());
}
@@ -115,26 +121,26 @@ void OQCopMessage::setChannel ( const QCString &ch )
}
void OQCopMessage::setMessage ( const QCString &m )
{
d->m_message = m;
}
void OQCopMessage::setData ( const QByteArray &data )
{
d->m_data = data;
}
-/*! \class Opie::ODeviceButton
- \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device.
+/*! \class Opie::Core::ODeviceButton
+ \brief The Opie::Core::ODeviceButton class represents a physical user mappable button on a Qtopia device.
This class represents a physical button on a Qtopia device. A
device may have "user programmable" buttons.
The location and number of buttons will vary from device to
device. userText() and pixmap() may be used to describe this button
to the user in help documentation.
\ingroup qtopiaemb
\internal
*/
ODeviceButton::ODeviceButton()
@@ -235,12 +241,15 @@ void ODeviceButton::setPressedAction(const OQCopMessage& action)
m_PressedAction = action;
}
void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action)
{
m_FactoryPresetHeldAction = action;
}
void ODeviceButton::setHeldAction(const OQCopMessage& action)
{
m_HeldAction = action;
}
+
+}
+}
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 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef DEVICE_BUTTON_H
#define DEVICE_BUTTON_H
#include <qpixmap.h>
#include <qstring.h>
-class OQCopMessageData;
-namespace Opie
-{
+namespace Opie{
+namespace Core{
+namespace Private {
+class OQCopMessageData;
+}
class OQCopMessage
{
public:
OQCopMessage ( );
OQCopMessage ( const OQCopMessage &copy );
OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( ));
OQCopMessage &operator = ( const OQCopMessage &assign );
void setChannel ( const QCString &channel );
void setMessage ( const QCString &message );
@@ -43,25 +45,25 @@ public:
QCString channel ( ) const;
QCString message ( ) const;
QByteArray data ( ) const;
bool isNull()const;
bool send ( );
private:
void init ( const QCString &m_channel, const QCString &message, const QByteArray &args );
- OQCopMessageData *d;
+ Private::OQCopMessageData *d;
class Private;
Private* m_data;
};
/**
* This class represents a physical button on a Qtopia device. A device may
* have n "user programmable" buttons, which are number 1..n. The location
* and number of buttons will vary from device to device. userText() and pixmap()
* may be used to describe this button to the user in help documentation.
*
* @version 1.0
@@ -95,14 +97,15 @@ class ODeviceButton
ushort m_Keycode;
QString m_UserText;
QPixmap m_Pixmap;
OQCopMessage m_FactoryPresetPressedAction;
OQCopMessage m_PressedAction;
OQCopMessage m_FactoryPresetHeldAction;
OQCopMessage m_HeldAction;
class Private;
Private *d;
};
}
+}
#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 @@
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/oapplication.h>
#include <opie2/oconfig.h>
#include <opie2/odebug.h>
#include <signal.h>
#include <stdio.h>
+using namespace Opie::Core;
+
+
OApplication* OApplication::_instance = 0;
/**************************************************************************************************
* OApplicationPrivate
**************************************************************************************************/
+namespace Opie {
+namespace Core {
+namespace Private {
class OApplicationPrivate
{
public:
OApplicationPrivate() {};
~OApplicationPrivate() {};
};
+}
/**************************************************************************************************
* OApplication
**************************************************************************************************/
OApplication::OApplication( int& argc, char** argv, const QCString& rAppName )
:QPEApplication( argc, argv ),
_appname( rAppName ),
_config( 0 )
{
init();
@@ -75,25 +82,25 @@ OApplication::~OApplication()
OConfig* OApplication::config()
{
if ( !_config )
{
_config = new OConfig( _appname );
}
return _config;
}
void OApplication::init()
{
- d = new OApplicationPrivate();
+ d = new Private::OApplicationPrivate();
if ( !OApplication::_instance )
{
OApplication::_instance = this;
/* register SIGSEGV handler to give programs an option
* to exit gracefully, e.g. save or close devices or files.
struct sigaction sa;
sa.sa_handler = ( void (*)(int) ) &segv_handler;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, NULL);
*/
@@ -116,12 +123,14 @@ void OApplication::showMainWidget( QWidget* widget, bool nomax )
void OApplication::setTitle( const QString& title ) const
{
if ( mainWidget() )
{
if ( !title.isNull() )
mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title );
else
mainWidget()->setCaption( _appname );
}
}
+}
+}
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 @@
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef OAPPLICATION_H
#define OAPPLICATION_H
-#define oApp OApplication::oApplication()
+#define oApp Opie::Core::OApplication::oApplication()
#include <qpe/qpeapplication.h>
-
+namespace Opie {
+namespace Core {
+namespace Private {
class OApplicationPrivate;
+} // private class
+
class OConfig;
class OApplication : public QPEApplication
{
Q_OBJECT
public:
/**
* Constructor. Parses command-line arguments and sets the window caption.
*
* @param rAppName application name. Will be used for finding the
@@ -89,16 +93,19 @@ class OApplication : public QPEApplication
*
* @param title the title. If not given, resets caption to appname
*/
virtual void setTitle( const QString& title = QString::null ) const;
protected:
void init();
private:
const QCString _appname;
static OApplication* _instance;
OConfig* _config;
- OApplicationPrivate* d;
+ Private::OApplicationPrivate* d;
};
+} // Core
+} // Opie
+
#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 @@
Boston, MA 02111-1307, USA.
*/
/* QT */
#include <qfont.h>
#include <qcolor.h>
/* OPIE */
#include <opie2/oconfig.h>
+using namespace Opie::Core;
+
OConfig::OConfig( const QString &name, Domain domain )
:Config( name, domain )
{
qDebug( "OConfig::OConfig()" );
}
OConfig::~OConfig()
{
qDebug( "OConfig::~OConfig()" );
}
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 @@
#ifndef OCONFIG_H
#define OCONFIG_H
//FIXME: Implement for X11 or reuse libqpe/Config there also?
//FIXME: Or rather use QSettings also for libqpe?
#include <qpe/config.h>
class QColor;
class QFont;
+namespace Opie {
+namespace Core {
+
/**
* A Configuration class based on the Qtopia @ref Config class
* featuring additional handling of color and font entries
*/
class OConfig : public Config
{
public:
/**
* Constructs a OConfig object with a @a name.
*/
OConfig( const QString &name, Domain domain = User );
/**
* Destructs the OConfig object.
*
* Writes back any dirty configuration entries, and destroys
* dynamically created objects.
*/
virtual ~OConfig();
/**
* @returns the name of the current group.
* The current group is used for searching keys and accessing entries.
+ * @todo make const
*/
const QString& group() { return git.key(); };
/**
* @returns a @ref QColor entry or a @a default value if the key is not found.
*/
QColor readColorEntry( const QString& key, const QColor* pDefault ) const;
/**
* @returns a @ref QFont value or a @a default value if the key is not found.
*/
QFont readFontEntry( const QString& key, const QFont* pDefault ) const;
+
+private:
+ class Private;
+ Private *d;
};
/**
* @brief Helper class for easier use of OConfig groups.
*
* Careful programmers always set the group of a
* @ref OConfig object to the group they want to read from
* and set it back to the old one of afterwards. This is usually
* written as:
* <pre>
*
* QString oldgroup config()->group();
@@ -127,15 +135,20 @@ class OConfigGroupSaver
* @todo make it not inline for bc reasons. See KDE BC guide
*/
~OConfigGroupSaver() { _config->setGroup( _oldgroup ); }
OConfig* config() { return _config; };
private:
OConfig* _config;
QString _oldgroup;
OConfigGroupSaver( const OConfigGroupSaver& );
OConfigGroupSaver& operator=( const OConfigGroupSaver& );
+
+ class Private;
+ Private *d;
};
+}
+}
#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 @@
#include <stdlib.h> // abort
#include <unistd.h> // getpid
#include <stdarg.h> // vararg stuff
#include <ctype.h> // isprint
#include <syslog.h>
#include <errno.h>
#include <string.h>
#ifndef OPIE_NO_BACKTRACE
#include <execinfo.h>
#endif
-
+namespace Opie {
+namespace Core {
/*======================================================================================
* debug levels
*======================================================================================*/
enum DebugLevels {
ODEBUG_INFO = 0,
ODEBUG_WARN = 1,
ODEBUG_ERROR = 2,
ODEBUG_FATAL = 3
};
/*======================================================================================
@@ -605,16 +606,20 @@ QString odBacktrace( int levels )
#endif
return s;
}
void odClearDebugConfig()
{
/*
delete oDebug_data->config;
oDebug_data->config = 0;
*/
}
+
#ifdef OPIE_NO_DEBUG
#define odDebug ondDebug
#define odBacktrace ondBacktrace
#endif
+
+}
+} \ 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 @@
class QWidget;
class QDateTime;
class QDate;
class QTime;
class QPoint;
class QSize;
class QRect;
class QRegion;
class QStringList;
class QColor;
class QBrush;
+namespace Opie {
+namespace Core {
+
class odbgstream;
class ondbgstream;
#ifdef __GNUC__
#define o_funcinfo "[" << __PRETTY_FUNCTION__ << "] "
#else
#define o_funcinfo "[" << __FILE__ << ":" << __LINE__ << "] "
#endif
#define o_lineinfo "[" << __FILE__ << ":" << __LINE__ << "] "
#define owarn odWarning()
@@ -385,24 +388,28 @@ class ondbgstream {
ondbgstream &form(const char *, ...) { return *this; }
ondbgstream& operator<<( const QDateTime& ) { return *this; }
ondbgstream& operator<<( const QDate& ) { return *this; }
ondbgstream& operator<<( const QTime& ) { return *this; }
ondbgstream& operator<<( const QPoint & ) { return *this; }
ondbgstream& operator<<( const QSize & ) { return *this; }
ondbgstream& operator<<( const QRect & ) { return *this; }
ondbgstream& operator<<( const QRegion & ) { return *this; }
ondbgstream& operator<<( const QStringList & ) { return *this; }
ondbgstream& operator<<( const QColor & ) { return *this; }
ondbgstream& operator<<( const QBrush & ) { return *this; }
+
+private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* related functions
*======================================================================================*/
/**
* Does nothing.
* @param a stream
* @return the given @p s
*/
inline ondbgstream& endl( ondbgstream & s) { return s; }
@@ -463,12 +470,14 @@ odbgstream odFatal(bool cond, int area = 0);
* Deletes the odebugrc cache and therefore forces KDebug to reread the
* config file
*/
void odClearDebugConfig();
#ifdef OPIE_NO_DEBUG
#define odDebug ondDebug
#define odBacktrace ondBacktrace
#endif
#endif
+}
+}
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 @@
#include <opie2/oglobal.h>
#include <qtextstream.h>
#include <qdir.h>
#include <qpe/mimetype.h>
#include <qpe/qpeapplication.h>
#include <qpe/storage.h>
#include <unistd.h>
#include <sys/types.h>
+using namespace Opie::Core;
+
static const char Base64EncMap[64] =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
};
@@ -303,36 +305,36 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) {
if (++didx < len )
out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
// Resize the output buffer
if ( len == 0 || len < out.size() )
out.resize(len);
return out;
}
bool OGlobal::isAppLnkFileName( const QString& str )
{
- if (str.length()==0||str.at(str.length()-1)==QDir::separator()) return false;
+ if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false;
return str.startsWith(MimeType::appsFolderName()+QDir::separator());
}
/* ToDo:
* This fun should check the document-path value for the mounted media
* which has to be implemented later. this moment we just check for a
* mounted media name.
*/
bool OGlobal::isDocumentFileName( const QString& file )
{
- if (file.length()==0||file.at(file.length()-1)==QDir::separator()) return false;
+ if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false;
if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true;
StorageInfo si;
QList< FileSystem > fl = si.fileSystems();
FileSystem*fs;
for (fs = fl.first();fs!=0;fs=fl.next()) {
if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator()))
return true;
}
if (file.startsWith(homeDirPath())+"/Documents/") return true;
return false;
}
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 @@
#endif
#include <sys/types.h>
//FIXME Is it wise or even necessary to inherit OGlobal from Global?
// once we totally skip libqpe it should ideally swallow Global -zecke
// You're right. I deleted global as the base class. -mickeyl
class QFile;
class QString;
class DateFormat;
+
+
+
+namespace Opie {
+namespace Core {
/**
*\brief OGlobal contains a list of generic functions
*
* The class OGlobal contains small utility functions
* which might be useful for other applications to use. It features access
* to the global device config and specialized functions to get information
* out of this config like Weekstart or Owner name.
*
* @todo ODP implement the things from Global which are good
* @author mickey,alwin,zecke
* @version 0.1
*/
@@ -137,15 +142,18 @@ public:
static void setWeekStartsOnMonday( bool );
static void setUseAMPM( bool );
//@}
//@{
static Global::Command* builtinCommands();
static QGuardedPtr<QWidget>* builtinRunning();
//@}
private:
static OConfig* _config;
static OConfig* _qpe_config;
+ class Private;
+ Private *d;
};
-
+}
+}
#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 @@
#include <opie2/oglobalsettings.h>
#include <opie2/oconfig.h>
#include <opie2/oglobal.h>
/* QT */
#include <qdir.h>
/* UNIX */
#include <stdlib.h>
+
+using namespace Opie::Core;
+
QString* OGlobalSettings::s_desktopPath = 0;
QString* OGlobalSettings::s_autostartPath = 0;
QString* OGlobalSettings::s_trashPath = 0;
QString* OGlobalSettings::s_documentPath = 0;
QFont *OGlobalSettings::_generalFont = 0;
QFont *OGlobalSettings::_fixedFont = 0;
QFont *OGlobalSettings::_toolBarFont = 0;
QFont *OGlobalSettings::_menuFont = 0;
QFont *OGlobalSettings::_windowTitleFont = 0;
QFont *OGlobalSettings::_taskbarFont = 0;
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 @@
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef OGLOBALSETTINGS_H
#define OGLOBALSETTINGS_H
#include <qstring.h>
#include <qcolor.h>
#include <qfont.h>
+/**
+ * \todo make real const values
+ */
#define OPIE_DEFAULT_SINGLECLICK true
#define OPIE_DEFAULT_INSERTTEAROFFHANDLES true
#define OPIE_DEFAULT_AUTOSELECTDELAY -1
#define OPIE_DEFAULT_CHANGECURSOR true
#define OPIE_DEFAULT_LARGE_CURSOR false
#define OPIE_DEFAULT_VISUAL_ACTIVATE true
#define OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED 50
//FIXME: There's still a whole lot of stuff in here which has to be revised
//FIXME: before public usage... lack of time to do it at once - so it will
//FIXME: happen step-by-step. ML.
// we should not habe too much configure options!!!!!! -zecke
+namespace Opie {
+namespace Core {
+
/**
* Access the OPIE global configuration settings.
*
*/
class OGlobalSettings
{
public:
/**
* Returns a threshold in pixels for drag & drop operations.
* As long as the mouse movement has not exceeded this number
* of pixels in either X or Y direction no drag operation may
@@ -359,15 +365,21 @@ private:
static QFont *_taskbarFont;
static QColor * kde2Gray;
static QColor * kde2Blue;
static QColor * kde2AlternateColor;
static OMouseSettings *s_mouseSettings;
static QColor * OpieGray;
static QColor * OpieBlue;
static QColor * OpieAlternate;
static QColor * OpieHighlight;
friend class OApplication;
+private:
+ class Private;
+ Private *d;
};
+}
+}
+
#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 @@
TEMPLATE = lib
CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/lib
HEADERS = oapplication.h \
oconfig.h \
odebug.h \
oglobal.h \
oglobalsettings.h \
oprocess.h \
oprocctrl.h \
osmartpointer.h \
- ostorageinfo.h \
- xmltree.h
+ ostorageinfo.h
SOURCES = oapplication.cpp \
oconfig.cpp \
odebug.cpp \
oglobal.cpp \
oglobalsettings.cpp \
oprocess.cpp \
oprocctrl.cpp \
- ostorageinfo.cpp \
- xmltree.cc
+ ostorageinfo.cpp
include ( device/device.pro )
INTERFACES =
TARGET = opiecore2
-VERSION = 1.8.5
+VERSION = 1.9.0
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
!contains( platform, x11 ) {
LIBS = -lqpe
include ( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
}
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 @@
#include <sys/socket.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <qsocketnotifier.h>
#include "oprocctrl.h"
+using namespace Opie::Core::Private;
+
OProcessController *OProcessController::theOProcessController = 0;
struct sigaction OProcessController::oldChildHandlerData;
bool OProcessController::handlerSet = false;
OProcessController::OProcessController()
{
assert( theOProcessController == 0 );
if (0 > pipe(fd))
printf(strerror(errno));
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 @@
// e9025461@student.tuwien.ac.at
// Ported by Holger Freyther
//
#ifndef __KPROCCTRL_H__
#define __KPROCCTRL_H__
#include <qvaluelist.h>
#include <qtimer.h>
#include "oprocess.h"
-class OProcessControllerPrivate;
class QSocketNotifier;
+
+namespace Opie {
+namespace Core {
+namespace Private {
+class OProcessControllerPrivate;
+
/**
* @short Used internally by @ref OProcess
* @internal
* @author Christian Czezakte <e9025461@student.tuwien.ac.at>
*
* A class for internal use by OProcess only. -- Exactly one instance
* of this class is generated by the first instance of OProcess that is
* created (a pointer to it gets stored in @ref theOProcessController ).
*
* This class takes care of the actual (UN*X) signal handling.
*/
class OProcessController : public QObject
@@ -106,16 +111,19 @@ private:
static struct sigaction oldChildHandlerData;
static bool handlerSet;
QValueList<OProcess*> processList;
QTimer delayedChildrenCleanupTimer;
// Disallow assignment and copy-construction
OProcessController( const OProcessController& );
OProcessController& operator= ( const OProcessController& );
OProcessControllerPrivate *d;
};
+}
+}
+}
#endif
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
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <unistd.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_INITGROUPS
#include <grp.h>
#endif
+using namespace Opie::Core::Private;
+
+namespace Opie {
+namespace Core {
+namespace Private {
class OProcessPrivate
{
public:
OProcessPrivate() : useShell( false )
{ }
bool useShell;
QMap<QString, QString> env;
QString wd;
QCString shell;
};
-
+}
OProcess::OProcess( QObject *parent, const char *name )
: QObject( parent, name )
{
init ( );
}
OProcess::OProcess( const QString &arg0, QObject *parent, const char *name )
: QObject( parent, name )
{
init ( );
*this << arg0;
@@ -932,12 +937,15 @@ int OProcess::processPID( const QString& process )
}
if ( line.contains( process ) )
{
//qDebug( "found process id #%d", (*it).toInt() );
return (*it).toInt();
}
else
{
//qDebug( "process '%s' not found", (const char*) process );
return 0;
}
}
+
+}
+}
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
/* QT */
#include <qcstring.h>
#include <qobject.h>
#include <qvaluelist.h>
/* STD */
#include <sys/types.h> // for pid_t
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
class QSocketNotifier;
+
+namespace Opie {
+namespace Core {
+namespace Private {
+class OProcessController;
class OProcessPrivate;
+}
/**
* Child process invocation, monitoring and control.
*
* @sect General usage and features
*
*This class allows a KDE and OPIE application to start child processes without having
*to worry about UN*X signal handling issues and zombie process reaping.
*
*@see KProcIO
*
*Basically, this class distinguishes three different ways of running
@@ -388,24 +394,25 @@ public:
/**
* This causes the stderr file descriptor of the child process to be
* closed.
*
* @return @p false if no communication to the process's stderr
* had been specified in the call to @ref start().
*/
bool closeStderr();
/**
* Lets you see what your arguments are for debugging.
+ * \todo make const
*/
const QValueList<QCString> &args()
{
return arguments;
}
/**
* Controls whether the started process should drop any
* setuid/segid privileges or whether it should keep them
*
* The default is @p false : drop privileges
@@ -707,25 +714,25 @@ protected:
int childError( int fdno );
// information about the data that has to be sent to the child:
const char *input_data; // the buffer holding the data
int input_sent; // # of bytes already transmitted
int input_total; // total length of input_data
/**
* @ref OProcessController is a friend of OProcess because it has to have
* access to various data members.
*/
- friend class OProcessController;
+ friend class Private::OProcessController;
private:
/**
* Searches for a valid shell.
* Here is the algorithm used for finding an executable shell:
*
* @li Try the executable pointed to by the "SHELL" environment
* variable with white spaces stripped off
*
* @li If your process runs with uid != euid or gid != egid, a shell
* not listed in /etc/shells will not used.
*
@@ -736,17 +743,19 @@ private:
/**
* Used by @ref searchShell in order to find out whether the shell found
* is actually executable at all.
*/
bool isExecutable( const QCString &filename );
// Disallow assignment and copy-construction
OProcess( const OProcess& );
OProcess& operator= ( const OProcess& );
private:
void init ( );
- OProcessPrivate *d;
+ Private::OProcessPrivate *d;
};
+}
+}
#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
@@ -31,24 +31,25 @@ _;:, .> :=|. This program is free software; you can
#ifndef _OSmartPointer_h
#define _OSmartPointer_h
/*!
* \file OSmartPointer.h
* \brief smart pointer and reference counter
* \author Rajko Albrecht
*
*/
namespace Opie {
+namespace Core {
//! simple reference counter class
class ORefCount {
protected:
//! reference count member
long m_RefCount;
public:
//! first reference must be added after "new" via Pointer()
ORefCount() : m_RefCount(0)
{}
virtual ~ORefCount() {}
//! add a reference
@@ -131,15 +132,16 @@ public:
//! supports "if (pointer)"
operator bool () const { return (ptr != NULL); }
//! "if (pointer)" as non const
operator bool () { return ptr != NULL;}
//! support if (!pointer)"
bool operator! () const { return (ptr == NULL); }
//! support if (!pointer)" as non const
bool operator! () { return (ptr == NULL); }
};
}
+}
#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
@@ -20,24 +20,26 @@
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/ostorageinfo.h>
+using namespace Opie::Core;
+
OStorageInfo::OStorageInfo( QObject *parent )
: StorageInfo( parent )
{
}
OStorageInfo::~OStorageInfo()
{
}
QString OStorageInfo::cfPath()const
{
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 @@
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef OSTORAGE_H
#define OSTORAGE_H
#include <qpe/storage.h>
+namespace Opie {
+namespace Core {
+
class OStorageInfo : public StorageInfo
{
Q_OBJECT
public:
OStorageInfo( QObject *parent=0 );
~OStorageInfo();
/**
* @returns the mount path of the CF (Compact Flash) card
*
**/
QString cfPath() const;
/**
* @returns the mount path of the SD (Secure Digital) card
*
**/
QString sdPath() const;
/**
* @returns the mount path of the MMC (MultiMedia) card
*
**/
QString mmcPath() const;
+private:
+ class Private;
+ Private *d;
};
+}
+}
#endif // OSTORAGE_H
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 @@
-/* This file is part of the KDE project
- Copyright (C) 2001 Simon Hausmann <hausmann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <opie2/xmltree.h>
-
-#include <qpe/stringutil.h>
-
-#include <qxml.h>
-
-#include <assert.h>
-
-using namespace Opie;
-
-XMLElement::XMLElement()
- : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 )
-{
-}
-
-XMLElement::~XMLElement()
-{
- XMLElement *n = m_first;
-
- while ( n )
- {
- XMLElement *tmp = n;
- n = n->m_next;
- delete tmp;
- }
-}
-
-void XMLElement::appendChild( XMLElement *child )
-{
- if ( child->m_parent )
- child->m_parent->removeChild( child );
-
- child->m_parent = this;
-
- if ( m_last )
- m_last->m_next = child;
-
- child->m_prev = m_last;
-
- if ( !m_first )
- m_first = child;
-
- m_last = child;
-}
-
-void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
-{
- assert( newChild != refChild );
-
- if ( refChild == m_last )
- {
- appendChild( newChild );
- return;
- }
-
- assert( refChild );
- assert( refChild->m_parent );
- assert( refChild->m_parent == this );
-
- if ( newChild->m_parent && newChild != refChild )
- newChild->m_parent->removeChild( newChild );
-
- newChild->m_parent = this;
-
- XMLElement *next = refChild->m_next;
-
- refChild->m_next = newChild;
-
- newChild->m_prev = refChild;
- newChild->m_next = next;
-
- if ( next )
- next->m_prev = newChild;
-}
-
-QString XMLElement::attribute( const QString &attr ) const
-{
- AttributeMap::ConstIterator it = m_attributes.find( attr );
- if ( it == m_attributes.end() )
- return QString::null;
- return it.data();
-}
-
-void XMLElement::setAttribute( const QString &attr, const QString &value )
-{
- m_attributes.replace( attr, value );
-}
-
-void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild )
-{
- assert( refChild );
- assert( refChild->m_parent );
- assert( refChild->m_parent == this );
- assert( newChild != refChild );
-
- if ( newChild->m_parent && newChild != refChild )
- newChild->m_parent->removeChild( newChild );
-
- newChild->m_parent = this;
-
- XMLElement *prev = refChild->m_prev;
-
- refChild->m_prev = newChild;
-
- newChild->m_prev = prev;
- newChild->m_next = refChild;
-
- if ( prev )
- prev->m_next = newChild;
-
- if ( refChild == m_first )
- m_first = newChild;
-}
-
-void XMLElement::removeChild( XMLElement *child )
-{
- if ( child->m_parent != this )
- return;
-
- if ( m_first == child )
- m_first = child->m_next;
-
- if ( m_last == child )
- m_last = child->m_prev;
-
- if ( child->m_prev )
- child->m_prev->m_next = child->m_next;
-
- if ( child->m_next )
- child->m_next->m_prev = child->m_prev;
-
- child->m_parent = 0;
- child->m_prev = 0;
- child->m_next = 0;
-}
-
-void XMLElement::save( QTextStream &s, uint indent )
-{
- if ( !m_value.isEmpty() )
- {
- s << Qtopia::escapeString( m_value );
- return;
- }
-
- for ( uint i = 0; i < indent; ++i )
- s << " ";
-
- s << "<" << m_tag;
-
- if ( !m_attributes.isEmpty() )
- {
- s << " ";
- AttributeMap::ConstIterator it = m_attributes.begin();
- AttributeMap::ConstIterator end = m_attributes.end();
- for (; it != end; ++it )
- {
- s << it.key() << "=\"" << Qtopia::escapeString( it.data() ) << "\"";
- s << " ";
- }
- }
-
- if ( m_last )
- {
- if ( ( m_first && !m_first->value().isEmpty() ) || !m_parent )
- s << ">";
- else
- s << ">" << endl;
-
- int newIndent = indent;
- if ( m_parent )
- newIndent++;
-
- XMLElement *n = m_first;
- while ( n )
- {
- n->save( s, newIndent );
- n = n->nextChild();
- }
-
- if ( m_last && m_last->value().isEmpty() && m_parent )
- for ( uint i = 0; i < indent; ++i )
- s << " ";
-
- if ( m_parent )
- s << "</" << m_tag << ">" << endl;
- }
- else
- s << "/>" << endl;
-}
-
-class Handler : public QXmlDefaultHandler
-{
-public:
- Handler() : m_node( 0 ), m_root( 0 ) {}
-
- XMLElement *root() const { return m_root; }
-
- virtual bool startDocument();
- virtual bool endDocument();
- virtual bool startElement( const QString &ns, const QString &ln, const QString &qName,
- const QXmlAttributes &attr );
- virtual bool endElement( const QString &ns, const QString &ln, const QString &qName );
- virtual bool characters( const QString &ch );
-
-private:
- XMLElement *m_node;
- XMLElement *m_root;
-};
-
-bool Handler::startDocument()
-{
- m_root = m_node = new XMLElement;
-
- return true;
-}
-
-bool Handler::endDocument()
-{
- return m_root == m_node;
-}
-
-bool Handler::startElement( const QString &, const QString &, const QString &qName,
- const QXmlAttributes &attr )
-{
- XMLElement *bm = new XMLElement;
-
- XMLElement::AttributeMap attributes;
- for ( int i = 0; i < attr.length(); ++i )
- attributes[ attr.qName( i ) ] = attr.value( i );
-
- bm->setAttributes( attributes );
-
- bm->setTagName( qName );
-
- m_node->appendChild( bm );
- m_node = bm;
-
- return true;
-}
-
-bool Handler::endElement( const QString &, const QString &, const QString & )
-{
- if ( m_node == m_root )
- return false;
-
- m_node = m_node->parent();
- return true;
-}
-
-bool Handler::characters( const QString &ch )
-{
- XMLElement *textNode = new XMLElement;
- textNode->setValue( ch );
- m_node->appendChild( textNode );
- return true;
-}
-
-XMLElement *XMLElement::namedItem( const QString &name )
-{
- XMLElement *e = m_first;
-
- for (; e; e = e->nextChild() )
- if ( e->tagName() == name )
- return e;
-
- return 0;
-}
-
-XMLElement *XMLElement::clone() const
-{
- XMLElement *res = new XMLElement;
-
- res->setTagName( m_tag );
- res->setValue( m_value );
- res->setAttributes( m_attributes );
-
- XMLElement *e = m_first;
- for (; e; e = e->m_next )
- res->appendChild( e->clone() );
-
- return res;
-}
-
-XMLElement *XMLElement::load( const QString &fileName )
-{
- QFile f( fileName );
- if ( !f.open( IO_ReadOnly ) )
- return 0;
-
- QTextStream stream( &f );
- stream.setEncoding( QTextStream::UnicodeUTF8 );
- QXmlInputSource src( stream );
- QXmlSimpleReader reader;
- Handler handler;
-
- reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false );
- reader.setContentHandler( &handler );
- reader.parse( src );
-
- return handler.root();;
-}
-
-/* vim: et sw=4
- */
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 @@
-/* This file is part of the KDE project
- Copyright (C) 2000,2001 Simon Hausmann <hausmann@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-
-#ifndef __bookmarks_h__
-#define __bookmarks_h__
-
-#include <qstring.h>
-#include <qmap.h>
-#include <qtextstream.h>
-
-namespace Opie
-{
-
-/**
- * A small xml lib written by Simon Hausmann.
- */
-class XMLElement
-{
-public:
- typedef QMap<QString, QString> AttributeMap;
-
- /**
- * The constructor of XMLElement
- */
- XMLElement();
- ~XMLElement();
-
- /** appendChild appends a child to the XMLElement behind the last element.
- * The ownership of the child get's transfered to the
- * this XMLElement.
- * If child is already the child of another parent
- * it's get removed from the other parent first.
- */
- void appendChild( XMLElement *child );
-
- /** inserts newChild after refChild. If newChild is the child
- * of another parent the child will get removed.
- * The ownership of child gets transfered.
- *
- */
- void insertAfter( XMLElement *newChild, XMLElement *refChild );
-
- /** same as insertAfter but the element get's inserted before refChild.
- *
- */
- void insertBefore( XMLElement *newChild, XMLElement *refChild );
-
- /** removeChild removes the child from the XMLElement.
- * The ownership gets dropped. You need to delete the
- * child yourself.
- */
- void removeChild( XMLElement *child );
-
- /** parent() returns the parent of this XMLElement
- * If there is no parent 0l gets returned
- */
- XMLElement *parent() const { return m_parent; }
- XMLElement *firstChild() const { return m_first; }
- XMLElement *nextChild() const { return m_next; }
- XMLElement *prevChild() const { return m_prev; }
- XMLElement *lastChild() const { return m_last; }
-
- void setTagName( const QString &tag ) { m_tag = tag; }
- QString tagName() const { return m_tag; }
-
- void setValue( const QString &val ) { m_value = val; }
- QString value() const { return m_value; }
-
- void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; }
- AttributeMap attributes() const { return m_attributes; }
- AttributeMap &attributes() { return m_attributes; }
-
- QString attribute( const QString & ) const;
- void setAttribute( const QString &attr, const QString &value );
- void save( QTextStream &stream, uint indent = 0 );
-
- XMLElement *namedItem( const QString &name );
-
- XMLElement *clone() const;
-
- static XMLElement *load( const QString &fileName );
-
-private:
- QString m_tag;
- QString m_value;
- AttributeMap m_attributes;
-
- XMLElement *m_parent;
- XMLElement *m_next;
- XMLElement *m_prev;
- XMLElement *m_first;
- XMLElement *m_last;
-
- XMLElement( const XMLElement &rhs );
- XMLElement &operator=( const XMLElement &rhs );
- class Private;
- Private* d;
-};
-
-} // namespace Opie
-
-#endif