-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 | |||
@@ -1,14 +1,20 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = oconfigdemo.cpp | 4 | 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 | |||
@@ -1,13 +1,19 @@ | |||
1 | TEMPLATE = app | 1 | 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 | |||
@@ -1,15 +1,23 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | HEADERS = olistviewdemo.h | 3 | HEADERS = olistviewdemo.h |
4 | SOURCES = olistviewdemo.cpp \ | 4 | 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 | |||
@@ -9,118 +9,118 @@ | |||
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/oapplication.h> | 31 | #include <opie2/oapplication.h> |
32 | #include <opie2/oconfig.h> | 32 | #include <opie2/oconfig.h> |
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | 34 | ||
35 | #include <signal.h> | 35 | #include <signal.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | 37 | ||
38 | OApplication* OApplication::_instance = 0; | 38 | OApplication* OApplication::_instance = 0; |
39 | 39 | ||
40 | /**************************************************************************************************/ | 40 | /**************************************************************************************************/ |
41 | /* OApplicationPrivate | 41 | /* OApplicationPrivate |
42 | /**************************************************************************************************/ | 42 | /**************************************************************************************************/ |
43 | 43 | ||
44 | class OApplicationPrivate | 44 | class OApplicationPrivate |
45 | { | 45 | { |
46 | public: | 46 | public: |
47 | OApplicationPrivate() {}; | 47 | OApplicationPrivate() {}; |
48 | ~OApplicationPrivate() {}; | 48 | ~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() |
66 | { | 66 | { |
67 | delete d; | 67 | delete d; |
68 | if ( _config ) | 68 | if ( _config ) |
69 | delete _config; | 69 | delete _config; |
70 | OApplication::_instance = 0; | 70 | OApplication::_instance = 0; |
71 | // after deconstruction of the one-and-only application object, | 71 | // after deconstruction of the one-and-only application object, |
72 | // the construction of another object is allowed | 72 | // the construction of another object is allowed |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | OConfig* OApplication::config() | 76 | OConfig* OApplication::config() |
77 | { | 77 | { |
78 | if ( !_config ) | 78 | if ( !_config ) |
79 | { | 79 | { |
80 | _config = new OConfig( _appname ); | 80 | _config = new OConfig( _appname ); |
81 | } | 81 | } |
82 | return _config; | 82 | return _config; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | void OApplication::init() | 86 | void OApplication::init() |
87 | { | 87 | { |
88 | d = new OApplicationPrivate(); | 88 | d = new OApplicationPrivate(); |
89 | if ( !OApplication::_instance ) | 89 | if ( !OApplication::_instance ) |
90 | { | 90 | { |
91 | OApplication::_instance = this; | 91 | OApplication::_instance = this; |
92 | 92 | ||
93 | /* register SIGSEGV handler to give programs an option | 93 | /* register SIGSEGV handler to give programs an option |
94 | * to exit gracefully, e.g. save or close devices or files. | 94 | * to exit gracefully, e.g. save or close devices or files. |
95 | struct sigaction sa; | 95 | struct sigaction sa; |
96 | sa.sa_handler = ( void (*)(int) ) &segv_handler; | 96 | sa.sa_handler = ( void (*)(int) ) &segv_handler; |
97 | sa.sa_flags = SA_SIGINFO | SA_RESTART; | 97 | sa.sa_flags = SA_SIGINFO | SA_RESTART; |
98 | sigemptyset(&sa.sa_mask); | 98 | sigemptyset(&sa.sa_mask); |
99 | sigaction(SIGSEGV, &sa, NULL); | 99 | sigaction(SIGSEGV, &sa, NULL); |
100 | */ | 100 | */ |
101 | } | 101 | } |
102 | else | 102 | else |
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 | { |
120 | if ( !title.isNull() ) | 120 | if ( !title.isNull() ) |
121 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); | 121 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); |
122 | else | 122 | else |
123 | mainWidget()->setCaption( _appname ); | 123 | mainWidget()->setCaption( _appname ); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
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 | |||
@@ -1,92 +1,92 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef 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 |
53 | * associated message, icon and configuration files | 53 | * associated message, icon and configuration files |
54 | * | 54 | * |
55 | */ | 55 | */ |
56 | OApplication( int& argc, char** argv, const QCString& rAppName ); | 56 | OApplication( int& argc, char** argv, const QCString& rAppName ); |
57 | /** | 57 | /** |
58 | * Destructor. Destroys the application object and its children. | 58 | * Destructor. Destroys the application object and its children. |
59 | */ | 59 | */ |
60 | virtual ~OApplication(); | 60 | virtual ~OApplication(); |
61 | /** | 61 | /** |
62 | * @returns the process-wide application object | 62 | * @returns the process-wide application object |
63 | * | 63 | * |
64 | * This is similar to the global @ref QApplication pointer qApp. It | 64 | * This is similar to the global @ref QApplication pointer qApp. It |
65 | * allows access to the single global OApplication object, since | 65 | * allows access to the single global OApplication object, since |
66 | * more than one cannot be created in the same application. It | 66 | * more than one cannot be created in the same application. It |
67 | * saves you the trouble of having to pass the pointer explicitly | 67 | * saves you the trouble of having to pass the pointer explicitly |
68 | * to every function that may require it. | 68 | * to every function that may require it. |
69 | */ | 69 | */ |
70 | static OApplication* oApplication() { return _instance; }; | 70 | static OApplication* oApplication() { return _instance; }; |
71 | /** | 71 | /** |
72 | * Returns the application name as given during creation. | 72 | * Returns the application name as given during creation. |
73 | * | 73 | * |
74 | * @returns a reference to the application name | 74 | * @returns a reference to the application name |
75 | */ | 75 | */ |
76 | const QCString& appName() const { return _appname; }; | 76 | const QCString& appName() const { return _appname; }; |
77 | /** | 77 | /** |
78 | * @returns the application session config object. | 78 | * @returns the application session config object. |
79 | * | 79 | * |
80 | * @see OConfig | 80 | * @see OConfig |
81 | */ | 81 | */ |
82 | OConfig* config(); | 82 | OConfig* config(); |
83 | /** | 83 | /** |
84 | * Shows the main @a widget and sets the name of the application as window caption. | 84 | * Shows the main @a widget and sets the name of the application as window caption. |
85 | */ | 85 | */ |
86 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); | 86 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); |
87 | /** | 87 | /** |
88 | * Set the application title. The application title will be concatenated | 88 | * Set the application title. The application title will be concatenated |
89 | * to the application name given in the constructor. | 89 | * to the application name given in the constructor. |
90 | * | 90 | * |
91 | * @param title the title. If not given, resets caption to appname | 91 | * @param title the title. If not given, resets caption to appname |
92 | */ | 92 | */ |
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 | |||
@@ -1,90 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | Inspired by the config classes from the KDE Project which are | 5 | Inspired by the config classes from the KDE Project which are |
6 | =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> | 6 | =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | 33 | ||
34 | #include <qfont.h> | 34 | #include <qfont.h> |
35 | #include <qcolor.h> | 35 | #include <qcolor.h> |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | 38 | ||
39 | #include <opie2/oconfig.h> | 39 | #include <opie2/oconfig.h> |
40 | 40 | ||
41 | 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 |
51 | { | 51 | { |
52 | QColor aRetColor; | 52 | QColor aRetColor; |
53 | int nRed = 0, nGreen = 0, nBlue = 0; | 53 | int nRed = 0, nGreen = 0, nBlue = 0; |
54 | 54 | ||
55 | QString aValue = readEntry( key ); | 55 | QString aValue = readEntry( key ); |
56 | if( !aValue.isEmpty() ) | 56 | if( !aValue.isEmpty() ) |
57 | { | 57 | { |
58 | if ( aValue.at(0) == '#' ) | 58 | if ( aValue.at(0) == '#' ) |
59 | { | 59 | { |
60 | aRetColor.setNamedColor(aValue); | 60 | aRetColor.setNamedColor(aValue); |
61 | } | 61 | } |
62 | else | 62 | else |
63 | { | 63 | { |
64 | bool bOK; | 64 | bool bOK; |
65 | 65 | ||
66 | // find first part (red) | 66 | // find first part (red) |
67 | int nIndex = aValue.find( ',' ); | 67 | int nIndex = aValue.find( ',' ); |
68 | 68 | ||
69 | if( nIndex == -1 ) | 69 | if( nIndex == -1 ) |
70 | { | 70 | { |
71 | // return a sensible default -- Bernd | 71 | // return a sensible default -- Bernd |
72 | if( pDefault ) | 72 | if( pDefault ) |
73 | aRetColor = *pDefault; | 73 | aRetColor = *pDefault; |
74 | return aRetColor; | 74 | return aRetColor; |
75 | } | 75 | } |
76 | 76 | ||
77 | nRed = aValue.left( nIndex ).toInt( &bOK ); | 77 | nRed = aValue.left( nIndex ).toInt( &bOK ); |
78 | 78 | ||
79 | // find second part (green) | 79 | // find second part (green) |
80 | int nOldIndex = nIndex; | 80 | int nOldIndex = nIndex; |
81 | nIndex = aValue.find( ',', nOldIndex+1 ); | 81 | nIndex = aValue.find( ',', nOldIndex+1 ); |
82 | 82 | ||
83 | if( nIndex == -1 ) | 83 | if( nIndex == -1 ) |
84 | { | 84 | { |
85 | // return a sensible default -- Bernd | 85 | // return a sensible default -- Bernd |
86 | if( pDefault ) | 86 | if( pDefault ) |
87 | aRetColor = *pDefault; | 87 | aRetColor = *pDefault; |
88 | return aRetColor; | 88 | return aRetColor; |
89 | } | 89 | } |
90 | nGreen = aValue.mid( nOldIndex+1, | 90 | nGreen = aValue.mid( nOldIndex+1, |
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 | |||
@@ -1,114 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | Inspired by the config classes from the KDE Project which are | 5 | Inspired by the config classes from the KDE Project which are |
6 | =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> | 6 | =. (C) 1997 Matthias Kalle Dalheimer <kalle@kde.org> |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OCONFIG_H | 32 | #ifndef OCONFIG_H |
33 | #define OCONFIG_H | 33 | #define OCONFIG_H |
34 | 34 | ||
35 | //FIXME: Implement for X11 or reuse libqpe/Config there also? | 35 | //FIXME: Implement for X11 or reuse libqpe/Config there also? |
36 | //FIXME: Or rather use QSettings also for libqpe? | 36 | //FIXME: Or rather use QSettings also for libqpe? |
37 | 37 | ||
38 | #include <qpe/config.h> | 38 | #include "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. |
57 | * | 57 | * |
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; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * @brief Helper class for easier use of OConfig groups. | 78 | * @brief Helper class for easier use of OConfig groups. |
79 | * | 79 | * |
80 | * Careful programmers always set the group of a | 80 | * Careful programmers always set the group of a |
81 | * @ref OConfig object to the group they want to read from | 81 | * @ref OConfig object to the group they want to read from |
82 | * and set it back to the old one of afterwards. This is usually | 82 | * and set it back to the old one of afterwards. This is usually |
83 | * written as: | 83 | * written as: |
84 | * <pre> | 84 | * <pre> |
85 | * | 85 | * |
86 | * QString oldgroup config()->group(); | 86 | * QString oldgroup config()->group(); |
87 | * config()->setGroup( "TheGroupThatIWant" ); | 87 | * config()->setGroup( "TheGroupThatIWant" ); |
88 | * ... | 88 | * ... |
89 | * config()->writeEntry( "Blah", "Blubb" ); | 89 | * config()->writeEntry( "Blah", "Blubb" ); |
90 | * | 90 | * |
91 | * config()->setGroup( oldgroup ); | 91 | * config()->setGroup( oldgroup ); |
92 | * </pre> | 92 | * </pre> |
93 | * | 93 | * |
94 | * In order to facilitate this task, you can use | 94 | * In order to facilitate this task, you can use |
95 | * OConfigGroupSaver. Simply construct such an object ON THE STACK | 95 | * OConfigGroupSaver. Simply construct such an object ON THE STACK |
96 | * when you want to switch to a new group. Then, when the object goes | 96 | * when you want to switch to a new group. Then, when the object goes |
97 | * out of scope, the group will automatically be restored. If you | 97 | * out of scope, the group will automatically be restored. If you |
98 | * want to use several different groups within a function or method, | 98 | * want to use several different groups within a function or method, |
99 | * you can still use OConfigGroupSaver: Simply enclose all work with | 99 | * you can still use OConfigGroupSaver: Simply enclose all work with |
100 | * one group (including the creation of the OConfigGroupSaver object) | 100 | * one group (including the creation of the OConfigGroupSaver object) |
101 | * in one block. | 101 | * in one block. |
102 | * | 102 | * |
103 | * @author Matthias Kalle Dalheimer <Kalle@kde.org> | 103 | * @author Matthias Kalle Dalheimer <Kalle@kde.org> |
104 | * @version $Id$ | 104 | * @version $Id$ |
105 | * @see OConfig | 105 | * @see OConfig |
106 | */ | 106 | */ |
107 | 107 | ||
108 | class OConfigGroupSaver | 108 | class OConfigGroupSaver |
109 | { | 109 | { |
110 | public: | 110 | public: |
111 | /** | 111 | /** |
112 | * Constructor. | 112 | * Constructor. |
113 | * Create the object giving a @config object and a @a group to become | 113 | * Create the object giving a @config object and a @a group to become |
114 | * the current group. | 114 | * the current group. |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #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 | |||
@@ -1,49 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef 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 |
46 | static OConfig* config(); | 46 | static OConfig* config(); |
47 | }; | 47 | }; |
48 | 48 | ||
49 | #endif // OGLOBAL_H | 49 | #endif // OGLOBAL_H |
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 | ||