author | tille <tille> | 2003-09-02 15:38:07 (UTC) |
---|---|---|
committer | tille <tille> | 2003-09-02 15:38:07 (UTC) |
commit | e87caebc920ad256d210eeb31aeb134318f0c104 (patch) (unidiff) | |
tree | 2776167f9277b41cb03d4afbb5626ccb6a88b8ea /libopie2 | |
parent | aa1be5c49b77368999f068222f5f4e1f0d1ace0d (diff) | |
download | opie-e87caebc920ad256d210eeb31aeb134318f0c104.zip opie-e87caebc920ad256d210eeb31aeb134318f0c104.tar.gz opie-e87caebc920ad256d210eeb31aeb134318f0c104.tar.bz2 |
this should make oapplication compile (and run) for qt3/x11
-rw-r--r-- | libopie2/examples/examples.pro | 10 | ||||
-rw-r--r-- | libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro | 8 | ||||
-rw-r--r-- | libopie2/examples/opiecore/odebugdemo/odebugdemo.pro | 10 | ||||
-rw-r--r-- | libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro | 10 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/oconfig.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/oconfig.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/oglobal.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/oglobal.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/opieapplication.cpp | 48 | ||||
-rw-r--r-- | libopie2/opiecore/opieapplication.h | 58 | ||||
-rw-r--r-- | libopie2/opiecore/opieconfig.cpp | 69 | ||||
-rw-r--r-- | libopie2/opiecore/opieconfig.h | 79 | ||||
-rw-r--r-- | libopie2/opiecore/opiecore.pro | 14 |
15 files changed, 306 insertions, 20 deletions
diff --git a/libopie2/examples/examples.pro b/libopie2/examples/examples.pro index c1ed98e..b2d47b0 100644 --- a/libopie2/examples/examples.pro +++ b/libopie2/examples/examples.pro | |||
@@ -1,4 +1,12 @@ | |||
1 | TEMPLATE = subdirs | 1 | TEMPLATE = subdirs |
2 | unix:SUBDIRS = opieui opienet opiecore opiemm opiedb | 2 | unix:SUBDIRS = opieui opienet opiecore opiemm opiedb |
3 | 3 | ||
4 | #include ( ../../../include.pro ) | 4 | |
5 | !contains( platform, x11 ) { | ||
6 | include ( $(OPIEDIR)/include.pro ) | ||
7 | } | ||
8 | |||
9 | contains( platform, x11 ) { | ||
10 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
11 | } | ||
12 | |||
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro index 0109c57..9b59106 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro | |||
@@ -5,10 +5,16 @@ SOURCES = oconfigdemo.cpp | |||
5 | 5 | ||
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lopiecore2 | 8 | LIBS += -lopiecore2 |
9 | TARGET = oconfigdemo | 9 | TARGET = oconfigdemo |
10 | MOC_DIR = moc | 10 | MOC_DIR = moc |
11 | OBJECTS_DIR = obj | 11 | OBJECTS_DIR = obj |
12 | 12 | ||
13 | include ( $(OPIEDIR)/include.pro ) | 13 | !contains( platform, x11 ) { |
14 | include ( $(OPIEDIR)/include.pro ) | ||
15 | } | ||
16 | |||
17 | contains( platform, x11 ) { | ||
18 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
19 | } | ||
14 | 20 | ||
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro index 4cd815f..c52cd02 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro | |||
@@ -2,12 +2,18 @@ TEMPLATE = app | |||
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = odebugdemo.cpp | 4 | SOURCES = odebugdemo.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lopiecore2 | 7 | LIBS += -lopiecore2 |
8 | TARGET = odebugdemo | 8 | TARGET = odebugdemo |
9 | 9 | ||
10 | include ( $(OPIEDIR)/include.pro ) | ||
11 | |||
12 | MOC_DIR = moc | 10 | MOC_DIR = moc |
13 | OBJECTS_DIR = obj | 11 | OBJECTS_DIR = obj |
12 | |||
13 | !contains( platform, x11 ) { | ||
14 | include ( $(OPIEDIR)/include.pro ) | ||
15 | } | ||
16 | |||
17 | contains( platform, x11 ) { | ||
18 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
19 | } | ||
diff --git a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro index aabe733..99eb41a 100644 --- a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro +++ b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro | |||
@@ -5,11 +5,19 @@ SOURCES = olistviewdemo.cpp \ | |||
5 | main.cpp | 5 | main.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lopieui2 -lopiecore2 | 8 | LIBS += -lopieui2 -lopiecore2 |
9 | TARGET = olistviewdemo | 9 | TARGET = olistviewdemo |
10 | MOC_DIR = moc | 10 | MOC_DIR = moc |
11 | OBJECTS_DIR = obj | 11 | OBJECTS_DIR = obj |
12 | 12 | ||
13 | include ( $(OPIEDIR)/include.pro ) | ||
14 | 13 | ||
15 | 14 | ||
15 | |||
16 | !contains( platform, x11 ) { | ||
17 | include ( $(OPIEDIR)/include.pro ) | ||
18 | } | ||
19 | |||
20 | contains( platform, x11 ) { | ||
21 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
22 | } | ||
23 | |||
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index c3cacce..12f33cc 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp | |||
@@ -49,17 +49,17 @@ class OApplicationPrivate | |||
49 | }; | 49 | }; |
50 | 50 | ||
51 | /**************************************************************************************************/ | 51 | /**************************************************************************************************/ |
52 | /* OApplication | 52 | /* OApplication |
53 | /**************************************************************************************************/ | 53 | /**************************************************************************************************/ |
54 | 54 | ||
55 | 55 | ||
56 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) | 56 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) |
57 | :QPEApplication( argc, argv ), | 57 | :OpieApplication( argc, argv ), |
58 | _appname( rAppName ), | 58 | _appname( rAppName ), |
59 | _config( 0 ) | 59 | _config( 0 ) |
60 | { | 60 | { |
61 | init(); | 61 | init(); |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | OApplication::~OApplication() | 65 | OApplication::~OApplication() |
@@ -103,17 +103,17 @@ void OApplication::init() | |||
103 | { | 103 | { |
104 | qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); | 104 | qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) | 109 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) |
110 | { | 110 | { |
111 | QPEApplication::showMainWidget( widget, nomax ); | 111 | OpieApplication::showMainWidget( widget, nomax ); |
112 | widget->setCaption( _appname ); | 112 | widget->setCaption( _appname ); |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | void OApplication::setTitle( const QString& title ) const | 116 | void OApplication::setTitle( const QString& title ) const |
117 | { | 117 | { |
118 | if ( mainWidget() ) | 118 | if ( mainWidget() ) |
119 | { | 119 | { |
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index 72a659e..da5b905 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h | |||
@@ -29,24 +29,24 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OAPPLICATION_H | 31 | #ifndef OAPPLICATION_H |
32 | #define OAPPLICATION_H | 32 | #define OAPPLICATION_H |
33 | 33 | ||
34 | #define oApp OApplication::oApplication() | 34 | #define oApp OApplication::oApplication() |
35 | 35 | ||
36 | 36 | ||
37 | #include <qpe/qpeapplication.h> | 37 | #include "opieapplication.h" |
38 | 38 | ||
39 | 39 | ||
40 | class OApplicationPrivate; | 40 | class OApplicationPrivate; |
41 | class OConfig; | 41 | class OConfig; |
42 | 42 | ||
43 | 43 | ||
44 | class OApplication : public QPEApplication | 44 | class OApplication : public OpieApplication |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | /** | 49 | /** |
50 | * Constructor. Parses command-line arguments and sets the window caption. | 50 | * Constructor. Parses command-line arguments and sets the window caption. |
51 | * | 51 | * |
52 | * @param rAppName application name. Will be used for finding the | 52 | * @param rAppName application name. Will be used for finding the |
diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp index 40edbc7..dc4d0b3 100644 --- a/libopie2/opiecore/oconfig.cpp +++ b/libopie2/opiecore/oconfig.cpp | |||
@@ -34,17 +34,17 @@ | |||
34 | #include <qfont.h> | 34 | #include <qfont.h> |
35 | #include <qcolor.h> | 35 | #include <qcolor.h> |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | 38 | ||
39 | #include <opie2/oconfig.h> | 39 | #include <opie2/oconfig.h> |
40 | 40 | ||
41 | OConfig::OConfig( const QString &name, Domain domain ) | 41 | OConfig::OConfig( const QString &name, Domain domain ) |
42 | :Config( name, domain ) | 42 | :OpieConfig( name, domain ) |
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | OConfig::~OConfig() | 46 | OConfig::~OConfig() |
47 | { | 47 | { |
48 | } | 48 | } |
49 | 49 | ||
50 | QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const | 50 | QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const |
diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h index 444d280..e7d3be6 100644 --- a/libopie2/opiecore/oconfig.h +++ b/libopie2/opiecore/oconfig.h | |||
@@ -30,27 +30,27 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OCONFIG_H | 32 | #ifndef OCONFIG_H |
33 | #define OCONFIG_H | 33 | #define OCONFIG_H |
34 | 34 | ||
35 | //FIXME: Implement for X11 or reuse libqpe/Config there also? | 35 | //FIXME: Implement for X11 or reuse libqpe/Config there also? |
36 | //FIXME: Or rather use QSettings also for libqpe? | 36 | //FIXME: Or rather use QSettings also for libqpe? |
37 | 37 | ||
38 | #include <qpe/config.h> | 38 | #include "opieconfig.h" |
39 | 39 | ||
40 | class QColor; | 40 | class QColor; |
41 | class QFont; | 41 | class QFont; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * A Configuration class based on the Qtopia @ref Config class | 44 | * A Configuration class based on the Qtopia @ref Config class |
45 | * featuring additional handling of color and font entries | 45 | * featuring additional handling of color and font entries |
46 | */ | 46 | */ |
47 | 47 | ||
48 | class OConfig : public Config | 48 | class OConfig : public OpieConfig |
49 | { | 49 | { |
50 | public: | 50 | public: |
51 | /** | 51 | /** |
52 | * Constructs a OConfig object with a @a name. | 52 | * Constructs a OConfig object with a @a name. |
53 | */ | 53 | */ |
54 | OConfig( const QString &name, Domain domain = User ); | 54 | OConfig( const QString &name, Domain domain = User ); |
55 | /** | 55 | /** |
56 | * Destructs the OConfig object. | 56 | * Destructs the OConfig object. |
@@ -58,17 +58,17 @@ class OConfig : public Config | |||
58 | * Writes back any dirty configuration entries, and destroys | 58 | * Writes back any dirty configuration entries, and destroys |
59 | * dynamically created objects. | 59 | * dynamically created objects. |
60 | */ | 60 | */ |
61 | virtual ~OConfig(); | 61 | virtual ~OConfig(); |
62 | /** | 62 | /** |
63 | * @returns the name of the current group. | 63 | * @returns the name of the current group. |
64 | * The current group is used for searching keys and accessing entries. | 64 | * The current group is used for searching keys and accessing entries. |
65 | */ | 65 | */ |
66 | const QString& group() { return git.key(); }; | 66 | const QString& group() { return group(); }; |
67 | /** | 67 | /** |
68 | * @returns a @ref QColor entry or a @a default value if the key is not found. | 68 | * @returns a @ref QColor entry or a @a default value if the key is not found. |
69 | */ | 69 | */ |
70 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; | 70 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; |
71 | /** | 71 | /** |
72 | * @returns a @ref QFont value or a @a default value if the key is not found. | 72 | * @returns a @ref QFont value or a @a default value if the key is not found. |
73 | */ | 73 | */ |
74 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; | 74 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; |
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp index 2eb4108..f6071be 100644 --- a/libopie2/opiecore/oglobal.cpp +++ b/libopie2/opiecore/oglobal.cpp | |||
@@ -27,10 +27,10 @@ | |||
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/oglobal.h> | 31 | #include <opie2/oglobal.h> |
32 | 32 | ||
33 | OConfig* OGlobal::config() | 33 | OConfig* OGlobal::config() |
34 | { | 34 | { |
35 | return &globalconfig; | 35 | return globalconfig; |
36 | } | 36 | } |
diff --git a/libopie2/opiecore/oglobal.h b/libopie2/opiecore/oglobal.h index 34f211e..23cedde 100644 --- a/libopie2/opiecore/oglobal.h +++ b/libopie2/opiecore/oglobal.h | |||
@@ -29,17 +29,17 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OGLOBAL_H | 31 | #ifndef OGLOBAL_H |
32 | #define OGLOBAL_H | 32 | #define OGLOBAL_H |
33 | 33 | ||
34 | #include <qpe/global.h> | 34 | #include <qpe/global.h> |
35 | #include <opie2/oconfig.h> | 35 | #include <opie2/oconfig.h> |
36 | 36 | ||
37 | static OConfig globalconfig = OConfig( "global" ); | 37 | static OConfig *globalconfig = new OConfig( "global" ); |
38 | 38 | ||
39 | //FIXME: Is it wise or even necessary to inherit OGlobal from Global? | 39 | //FIXME: Is it wise or even necessary to inherit OGlobal from Global? |
40 | // once we totally skip libqpe it should ideally swallow Global -zecke | 40 | // once we totally skip libqpe it should ideally swallow Global -zecke |
41 | 41 | ||
42 | class OGlobal : public Global | 42 | class OGlobal : public Global |
43 | { | 43 | { |
44 | public: | 44 | public: |
45 | // do we want to put that into OApplication as in KApplication -zecke | 45 | // do we want to put that into OApplication as in KApplication -zecke |
diff --git a/libopie2/opiecore/opieapplication.cpp b/libopie2/opiecore/opieapplication.cpp new file mode 100644 index 0000000..7ff7b44 --- a/dev/null +++ b/libopie2/opiecore/opieapplication.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
31 | |||
32 | #include "opieapplication.h" | ||
33 | |||
34 | OpieApplication::OpieApplication( int& argc, char** argv) | ||
35 | #ifdef QWS | ||
36 | : QPEApplication(argc,argv) | ||
37 | #else | ||
38 | : QApplication(argc,argv) | ||
39 | #endif | ||
40 | {}; | ||
41 | |||
42 | #ifndef QWS | ||
43 | void OpieApplication::showMainWidget( QWidget* widget, bool nomax ) | ||
44 | { | ||
45 | setMainWidget( widget ); | ||
46 | widget->show(); | ||
47 | }; | ||
48 | #endif | ||
diff --git a/libopie2/opiecore/opieapplication.h b/libopie2/opiecore/opieapplication.h new file mode 100644 index 0000000..a864ee9 --- a/dev/null +++ b/libopie2/opiecore/opieapplication.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
31 | #ifndef OPIE_APPLICATION_H | ||
32 | #define OPIE_APPLICATION_H | ||
33 | |||
34 | #ifdef QWS | ||
35 | #include <qpe/qpeapplication.h> | ||
36 | #else | ||
37 | #include <qapplication.h> | ||
38 | #endif | ||
39 | |||
40 | class OpieApplication | ||
41 | #ifdef QWS | ||
42 | : public QPEApplication | ||
43 | #else | ||
44 | : public QApplication | ||
45 | #endif | ||
46 | { | ||
47 | public: | ||
48 | OpieApplication( int& argc, char** argv ); | ||
49 | |||
50 | #ifndef QWS | ||
51 | void showMainWidget( QWidget* widget, bool nomax=false ); | ||
52 | #endif | ||
53 | }; | ||
54 | |||
55 | |||
56 | #endif | ||
57 | |||
58 | |||
diff --git a/libopie2/opiecore/opieconfig.cpp b/libopie2/opiecore/opieconfig.cpp new file mode 100644 index 0000000..ac65977 --- a/dev/null +++ b/libopie2/opiecore/opieconfig.cpp | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
31 | |||
32 | #include "opieconfig.h" | ||
33 | |||
34 | OpieConfig::OpieConfig( const QString &name, Domain domain ) | ||
35 | #ifdef QWS | ||
36 | :Config( name, domain ) | ||
37 | { | ||
38 | #else | ||
39 | :QSettings(Native), hasGroup(false) | ||
40 | { | ||
41 | Scope s; | ||
42 | switch (domain) { | ||
43 | case File: s = QSettings::Global; | ||
44 | break; | ||
45 | case User: s = QSettings::User; | ||
46 | break; | ||
47 | } | ||
48 | setPath("libopie2", name, s ); | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | |||
53 | #ifndef QWS | ||
54 | |||
55 | void OpieConfig::setGroup( const QString& key) | ||
56 | { | ||
57 | if (hasGroup) endGroup(); | ||
58 | hasGroup = true; | ||
59 | beginGroup( key ); | ||
60 | }; | ||
61 | |||
62 | bool OpieConfig::hasKey ( const QString & key ) const | ||
63 | { | ||
64 | bool *ok; | ||
65 | readEntry( key, QString::null, ok ); | ||
66 | return *ok; | ||
67 | }; | ||
68 | #endif | ||
69 | |||
diff --git a/libopie2/opiecore/opieconfig.h b/libopie2/opiecore/opieconfig.h new file mode 100644 index 0000000..011ac86 --- a/dev/null +++ b/libopie2/opiecore/opieconfig.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | (C) 2003 Patrick S. Vogt | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | |||
30 | #ifndef OPIECONFIG_H | ||
31 | #define OPIECONFIG_H | ||
32 | |||
33 | |||
34 | #ifdef QWS | ||
35 | #include <qpe/config.h> | ||
36 | #else | ||
37 | #include <qsettings.h> | ||
38 | #endif | ||
39 | |||
40 | |||
41 | class OpieConfig | ||
42 | #ifdef QWS | ||
43 | : public Config | ||
44 | #else | ||
45 | : public QSettings | ||
46 | #endif | ||
47 | { | ||
48 | |||
49 | public: | ||
50 | #ifndef QWS | ||
51 | enum Domain { File, User }; | ||
52 | #endif | ||
53 | |||
54 | OpieConfig( const QString&, Domain ); | ||
55 | |||
56 | #ifndef QWS | ||
57 | void setGroup( const QString& key); | ||
58 | bool hasKey ( const QString & key ) const; | ||
59 | #endif | ||
60 | |||
61 | /** | ||
62 | * @returns the name of the current group. | ||
63 | * The current group is used for searching keys and accessing entries. | ||
64 | */ | ||
65 | const QString& group() | ||
66 | #ifdef QWS | ||
67 | { return git.key(); }; | ||
68 | #else | ||
69 | { return group(); }; | ||
70 | #endif | ||
71 | |||
72 | #ifndef QWS | ||
73 | private: | ||
74 | bool hasGroup; | ||
75 | #endif | ||
76 | |||
77 | }; | ||
78 | |||
79 | #endif // OPIECONFIG_H | ||
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro index 18c6986..fe5800e 100644 --- a/libopie2/opiecore/opiecore.pro +++ b/libopie2/opiecore/opiecore.pro | |||
@@ -1,39 +1,43 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = oconfig.h \ | 4 | HEADERS = oapplication.h \ |
5 | opieapplication.h \ | ||
6 | oconfig.h \ | ||
7 | opieconfig.h \ | ||
5 | ocompletionbase.h \ | 8 | ocompletionbase.h \ |
6 | ocompletion.h \ | 9 | ocompletion.h \ |
7 | odebug.h \ | 10 | odebug.h \ |
8 | oglobal.h \ | 11 | oglobal.h \ |
9 | oglobalsettings.h \ | 12 | oglobalsettings.h \ |
10 | osortablevaluelist.h | 13 | osortablevaluelist.h |
11 | 14 | ||
12 | SOURCES = oconfig.cpp \ | 15 | |
16 | SOURCES = oapplication.cpp \ | ||
17 | opieapplication.cpp \ | ||
18 | oconfig.cpp \ | ||
19 | opieconfig.cpp \ | ||
13 | ocompletionbase.cpp \ | 20 | ocompletionbase.cpp \ |
14 | ocompletion.cpp \ | 21 | ocompletion.cpp \ |
15 | odebug.cpp \ | 22 | odebug.cpp \ |
16 | oglobal.cpp \ | 23 | oglobal.cpp \ |
17 | oglobalsettings.cpp | 24 | oglobalsettings.cpp |
18 | 25 | ||
19 | INTERFACES = | 26 | INTERFACES = |
20 | TARGET = opiecore2 | 27 | TARGET = opiecore2 |
21 | VERSION = 1.8.1 | 28 | VERSION = 1.8.1 |
22 | INCLUDEPATH += $(OPIEDIR)/include | 29 | INCLUDEPATH += $(OPIEDIR)/include |
23 | DEPENDPATH += $(OPIEDIR)/include | 30 | DEPENDPATH += $(OPIEDIR)/include |
24 | MOC_DIR = moc | 31 | MOC_DIR = moc |
25 | OBJECTS_DIR = obj | 32 | OBJECTS_DIR = obj |
26 | 33 | ||
27 | 34 | ||
28 | !contains( platform, x11 ) { | 35 | !contains( platform, x11 ) { |
29 | HEADERS += oapplication.h | ||
30 | SOURCES += oapplication.cpp | ||
31 | LIBS = -lqpe | 36 | LIBS = -lqpe |
32 | include ( $(OPIEDIR)/include.pro ) | 37 | include ( $(OPIEDIR)/include.pro ) |
33 | } | 38 | } |
34 | 39 | ||
35 | contains( platform, x11 ) { | 40 | contains( platform, x11 ) { |
36 | message( NOT building oapplication for X11 ) | ||
37 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 41 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
38 | } | 42 | } |
39 | 43 | ||