author | zecke <zecke> | 2004-03-13 19:51:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-13 19:51:45 (UTC) |
commit | 6d08277737e22b7a1527124623f3571969073ddf (patch) (unidiff) | |
tree | 4129e674e21df767b31299e873dd44e33a308e1b | |
parent | 8e28911f7199f4450ac5eef09482069f9b9caea2 (diff) | |
download | opie-6d08277737e22b7a1527124623f3571969073ddf.zip opie-6d08277737e22b7a1527124623f3571969073ddf.tar.gz opie-6d08277737e22b7a1527124623f3571969073ddf.tar.bz2 |
Move XML class to internal PIM
Add namespaces!!!
Opie::Core and Opie::Core::Private
Opie::Net and Opie::Net::Private
Opie::Ui and Opie::Ui::Private
Opie::MM and Opie::MM::Private
Opie::DB and Opie::DB::Private
PIM classes are not yet converted because we will do other work
on it as well
156 files changed, 1001 insertions, 337 deletions
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp index a3f8e10..6712870 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp | |||
@@ -1,20 +1,22 @@ | |||
1 | #include <opie2/oapplication.h> | 1 | #include <opie2/oapplication.h> |
2 | #include <opie2/oconfig.h> | 2 | #include <opie2/oconfig.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | 4 | ||
5 | using namespace Opie::Core; | ||
6 | |||
5 | int main( int argc, char** argv ) | 7 | int main( int argc, char** argv ) |
6 | { | 8 | { |
7 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); | 9 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); |
8 | 10 | ||
9 | OConfigGroupSaver c1( app->config(), "MyGroup" ); | 11 | OConfigGroupSaver c1( app->config(), "MyGroup" ); |
10 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); | 12 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); |
11 | { | 13 | { |
12 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); | 14 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); |
13 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); | 15 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); |
14 | } // closing the scope returns to the last group | 16 | } // closing the scope returns to the last group |
15 | 17 | ||
16 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); | 18 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); |
17 | 19 | ||
18 | // do more stuff ... | 20 | // do more stuff ... |
19 | 21 | ||
20 | // in this (special) case it is necessary to manually call OConfig::write() (see below) | 22 | // in this (special) case it is necessary to manually call OConfig::write() (see below) |
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp index e8bf04f..0b8e1fe 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp | |||
@@ -4,32 +4,34 @@ | |||
4 | #include <qhbox.h> | 4 | #include <qhbox.h> |
5 | #include <qvbuttongroup.h> | 5 | #include <qvbuttongroup.h> |
6 | #include <qhbuttongroup.h> | 6 | #include <qhbuttongroup.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qradiobutton.h> | 8 | #include <qradiobutton.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | 12 | ||
13 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
14 | 14 | ||
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <opie2/oapplication.h> | 16 | #include <opie2/oapplication.h> |
17 | #include <opie2/oglobal.h> | 17 | #include <opie2/oglobal.h> |
18 | #include <opie2/oglobalsettings.h> | 18 | #include <opie2/oglobalsettings.h> |
19 | 19 | ||
20 | using namespace Opie::Core; | ||
21 | |||
20 | class DemoApp : public OApplication | 22 | class DemoApp : public OApplication |
21 | { | 23 | { |
22 | Q_OBJECT | 24 | Q_OBJECT |
23 | public: | 25 | public: |
24 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) | 26 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) |
25 | { | 27 | { |
26 | // you have access to your OApplication object via oApp | 28 | // you have access to your OApplication object via oApp |
27 | qDebug( "Process-wide OApplication object @ %0x", oApp ); | 29 | qDebug( "Process-wide OApplication object @ %0x", oApp ); |
28 | 30 | ||
29 | // you have access to global settings via OGlobalSettings | 31 | // you have access to global settings via OGlobalSettings |
30 | int mode = OGlobalSettings::debugMode(); | 32 | int mode = OGlobalSettings::debugMode(); |
31 | 33 | ||
32 | QVBox* vbox = new QVBox(); | 34 | QVBox* vbox = new QVBox(); |
33 | setMainWidget( vbox ); | 35 | setMainWidget( vbox ); |
34 | 36 | ||
35 | g = new QVButtonGroup( "Output Strategy", vbox ); | 37 | g = new QVButtonGroup( "Output Strategy", vbox ); |
diff --git a/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp index 2f5220b..56f1a0b 100644 --- a/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp +++ b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp | |||
@@ -1,13 +1,15 @@ | |||
1 | #include <opie2/oglobalsettings.h> | 1 | #include <opie2/oglobalsettings.h> |
2 | #include <iostream.h> | 2 | #include <iostream> |
3 | |||
4 | using namespace Opie::Core; | ||
3 | 5 | ||
4 | int main( int argc, char** argv ) | 6 | int main( int argc, char** argv ) |
5 | { | 7 | { |
6 | printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() ); | 8 | printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() ); |
7 | printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() ); | 9 | printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() ); |
8 | 10 | ||
9 | return 0; | 11 | return 0; |
10 | 12 | ||
11 | } | 13 | } |
12 | 14 | ||
13 | //#include "moc/oconfigdemo.moc" | 15 | //#include "moc/oconfigdemo.moc" |
diff --git a/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp b/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp index 0abf53e..2193565 100644 --- a/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp +++ b/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp | |||
@@ -1,11 +1,13 @@ | |||
1 | #include <opie2/oprocess.h> | 1 | #include <opie2/oprocess.h> |
2 | #include <iostream.h> | 2 | #include <iostream> |
3 | |||
4 | using namespace Opie::Core; | ||
3 | 5 | ||
4 | int main( int argc, char** argv ) | 6 | int main( int argc, char** argv ) |
5 | { | 7 | { |
6 | printf( "my own PID seems to be '%d'\n", OProcess::processPID( "oprocessdemo" ) ); | 8 | printf( "my own PID seems to be '%d'\n", OProcess::processPID( "oprocessdemo" ) ); |
7 | printf( "the PID of process 'Mickey' seems to be '%d'\n\n", OProcess::processPID( "Mickey" ) ); | 9 | printf( "the PID of process 'Mickey' seems to be '%d'\n\n", OProcess::processPID( "Mickey" ) ); |
8 | 10 | ||
9 | return 0; | 11 | return 0; |
10 | } | 12 | } |
11 | 13 | ||
diff --git a/libopie2/examples/opiedb/sqltest/spaltenweise.cpp b/libopie2/examples/opiedb/sqltest/spaltenweise.cpp index 8790cdd..e1a4d5d 100644 --- a/libopie2/examples/opiedb/sqltest/spaltenweise.cpp +++ b/libopie2/examples/opiedb/sqltest/spaltenweise.cpp | |||
@@ -1,23 +1,25 @@ | |||
1 | #include <qdir.h> | 1 | #include <qdir.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include "../osqlmanager.h" | 4 | #include <opie2/osqlmanager.h> |
5 | #include "../osqlquery.h" | 5 | #include <opie2/osqlquery.h> |
6 | #include "../osqldriver.h" | 6 | #include <opie2/osqldriver.h> |
7 | #include "../osqlresult.h" | 7 | #include <opie2/osqlresult.h> |
8 | |||
9 | using namespace Opie::DB; | ||
8 | 10 | ||
9 | int main( int argc, char* argv[] ) { | 11 | int main( int argc, char* argv[] ) { |
10 | 12 | ||
11 | QPEApplication app( argc, argv ); | 13 | QPEApplication app( argc, argv ); |
12 | OSQLManager man; | 14 | OSQLManager man; |
13 | man.registerPath( QDir::currentDirPath() ); | 15 | man.registerPath( QDir::currentDirPath() ); |
14 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | 16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); |
15 | 17 | ||
16 | OSQLDriver *driver = man.standard(); | 18 | OSQLDriver *driver = man.standard(); |
17 | qWarning("testmain" + driver->id() ); | 19 | qWarning("testmain" + driver->id() ); |
18 | driver->setUrl("/home/ich/spaltenweise"); | 20 | driver->setUrl("/home/ich/spaltenweise"); |
19 | if ( driver->open() ) { | 21 | if ( driver->open() ) { |
20 | qWarning("could open"); | 22 | qWarning("could open"); |
21 | }else | 23 | }else |
22 | qWarning("wasn't able to open"); | 24 | qWarning("wasn't able to open"); |
23 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(" | 25 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(" |
diff --git a/libopie2/examples/opiedb/sqltest/spaltenweise.pro b/libopie2/examples/opiedb/sqltest/spaltenweise.pro index f54fada..3cab802 100644 --- a/libopie2/examples/opiedb/sqltest/spaltenweise.pro +++ b/libopie2/examples/opiedb/sqltest/spaltenweise.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = spaltenweise.cpp | 4 | SOURCES = spaltenweise.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiesql | 7 | LIBS += -lqpe -lopiedb2 |
8 | TARGET = spaltenweise | 8 | TARGET = spaltenweise |
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | 12 | ||
13 | include ( $(OPIEDIR)/include.pro ) | 13 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/libopie2/examples/opiedb/sqltest/zeilenweise.cpp b/libopie2/examples/opiedb/sqltest/zeilenweise.cpp index e538c9f..2d11ac5 100644 --- a/libopie2/examples/opiedb/sqltest/zeilenweise.cpp +++ b/libopie2/examples/opiedb/sqltest/zeilenweise.cpp | |||
@@ -1,23 +1,25 @@ | |||
1 | #include <qdir.h> | 1 | #include <qdir.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include "../osqlmanager.h" | 4 | #include <opie2/osqlmanager.h> |
5 | #include "../osqlquery.h" | 5 | #include <opie2/osqlquery.h> |
6 | #include "../osqldriver.h" | 6 | #include <opie2/osqldriver.h> |
7 | #include "../osqlresult.h" | 7 | #include <opie2/osqlresult.h> |
8 | |||
9 | using namespace Opie::DB; | ||
8 | 10 | ||
9 | int main( int argc, char* argv[] ) { | 11 | int main( int argc, char* argv[] ) { |
10 | 12 | ||
11 | QPEApplication app( argc, argv ); | 13 | QPEApplication app( argc, argv ); |
12 | OSQLManager man; | 14 | OSQLManager man; |
13 | man.registerPath( QDir::currentDirPath() ); | 15 | man.registerPath( QDir::currentDirPath() ); |
14 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | 16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); |
15 | 17 | ||
16 | OSQLDriver *driver = man.standard(); | 18 | OSQLDriver *driver = man.standard(); |
17 | qWarning("testmain" + driver->id() ); | 19 | qWarning("testmain" + driver->id() ); |
18 | driver->setUrl("/home/ich/zeilenweise"); | 20 | driver->setUrl("/home/ich/zeilenweise"); |
19 | if ( driver->open() ) { | 21 | if ( driver->open() ) { |
20 | qWarning("could open"); | 22 | qWarning("could open"); |
21 | }else | 23 | }else |
22 | qWarning("wasn't able to open"); | 24 | qWarning("wasn't able to open"); |
23 | OSQLRawQuery raw2("BEGIN TRANSACTION"); | 25 | OSQLRawQuery raw2("BEGIN TRANSACTION"); |
diff --git a/libopie2/examples/opiedb/sqltest/zeilenweise.pro b/libopie2/examples/opiedb/sqltest/zeilenweise.pro index e5cfcc7..6952921 100644 --- a/libopie2/examples/opiedb/sqltest/zeilenweise.pro +++ b/libopie2/examples/opiedb/sqltest/zeilenweise.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = zeilenweise.cpp | 4 | SOURCES = zeilenweise.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiesql | 7 | LIBS += -lqpe -lopiedb2 |
8 | TARGET = zeilenweise | 8 | TARGET = zeilenweise |
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | 12 | ||
13 | include ( $(OPIEDIR)/include.pro ) | 13 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp b/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp index 79bf327..8d421fd 100644 --- a/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp +++ b/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | #include <opie2/osoundsystem.h> | 1 | #include <opie2/osoundsystem.h> |
2 | 2 | ||
3 | using namespace Opie::MM; | ||
4 | |||
3 | int main( int argc, char** argv ) | 5 | int main( int argc, char** argv ) |
4 | { | 6 | { |
5 | qDebug( "OPIE Sound System Demo" ); | 7 | qDebug( "OPIE Sound System Demo" ); |
6 | 8 | ||
7 | OSoundSystem* sound = OSoundSystem::instance(); | 9 | OSoundSystem* sound = OSoundSystem::instance(); |
8 | 10 | ||
9 | OSoundSystem::CardIterator it = sound->iterator(); | 11 | OSoundSystem::CardIterator it = sound->iterator(); |
10 | /* | 12 | /* |
11 | while ( it.current() ) | 13 | while ( it.current() ) |
12 | { | 14 | { |
13 | qDebug( "DEMO: OSoundSystem contains Interface '%s'", (const char*) it.current()->name() ); | 15 | qDebug( "DEMO: OSoundSystem contains Interface '%s'", (const char*) it.current()->name() ); |
14 | ++it; | 16 | ++it; |
15 | } | 17 | } |
16 | 18 | ||
17 | */ | 19 | */ |
18 | OSoundCard* card = it.current(); | 20 | OSoundCard* card = it.current(); |
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index eb2e8e8..f1966c1 100644 --- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | |||
@@ -1,27 +1,29 @@ | |||
1 | #include <qdict.h> | 1 | #include <qdict.h> |
2 | #include <qsocketnotifier.h> | 2 | #include <qsocketnotifier.h> |
3 | #include <qstring.h> | 3 | #include <qstring.h> |
4 | #include <opie2/onetwork.h> | 4 | #include <opie2/onetwork.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <opie2/opcap.h> | 6 | #include <opie2/opcap.h> |
7 | #include <cerrno> | 7 | #include <cerrno> |
8 | #include <cstdio> | 8 | #include <cstdio> |
9 | #include <cstdlib> | 9 | #include <cstdlib> |
10 | #include <cstring> | 10 | #include <cstring> |
11 | 11 | ||
12 | |||
13 | using namespace Opie::Net; | ||
12 | //======================== Station help class =============================== | 14 | //======================== Station help class =============================== |
13 | 15 | ||
14 | class Station | 16 | class Station |
15 | { | 17 | { |
16 | public: | 18 | public: |
17 | Station( QString t, int c, bool w ) : type(t), channel(c), wep(w), beacons(1) {}; | 19 | Station( QString t, int c, bool w ) : type(t), channel(c), wep(w), beacons(1) {}; |
18 | ~Station() {}; | 20 | ~Station() {}; |
19 | 21 | ||
20 | QString type; | 22 | QString type; |
21 | int channel; | 23 | int channel; |
22 | bool wep; | 24 | bool wep; |
23 | int beacons; | 25 | int beacons; |
24 | }; | 26 | }; |
25 | 27 | ||
26 | QDict<Station> stations; | 28 | QDict<Station> stations; |
27 | 29 | ||
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index 4763316..4f8af60 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -1,22 +1,24 @@ | |||
1 | #include <opie2/onetwork.h> | 1 | #include <opie2/onetwork.h> |
2 | #include <opie2/ostation.h> | 2 | #include <opie2/ostation.h> |
3 | #include <opie2/omanufacturerdb.h> | 3 | #include <opie2/omanufacturerdb.h> |
4 | 4 | ||
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | 6 | ||
7 | using namespace Opie::Net; | ||
8 | |||
7 | int main( int argc, char** argv ) | 9 | int main( int argc, char** argv ) |
8 | { | 10 | { |
9 | qDebug( "OPIE Network Demo" ); | 11 | qDebug( "OPIE Network Demo" ); |
10 | 12 | ||
11 | ONetwork* net = ONetwork::instance(); | 13 | ONetwork* net = ONetwork::instance(); |
12 | 14 | ||
13 | ONetwork::InterfaceIterator it = net->iterator(); | 15 | ONetwork::InterfaceIterator it = net->iterator(); |
14 | 16 | ||
15 | while ( it.current() ) | 17 | while ( it.current() ) |
16 | { | 18 | { |
17 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); | 19 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); |
18 | qDebug( "DEMO: Datalink code is '%d'", it.current()->dataLinkType() ); | 20 | qDebug( "DEMO: Datalink code is '%d'", it.current()->dataLinkType() ); |
19 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); | 21 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); |
20 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); | 22 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); |
21 | qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() ); | 23 | qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() ); |
22 | qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) ); | 24 | qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) ); |
diff --git a/libopie2/examples/opieui/olistviewdemo/main.cpp b/libopie2/examples/opieui/olistviewdemo/main.cpp index a93f361..cd49c28 100644 --- a/libopie2/examples/opieui/olistviewdemo/main.cpp +++ b/libopie2/examples/opieui/olistviewdemo/main.cpp | |||
@@ -3,24 +3,27 @@ | |||
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "olistviewdemo.h" | 16 | #include "olistviewdemo.h" |
17 | #include <opie2/oapplication.h> | 17 | #include <opie2/oapplication.h> |
18 | 18 | ||
19 | using namespace Opie::Ui; | ||
20 | using namespace Opie::Core; | ||
21 | |||
19 | int main( int argc, char **argv ) | 22 | int main( int argc, char **argv ) |
20 | { | 23 | { |
21 | OApplication a( argc, argv, "OListViewDemo" ); | 24 | OApplication a( argc, argv, "OListViewDemo" ); |
22 | OListViewDemo e; | 25 | OListViewDemo e; |
23 | a.showMainWidget(&e); | 26 | a.showMainWidget(&e); |
24 | return a.exec(); | 27 | return a.exec(); |
25 | } | 28 | } |
26 | 29 | ||
diff --git a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp index 5ba7b69..7834b3b 100644 --- a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp +++ b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp | |||
@@ -24,32 +24,34 @@ | |||
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 | 32 | ||
33 | #include "olistviewdemo.h" | 33 | #include "olistviewdemo.h" |
34 | #include <opie2/olistview.h> | 34 | #include <opie2/olistview.h> |
35 | 35 | ||
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qlistview.h> | 38 | #include <qlistview.h> |
39 | 39 | ||
40 | using namespace Opie::Ui; | ||
41 | |||
40 | OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f ) | 42 | OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f ) |
41 | :QVBox( parent, name, f ) | 43 | :QVBox( parent, name, f ) |
42 | { | 44 | { |
43 | lv = new ONamedListView( this ); | 45 | lv = new ONamedListView( this ); |
44 | lv->setRootIsDecorated( true ); | 46 | lv->setRootIsDecorated( true ); |
45 | lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) ); | 47 | lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) ); |
46 | 48 | ||
47 | ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 49 | ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
48 | item->setText( "Column2", "ModifiedText" ); | 50 | item->setText( "Column2", "ModifiedText" ); |
49 | item->setText( "Column5", "ThisColumnDoesNotExits" ); | 51 | item->setText( "Column5", "ThisColumnDoesNotExits" ); |
50 | 52 | ||
51 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 53 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
52 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 54 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
53 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) ); | 55 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) ); |
54 | item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) ); | 56 | item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) ); |
55 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 57 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
diff --git a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.h b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.h index 8a5986a..0b5c498 100644 --- a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.h +++ b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.h | |||
@@ -31,21 +31,21 @@ | |||
31 | 31 | ||
32 | #ifndef OLISTVIEWDEMO_H | 32 | #ifndef OLISTVIEWDEMO_H |
33 | #define OLISTVIEWDEMO_H | 33 | #define OLISTVIEWDEMO_H |
34 | 34 | ||
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <opie2/olistview.h> | 36 | #include <opie2/olistview.h> |
37 | 37 | ||
38 | class OListViewDemo: public QVBox | 38 | class OListViewDemo: public QVBox |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | OListViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 43 | OListViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
44 | virtual ~OListViewDemo(); | 44 | virtual ~OListViewDemo(); |
45 | 45 | ||
46 | private: | 46 | private: |
47 | ONamedListView* lv; | 47 | Opie::Ui::ONamedListView* lv; |
48 | 48 | ||
49 | }; | 49 | }; |
50 | 50 | ||
51 | #endif | 51 | #endif |
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp index 7ba0f0d..4a1468d 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp +++ b/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp | |||
@@ -1,29 +1,30 @@ | |||
1 | #include "osplitter_example.h" | 1 | #include "osplitter_example.h" |
2 | 2 | ||
3 | /* OPIE */ | 3 | /* OPIE */ |
4 | 4 | ||
5 | #include <opie2/osplitter.h> | 5 | #include <opie2/osplitter.h> |
6 | #include <opie2/ofileselector.h> | ||
6 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
7 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
8 | 9 | ||
9 | /* QT*/ | 10 | /* QT*/ |
10 | #include <qdir.h> | 11 | #include <qdir.h> |
11 | #include <qlayout.h> | 12 | #include <qlayout.h> |
12 | 13 | ||
13 | using namespace Opie; | 14 | using namespace Opie::Ui; |
14 | 15 | ||
15 | OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> ) | 16 | OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> ) |
16 | 17 | ||
17 | OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f ) | 18 | OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f ) |
18 | : QWidget( w, n, f ){ | 19 | : QWidget( w, n, f ){ |
19 | QVBoxLayout * lay = new QVBoxLayout(this); | 20 | QVBoxLayout * lay = new QVBoxLayout(this); |
20 | OSplitter * splitter = new OSplitter( Horizontal, this ); | 21 | OSplitter * splitter = new OSplitter( Horizontal, this ); |
21 | lay->addWidget( splitter ); | 22 | lay->addWidget( splitter ); |
22 | 23 | ||
23 | OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector, | 24 | OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector, |
24 | OFileSelector::Normal, QDir::homeDirPath(), | 25 | OFileSelector::Normal, QDir::homeDirPath(), |
25 | QString::null ); | 26 | QString::null ); |
26 | splitter->addWidget( selector, "zoom", tr("Selector 1") ); | 27 | splitter->addWidget( selector, "zoom", tr("Selector 1") ); |
27 | 28 | ||
28 | selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal, | 29 | selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal, |
29 | QDir::homeDirPath(), QString::null ); | 30 | QDir::homeDirPath(), QString::null ); |
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_example.h b/libopie2/examples/opieui/osplitter_example/osplitter_example.h index 176ad62..0cf28aa 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_example.h +++ b/libopie2/examples/opieui/osplitter_example/osplitter_example.h | |||
@@ -1,20 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * May be used, copied and modified wihtout any limitation | 2 | * May be used, copied and modified wihtout any limitation |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef OSPlitter_EXAMPLE_H | 5 | #ifndef OSPlitter_EXAMPLE_H |
6 | #define OSPlitter_EXAMPLE_H | 6 | #define OSPlitter_EXAMPLE_H |
7 | 7 | ||
8 | #include <qvbox.h> | 8 | #include <qvbox.h> |
9 | #include <opie2/ofileselector.h> | ||
10 | 9 | ||
11 | class OSplitterExample : public QWidget { | 10 | class OSplitterExample : public QWidget { |
12 | Q_OBJECT | 11 | Q_OBJECT |
13 | public: | 12 | public: |
14 | static QString appName() { return QString::fromLatin1("osplitter_example"); } | 13 | static QString appName() { return QString::fromLatin1("osplitter_example"); } |
15 | OSplitterExample( QWidget *parent, const char* name, WFlags fl ); | 14 | OSplitterExample( QWidget *parent, const char* name, WFlags fl ); |
16 | 15 | ||
17 | }; | 16 | }; |
18 | 17 | ||
19 | 18 | ||
20 | #endif | 19 | #endif |
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp index 789496c..6443dc0 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp +++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp | |||
@@ -1,50 +1,52 @@ | |||
1 | 1 | ||
2 | #include <qstring.h> | 2 | #include <qstring.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qheader.h> | 4 | #include <qheader.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | 6 | ||
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include <opie2/oapplicationfactory.h> | 9 | #include <opie2/oapplicationfactory.h> |
10 | #include "osplitter_mail.h" | 10 | #include "osplitter_mail.h" |
11 | 11 | ||
12 | using namespace Opie::Ui; | ||
13 | |||
12 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) | 14 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) |
13 | 15 | ||
14 | class Folder { | 16 | class Folder { |
15 | int dummy; | 17 | int dummy; |
16 | }; | 18 | }; |
17 | 19 | ||
18 | // ----------------------------------------------------------------- | 20 | // ----------------------------------------------------------------- |
19 | 21 | ||
20 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) | 22 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) |
21 | : QWidget( p, name, fl ) { | 23 | : QWidget( p, name, fl ) { |
22 | qApp->installEventFilter( this ); | 24 | qApp->installEventFilter( this ); |
23 | m_lstFolders.setAutoDelete( true ); | 25 | m_lstFolders.setAutoDelete( true ); |
24 | QHBoxLayout *lay = new QHBoxLayout(this); | 26 | QHBoxLayout *lay = new QHBoxLayout(this); |
25 | 27 | ||
26 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); | 28 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); |
27 | lay->addWidget( m_splitter ); | 29 | lay->addWidget( m_splitter ); |
28 | connect(m_splitter, SIGNAL(sizeChange(bool,const QSize&) ), | 30 | connect(m_splitter, SIGNAL(sizeChanged(bool,Orientation) ), |
29 | this, SLOT(slotSizeChange(bool,const QSize&) ) ); | 31 | this, SLOT(slotSizeChange(bool,Orientation) ) ); |
30 | 32 | ||
31 | m_overview = new QListView( m_splitter ); | 33 | m_overview = new QListView( m_splitter ); |
32 | m_overview->header()->setClickEnabled( FALSE ); | 34 | m_overview->header()->setClickEnabled( FALSE ); |
33 | m_overview->addColumn( tr("Folder") ); | 35 | m_overview->addColumn( tr("Folder") ); |
34 | m_overview->setMaximumWidth( 200 ); | 36 | // m_overview->setMaximumWidth( 200 ); |
35 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); | 37 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); |
36 | m_splitter->setSizeChange( 300 ); | 38 | m_splitter->setSizeChange( 300 ); |
37 | 39 | ||
38 | /* OSplitter starts with the small mode */ | 40 | /* OSplitter starts with the small mode */ |
39 | m_messages = 0; | 41 | m_messages = 0; |
40 | m_message = m_attach = 0; | 42 | m_message = m_attach = 0; |
41 | 43 | ||
42 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); | 44 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); |
43 | splitti->setSizeChange( 300 ); | 45 | splitti->setSizeChange( 300 ); |
44 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 46 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
45 | 47 | ||
46 | QLabel *lbl = new QLabel(splitti); | 48 | QLabel *lbl = new QLabel(splitti); |
47 | lbl->setTextFormat ( Qt::RichText ); | 49 | lbl->setTextFormat ( Qt::RichText ); |
48 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); | 50 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); |
49 | 51 | ||
50 | m_messages = new QListView( splitti ); | 52 | m_messages = new QListView( splitti ); |
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.h b/libopie2/examples/opieui/osplitter_example/osplitter_mail.h index 1447a92..67961fb 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.h +++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.h | |||
@@ -3,51 +3,49 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | /* | 5 | /* |
6 | * Header file for a more complete email client like | 6 | * Header file for a more complete email client like |
7 | * layout | 7 | * layout |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H | 10 | #ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H |
11 | #define OPIE_SPLITTER_MAIL_EXAMPLE_H | 11 | #define OPIE_SPLITTER_MAIL_EXAMPLE_H |
12 | 12 | ||
13 | #include <qwidget.h> | 13 | #include <qwidget.h> |
14 | #include <qlist.h> | 14 | #include <qlist.h> |
15 | #include <qlistview.h> | 15 | #include <qlistview.h> |
16 | 16 | ||
17 | #include <opie2/osplitter.h> | 17 | #include <opie2/osplitter.h> |
18 | 18 | ||
19 | using Opie::OSplitter; | ||
20 | 19 | ||
21 | class Folder; | 20 | class Folder; |
22 | class QLabel; | 21 | class QLabel; |
23 | 22 | ||
24 | class OSplitter; | ||
25 | class ListViews : public QWidget { | 23 | class ListViews : public QWidget { |
26 | Q_OBJECT | 24 | Q_OBJECT |
27 | public: | 25 | public: |
28 | static QString appName() { return QString::fromLatin1("osplitter-mail"); } | 26 | static QString appName() { return QString::fromLatin1("osplitter-mail"); } |
29 | ListViews( QWidget* parent, const char * name, WFlags fl ); | 27 | ListViews( QWidget* parent, const char * name, WFlags fl ); |
30 | ~ListViews(); | 28 | ~ListViews(); |
31 | 29 | ||
32 | bool eventFilter( QObject* , QEvent* ); | 30 | bool eventFilter( QObject* , QEvent* ); |
33 | private: | 31 | private: |
34 | void initFolders(); | 32 | void initFolders(); |
35 | void initFolder( Folder *folder, unsigned int &count ); | 33 | void initFolder( Folder *folder, unsigned int &count ); |
36 | 34 | ||
37 | QListView *m_messages, *m_overview; | 35 | QListView *m_messages, *m_overview; |
38 | QLabel *m_message, *m_attach; | 36 | QLabel *m_message, *m_attach; |
39 | QList<QListView> m_folders; // used in tab mode | 37 | QList<QListView> m_folders; // used in tab mode |
40 | QList<Folder> m_lstFolders; | 38 | QList<Folder> m_lstFolders; |
41 | bool m_mode : 1; // bitfield | 39 | bool m_mode : 1; // bitfield |
42 | OSplitter *m_splitter; | 40 | Opie::Ui::OSplitter *m_splitter; |
43 | OSplitter *splitti; | 41 | Opie::Ui::OSplitter *splitti; |
44 | QListView *folder1; | 42 | QListView *folder1; |
45 | #if 0 | 43 | #if 0 |
46 | //private slots: | 44 | //private slots: |
47 | // void slotFolderChanged( QListViewItem* ); | 45 | // void slotFolderChanged( QListViewItem* ); |
48 | // void slotMessageChanged(); | 46 | // void slotMessageChanged(); |
49 | // void slotSizeChange( bool, const QSize& ); | 47 | // void slotSizeChange( bool, const QSize& ); |
50 | #endif | 48 | #endif |
51 | }; | 49 | }; |
52 | 50 | ||
53 | #endif | 51 | #endif |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/main.cpp b/libopie2/examples/opieui/oversatileviewdemo/main.cpp index d8c01a4..bcda14c 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/main.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/main.cpp | |||
@@ -4,26 +4,29 @@ | |||
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "opieuidemo.h" | 16 | #include "opieuidemo.h" |
17 | 17 | ||
18 | #include <opie2/oapplication.h> | 18 | #include <opie2/oapplication.h> |
19 | 19 | ||
20 | using namespace Opie::Core; | ||
21 | using namespace Opie::Ui; | ||
22 | |||
20 | int main( int argc, char **argv ) | 23 | int main( int argc, char **argv ) |
21 | { | 24 | { |
22 | OApplication a( argc, argv, "Opie UI Demo" ); | 25 | OApplication a( argc, argv, "Opie UI Demo" ); |
23 | qDebug( "." ); | 26 | qDebug( "." ); |
24 | OpieUIDemo e; | 27 | OpieUIDemo e; |
25 | qDebug( "." ); | 28 | qDebug( "." ); |
26 | a.showMainWidget(&e); | 29 | a.showMainWidget(&e); |
27 | qDebug( "." ); | 30 | qDebug( "." ); |
28 | return a.exec(); | 31 | return a.exec(); |
29 | } | 32 | } |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp index 0d8bc9f..754a744 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp | |||
@@ -12,58 +12,56 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Qt | 16 | // Qt |
17 | 17 | ||
18 | #include <qcolor.h> | 18 | #include <qcolor.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qmenubar.h> | 20 | #include <qmenubar.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | 25 | ||
26 | // Qtopia | 26 | // Qtopia |
27 | 27 | ||
28 | #ifdef QWS | ||
29 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
31 | #endif | ||
32 | 30 | ||
33 | // Opie | 31 | // Opie |
34 | 32 | ||
35 | #ifdef QWS | ||
36 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
37 | using namespace Opie; | ||
38 | #endif | ||
39 | 34 | ||
40 | #include <opie2/ocompletionbox.h> | 35 | #include <opie2/ocompletionbox.h> |
41 | #include <opie2/olineedit.h> | 36 | #include <opie2/olineedit.h> |
42 | #include <opie2/ocombobox.h> | 37 | #include <opie2/ocombobox.h> |
43 | #include <opie2/oeditlistbox.h> | 38 | #include <opie2/oeditlistbox.h> |
44 | #include <opie2/oselector.h> | 39 | #include <opie2/oselector.h> |
45 | #include <opie2/opopupmenu.h> | 40 | #include <opie2/opopupmenu.h> |
46 | 41 | ||
47 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
48 | #include "oversatileviewdemo.h" | 43 | #include "oversatileviewdemo.h" |
49 | 44 | ||
50 | // Local | 45 | // Local |
51 | 46 | ||
52 | #include "opieuidemo.h" | 47 | #include "opieuidemo.h" |
53 | 48 | ||
49 | using namespace Opie::Core; | ||
50 | using namespace Opie::Ui; | ||
51 | |||
54 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; | 52 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; |
55 | 53 | ||
56 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) | 54 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) |
57 | : QMainWindow( parent, name, fl ) | 55 | : QMainWindow( parent, name, fl ) |
58 | { | 56 | { |
59 | 57 | ||
60 | QMenuBar* mbar = this->menuBar(); | 58 | QMenuBar* mbar = this->menuBar(); |
61 | OPopupMenu* demo = new OPopupMenu( this ); | 59 | OPopupMenu* demo = new OPopupMenu( this ); |
62 | demo->setTitle( "Title" ); | 60 | demo->setTitle( "Title" ); |
63 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); | 61 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); |
64 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); | 62 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); |
65 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); | 63 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); |
66 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); | 64 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); |
67 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); | 65 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); |
68 | mbar->insertItem( "Demonstrate", demo ); | 66 | mbar->insertItem( "Demonstrate", demo ); |
69 | 67 | ||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h index 0519ae6..382885f 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h +++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h | |||
@@ -5,52 +5,56 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef OPIEUIDEMO_H | 16 | #ifndef OPIEUIDEMO_H |
17 | #define OPIEUIDEMO_H | 17 | #define OPIEUIDEMO_H |
18 | 18 | ||
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | 20 | ||
21 | namespace Opie { | ||
22 | namespace Ui { | ||
21 | class OVersatileView; | 23 | class OVersatileView; |
24 | } | ||
25 | } | ||
22 | class QTabWidget; | 26 | class QTabWidget; |
23 | class QVBox; | 27 | class QVBox; |
24 | 28 | ||
25 | class OpieUIDemo : public QMainWindow { | 29 | class OpieUIDemo : public QMainWindow { |
26 | Q_OBJECT | 30 | Q_OBJECT |
27 | 31 | ||
28 | public: | 32 | public: |
29 | 33 | ||
30 | OpieUIDemo( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel ); | 34 | OpieUIDemo( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel ); |
31 | ~OpieUIDemo(); | 35 | ~OpieUIDemo(); |
32 | 36 | ||
33 | void demoOCompletionBox(); | 37 | void demoOCompletionBox(); |
34 | void demoOLineEdit(); | 38 | void demoOLineEdit(); |
35 | void demoOComboBox(); | 39 | void demoOComboBox(); |
36 | void demoOEditListBox(); | 40 | void demoOEditListBox(); |
37 | void demoOSelector(); | 41 | void demoOSelector(); |
38 | 42 | ||
39 | public slots: | 43 | public slots: |
40 | void demo( int ); | 44 | void demo( int ); |
41 | void messageBox( const QString& text ); | 45 | void messageBox( const QString& text ); |
42 | 46 | ||
43 | protected: | 47 | protected: |
44 | void build(); | 48 | void build(); |
45 | void buildVV( QVBox* b ); | 49 | void buildVV( QVBox* b ); |
46 | 50 | ||
47 | private: | 51 | private: |
48 | QTabWidget* main; | 52 | QTabWidget* main; |
49 | 53 | ||
50 | OVersatileView* vv; | 54 | Opie::Ui::OVersatileView* vv; |
51 | 55 | ||
52 | }; | 56 | }; |
53 | 57 | ||
54 | 58 | ||
55 | 59 | ||
56 | #endif | 60 | #endif |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp index 9db4e62..b6d59aa 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp | |||
@@ -25,32 +25,34 @@ | |||
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 | 32 | ||
33 | #include "oversatileviewdemo.h" | 33 | #include "oversatileviewdemo.h" |
34 | #include <opie2/oversatileview.h> | 34 | #include <opie2/oversatileview.h> |
35 | #include <opie2/oversatileviewitem.h> | 35 | #include <opie2/oversatileviewitem.h> |
36 | 36 | ||
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qpixmap.h> | 38 | #include <qpixmap.h> |
39 | #include <qlistview.h> | 39 | #include <qlistview.h> |
40 | 40 | ||
41 | using namespace Opie::Ui; | ||
42 | |||
41 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) | 43 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) |
42 | :QVBox( parent, name, f ) | 44 | :QVBox( parent, name, f ) |
43 | { | 45 | { |
44 | vv = new OVersatileView( this ); | 46 | vv = new OVersatileView( this ); |
45 | 47 | ||
46 | vv->addColumn( "First" ); | 48 | vv->addColumn( "First" ); |
47 | vv->addColumn( "2nd" ); | 49 | vv->addColumn( "2nd" ); |
48 | vv->addColumn( "IIIrd" ); | 50 | vv->addColumn( "IIIrd" ); |
49 | 51 | ||
50 | QString counter; | 52 | QString counter; |
51 | 53 | ||
52 | QPixmap leaf( "leaf.png" ); | 54 | QPixmap leaf( "leaf.png" ); |
53 | QPixmap opened( "folder_opened.png" ); | 55 | QPixmap opened( "folder_opened.png" ); |
54 | QPixmap closed( "folder_closed.png" ); | 56 | QPixmap closed( "folder_closed.png" ); |
55 | 57 | ||
56 | QPixmap leaf32( "leaf32.png" ); | 58 | QPixmap leaf32( "leaf32.png" ); |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h index 79318d0..35e2c3c 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h +++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h | |||
@@ -21,53 +21,57 @@ | |||
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 | 31 | ||
32 | #ifndef OVERSATILEVIEWDEMO_H | 32 | #ifndef OVERSATILEVIEWDEMO_H |
33 | #define OVERSATILEVIEWDEMO_H | 33 | #define OVERSATILEVIEWDEMO_H |
34 | 34 | ||
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | 36 | ||
37 | namespace Opie { | ||
38 | namespace Ui { | ||
37 | class OVersatileView; | 39 | class OVersatileView; |
38 | class OVersatileViewItem; | 40 | class OVersatileViewItem; |
41 | } | ||
42 | } | ||
39 | 43 | ||
40 | class OVersatileViewDemo: public QVBox | 44 | class OVersatileViewDemo: public QVBox |
41 | { | 45 | { |
42 | Q_OBJECT | 46 | Q_OBJECT |
43 | 47 | ||
44 | public: | 48 | public: |
45 | OVersatileViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 49 | OVersatileViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
46 | virtual ~OVersatileViewDemo(); | 50 | virtual ~OVersatileViewDemo(); |
47 | 51 | ||
48 | public slots: | 52 | public slots: |
49 | void selectionChanged(); | 53 | void selectionChanged(); |
50 | void selectionChanged( OVersatileViewItem * ); | 54 | void selectionChanged( Opie::Ui::OVersatileViewItem * ); |
51 | void currentChanged( OVersatileViewItem * ); | 55 | void currentChanged( Opie::Ui::OVersatileViewItem * ); |
52 | void clicked( OVersatileViewItem * ); | 56 | void clicked( Opie::Ui::OVersatileViewItem * ); |
53 | void pressed( OVersatileViewItem * ); | 57 | void pressed( OPie::Ui::OVersatileViewItem * ); |
54 | 58 | ||
55 | void doubleClicked( OVersatileViewItem *item ); | 59 | void doubleClicked( Opie::Ui::OVersatileViewItem *item ); |
56 | void returnPressed( OVersatileViewItem *item ); | 60 | void returnPressed( Opie::Ui::OVersatileViewItem *item ); |
57 | 61 | ||
58 | void onItem( OVersatileViewItem *item ); | 62 | void onItem( Opie::Ui::OVersatileViewItem *item ); |
59 | void onViewport(); | 63 | void onViewport(); |
60 | 64 | ||
61 | void expanded( OVersatileViewItem *item ); | 65 | void expanded( Opie::Ui::OVersatileViewItem *item ); |
62 | void collapsed( OVersatileViewItem *item ); | 66 | void collapsed( Opie::Ui::OVersatileViewItem *item ); |
63 | 67 | ||
64 | void moved(); | 68 | void moved(); |
65 | 69 | ||
66 | void contextMenuRequested( OVersatileViewItem *item, const QPoint&, int col ); | 70 | void contextMenuRequested( Opie::Ui::OVersatileViewItem *item, const QPoint&, int col ); |
67 | 71 | ||
68 | private: | 72 | private: |
69 | OVersatileView* vv; | 73 | Opie::Ui::OVersatileView* vv; |
70 | 74 | ||
71 | }; | 75 | }; |
72 | 76 | ||
73 | #endif | 77 | #endif |
diff --git a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp index b1c5e70..50cc11b 100644 --- a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp +++ b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp | |||
@@ -6,33 +6,33 @@ | |||
6 | 6 | ||
7 | /* OPIE */ | 7 | /* OPIE */ |
8 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
9 | #include <opie2/owidgetstack.h> | 9 | #include <opie2/owidgetstack.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | /* QT */ | 12 | /* QT */ |
13 | #include <qaction.h> | 13 | #include <qaction.h> |
14 | #include <qtoolbar.h> | 14 | #include <qtoolbar.h> |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmenubar.h> | 16 | #include <qmenubar.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qlabel.h> | 18 | #include <qlabel.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qsignalmapper.h> | 20 | #include <qsignalmapper.h> |
21 | 21 | ||
22 | using namespace Opie; | 22 | using namespace Opie::Ui; |
23 | 23 | ||
24 | OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) | 24 | OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) |
25 | 25 | ||
26 | StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) | 26 | StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow( parent, name, fl ) | 27 | : QMainWindow( parent, name, fl ) |
28 | { | 28 | { |
29 | m_stack = new OWidgetStack( this ); | 29 | m_stack = new OWidgetStack( this ); |
30 | setCentralWidget( m_stack ); | 30 | setCentralWidget( m_stack ); |
31 | 31 | ||
32 | /* nice Signal Mapper ;) */ | 32 | /* nice Signal Mapper ;) */ |
33 | QSignalMapper *sm = new QSignalMapper(this); | 33 | QSignalMapper *sm = new QSignalMapper(this); |
34 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); | 34 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); |
35 | 35 | ||
36 | /* toolbar first but this should be known from the other examples */ | 36 | /* toolbar first but this should be known from the other examples */ |
37 | setToolBarsMovable( false ); | 37 | setToolBarsMovable( false ); |
38 | 38 | ||
diff --git a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h index aea85cb..c9b70cb 100644 --- a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h +++ b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h | |||
@@ -1,28 +1,27 @@ | |||
1 | /* | 1 | /* |
2 | * You may use, modify and distribute this example without any limitation | 2 | * You may use, modify and distribute this example without any limitation |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef O_STACK_EXAMPLE_SIMPLE_H | 5 | #ifndef O_STACK_EXAMPLE_SIMPLE_H |
6 | #define O_STACK_EXAMPLE_SIMPLE_H | 6 | #define O_STACK_EXAMPLE_SIMPLE_H |
7 | 7 | ||
8 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
9 | #include <opie2/owidgetstack.h> | 9 | #include <opie2/owidgetstack.h> |
10 | 10 | ||
11 | using namespace Opie; | ||
12 | 11 | ||
13 | class StackExample : public QMainWindow { | 12 | class StackExample : public QMainWindow { |
14 | Q_OBJECT | 13 | Q_OBJECT |
15 | public: | 14 | public: |
16 | StackExample( QWidget* paren, const char* name, WFlags fl ); | 15 | StackExample( QWidget* paren, const char* name, WFlags fl ); |
17 | ~StackExample(); | 16 | ~StackExample(); |
18 | static QString appName() { return QString::fromLatin1("owidgetstack-example"); } | 17 | static QString appName() { return QString::fromLatin1("owidgetstack-example"); } |
19 | 18 | ||
20 | protected: | 19 | protected: |
21 | void closeEvent( QCloseEvent* e ); | 20 | void closeEvent( QCloseEvent* e ); |
22 | private: | 21 | private: |
23 | OWidgetStack* m_stack; | 22 | Opie::Ui::OWidgetStack* m_stack; |
24 | QWidget* m_main; | 23 | QWidget* m_main; |
25 | 24 | ||
26 | }; | 25 | }; |
27 | 26 | ||
28 | #endif | 27 | #endif |
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 | |||
@@ -47,58 +47,58 @@ _;:, .> :=|. This program is free software; you can | |||
47 | #include <qpe/qcopenvelope_qws.h> | 47 | #include <qpe/qcopenvelope_qws.h> |
48 | 48 | ||
49 | /* STD */ | 49 | /* STD */ |
50 | #include <fcntl.h> | 50 | #include <fcntl.h> |
51 | #include <math.h> | 51 | #include <math.h> |
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | #include <signal.h> | 53 | #include <signal.h> |
54 | #include <sys/ioctl.h> | 54 | #include <sys/ioctl.h> |
55 | #include <sys/time.h> | 55 | #include <sys/time.h> |
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #ifndef QT_NO_SOUND | 57 | #ifndef QT_NO_SOUND |
58 | #include <linux/soundcard.h> | 58 | #include <linux/soundcard.h> |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 61 | const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
62 | 62 | ||
63 | using namespace Opie; | 63 | using namespace Opie::Core; |
64 | 64 | ||
65 | ODevice *ODevice::inst() | 65 | ODevice *ODevice::inst() |
66 | { | 66 | { |
67 | static ODevice *dev = 0; | 67 | static ODevice *dev = 0; |
68 | 68 | ||
69 | // rewrite this to only use /proc/cpuinfo or so | 69 | // rewrite this to only use /proc/cpuinfo or so |
70 | 70 | ||
71 | if ( !dev ) | 71 | if ( !dev ) |
72 | { | 72 | { |
73 | QFile f( PATH_PROC_CPUINFO ); | 73 | QFile f( PATH_PROC_CPUINFO ); |
74 | if ( f.open( IO_ReadOnly ) ) | 74 | if ( f.open( IO_ReadOnly ) ) |
75 | { | 75 | { |
76 | QTextStream s( &f ); | 76 | QTextStream s( &f ); |
77 | while ( !s.atEnd() ) | 77 | while ( !s.atEnd() ) |
78 | { | 78 | { |
79 | QString line; | 79 | QString line; |
80 | line = s.readLine(); | 80 | line = s.readLine(); |
81 | if ( line.startsWith( "Hardware" ) ) | 81 | if ( line.startsWith( "Hardware" ) ) |
82 | { | 82 | { |
83 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 83 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
84 | if ( line.contains( "sharp", false ) ) dev = new Zaurus(); | 84 | if ( line.contains( "sharp", false ) ) dev = new Private::Zaurus(); |
85 | else if ( line.contains( "ipaq", false ) ) dev = new iPAQ(); | 85 | else if ( line.contains( "ipaq", false ) ) dev = new Private::iPAQ(); |
86 | else if ( line.contains( "simpad", false ) ) dev = new SIMpad(); | 86 | else if ( line.contains( "simpad", false ) ) dev = new Private::SIMpad(); |
87 | else if ( line.contains( "jornada", false ) ) dev = new Jornada(); | 87 | else if ( line.contains( "jornada", false ) ) dev = new Private::Jornada(); |
88 | else if ( line.contains( "ramses", false ) ) dev = new Ramses(); | 88 | else if ( line.contains( "ramses", false ) ) dev = new Private::Ramses(); |
89 | else qWarning( "ODevice() - unknown hardware - using default." ); | 89 | else qWarning( "ODevice() - unknown hardware - using default." ); |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | } | 93 | } |
94 | else | 94 | else |
95 | { | 95 | { |
96 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." ); | 96 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." ); |
97 | } | 97 | } |
98 | if ( !dev ) dev = new ODevice(); | 98 | if ( !dev ) dev = new ODevice(); |
99 | dev->init(); | 99 | dev->init(); |
100 | } | 100 | } |
101 | return dev; | 101 | return dev; |
102 | } | 102 | } |
103 | 103 | ||
104 | ODevice::ODevice() | 104 | ODevice::ODevice() |
@@ -174,33 +174,33 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ ) | |||
174 | * This method will either fail and return false or it'll suspend the | 174 | * This method will either fail and return false or it'll suspend the |
175 | * device and return once the device got woken up | 175 | * device and return once the device got woken up |
176 | * | 176 | * |
177 | * @return if the device got suspended | 177 | * @return if the device got suspended |
178 | */ | 178 | */ |
179 | bool ODevice::suspend() | 179 | bool ODevice::suspend() |
180 | { | 180 | { |
181 | qDebug("ODevice::suspend"); | 181 | qDebug("ODevice::suspend"); |
182 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 182 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
183 | return false; | 183 | return false; |
184 | 184 | ||
185 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 185 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | bool res = false; | 188 | bool res = false; |
189 | ODevice::sendSuspendmsg(); | 189 | ODevice::sendSuspendmsg(); |
190 | 190 | ||
191 | struct timeval tvs, tvn; | 191 | struct timeval tvs, tvn; |
192 | ::gettimeofday ( &tvs, 0 ); | 192 | ::gettimeofday ( &tvs, 0 ); |
193 | 193 | ||
194 | ::sync(); // flush fs caches | 194 | ::sync(); // flush fs caches |
195 | res = ( ::system ( "apm --suspend" ) == 0 ); | 195 | res = ( ::system ( "apm --suspend" ) == 0 ); |
196 | 196 | ||
197 | // This is needed because the iPAQ apm implementation is asynchronous and we | 197 | // This is needed because the iPAQ apm implementation is asynchronous and we |
198 | // can not be sure when exactly the device is really suspended | 198 | // can not be sure when exactly the device is really suspended |
199 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 199 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
200 | 200 | ||
201 | if ( res ) { | 201 | if ( res ) { |
202 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 202 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
203 | ::usleep ( 200 * 1000 ); | 203 | ::usleep ( 200 * 1000 ); |
204 | ::gettimeofday ( &tvn, 0 ); | 204 | ::gettimeofday ( &tvn, 0 ); |
205 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 205 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
206 | } | 206 | } |
@@ -611,18 +611,21 @@ void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) | |||
611 | 611 | ||
612 | Config buttonFile ( "ButtonSettings" ); | 612 | Config buttonFile ( "ButtonSettings" ); |
613 | buttonFile. setGroup ( "Button" + QString::number ( button )); | 613 | buttonFile. setGroup ( "Button" + QString::number ( button )); |
614 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); | 614 | buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction(). channel()); |
615 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); | 615 | buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction(). message()); |
616 | 616 | ||
617 | //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); | 617 | //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction(). data())); |
618 | 618 | ||
619 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); | 619 | QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); |
620 | } | 620 | } |
621 | void ODevice::virtual_hook(int, void* ){ | 621 | void ODevice::virtual_hook(int, void* ){ |
622 | 622 | ||
623 | } | 623 | } |
624 | 624 | ||
625 | void ODevice::sendSuspendmsg() | 625 | void ODevice::sendSuspendmsg() |
626 | { | 626 | { |
627 | if ( isQWS() ) | ||
628 | return; | ||
629 | |||
627 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); | 630 | QCopEnvelope ( "QPE/System", "aboutToSuspend()" ); |
628 | } | 631 | } |
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index bccb449..5ee9cca 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -27,34 +27,35 @@ _;:, .> :=|. This program is free software; you can | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qstrlist.h> | 41 | #include <qstrlist.h> |
42 | 42 | ||
43 | namespace Opie | 43 | namespace Opie{ |
44 | { | 44 | namespace Core{ |
45 | |||
45 | class ODeviceData; | 46 | class ODeviceData; |
46 | /** | 47 | /** |
47 | * The available devices | 48 | * The available devices |
48 | */ | 49 | */ |
49 | enum OModel { | 50 | enum OModel { |
50 | Model_Unknown, // = 0 | 51 | Model_Unknown, // = 0 |
51 | 52 | ||
52 | Model_Series_Mask = 0xff000000, | 53 | Model_Series_Mask = 0xff000000, |
53 | 54 | ||
54 | Model_iPAQ = ( 1 << 24 ), | 55 | Model_iPAQ = ( 1 << 24 ), |
55 | 56 | ||
56 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 57 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
57 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 58 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
58 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 59 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
59 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 60 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
60 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 61 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
@@ -237,33 +238,33 @@ public: | |||
237 | 238 | ||
238 | virtual bool hasLightSensor() const; | 239 | virtual bool hasLightSensor() const; |
239 | virtual int readLightSensor(); | 240 | virtual int readLightSensor(); |
240 | virtual int lightSensorResolution() const; | 241 | virtual int lightSensorResolution() const; |
241 | 242 | ||
242 | virtual bool hasHingeSensor() const; | 243 | virtual bool hasHingeSensor() const; |
243 | virtual OHingeStatus readHingeSensor(); | 244 | virtual OHingeStatus readHingeSensor(); |
244 | 245 | ||
245 | const QStrList &allowedCpuFrequencies() const; | 246 | const QStrList &allowedCpuFrequencies() const; |
246 | bool setCurrentCpuFrequency(uint index); | 247 | bool setCurrentCpuFrequency(uint index); |
247 | 248 | ||
248 | /** | 249 | /** |
249 | * Returns the available buttons on this device. The number and location | 250 | * Returns the available buttons on this device. The number and location |
250 | * of buttons will vary depending on the device. Button numbers will be assigned | 251 | * of buttons will vary depending on the device. Button numbers will be assigned |
251 | * by the device manufacturer and will be from most preferred button to least preffered | 252 | * by the device manufacturer and will be from most preferred button to least preffered |
252 | * button. Note that this list only contains "user mappable" buttons. | 253 | * button. Note that this list only contains "user mappable" buttons. |
253 | * | 254 | * |
254 | * @todo Make method const and take care of calling initButtons or make that const too | 255 | * @todo Make method const and take care of calling initButtons or make that const too |
255 | * | 256 | * |
256 | */ | 257 | */ |
257 | const QValueList<ODeviceButton> &buttons(); | 258 | const QValueList<ODeviceButton> &buttons(); |
258 | 259 | ||
259 | /** | 260 | /** |
260 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 261 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
261 | * returns 0L | 262 | * returns 0L |
262 | */ | 263 | */ |
263 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 264 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
264 | 265 | ||
265 | /** | 266 | /** |
266 | * Reassigns the pressed action for \a button. To return to the factory | 267 | * Reassigns the pressed action for \a button. To return to the factory |
267 | * default pass an empty string as \a qcopMessage. | 268 | * default pass an empty string as \a qcopMessage. |
268 | */ | 269 | */ |
269 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 270 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
@@ -301,32 +302,34 @@ class ODeviceData { | |||
301 | OModel m_model; | 302 | OModel m_model; |
302 | 303 | ||
303 | QString m_systemstr; | 304 | QString m_systemstr; |
304 | OSystem m_system; | 305 | OSystem m_system; |
305 | 306 | ||
306 | QString m_sysverstr; | 307 | QString m_sysverstr; |
307 | 308 | ||
308 | Transformation m_rotation; | 309 | Transformation m_rotation; |
309 | ODirection m_direction; | 310 | ODirection m_direction; |
310 | 311 | ||
311 | QValueList <ODeviceButton> *m_buttons; | 312 | QValueList <ODeviceButton> *m_buttons; |
312 | uint m_holdtime; | 313 | uint m_holdtime; |
313 | QStrList *m_cpu_frequencies; | 314 | QStrList *m_cpu_frequencies; |
314 | }; | 315 | }; |
315 | 316 | ||
316 | } | 317 | } |
318 | } | ||
317 | 319 | ||
318 | static inline bool isQWS() | 320 | static inline bool isQWS() |
319 | { | 321 | { |
320 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; | 322 | return qApp ? ( qApp->type() == QApplication::GuiServer ) : false; |
321 | } | 323 | } |
322 | 324 | ||
323 | static QCString makeChannel ( const char *str ) | 325 | static QCString makeChannel ( const char *str ) |
324 | { | 326 | { |
325 | if ( str && !::strchr ( str, '/' )) | 327 | if ( str && !::strchr ( str, '/' )) |
326 | return QCString ( "QPE/Application/" ) + str; | 328 | return QCString ( "QPE/Application/" ) + str; |
327 | else | 329 | else |
328 | return str; | 330 | return str; |
329 | } | 331 | } |
330 | 332 | ||
333 | |||
331 | #endif | 334 | #endif |
332 | 335 | ||
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 8ecea1b..177fd4c 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -40,32 +40,36 @@ | |||
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | |||
57 | using namespace Opie::Core; | ||
58 | using namespace Opie::Core::Private; | ||
59 | |||
56 | /* KERNEL */ | 60 | /* KERNEL */ |
57 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 61 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
58 | 62 | ||
59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 63 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
60 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 64 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
61 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 65 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
62 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 66 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
63 | 67 | ||
64 | typedef struct { | 68 | typedef struct { |
65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 69 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
66 | unsigned char TotalTime; /* Units of 5 seconds */ | 70 | unsigned char TotalTime; /* Units of 5 seconds */ |
67 | unsigned char OnTime; /* units of 100m/s */ | 71 | unsigned char OnTime; /* units of 100m/s */ |
68 | unsigned char OffTime; /* units of 100m/s */ | 72 | unsigned char OffTime; /* units of 100m/s */ |
69 | } LED_IN; | 73 | } LED_IN; |
70 | 74 | ||
71 | typedef struct { | 75 | typedef struct { |
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 | |||
@@ -22,33 +22,35 @@ | |||
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_IPAQ | 30 | #ifndef ODEVICE_IPAQ |
31 | #define ODEVICE_IPAQ | 31 | #define ODEVICE_IPAQ |
32 | 32 | ||
33 | #include "odevice.h" | 33 | #include "odevice.h" |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | using namespace Opie; | 38 | namespace Opie { |
39 | namespace Core { | ||
40 | namespace Private { | ||
39 | 41 | ||
40 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter | 42 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter |
41 | { | 43 | { |
42 | 44 | ||
43 | protected: | 45 | protected: |
44 | virtual void init(); | 46 | virtual void init(); |
45 | virtual void initButtons(); | 47 | virtual void initButtons(); |
46 | 48 | ||
47 | public: | 49 | public: |
48 | virtual bool setSoftSuspend( bool soft ); | 50 | virtual bool setSoftSuspend( bool soft ); |
49 | 51 | ||
50 | virtual bool setDisplayBrightness( int b ); | 52 | virtual bool setDisplayBrightness( int b ); |
51 | virtual int displayBrightnessResolution() const; | 53 | virtual int displayBrightnessResolution() const; |
52 | 54 | ||
53 | virtual void playAlarmSound(); | 55 | virtual void playAlarmSound(); |
54 | 56 | ||
@@ -68,17 +70,21 @@ class iPAQ : public ODevice, public QWSServer::KeyboardFilter | |||
68 | int m_power_timer; | 70 | int m_power_timer; |
69 | 71 | ||
70 | OLedState m_leds [2]; | 72 | OLedState m_leds [2]; |
71 | }; | 73 | }; |
72 | 74 | ||
73 | struct i_button { | 75 | struct i_button { |
74 | uint model; | 76 | uint model; |
75 | Qt::Key code; | 77 | Qt::Key code; |
76 | char *utext; | 78 | char *utext; |
77 | char *pix; | 79 | char *pix; |
78 | char *fpressedservice; | 80 | char *fpressedservice; |
79 | char *fpressedaction; | 81 | char *fpressedaction; |
80 | char *fheldservice; | 82 | char *fheldservice; |
81 | char *fheldaction; | 83 | char *fheldaction; |
82 | }; | 84 | }; |
83 | 85 | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
84 | #endif | 90 | #endif |
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 37bd6e9..b79b0b5 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -64,33 +64,33 @@ | |||
64 | typedef struct { | 64 | typedef struct { |
65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
66 | unsigned char TotalTime; /* Units of 5 seconds */ | 66 | unsigned char TotalTime; /* Units of 5 seconds */ |
67 | unsigned char OnTime; /* units of 100m/s */ | 67 | unsigned char OnTime; /* units of 100m/s */ |
68 | unsigned char OffTime; /* units of 100m/s */ | 68 | unsigned char OffTime; /* units of 100m/s */ |
69 | } LED_IN; | 69 | } LED_IN; |
70 | 70 | ||
71 | typedef struct { | 71 | typedef struct { |
72 | unsigned char mode; | 72 | unsigned char mode; |
73 | unsigned char pwr; | 73 | unsigned char pwr; |
74 | unsigned char brightness; | 74 | unsigned char brightness; |
75 | } FLITE_IN; | 75 | } FLITE_IN; |
76 | 76 | ||
77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
79 | 79 | ||
80 | using namespace Opie; | 80 | using namespace Opie::Core::Private; |
81 | 81 | ||
82 | void Jornada::init() | 82 | void Jornada::init() |
83 | { | 83 | { |
84 | d->m_vendorstr = "HP"; | 84 | d->m_vendorstr = "HP"; |
85 | d->m_vendor = Vendor_HP; | 85 | d->m_vendor = Vendor_HP; |
86 | d->m_modelstr = "Jornada 56x"; | 86 | d->m_modelstr = "Jornada 56x"; |
87 | d->m_model = Model_Jornada_56x; | 87 | d->m_model = Model_Jornada_56x; |
88 | d->m_systemstr = "Familiar"; | 88 | d->m_systemstr = "Familiar"; |
89 | d->m_system = System_Familiar; | 89 | d->m_system = System_Familiar; |
90 | d->m_rotation = Rot0; | 90 | d->m_rotation = Rot0; |
91 | 91 | ||
92 | QFile f ( "/etc/familiar-version" ); | 92 | QFile f ( "/etc/familiar-version" ); |
93 | f.setName ( "/etc/familiar-version" ); | 93 | f.setName ( "/etc/familiar-version" ); |
94 | if ( f.open ( IO_ReadOnly )) { | 94 | if ( f.open ( IO_ReadOnly )) { |
95 | 95 | ||
96 | QTextStream ts ( &f ); | 96 | QTextStream ts ( &f ); |
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 | |||
@@ -19,32 +19,35 @@ | |||
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_JORNADA | 30 | #ifndef ODEVICE_JORNADA |
31 | #define ODEVICE_JORNADA | 31 | #define ODEVICE_JORNADA |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | using namespace Opie; | 35 | namespace Opie { |
36 | 36 | namespace Core { | |
37 | namespace Private { | ||
37 | class Jornada : public ODevice | 38 | class Jornada : public ODevice |
38 | { | 39 | { |
39 | 40 | ||
40 | protected: | 41 | protected: |
41 | virtual void init(); | 42 | virtual void init(); |
42 | 43 | ||
43 | public: | 44 | public: |
44 | virtual bool setSoftSuspend ( bool soft ); | 45 | virtual bool setSoftSuspend ( bool soft ); |
45 | virtual bool setDisplayBrightness ( int b ); | 46 | virtual bool setDisplayBrightness ( int b ); |
46 | virtual int displayBrightnessResolution() const; | 47 | virtual int displayBrightnessResolution() const; |
47 | }; | 48 | }; |
48 | 49 | } | |
50 | } | ||
51 | } | ||
49 | #endif | 52 | #endif |
50 | 53 | ||
diff --git a/libopie2/opiecore/device/odevice_ramses.cpp b/libopie2/opiecore/device/odevice_ramses.cpp index 5bcf6a9..77de8c5 100644 --- a/libopie2/opiecore/device/odevice_ramses.cpp +++ b/libopie2/opiecore/device/odevice_ramses.cpp | |||
@@ -40,32 +40,35 @@ | |||
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie::Core; | ||
57 | using namespace Opie::Core::Private; | ||
58 | |||
56 | struct r_button ramses_buttons [] = { | 59 | struct r_button ramses_buttons [] = { |
57 | { Model_Ramses_MNCI, | 60 | { Model_Ramses_MNCI, |
58 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 61 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
59 | "devicebuttons/z_menu", | 62 | "devicebuttons/z_menu", |
60 | "QPE/TaskBar", "toggleMenu()", | 63 | "QPE/TaskBar", "toggleMenu()", |
61 | "QPE/TaskBar", "toggleStartMenu()" }, | 64 | "QPE/TaskBar", "toggleStartMenu()" }, |
62 | { Model_Ramses_MNCI, | 65 | { Model_Ramses_MNCI, |
63 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 66 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
64 | "devicebuttons/ipaq_home", | 67 | "devicebuttons/ipaq_home", |
65 | "QPE/Launcher", "home()", | 68 | "QPE/Launcher", "home()", |
66 | "buttonsettings", "raise()" }, | 69 | "buttonsettings", "raise()" }, |
67 | }; | 70 | }; |
68 | 71 | ||
69 | void Ramses::init() | 72 | void Ramses::init() |
70 | { | 73 | { |
71 | d->m_vendorstr = "M und N"; | 74 | d->m_vendorstr = "M und N"; |
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 | |||
@@ -21,33 +21,35 @@ | |||
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_RAMSES | 30 | #ifndef ODEVICE_RAMSES |
31 | #define ODEVICE_RAMSES | 31 | #define ODEVICE_RAMSES |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qwindowsystem_qws.h> | 35 | #include <qwindowsystem_qws.h> |
36 | 36 | ||
37 | using namespace Opie; | 37 | namespace Opie { |
38 | namespace Core { | ||
39 | namespace Private { | ||
38 | 40 | ||
39 | class Ramses : public ODevice, public QWSServer::KeyboardFilter | 41 | class Ramses : public ODevice, public QWSServer::KeyboardFilter |
40 | { | 42 | { |
41 | protected: | 43 | protected: |
42 | virtual void init(); | 44 | virtual void init(); |
43 | 45 | ||
44 | public: | 46 | public: |
45 | virtual bool setSoftSuspend( bool soft ); | 47 | virtual bool setSoftSuspend( bool soft ); |
46 | virtual bool suspend(); | 48 | virtual bool suspend(); |
47 | 49 | ||
48 | virtual bool setDisplayStatus( bool on ); | 50 | virtual bool setDisplayStatus( bool on ); |
49 | virtual bool setDisplayBrightness( int b ); | 51 | virtual bool setDisplayBrightness( int b ); |
50 | virtual int displayBrightnessResolution() const; | 52 | virtual int displayBrightnessResolution() const; |
51 | virtual bool setDisplayContrast( int b ); | 53 | virtual bool setDisplayContrast( int b ); |
52 | virtual int displayContrastResolution() const; | 54 | virtual int displayContrastResolution() const; |
53 | 55 | ||
@@ -55,18 +57,21 @@ class Ramses : public ODevice, public QWSServer::KeyboardFilter | |||
55 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 57 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
56 | virtual void timerEvent ( QTimerEvent *te ); | 58 | virtual void timerEvent ( QTimerEvent *te ); |
57 | 59 | ||
58 | int m_power_timer; | 60 | int m_power_timer; |
59 | }; | 61 | }; |
60 | 62 | ||
61 | struct r_button { | 63 | struct r_button { |
62 | uint model; | 64 | uint model; |
63 | Qt::Key code; | 65 | Qt::Key code; |
64 | char *utext; | 66 | char *utext; |
65 | char *pix; | 67 | char *pix; |
66 | char *fpressedservice; | 68 | char *fpressedservice; |
67 | char *fpressedaction; | 69 | char *fpressedaction; |
68 | char *fheldservice; | 70 | char *fheldservice; |
69 | char *fheldaction; | 71 | char *fheldaction; |
70 | }; | 72 | }; |
73 | } | ||
74 | } | ||
75 | } | ||
71 | 76 | ||
72 | #endif | 77 | #endif |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 90aca2f..80d40a3 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -40,33 +40,34 @@ _;:, .> :=|. This program is free software; you can | |||
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Private; | ||
57 | 58 | ||
58 | struct s_button simpad_buttons [] = { | 59 | struct s_button simpad_buttons [] = { |
59 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 60 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
60 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 61 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
61 | "devicebuttons/simpad_lower_up", | 62 | "devicebuttons/simpad_lower_up", |
62 | "datebook", "nextView()", | 63 | "datebook", "nextView()", |
63 | "today", "raise()" }, | 64 | "today", "raise()" }, |
64 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 65 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
65 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), | 66 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
66 | "devicebuttons/simpad_lower_down", | 67 | "devicebuttons/simpad_lower_down", |
67 | "addressbook", "raise()", | 68 | "addressbook", "raise()", |
68 | "addressbook", "beamBusinessCard()" }, | 69 | "addressbook", "beamBusinessCard()" }, |
69 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 70 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
70 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), | 71 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), |
71 | "devicebuttons/simpad_lower_right", | 72 | "devicebuttons/simpad_lower_right", |
72 | "QPE/TaskBar", "toggleMenu()", | 73 | "QPE/TaskBar", "toggleMenu()", |
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 | |||
@@ -22,33 +22,35 @@ | |||
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_SIMPAD | 30 | #ifndef ODEVICE_SIMPAD |
31 | #define ODEVICE_SIMPAD | 31 | #define ODEVICE_SIMPAD |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | using namespace Opie; | 38 | namespace Opie { |
39 | namespace Core { | ||
40 | namespace Private { | ||
39 | 41 | ||
40 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter | 42 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter |
41 | { | 43 | { |
42 | protected: | 44 | protected: |
43 | virtual void init(); | 45 | virtual void init(); |
44 | virtual void initButtons(); | 46 | virtual void initButtons(); |
45 | 47 | ||
46 | public: | 48 | public: |
47 | virtual bool setSoftSuspend( bool soft ); | 49 | virtual bool setSoftSuspend( bool soft ); |
48 | virtual bool suspend(); | 50 | virtual bool suspend(); |
49 | 51 | ||
50 | virtual bool setDisplayStatus( bool on ); | 52 | virtual bool setDisplayStatus( bool on ); |
51 | virtual bool setDisplayBrightness( int b ); | 53 | virtual bool setDisplayBrightness( int b ); |
52 | virtual int displayBrightnessResolution() const; | 54 | virtual int displayBrightnessResolution() const; |
53 | 55 | ||
54 | virtual void playAlarmSound(); | 56 | virtual void playAlarmSound(); |
@@ -65,17 +67,21 @@ class SIMpad : public ODevice, public QWSServer::KeyboardFilter | |||
65 | int m_power_timer; | 67 | int m_power_timer; |
66 | 68 | ||
67 | OLedState m_leds [1]; | 69 | OLedState m_leds [1]; |
68 | }; | 70 | }; |
69 | 71 | ||
70 | struct s_button { | 72 | struct s_button { |
71 | uint model; | 73 | uint model; |
72 | Qt::Key code; | 74 | Qt::Key code; |
73 | char *utext; | 75 | char *utext; |
74 | char *pix; | 76 | char *pix; |
75 | char *fpressedservice; | 77 | char *fpressedservice; |
76 | char *fpressedaction; | 78 | char *fpressedaction; |
77 | char *fheldservice; | 79 | char *fheldservice; |
78 | char *fheldaction; | 80 | char *fheldaction; |
79 | }; | 81 | }; |
80 | 82 | ||
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||
81 | #endif | 87 | #endif |
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index d241db8..f7a4025 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp | |||
@@ -40,33 +40,34 @@ _;:, .> :=|. This program is free software; you can | |||
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Private; | ||
57 | 58 | ||
58 | struct yopy_button yopy_buttons [] = { | 59 | struct yopy_button yopy_buttons [] = { |
59 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), | 60 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), |
60 | "devicebuttons/yopy_action", | 61 | "devicebuttons/yopy_action", |
61 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
62 | "today", "raise()" }, | 63 | "today", "raise()" }, |
63 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), | 64 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), |
64 | "devicebuttons/yopy_ok", | 65 | "devicebuttons/yopy_ok", |
65 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
66 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
67 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), |
68 | "devicebuttons/yopy_end", | 69 | "devicebuttons/yopy_end", |
69 | "QPE/Launcher", "home()", | 70 | "QPE/Launcher", "home()", |
70 | "buttonsettings", "raise()" }, | 71 | "buttonsettings", "raise()" }, |
71 | }; | 72 | }; |
72 | 73 | ||
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 | |||
@@ -19,44 +19,49 @@ _;:, .> :=|. This program is free software; you can | |||
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_YOPY | 30 | #ifndef ODEVICE_YOPY |
31 | #define ODEVICE_YOPY | 31 | #define ODEVICE_YOPY |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | using namespace Opie; | 35 | namespace Opie { |
36 | 36 | namespace Core { | |
37 | namespace Private { | ||
37 | class Yopy : public ODevice | 38 | class Yopy : public ODevice |
38 | { | 39 | { |
39 | protected: | 40 | protected: |
40 | 41 | ||
41 | virtual void init(); | 42 | virtual void init(); |
42 | virtual void initButtons(); | 43 | virtual void initButtons(); |
43 | 44 | ||
44 | public: | 45 | public: |
45 | virtual bool suspend(); | 46 | virtual bool suspend(); |
46 | 47 | ||
47 | virtual bool setDisplayBrightness ( int b ); | 48 | virtual bool setDisplayBrightness ( int b ); |
48 | virtual int displayBrightnessResolution() const; | 49 | virtual int displayBrightnessResolution() const; |
49 | }; | 50 | }; |
50 | 51 | ||
51 | struct yopy_button | 52 | struct yopy_button |
52 | { | 53 | { |
53 | Qt::Key code; | 54 | Qt::Key code; |
54 | char *utext; | 55 | char *utext; |
55 | char *pix; | 56 | char *pix; |
56 | char *fpressedservice; | 57 | char *fpressedservice; |
57 | char *fpressedaction; | 58 | char *fpressedaction; |
58 | char *fheldservice; | 59 | char *fheldservice; |
59 | char *fheldaction; | 60 | char *fheldaction; |
60 | }; | 61 | }; |
61 | 62 | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | |||
62 | #endif | 67 | #endif |
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 8ab3cbe..0d21f26 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -40,33 +40,34 @@ _;:, .> :=|. This program is free software; you can | |||
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Private; | ||
57 | 58 | ||
58 | struct z_button z_buttons [] = { | 59 | struct z_button z_buttons [] = { |
59 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 60 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
60 | "devicebuttons/z_calendar", | 61 | "devicebuttons/z_calendar", |
61 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
62 | "today", "raise()" }, | 63 | "today", "raise()" }, |
63 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 64 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
64 | "devicebuttons/z_contact", | 65 | "devicebuttons/z_contact", |
65 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
66 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
67 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
68 | "devicebuttons/z_home", | 69 | "devicebuttons/z_home", |
69 | "QPE/Launcher", "home()", | 70 | "QPE/Launcher", "home()", |
70 | "buttonsettings", "raise()" }, | 71 | "buttonsettings", "raise()" }, |
71 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 72 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
72 | "devicebuttons/z_menu", | 73 | "devicebuttons/z_menu", |
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 | |||
@@ -32,34 +32,36 @@ | |||
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | #ifndef ARRAY_SIZE | 35 | #ifndef ARRAY_SIZE |
36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | // _IO and friends are only defined in kernel headers ... | 39 | // _IO and friends are only defined in kernel headers ... |
40 | 40 | ||
41 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 41 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
42 | 42 | ||
43 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 43 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
44 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 44 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
45 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 45 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
46 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 46 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
47 | 47 | ||
48 | using namespace Opie; | ||
49 | 48 | ||
49 | namespace Opie { | ||
50 | namespace Core { | ||
51 | namespace Private { | ||
50 | class Zaurus : public ODevice | 52 | class Zaurus : public ODevice |
51 | { | 53 | { |
52 | 54 | ||
53 | protected: | 55 | protected: |
54 | virtual void init(); | 56 | virtual void init(); |
55 | virtual void initButtons(); | 57 | virtual void initButtons(); |
56 | 58 | ||
57 | public: | 59 | public: |
58 | virtual bool setSoftSuspend ( bool soft ); | 60 | virtual bool setSoftSuspend ( bool soft ); |
59 | 61 | ||
60 | virtual bool setDisplayBrightness ( int b ); | 62 | virtual bool setDisplayBrightness ( int b ); |
61 | virtual int displayBrightnessResolution() const; | 63 | virtual int displayBrightnessResolution() const; |
62 | 64 | ||
63 | virtual void playAlarmSound(); | 65 | virtual void playAlarmSound(); |
64 | virtual void playKeySound(); | 66 | virtual void playKeySound(); |
65 | virtual void playTouchSound(); | 67 | virtual void playTouchSound(); |
@@ -79,18 +81,20 @@ class Zaurus : public ODevice | |||
79 | protected: | 81 | protected: |
80 | virtual void buzzer ( int snd ); | 82 | virtual void buzzer ( int snd ); |
81 | 83 | ||
82 | OLedState m_leds [1]; | 84 | OLedState m_leds [1]; |
83 | bool m_embedix; | 85 | bool m_embedix; |
84 | }; | 86 | }; |
85 | 87 | ||
86 | struct z_button { | 88 | struct z_button { |
87 | Qt::Key code; | 89 | Qt::Key code; |
88 | char *utext; | 90 | char *utext; |
89 | char *pix; | 91 | char *pix; |
90 | char *fpressedservice; | 92 | char *fpressedservice; |
91 | char *fpressedaction; | 93 | char *fpressedaction; |
92 | char *fheldservice; | 94 | char *fheldservice; |
93 | char *fheldaction; | 95 | char *fheldaction; |
94 | }; | 96 | }; |
95 | 97 | } | |
98 | } | ||
99 | } | ||
96 | #endif | 100 | #endif |
diff --git a/libopie2/opiecore/device/odevicebutton.cpp b/libopie2/opiecore/device/odevicebutton.cpp index 0b593d5..a081b7f 100644 --- a/libopie2/opiecore/device/odevicebutton.cpp +++ b/libopie2/opiecore/device/odevicebutton.cpp | |||
@@ -20,42 +20,48 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <qpixmap.h> | 30 | #include <qpixmap.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | 32 | ||
33 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | 35 | ||
36 | using namespace Opie; | 36 | |
37 | namespace Opie { | ||
38 | namespace Core { | ||
39 | namespace Private { | ||
37 | 40 | ||
38 | class OQCopMessageData | 41 | class OQCopMessageData |
39 | { | 42 | { |
40 | public: | 43 | public: |
41 | QCString m_channel; | 44 | QCString m_channel; |
42 | QCString m_message; | 45 | QCString m_message; |
43 | QByteArray m_data; | 46 | QByteArray m_data; |
44 | }; | 47 | }; |
48 | } | ||
45 | 49 | ||
50 | using namespace Opie::Core; | ||
51 | using namespace Opie::Core::Private; | ||
46 | 52 | ||
47 | OQCopMessage::OQCopMessage() | 53 | OQCopMessage::OQCopMessage() |
48 | : d ( 0 ) | 54 | : d ( 0 ) |
49 | { | 55 | { |
50 | init ( QCString(), QCString(), QByteArray()); | 56 | init ( QCString(), QCString(), QByteArray()); |
51 | } | 57 | } |
52 | 58 | ||
53 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) | 59 | OQCopMessage::OQCopMessage ( const OQCopMessage © ) |
54 | : d ( 0 ) | 60 | : d ( 0 ) |
55 | { | 61 | { |
56 | init ( copy. channel(), copy. message(), copy. data()); | 62 | init ( copy. channel(), copy. message(), copy. data()); |
57 | } | 63 | } |
58 | 64 | ||
59 | OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) | 65 | OQCopMessage &OQCopMessage::operator = ( const OQCopMessage &assign ) |
60 | { | 66 | { |
61 | init ( assign. channel(), assign. message(), assign. data()); | 67 | init ( assign. channel(), assign. message(), assign. data()); |
@@ -111,34 +117,34 @@ bool OQCopMessage::isNull() const | |||
111 | } | 117 | } |
112 | void OQCopMessage::setChannel ( const QCString &ch ) | 118 | void OQCopMessage::setChannel ( const QCString &ch ) |
113 | { | 119 | { |
114 | d->m_channel = ch; | 120 | d->m_channel = ch; |
115 | } | 121 | } |
116 | 122 | ||
117 | void OQCopMessage::setMessage ( const QCString &m ) | 123 | void OQCopMessage::setMessage ( const QCString &m ) |
118 | { | 124 | { |
119 | d->m_message = m; | 125 | d->m_message = m; |
120 | } | 126 | } |
121 | 127 | ||
122 | void OQCopMessage::setData ( const QByteArray &data ) | 128 | void OQCopMessage::setData ( const QByteArray &data ) |
123 | { | 129 | { |
124 | d->m_data = data; | 130 | d->m_data = data; |
125 | } | 131 | } |
126 | 132 | ||
127 | /*! \class Opie::ODeviceButton | 133 | /*! \class Opie::Core::ODeviceButton |
128 | \brief The Opie::ODeviceButton class represents a physical user mappable button on a Qtopia device. | 134 | \brief The Opie::Core::ODeviceButton class represents a physical user mappable button on a Qtopia device. |
129 | 135 | ||
130 | This class represents a physical button on a Qtopia device. A | 136 | This class represents a physical button on a Qtopia device. A |
131 | device may have "user programmable" buttons. | 137 | device may have "user programmable" buttons. |
132 | The location and number of buttons will vary from device to | 138 | The location and number of buttons will vary from device to |
133 | device. userText() and pixmap() may be used to describe this button | 139 | device. userText() and pixmap() may be used to describe this button |
134 | to the user in help documentation. | 140 | to the user in help documentation. |
135 | 141 | ||
136 | \ingroup qtopiaemb | 142 | \ingroup qtopiaemb |
137 | \internal | 143 | \internal |
138 | */ | 144 | */ |
139 | 145 | ||
140 | ODeviceButton::ODeviceButton() | 146 | ODeviceButton::ODeviceButton() |
141 | {} | 147 | {} |
142 | 148 | ||
143 | ODeviceButton::~ODeviceButton() | 149 | ODeviceButton::~ODeviceButton() |
144 | {} | 150 | {} |
@@ -231,16 +237,19 @@ void ODeviceButton::setFactoryPresetPressedAction(const OQCopMessage& action) | |||
231 | 237 | ||
232 | 238 | ||
233 | void ODeviceButton::setPressedAction(const OQCopMessage& action) | 239 | void ODeviceButton::setPressedAction(const OQCopMessage& action) |
234 | { | 240 | { |
235 | m_PressedAction = action; | 241 | m_PressedAction = action; |
236 | } | 242 | } |
237 | 243 | ||
238 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) | 244 | void ODeviceButton::setFactoryPresetHeldAction(const OQCopMessage& action) |
239 | { | 245 | { |
240 | m_FactoryPresetHeldAction = action; | 246 | m_FactoryPresetHeldAction = action; |
241 | } | 247 | } |
242 | 248 | ||
243 | void ODeviceButton::setHeldAction(const OQCopMessage& action) | 249 | void ODeviceButton::setHeldAction(const OQCopMessage& action) |
244 | { | 250 | { |
245 | m_HeldAction = action; | 251 | m_HeldAction = action; |
246 | } | 252 | } |
253 | |||
254 | } | ||
255 | } | ||
diff --git a/libopie2/opiecore/device/odevicebutton.h b/libopie2/opiecore/device/odevicebutton.h index a66b88f..4000144 100644 --- a/libopie2/opiecore/device/odevicebutton.h +++ b/libopie2/opiecore/device/odevicebutton.h | |||
@@ -10,62 +10,64 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DEVICE_BUTTON_H | 20 | #ifndef DEVICE_BUTTON_H |
21 | #define DEVICE_BUTTON_H | 21 | #define DEVICE_BUTTON_H |
22 | 22 | ||
23 | #include <qpixmap.h> | 23 | #include <qpixmap.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | 25 | ||
26 | class OQCopMessageData; | ||
27 | 26 | ||
28 | namespace Opie | 27 | namespace Opie{ |
29 | { | 28 | namespace Core{ |
29 | namespace Private { | ||
30 | class OQCopMessageData; | ||
31 | } | ||
30 | 32 | ||
31 | class OQCopMessage | 33 | class OQCopMessage |
32 | { | 34 | { |
33 | public: | 35 | public: |
34 | OQCopMessage ( ); | 36 | OQCopMessage ( ); |
35 | OQCopMessage ( const OQCopMessage © ); | 37 | OQCopMessage ( const OQCopMessage © ); |
36 | OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( )); | 38 | OQCopMessage ( const QCString &m_channel, const QCString &message, const QByteArray &args = QByteArray ( )); |
37 | 39 | ||
38 | OQCopMessage &operator = ( const OQCopMessage &assign ); | 40 | OQCopMessage &operator = ( const OQCopMessage &assign ); |
39 | 41 | ||
40 | void setChannel ( const QCString &channel ); | 42 | void setChannel ( const QCString &channel ); |
41 | void setMessage ( const QCString &message ); | 43 | void setMessage ( const QCString &message ); |
42 | void setData ( const QByteArray &ba ); | 44 | void setData ( const QByteArray &ba ); |
43 | 45 | ||
44 | QCString channel ( ) const; | 46 | QCString channel ( ) const; |
45 | QCString message ( ) const; | 47 | QCString message ( ) const; |
46 | QByteArray data ( ) const; | 48 | QByteArray data ( ) const; |
47 | 49 | ||
48 | bool isNull()const; | 50 | bool isNull()const; |
49 | 51 | ||
50 | bool send ( ); | 52 | bool send ( ); |
51 | 53 | ||
52 | private: | 54 | private: |
53 | void init ( const QCString &m_channel, const QCString &message, const QByteArray &args ); | 55 | void init ( const QCString &m_channel, const QCString &message, const QByteArray &args ); |
54 | 56 | ||
55 | OQCopMessageData *d; | 57 | Private::OQCopMessageData *d; |
56 | class Private; | 58 | class Private; |
57 | Private* m_data; | 59 | Private* m_data; |
58 | }; | 60 | }; |
59 | 61 | ||
60 | 62 | ||
61 | /** | 63 | /** |
62 | * This class represents a physical button on a Qtopia device. A device may | 64 | * This class represents a physical button on a Qtopia device. A device may |
63 | * have n "user programmable" buttons, which are number 1..n. The location | 65 | * have n "user programmable" buttons, which are number 1..n. The location |
64 | * and number of buttons will vary from device to device. userText() and pixmap() | 66 | * and number of buttons will vary from device to device. userText() and pixmap() |
65 | * may be used to describe this button to the user in help documentation. | 67 | * may be used to describe this button to the user in help documentation. |
66 | * | 68 | * |
67 | * @version 1.0 | 69 | * @version 1.0 |
68 | * @author Trolltech | 70 | * @author Trolltech |
69 | * @short A representation of buttons | 71 | * @short A representation of buttons |
70 | */ | 72 | */ |
71 | 73 | ||
@@ -91,18 +93,19 @@ class ODeviceButton | |||
91 | void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage ); | 93 | void setFactoryPresetHeldAction ( const OQCopMessage& qcopMessage ); |
92 | void setHeldAction ( const OQCopMessage& qcopMessage ); | 94 | void setHeldAction ( const OQCopMessage& qcopMessage ); |
93 | 95 | ||
94 | private: | 96 | private: |
95 | ushort m_Keycode; | 97 | ushort m_Keycode; |
96 | QString m_UserText; | 98 | QString m_UserText; |
97 | QPixmap m_Pixmap; | 99 | QPixmap m_Pixmap; |
98 | OQCopMessage m_FactoryPresetPressedAction; | 100 | OQCopMessage m_FactoryPresetPressedAction; |
99 | OQCopMessage m_PressedAction; | 101 | OQCopMessage m_PressedAction; |
100 | OQCopMessage m_FactoryPresetHeldAction; | 102 | OQCopMessage m_FactoryPresetHeldAction; |
101 | OQCopMessage m_HeldAction; | 103 | OQCopMessage m_HeldAction; |
102 | class Private; | 104 | class Private; |
103 | Private *d; | 105 | Private *d; |
104 | }; | 106 | }; |
105 | 107 | ||
106 | } | 108 | } |
109 | } | ||
107 | 110 | ||
108 | #endif | 111 | #endif |
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index d340c0e..e2f6e82 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp | |||
@@ -21,44 +21,51 @@ | |||
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <opie2/oapplication.h> | 30 | #include <opie2/oapplication.h> |
31 | #include <opie2/oconfig.h> | 31 | #include <opie2/oconfig.h> |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | #include <signal.h> | 34 | #include <signal.h> |
35 | #include <stdio.h> | 35 | #include <stdio.h> |
36 | 36 | ||
37 | using namespace Opie::Core; | ||
38 | |||
39 | |||
37 | OApplication* OApplication::_instance = 0; | 40 | OApplication* OApplication::_instance = 0; |
38 | 41 | ||
39 | /************************************************************************************************** | 42 | /************************************************************************************************** |
40 | * OApplicationPrivate | 43 | * OApplicationPrivate |
41 | **************************************************************************************************/ | 44 | **************************************************************************************************/ |
42 | 45 | ||
46 | namespace Opie { | ||
47 | namespace Core { | ||
48 | namespace Private { | ||
43 | class OApplicationPrivate | 49 | class OApplicationPrivate |
44 | { | 50 | { |
45 | public: | 51 | public: |
46 | OApplicationPrivate() {}; | 52 | OApplicationPrivate() {}; |
47 | ~OApplicationPrivate() {}; | 53 | ~OApplicationPrivate() {}; |
48 | }; | 54 | }; |
55 | } | ||
49 | 56 | ||
50 | /************************************************************************************************** | 57 | /************************************************************************************************** |
51 | * OApplication | 58 | * OApplication |
52 | **************************************************************************************************/ | 59 | **************************************************************************************************/ |
53 | 60 | ||
54 | 61 | ||
55 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) | 62 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) |
56 | :QPEApplication( argc, argv ), | 63 | :QPEApplication( argc, argv ), |
57 | _appname( rAppName ), | 64 | _appname( rAppName ), |
58 | _config( 0 ) | 65 | _config( 0 ) |
59 | { | 66 | { |
60 | init(); | 67 | init(); |
61 | } | 68 | } |
62 | 69 | ||
63 | 70 | ||
64 | OApplication::~OApplication() | 71 | OApplication::~OApplication() |
@@ -71,33 +78,33 @@ OApplication::~OApplication() | |||
71 | // the construction of another object is allowed | 78 | // the construction of another object is allowed |
72 | } | 79 | } |
73 | 80 | ||
74 | 81 | ||
75 | OConfig* OApplication::config() | 82 | OConfig* OApplication::config() |
76 | { | 83 | { |
77 | if ( !_config ) | 84 | if ( !_config ) |
78 | { | 85 | { |
79 | _config = new OConfig( _appname ); | 86 | _config = new OConfig( _appname ); |
80 | } | 87 | } |
81 | return _config; | 88 | return _config; |
82 | } | 89 | } |
83 | 90 | ||
84 | 91 | ||
85 | void OApplication::init() | 92 | void OApplication::init() |
86 | { | 93 | { |
87 | d = new OApplicationPrivate(); | 94 | d = new Private::OApplicationPrivate(); |
88 | if ( !OApplication::_instance ) | 95 | if ( !OApplication::_instance ) |
89 | { | 96 | { |
90 | OApplication::_instance = this; | 97 | OApplication::_instance = this; |
91 | 98 | ||
92 | /* register SIGSEGV handler to give programs an option | 99 | /* register SIGSEGV handler to give programs an option |
93 | * to exit gracefully, e.g. save or close devices or files. | 100 | * to exit gracefully, e.g. save or close devices or files. |
94 | struct sigaction sa; | 101 | struct sigaction sa; |
95 | sa.sa_handler = ( void (*)(int) ) &segv_handler; | 102 | sa.sa_handler = ( void (*)(int) ) &segv_handler; |
96 | sa.sa_flags = SA_SIGINFO | SA_RESTART; | 103 | sa.sa_flags = SA_SIGINFO | SA_RESTART; |
97 | sigemptyset(&sa.sa_mask); | 104 | sigemptyset(&sa.sa_mask); |
98 | sigaction(SIGSEGV, &sa, NULL); | 105 | sigaction(SIGSEGV, &sa, NULL); |
99 | */ | 106 | */ |
100 | } | 107 | } |
101 | else | 108 | else |
102 | { | 109 | { |
103 | ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl; | 110 | ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl; |
@@ -112,16 +119,18 @@ void OApplication::showMainWidget( QWidget* widget, bool nomax ) | |||
112 | QPEApplication::showMainWidget( widget, nomax ); | 119 | QPEApplication::showMainWidget( widget, nomax ); |
113 | widget->setCaption( _appname ); | 120 | widget->setCaption( _appname ); |
114 | } | 121 | } |
115 | 122 | ||
116 | 123 | ||
117 | void OApplication::setTitle( const QString& title ) const | 124 | void OApplication::setTitle( const QString& title ) const |
118 | { | 125 | { |
119 | if ( mainWidget() ) | 126 | if ( mainWidget() ) |
120 | { | 127 | { |
121 | if ( !title.isNull() ) | 128 | if ( !title.isNull() ) |
122 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); | 129 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); |
123 | else | 130 | else |
124 | mainWidget()->setCaption( _appname ); | 131 | mainWidget()->setCaption( _appname ); |
125 | } | 132 | } |
126 | } | 133 | } |
127 | 134 | ||
135 | } | ||
136 | } | ||
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index cc506a2..c1e32a6 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h | |||
@@ -17,39 +17,43 @@ | |||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OAPPLICATION_H | 30 | #ifndef OAPPLICATION_H |
31 | #define OAPPLICATION_H | 31 | #define OAPPLICATION_H |
32 | 32 | ||
33 | #define oApp OApplication::oApplication() | 33 | #define oApp Opie::Core::OApplication::oApplication() |
34 | 34 | ||
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | 37 | ||
38 | 38 | namespace Opie { | |
39 | namespace Core { | ||
40 | namespace Private { | ||
39 | class OApplicationPrivate; | 41 | class OApplicationPrivate; |
42 | } // private class | ||
43 | |||
40 | class OConfig; | 44 | class OConfig; |
41 | 45 | ||
42 | 46 | ||
43 | class OApplication : public QPEApplication | 47 | class OApplication : public QPEApplication |
44 | { | 48 | { |
45 | Q_OBJECT | 49 | Q_OBJECT |
46 | 50 | ||
47 | public: | 51 | public: |
48 | /** | 52 | /** |
49 | * Constructor. Parses command-line arguments and sets the window caption. | 53 | * Constructor. Parses command-line arguments and sets the window caption. |
50 | * | 54 | * |
51 | * @param rAppName application name. Will be used for finding the | 55 | * @param rAppName application name. Will be used for finding the |
52 | * associated message, icon and configuration files | 56 | * associated message, icon and configuration files |
53 | * | 57 | * |
54 | */ | 58 | */ |
55 | OApplication( int& argc, char** argv, const QCString& rAppName ); | 59 | OApplication( int& argc, char** argv, const QCString& rAppName ); |
@@ -85,20 +89,23 @@ class OApplication : public QPEApplication | |||
85 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); | 89 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); |
86 | /** | 90 | /** |
87 | * Set the application title. The application title will be concatenated | 91 | * Set the application title. The application title will be concatenated |
88 | * to the application name given in the constructor. | 92 | * to the application name given in the constructor. |
89 | * | 93 | * |
90 | * @param title the title. If not given, resets caption to appname | 94 | * @param title the title. If not given, resets caption to appname |
91 | */ | 95 | */ |
92 | virtual void setTitle( const QString& title = QString::null ) const; | 96 | virtual void setTitle( const QString& title = QString::null ) const; |
93 | 97 | ||
94 | protected: | 98 | protected: |
95 | void init(); | 99 | void init(); |
96 | 100 | ||
97 | private: | 101 | private: |
98 | const QCString _appname; | 102 | const QCString _appname; |
99 | static OApplication* _instance; | 103 | static OApplication* _instance; |
100 | OConfig* _config; | 104 | OConfig* _config; |
101 | OApplicationPrivate* d; | 105 | Private::OApplicationPrivate* d; |
102 | }; | 106 | }; |
103 | 107 | ||
108 | } // Core | ||
109 | } // Opie | ||
110 | |||
104 | #endif // OAPPLICATION_H | 111 | #endif // OAPPLICATION_H |
diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp index fb5eabb..05d8070 100644 --- a/libopie2/opiecore/oconfig.cpp +++ b/libopie2/opiecore/oconfig.cpp | |||
@@ -25,32 +25,34 @@ | |||
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 | using namespace Opie::Core; | ||
42 | |||
41 | OConfig::OConfig( const QString &name, Domain domain ) | 43 | OConfig::OConfig( const QString &name, Domain domain ) |
42 | :Config( name, domain ) | 44 | :Config( name, domain ) |
43 | { | 45 | { |
44 | qDebug( "OConfig::OConfig()" ); | 46 | qDebug( "OConfig::OConfig()" ); |
45 | } | 47 | } |
46 | 48 | ||
47 | OConfig::~OConfig() | 49 | OConfig::~OConfig() |
48 | { | 50 | { |
49 | qDebug( "OConfig::~OConfig()" ); | 51 | qDebug( "OConfig::~OConfig()" ); |
50 | } | 52 | } |
51 | 53 | ||
52 | QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const | 54 | QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const |
53 | { | 55 | { |
54 | QColor aRetColor; | 56 | QColor aRetColor; |
55 | int nRed = 0, nGreen = 0, nBlue = 0; | 57 | int nRed = 0, nGreen = 0, nBlue = 0; |
56 | 58 | ||
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 | |||
@@ -27,64 +27,72 @@ | |||
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 <qpe/config.h> |
39 | 39 | ||
40 | class QColor; | 40 | class QColor; |
41 | class QFont; | 41 | class QFont; |
42 | 42 | ||
43 | namespace Opie { | ||
44 | namespace Core { | ||
45 | |||
43 | /** | 46 | /** |
44 | * A Configuration class based on the Qtopia @ref Config class | 47 | * A Configuration class based on the Qtopia @ref Config class |
45 | * featuring additional handling of color and font entries | 48 | * featuring additional handling of color and font entries |
46 | */ | 49 | */ |
47 | 50 | ||
48 | class OConfig : public Config | 51 | class OConfig : public Config |
49 | { | 52 | { |
50 | public: | 53 | public: |
51 | /** | 54 | /** |
52 | * Constructs a OConfig object with a @a name. | 55 | * Constructs a OConfig object with a @a name. |
53 | */ | 56 | */ |
54 | OConfig( const QString &name, Domain domain = User ); | 57 | OConfig( const QString &name, Domain domain = User ); |
55 | /** | 58 | /** |
56 | * Destructs the OConfig object. | 59 | * Destructs the OConfig object. |
57 | * | 60 | * |
58 | * Writes back any dirty configuration entries, and destroys | 61 | * Writes back any dirty configuration entries, and destroys |
59 | * dynamically created objects. | 62 | * dynamically created objects. |
60 | */ | 63 | */ |
61 | virtual ~OConfig(); | 64 | virtual ~OConfig(); |
62 | /** | 65 | /** |
63 | * @returns the name of the current group. | 66 | * @returns the name of the current group. |
64 | * The current group is used for searching keys and accessing entries. | 67 | * The current group is used for searching keys and accessing entries. |
68 | * @todo make const | ||
65 | */ | 69 | */ |
66 | const QString& group() { return git.key(); }; | 70 | const QString& group() { return git.key(); }; |
67 | /** | 71 | /** |
68 | * @returns a @ref QColor entry or a @a default value if the key is not found. | 72 | * @returns a @ref QColor entry or a @a default value if the key is not found. |
69 | */ | 73 | */ |
70 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; | 74 | QColor readColorEntry( const QString& key, const QColor* pDefault ) const; |
71 | /** | 75 | /** |
72 | * @returns a @ref QFont value or a @a default value if the key is not found. | 76 | * @returns a @ref QFont value or a @a default value if the key is not found. |
73 | */ | 77 | */ |
74 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; | 78 | QFont readFontEntry( const QString& key, const QFont* pDefault ) const; |
79 | |||
80 | private: | ||
81 | class Private; | ||
82 | Private *d; | ||
75 | }; | 83 | }; |
76 | 84 | ||
77 | /** | 85 | /** |
78 | * @brief Helper class for easier use of OConfig groups. | 86 | * @brief Helper class for easier use of OConfig groups. |
79 | * | 87 | * |
80 | * Careful programmers always set the group of a | 88 | * Careful programmers always set the group of a |
81 | * @ref OConfig object to the group they want to read from | 89 | * @ref OConfig object to the group they want to read from |
82 | * and set it back to the old one of afterwards. This is usually | 90 | * and set it back to the old one of afterwards. This is usually |
83 | * written as: | 91 | * written as: |
84 | * <pre> | 92 | * <pre> |
85 | * | 93 | * |
86 | * QString oldgroup config()->group(); | 94 | * QString oldgroup config()->group(); |
87 | * config()->setGroup( "TheGroupThatIWant" ); | 95 | * config()->setGroup( "TheGroupThatIWant" ); |
88 | * ... | 96 | * ... |
89 | * config()->writeEntry( "Blah", "Blubb" ); | 97 | * config()->writeEntry( "Blah", "Blubb" ); |
90 | * | 98 | * |
@@ -123,19 +131,24 @@ class OConfigGroupSaver | |||
123 | { _config->setGroup( group ); } | 131 | { _config->setGroup( group ); } |
124 | /** | 132 | /** |
125 | * Destructor. | 133 | * Destructor. |
126 | * Restores the last current group. | 134 | * Restores the last current group. |
127 | * @todo make it not inline for bc reasons. See KDE BC guide | 135 | * @todo make it not inline for bc reasons. See KDE BC guide |
128 | */ | 136 | */ |
129 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } | 137 | ~OConfigGroupSaver() { _config->setGroup( _oldgroup ); } |
130 | 138 | ||
131 | OConfig* config() { return _config; }; | 139 | OConfig* config() { return _config; }; |
132 | 140 | ||
133 | private: | 141 | private: |
134 | OConfig* _config; | 142 | OConfig* _config; |
135 | QString _oldgroup; | 143 | QString _oldgroup; |
136 | 144 | ||
137 | OConfigGroupSaver( const OConfigGroupSaver& ); | 145 | OConfigGroupSaver( const OConfigGroupSaver& ); |
138 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); | 146 | OConfigGroupSaver& operator=( const OConfigGroupSaver& ); |
147 | |||
148 | class Private; | ||
149 | Private *d; | ||
139 | }; | 150 | }; |
151 | } | ||
152 | } | ||
140 | 153 | ||
141 | #endif // OCONFIG_H | 154 | #endif // OCONFIG_H |
diff --git a/libopie2/opiecore/odebug.cpp b/libopie2/opiecore/odebug.cpp index a40ef53..cac985b 100644 --- a/libopie2/opiecore/odebug.cpp +++ b/libopie2/opiecore/odebug.cpp | |||
@@ -52,33 +52,34 @@ | |||
52 | #include <qsocketdevice.h> | 52 | #include <qsocketdevice.h> |
53 | 53 | ||
54 | /* UNIX */ | 54 | /* UNIX */ |
55 | 55 | ||
56 | #include <stdlib.h> // abort | 56 | #include <stdlib.h> // abort |
57 | #include <unistd.h> // getpid | 57 | #include <unistd.h> // getpid |
58 | #include <stdarg.h> // vararg stuff | 58 | #include <stdarg.h> // vararg stuff |
59 | #include <ctype.h> // isprint | 59 | #include <ctype.h> // isprint |
60 | #include <syslog.h> | 60 | #include <syslog.h> |
61 | #include <errno.h> | 61 | #include <errno.h> |
62 | #include <string.h> | 62 | #include <string.h> |
63 | 63 | ||
64 | #ifndef OPIE_NO_BACKTRACE | 64 | #ifndef OPIE_NO_BACKTRACE |
65 | #include <execinfo.h> | 65 | #include <execinfo.h> |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | 68 | namespace Opie { | |
69 | namespace Core { | ||
69 | /*====================================================================================== | 70 | /*====================================================================================== |
70 | * debug levels | 71 | * debug levels |
71 | *======================================================================================*/ | 72 | *======================================================================================*/ |
72 | 73 | ||
73 | enum DebugLevels { | 74 | enum DebugLevels { |
74 | ODEBUG_INFO = 0, | 75 | ODEBUG_INFO = 0, |
75 | ODEBUG_WARN = 1, | 76 | ODEBUG_WARN = 1, |
76 | ODEBUG_ERROR = 2, | 77 | ODEBUG_ERROR = 2, |
77 | ODEBUG_FATAL = 3 | 78 | ODEBUG_FATAL = 3 |
78 | }; | 79 | }; |
79 | 80 | ||
80 | /*====================================================================================== | 81 | /*====================================================================================== |
81 | * oDebug private data | 82 | * oDebug private data |
82 | *======================================================================================*/ | 83 | *======================================================================================*/ |
83 | 84 | ||
84 | /*====================================================================================== | 85 | /*====================================================================================== |
@@ -601,20 +602,24 @@ QString odBacktrace( int levels ) | |||
601 | QString::fromLatin1(": ") + | 602 | QString::fromLatin1(": ") + |
602 | QString::fromLatin1(strings[i]) + QString::fromLatin1("\n"); | 603 | QString::fromLatin1(strings[i]) + QString::fromLatin1("\n"); |
603 | s += "]\n"; | 604 | s += "]\n"; |
604 | free (strings); | 605 | free (strings); |
605 | #endif | 606 | #endif |
606 | return s; | 607 | return s; |
607 | } | 608 | } |
608 | 609 | ||
609 | void odClearDebugConfig() | 610 | void odClearDebugConfig() |
610 | { | 611 | { |
611 | /* | 612 | /* |
612 | delete oDebug_data->config; | 613 | delete oDebug_data->config; |
613 | oDebug_data->config = 0; | 614 | oDebug_data->config = 0; |
614 | */ | 615 | */ |
615 | } | 616 | } |
616 | 617 | ||
618 | |||
617 | #ifdef OPIE_NO_DEBUG | 619 | #ifdef OPIE_NO_DEBUG |
618 | #define odDebug ondDebug | 620 | #define odDebug ondDebug |
619 | #define odBacktrace ondBacktrace | 621 | #define odBacktrace ondBacktrace |
620 | #endif | 622 | #endif |
623 | |||
624 | } | ||
625 | } \ No newline at end of file | ||
diff --git a/libopie2/opiecore/odebug.h b/libopie2/opiecore/odebug.h index 85941fd..a5c9ded 100644 --- a/libopie2/opiecore/odebug.h +++ b/libopie2/opiecore/odebug.h | |||
@@ -34,32 +34,35 @@ | |||
34 | #define ODEBUG_H | 34 | #define ODEBUG_H |
35 | 35 | ||
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | 37 | ||
38 | class QWidget; | 38 | class QWidget; |
39 | class QDateTime; | 39 | class QDateTime; |
40 | class QDate; | 40 | class QDate; |
41 | class QTime; | 41 | class QTime; |
42 | class QPoint; | 42 | class QPoint; |
43 | class QSize; | 43 | class QSize; |
44 | class QRect; | 44 | class QRect; |
45 | class QRegion; | 45 | class QRegion; |
46 | class QStringList; | 46 | class QStringList; |
47 | class QColor; | 47 | class QColor; |
48 | class QBrush; | 48 | class QBrush; |
49 | 49 | ||
50 | namespace Opie { | ||
51 | namespace Core { | ||
52 | |||
50 | class odbgstream; | 53 | class odbgstream; |
51 | class ondbgstream; | 54 | class ondbgstream; |
52 | 55 | ||
53 | #ifdef __GNUC__ | 56 | #ifdef __GNUC__ |
54 | #define o_funcinfo "[" << __PRETTY_FUNCTION__ << "] " | 57 | #define o_funcinfo "[" << __PRETTY_FUNCTION__ << "] " |
55 | #else | 58 | #else |
56 | #define o_funcinfo "[" << __FILE__ << ":" << __LINE__ << "] " | 59 | #define o_funcinfo "[" << __FILE__ << ":" << __LINE__ << "] " |
57 | #endif | 60 | #endif |
58 | 61 | ||
59 | #define o_lineinfo "[" << __FILE__ << ":" << __LINE__ << "] " | 62 | #define o_lineinfo "[" << __FILE__ << ":" << __LINE__ << "] " |
60 | 63 | ||
61 | #define owarn odWarning() | 64 | #define owarn odWarning() |
62 | #define oerr odError() | 65 | #define oerr odError() |
63 | #define odebug odDebug() | 66 | #define odebug odDebug() |
64 | #define ofatal odFatal() | 67 | #define ofatal odFatal() |
65 | #define oendl "\n" | 68 | #define oendl "\n" |
@@ -381,32 +384,36 @@ class ondbgstream { | |||
381 | /** | 384 | /** |
382 | * Does nothing. | 385 | * Does nothing. |
383 | * @return this stream | 386 | * @return this stream |
384 | */ | 387 | */ |
385 | ondbgstream &form(const char *, ...) { return *this; } | 388 | ondbgstream &form(const char *, ...) { return *this; } |
386 | 389 | ||
387 | ondbgstream& operator<<( const QDateTime& ) { return *this; } | 390 | ondbgstream& operator<<( const QDateTime& ) { return *this; } |
388 | ondbgstream& operator<<( const QDate& ) { return *this; } | 391 | ondbgstream& operator<<( const QDate& ) { return *this; } |
389 | ondbgstream& operator<<( const QTime& ) { return *this; } | 392 | ondbgstream& operator<<( const QTime& ) { return *this; } |
390 | ondbgstream& operator<<( const QPoint & ) { return *this; } | 393 | ondbgstream& operator<<( const QPoint & ) { return *this; } |
391 | ondbgstream& operator<<( const QSize & ) { return *this; } | 394 | ondbgstream& operator<<( const QSize & ) { return *this; } |
392 | ondbgstream& operator<<( const QRect & ) { return *this; } | 395 | ondbgstream& operator<<( const QRect & ) { return *this; } |
393 | ondbgstream& operator<<( const QRegion & ) { return *this; } | 396 | ondbgstream& operator<<( const QRegion & ) { return *this; } |
394 | ondbgstream& operator<<( const QStringList & ) { return *this; } | 397 | ondbgstream& operator<<( const QStringList & ) { return *this; } |
395 | ondbgstream& operator<<( const QColor & ) { return *this; } | 398 | ondbgstream& operator<<( const QColor & ) { return *this; } |
396 | ondbgstream& operator<<( const QBrush & ) { return *this; } | 399 | ondbgstream& operator<<( const QBrush & ) { return *this; } |
400 | |||
401 | private: | ||
402 | class Private; | ||
403 | Private *d; | ||
397 | }; | 404 | }; |
398 | 405 | ||
399 | /*====================================================================================== | 406 | /*====================================================================================== |
400 | * related functions | 407 | * related functions |
401 | *======================================================================================*/ | 408 | *======================================================================================*/ |
402 | 409 | ||
403 | /** | 410 | /** |
404 | * Does nothing. | 411 | * Does nothing. |
405 | * @param a stream | 412 | * @param a stream |
406 | * @return the given @p s | 413 | * @return the given @p s |
407 | */ | 414 | */ |
408 | inline ondbgstream& endl( ondbgstream & s) { return s; } | 415 | inline ondbgstream& endl( ondbgstream & s) { return s; } |
409 | /** | 416 | /** |
410 | * Does nothing. | 417 | * Does nothing. |
411 | * @param a stream | 418 | * @param a stream |
412 | * @return the given @p s | 419 | * @return the given @p s |
@@ -459,16 +466,18 @@ odbgstream odError(bool cond, int area = 0); | |||
459 | odbgstream odFatal(int area = 0); | 466 | odbgstream odFatal(int area = 0); |
460 | odbgstream odFatal(bool cond, int area = 0); | 467 | odbgstream odFatal(bool cond, int area = 0); |
461 | 468 | ||
462 | /** | 469 | /** |
463 | * Deletes the odebugrc cache and therefore forces KDebug to reread the | 470 | * Deletes the odebugrc cache and therefore forces KDebug to reread the |
464 | * config file | 471 | * config file |
465 | */ | 472 | */ |
466 | void odClearDebugConfig(); | 473 | void odClearDebugConfig(); |
467 | 474 | ||
468 | #ifdef OPIE_NO_DEBUG | 475 | #ifdef OPIE_NO_DEBUG |
469 | #define odDebug ondDebug | 476 | #define odDebug ondDebug |
470 | #define odBacktrace ondBacktrace | 477 | #define odBacktrace ondBacktrace |
471 | #endif | 478 | #endif |
472 | 479 | ||
473 | #endif | 480 | #endif |
474 | 481 | ||
482 | } | ||
483 | } | ||
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp index 1aa206e..ea02058 100644 --- a/libopie2/opiecore/oglobal.cpp +++ b/libopie2/opiecore/oglobal.cpp | |||
@@ -25,32 +25,34 @@ | |||
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <opie2/oglobal.h> | 30 | #include <opie2/oglobal.h> |
31 | 31 | ||
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qdir.h> | 33 | #include <qdir.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
37 | 37 | ||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | 40 | ||
41 | using namespace Opie::Core; | ||
42 | |||
41 | static const char Base64EncMap[64] = | 43 | static const char Base64EncMap[64] = |
42 | { | 44 | { |
43 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, | 45 | 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, |
44 | 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, | 46 | 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, |
45 | 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | 47 | 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, |
46 | 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, | 48 | 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, |
47 | 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, | 49 | 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, |
48 | 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, | 50 | 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, |
49 | 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, | 51 | 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, |
50 | 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F | 52 | 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F |
51 | }; | 53 | }; |
52 | 54 | ||
53 | static char Base64DecMap[128] = | 55 | static char Base64DecMap[128] = |
54 | { | 56 | { |
55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -299,44 +301,44 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) { | |||
299 | 301 | ||
300 | if (didx < len) | 302 | if (didx < len) |
301 | out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003)); | 303 | out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003)); |
302 | 304 | ||
303 | if (++didx < len ) | 305 | if (++didx < len ) |
304 | out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); | 306 | out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); |
305 | 307 | ||
306 | // Resize the output buffer | 308 | // Resize the output buffer |
307 | if ( len == 0 || len < out.size() ) | 309 | if ( len == 0 || len < out.size() ) |
308 | out.resize(len); | 310 | out.resize(len); |
309 | 311 | ||
310 | return out; | 312 | return out; |
311 | } | 313 | } |
312 | 314 | ||
313 | bool OGlobal::isAppLnkFileName( const QString& str ) | 315 | bool OGlobal::isAppLnkFileName( const QString& str ) |
314 | { | 316 | { |
315 | if (str.length()==0||str.at(str.length()-1)==QDir::separator()) return false; | 317 | if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false; |
316 | return str.startsWith(MimeType::appsFolderName()+QDir::separator()); | 318 | return str.startsWith(MimeType::appsFolderName()+QDir::separator()); |
317 | } | 319 | } |
318 | 320 | ||
319 | /* ToDo: | 321 | /* ToDo: |
320 | * This fun should check the document-path value for the mounted media | 322 | * This fun should check the document-path value for the mounted media |
321 | * which has to be implemented later. this moment we just check for a | 323 | * which has to be implemented later. this moment we just check for a |
322 | * mounted media name. | 324 | * mounted media name. |
323 | */ | 325 | */ |
324 | bool OGlobal::isDocumentFileName( const QString& file ) | 326 | bool OGlobal::isDocumentFileName( const QString& file ) |
325 | { | 327 | { |
326 | if (file.length()==0||file.at(file.length()-1)==QDir::separator()) return false; | 328 | if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false; |
327 | if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; | 329 | if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; |
328 | StorageInfo si; | 330 | StorageInfo si; |
329 | QList< FileSystem > fl = si.fileSystems(); | 331 | QList< FileSystem > fl = si.fileSystems(); |
330 | FileSystem*fs; | 332 | FileSystem*fs; |
331 | for (fs = fl.first();fs!=0;fs=fl.next()) { | 333 | for (fs = fl.first();fs!=0;fs=fl.next()) { |
332 | if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) | 334 | if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) |
333 | return true; | 335 | return true; |
334 | } | 336 | } |
335 | if (file.startsWith(homeDirPath())+"/Documents/") return true; | 337 | if (file.startsWith(homeDirPath())+"/Documents/") return true; |
336 | return false; | 338 | return false; |
337 | } | 339 | } |
338 | 340 | ||
339 | QString OGlobal::tempDirPath() | 341 | QString OGlobal::tempDirPath() |
340 | { | 342 | { |
341 | static QString defstring="/tmp"; | 343 | static QString defstring="/tmp"; |
342 | char * tmpp = 0; | 344 | char * tmpp = 0; |
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 | |||
@@ -39,32 +39,37 @@ | |||
39 | #endif | 39 | #endif |
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | #ifdef HACK_DEFINED | 41 | #ifdef HACK_DEFINED |
42 | #undef private | 42 | #undef private |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
46 | 46 | ||
47 | //FIXME Is it wise or even necessary to inherit OGlobal from Global? | 47 | //FIXME Is it wise or even necessary to inherit OGlobal from Global? |
48 | // once we totally skip libqpe it should ideally swallow Global -zecke | 48 | // once we totally skip libqpe it should ideally swallow Global -zecke |
49 | // You're right. I deleted global as the base class. -mickeyl | 49 | // You're right. I deleted global as the base class. -mickeyl |
50 | 50 | ||
51 | 51 | ||
52 | class QFile; | 52 | class QFile; |
53 | class QString; | 53 | class QString; |
54 | class DateFormat; | 54 | class DateFormat; |
55 | |||
56 | |||
57 | |||
58 | namespace Opie { | ||
59 | namespace Core { | ||
55 | /** | 60 | /** |
56 | *\brief OGlobal contains a list of generic functions | 61 | *\brief OGlobal contains a list of generic functions |
57 | * | 62 | * |
58 | * The class OGlobal contains small utility functions | 63 | * The class OGlobal contains small utility functions |
59 | * which might be useful for other applications to use. It features access | 64 | * which might be useful for other applications to use. It features access |
60 | * to the global device config and specialized functions to get information | 65 | * to the global device config and specialized functions to get information |
61 | * out of this config like Weekstart or Owner name. | 66 | * out of this config like Weekstart or Owner name. |
62 | * | 67 | * |
63 | * @todo ODP implement the things from Global which are good | 68 | * @todo ODP implement the things from Global which are good |
64 | * @author mickey,alwin,zecke | 69 | * @author mickey,alwin,zecke |
65 | * @version 0.1 | 70 | * @version 0.1 |
66 | */ | 71 | */ |
67 | class OGlobal : public Global | 72 | class OGlobal : public Global |
68 | { | 73 | { |
69 | public: | 74 | public: |
70 | 75 | ||
@@ -133,19 +138,22 @@ public: | |||
133 | static DateFormat dateFormat(); | 138 | static DateFormat dateFormat(); |
134 | static void setDateFormat( const DateFormat& ); | 139 | static void setDateFormat( const DateFormat& ); |
135 | 140 | ||
136 | 141 | ||
137 | static void setWeekStartsOnMonday( bool ); | 142 | static void setWeekStartsOnMonday( bool ); |
138 | static void setUseAMPM( bool ); | 143 | static void setUseAMPM( bool ); |
139 | //@} | 144 | //@} |
140 | 145 | ||
141 | //@{ | 146 | //@{ |
142 | static Global::Command* builtinCommands(); | 147 | static Global::Command* builtinCommands(); |
143 | static QGuardedPtr<QWidget>* builtinRunning(); | 148 | static QGuardedPtr<QWidget>* builtinRunning(); |
144 | //@} | 149 | //@} |
145 | 150 | ||
146 | private: | 151 | private: |
147 | static OConfig* _config; | 152 | static OConfig* _config; |
148 | static OConfig* _qpe_config; | 153 | static OConfig* _qpe_config; |
154 | class Private; | ||
155 | Private *d; | ||
149 | }; | 156 | }; |
150 | 157 | } | |
158 | } | ||
151 | #endif // OGLOBAL_H | 159 | #endif // OGLOBAL_H |
diff --git a/libopie2/opiecore/oglobalsettings.cpp b/libopie2/opiecore/oglobalsettings.cpp index 192e55b..f34c531 100644 --- a/libopie2/opiecore/oglobalsettings.cpp +++ b/libopie2/opiecore/oglobalsettings.cpp | |||
@@ -31,32 +31,35 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | 34 | ||
35 | #include <opie2/oglobalsettings.h> | 35 | #include <opie2/oglobalsettings.h> |
36 | #include <opie2/oconfig.h> | 36 | #include <opie2/oconfig.h> |
37 | #include <opie2/oglobal.h> | 37 | #include <opie2/oglobal.h> |
38 | 38 | ||
39 | /* QT */ | 39 | /* QT */ |
40 | 40 | ||
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | 42 | ||
43 | /* UNIX */ | 43 | /* UNIX */ |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | |||
48 | using namespace Opie::Core; | ||
49 | |||
47 | QString* OGlobalSettings::s_desktopPath = 0; | 50 | QString* OGlobalSettings::s_desktopPath = 0; |
48 | QString* OGlobalSettings::s_autostartPath = 0; | 51 | QString* OGlobalSettings::s_autostartPath = 0; |
49 | QString* OGlobalSettings::s_trashPath = 0; | 52 | QString* OGlobalSettings::s_trashPath = 0; |
50 | QString* OGlobalSettings::s_documentPath = 0; | 53 | QString* OGlobalSettings::s_documentPath = 0; |
51 | QFont *OGlobalSettings::_generalFont = 0; | 54 | QFont *OGlobalSettings::_generalFont = 0; |
52 | QFont *OGlobalSettings::_fixedFont = 0; | 55 | QFont *OGlobalSettings::_fixedFont = 0; |
53 | QFont *OGlobalSettings::_toolBarFont = 0; | 56 | QFont *OGlobalSettings::_toolBarFont = 0; |
54 | QFont *OGlobalSettings::_menuFont = 0; | 57 | QFont *OGlobalSettings::_menuFont = 0; |
55 | QFont *OGlobalSettings::_windowTitleFont = 0; | 58 | QFont *OGlobalSettings::_windowTitleFont = 0; |
56 | QFont *OGlobalSettings::_taskbarFont = 0; | 59 | QFont *OGlobalSettings::_taskbarFont = 0; |
57 | 60 | ||
58 | QColor *OGlobalSettings::OpieGray = 0; | 61 | QColor *OGlobalSettings::OpieGray = 0; |
59 | QColor *OGlobalSettings::OpieHighlight = 0; | 62 | QColor *OGlobalSettings::OpieHighlight = 0; |
60 | QColor *OGlobalSettings::OpieAlternate = 0; | 63 | QColor *OGlobalSettings::OpieAlternate = 0; |
61 | 64 | ||
62 | OGlobalSettings::OMouseSettings *OGlobalSettings::s_mouseSettings = 0; | 65 | OGlobalSettings::OMouseSettings *OGlobalSettings::s_mouseSettings = 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 | |||
@@ -23,45 +23,51 @@ | |||
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 OGLOBALSETTINGS_H | 32 | #ifndef OGLOBALSETTINGS_H |
33 | #define OGLOBALSETTINGS_H | 33 | #define OGLOBALSETTINGS_H |
34 | 34 | ||
35 | #include <qstring.h> | 35 | #include <qstring.h> |
36 | #include <qcolor.h> | 36 | #include <qcolor.h> |
37 | #include <qfont.h> | 37 | #include <qfont.h> |
38 | 38 | ||
39 | /** | ||
40 | * \todo make real const values | ||
41 | */ | ||
39 | #define OPIE_DEFAULT_SINGLECLICK true | 42 | #define OPIE_DEFAULT_SINGLECLICK true |
40 | #define OPIE_DEFAULT_INSERTTEAROFFHANDLES true | 43 | #define OPIE_DEFAULT_INSERTTEAROFFHANDLES true |
41 | #define OPIE_DEFAULT_AUTOSELECTDELAY -1 | 44 | #define OPIE_DEFAULT_AUTOSELECTDELAY -1 |
42 | #define OPIE_DEFAULT_CHANGECURSOR true | 45 | #define OPIE_DEFAULT_CHANGECURSOR true |
43 | #define OPIE_DEFAULT_LARGE_CURSOR false | 46 | #define OPIE_DEFAULT_LARGE_CURSOR false |
44 | #define OPIE_DEFAULT_VISUAL_ACTIVATE true | 47 | #define OPIE_DEFAULT_VISUAL_ACTIVATE true |
45 | #define OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED 50 | 48 | #define OPIE_DEFAULT_VISUAL_ACTIVATE_SPEED 50 |
46 | 49 | ||
47 | //FIXME: There's still a whole lot of stuff in here which has to be revised | 50 | //FIXME: There's still a whole lot of stuff in here which has to be revised |
48 | //FIXME: before public usage... lack of time to do it at once - so it will | 51 | //FIXME: before public usage... lack of time to do it at once - so it will |
49 | //FIXME: happen step-by-step. ML. | 52 | //FIXME: happen step-by-step. ML. |
50 | // we should not habe too much configure options!!!!!! -zecke | 53 | // we should not habe too much configure options!!!!!! -zecke |
51 | 54 | ||
55 | namespace Opie { | ||
56 | namespace Core { | ||
57 | |||
52 | /** | 58 | /** |
53 | * Access the OPIE global configuration settings. | 59 | * Access the OPIE global configuration settings. |
54 | * | 60 | * |
55 | */ | 61 | */ |
56 | class OGlobalSettings | 62 | class OGlobalSettings |
57 | { | 63 | { |
58 | public: | 64 | public: |
59 | 65 | ||
60 | /** | 66 | /** |
61 | * Returns a threshold in pixels for drag & drop operations. | 67 | * Returns a threshold in pixels for drag & drop operations. |
62 | * As long as the mouse movement has not exceeded this number | 68 | * As long as the mouse movement has not exceeded this number |
63 | * of pixels in either X or Y direction no drag operation may | 69 | * of pixels in either X or Y direction no drag operation may |
64 | * be started. This prevents spurious drags when the user intended | 70 | * be started. This prevents spurious drags when the user intended |
65 | * to click on something but moved the mouse a bit while doing so. | 71 | * to click on something but moved the mouse a bit while doing so. |
66 | * | 72 | * |
67 | * For this to work you must save the position of the mouse (oldPos) | 73 | * For this to work you must save the position of the mouse (oldPos) |
@@ -355,19 +361,25 @@ private: | |||
355 | static QFont *_fixedFont; | 361 | static QFont *_fixedFont; |
356 | static QFont *_toolBarFont; | 362 | static QFont *_toolBarFont; |
357 | static QFont *_menuFont; | 363 | static QFont *_menuFont; |
358 | static QFont *_windowTitleFont; | 364 | static QFont *_windowTitleFont; |
359 | static QFont *_taskbarFont; | 365 | static QFont *_taskbarFont; |
360 | static QColor * kde2Gray; | 366 | static QColor * kde2Gray; |
361 | static QColor * kde2Blue; | 367 | static QColor * kde2Blue; |
362 | static QColor * kde2AlternateColor; | 368 | static QColor * kde2AlternateColor; |
363 | static OMouseSettings *s_mouseSettings; | 369 | static OMouseSettings *s_mouseSettings; |
364 | 370 | ||
365 | static QColor * OpieGray; | 371 | static QColor * OpieGray; |
366 | static QColor * OpieBlue; | 372 | static QColor * OpieBlue; |
367 | static QColor * OpieAlternate; | 373 | static QColor * OpieAlternate; |
368 | static QColor * OpieHighlight; | 374 | static QColor * OpieHighlight; |
369 | 375 | ||
370 | friend class OApplication; | 376 | friend class OApplication; |
377 | private: | ||
378 | class Private; | ||
379 | Private *d; | ||
371 | }; | 380 | }; |
372 | 381 | ||
382 | } | ||
383 | } | ||
384 | |||
373 | #endif | 385 | #endif |
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro index 523d6a7..ff3c036 100644 --- a/libopie2/opiecore/opiecore.pro +++ b/libopie2/opiecore/opiecore.pro | |||
@@ -1,41 +1,39 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = oapplication.h \ | 4 | HEADERS = oapplication.h \ |
5 | oconfig.h \ | 5 | oconfig.h \ |
6 | odebug.h \ | 6 | odebug.h \ |
7 | oglobal.h \ | 7 | oglobal.h \ |
8 | oglobalsettings.h \ | 8 | oglobalsettings.h \ |
9 | oprocess.h \ | 9 | oprocess.h \ |
10 | oprocctrl.h \ | 10 | oprocctrl.h \ |
11 | osmartpointer.h \ | 11 | osmartpointer.h \ |
12 | ostorageinfo.h \ | 12 | ostorageinfo.h |
13 | xmltree.h | ||
14 | 13 | ||
15 | SOURCES = oapplication.cpp \ | 14 | SOURCES = oapplication.cpp \ |
16 | oconfig.cpp \ | 15 | oconfig.cpp \ |
17 | odebug.cpp \ | 16 | odebug.cpp \ |
18 | oglobal.cpp \ | 17 | oglobal.cpp \ |
19 | oglobalsettings.cpp \ | 18 | oglobalsettings.cpp \ |
20 | oprocess.cpp \ | 19 | oprocess.cpp \ |
21 | oprocctrl.cpp \ | 20 | oprocctrl.cpp \ |
22 | ostorageinfo.cpp \ | 21 | ostorageinfo.cpp |
23 | xmltree.cc | ||
24 | 22 | ||
25 | include ( device/device.pro ) | 23 | include ( device/device.pro ) |
26 | 24 | ||
27 | INTERFACES = | 25 | INTERFACES = |
28 | TARGET = opiecore2 | 26 | TARGET = opiecore2 |
29 | VERSION = 1.8.5 | 27 | VERSION = 1.9.0 |
30 | INCLUDEPATH += $(OPIEDIR)/include | 28 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH += $(OPIEDIR)/include | 29 | DEPENDPATH += $(OPIEDIR)/include |
32 | 30 | ||
33 | !contains( platform, x11 ) { | 31 | !contains( platform, x11 ) { |
34 | LIBS = -lqpe | 32 | LIBS = -lqpe |
35 | include ( $(OPIEDIR)/include.pro ) | 33 | include ( $(OPIEDIR)/include.pro ) |
36 | } | 34 | } |
37 | 35 | ||
38 | contains( platform, x11 ) { | 36 | contains( platform, x11 ) { |
39 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 37 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
40 | } | 38 | } |
41 | 39 | ||
diff --git a/libopie2/opiecore/oprocctrl.cpp b/libopie2/opiecore/oprocctrl.cpp index 0403526..46708ba 100644 --- a/libopie2/opiecore/oprocctrl.cpp +++ b/libopie2/opiecore/oprocctrl.cpp | |||
@@ -28,32 +28,34 @@ | |||
28 | 28 | ||
29 | //#include <config.h> | 29 | //#include <config.h> |
30 | 30 | ||
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | #include <sys/socket.h> | 32 | #include <sys/socket.h> |
33 | 33 | ||
34 | #include <errno.h> | 34 | #include <errno.h> |
35 | #include <fcntl.h> | 35 | #include <fcntl.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <assert.h> | 39 | #include <assert.h> |
40 | 40 | ||
41 | #include <qsocketnotifier.h> | 41 | #include <qsocketnotifier.h> |
42 | #include "oprocctrl.h" | 42 | #include "oprocctrl.h" |
43 | 43 | ||
44 | using namespace Opie::Core::Private; | ||
45 | |||
44 | OProcessController *OProcessController::theOProcessController = 0; | 46 | OProcessController *OProcessController::theOProcessController = 0; |
45 | 47 | ||
46 | struct sigaction OProcessController::oldChildHandlerData; | 48 | struct sigaction OProcessController::oldChildHandlerData; |
47 | bool OProcessController::handlerSet = false; | 49 | bool OProcessController::handlerSet = false; |
48 | 50 | ||
49 | OProcessController::OProcessController() | 51 | OProcessController::OProcessController() |
50 | { | 52 | { |
51 | assert( theOProcessController == 0 ); | 53 | assert( theOProcessController == 0 ); |
52 | 54 | ||
53 | if (0 > pipe(fd)) | 55 | if (0 > pipe(fd)) |
54 | printf(strerror(errno)); | 56 | printf(strerror(errno)); |
55 | 57 | ||
56 | notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read); | 58 | notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read); |
57 | notifier->setEnabled(true); | 59 | notifier->setEnabled(true); |
58 | QObject::connect(notifier, SIGNAL(activated(int)), | 60 | QObject::connect(notifier, SIGNAL(activated(int)), |
59 | this, SLOT(slotDoHousekeeping(int))); | 61 | this, SLOT(slotDoHousekeeping(int))); |
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 | |||
@@ -21,35 +21,40 @@ | |||
21 | // | 21 | // |
22 | // version 0.3.1, Jan 8th 1997 | 22 | // version 0.3.1, Jan 8th 1997 |
23 | // | 23 | // |
24 | // (C) Christian Czezatke | 24 | // (C) Christian Czezatke |
25 | // e9025461@student.tuwien.ac.at | 25 | // e9025461@student.tuwien.ac.at |
26 | // Ported by Holger Freyther | 26 | // Ported by Holger Freyther |
27 | // | 27 | // |
28 | 28 | ||
29 | #ifndef __KPROCCTRL_H__ | 29 | #ifndef __KPROCCTRL_H__ |
30 | #define __KPROCCTRL_H__ | 30 | #define __KPROCCTRL_H__ |
31 | 31 | ||
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | 34 | ||
35 | #include "oprocess.h" | 35 | #include "oprocess.h" |
36 | 36 | ||
37 | class OProcessControllerPrivate; | ||
38 | class QSocketNotifier; | 37 | class QSocketNotifier; |
39 | 38 | ||
39 | |||
40 | namespace Opie { | ||
41 | namespace Core { | ||
42 | namespace Private { | ||
43 | class OProcessControllerPrivate; | ||
44 | |||
40 | /** | 45 | /** |
41 | * @short Used internally by @ref OProcess | 46 | * @short Used internally by @ref OProcess |
42 | * @internal | 47 | * @internal |
43 | * @author Christian Czezakte <e9025461@student.tuwien.ac.at> | 48 | * @author Christian Czezakte <e9025461@student.tuwien.ac.at> |
44 | * | 49 | * |
45 | * A class for internal use by OProcess only. -- Exactly one instance | 50 | * A class for internal use by OProcess only. -- Exactly one instance |
46 | * of this class is generated by the first instance of OProcess that is | 51 | * of this class is generated by the first instance of OProcess that is |
47 | * created (a pointer to it gets stored in @ref theOProcessController ). | 52 | * created (a pointer to it gets stored in @ref theOProcessController ). |
48 | * | 53 | * |
49 | * This class takes care of the actual (UN*X) signal handling. | 54 | * This class takes care of the actual (UN*X) signal handling. |
50 | */ | 55 | */ |
51 | class OProcessController : public QObject | 56 | class OProcessController : public QObject |
52 | { | 57 | { |
53 | Q_OBJECT | 58 | Q_OBJECT |
54 | 59 | ||
55 | public: | 60 | public: |
@@ -102,20 +107,23 @@ private slots: | |||
102 | void delayedChildrenCleanup(); | 107 | void delayedChildrenCleanup(); |
103 | private: | 108 | private: |
104 | int fd[2]; | 109 | int fd[2]; |
105 | QSocketNotifier *notifier; | 110 | QSocketNotifier *notifier; |
106 | static struct sigaction oldChildHandlerData; | 111 | static struct sigaction oldChildHandlerData; |
107 | static bool handlerSet; | 112 | static bool handlerSet; |
108 | QValueList<OProcess*> processList; | 113 | QValueList<OProcess*> processList; |
109 | QTimer delayedChildrenCleanupTimer; | 114 | QTimer delayedChildrenCleanupTimer; |
110 | 115 | ||
111 | // Disallow assignment and copy-construction | 116 | // Disallow assignment and copy-construction |
112 | OProcessController( const OProcessController& ); | 117 | OProcessController( const OProcessController& ); |
113 | OProcessController& operator= ( const OProcessController& ); | 118 | OProcessController& operator= ( const OProcessController& ); |
114 | 119 | ||
115 | OProcessControllerPrivate *d; | 120 | OProcessControllerPrivate *d; |
116 | }; | 121 | }; |
117 | 122 | ||
123 | } | ||
124 | } | ||
125 | } | ||
118 | 126 | ||
119 | 127 | ||
120 | #endif | 128 | #endif |
121 | 129 | ||
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp index 6349c83..dfde74a 100644 --- a/libopie2/opiecore/oprocess.cpp +++ b/libopie2/opiecore/oprocess.cpp | |||
@@ -48,44 +48,49 @@ _;:, .> :=|. This program is free software; you can | |||
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <signal.h> | 49 | #include <signal.h> |
50 | #include <stdio.h> | 50 | #include <stdio.h> |
51 | #include <string.h> | 51 | #include <string.h> |
52 | #include <sys/time.h> | 52 | #include <sys/time.h> |
53 | #include <sys/types.h> | 53 | #include <sys/types.h> |
54 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
55 | #include <sys/socket.h> | 55 | #include <sys/socket.h> |
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #ifdef HAVE_SYS_SELECT_H | 57 | #ifdef HAVE_SYS_SELECT_H |
58 | #include <sys/select.h> | 58 | #include <sys/select.h> |
59 | #endif | 59 | #endif |
60 | #ifdef HAVE_INITGROUPS | 60 | #ifdef HAVE_INITGROUPS |
61 | #include <grp.h> | 61 | #include <grp.h> |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | using namespace Opie::Core::Private; | ||
65 | |||
66 | namespace Opie { | ||
67 | namespace Core { | ||
68 | namespace Private { | ||
64 | class OProcessPrivate | 69 | class OProcessPrivate |
65 | { | 70 | { |
66 | public: | 71 | public: |
67 | OProcessPrivate() : useShell( false ) | 72 | OProcessPrivate() : useShell( false ) |
68 | { } | 73 | { } |
69 | 74 | ||
70 | bool useShell; | 75 | bool useShell; |
71 | QMap<QString, QString> env; | 76 | QMap<QString, QString> env; |
72 | QString wd; | 77 | QString wd; |
73 | QCString shell; | 78 | QCString shell; |
74 | }; | 79 | }; |
75 | 80 | } | |
76 | 81 | ||
77 | OProcess::OProcess( QObject *parent, const char *name ) | 82 | OProcess::OProcess( QObject *parent, const char *name ) |
78 | : QObject( parent, name ) | 83 | : QObject( parent, name ) |
79 | { | 84 | { |
80 | init ( ); | 85 | init ( ); |
81 | } | 86 | } |
82 | 87 | ||
83 | OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) | 88 | OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) |
84 | : QObject( parent, name ) | 89 | : QObject( parent, name ) |
85 | { | 90 | { |
86 | init ( ); | 91 | init ( ); |
87 | *this << arg0; | 92 | *this << arg0; |
88 | } | 93 | } |
89 | 94 | ||
90 | OProcess::OProcess( const QStringList &args, QObject *parent, const char *name ) | 95 | OProcess::OProcess( const QStringList &args, QObject *parent, const char *name ) |
91 | : QObject( parent, name ) | 96 | : QObject( parent, name ) |
@@ -928,16 +933,19 @@ int OProcess::processPID( const QString& process ) | |||
928 | QTextStream t( &file ); | 933 | QTextStream t( &file ); |
929 | line = t.readLine(); | 934 | line = t.readLine(); |
930 | //qDebug( "cmdline = %s", (const char*) line ); | 935 | //qDebug( "cmdline = %s", (const char*) line ); |
931 | if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;) | 936 | if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;) |
932 | } | 937 | } |
933 | if ( line.contains( process ) ) | 938 | if ( line.contains( process ) ) |
934 | { | 939 | { |
935 | //qDebug( "found process id #%d", (*it).toInt() ); | 940 | //qDebug( "found process id #%d", (*it).toInt() ); |
936 | return (*it).toInt(); | 941 | return (*it).toInt(); |
937 | } | 942 | } |
938 | else | 943 | else |
939 | { | 944 | { |
940 | //qDebug( "process '%s' not found", (const char*) process ); | 945 | //qDebug( "process '%s' not found", (const char*) process ); |
941 | return 0; | 946 | return 0; |
942 | } | 947 | } |
943 | } | 948 | } |
949 | |||
950 | } | ||
951 | } | ||
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index 1a2472d..eb56b03 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h | |||
@@ -30,33 +30,39 @@ _;:, .> :=|. This program is free software; you can | |||
30 | 30 | ||
31 | #ifndef OPROCESS_H | 31 | #ifndef OPROCESS_H |
32 | #define OPROCESS_H | 32 | #define OPROCESS_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qcstring.h> | 35 | #include <qcstring.h> |
36 | #include <qobject.h> | 36 | #include <qobject.h> |
37 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
38 | 38 | ||
39 | /* STD */ | 39 | /* STD */ |
40 | #include <sys/types.h> // for pid_t | 40 | #include <sys/types.h> // for pid_t |
41 | #include <sys/wait.h> | 41 | #include <sys/wait.h> |
42 | #include <signal.h> | 42 | #include <signal.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | 44 | ||
45 | class QSocketNotifier; | 45 | class QSocketNotifier; |
46 | |||
47 | namespace Opie { | ||
48 | namespace Core { | ||
49 | namespace Private { | ||
50 | class OProcessController; | ||
46 | class OProcessPrivate; | 51 | class OProcessPrivate; |
52 | } | ||
47 | 53 | ||
48 | /** | 54 | /** |
49 | * Child process invocation, monitoring and control. | 55 | * Child process invocation, monitoring and control. |
50 | * | 56 | * |
51 | * @sect General usage and features | 57 | * @sect General usage and features |
52 | * | 58 | * |
53 | *This class allows a KDE and OPIE application to start child processes without having | 59 | *This class allows a KDE and OPIE application to start child processes without having |
54 | *to worry about UN*X signal handling issues and zombie process reaping. | 60 | *to worry about UN*X signal handling issues and zombie process reaping. |
55 | * | 61 | * |
56 | *@see KProcIO | 62 | *@see KProcIO |
57 | * | 63 | * |
58 | *Basically, this class distinguishes three different ways of running | 64 | *Basically, this class distinguishes three different ways of running |
59 | *child processes: | 65 | *child processes: |
60 | * | 66 | * |
61 | *@li OProcess::DontCare -- The child process is invoked and both the child | 67 | *@li OProcess::DontCare -- The child process is invoked and both the child |
62 | *process and the parent process continue concurrently. | 68 | *process and the parent process continue concurrently. |
@@ -384,32 +390,33 @@ public: | |||
384 | * @return @p false if no communication to the process's stdout | 390 | * @return @p false if no communication to the process's stdout |
385 | * had been specified in the call to @ref start(). | 391 | * had been specified in the call to @ref start(). |
386 | */ | 392 | */ |
387 | bool closeStdout(); | 393 | bool closeStdout(); |
388 | 394 | ||
389 | /** | 395 | /** |
390 | * This causes the stderr file descriptor of the child process to be | 396 | * This causes the stderr file descriptor of the child process to be |
391 | * closed. | 397 | * closed. |
392 | * | 398 | * |
393 | * @return @p false if no communication to the process's stderr | 399 | * @return @p false if no communication to the process's stderr |
394 | * had been specified in the call to @ref start(). | 400 | * had been specified in the call to @ref start(). |
395 | */ | 401 | */ |
396 | bool closeStderr(); | 402 | bool closeStderr(); |
397 | 403 | ||
398 | /** | 404 | /** |
399 | * Lets you see what your arguments are for debugging. | 405 | * Lets you see what your arguments are for debugging. |
406 | * \todo make const | ||
400 | */ | 407 | */ |
401 | 408 | ||
402 | const QValueList<QCString> &args() | 409 | const QValueList<QCString> &args() |
403 | { | 410 | { |
404 | return arguments; | 411 | return arguments; |
405 | } | 412 | } |
406 | 413 | ||
407 | /** | 414 | /** |
408 | * Controls whether the started process should drop any | 415 | * Controls whether the started process should drop any |
409 | * setuid/segid privileges or whether it should keep them | 416 | * setuid/segid privileges or whether it should keep them |
410 | * | 417 | * |
411 | * The default is @p false : drop privileges | 418 | * The default is @p false : drop privileges |
412 | */ | 419 | */ |
413 | void setRunPrivileged( bool keepPrivileges ); | 420 | void setRunPrivileged( bool keepPrivileges ); |
414 | 421 | ||
415 | /** | 422 | /** |
@@ -703,50 +710,52 @@ protected: | |||
703 | * Called by "slotChildOutput" this function copies data arriving from the | 710 | * Called by "slotChildOutput" this function copies data arriving from the |
704 | * child process's stdout to the respective buffer and emits the signal | 711 | * child process's stdout to the respective buffer and emits the signal |
705 | * "@ref receivedStderr" | 712 | * "@ref receivedStderr" |
706 | */ | 713 | */ |
707 | int childError( int fdno ); | 714 | int childError( int fdno ); |
708 | 715 | ||
709 | // information about the data that has to be sent to the child: | 716 | // information about the data that has to be sent to the child: |
710 | 717 | ||
711 | const char *input_data; // the buffer holding the data | 718 | const char *input_data; // the buffer holding the data |
712 | int input_sent; // # of bytes already transmitted | 719 | int input_sent; // # of bytes already transmitted |
713 | int input_total; // total length of input_data | 720 | int input_total; // total length of input_data |
714 | 721 | ||
715 | /** | 722 | /** |
716 | * @ref OProcessController is a friend of OProcess because it has to have | 723 | * @ref OProcessController is a friend of OProcess because it has to have |
717 | * access to various data members. | 724 | * access to various data members. |
718 | */ | 725 | */ |
719 | friend class OProcessController; | 726 | friend class Private::OProcessController; |
720 | 727 | ||
721 | private: | 728 | private: |
722 | /** | 729 | /** |
723 | * Searches for a valid shell. | 730 | * Searches for a valid shell. |
724 | * Here is the algorithm used for finding an executable shell: | 731 | * Here is the algorithm used for finding an executable shell: |
725 | * | 732 | * |
726 | * @li Try the executable pointed to by the "SHELL" environment | 733 | * @li Try the executable pointed to by the "SHELL" environment |
727 | * variable with white spaces stripped off | 734 | * variable with white spaces stripped off |
728 | * | 735 | * |
729 | * @li If your process runs with uid != euid or gid != egid, a shell | 736 | * @li If your process runs with uid != euid or gid != egid, a shell |
730 | * not listed in /etc/shells will not used. | 737 | * not listed in /etc/shells will not used. |
731 | * | 738 | * |
732 | * @li If no valid shell could be found, "/bin/sh" is used as a last resort. | 739 | * @li If no valid shell could be found, "/bin/sh" is used as a last resort. |
733 | */ | 740 | */ |
734 | QCString searchShell(); | 741 | QCString searchShell(); |
735 | 742 | ||
736 | /** | 743 | /** |
737 | * Used by @ref searchShell in order to find out whether the shell found | 744 | * Used by @ref searchShell in order to find out whether the shell found |
738 | * is actually executable at all. | 745 | * is actually executable at all. |
739 | */ | 746 | */ |
740 | bool isExecutable( const QCString &filename ); | 747 | bool isExecutable( const QCString &filename ); |
741 | 748 | ||
742 | // Disallow assignment and copy-construction | 749 | // Disallow assignment and copy-construction |
743 | OProcess( const OProcess& ); | 750 | OProcess( const OProcess& ); |
744 | OProcess& operator= ( const OProcess& ); | 751 | OProcess& operator= ( const OProcess& ); |
745 | 752 | ||
746 | private: | 753 | private: |
747 | void init ( ); | 754 | void init ( ); |
748 | OProcessPrivate *d; | 755 | Private::OProcessPrivate *d; |
749 | }; | 756 | }; |
757 | } | ||
758 | } | ||
750 | 759 | ||
751 | #endif | 760 | #endif |
752 | 761 | ||
diff --git a/libopie2/opiecore/osmartpointer.h b/libopie2/opiecore/osmartpointer.h index 9000e71..8f9da7f 100644 --- a/libopie2/opiecore/osmartpointer.h +++ b/libopie2/opiecore/osmartpointer.h | |||
@@ -27,32 +27,33 @@ _;:, .> :=|. This program is free software; you can | |||
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 _OSmartPointer_h | 32 | #ifndef _OSmartPointer_h |
33 | #define _OSmartPointer_h | 33 | #define _OSmartPointer_h |
34 | 34 | ||
35 | /*! | 35 | /*! |
36 | * \file OSmartPointer.h | 36 | * \file OSmartPointer.h |
37 | * \brief smart pointer and reference counter | 37 | * \brief smart pointer and reference counter |
38 | * \author Rajko Albrecht | 38 | * \author Rajko Albrecht |
39 | * | 39 | * |
40 | */ | 40 | */ |
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | namespace Core { | ||
43 | 44 | ||
44 | //! simple reference counter class | 45 | //! simple reference counter class |
45 | class ORefCount { | 46 | class ORefCount { |
46 | protected: | 47 | protected: |
47 | //! reference count member | 48 | //! reference count member |
48 | long m_RefCount; | 49 | long m_RefCount; |
49 | public: | 50 | public: |
50 | //! first reference must be added after "new" via Pointer() | 51 | //! first reference must be added after "new" via Pointer() |
51 | ORefCount() : m_RefCount(0) | 52 | ORefCount() : m_RefCount(0) |
52 | {} | 53 | {} |
53 | virtual ~ORefCount() {} | 54 | virtual ~ORefCount() {} |
54 | //! add a reference | 55 | //! add a reference |
55 | void Incr() { | 56 | void Incr() { |
56 | ++m_RefCount; | 57 | ++m_RefCount; |
57 | } | 58 | } |
58 | //! delete a reference | 59 | //! delete a reference |
@@ -127,19 +128,20 @@ public: | |||
127 | T* operator-> () {return ptr; } | 128 | T* operator-> () {return ptr; } |
128 | //! deref with const method call | 129 | //! deref with const method call |
129 | const T* operator-> ()const {return ptr; } | 130 | const T* operator-> ()const {return ptr; } |
130 | 131 | ||
131 | //! supports "if (pointer)" | 132 | //! supports "if (pointer)" |
132 | operator bool () const { return (ptr != NULL); } | 133 | operator bool () const { return (ptr != NULL); } |
133 | //! "if (pointer)" as non const | 134 | //! "if (pointer)" as non const |
134 | operator bool () { return ptr != NULL;} | 135 | operator bool () { return ptr != NULL;} |
135 | 136 | ||
136 | //! support if (!pointer)" | 137 | //! support if (!pointer)" |
137 | bool operator! () const { return (ptr == NULL); } | 138 | bool operator! () const { return (ptr == NULL); } |
138 | //! support if (!pointer)" as non const | 139 | //! support if (!pointer)" as non const |
139 | bool operator! () { return (ptr == NULL); } | 140 | bool operator! () { return (ptr == NULL); } |
140 | }; | 141 | }; |
141 | 142 | ||
142 | } | 143 | } |
144 | } | ||
143 | 145 | ||
144 | #endif | 146 | #endif |
145 | 147 | ||
diff --git a/libopie2/opiecore/ostorageinfo.cpp b/libopie2/opiecore/ostorageinfo.cpp index aa8d2fc..8fcf5fc 100644 --- a/libopie2/opiecore/ostorageinfo.cpp +++ b/libopie2/opiecore/ostorageinfo.cpp | |||
@@ -16,32 +16,34 @@ | |||
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <opie2/ostorageinfo.h> | 30 | #include <opie2/ostorageinfo.h> |
31 | 31 | ||
32 | using namespace Opie::Core; | ||
33 | |||
32 | OStorageInfo::OStorageInfo( QObject *parent ) | 34 | OStorageInfo::OStorageInfo( QObject *parent ) |
33 | : StorageInfo( parent ) | 35 | : StorageInfo( parent ) |
34 | { | 36 | { |
35 | } | 37 | } |
36 | 38 | ||
37 | OStorageInfo::~OStorageInfo() | 39 | OStorageInfo::~OStorageInfo() |
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | QString OStorageInfo::cfPath()const | 43 | QString OStorageInfo::cfPath()const |
42 | { | 44 | { |
43 | QString r = ""; | 45 | QString r = ""; |
44 | 46 | ||
45 | for (QListIterator<FileSystem> i( fileSystems() ); i.current(); ++i) | 47 | for (QListIterator<FileSystem> i( fileSystems() ); i.current(); ++i) |
46 | { | 48 | { |
47 | if ( (*i)->disk().left( 8 ) == "/dev/hda" ) | 49 | if ( (*i)->disk().left( 8 ) == "/dev/hda" ) |
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 | |||
@@ -19,44 +19,52 @@ | |||
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OSTORAGE_H | 30 | #ifndef OSTORAGE_H |
31 | #define OSTORAGE_H | 31 | #define OSTORAGE_H |
32 | 32 | ||
33 | #include <qpe/storage.h> | 33 | #include <qpe/storage.h> |
34 | 34 | ||
35 | namespace Opie { | ||
36 | namespace Core { | ||
37 | |||
35 | class OStorageInfo : public StorageInfo | 38 | class OStorageInfo : public StorageInfo |
36 | { | 39 | { |
37 | Q_OBJECT | 40 | Q_OBJECT |
38 | 41 | ||
39 | public: | 42 | public: |
40 | 43 | ||
41 | OStorageInfo( QObject *parent=0 ); | 44 | OStorageInfo( QObject *parent=0 ); |
42 | ~OStorageInfo(); | 45 | ~OStorageInfo(); |
43 | 46 | ||
44 | /** | 47 | /** |
45 | * @returns the mount path of the CF (Compact Flash) card | 48 | * @returns the mount path of the CF (Compact Flash) card |
46 | * | 49 | * |
47 | **/ | 50 | **/ |
48 | QString cfPath() const; | 51 | QString cfPath() const; |
49 | /** | 52 | /** |
50 | * @returns the mount path of the SD (Secure Digital) card | 53 | * @returns the mount path of the SD (Secure Digital) card |
51 | * | 54 | * |
52 | **/ | 55 | **/ |
53 | QString sdPath() const; | 56 | QString sdPath() const; |
54 | /** | 57 | /** |
55 | * @returns the mount path of the MMC (MultiMedia) card | 58 | * @returns the mount path of the MMC (MultiMedia) card |
56 | * | 59 | * |
57 | **/ | 60 | **/ |
58 | QString mmcPath() const; | 61 | QString mmcPath() const; |
62 | private: | ||
63 | class Private; | ||
64 | Private *d; | ||
59 | }; | 65 | }; |
60 | 66 | ||
67 | } | ||
68 | } | ||
61 | #endif // OSTORAGE_H | 69 | #endif // OSTORAGE_H |
62 | 70 | ||
diff --git a/libopie2/opiedb/TODO b/libopie2/opiedb/TODO index ca04ac6..8b86187 100644 --- a/libopie2/opiedb/TODO +++ b/libopie2/opiedb/TODO | |||
@@ -1,9 +1,10 @@ | |||
1 | * something like Capabilities of a Driver | 1 | * something like Capabilities of a Driver |
2 | - ROWID | 2 | - ROWID |
3 | - How to declare INTEGER PRIMARY KEY | 3 | - How to declare INTEGER PRIMARY KEY |
4 | - Abstract from implementation of some dbs | 4 | - Abstract from implementation of some dbs |
5 | - provides( Type::What ) | 5 | - provides( Type::What ) |
6 | - emit signals directly on arriving of data | ||
6 | 7 | ||
7 | * OSQLDriver DriverVersion - DatabaseVersion | 8 | * OSQLDriver DriverVersion - DatabaseVersion |
8 | * Better OSQLQueries | 9 | * Better OSQLQueries |
9 | - more than OSQLRawQuery \ No newline at end of file | 10 | - more than OSQLRawQuery \ No newline at end of file |
diff --git a/libopie2/opiedb/opiedb.pro b/libopie2/opiedb/opiedb.pro index c773d6c..147435a 100644 --- a/libopie2/opiedb/opiedb.pro +++ b/libopie2/opiedb/opiedb.pro | |||
@@ -8,29 +8,29 @@ HEADERS = osqlbackend.h \ | |||
8 | osqlquery.h \ | 8 | osqlquery.h \ |
9 | osqlresult.h \ | 9 | osqlresult.h \ |
10 | osqltable.h \ | 10 | osqltable.h \ |
11 | osqlbackendmanager.h \ | 11 | osqlbackendmanager.h \ |
12 | osqlitedriver.h | 12 | osqlitedriver.h |
13 | SOURCES = osqlbackend.cpp \ | 13 | SOURCES = osqlbackend.cpp \ |
14 | osqldriver.cpp \ | 14 | osqldriver.cpp \ |
15 | osqlerror.cpp \ | 15 | osqlerror.cpp \ |
16 | osqlmanager.cpp \ | 16 | osqlmanager.cpp \ |
17 | osqlquery.cpp \ | 17 | osqlquery.cpp \ |
18 | osqlresult.cpp \ | 18 | osqlresult.cpp \ |
19 | osqltable.cpp \ | 19 | osqltable.cpp \ |
20 | osqlbackendmanager.cpp \ | 20 | osqlbackendmanager.cpp \ |
21 | osqlitedriver.cpp | 21 | osqlitedriver.cpp |
22 | INTERFACES = | 22 | INTERFACES = |
23 | TARGET = opiedb2 | 23 | TARGET = opiedb2 |
24 | VERSION = 1.8.2 | 24 | VERSION = 1.9.0 |
25 | INCLUDEPATH = $(OPIEDIR)/include | 25 | INCLUDEPATH = $(OPIEDIR)/include |
26 | DEPENDPATH = $(OPIEDIR)/include | 26 | DEPENDPATH = $(OPIEDIR)/include |
27 | LIBS += -lopiecore2 -lqpe -lsqlite | 27 | LIBS += -lopiecore2 -lqpe -lsqlite |
28 | 28 | ||
29 | !contains( platform, x11 ) { | 29 | !contains( platform, x11 ) { |
30 | include ( $(OPIEDIR)/include.pro ) | 30 | include ( $(OPIEDIR)/include.pro ) |
31 | } | 31 | } |
32 | 32 | ||
33 | contains( platform, x11 ) { | 33 | contains( platform, x11 ) { |
34 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 34 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
35 | } | 35 | } |
36 | 36 | ||
diff --git a/libopie2/opiedb/osqlbackend.cpp b/libopie2/opiedb/osqlbackend.cpp index d6c39a9..6e5159f 100644 --- a/libopie2/opiedb/osqlbackend.cpp +++ b/libopie2/opiedb/osqlbackend.cpp | |||
@@ -1,19 +1,21 @@ | |||
1 | 1 | ||
2 | #include "osqlbackend.h" | 2 | #include "osqlbackend.h" |
3 | 3 | ||
4 | using namespace Opie::DB; | ||
5 | |||
4 | 6 | ||
5 | OSQLBackEnd::OSQLBackEnd( const QString& name, | 7 | OSQLBackEnd::OSQLBackEnd( const QString& name, |
6 | const QString& vendor, | 8 | const QString& vendor, |
7 | const QString& license, | 9 | const QString& license, |
8 | const QCString& lib ) | 10 | const QCString& lib ) |
9 | : m_name( name), m_vendor( vendor), m_license( license ), m_lib( lib ) | 11 | : m_name( name), m_vendor( vendor), m_license( license ), m_lib( lib ) |
10 | { | 12 | { |
11 | m_default = false; | 13 | m_default = false; |
12 | m_pref = -1; | 14 | m_pref = -1; |
13 | } | 15 | } |
14 | OSQLBackEnd::OSQLBackEnd( const OSQLBackEnd& back ) { | 16 | OSQLBackEnd::OSQLBackEnd( const OSQLBackEnd& back ) { |
15 | (*this) = back; | 17 | (*this) = back; |
16 | } | 18 | } |
17 | OSQLBackEnd::~OSQLBackEnd() { | 19 | OSQLBackEnd::~OSQLBackEnd() { |
18 | } | 20 | } |
19 | bool OSQLBackEnd::operator==( const OSQLBackEnd& other ) { | 21 | bool OSQLBackEnd::operator==( const OSQLBackEnd& other ) { |
diff --git a/libopie2/opiedb/osqlbackend.h b/libopie2/opiedb/osqlbackend.h index ad879a4..28451b6 100644 --- a/libopie2/opiedb/osqlbackend.h +++ b/libopie2/opiedb/osqlbackend.h | |||
@@ -1,24 +1,27 @@ | |||
1 | 1 | ||
2 | #ifndef OSQL_BACKEND_H | 2 | #ifndef OSQL_BACKEND_H |
3 | #define OSQL_BACKEND_H | 3 | #define OSQL_BACKEND_H |
4 | 4 | ||
5 | #include <qcstring.h> | 5 | #include <qcstring.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | 8 | ||
9 | |||
10 | namespace Opie { | ||
11 | namespace DB { | ||
9 | /** | 12 | /** |
10 | * OSQLBackEnd represents an available backend | 13 | * OSQLBackEnd represents an available backend |
11 | * to the Opie Database Service | 14 | * to the Opie Database Service |
12 | * It's used to easily extend OSQL services by | 15 | * It's used to easily extend OSQL services by |
13 | * 3rd party plugins. | 16 | * 3rd party plugins. |
14 | * It's used to show | 17 | * It's used to show |
15 | */ | 18 | */ |
16 | class OSQLBackEnd /*: public QShared */ { | 19 | class OSQLBackEnd /*: public QShared */ { |
17 | public: | 20 | public: |
18 | typedef QValueList<OSQLBackEnd> ValueList; | 21 | typedef QValueList<OSQLBackEnd> ValueList; |
19 | /** | 22 | /** |
20 | * A basic c'tor | 23 | * A basic c'tor |
21 | * @param name the user visible name of the service | 24 | * @param name the user visible name of the service |
22 | * @param vendor the vendor of the service | 25 | * @param vendor the vendor of the service |
23 | * @param license the license of the service | 26 | * @param license the license of the service |
24 | * @param library what is the name of lib if builtin it's builtin | 27 | * @param library what is the name of lib if builtin it's builtin |
@@ -57,19 +60,24 @@ public: | |||
57 | /** @param license the license applied */ | 60 | /** @param license the license applied */ |
58 | void setLicense( const QString& license ); | 61 | void setLicense( const QString& license ); |
59 | 62 | ||
60 | /** @param the lib to set */ | 63 | /** @param the lib to set */ |
61 | void setLibrary( const QCString& lib ); | 64 | void setLibrary( const QCString& lib ); |
62 | 65 | ||
63 | void setDefault( bool ); | 66 | void setDefault( bool ); |
64 | void setPreference( int ); | 67 | void setPreference( int ); |
65 | 68 | ||
66 | private: | 69 | private: |
67 | QString m_name; | 70 | QString m_name; |
68 | QString m_vendor; | 71 | QString m_vendor; |
69 | QString m_license; | 72 | QString m_license; |
70 | QCString m_lib; | 73 | QCString m_lib; |
71 | bool m_default :1; | 74 | bool m_default :1; |
72 | int m_pref; | 75 | int m_pref; |
76 | class Private; | ||
77 | Private *d; | ||
73 | }; | 78 | }; |
74 | 79 | ||
80 | } | ||
81 | } | ||
82 | |||
75 | #endif | 83 | #endif |
diff --git a/libopie2/opiedb/osqlbackendmanager.cpp b/libopie2/opiedb/osqlbackendmanager.cpp index 95ed77b..fc18e07 100644 --- a/libopie2/opiedb/osqlbackendmanager.cpp +++ b/libopie2/opiedb/osqlbackendmanager.cpp | |||
@@ -1,21 +1,25 @@ | |||
1 | #include <qdir.h> | 1 | #include <qdir.h> |
2 | #include <qmap.h> | 2 | #include <qmap.h> |
3 | 3 | ||
4 | #include "osqlbackendmanager.h" | 4 | #include "osqlbackendmanager.h" |
5 | 5 | ||
6 | /** | ||
7 | * \todo FIXME CONFIG!!! | ||
8 | */ | ||
9 | |||
6 | namespace { | 10 | namespace { |
7 | class Config { | 11 | class Config { |
8 | typedef QMap<QString, QString> List; | 12 | typedef QMap<QString, QString> List; |
9 | public: | 13 | public: |
10 | Config( const QString& fileName ); | 14 | Config( const QString& fileName ); |
11 | /** | 15 | /** |
12 | * Quite simple layout in nature | 16 | * Quite simple layout in nature |
13 | * BeginFile | 17 | * BeginFile |
14 | * Key = Value | 18 | * Key = Value |
15 | */ | 19 | */ |
16 | bool load(); | 20 | bool load(); |
17 | QString value( const QString& key ); | 21 | QString value( const QString& key ); |
18 | private: | 22 | private: |
19 | List m_list; | 23 | List m_list; |
20 | QString m_fileName; | 24 | QString m_fileName; |
21 | }; | 25 | }; |
@@ -31,32 +35,36 @@ namespace { | |||
31 | return false; | 35 | return false; |
32 | QStringList list = QStringList::split( '\n', file.readAll() ); | 36 | QStringList list = QStringList::split( '\n', file.readAll() ); |
33 | QStringList::Iterator it; | 37 | QStringList::Iterator it; |
34 | QString line; | 38 | QString line; |
35 | for (it = list.begin(); it != list.end(); ++it ) { | 39 | for (it = list.begin(); it != list.end(); ++it ) { |
36 | line = (*it).stripWhiteSpace(); | 40 | line = (*it).stripWhiteSpace(); |
37 | qWarning("Anonymous::Config:" + line ); | 41 | qWarning("Anonymous::Config:" + line ); |
38 | QStringList test = QStringList::split(' ', line ); | 42 | QStringList test = QStringList::split(' ', line ); |
39 | m_list.insert( test[0], test[2] ); | 43 | m_list.insert( test[0], test[2] ); |
40 | } | 44 | } |
41 | return true; | 45 | return true; |
42 | } | 46 | } |
43 | QString Config::value( const QString& key ) { | 47 | QString Config::value( const QString& key ) { |
44 | return m_list[key]; | 48 | return m_list[key]; |
45 | } | 49 | } |
46 | }; | 50 | }; |
51 | |||
52 | |||
53 | using namespace Opie::DB; | ||
54 | |||
47 | OSQLBackEndManager::OSQLBackEndManager( const QStringList& path ) | 55 | OSQLBackEndManager::OSQLBackEndManager( const QStringList& path ) |
48 | :m_path( path ) | 56 | :m_path( path ) |
49 | { | 57 | { |
50 | } | 58 | } |
51 | OSQLBackEndManager::~OSQLBackEndManager() { | 59 | OSQLBackEndManager::~OSQLBackEndManager() { |
52 | } | 60 | } |
53 | /** | 61 | /** |
54 | * scan dirs | 62 | * scan dirs |
55 | */ | 63 | */ |
56 | OSQLBackEnd::ValueList OSQLBackEndManager::scan() { | 64 | OSQLBackEnd::ValueList OSQLBackEndManager::scan() { |
57 | OSQLBackEnd::ValueList list; | 65 | OSQLBackEnd::ValueList list; |
58 | if (!m_path.isEmpty() ) { | 66 | if (!m_path.isEmpty() ) { |
59 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
60 | for ( it = m_path.begin(); it != m_path.end(); ++it ) { | 68 | for ( it = m_path.begin(); it != m_path.end(); ++it ) { |
61 | list += scanDir( (*it) ); | 69 | list += scanDir( (*it) ); |
62 | } | 70 | } |
diff --git a/libopie2/opiedb/osqlbackendmanager.h b/libopie2/opiedb/osqlbackendmanager.h index bc357a9..00e81fc 100644 --- a/libopie2/opiedb/osqlbackendmanager.h +++ b/libopie2/opiedb/osqlbackendmanager.h | |||
@@ -1,20 +1,26 @@ | |||
1 | #ifndef OSQL_BACKEND_MANAGER_H | 1 | #ifndef OSQL_BACKEND_MANAGER_H |
2 | #define OSQL_BACKEND_MANAGER_H | 2 | #define OSQL_BACKEND_MANAGER_H |
3 | 3 | ||
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | 5 | ||
6 | #include "osqlbackend.h" | 6 | #include "osqlbackend.h" |
7 | 7 | ||
8 | namespace Opie { | ||
9 | namespace DB { | ||
10 | |||
8 | class OSQLBackEndManager { | 11 | class OSQLBackEndManager { |
9 | public: | 12 | public: |
10 | OSQLBackEndManager(const QStringList& path ); | 13 | OSQLBackEndManager(const QStringList& path ); |
11 | ~OSQLBackEndManager(); | 14 | ~OSQLBackEndManager(); |
12 | OSQLBackEnd::ValueList scan(); | 15 | OSQLBackEnd::ValueList scan(); |
13 | private: | 16 | private: |
14 | OSQLBackEnd::ValueList scanDir( const QString& dir ); | 17 | OSQLBackEnd::ValueList scanDir( const QString& dir ); |
15 | OSQLBackEnd file2backend( const QString& file ); | 18 | OSQLBackEnd file2backend( const QString& file ); |
16 | class OSQLBackEndManagerPrivate; | 19 | class OSQLBackEndManagerPrivate; |
17 | OSQLBackEndManagerPrivate* d; | 20 | OSQLBackEndManagerPrivate* d; |
18 | QStringList m_path; | 21 | QStringList m_path; |
19 | }; | 22 | }; |
23 | } | ||
24 | } | ||
25 | |||
20 | #endif | 26 | #endif |
diff --git a/libopie2/opiedb/osqldriver.cpp b/libopie2/opiedb/osqldriver.cpp index 258c116..a6dae77 100644 --- a/libopie2/opiedb/osqldriver.cpp +++ b/libopie2/opiedb/osqldriver.cpp | |||
@@ -1,13 +1,15 @@ | |||
1 | #include <qpe/qlibrary.h> | 1 | #include <qpe/qlibrary.h> |
2 | 2 | ||
3 | #include "osqldriver.h" | 3 | #include "osqldriver.h" |
4 | 4 | ||
5 | using namespace Opie::DB; | ||
6 | |||
5 | OSQLDriver::OSQLDriver( QLibrary* lib ) | 7 | OSQLDriver::OSQLDriver( QLibrary* lib ) |
6 | : QObject(), m_lib(lib) { | 8 | : QObject(), m_lib(lib) { |
7 | } | 9 | } |
8 | OSQLDriver::~OSQLDriver() { | 10 | OSQLDriver::~OSQLDriver() { |
9 | delete m_lib; | 11 | delete m_lib; |
10 | } | 12 | } |
11 | bool OSQLDriver::sync() { | 13 | bool OSQLDriver::sync() { |
12 | return true; | 14 | return true; |
13 | } | 15 | } |
diff --git a/libopie2/opiedb/osqldriver.h b/libopie2/opiedb/osqldriver.h index 68d8ee6..492b8dd 100644 --- a/libopie2/opiedb/osqldriver.h +++ b/libopie2/opiedb/osqldriver.h | |||
@@ -1,25 +1,29 @@ | |||
1 | #ifndef OSQL_DRIVER_H | 1 | #ifndef OSQL_DRIVER_H |
2 | #define OSQL_DRIVER_H | 2 | #define OSQL_DRIVER_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | #include "osqltable.h" | 7 | #include "osqltable.h" |
8 | 8 | ||
9 | class QLibrary; | 9 | class QLibrary; |
10 | |||
11 | namespace Opie { | ||
12 | namespace DB { | ||
13 | |||
10 | class OSQLResult; | 14 | class OSQLResult; |
11 | class OSQLQuery; | 15 | class OSQLQuery; |
12 | class OSQLError; | 16 | class OSQLError; |
13 | 17 | ||
14 | /** | 18 | /** |
15 | * A OSQLDriver implements the communication with | 19 | * A OSQLDriver implements the communication with |
16 | * a database. | 20 | * a database. |
17 | * After you queried and loaded a driver you can | 21 | * After you queried and loaded a driver you can |
18 | * set some informations and finally try to open | 22 | * set some informations and finally try to open |
19 | * the database | 23 | * the database |
20 | * | 24 | * |
21 | */ | 25 | */ |
22 | class OSQLDriver : public QObject{ | 26 | class OSQLDriver : public QObject{ |
23 | Q_OBJECT | 27 | Q_OBJECT |
24 | public: | 28 | public: |
25 | enum Capabilities { RowID=0 }; | 29 | enum Capabilities { RowID=0 }; |
@@ -71,17 +75,20 @@ public: | |||
71 | virtual OSQLResult query( OSQLQuery* ) = 0; | 75 | virtual OSQLResult query( OSQLQuery* ) = 0; |
72 | 76 | ||
73 | /** | 77 | /** |
74 | * Get a list of tables | 78 | * Get a list of tables |
75 | */ | 79 | */ |
76 | virtual OSQLTable::ValueList tables() const = 0l; | 80 | virtual OSQLTable::ValueList tables() const = 0l; |
77 | virtual bool sync(); | 81 | virtual bool sync(); |
78 | 82 | ||
79 | 83 | ||
80 | private: | 84 | private: |
81 | QLibrary* m_lib; | 85 | QLibrary* m_lib; |
82 | class OSQLDriverPrivate; | 86 | class OSQLDriverPrivate; |
83 | OSQLDriverPrivate *d; | 87 | OSQLDriverPrivate *d; |
84 | 88 | ||
85 | }; | 89 | }; |
86 | 90 | ||
91 | } | ||
92 | } | ||
93 | |||
87 | #endif | 94 | #endif |
diff --git a/libopie2/opiedb/osqlerror.cpp b/libopie2/opiedb/osqlerror.cpp index 3890a50..165ba65 100644 --- a/libopie2/opiedb/osqlerror.cpp +++ b/libopie2/opiedb/osqlerror.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | #include "osqlerror.h" | 1 | #include "osqlerror.h" |
2 | 2 | ||
3 | using namespace Opie::DB; | ||
4 | |||
3 | OSQLError::OSQLError( const QString& driverText, | 5 | OSQLError::OSQLError( const QString& driverText, |
4 | const QString& driverDatabaseText, | 6 | const QString& driverDatabaseText, |
5 | int type, int subType ) | 7 | int type, int subType ) |
6 | : m_drvText( driverText ), m_drvDBText( driverDatabaseText ), | 8 | : m_drvText( driverText ), m_drvDBText( driverDatabaseText ), |
7 | m_type( type ), m_number( subType ) | 9 | m_type( type ), m_number( subType ) |
8 | { | 10 | { |
9 | } | 11 | } |
10 | OSQLError::~OSQLError() { | 12 | OSQLError::~OSQLError() { |
11 | } | 13 | } |
12 | QString OSQLError::driverText()const { | 14 | QString OSQLError::driverText()const { |
13 | return m_drvText; | 15 | return m_drvText; |
14 | } | 16 | } |
15 | QString OSQLError::databaseText()const { | 17 | QString OSQLError::databaseText()const { |
16 | return m_drvDBText; | 18 | return m_drvDBText; |
17 | } | 19 | } |
18 | int OSQLError::type()const { | 20 | int OSQLError::type()const { |
diff --git a/libopie2/opiedb/osqlerror.h b/libopie2/opiedb/osqlerror.h index 35a4368..8fa973d 100644 --- a/libopie2/opiedb/osqlerror.h +++ b/libopie2/opiedb/osqlerror.h | |||
@@ -1,22 +1,25 @@ | |||
1 | #ifndef OSQL_ERROR_H | 1 | #ifndef OSQL_ERROR_H |
2 | #define OSQL_ERROR_H | 2 | #define OSQL_ERROR_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qvaluelist.h> | 5 | #include <qvaluelist.h> |
6 | 6 | ||
7 | |||
8 | namespace Opie { | ||
9 | namespace DB { | ||
7 | /** | 10 | /** |
8 | * OSQLError is the base class of all errors | 11 | * OSQLError is the base class of all errors |
9 | */ | 12 | */ |
10 | class OSQLError { | 13 | class OSQLError { |
11 | public: | 14 | public: |
12 | typedef QValueList<OSQLError> ValueList; | 15 | typedef QValueList<OSQLError> ValueList; |
13 | enum Type { None = 0, // NoError | 16 | enum Type { None = 0, // NoError |
14 | Internal, // Internal Error in OSQL | 17 | Internal, // Internal Error in OSQL |
15 | Unknown, // Unknown Error | 18 | Unknown, // Unknown Error |
16 | Transaction, // Transaction Error | 19 | Transaction, // Transaction Error |
17 | Statement, // Wrong Statement | 20 | Statement, // Wrong Statement |
18 | Connection, // Connection Error( lost ) | 21 | Connection, // Connection Error( lost ) |
19 | Driver // Driver Specefic error | 22 | Driver // Driver Specefic error |
20 | }; | 23 | }; |
21 | enum DriverError { | 24 | enum DriverError { |
22 | DriverInternal=0, // internal DriverError | 25 | DriverInternal=0, // internal DriverError |
@@ -43,17 +46,19 @@ public: | |||
43 | int type = None, int subNumber = -1 ); | 46 | int type = None, int subNumber = -1 ); |
44 | ~OSQLError(); | 47 | ~OSQLError(); |
45 | 48 | ||
46 | QString driverText()const; | 49 | QString driverText()const; |
47 | QString databaseText()const; | 50 | QString databaseText()const; |
48 | int type()const; | 51 | int type()const; |
49 | int subNumber()const; | 52 | int subNumber()const; |
50 | private: | 53 | private: |
51 | QString m_drvText; | 54 | QString m_drvText; |
52 | QString m_drvDBText; | 55 | QString m_drvDBText; |
53 | int m_type; | 56 | int m_type; |
54 | int m_number; | 57 | int m_number; |
55 | class OSQLErrorPrivate; | 58 | class OSQLErrorPrivate; |
56 | OSQLErrorPrivate* d; | 59 | OSQLErrorPrivate* d; |
57 | }; | 60 | }; |
58 | 61 | ||
62 | } | ||
63 | } | ||
59 | #endif | 64 | #endif |
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index 6141504..47bc250 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp | |||
@@ -27,32 +27,35 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "osqlquery.h" | 31 | #include "osqlquery.h" |
32 | #include "osqlitedriver.h" | 32 | #include "osqlitedriver.h" |
33 | 33 | ||
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | 35 | ||
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | // fromLocal8Bit() does not work as expected. Thus it | 38 | // fromLocal8Bit() does not work as expected. Thus it |
39 | // is replaced by fromLatin1() (eilers) | 39 | // is replaced by fromLatin1() (eilers) |
40 | #define __BUGGY_LOCAL8BIT_ | 40 | #define __BUGGY_LOCAL8BIT_ |
41 | 41 | ||
42 | 42 | ||
43 | using namespace Opie::DB; | ||
44 | using namespace Opie::DB::Private; | ||
45 | |||
43 | namespace { | 46 | namespace { |
44 | struct Query { | 47 | struct Query { |
45 | OSQLError::ValueList errors; | 48 | OSQLError::ValueList errors; |
46 | OSQLResultItem::ValueList items; | 49 | OSQLResultItem::ValueList items; |
47 | OSQLiteDriver *driver; | 50 | OSQLiteDriver *driver; |
48 | }; | 51 | }; |
49 | } | 52 | } |
50 | 53 | ||
51 | 54 | ||
52 | OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) | 55 | OSQLiteDriver::OSQLiteDriver( QLibrary *lib ) |
53 | : OSQLDriver( lib ) | 56 | : OSQLDriver( lib ) |
54 | { | 57 | { |
55 | m_sqlite = 0l; | 58 | m_sqlite = 0l; |
56 | } | 59 | } |
57 | 60 | ||
58 | 61 | ||
@@ -73,73 +76,73 @@ void OSQLiteDriver::setPassword( const QString& ) {} | |||
73 | 76 | ||
74 | void OSQLiteDriver::setUrl( const QString& url ) { | 77 | void OSQLiteDriver::setUrl( const QString& url ) { |
75 | m_url = url; | 78 | m_url = url; |
76 | } | 79 | } |
77 | 80 | ||
78 | 81 | ||
79 | void OSQLiteDriver::setOptions( const QStringList& ) { | 82 | void OSQLiteDriver::setOptions( const QStringList& ) { |
80 | } | 83 | } |
81 | 84 | ||
82 | 85 | ||
83 | /* | 86 | /* |
84 | * try to open a db specified via setUrl | 87 | * try to open a db specified via setUrl |
85 | * and options | 88 | * and options |
86 | */ | 89 | */ |
87 | bool OSQLiteDriver::open() { | 90 | bool OSQLiteDriver::open() { |
88 | char *error; | 91 | char *error; |
89 | odebug << "OSQLiteDriver::open: about to open" << oendl; | 92 | qDebug("OSQLiteDriver::open: about to open"); |
90 | m_sqlite = sqlite_open(m_url.local8Bit(), | 93 | m_sqlite = sqlite_open(m_url.local8Bit(), |
91 | 0, | 94 | 0, |
92 | &error ); | 95 | &error ); |
93 | 96 | ||
94 | /* failed to open */ | 97 | /* failed to open */ |
95 | if (m_sqlite == 0l ) { | 98 | if (m_sqlite == 0l ) { |
96 | // FIXME set the last error | 99 | // FIXME set the last error |
97 | owarn << "OSQLiteDriver::open: " << error << oendl; | 100 | qWarning("OSQLiteDriver::open: %s", error ); |
98 | free( error ); | 101 | free( error ); |
99 | return false; | 102 | return false; |
100 | } | 103 | } |
101 | return true; | 104 | return true; |
102 | } | 105 | } |
103 | 106 | ||
104 | 107 | ||
105 | /* close the db | 108 | /* close the db |
106 | * sqlite closes them without | 109 | * sqlite closes them without |
107 | * telling failure or success | 110 | * telling failure or success |
108 | */ | 111 | */ |
109 | bool OSQLiteDriver::close() { | 112 | bool OSQLiteDriver::close() { |
110 | if (m_sqlite ) | 113 | if (m_sqlite ) |
111 | sqlite_close( m_sqlite ), m_sqlite=0l; | 114 | sqlite_close( m_sqlite ), m_sqlite=0l; |
112 | 115 | ||
113 | return true; | 116 | return true; |
114 | } | 117 | } |
115 | 118 | ||
116 | 119 | ||
117 | /* Query */ | 120 | /* Query */ |
118 | OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { | 121 | OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { |
119 | if ( !m_sqlite ) { | 122 | if ( !m_sqlite ) { |
120 | // FIXME set error code | 123 | // FIXME set error code |
121 | OSQLResult result( OSQLResult::Failure ); | 124 | OSQLResult result( OSQLResult::Failure ); |
122 | return result; | 125 | return result; |
123 | } | 126 | } |
124 | Query query; | 127 | Query query; |
125 | query.driver = this; | 128 | query.driver = this; |
126 | char *err; | 129 | char *err; |
127 | /* SQLITE_OK 0 if return code > 0 == failure */ | 130 | /* SQLITE_OK 0 if return code > 0 == failure */ |
128 | if ( sqlite_exec(m_sqlite, qu->query(),&call_back, &query, &err) > 0 ) { | 131 | if ( sqlite_exec(m_sqlite, qu->query(),&call_back, &query, &err) > 0 ) { |
129 | owarn << "OSQLiteDriver::query: Error while executing" << oendl; | 132 | qWarning("OSQLiteDriver::query: Error while executing"); |
130 | free(err ); | 133 | free(err ); |
131 | // FixMe Errors | 134 | // FixMe Errors |
132 | } | 135 | } |
133 | 136 | ||
134 | OSQLResult result(OSQLResult::Success, | 137 | OSQLResult result(OSQLResult::Success, |
135 | query.items, | 138 | query.items, |
136 | query.errors ); | 139 | query.errors ); |
137 | return result; | 140 | return result; |
138 | } | 141 | } |
139 | 142 | ||
140 | 143 | ||
141 | OSQLTable::ValueList OSQLiteDriver::tables() const { | 144 | OSQLTable::ValueList OSQLiteDriver::tables() const { |
142 | 145 | ||
143 | } | 146 | } |
144 | 147 | ||
145 | 148 | ||
diff --git a/libopie2/opiedb/osqlitedriver.h b/libopie2/opiedb/osqlitedriver.h index 6984539..3e1325b 100644 --- a/libopie2/opiedb/osqlitedriver.h +++ b/libopie2/opiedb/osqlitedriver.h | |||
@@ -1,34 +1,42 @@ | |||
1 | #ifndef OSQL_LITE_DRIVER_H | 1 | #ifndef OSQL_LITE_DRIVER_H |
2 | #define OSQL_LITE_DRIVER_H | 2 | #define OSQL_LITE_DRIVER_H |
3 | 3 | ||
4 | #include <sqlite.h> | 4 | #include <sqlite.h> |
5 | 5 | ||
6 | #include "osqldriver.h" | 6 | #include "osqldriver.h" |
7 | #include "osqlerror.h" | 7 | #include "osqlerror.h" |
8 | #include "osqlresult.h" | 8 | #include "osqlresult.h" |
9 | 9 | ||
10 | namespace Opie { | ||
11 | namespace DB { | ||
12 | namespace Private { | ||
13 | |||
10 | class OSQLiteDriver : public OSQLDriver { | 14 | class OSQLiteDriver : public OSQLDriver { |
11 | Q_OBJECT | 15 | Q_OBJECT |
12 | public: | 16 | public: |
13 | OSQLiteDriver( QLibrary *lib = 0l ); | 17 | OSQLiteDriver( QLibrary *lib = 0l ); |
14 | ~OSQLiteDriver(); | 18 | ~OSQLiteDriver(); |
15 | QString id()const; | 19 | QString id()const; |
16 | void setUserName( const QString& ); | 20 | void setUserName( const QString& ); |
17 | void setPassword( const QString& ); | 21 | void setPassword( const QString& ); |
18 | void setUrl( const QString& url ); | 22 | void setUrl( const QString& url ); |
19 | void setOptions( const QStringList& ); | 23 | void setOptions( const QStringList& ); |
20 | bool open(); | 24 | bool open(); |
21 | bool close(); | 25 | bool close(); |
22 | OSQLError lastError(); | 26 | OSQLError lastError(); |
23 | OSQLResult query( OSQLQuery* ); | 27 | OSQLResult query( OSQLQuery* ); |
24 | OSQLTable::ValueList tables()const; | 28 | OSQLTable::ValueList tables()const; |
25 | private: | 29 | private: |
26 | OSQLError m_lastE; | 30 | OSQLError m_lastE; |
27 | OSQLResult m_result; | 31 | OSQLResult m_result; |
28 | OSQLResultItem m_items; | 32 | OSQLResultItem m_items; |
29 | int handleCallBack( int, char**, char** ); | 33 | int handleCallBack( int, char**, char** ); |
30 | static int call_back( void*, int, char**, char** ); | 34 | static int call_back( void*, int, char**, char** ); |
31 | QString m_url; | 35 | QString m_url; |
32 | sqlite *m_sqlite; | 36 | sqlite *m_sqlite; |
33 | }; | 37 | }; |
38 | } | ||
39 | } | ||
40 | } | ||
41 | |||
34 | #endif | 42 | #endif |
diff --git a/libopie2/opiedb/osqlmanager.cpp b/libopie2/opiedb/osqlmanager.cpp index 766ebe1..990d258 100644 --- a/libopie2/opiedb/osqlmanager.cpp +++ b/libopie2/opiedb/osqlmanager.cpp | |||
@@ -1,61 +1,63 @@ | |||
1 | 1 | ||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include "osqlmanager.h" | 4 | #include "osqlmanager.h" |
5 | #include "osqlbackendmanager.h" | 5 | #include "osqlbackendmanager.h" |
6 | #include "osqlitedriver.h" | 6 | #include "osqlitedriver.h" |
7 | 7 | ||
8 | using namespace Opie::DB; | ||
9 | |||
8 | OSQLManager::OSQLManager() { | 10 | OSQLManager::OSQLManager() { |
9 | } | 11 | } |
10 | OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { | 12 | OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { |
11 | m_list.clear(); | 13 | m_list.clear(); |
12 | QString opie = QString::fromLatin1( getenv("OPIEDIR") ); | 14 | QString opie = QString::fromLatin1( getenv("OPIEDIR") ); |
13 | QString qpe = QString::fromLatin1( getenv("QPEDIR") ); | 15 | QString qpe = QString::fromLatin1( getenv("QPEDIR") ); |
14 | 16 | ||
15 | if ( !m_path.contains(opie) && !opie.isEmpty() ) | 17 | if ( !m_path.contains(opie) && !opie.isEmpty() ) |
16 | m_path << opie; | 18 | m_path << opie; |
17 | if ( !m_path.contains(qpe) && !qpe.isEmpty() ) | 19 | if ( !m_path.contains(qpe) && !qpe.isEmpty() ) |
18 | m_path << qpe; | 20 | m_path << qpe; |
19 | 21 | ||
20 | OSQLBackEndManager mng( m_path ); | 22 | OSQLBackEndManager mng( m_path ); |
21 | m_list = mng.scan(); | 23 | m_list = mng.scan(); |
22 | m_list += builtIn(); | 24 | m_list += builtIn(); |
23 | 25 | ||
24 | return m_list; | 26 | return m_list; |
25 | } | 27 | } |
26 | /* | 28 | /* |
27 | * loading dso's is currently not enabled due problems with QLibrary | 29 | * loading dso's is currently not enabled due problems with QLibrary |
28 | * beeing in libqpe and not libqte | 30 | * beeing in libqpe and not libqte |
29 | */ | 31 | */ |
30 | OSQLDriver* OSQLManager::load( const QString& name ) { | 32 | OSQLDriver* OSQLManager::load( const QString& name ) { |
31 | OSQLDriver* driver = 0l; | 33 | OSQLDriver* driver = 0l; |
32 | 34 | ||
33 | if ( name == "SQLite" ) { | 35 | if ( name == "SQLite" ) { |
34 | driver = new OSQLiteDriver(); | 36 | driver = new Opie::DB::Private::OSQLiteDriver; |
35 | } | 37 | } |
36 | return driver; | 38 | return driver; |
37 | } | 39 | } |
38 | /* | 40 | /* |
39 | * same as above | 41 | * same as above |
40 | */ | 42 | */ |
41 | OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { | 43 | OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { |
42 | OSQLDriver *driver = 0l; | 44 | OSQLDriver *driver = 0l; |
43 | if ( end.library() == "builtin" && | 45 | if ( end.library() == "builtin" && |
44 | end.name() == "SQLite" ) | 46 | end.name() == "SQLite" ) |
45 | driver = new OSQLiteDriver(); | 47 | driver = new Opie::DB::Private::OSQLiteDriver; |
46 | 48 | ||
47 | return driver; | 49 | return driver; |
48 | } | 50 | } |
49 | /* | 51 | /* |
50 | * let's find the a default with the highes preference | 52 | * let's find the a default with the highes preference |
51 | */ | 53 | */ |
52 | OSQLDriver* OSQLManager::standard() { | 54 | OSQLDriver* OSQLManager::standard() { |
53 | OSQLDriver* driver =0l; | 55 | OSQLDriver* driver =0l; |
54 | if ( m_list.isEmpty() ) queryBackEnd(); | 56 | if ( m_list.isEmpty() ) queryBackEnd(); |
55 | OSQLBackEnd::ValueList::Iterator it; | 57 | OSQLBackEnd::ValueList::Iterator it; |
56 | OSQLBackEnd back; | 58 | OSQLBackEnd back; |
57 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 59 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
58 | if ( (*it).isDefault() && | 60 | if ( (*it).isDefault() && |
59 | back.preference() < (*it).preference() ) { | 61 | back.preference() < (*it).preference() ) { |
60 | back = (*it); | 62 | back = (*it); |
61 | } | 63 | } |
diff --git a/libopie2/opiedb/osqlmanager.h b/libopie2/opiedb/osqlmanager.h index 5323b14..ca73c64 100644 --- a/libopie2/opiedb/osqlmanager.h +++ b/libopie2/opiedb/osqlmanager.h | |||
@@ -1,26 +1,28 @@ | |||
1 | 1 | ||
2 | #ifndef OSQL_MANAGER_H | 2 | #ifndef OSQL_MANAGER_H |
3 | #define OSQL_MANAGER_H | 3 | #define OSQL_MANAGER_H |
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | #include "osqlbackend.h" | 8 | #include "osqlbackend.h" |
9 | 9 | ||
10 | 10 | ||
11 | namespace Opie { | ||
12 | namespace DB { | ||
11 | /** | 13 | /** |
12 | * OSQLManager is responsible for loading | 14 | * OSQLManager is responsible for loading |
13 | * and unloading, querying different OSQL | 15 | * and unloading, querying different OSQL |
14 | * services | 16 | * services |
15 | * Load a OSQLDriver and delete it yourself | 17 | * Load a OSQLDriver and delete it yourself |
16 | * | 18 | * |
17 | */ | 19 | */ |
18 | class OSQLDriver; | 20 | class OSQLDriver; |
19 | class OSQLManager : public QObject { | 21 | class OSQLManager : public QObject { |
20 | Q_OBJECT | 22 | Q_OBJECT |
21 | public: | 23 | public: |
22 | /** | 24 | /** |
23 | * Empty c'tor | 25 | * Empty c'tor |
24 | */ | 26 | */ |
25 | OSQLManager(); | 27 | OSQLManager(); |
26 | 28 | ||
@@ -46,19 +48,23 @@ public: | |||
46 | 48 | ||
47 | /** | 49 | /** |
48 | * register path to the search path list | 50 | * register path to the search path list |
49 | * When querying for services we scan all the | 51 | * When querying for services we scan all the |
50 | * registered path for backends | 52 | * registered path for backends |
51 | */ | 53 | */ |
52 | void registerPath( const QString& path ); | 54 | void registerPath( const QString& path ); |
53 | 55 | ||
54 | /** | 56 | /** |
55 | * unregisterPath from the search path list | 57 | * unregisterPath from the search path list |
56 | */ | 58 | */ |
57 | bool unregisterPath( const QString& path ); | 59 | bool unregisterPath( const QString& path ); |
58 | private: | 60 | private: |
59 | OSQLBackEnd::ValueList builtIn()const; | 61 | OSQLBackEnd::ValueList builtIn()const; |
60 | OSQLBackEnd::ValueList m_list; | 62 | OSQLBackEnd::ValueList m_list; |
61 | QStringList m_path; | 63 | QStringList m_path; |
64 | class Private; | ||
65 | Private *d; | ||
62 | }; | 66 | }; |
67 | } | ||
68 | } | ||
63 | 69 | ||
64 | #endif | 70 | #endif |
diff --git a/libopie2/opiedb/osqlquery.cpp b/libopie2/opiedb/osqlquery.cpp index ecd53f2..8270c4c 100644 --- a/libopie2/opiedb/osqlquery.cpp +++ b/libopie2/opiedb/osqlquery.cpp | |||
@@ -1,17 +1,19 @@ | |||
1 | 1 | ||
2 | #include "osqlquery.h" | 2 | #include "osqlquery.h" |
3 | 3 | ||
4 | using namespace Opie::DB; | ||
5 | |||
4 | OSQLQuery::OSQLQuery() { | 6 | OSQLQuery::OSQLQuery() { |
5 | } | 7 | } |
6 | OSQLQuery::~OSQLQuery() { | 8 | OSQLQuery::~OSQLQuery() { |
7 | } | 9 | } |
8 | 10 | ||
9 | OSQLRawQuery::OSQLRawQuery(const QString& query) | 11 | OSQLRawQuery::OSQLRawQuery(const QString& query) |
10 | : OSQLQuery(), m_query( query ) { | 12 | : OSQLQuery(), m_query( query ) { |
11 | 13 | ||
12 | } | 14 | } |
13 | OSQLRawQuery::~OSQLRawQuery() { | 15 | OSQLRawQuery::~OSQLRawQuery() { |
14 | } | 16 | } |
15 | QString OSQLRawQuery::query()const { | 17 | QString OSQLRawQuery::query()const { |
16 | return m_query; | 18 | return m_query; |
17 | } | 19 | } |
diff --git a/libopie2/opiedb/osqlquery.h b/libopie2/opiedb/osqlquery.h index 63c26b0..0265d2b 100644 --- a/libopie2/opiedb/osqlquery.h +++ b/libopie2/opiedb/osqlquery.h | |||
@@ -1,25 +1,28 @@ | |||
1 | 1 | ||
2 | #ifndef OSQL_QUERY_H | 2 | #ifndef OSQL_QUERY_H |
3 | #define OSQL_QUERY_H | 3 | #define OSQL_QUERY_H |
4 | 4 | ||
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qvaluelist.h> | 6 | #include <qvaluelist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | 8 | ||
9 | 9 | ||
10 | namespace Opie { | ||
11 | namespace DB { | ||
12 | |||
10 | /** I'm not happy with them | 13 | /** I'm not happy with them |
11 | class OSQLQueryOrder { | 14 | class OSQLQueryOrder { |
12 | public: | 15 | public: |
13 | typedef QValueList<OSQLQueryOrder> ValueList; | 16 | typedef QValueList<OSQLQueryOrder> ValueList; |
14 | OSQLQueryOrder(const QString& table = QString::null ); | 17 | OSQLQueryOrder(const QString& table = QString::null ); |
15 | OSQLQueryOrder( const OSQLQueryOrder& ); | 18 | OSQLQueryOrder( const OSQLQueryOrder& ); |
16 | ~OSQLQueryOrder(); | 19 | ~OSQLQueryOrder(); |
17 | void setOrderFields( const QStringList& list ); | 20 | void setOrderFields( const QStringList& list ); |
18 | void setValue( const QString& fieldName, const QString& Value ); | 21 | void setValue( const QString& fieldName, const QString& Value ); |
19 | void setValues( const QMap<QString, QString>& ); | 22 | void setValues( const QMap<QString, QString>& ); |
20 | QMap<QString, QString> orders() const; | 23 | QMap<QString, QString> orders() const; |
21 | QString orderStatement()const; | 24 | QString orderStatement()const; |
22 | OSQLQueryOrder &operator=(const OSQLQueryOrder& ); | 25 | OSQLQueryOrder &operator=(const OSQLQueryOrder& ); |
23 | private: | 26 | private: |
24 | QMap<QString, QString> m_fields; | 27 | QMap<QString, QString> m_fields; |
25 | class OSQLQueryOrderPrivate; | 28 | class OSQLQueryOrderPrivate; |
@@ -34,32 +37,35 @@ public: | |||
34 | ~OSQLWhere(); | 37 | ~OSQLWhere(); |
35 | void setExpression(const QString& key, enum Vergleiche, const QString& ); | 38 | void setExpression(const QString& key, enum Vergleiche, const QString& ); |
36 | QString statement()const; | 39 | QString statement()const; |
37 | private: | 40 | private: |
38 | int m_vergleich; | 41 | int m_vergleich; |
39 | const QString& m_left; | 42 | const QString& m_left; |
40 | const QString& m_right; | 43 | const QString& m_right; |
41 | 44 | ||
42 | }; | 45 | }; |
43 | */ | 46 | */ |
44 | class OSQLQuery { | 47 | class OSQLQuery { |
45 | public: | 48 | public: |
46 | OSQLQuery(); | 49 | OSQLQuery(); |
47 | virtual ~OSQLQuery(); | 50 | virtual ~OSQLQuery(); |
48 | 51 | ||
49 | virtual QString query()const = 0; | 52 | virtual QString query()const = 0; |
53 | private: | ||
54 | class Private; | ||
55 | Private *d; | ||
50 | }; | 56 | }; |
51 | 57 | ||
52 | class OSQLRawQuery : public OSQLQuery { | 58 | class OSQLRawQuery : public OSQLQuery { |
53 | public: | 59 | public: |
54 | OSQLRawQuery( const QString& query ); | 60 | OSQLRawQuery( const QString& query ); |
55 | ~OSQLRawQuery(); | 61 | ~OSQLRawQuery(); |
56 | QString query() const; | 62 | QString query() const; |
57 | private: | 63 | private: |
58 | class OSQLRawQueryPrivate; | 64 | class OSQLRawQueryPrivate; |
59 | OSQLRawQueryPrivate* d; | 65 | OSQLRawQueryPrivate* d; |
60 | QString m_query; | 66 | QString m_query; |
61 | 67 | ||
62 | }; | 68 | }; |
63 | /* I'm not happy with them again | 69 | /* I'm not happy with them again |
64 | class OSQLSelectQuery : public OSQLQuery { | 70 | class OSQLSelectQuery : public OSQLQuery { |
65 | public: | 71 | public: |
@@ -106,17 +112,19 @@ private: | |||
106 | 112 | ||
107 | }; | 113 | }; |
108 | class OSQLUpdateQuery : public OSQLQuery { | 114 | class OSQLUpdateQuery : public OSQLQuery { |
109 | public: | 115 | public: |
110 | OSQLUpdateQuery( const QString& table ); | 116 | OSQLUpdateQuery( const QString& table ); |
111 | ~OSQLUpdateQuery(); | 117 | ~OSQLUpdateQuery(); |
112 | void setWhere( const OSQLWhere& ); | 118 | void setWhere( const OSQLWhere& ); |
113 | void setWheres( const OSQLWhere::ValueList& ); | 119 | void setWheres( const OSQLWhere::ValueList& ); |
114 | */ | 120 | */ |
115 | /* replaces all previous set Values */ | 121 | /* replaces all previous set Values */ |
116 | /* | 122 | /* |
117 | void setValue( const QString& field, const QString& value ); | 123 | void setValue( const QString& field, const QString& value ); |
118 | void setValue( const QMap<QString, QString> &fields ); | 124 | void setValue( const QMap<QString, QString> &fields ); |
119 | QString query() const; | 125 | QString query() const; |
120 | }; | 126 | }; |
121 | */ | 127 | */ |
128 | } | ||
129 | } | ||
122 | #endif | 130 | #endif |
diff --git a/libopie2/opiedb/osqlresult.cpp b/libopie2/opiedb/osqlresult.cpp index 42da356..bad7d8b 100644 --- a/libopie2/opiedb/osqlresult.cpp +++ b/libopie2/opiedb/osqlresult.cpp | |||
@@ -1,19 +1,21 @@ | |||
1 | 1 | ||
2 | #include "osqlresult.h" | 2 | #include "osqlresult.h" |
3 | 3 | ||
4 | using namespace Opie::DB; | ||
5 | |||
4 | OSQLResultItem::OSQLResultItem( const TableString& string, | 6 | OSQLResultItem::OSQLResultItem( const TableString& string, |
5 | const TableInt& Int) | 7 | const TableInt& Int) |
6 | : m_string( string ), m_int( Int ) | 8 | : m_string( string ), m_int( Int ) |
7 | { | 9 | { |
8 | 10 | ||
9 | } | 11 | } |
10 | OSQLResultItem::~OSQLResultItem() { | 12 | OSQLResultItem::~OSQLResultItem() { |
11 | } | 13 | } |
12 | OSQLResultItem::OSQLResultItem( const OSQLResultItem& item) { | 14 | OSQLResultItem::OSQLResultItem( const OSQLResultItem& item) { |
13 | *this = item; | 15 | *this = item; |
14 | } | 16 | } |
15 | OSQLResultItem &OSQLResultItem::operator=( const OSQLResultItem& other) { | 17 | OSQLResultItem &OSQLResultItem::operator=( const OSQLResultItem& other) { |
16 | m_string = other.m_string; | 18 | m_string = other.m_string; |
17 | m_int = other.m_int; | 19 | m_int = other.m_int; |
18 | return *this; | 20 | return *this; |
19 | } | 21 | } |
diff --git a/libopie2/opiedb/osqlresult.h b/libopie2/opiedb/osqlresult.h index 9c9efa2..fc6f01a 100644 --- a/libopie2/opiedb/osqlresult.h +++ b/libopie2/opiedb/osqlresult.h | |||
@@ -1,25 +1,29 @@ | |||
1 | #ifndef OSQL_RESULT_H | 1 | #ifndef OSQL_RESULT_H |
2 | #define OSQL_RESULT_H | 2 | #define OSQL_RESULT_H |
3 | 3 | ||
4 | #include <qdatetime.h> | 4 | #include <qdatetime.h> |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qvaluelist.h> | 6 | #include <qvaluelist.h> |
7 | 7 | ||
8 | 8 | ||
9 | #include "osqlerror.h" | 9 | #include "osqlerror.h" |
10 | |||
11 | namespace Opie { | ||
12 | namespace DB { | ||
13 | |||
10 | /** | 14 | /** |
11 | * ResultItem represents one row of the resulting answer | 15 | * ResultItem represents one row of the resulting answer |
12 | */ | 16 | */ |
13 | class OSQLResultItem { | 17 | class OSQLResultItem { |
14 | public: | 18 | public: |
15 | typedef QValueList<OSQLResultItem> ValueList; | 19 | typedef QValueList<OSQLResultItem> ValueList; |
16 | /** | 20 | /** |
17 | * TableString is used to establish the relations | 21 | * TableString is used to establish the relations |
18 | * between the column name and the real item | 22 | * between the column name and the real item |
19 | */ | 23 | */ |
20 | typedef QMap<QString, QString> TableString; | 24 | typedef QMap<QString, QString> TableString; |
21 | 25 | ||
22 | /** | 26 | /** |
23 | * TableInt is used to establish a relation between a | 27 | * TableInt is used to establish a relation between a |
24 | * position of a column and the row value | 28 | * position of a column and the row value |
25 | */ | 29 | */ |
@@ -94,19 +98,23 @@ public: | |||
94 | OSQLError::ValueList errors()const; | 98 | OSQLError::ValueList errors()const; |
95 | OSQLResultItem::ValueList results()const; | 99 | OSQLResultItem::ValueList results()const; |
96 | 100 | ||
97 | void setState( enum State state ); | 101 | void setState( enum State state ); |
98 | void setErrors( const OSQLError::ValueList& error ); | 102 | void setErrors( const OSQLError::ValueList& error ); |
99 | void setResults( const OSQLResultItem::ValueList& result ); | 103 | void setResults( const OSQLResultItem::ValueList& result ); |
100 | 104 | ||
101 | OSQLResultItem first(); | 105 | OSQLResultItem first(); |
102 | OSQLResultItem next(); | 106 | OSQLResultItem next(); |
103 | bool atEnd(); | 107 | bool atEnd(); |
104 | OSQLResultItem::ValueList::ConstIterator iterator()const; | 108 | OSQLResultItem::ValueList::ConstIterator iterator()const; |
105 | private: | 109 | private: |
106 | enum State m_state; | 110 | enum State m_state; |
107 | OSQLResultItem::ValueList m_list; | 111 | OSQLResultItem::ValueList m_list; |
108 | OSQLError::ValueList m_error; | 112 | OSQLError::ValueList m_error; |
109 | OSQLResultItem::ValueList::Iterator it; | 113 | OSQLResultItem::ValueList::Iterator it; |
114 | class Private; | ||
115 | Private *d; | ||
110 | }; | 116 | }; |
111 | 117 | ||
118 | } | ||
119 | } | ||
112 | #endif | 120 | #endif |
diff --git a/libopie2/opiedb/osqltable.cpp b/libopie2/opiedb/osqltable.cpp index cde40f4..117cf21 100644 --- a/libopie2/opiedb/osqltable.cpp +++ b/libopie2/opiedb/osqltable.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | #include "osqltable.h" | 1 | #include "osqltable.h" |
2 | 2 | ||
3 | using namespace Opie::DB; | ||
4 | |||
3 | OSQLTableItem::OSQLTableItem() {} | 5 | OSQLTableItem::OSQLTableItem() {} |
4 | OSQLTableItem::OSQLTableItem( enum Type type, | 6 | OSQLTableItem::OSQLTableItem( enum Type type, |
5 | const QString& field, | 7 | const QString& field, |
6 | const QVariant& var) | 8 | const QVariant& var) |
7 | : m_type( type ), m_field( field ), m_var( var ) | 9 | : m_type( type ), m_field( field ), m_var( var ) |
8 | { | 10 | { |
9 | 11 | ||
10 | } | 12 | } |
11 | OSQLTableItem::~OSQLTableItem() {} | 13 | OSQLTableItem::~OSQLTableItem() {} |
12 | OSQLTableItem::OSQLTableItem( const OSQLTableItem& item) { | 14 | OSQLTableItem::OSQLTableItem( const OSQLTableItem& item) { |
13 | *this = item; | 15 | *this = item; |
14 | } | 16 | } |
15 | OSQLTableItem &OSQLTableItem::operator=(const OSQLTableItem& other) { | 17 | OSQLTableItem &OSQLTableItem::operator=(const OSQLTableItem& other) { |
16 | m_var = other.m_var; | 18 | m_var = other.m_var; |
17 | m_field = other.m_field; | 19 | m_field = other.m_field; |
18 | m_type = other.m_type; | 20 | m_type = other.m_type; |
diff --git a/libopie2/opiedb/osqltable.h b/libopie2/opiedb/osqltable.h index 87f7e74..86c30dd 100644 --- a/libopie2/opiedb/osqltable.h +++ b/libopie2/opiedb/osqltable.h | |||
@@ -1,23 +1,25 @@ | |||
1 | #ifndef OSQL_TABLE_H | 1 | #ifndef OSQL_TABLE_H |
2 | #define OSQL_TABLE_H | 2 | #define OSQL_TABLE_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qvaluelist.h> | 5 | #include <qvaluelist.h> |
6 | #include <qvariant.h> | 6 | #include <qvariant.h> |
7 | 7 | ||
8 | namespace Opie { | ||
9 | namespace DB { | ||
8 | /** | 10 | /** |
9 | * OSQLTableItem saves one column of a complete | 11 | * OSQLTableItem saves one column of a complete |
10 | * table | 12 | * table |
11 | */ | 13 | */ |
12 | class OSQLTableItem { | 14 | class OSQLTableItem { |
13 | public: | 15 | public: |
14 | typedef QValueList<OSQLTableItem> ValueList; | 16 | typedef QValueList<OSQLTableItem> ValueList; |
15 | /** | 17 | /** |
16 | * Type kinds ( to be extended ) | 18 | * Type kinds ( to be extended ) |
17 | */ | 19 | */ |
18 | enum Type { Undefined=-1, Integer=0, BigInteger =1, | 20 | enum Type { Undefined=-1, Integer=0, BigInteger =1, |
19 | Float = 2, VarChar = 4 }; | 21 | Float = 2, VarChar = 4 }; |
20 | /** | 22 | /** |
21 | * A constructor | 23 | * A constructor |
22 | * @param type the Type of the Column | 24 | * @param type the Type of the Column |
23 | * @param fieldName the Name of the Column | 25 | * @param fieldName the Name of the Column |
@@ -77,19 +79,24 @@ public: | |||
77 | 79 | ||
78 | /** | 80 | /** |
79 | * setColumns sets the Columns of the Table | 81 | * setColumns sets the Columns of the Table |
80 | */ | 82 | */ |
81 | void setColumns( const OSQLTableItem::ValueList& ); | 83 | void setColumns( const OSQLTableItem::ValueList& ); |
82 | 84 | ||
83 | /** | 85 | /** |
84 | * returns all columns of the table | 86 | * returns all columns of the table |
85 | */ | 87 | */ |
86 | OSQLTableItem::ValueList columns() const; | 88 | OSQLTableItem::ValueList columns() const; |
87 | 89 | ||
88 | QString tableName()const; | 90 | QString tableName()const; |
89 | 91 | ||
90 | private: | 92 | private: |
91 | QString m_table; | 93 | QString m_table; |
92 | OSQLTableItem::ValueList m_list; | 94 | OSQLTableItem::ValueList m_list; |
95 | class Private; | ||
96 | Private *d; | ||
93 | }; | 97 | }; |
94 | 98 | ||
99 | } | ||
100 | } | ||
101 | |||
95 | #endif | 102 | #endif |
diff --git a/libopie2/opiemm/opiemm.pro b/libopie2/opiemm/opiemm.pro index d6f54ee..ce30dfb 100644 --- a/libopie2/opiemm/opiemm.pro +++ b/libopie2/opiemm/opiemm.pro | |||
@@ -1,18 +1,18 @@ | |||
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 = osoundsystem.h | 4 | HEADERS = osoundsystem.h |
5 | SOURCES = osoundsystem.cpp | 5 | SOURCES = osoundsystem.cpp |
6 | INTERFACES = | 6 | INTERFACES = |
7 | TARGET = opiemm2 | 7 | TARGET = opiemm2 |
8 | VERSION = 1.8.2 | 8 | VERSION = 1.9.0 |
9 | INCLUDEPATH += $(OPIEDIR)/include | 9 | INCLUDEPATH += $(OPIEDIR)/include |
10 | DEPENDPATH += $(OPIEDIR)/include | 10 | DEPENDPATH += $(OPIEDIR)/include |
11 | 11 | ||
12 | !contains( platform, x11 ) { | 12 | !contains( platform, x11 ) { |
13 | include ( $(OPIEDIR)/include.pro ) | 13 | include ( $(OPIEDIR)/include.pro ) |
14 | } | 14 | } |
15 | 15 | ||
16 | contains( platform, x11 ) { | 16 | contains( platform, x11 ) { |
17 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 17 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
18 | } | 18 | } |
diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp index 51e088c..07f26c0 100644 --- a/libopie2/opiemm/osoundsystem.cpp +++ b/libopie2/opiemm/osoundsystem.cpp | |||
@@ -28,32 +28,34 @@ | |||
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/osoundsystem.h> | 32 | #include <opie2/osoundsystem.h> |
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | 34 | ||
35 | #include <errno.h> | 35 | #include <errno.h> |
36 | #include <fcntl.h> | 36 | #include <fcntl.h> |
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | #include <sys/soundcard.h> | 40 | #include <sys/soundcard.h> |
41 | #include <sys/stat.h> | 41 | #include <sys/stat.h> |
42 | 42 | ||
43 | 43 | ||
44 | using namespace Opie::Core; | ||
45 | using namespace Opie::MM; | ||
44 | /*====================================================================================== | 46 | /*====================================================================================== |
45 | * OSoundSystem | 47 | * OSoundSystem |
46 | *======================================================================================*/ | 48 | *======================================================================================*/ |
47 | 49 | ||
48 | OSoundSystem* OSoundSystem::_instance = 0; | 50 | OSoundSystem* OSoundSystem::_instance = 0; |
49 | 51 | ||
50 | OSoundSystem::OSoundSystem() | 52 | OSoundSystem::OSoundSystem() |
51 | { | 53 | { |
52 | odebug << "OSoundSystem::OSoundSystem()" << oendl; | 54 | odebug << "OSoundSystem::OSoundSystem()" << oendl; |
53 | synchronize(); | 55 | synchronize(); |
54 | } | 56 | } |
55 | 57 | ||
56 | void OSoundSystem::synchronize() | 58 | void OSoundSystem::synchronize() |
57 | { | 59 | { |
58 | // gather available interfaces by inspecting /dev | 60 | // gather available interfaces by inspecting /dev |
59 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 61 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
diff --git a/libopie2/opiemm/osoundsystem.h b/libopie2/opiemm/osoundsystem.h index 096d397..3c3b622 100644 --- a/libopie2/opiemm/osoundsystem.h +++ b/libopie2/opiemm/osoundsystem.h | |||
@@ -23,32 +23,35 @@ | |||
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 | 31 | ||
32 | #ifndef OSOUNDSYSTEM_H | 32 | #ifndef OSOUNDSYSTEM_H |
33 | #define OSOUNDSYSTEM_H | 33 | #define OSOUNDSYSTEM_H |
34 | 34 | ||
35 | #include <qobject.h> | 35 | #include <qobject.h> |
36 | #include <qdict.h> | 36 | #include <qdict.h> |
37 | #include <qmap.h> | 37 | #include <qmap.h> |
38 | 38 | ||
39 | namespace Opie { | ||
40 | namespace MM { | ||
41 | |||
39 | class OAudioInterface; | 42 | class OAudioInterface; |
40 | class OMixerInterface; | 43 | class OMixerInterface; |
41 | class OSoundCard; | 44 | class OSoundCard; |
42 | 45 | ||
43 | /*====================================================================================== | 46 | /*====================================================================================== |
44 | * OSoundSystem | 47 | * OSoundSystem |
45 | *======================================================================================*/ | 48 | *======================================================================================*/ |
46 | 49 | ||
47 | /** | 50 | /** |
48 | * @brief A container class for all audio interfaces | 51 | * @brief A container class for all audio interfaces |
49 | * | 52 | * |
50 | * This class provides access to all available audio/midi/sequencer interfaces of your computer. | 53 | * This class provides access to all available audio/midi/sequencer interfaces of your computer. |
51 | * | 54 | * |
52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 55 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
53 | */ | 56 | */ |
54 | class OSoundSystem : public QObject | 57 | class OSoundSystem : public QObject |
@@ -77,32 +80,34 @@ class OSoundSystem : public QObject | |||
77 | * @see OAudioInterface | 80 | * @see OAudioInterface |
78 | */ | 81 | */ |
79 | OSoundCard* card( const QString& interface ) const; | 82 | OSoundCard* card( const QString& interface ) const; |
80 | /** | 83 | /** |
81 | * @internal Rebuild the internal interface database | 84 | * @internal Rebuild the internal interface database |
82 | * @note Sometimes it might be useful to call this from client code, | 85 | * @note Sometimes it might be useful to call this from client code, |
83 | * e.g. after issuing a cardctl insert | 86 | * e.g. after issuing a cardctl insert |
84 | */ | 87 | */ |
85 | void synchronize(); | 88 | void synchronize(); |
86 | 89 | ||
87 | protected: | 90 | protected: |
88 | OSoundSystem(); | 91 | OSoundSystem(); |
89 | 92 | ||
90 | private: | 93 | private: |
91 | static OSoundSystem* _instance; | 94 | static OSoundSystem* _instance; |
92 | CardMap _interfaces; | 95 | CardMap _interfaces; |
96 | class Private; | ||
97 | Private *d; | ||
93 | }; | 98 | }; |
94 | 99 | ||
95 | 100 | ||
96 | /*====================================================================================== | 101 | /*====================================================================================== |
97 | * OSoundCard | 102 | * OSoundCard |
98 | *======================================================================================*/ | 103 | *======================================================================================*/ |
99 | 104 | ||
100 | class OSoundCard : public QObject | 105 | class OSoundCard : public QObject |
101 | { | 106 | { |
102 | Q_OBJECT | 107 | Q_OBJECT |
103 | 108 | ||
104 | public: | 109 | public: |
105 | /** | 110 | /** |
106 | * Constructor. Normally you don't create @ref OSoundCard objects yourself, | 111 | * Constructor. Normally you don't create @ref OSoundCard objects yourself, |
107 | * but access them via @ref OSoundSystem::card(). | 112 | * but access them via @ref OSoundSystem::card(). |
108 | */ | 113 | */ |
@@ -111,58 +116,64 @@ class OSoundCard : public QObject | |||
111 | * Destructor. | 116 | * Destructor. |
112 | */ | 117 | */ |
113 | virtual ~OSoundCard(); | 118 | virtual ~OSoundCard(); |
114 | 119 | ||
115 | bool hasMixer() const { return _audio; }; | 120 | bool hasMixer() const { return _audio; }; |
116 | bool hasAudio() const { return _mixer; }; | 121 | bool hasAudio() const { return _mixer; }; |
117 | 122 | ||
118 | OAudioInterface* audio() const { return _audio; }; | 123 | OAudioInterface* audio() const { return _audio; }; |
119 | OMixerInterface* mixer() const { return _mixer; }; | 124 | OMixerInterface* mixer() const { return _mixer; }; |
120 | 125 | ||
121 | protected: | 126 | protected: |
122 | OAudioInterface* _audio; | 127 | OAudioInterface* _audio; |
123 | OMixerInterface* _mixer; | 128 | OMixerInterface* _mixer; |
124 | 129 | ||
125 | private: | 130 | private: |
126 | void init(); | 131 | void init(); |
132 | private: | ||
133 | class Private; | ||
134 | Private *d; | ||
127 | }; | 135 | }; |
128 | 136 | ||
129 | /*====================================================================================== | 137 | /*====================================================================================== |
130 | * OAudioInterface | 138 | * OAudioInterface |
131 | *======================================================================================*/ | 139 | *======================================================================================*/ |
132 | 140 | ||
133 | class OAudioInterface : public QObject | 141 | class OAudioInterface : public QObject |
134 | { | 142 | { |
135 | Q_OBJECT | 143 | Q_OBJECT |
136 | 144 | ||
137 | public: | 145 | public: |
138 | /** | 146 | /** |
139 | * Constructor. Normally you don't create @ref OAudioInterface objects yourself, | 147 | * Constructor. Normally you don't create @ref OAudioInterface objects yourself, |
140 | * but access them via the @ref OSoundCard interface. | 148 | * but access them via the @ref OSoundCard interface. |
141 | */ | 149 | */ |
142 | OAudioInterface( QObject* parent, const char* name ); | 150 | OAudioInterface( QObject* parent, const char* name ); |
143 | /** | 151 | /** |
144 | * Destructor. | 152 | * Destructor. |
145 | */ | 153 | */ |
146 | virtual ~OAudioInterface(); | 154 | virtual ~OAudioInterface(); |
147 | 155 | ||
148 | protected: | 156 | protected: |
149 | const int _sfd; | 157 | const int _sfd; |
150 | 158 | ||
151 | private: | 159 | private: |
152 | void init(); | 160 | void init(); |
161 | private: | ||
162 | class Private; | ||
163 | Private *d; | ||
153 | }; | 164 | }; |
154 | 165 | ||
155 | 166 | ||
156 | /*====================================================================================== | 167 | /*====================================================================================== |
157 | * OMixerInterface | 168 | * OMixerInterface |
158 | *======================================================================================*/ | 169 | *======================================================================================*/ |
159 | 170 | ||
160 | class OMixerInterface : public QObject | 171 | class OMixerInterface : public QObject |
161 | { | 172 | { |
162 | Q_OBJECT | 173 | Q_OBJECT |
163 | 174 | ||
164 | public: | 175 | public: |
165 | 176 | ||
166 | typedef QMap<QString,int>::ConstIterator ChannelIterator; | 177 | typedef QMap<QString,int>::ConstIterator ChannelIterator; |
167 | 178 | ||
168 | /** | 179 | /** |
@@ -197,20 +208,26 @@ class OMixerInterface : public QObject | |||
197 | * Set the @a left and @a right volumes for @a channel. | 208 | * Set the @a left and @a right volumes for @a channel. |
198 | * If no value for right is given, the value for left is taken for that. | 209 | * If no value for right is given, the value for left is taken for that. |
199 | */ | 210 | */ |
200 | void setVolume( const QString& channel, int left, int right = -1 ); | 211 | void setVolume( const QString& channel, int left, int right = -1 ); |
201 | /** | 212 | /** |
202 | * @returns the volume of @a channel or -1, if the channel doesn't exist. | 213 | * @returns the volume of @a channel or -1, if the channel doesn't exist. |
203 | * @note You might want to use @ref hasChannel() to check if a channel exists. | 214 | * @note You might want to use @ref hasChannel() to check if a channel exists. |
204 | */ | 215 | */ |
205 | int volume( const QString& channel ) const; | 216 | int volume( const QString& channel ) const; |
206 | 217 | ||
207 | protected: | 218 | protected: |
208 | int _fd; | 219 | int _fd; |
209 | QMap<QString, int> _channels; | 220 | QMap<QString, int> _channels; |
210 | 221 | ||
211 | private: | 222 | private: |
212 | void init(); | 223 | void init(); |
224 | private: | ||
225 | class Private; | ||
226 | Private *d; | ||
213 | }; | 227 | }; |
214 | 228 | ||
229 | } | ||
230 | } | ||
231 | |||
215 | #endif // OSOUNDSYSTEM_H | 232 | #endif // OSOUNDSYSTEM_H |
216 | 233 | ||
diff --git a/libopie2/opienet/802_11_user.h b/libopie2/opienet/802_11_user.h index 7ae27c5..1a9a7a0 100644 --- a/libopie2/opienet/802_11_user.h +++ b/libopie2/opienet/802_11_user.h | |||
@@ -442,17 +442,18 @@ struct ctrl_end_t { | |||
442 | #define CTRL_END_LEN(2+2+6+6+4) | 442 | #define CTRL_END_LEN(2+2+6+6+4) |
443 | 443 | ||
444 | struct ctrl_end_ack_t { | 444 | struct ctrl_end_ack_t { |
445 | u_int16_tfc; | 445 | u_int16_tfc; |
446 | u_int16_tduration; | 446 | u_int16_tduration; |
447 | u_int8_tra[6]; | 447 | u_int8_tra[6]; |
448 | u_int8_tbssid[6]; | 448 | u_int8_tbssid[6]; |
449 | u_int8_tfcs[4]; | 449 | u_int8_tfcs[4]; |
450 | }; | 450 | }; |
451 | 451 | ||
452 | #define CTRL_END_ACK_LEN(2+2+6+6+4) | 452 | #define CTRL_END_ACK_LEN(2+2+6+6+4) |
453 | 453 | ||
454 | #define IV_IV(iv)((iv) & 0xFFFFFF) | 454 | #define IV_IV(iv)((iv) & 0xFFFFFF) |
455 | #define IV_PAD(iv)(((iv) >> 24) & 0x3F) | 455 | #define IV_PAD(iv)(((iv) >> 24) & 0x3F) |
456 | #define IV_KEYID(iv)(((iv) >> 30) & 0x03) | 456 | #define IV_KEYID(iv)(((iv) >> 30) & 0x03) |
457 | 457 | ||
458 | |||
458 | #endif | 459 | #endif |
diff --git a/libopie2/opienet/dhcp.h b/libopie2/opienet/dhcp.h index 368e375..6ba4c53 100644 --- a/libopie2/opienet/dhcp.h +++ b/libopie2/opienet/dhcp.h | |||
@@ -29,32 +29,33 @@ | |||
29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
30 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 30 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
31 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 31 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
33 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. |
35 | * | 35 | * |
36 | * This software has been written for the Internet Software Consortium | 36 | * This software has been written for the Internet Software Consortium |
37 | * by Ted Lemon in cooperation with Vixie Enterprises. To learn more | 37 | * by Ted Lemon in cooperation with Vixie Enterprises. To learn more |
38 | * about the Internet Software Consortium, see ``http://www.isc.org''. | 38 | * about the Internet Software Consortium, see ``http://www.isc.org''. |
39 | * To learn more about Vixie Enterprises, see ``http://www.vix.com''. | 39 | * To learn more about Vixie Enterprises, see ``http://www.vix.com''. |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #ifndef DHCP_H | 42 | #ifndef DHCP_H |
43 | #define DHCP_H | 43 | #define DHCP_H |
44 | 44 | ||
45 | |||
45 | #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ | 46 | #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ |
46 | 20 + /* IP header */ \ | 47 | 20 + /* IP header */ \ |
47 | 8) /* UDP header */ | 48 | 8) /* UDP header */ |
48 | #define DHCP_SNAME_LEN 64 | 49 | #define DHCP_SNAME_LEN 64 |
49 | #define DHCP_FILE_LEN 128 | 50 | #define DHCP_FILE_LEN 128 |
50 | #define DHCP_FIXED_NON_UDP236 | 51 | #define DHCP_FIXED_NON_UDP236 |
51 | #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) | 52 | #define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) |
52 | /* Everything but options. */ | 53 | /* Everything but options. */ |
53 | #define DHCP_MTU_MAX 1500 | 54 | #define DHCP_MTU_MAX 1500 |
54 | #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) | 55 | #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) |
55 | 56 | ||
56 | #define BOOTP_MIN_LEN 300 | 57 | #define BOOTP_MIN_LEN 300 |
57 | #define DHCP_MIN_LEN 548 | 58 | #define DHCP_MIN_LEN 548 |
58 | 59 | ||
59 | struct dhcp_packet { | 60 | struct dhcp_packet { |
60 | u_int8_t op; /* 0: Message opcode/type */ | 61 | u_int8_t op; /* 0: Message opcode/type */ |
@@ -184,18 +185,19 @@ struct dhcp_packet { | |||
184 | /* Relay Agent Information option subtypes: */ | 185 | /* Relay Agent Information option subtypes: */ |
185 | #define RAI_CIRCUIT_ID1 | 186 | #define RAI_CIRCUIT_ID1 |
186 | #define RAI_REMOTE_ID2 | 187 | #define RAI_REMOTE_ID2 |
187 | #define RAI_AGENT_ID3 | 188 | #define RAI_AGENT_ID3 |
188 | 189 | ||
189 | /* FQDN suboptions: */ | 190 | /* FQDN suboptions: */ |
190 | #define FQDN_NO_CLIENT_UPDATE 1 | 191 | #define FQDN_NO_CLIENT_UPDATE 1 |
191 | #define FQDN_SERVER_UPDATE 2 | 192 | #define FQDN_SERVER_UPDATE 2 |
192 | #define FQDN_ENCODED 3 | 193 | #define FQDN_ENCODED 3 |
193 | #define FQDN_RCODE1 4 | 194 | #define FQDN_RCODE1 4 |
194 | #define FQDN_RCODE2 5 | 195 | #define FQDN_RCODE2 5 |
195 | #define FQDN_HOSTNAME 6 | 196 | #define FQDN_HOSTNAME 6 |
196 | #define FQDN_DOMAINNAME 7 | 197 | #define FQDN_DOMAINNAME 7 |
197 | #define FQDN_FQDN 8 | 198 | #define FQDN_FQDN 8 |
198 | #define FQDN_SUBOPTION_COUNT 8 | 199 | #define FQDN_SUBOPTION_COUNT 8 |
199 | 200 | ||
201 | |||
200 | #endif | 202 | #endif |
201 | 203 | ||
diff --git a/libopie2/opienet/odebugmapper.cpp b/libopie2/opienet/odebugmapper.cpp index 7e4ab2b..f679afb 100644 --- a/libopie2/opienet/odebugmapper.cpp +++ b/libopie2/opienet/odebugmapper.cpp | |||
@@ -1,25 +1,31 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include "odebugmapper.h" | 8 | #include "odebugmapper.h" |
9 | 9 | ||
10 | using namespace Opie::Core; | ||
11 | |||
12 | namespace Opie { | ||
13 | namespace Net { | ||
14 | namespace Private { | ||
15 | |||
10 | DebugMapper::DebugMapper() | 16 | DebugMapper::DebugMapper() |
11 | { | 17 | { |
12 | odebug << "DebugMapper::DebugMapper()" << oendl; | 18 | odebug << "DebugMapper::DebugMapper()" << oendl; |
13 | 19 | ||
14 | 20 | ||
15 | _map.insert( 0x8902, new QString("SIOCSPGRP") ); | 21 | _map.insert( 0x8902, new QString("SIOCSPGRP") ); |
16 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); | 22 | _map.insert( 0x8904, new QString("SIOCGPGRP") ); |
17 | _map.insert( 0x8905, new QString("SIOCATMARK") ); | 23 | _map.insert( 0x8905, new QString("SIOCATMARK") ); |
18 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); | 24 | _map.insert( 0x8906, new QString("SIOCGSTAMP") ); |
19 | _map.insert( 0x890B, new QString("SIOCADDRT") ); | 25 | _map.insert( 0x890B, new QString("SIOCADDRT") ); |
20 | _map.insert( 0x890C, new QString("SIOCDELRT") ); | 26 | _map.insert( 0x890C, new QString("SIOCDELRT") ); |
21 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); | 27 | _map.insert( 0x890D, new QString("SIOCRTMSG") ); |
22 | _map.insert( 0x8910, new QString("SIOCGIFNAME") ); | 28 | _map.insert( 0x8910, new QString("SIOCGIFNAME") ); |
23 | _map.insert( 0x8911, new QString("SIOCSIFLINK") ); | 29 | _map.insert( 0x8911, new QString("SIOCSIFLINK") ); |
24 | _map.insert( 0x8912, new QString("SIOCGIFCONF") ); | 30 | _map.insert( 0x8912, new QString("SIOCGIFCONF") ); |
25 | _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); | 31 | _map.insert( 0x8913, new QString("SIOCGIFFLAGS") ); |
@@ -199,17 +205,19 @@ DebugMapper::~DebugMapper() | |||
199 | 205 | ||
200 | const QString& DebugMapper::map( int value ) const | 206 | const QString& DebugMapper::map( int value ) const |
201 | { | 207 | { |
202 | QString* result = _map[ value ]; | 208 | QString* result = _map[ value ]; |
203 | 209 | ||
204 | if ( !result ) | 210 | if ( !result ) |
205 | { | 211 | { |
206 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; | 212 | owarn << "DebugMapper::map() - value " << value << " is not found." << oendl; |
207 | return QString::null; | 213 | return QString::null; |
208 | } | 214 | } |
209 | else | 215 | else |
210 | { | 216 | { |
211 | return *result; | 217 | return *result; |
212 | } | 218 | } |
213 | } | 219 | } |
214 | 220 | ||
215 | 221 | } | |
222 | } | ||
223 | } | ||
diff --git a/libopie2/opienet/odebugmapper.h b/libopie2/opienet/odebugmapper.h index 66b331d..f47db47 100644 --- a/libopie2/opienet/odebugmapper.h +++ b/libopie2/opienet/odebugmapper.h | |||
@@ -1,26 +1,36 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> | 3 | * debug value mapper - generated by regen.py - (C) Michael 'Mickey' Lauer <mickey@vanille.de> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef DEBUGMAPPER_H | 6 | #ifndef DEBUGMAPPER_H |
7 | #define DEBUGMAPPER_H | 7 | #define DEBUGMAPPER_H |
8 | 8 | ||
9 | #include <qstring.h> | 9 | #include <qstring.h> |
10 | #include <qintdict.h> | 10 | #include <qintdict.h> |
11 | 11 | ||
12 | namespace Opie { | ||
13 | namespace Net { | ||
14 | namespace Private { | ||
15 | |||
12 | typedef QIntDict<QString> IntStringMap; | 16 | typedef QIntDict<QString> IntStringMap; |
13 | 17 | ||
14 | class DebugMapper | 18 | class DebugMapper |
15 | { | 19 | { |
16 | public: | 20 | public: |
17 | DebugMapper(); | 21 | DebugMapper(); |
18 | ~DebugMapper(); | 22 | ~DebugMapper(); |
19 | 23 | ||
20 | const QString& map( int value ) const; | 24 | const QString& map( int value ) const; |
21 | private: | 25 | private: |
22 | IntStringMap _map; | 26 | IntStringMap _map; |
27 | class Private; | ||
28 | Private *d; | ||
23 | }; | 29 | }; |
24 | 30 | ||
31 | } | ||
32 | } | ||
33 | } | ||
34 | |||
25 | #endif | 35 | #endif |
26 | 36 | ||
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index b93b752..209ec94 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -30,32 +30,36 @@ | |||
30 | 30 | ||
31 | #include "omanufacturerdb.h" | 31 | #include "omanufacturerdb.h" |
32 | 32 | ||
33 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 33 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
34 | 34 | ||
35 | /* OPIE */ | 35 | /* OPIE */ |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 37 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include <qfile.h> | 43 | #include <qfile.h> |
44 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
45 | 45 | ||
46 | using namespace Opie::Core; | ||
47 | namespace Opie { | ||
48 | namespace Net { | ||
49 | |||
46 | OManufacturerDB* OManufacturerDB::_instance = 0; | 50 | OManufacturerDB* OManufacturerDB::_instance = 0; |
47 | 51 | ||
48 | OManufacturerDB* OManufacturerDB::instance() | 52 | OManufacturerDB* OManufacturerDB::instance() |
49 | { | 53 | { |
50 | if ( !OManufacturerDB::_instance ) | 54 | if ( !OManufacturerDB::_instance ) |
51 | { | 55 | { |
52 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 56 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
53 | _instance = new OManufacturerDB(); | 57 | _instance = new OManufacturerDB(); |
54 | } | 58 | } |
55 | return _instance; | 59 | return _instance; |
56 | } | 60 | } |
57 | 61 | ||
58 | 62 | ||
59 | OManufacturerDB::OManufacturerDB() | 63 | OManufacturerDB::OManufacturerDB() |
60 | { | 64 | { |
61 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 65 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
@@ -120,16 +124,19 @@ OManufacturerDB::~OManufacturerDB() | |||
120 | { | 124 | { |
121 | } | 125 | } |
122 | 126 | ||
123 | 127 | ||
124 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const | 128 | const QString& OManufacturerDB::lookup( const QString& macaddr ) const |
125 | { | 129 | { |
126 | return manufacturers[macaddr.upper().left(8)]; | 130 | return manufacturers[macaddr.upper().left(8)]; |
127 | } | 131 | } |
128 | 132 | ||
129 | 133 | ||
130 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const | 134 | const QString& OManufacturerDB::lookupExt( const QString& macaddr ) const |
131 | { | 135 | { |
132 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); | 136 | QMap<QString,QString>::ConstIterator it = manufacturersExt.find( macaddr.upper().left(8) ); |
133 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; | 137 | return it == manufacturersExt.end() ? lookup( macaddr ) : *it; |
134 | } | 138 | } |
135 | 139 | ||
140 | } | ||
141 | } | ||
142 | |||
diff --git a/libopie2/opienet/omanufacturerdb.h b/libopie2/opienet/omanufacturerdb.h index c2712e5..5c1940e 100644 --- a/libopie2/opienet/omanufacturerdb.h +++ b/libopie2/opienet/omanufacturerdb.h | |||
@@ -20,50 +20,58 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OMANUFACTURERDB_H | 31 | #ifndef OMANUFACTURERDB_H |
32 | #define OMANUFACTURERDB_H | 32 | #define OMANUFACTURERDB_H |
33 | 33 | ||
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | 35 | ||
36 | namespace Opie { | ||
37 | namespace Net { | ||
38 | |||
36 | /** | 39 | /** |
37 | * @brief A Ethernet card vendor database. | 40 | * @brief A Ethernet card vendor database. |
38 | * | 41 | * |
39 | * This class encapsulates the lookup of Ethernet vendor given a | 42 | * This class encapsulates the lookup of Ethernet vendor given a |
40 | * certain Mac Address. Only the first three bytes define the vendor. | 43 | * certain Mac Address. Only the first three bytes define the vendor. |
41 | */ | 44 | */ |
42 | class OManufacturerDB | 45 | class OManufacturerDB |
43 | { | 46 | { |
44 | public: | 47 | public: |
45 | /** | 48 | /** |
46 | * @returns the one-and-only @ref OManufacturerDB instance. | 49 | * @returns the one-and-only @ref OManufacturerDB instance. |
47 | */ | 50 | */ |
48 | static OManufacturerDB* instance(); | 51 | static OManufacturerDB* instance(); |
49 | /** | 52 | /** |
50 | * @returns the short manufacturer string given a @a macaddr. | 53 | * @returns the short manufacturer string given a @a macaddr. |
51 | */ | 54 | */ |
52 | const QString& lookup( const QString& macaddr ) const; | 55 | const QString& lookup( const QString& macaddr ) const; |
53 | /** | 56 | /** |
54 | * @returns the enhanced manufacturer string given a @a macaddr. | 57 | * @returns the enhanced manufacturer string given a @a macaddr. |
55 | */ | 58 | */ |
56 | const QString& lookupExt( const QString& macaddr ) const; | 59 | const QString& lookupExt( const QString& macaddr ) const; |
57 | 60 | ||
58 | protected: | 61 | protected: |
59 | OManufacturerDB(); | 62 | OManufacturerDB(); |
60 | virtual ~OManufacturerDB(); | 63 | virtual ~OManufacturerDB(); |
61 | 64 | ||
62 | private: | 65 | private: |
63 | QMap<QString, QString> manufacturers; | 66 | QMap<QString, QString> manufacturers; |
64 | QMap<QString, QString> manufacturersExt; | 67 | QMap<QString, QString> manufacturersExt; |
65 | static OManufacturerDB* _instance; | 68 | static OManufacturerDB* _instance; |
69 | class Private; | ||
70 | Private *d; | ||
66 | }; | 71 | }; |
67 | 72 | ||
73 | } | ||
74 | } | ||
75 | |||
68 | #endif | 76 | #endif |
69 | 77 | ||
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 48cfa43..7794334 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -24,32 +24,35 @@ | |||
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 | 31 | ||
32 | #include <opie2/onetutils.h> | 32 | #include <opie2/onetutils.h> |
33 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
34 | #include <opie2/omanufacturerdb.h> | 34 | #include <opie2/omanufacturerdb.h> |
35 | 35 | ||
36 | #include <net/if.h> | 36 | #include <net/if.h> |
37 | #include <assert.h> | 37 | #include <assert.h> |
38 | #include <stdio.h> | 38 | #include <stdio.h> |
39 | 39 | ||
40 | namespace Opie { | ||
41 | namespace Net { | ||
42 | |||
40 | /*====================================================================================== | 43 | /*====================================================================================== |
41 | * OMacAddress | 44 | * OMacAddress |
42 | *======================================================================================*/ | 45 | *======================================================================================*/ |
43 | 46 | ||
44 | // static initializer for broadcast and unknown MAC Adresses | 47 | // static initializer for broadcast and unknown MAC Adresses |
45 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 48 | const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
46 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); | 49 | const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); |
47 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; | 50 | const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; |
48 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); | 51 | const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); |
49 | 52 | ||
50 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) | 53 | //TODO: Incorporate Ethernet Manufacturer database here! (inline or so) |
51 | 54 | ||
52 | OMacAddress::OMacAddress() | 55 | OMacAddress::OMacAddress() |
53 | { | 56 | { |
54 | memcpy( _bytes, __unknown, 6 ); | 57 | memcpy( _bytes, __unknown, 6 ); |
55 | } | 58 | } |
@@ -172,32 +175,35 @@ int OPrivateIOCTL::typeSetArgs() const | |||
172 | return _setargs & IW_PRIV_TYPE_MASK >> 12; | 175 | return _setargs & IW_PRIV_TYPE_MASK >> 12; |
173 | } | 176 | } |
174 | 177 | ||
175 | 178 | ||
176 | void OPrivateIOCTL::invoke() const | 179 | void OPrivateIOCTL::invoke() const |
177 | { | 180 | { |
178 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | 181 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); |
179 | } | 182 | } |
180 | 183 | ||
181 | 184 | ||
182 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) | 185 | void OPrivateIOCTL::setParameter( int num, u_int32_t value ) |
183 | { | 186 | { |
184 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; | 187 | u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; |
185 | arglist[num] = value; | 188 | arglist[num] = value; |
186 | } | 189 | } |
187 | 190 | ||
191 | |||
192 | |||
193 | namespace Private { | ||
188 | /*====================================================================================== | 194 | /*====================================================================================== |
189 | * assorted functions | 195 | * assorted functions |
190 | *======================================================================================*/ | 196 | *======================================================================================*/ |
191 | 197 | ||
192 | void dumpBytes( const unsigned char* data, int num ) | 198 | void dumpBytes( const unsigned char* data, int num ) |
193 | { | 199 | { |
194 | printf( "Dumping %d bytes @ %0x", num, data ); | 200 | printf( "Dumping %d bytes @ %0x", num, data ); |
195 | printf( "-------------------------------------------\n" ); | 201 | printf( "-------------------------------------------\n" ); |
196 | 202 | ||
197 | for ( int i = 0; i < num; ++i ) | 203 | for ( int i = 0; i < num; ++i ) |
198 | { | 204 | { |
199 | printf( "%02x ", data[i] ); | 205 | printf( "%02x ", data[i] ); |
200 | if ( !((i+1) % 32) ) printf( "\n" ); | 206 | if ( !((i+1) % 32) ) printf( "\n" ); |
201 | } | 207 | } |
202 | printf( "\n\n" ); | 208 | printf( "\n\n" ); |
203 | } | 209 | } |
@@ -217,16 +223,19 @@ int stringToMode( const QString& mode ) | |||
217 | 223 | ||
218 | 224 | ||
219 | QString modeToString( int mode ) | 225 | QString modeToString( int mode ) |
220 | { | 226 | { |
221 | switch ( mode ) | 227 | switch ( mode ) |
222 | { | 228 | { |
223 | case IW_MODE_AUTO: return "auto"; | 229 | case IW_MODE_AUTO: return "auto"; |
224 | case IW_MODE_ADHOC: return "adhoc"; | 230 | case IW_MODE_ADHOC: return "adhoc"; |
225 | case IW_MODE_INFRA: return "managed"; | 231 | case IW_MODE_INFRA: return "managed"; |
226 | case IW_MODE_MASTER: return "master"; | 232 | case IW_MODE_MASTER: return "master"; |
227 | case IW_MODE_REPEAT: return "repeater"; | 233 | case IW_MODE_REPEAT: return "repeater"; |
228 | case IW_MODE_SECOND: return "second"; | 234 | case IW_MODE_SECOND: return "second"; |
229 | case IW_MODE_MONITOR: return "monitor"; | 235 | case IW_MODE_MONITOR: return "monitor"; |
230 | default: assert( 0 ); | 236 | default: assert( 0 ); |
231 | } | 237 | } |
232 | } | 238 | } |
239 | } | ||
240 | } | ||
241 | } | ||
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index bddfab9..ca6815d 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -28,115 +28,130 @@ | |||
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef ONETUTILS_H | 32 | #ifndef ONETUTILS_H |
33 | #define ONETUTILS_H | 33 | #define ONETUTILS_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <qdict.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qhostaddress.h> | 38 | #include <qhostaddress.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> |
42 | 42 | ||
43 | struct ifreq; | 43 | struct ifreq; |
44 | |||
45 | namespace Opie { | ||
46 | namespace Net { | ||
47 | |||
44 | class OWirelessNetworkInterface; | 48 | class OWirelessNetworkInterface; |
45 | 49 | ||
46 | /*====================================================================================== | 50 | /*====================================================================================== |
47 | * OMacAddress | 51 | * OMacAddress |
48 | *======================================================================================*/ | 52 | *======================================================================================*/ |
49 | 53 | ||
50 | class OMacAddress | 54 | class OMacAddress |
51 | { | 55 | { |
52 | public: | 56 | public: |
53 | // QString c'tor? -zecke | 57 | // QString c'tor? -zecke |
54 | OMacAddress(); | 58 | OMacAddress(); |
55 | OMacAddress( unsigned char* ); | 59 | OMacAddress( unsigned char* ); |
56 | OMacAddress( const unsigned char* ); | 60 | OMacAddress( const unsigned char* ); |
57 | OMacAddress( struct ifreq& ); | 61 | OMacAddress( struct ifreq& ); |
58 | ~OMacAddress(); | 62 | ~OMacAddress(); |
59 | 63 | ||
60 | QString manufacturer() const; | 64 | QString manufacturer() const; |
61 | QString toString( bool substitute = false ) const; | 65 | QString toString( bool substitute = false ) const; |
62 | const unsigned char* native() const; | 66 | const unsigned char* native() const; |
63 | 67 | ||
64 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? | 68 | // no c'tor but this one why not make it a c'tor. it could also replace the others or is this the problem? |
65 | static OMacAddress fromString( const QString& ); | 69 | static OMacAddress fromString( const QString& ); |
66 | 70 | ||
67 | public: | 71 | public: |
68 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff | 72 | static const OMacAddress& broadcast; // ff:ff:ff:ff:ff:ff |
69 | static const OMacAddress& unknown; // 44:44:44:44:44:44 | 73 | static const OMacAddress& unknown; // 44:44:44:44:44:44 |
70 | 74 | ||
71 | private: | 75 | private: |
72 | unsigned char _bytes[6]; | 76 | unsigned char _bytes[6]; |
73 | 77 | ||
74 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 78 | friend bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | class Private; | ||
80 | Private *d; | ||
75 | 81 | ||
76 | }; | 82 | }; |
77 | 83 | ||
78 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 84 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
79 | 85 | ||
80 | 86 | ||
81 | /*====================================================================================== | 87 | /*====================================================================================== |
82 | * OHostAddress | 88 | * OHostAddress |
83 | *======================================================================================*/ | 89 | *======================================================================================*/ |
84 | 90 | ||
85 | class OHostAddress : public QHostAddress | 91 | class OHostAddress : public QHostAddress |
86 | { | 92 | { |
87 | /*public: | 93 | /*public: |
88 | OHostAddress(); | 94 | OHostAddress(); |
89 | ~OHostAddress(); | 95 | ~OHostAddress(); |
90 | */ | 96 | */ |
97 | private: | ||
98 | class Private; | ||
99 | Private *d; | ||
91 | }; | 100 | }; |
92 | 101 | ||
93 | 102 | ||
94 | /*====================================================================================== | 103 | /*====================================================================================== |
95 | * OPrivateIOCTL | 104 | * OPrivateIOCTL |
96 | *======================================================================================*/ | 105 | *======================================================================================*/ |
97 | 106 | ||
98 | class OPrivateIOCTL : public QObject | 107 | class OPrivateIOCTL : public QObject |
99 | { | 108 | { |
100 | public: | 109 | public: |
101 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); | 110 | OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ); |
102 | ~OPrivateIOCTL(); | 111 | ~OPrivateIOCTL(); |
103 | 112 | ||
104 | int numberGetArgs() const; | 113 | int numberGetArgs() const; |
105 | int typeGetArgs() const; | 114 | int typeGetArgs() const; |
106 | int numberSetArgs() const; | 115 | int numberSetArgs() const; |
107 | int typeSetArgs() const; | 116 | int typeSetArgs() const; |
108 | 117 | ||
109 | // FIXME return int? as ::ioctl does? -zecke | 118 | // FIXME return int? as ::ioctl does? -zecke |
110 | void invoke() const; | 119 | void invoke() const; |
111 | void setParameter( int, u_int32_t ); | 120 | void setParameter( int, u_int32_t ); |
112 | 121 | ||
113 | private: | 122 | private: |
114 | u_int32_t _ioctl; | 123 | u_int32_t _ioctl; |
115 | u_int16_t _getargs; | 124 | u_int16_t _getargs; |
116 | u_int16_t _setargs; | 125 | u_int16_t _setargs; |
117 | 126 | ||
127 | class Private; | ||
128 | Private *d; | ||
118 | }; | 129 | }; |
119 | 130 | ||
120 | /*====================================================================================== | 131 | /*====================================================================================== |
121 | * Miscellaneous | 132 | * Miscellaneous |
122 | *======================================================================================*/ | 133 | *======================================================================================*/ |
123 | 134 | ||
135 | namespace Private { | ||
124 | void dumpBytes( const unsigned char* data, int num ); | 136 | void dumpBytes( const unsigned char* data, int num ); |
125 | QString modeToString( int ); | 137 | QString modeToString( int ); |
126 | int stringToMode( const QString& ); | 138 | int stringToMode( const QString& ); |
139 | } | ||
140 | } | ||
141 | } | ||
127 | 142 | ||
128 | #define IW_PRIV_TYPE_MASK 0x7000 | 143 | #define IW_PRIV_TYPE_MASK 0x7000 |
129 | #define IW_PRIV_TYPE_NONE 0x0000 | 144 | #define IW_PRIV_TYPE_NONE 0x0000 |
130 | #define IW_PRIV_TYPE_BYTE 0x1000 | 145 | #define IW_PRIV_TYPE_BYTE 0x1000 |
131 | #define IW_PRIV_TYPE_CHAR 0x2000 | 146 | #define IW_PRIV_TYPE_CHAR 0x2000 |
132 | #define IW_PRIV_TYPE_INT 0x4000 | 147 | #define IW_PRIV_TYPE_INT 0x4000 |
133 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 148 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
134 | #define IW_PRIV_TYPE_ADDR 0x6000 | 149 | #define IW_PRIV_TYPE_ADDR 0x6000 |
135 | #define IW_PRIV_SIZE_FIXED 0x0800 | 150 | #define IW_PRIV_SIZE_FIXED 0x0800 |
136 | #define IW_PRIV_SIZE_MASK 0x07FF | 151 | #define IW_PRIV_SIZE_MASK 0x07FF |
137 | 152 | ||
138 | #ifndef ARPHRD_IEEE80211 | 153 | #ifndef ARPHRD_IEEE80211 |
139 | #define ARPHRD_IEEE80211 801 | 154 | #define ARPHRD_IEEE80211 801 |
140 | #endif | 155 | #endif |
141 | #ifndef ARPHRD_IEEE80211_PRISM | 156 | #ifndef ARPHRD_IEEE80211_PRISM |
142 | #define ARPHRD_IEEE80211_PRISM 802 | 157 | #define ARPHRD_IEEE80211_PRISM 802 |
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index e5b091f..ab3e77f 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -44,39 +44,45 @@ | |||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | #include <arpa/inet.h> | 45 | #include <arpa/inet.h> |
46 | #include <errno.h> | 46 | #include <errno.h> |
47 | #include <string.h> | 47 | #include <string.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/socket.h> | 51 | #include <sys/socket.h> |
52 | #include <sys/types.h> | 52 | #include <sys/types.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | #include <linux/sockios.h> | 54 | #include <linux/sockios.h> |
55 | #include <net/if_arp.h> | 55 | #include <net/if_arp.h> |
56 | #include <stdarg.h> | 56 | #include <stdarg.h> |
57 | 57 | ||
58 | #ifndef NODEBUG | 58 | #ifndef NODEBUG |
59 | #include <opie2/odebugmapper.h> | 59 | #include <opie2/odebugmapper.h> |
60 | |||
61 | |||
62 | using namespace Opie::Core; | ||
63 | using namespace Opie::Net::Private; | ||
60 | DebugMapper* debugmapper = new DebugMapper(); | 64 | DebugMapper* debugmapper = new DebugMapper(); |
61 | #endif | 65 | #endif |
62 | 66 | ||
63 | /*====================================================================================== | 67 | /*====================================================================================== |
64 | * ONetwork | 68 | * ONetwork |
65 | *======================================================================================*/ | 69 | *======================================================================================*/ |
66 | 70 | ||
71 | namespace Opie { | ||
72 | namespace Net { | ||
67 | ONetwork* ONetwork::_instance = 0; | 73 | ONetwork* ONetwork::_instance = 0; |
68 | 74 | ||
69 | ONetwork::ONetwork() | 75 | ONetwork::ONetwork() |
70 | { | 76 | { |
71 | odebug << "ONetwork::ONetwork()" << oendl; | 77 | odebug << "ONetwork::ONetwork()" << oendl; |
72 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 78 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
73 | synchronize(); | 79 | synchronize(); |
74 | } | 80 | } |
75 | 81 | ||
76 | void ONetwork::synchronize() | 82 | void ONetwork::synchronize() |
77 | { | 83 | { |
78 | // gather available interfaces by inspecting /proc/net/dev | 84 | // gather available interfaces by inspecting /proc/net/dev |
79 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | 85 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices |
80 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | 86 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices |
81 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | 87 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev |
82 | 88 | ||
@@ -1224,16 +1230,19 @@ void OOrinocoMonitoringInterface::setEnabled( bool b ) | |||
1224 | { | 1230 | { |
1225 | if ( b ) | 1231 | if ( b ) |
1226 | { | 1232 | { |
1227 | setChannel( 1 ); | 1233 | setChannel( 1 ); |
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | _if->setPrivate( "monitor", 2, 0, 0 ); | 1237 | _if->setPrivate( "monitor", 2, 0, 0 ); |
1232 | } | 1238 | } |
1233 | } | 1239 | } |
1234 | 1240 | ||
1235 | 1241 | ||
1236 | QString OOrinocoMonitoringInterface::name() const | 1242 | QString OOrinocoMonitoringInterface::name() const |
1237 | { | 1243 | { |
1238 | return "orinoco"; | 1244 | return "orinoco"; |
1239 | } | 1245 | } |
1246 | |||
1247 | } | ||
1248 | } | ||
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 93b129f..a953296 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -43,32 +43,35 @@ | |||
43 | #include "wireless.16.h" | 43 | #include "wireless.16.h" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | /* OPIE */ | 46 | /* OPIE */ |
47 | 47 | ||
48 | #include <opie2/onetutils.h> | 48 | #include <opie2/onetutils.h> |
49 | #include <opie2/ostation.h> | 49 | #include <opie2/ostation.h> |
50 | 50 | ||
51 | /* QT */ | 51 | /* QT */ |
52 | 52 | ||
53 | #include <qvaluelist.h> | 53 | #include <qvaluelist.h> |
54 | #include <qdict.h> | 54 | #include <qdict.h> |
55 | #include <qmap.h> | 55 | #include <qmap.h> |
56 | #include <qobject.h> | 56 | #include <qobject.h> |
57 | #include <qhostaddress.h> | 57 | #include <qhostaddress.h> |
58 | 58 | ||
59 | namespace Opie { | ||
60 | namespace Net { | ||
61 | |||
59 | class ONetworkInterface; | 62 | class ONetworkInterface; |
60 | class OWirelessNetworkInterface; | 63 | class OWirelessNetworkInterface; |
61 | class OChannelHopper; | 64 | class OChannelHopper; |
62 | class OMonitoringInterface; | 65 | class OMonitoringInterface; |
63 | 66 | ||
64 | /*====================================================================================== | 67 | /*====================================================================================== |
65 | * ONetwork | 68 | * ONetwork |
66 | *======================================================================================*/ | 69 | *======================================================================================*/ |
67 | 70 | ||
68 | /** | 71 | /** |
69 | * @brief A container class for all network interfaces | 72 | * @brief A container class for all network interfaces |
70 | * | 73 | * |
71 | * This class provides access to all available network interfaces of your computer. | 74 | * This class provides access to all available network interfaces of your computer. |
72 | * | 75 | * |
73 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 76 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
74 | */ | 77 | */ |
@@ -110,32 +113,34 @@ class ONetwork : public QObject | |||
110 | * @internal Rebuild the internal interface database | 113 | * @internal Rebuild the internal interface database |
111 | * @note Sometimes it might be useful to call this from client code, | 114 | * @note Sometimes it might be useful to call this from client code, |
112 | * e.g. after issuing a cardctl insert | 115 | * e.g. after issuing a cardctl insert |
113 | */ | 116 | */ |
114 | void synchronize(); | 117 | void synchronize(); |
115 | /** | 118 | /** |
116 | * @returns the wireless extension version used at compile time. | 119 | * @returns the wireless extension version used at compile time. |
117 | **/ | 120 | **/ |
118 | static short wirelessExtensionVersion(); | 121 | static short wirelessExtensionVersion(); |
119 | 122 | ||
120 | protected: | 123 | protected: |
121 | ONetwork(); | 124 | ONetwork(); |
122 | 125 | ||
123 | private: | 126 | private: |
124 | static ONetwork* _instance; | 127 | static ONetwork* _instance; |
125 | InterfaceMap _interfaces; | 128 | InterfaceMap _interfaces; |
129 | class Private; | ||
130 | Private *d; | ||
126 | }; | 131 | }; |
127 | 132 | ||
128 | 133 | ||
129 | /*====================================================================================== | 134 | /*====================================================================================== |
130 | * ONetworkInterface | 135 | * ONetworkInterface |
131 | *======================================================================================*/ | 136 | *======================================================================================*/ |
132 | 137 | ||
133 | /** | 138 | /** |
134 | * @brief A network interface wrapper. | 139 | * @brief A network interface wrapper. |
135 | * | 140 | * |
136 | * This class provides a wrapper for a network interface. All the cumbersume details of | 141 | * This class provides a wrapper for a network interface. All the cumbersume details of |
137 | * Linux ioctls are hidden under a convenient high-level interface. | 142 | * Linux ioctls are hidden under a convenient high-level interface. |
138 | * @warning Most of the setting methods contained in this class require the appropriate | 143 | * @warning Most of the setting methods contained in this class require the appropriate |
139 | * process permissions to work. | 144 | * process permissions to work. |
140 | * | 145 | * |
141 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 146 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
@@ -221,32 +226,35 @@ class ONetworkInterface : public QObject | |||
221 | /** | 226 | /** |
222 | * @returns the data link type currently associated with the interface. | 227 | * @returns the data link type currently associated with the interface. |
223 | * @see #include <net/if_arp.h> for possible values. | 228 | * @see #include <net/if_arp.h> for possible values. |
224 | */ | 229 | */ |
225 | int dataLinkType() const; | 230 | int dataLinkType() const; |
226 | 231 | ||
227 | protected: | 232 | protected: |
228 | const int _sfd; | 233 | const int _sfd; |
229 | mutable ifreq _ifr; | 234 | mutable ifreq _ifr; |
230 | OMonitoringInterface* _mon; | 235 | OMonitoringInterface* _mon; |
231 | 236 | ||
232 | protected: | 237 | protected: |
233 | struct ifreq& ifr() const; | 238 | struct ifreq& ifr() const; |
234 | virtual void init(); | 239 | virtual void init(); |
235 | bool ioctl( int call ) const; | 240 | bool ioctl( int call ) const; |
236 | bool ioctl( int call, struct ifreq& ) const; | 241 | bool ioctl( int call, struct ifreq& ) const; |
242 | private: | ||
243 | class Private; | ||
244 | Private *d; | ||
237 | }; | 245 | }; |
238 | 246 | ||
239 | /*====================================================================================== | 247 | /*====================================================================================== |
240 | * OChannelHopper | 248 | * OChannelHopper |
241 | *======================================================================================*/ | 249 | *======================================================================================*/ |
242 | 250 | ||
243 | /** | 251 | /** |
244 | * @brief A radio frequency channel hopper. | 252 | * @brief A radio frequency channel hopper. |
245 | * | 253 | * |
246 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently | 254 | * This class provides a channel hopper for radio frequencies. A channel hopper frequently |
247 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. | 255 | * changes the radio frequency channel of its associated @ref OWirelessNetworkInterface. |
248 | * This is necessary when in monitoring mode and scanning for other devices, because | 256 | * This is necessary when in monitoring mode and scanning for other devices, because |
249 | * the radio frequency hardware can only detect packets sent on the same frequency. | 257 | * the radio frequency hardware can only detect packets sent on the same frequency. |
250 | * | 258 | * |
251 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 259 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
252 | */ | 260 | */ |
@@ -283,32 +291,34 @@ class OChannelHopper : public QObject | |||
283 | 291 | ||
284 | signals: | 292 | signals: |
285 | /** | 293 | /** |
286 | * This signal is emitted right after the channel hopper performed a hop | 294 | * This signal is emitted right after the channel hopper performed a hop |
287 | */ | 295 | */ |
288 | void hopped( int ); | 296 | void hopped( int ); |
289 | 297 | ||
290 | protected: | 298 | protected: |
291 | virtual void timerEvent( QTimerEvent* ); | 299 | virtual void timerEvent( QTimerEvent* ); |
292 | 300 | ||
293 | private: | 301 | private: |
294 | OWirelessNetworkInterface* _iface; | 302 | OWirelessNetworkInterface* _iface; |
295 | int _interval; | 303 | int _interval; |
296 | int _tid; | 304 | int _tid; |
297 | QValueList<int> _channels; | 305 | QValueList<int> _channels; |
298 | QValueList<int>::Iterator _channel; | 306 | QValueList<int>::Iterator _channel; |
307 | class Private; | ||
308 | Private *d; | ||
299 | }; | 309 | }; |
300 | 310 | ||
301 | 311 | ||
302 | /*====================================================================================== | 312 | /*====================================================================================== |
303 | * OWirelessNetworkInterface | 313 | * OWirelessNetworkInterface |
304 | *======================================================================================*/ | 314 | *======================================================================================*/ |
305 | 315 | ||
306 | /** | 316 | /** |
307 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 317 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
308 | * | 318 | * |
309 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 319 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
310 | * | 320 | * |
311 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 321 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
312 | */ | 322 | */ |
313 | class OWirelessNetworkInterface : public ONetworkInterface | 323 | class OWirelessNetworkInterface : public ONetworkInterface |
314 | { | 324 | { |
@@ -442,118 +452,139 @@ class OWirelessNetworkInterface : public ONetworkInterface | |||
442 | protected: | 452 | protected: |
443 | void buildInformation(); | 453 | void buildInformation(); |
444 | void buildPrivateList(); | 454 | void buildPrivateList(); |
445 | void dumpInformation() const; | 455 | void dumpInformation() const; |
446 | virtual void init(); | 456 | virtual void init(); |
447 | struct iwreq& iwr() const; | 457 | struct iwreq& iwr() const; |
448 | bool wioctl( int call ) const; | 458 | bool wioctl( int call ) const; |
449 | bool wioctl( int call, struct iwreq& ) const; | 459 | bool wioctl( int call, struct iwreq& ) const; |
450 | 460 | ||
451 | protected: | 461 | protected: |
452 | mutable struct iwreq _iwr; | 462 | mutable struct iwreq _iwr; |
453 | QMap<int,int> _channels; | 463 | QMap<int,int> _channels; |
454 | struct iw_range _range; | 464 | struct iw_range _range; |
455 | 465 | ||
456 | private: | 466 | private: |
457 | OChannelHopper* _hopper; | 467 | OChannelHopper* _hopper; |
468 | class Private; | ||
469 | Private *d; | ||
458 | }; | 470 | }; |
459 | 471 | ||
460 | 472 | ||
461 | /*====================================================================================== | 473 | /*====================================================================================== |
462 | * OMonitoringInterface | 474 | * OMonitoringInterface |
463 | *======================================================================================*/ | 475 | *======================================================================================*/ |
464 | 476 | ||
465 | 477 | ||
466 | class OMonitoringInterface | 478 | class OMonitoringInterface |
467 | { | 479 | { |
468 | public: | 480 | public: |
469 | OMonitoringInterface(); | 481 | OMonitoringInterface(); |
470 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 482 | OMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
471 | virtual ~OMonitoringInterface(); | 483 | virtual ~OMonitoringInterface(); |
472 | 484 | ||
473 | public: | 485 | public: |
474 | virtual void setEnabled( bool ); | 486 | virtual void setEnabled( bool ); |
475 | virtual void setChannel( int ); | 487 | virtual void setChannel( int ); |
476 | 488 | ||
477 | virtual QString name() const = 0; | 489 | virtual QString name() const = 0; |
478 | 490 | ||
479 | protected: | 491 | protected: |
480 | OWirelessNetworkInterface* _if; | 492 | OWirelessNetworkInterface* _if; |
481 | bool _prismHeader; | 493 | bool _prismHeader; |
494 | private: | ||
495 | class Private; | ||
496 | Private *d; | ||
482 | 497 | ||
483 | }; | 498 | }; |
484 | 499 | ||
485 | 500 | ||
486 | /*====================================================================================== | 501 | /*====================================================================================== |
487 | * OCiscoMonitoring | 502 | * OCiscoMonitoring |
488 | *======================================================================================*/ | 503 | *======================================================================================*/ |
489 | 504 | ||
490 | 505 | ||
491 | class OCiscoMonitoringInterface : public OMonitoringInterface | 506 | class OCiscoMonitoringInterface : public OMonitoringInterface |
492 | { | 507 | { |
493 | public: | 508 | public: |
494 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 509 | OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
495 | virtual ~OCiscoMonitoringInterface(); | 510 | virtual ~OCiscoMonitoringInterface(); |
496 | 511 | ||
497 | virtual void setEnabled( bool ); | 512 | virtual void setEnabled( bool ); |
498 | virtual QString name() const; | 513 | virtual QString name() const; |
499 | virtual void setChannel( int ); | 514 | virtual void setChannel( int ); |
515 | private: | ||
516 | class Private; | ||
517 | Private *d; | ||
500 | 518 | ||
501 | }; | 519 | }; |
502 | 520 | ||
503 | 521 | ||
504 | /*====================================================================================== | 522 | /*====================================================================================== |
505 | * OWlanNGMonitoringInterface | 523 | * OWlanNGMonitoringInterface |
506 | *======================================================================================*/ | 524 | *======================================================================================*/ |
507 | 525 | ||
508 | 526 | ||
509 | class OWlanNGMonitoringInterface : public OMonitoringInterface | 527 | class OWlanNGMonitoringInterface : public OMonitoringInterface |
510 | { | 528 | { |
511 | public: | 529 | public: |
512 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 530 | OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
513 | virtual ~OWlanNGMonitoringInterface(); | 531 | virtual ~OWlanNGMonitoringInterface(); |
514 | 532 | ||
515 | public: | 533 | public: |
516 | virtual void setEnabled( bool ); | 534 | virtual void setEnabled( bool ); |
517 | virtual QString name() const; | 535 | virtual QString name() const; |
518 | virtual void setChannel( int ); | 536 | virtual void setChannel( int ); |
537 | private: | ||
538 | class Private; | ||
539 | Private *d; | ||
519 | 540 | ||
520 | }; | 541 | }; |
521 | 542 | ||
522 | 543 | ||
523 | /*====================================================================================== | 544 | /*====================================================================================== |
524 | * OHostAPMonitoringInterface | 545 | * OHostAPMonitoringInterface |
525 | *======================================================================================*/ | 546 | *======================================================================================*/ |
526 | 547 | ||
527 | 548 | ||
528 | class OHostAPMonitoringInterface : public OMonitoringInterface | 549 | class OHostAPMonitoringInterface : public OMonitoringInterface |
529 | { | 550 | { |
530 | public: | 551 | public: |
531 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 552 | OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
532 | virtual ~OHostAPMonitoringInterface(); | 553 | virtual ~OHostAPMonitoringInterface(); |
533 | 554 | ||
534 | public: | 555 | public: |
535 | virtual void setEnabled( bool ); | 556 | virtual void setEnabled( bool ); |
536 | virtual QString name() const; | 557 | virtual QString name() const; |
558 | |||
559 | private: | ||
560 | class Private; | ||
561 | Private *d; | ||
537 | }; | 562 | }; |
538 | 563 | ||
539 | 564 | ||
540 | /*====================================================================================== | 565 | /*====================================================================================== |
541 | * OOrinocoMonitoringInterface | 566 | * OOrinocoMonitoringInterface |
542 | *======================================================================================*/ | 567 | *======================================================================================*/ |
543 | 568 | ||
544 | 569 | ||
545 | class OOrinocoMonitoringInterface : public OMonitoringInterface | 570 | class OOrinocoMonitoringInterface : public OMonitoringInterface |
546 | { | 571 | { |
547 | public: | 572 | public: |
548 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); | 573 | OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader ); |
549 | virtual ~OOrinocoMonitoringInterface(); | 574 | virtual ~OOrinocoMonitoringInterface(); |
550 | 575 | ||
551 | public: | 576 | public: |
552 | virtual void setChannel( int ); | 577 | virtual void setChannel( int ); |
553 | virtual void setEnabled( bool ); | 578 | virtual void setEnabled( bool ); |
554 | virtual QString name() const; | 579 | virtual QString name() const; |
555 | 580 | ||
581 | private: | ||
582 | class Private; | ||
583 | Private *d; | ||
556 | }; | 584 | }; |
557 | 585 | ||
586 | } | ||
587 | } | ||
588 | |||
558 | #endif // ONETWORK_H | 589 | #endif // ONETWORK_H |
559 | 590 | ||
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index fdd519c..4081d4f 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -32,32 +32,37 @@ | |||
32 | #include <opie2/opcap.h> | 32 | #include <opie2/opcap.h> |
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) | 36 | #include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) |
37 | #include <qsocketnotifier.h> | 37 | #include <qsocketnotifier.h> |
38 | #include <qobjectlist.h> | 38 | #include <qobjectlist.h> |
39 | 39 | ||
40 | /* SYSTEM */ | 40 | /* SYSTEM */ |
41 | #include <sys/time.h> | 41 | #include <sys/time.h> |
42 | #include <sys/types.h> | 42 | #include <sys/types.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | 44 | ||
45 | /* LOCAL */ | 45 | /* LOCAL */ |
46 | #include "udp_ports.h" | 46 | #include "udp_ports.h" |
47 | 47 | ||
48 | using namespace Opie::Core; | ||
49 | |||
50 | namespace Opie { | ||
51 | namespace Net { | ||
52 | |||
48 | /*====================================================================================== | 53 | /*====================================================================================== |
49 | * OPacket | 54 | * OPacket |
50 | *======================================================================================*/ | 55 | *======================================================================================*/ |
51 | 56 | ||
52 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) | 57 | OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) |
53 | :QObject( parent, "Generic" ), _hdr( header ), _data( data ) | 58 | :QObject( parent, "Generic" ), _hdr( header ), _data( data ) |
54 | { | 59 | { |
55 | //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); | 60 | //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); |
56 | 61 | ||
57 | _end = (unsigned char*) data + header.len; | 62 | _end = (unsigned char*) data + header.len; |
58 | //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); | 63 | //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); |
59 | 64 | ||
60 | switch ( datalink ) | 65 | switch ( datalink ) |
61 | { | 66 | { |
62 | case DLT_EN10MB: | 67 | case DLT_EN10MB: |
63 | odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; | 68 | odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; |
@@ -1331,17 +1336,18 @@ int OPacketCapturer::snapShot() const | |||
1331 | { | 1336 | { |
1332 | return pcap_snapshot( _pch ); | 1337 | return pcap_snapshot( _pch ); |
1333 | } | 1338 | } |
1334 | 1339 | ||
1335 | 1340 | ||
1336 | bool OPacketCapturer::swapped() const | 1341 | bool OPacketCapturer::swapped() const |
1337 | { | 1342 | { |
1338 | return pcap_is_swapped( _pch ); | 1343 | return pcap_is_swapped( _pch ); |
1339 | } | 1344 | } |
1340 | 1345 | ||
1341 | 1346 | ||
1342 | QString OPacketCapturer::version() const | 1347 | QString OPacketCapturer::version() const |
1343 | { | 1348 | { |
1344 | return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) ); | 1349 | return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) ); |
1345 | } | 1350 | } |
1346 | 1351 | ||
1347 | 1352 | } | |
1353 | } | ||
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index b873b49..dc609a3 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h | |||
@@ -51,34 +51,36 @@ extern "C" // work around a bpf/pcap conflict in recent headers | |||
51 | #include <netinet/ether.h> | 51 | #include <netinet/ether.h> |
52 | #include <netinet/ip.h> | 52 | #include <netinet/ip.h> |
53 | #include <netinet/udp.h> | 53 | #include <netinet/udp.h> |
54 | #include <netinet/tcp.h> | 54 | #include <netinet/tcp.h> |
55 | #include <time.h> | 55 | #include <time.h> |
56 | 56 | ||
57 | /* Custom Network Includes (must go here, don't reorder!) */ | 57 | /* Custom Network Includes (must go here, don't reorder!) */ |
58 | #include "802_11_user.h" | 58 | #include "802_11_user.h" |
59 | #include "dhcp.h" | 59 | #include "dhcp.h" |
60 | 60 | ||
61 | 61 | ||
62 | /* TYPEDEFS */ | 62 | /* TYPEDEFS */ |
63 | typedef struct timeval timevalstruct; | 63 | typedef struct timeval timevalstruct; |
64 | typedef struct pcap_pkthdr packetheaderstruct; | 64 | typedef struct pcap_pkthdr packetheaderstruct; |
65 | 65 | ||
66 | /* FORWARDS */ | 66 | /* FORWARDS */ |
67 | class OPacketCapturer; | ||
68 | class QSocketNotifier; | 67 | class QSocketNotifier; |
68 | namespace Opie { | ||
69 | namespace Net { | ||
70 | class OPacketCapturer; | ||
69 | 71 | ||
70 | /*====================================================================================== | 72 | /*====================================================================================== |
71 | * OPacket - A frame on the wire | 73 | * OPacket - A frame on the wire |
72 | *======================================================================================*/ | 74 | *======================================================================================*/ |
73 | 75 | ||
74 | /** @brief A class representing a data frame on the wire. | 76 | /** @brief A class representing a data frame on the wire. |
75 | * | 77 | * |
76 | * The whole family of the packet classes are used when capturing frames from a network. | 78 | * The whole family of the packet classes are used when capturing frames from a network. |
77 | * Most standard network protocols in use share a common architecture, which mostly is | 79 | * Most standard network protocols in use share a common architecture, which mostly is |
78 | * a packet header and then the packet payload. In layered architectures, each lower layer | 80 | * a packet header and then the packet payload. In layered architectures, each lower layer |
79 | * encapsulates data from its upper layer - that is it | 81 | * encapsulates data from its upper layer - that is it |
80 | * treats the data from its upper layer as payload and prepends an own header to the packet, | 82 | * treats the data from its upper layer as payload and prepends an own header to the packet, |
81 | * which - again - is treated as the payload for the layer below. The figure below is an | 83 | * which - again - is treated as the payload for the layer below. The figure below is an |
82 | * example for how such a data frame is composed out of packets, e.g. when sending a mail. | 84 | * example for how such a data frame is composed out of packets, e.g. when sending a mail. |
83 | * | 85 | * |
84 | * <pre> | 86 | * <pre> |
@@ -128,436 +130,480 @@ class OPacket : public QObject | |||
128 | 130 | ||
129 | int caplen() const; | 131 | int caplen() const; |
130 | int len() const; | 132 | int len() const; |
131 | QString dump( int = 32 ) const; | 133 | QString dump( int = 32 ) const; |
132 | 134 | ||
133 | void updateStats( QMap<QString,int>&, QObjectList* ); | 135 | void updateStats( QMap<QString,int>&, QObjectList* ); |
134 | 136 | ||
135 | private: | 137 | private: |
136 | 138 | ||
137 | QString dumpStructure() const; | 139 | QString dumpStructure() const; |
138 | QString _dumpStructure( QObjectList* ) const; | 140 | QString _dumpStructure( QObjectList* ) const; |
139 | 141 | ||
140 | private: | 142 | private: |
141 | const packetheaderstruct _hdr; // pcap packet header | 143 | const packetheaderstruct _hdr; // pcap packet header |
142 | const unsigned char* _data; // pcap packet data | 144 | const unsigned char* _data; // pcap packet data |
143 | const unsigned char* _end; // end of pcap packet data | 145 | const unsigned char* _end; // end of pcap packet data |
146 | private: | ||
147 | class Private; | ||
148 | Private *d; | ||
144 | }; | 149 | }; |
145 | 150 | ||
146 | QTextStream& operator<<( QTextStream& s, const OPacket& p ); | 151 | QTextStream& operator<<( QTextStream& s, const OPacket& p ); |
147 | 152 | ||
148 | /*====================================================================================== | 153 | /*====================================================================================== |
149 | * OEthernetPacket - DLT_EN10MB frame | 154 | * OEthernetPacket - DLT_EN10MB frame |
150 | *======================================================================================*/ | 155 | *======================================================================================*/ |
151 | 156 | ||
152 | class OEthernetPacket : public QObject | 157 | class OEthernetPacket : public QObject |
153 | { | 158 | { |
154 | Q_OBJECT | 159 | Q_OBJECT |
155 | 160 | ||
156 | public: | 161 | public: |
157 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); | 162 | OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); |
158 | virtual ~OEthernetPacket(); | 163 | virtual ~OEthernetPacket(); |
159 | 164 | ||
160 | OMacAddress sourceAddress() const; | 165 | OMacAddress sourceAddress() const; |
161 | OMacAddress destinationAddress() const; | 166 | OMacAddress destinationAddress() const; |
162 | int type() const; | 167 | int type() const; |
163 | 168 | ||
164 | private: | 169 | private: |
165 | const struct ether_header* _ether; | 170 | const struct ether_header* _ether; |
171 | private: | ||
172 | class Private; | ||
173 | Private *d; | ||
166 | }; | 174 | }; |
167 | 175 | ||
168 | /*====================================================================================== | 176 | /*====================================================================================== |
169 | * OPrismHeaderPacket - DLT_PRISM_HEADER frame | 177 | * OPrismHeaderPacket - DLT_PRISM_HEADER frame |
170 | *======================================================================================*/ | 178 | *======================================================================================*/ |
171 | 179 | ||
172 | class OPrismHeaderPacket : public QObject | 180 | class OPrismHeaderPacket : public QObject |
173 | { | 181 | { |
174 | Q_OBJECT | 182 | Q_OBJECT |
175 | 183 | ||
176 | public: | 184 | public: |
177 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); | 185 | OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); |
178 | virtual ~OPrismHeaderPacket(); | 186 | virtual ~OPrismHeaderPacket(); |
179 | 187 | ||
180 | unsigned int signalStrength() const; | 188 | unsigned int signalStrength() const; |
181 | 189 | ||
182 | private: | 190 | private: |
183 | const struct prism_hdr* _header; | 191 | const struct prism_hdr* _header; |
192 | class Private; | ||
193 | Private *d; | ||
184 | }; | 194 | }; |
185 | 195 | ||
186 | /*====================================================================================== | 196 | /*====================================================================================== |
187 | * OWaveLanPacket - DLT_IEEE802_11 frame | 197 | * OWaveLanPacket - DLT_IEEE802_11 frame |
188 | *======================================================================================*/ | 198 | *======================================================================================*/ |
189 | 199 | ||
190 | class OWaveLanPacket : public QObject | 200 | class OWaveLanPacket : public QObject |
191 | { | 201 | { |
192 | Q_OBJECT | 202 | Q_OBJECT |
193 | 203 | ||
194 | public: | 204 | public: |
195 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); | 205 | OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); |
196 | virtual ~OWaveLanPacket(); | 206 | virtual ~OWaveLanPacket(); |
197 | 207 | ||
198 | int duration() const; | 208 | int duration() const; |
199 | bool fromDS() const; | 209 | bool fromDS() const; |
200 | bool toDS() const; | 210 | bool toDS() const; |
201 | virtual OMacAddress macAddress1() const; | 211 | virtual OMacAddress macAddress1() const; |
202 | virtual OMacAddress macAddress2() const; | 212 | virtual OMacAddress macAddress2() const; |
203 | virtual OMacAddress macAddress3() const; | 213 | virtual OMacAddress macAddress3() const; |
204 | virtual OMacAddress macAddress4() const; | 214 | virtual OMacAddress macAddress4() const; |
205 | bool usesPowerManagement() const; | 215 | bool usesPowerManagement() const; |
206 | int type() const; | 216 | int type() const; |
207 | int subType() const; | 217 | int subType() const; |
208 | int version() const; | 218 | int version() const; |
209 | bool usesWep() const; | 219 | bool usesWep() const; |
210 | 220 | ||
211 | private: | 221 | private: |
212 | const struct ieee_802_11_header* _wlanhdr; | 222 | const struct ieee_802_11_header* _wlanhdr; |
223 | class Private; | ||
224 | Private *d; | ||
213 | }; | 225 | }; |
214 | 226 | ||
215 | 227 | ||
216 | /*====================================================================================== | 228 | /*====================================================================================== |
217 | * OWaveLanManagementPacket - type: management (T_MGMT) | 229 | * OWaveLanManagementPacket - type: management (T_MGMT) |
218 | *======================================================================================*/ | 230 | *======================================================================================*/ |
219 | 231 | ||
220 | class OWaveLanManagementPacket : public QObject | 232 | class OWaveLanManagementPacket : public QObject |
221 | { | 233 | { |
222 | Q_OBJECT | 234 | Q_OBJECT |
223 | 235 | ||
224 | public: | 236 | public: |
225 | OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); | 237 | OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); |
226 | virtual ~OWaveLanManagementPacket(); | 238 | virtual ~OWaveLanManagementPacket(); |
227 | 239 | ||
228 | QString managementType() const; | 240 | QString managementType() const; |
229 | 241 | ||
230 | int beaconInterval() const; | 242 | int beaconInterval() const; |
231 | int capabilities() const; // generic | 243 | int capabilities() const; // generic |
232 | 244 | ||
233 | bool canESS() const; | 245 | bool canESS() const; |
234 | bool canIBSS() const; | 246 | bool canIBSS() const; |
235 | bool canCFP() const; | 247 | bool canCFP() const; |
236 | bool canCFP_REQ() const; | 248 | bool canCFP_REQ() const; |
237 | bool canPrivacy() const; | 249 | bool canPrivacy() const; |
238 | 250 | ||
239 | private: | 251 | private: |
240 | const struct ieee_802_11_mgmt_header* _header; | 252 | const struct ieee_802_11_mgmt_header* _header; |
241 | const struct ieee_802_11_mgmt_body* _body; | 253 | const struct ieee_802_11_mgmt_body* _body; |
254 | class Private; | ||
255 | Private *d; | ||
242 | }; | 256 | }; |
243 | 257 | ||
244 | 258 | ||
245 | /*====================================================================================== | 259 | /*====================================================================================== |
246 | * OWaveLanManagementSSID | 260 | * OWaveLanManagementSSID |
247 | *======================================================================================*/ | 261 | *======================================================================================*/ |
248 | 262 | ||
249 | class OWaveLanManagementSSID : public QObject | 263 | class OWaveLanManagementSSID : public QObject |
250 | { | 264 | { |
251 | Q_OBJECT | 265 | Q_OBJECT |
252 | 266 | ||
253 | public: | 267 | public: |
254 | OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); | 268 | OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); |
255 | virtual ~OWaveLanManagementSSID(); | 269 | virtual ~OWaveLanManagementSSID(); |
256 | 270 | ||
257 | QString ID( bool decloak = false ) const; | 271 | QString ID( bool decloak = false ) const; |
258 | 272 | ||
259 | private: | 273 | private: |
260 | const struct ssid_t* _data; | 274 | const struct ssid_t* _data; |
275 | class Private; | ||
276 | Private *d; | ||
261 | }; | 277 | }; |
262 | 278 | ||
263 | /*====================================================================================== | 279 | /*====================================================================================== |
264 | * OWaveLanManagementRates | 280 | * OWaveLanManagementRates |
265 | *======================================================================================*/ | 281 | *======================================================================================*/ |
266 | 282 | ||
267 | class OWaveLanManagementRates : public QObject | 283 | class OWaveLanManagementRates : public QObject |
268 | { | 284 | { |
269 | Q_OBJECT | 285 | Q_OBJECT |
270 | 286 | ||
271 | public: | 287 | public: |
272 | OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); | 288 | OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); |
273 | virtual ~OWaveLanManagementRates(); | 289 | virtual ~OWaveLanManagementRates(); |
274 | 290 | ||
275 | private: | 291 | private: |
276 | const struct rates_t* _data; | 292 | const struct rates_t* _data; |
293 | class Private; | ||
294 | Private *d; | ||
277 | }; | 295 | }; |
278 | 296 | ||
279 | /*====================================================================================== | 297 | /*====================================================================================== |
280 | * OWaveLanManagementCF | 298 | * OWaveLanManagementCF |
281 | *======================================================================================*/ | 299 | *======================================================================================*/ |
282 | 300 | ||
283 | class OWaveLanManagementCF : public QObject | 301 | class OWaveLanManagementCF : public QObject |
284 | { | 302 | { |
285 | Q_OBJECT | 303 | Q_OBJECT |
286 | 304 | ||
287 | public: | 305 | public: |
288 | OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); | 306 | OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); |
289 | virtual ~OWaveLanManagementCF(); | 307 | virtual ~OWaveLanManagementCF(); |
290 | 308 | ||
291 | private: | 309 | private: |
292 | const struct cf_t* _data; | 310 | const struct cf_t* _data; |
311 | class Private; | ||
312 | Private *d; | ||
293 | }; | 313 | }; |
294 | 314 | ||
295 | /*====================================================================================== | 315 | /*====================================================================================== |
296 | * OWaveLanManagementFH | 316 | * OWaveLanManagementFH |
297 | *======================================================================================*/ | 317 | *======================================================================================*/ |
298 | 318 | ||
299 | class OWaveLanManagementFH : public QObject | 319 | class OWaveLanManagementFH : public QObject |
300 | { | 320 | { |
301 | Q_OBJECT | 321 | Q_OBJECT |
302 | 322 | ||
303 | public: | 323 | public: |
304 | OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); | 324 | OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); |
305 | virtual ~OWaveLanManagementFH(); | 325 | virtual ~OWaveLanManagementFH(); |
306 | 326 | ||
307 | private: | 327 | private: |
308 | const struct fh_t* _data; | 328 | const struct fh_t* _data; |
329 | class Private; | ||
330 | Private *d; | ||
309 | }; | 331 | }; |
310 | 332 | ||
311 | /*====================================================================================== | 333 | /*====================================================================================== |
312 | * OWaveLanManagementDS | 334 | * OWaveLanManagementDS |
313 | *======================================================================================*/ | 335 | *======================================================================================*/ |
314 | 336 | ||
315 | class OWaveLanManagementDS : public QObject | 337 | class OWaveLanManagementDS : public QObject |
316 | { | 338 | { |
317 | Q_OBJECT | 339 | Q_OBJECT |
318 | 340 | ||
319 | public: | 341 | public: |
320 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); | 342 | OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); |
321 | virtual ~OWaveLanManagementDS(); | 343 | virtual ~OWaveLanManagementDS(); |
322 | 344 | ||
323 | int channel() const; | 345 | int channel() const; |
324 | 346 | ||
325 | private: | 347 | private: |
326 | const struct ds_t* _data; | 348 | const struct ds_t* _data; |
349 | class Private; | ||
350 | Private *d; | ||
327 | }; | 351 | }; |
328 | 352 | ||
329 | /*====================================================================================== | 353 | /*====================================================================================== |
330 | * OWaveLanManagementTim | 354 | * OWaveLanManagementTim |
331 | *======================================================================================*/ | 355 | *======================================================================================*/ |
332 | 356 | ||
333 | class OWaveLanManagementTim : public QObject | 357 | class OWaveLanManagementTim : public QObject |
334 | { | 358 | { |
335 | Q_OBJECT | 359 | Q_OBJECT |
336 | 360 | ||
337 | public: | 361 | public: |
338 | OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); | 362 | OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); |
339 | virtual ~OWaveLanManagementTim(); | 363 | virtual ~OWaveLanManagementTim(); |
340 | 364 | ||
341 | private: | 365 | private: |
342 | const struct tim_t* _data; | 366 | const struct tim_t* _data; |
367 | class Private; | ||
368 | Private *d; | ||
343 | }; | 369 | }; |
344 | 370 | ||
345 | /*====================================================================================== | 371 | /*====================================================================================== |
346 | * OWaveLanManagementIBSS | 372 | * OWaveLanManagementIBSS |
347 | *======================================================================================*/ | 373 | *======================================================================================*/ |
348 | 374 | ||
349 | class OWaveLanManagementIBSS : public QObject | 375 | class OWaveLanManagementIBSS : public QObject |
350 | { | 376 | { |
351 | Q_OBJECT | 377 | Q_OBJECT |
352 | 378 | ||
353 | public: | 379 | public: |
354 | OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); | 380 | OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); |
355 | virtual ~OWaveLanManagementIBSS(); | 381 | virtual ~OWaveLanManagementIBSS(); |
356 | 382 | ||
357 | private: | 383 | private: |
358 | const struct ibss_t* _data; | 384 | const struct ibss_t* _data; |
385 | class Private; | ||
386 | Private *d; | ||
359 | }; | 387 | }; |
360 | 388 | ||
361 | /*====================================================================================== | 389 | /*====================================================================================== |
362 | * OWaveLanManagementChallenge | 390 | * OWaveLanManagementChallenge |
363 | *======================================================================================*/ | 391 | *======================================================================================*/ |
364 | 392 | ||
365 | class OWaveLanManagementChallenge : public QObject | 393 | class OWaveLanManagementChallenge : public QObject |
366 | { | 394 | { |
367 | Q_OBJECT | 395 | Q_OBJECT |
368 | 396 | ||
369 | public: | 397 | public: |
370 | OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); | 398 | OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); |
371 | virtual ~OWaveLanManagementChallenge(); | 399 | virtual ~OWaveLanManagementChallenge(); |
372 | 400 | ||
373 | private: | 401 | private: |
374 | const struct challenge_t* _data; | 402 | const struct challenge_t* _data; |
403 | class Private; | ||
404 | Private *d; | ||
375 | }; | 405 | }; |
376 | 406 | ||
377 | /*====================================================================================== | 407 | /*====================================================================================== |
378 | * OWaveLanDataPacket - type: data (T_DATA) | 408 | * OWaveLanDataPacket - type: data (T_DATA) |
379 | *======================================================================================*/ | 409 | *======================================================================================*/ |
380 | 410 | ||
381 | class OWaveLanDataPacket : public QObject | 411 | class OWaveLanDataPacket : public QObject |
382 | { | 412 | { |
383 | Q_OBJECT | 413 | Q_OBJECT |
384 | 414 | ||
385 | public: | 415 | public: |
386 | OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); | 416 | OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); |
387 | virtual ~OWaveLanDataPacket(); | 417 | virtual ~OWaveLanDataPacket(); |
388 | 418 | ||
389 | private: | 419 | private: |
390 | const struct ieee_802_11_data_header* _header; | 420 | const struct ieee_802_11_data_header* _header; |
421 | class Private; | ||
422 | Private *d; | ||
391 | }; | 423 | }; |
392 | 424 | ||
393 | /*====================================================================================== | 425 | /*====================================================================================== |
394 | * OWaveLanControlPacket - type: control (T_CTRL) | 426 | * OWaveLanControlPacket - type: control (T_CTRL) |
395 | *======================================================================================*/ | 427 | *======================================================================================*/ |
396 | 428 | ||
397 | class OWaveLanControlPacket : public QObject | 429 | class OWaveLanControlPacket : public QObject |
398 | { | 430 | { |
399 | Q_OBJECT | 431 | Q_OBJECT |
400 | 432 | ||
401 | public: | 433 | public: |
402 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); | 434 | OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); |
403 | virtual ~OWaveLanControlPacket(); | 435 | virtual ~OWaveLanControlPacket(); |
404 | 436 | ||
405 | QString controlType() const; | 437 | QString controlType() const; |
406 | 438 | ||
407 | private: | 439 | private: |
408 | const struct ieee_802_11_control_header* _header; | 440 | const struct ieee_802_11_control_header* _header; |
441 | class Private; | ||
442 | Private *d; | ||
409 | }; | 443 | }; |
410 | 444 | ||
411 | /*====================================================================================== | 445 | /*====================================================================================== |
412 | * OLLCPacket - IEEE 802.2 Link Level Control | 446 | * OLLCPacket - IEEE 802.2 Link Level Control |
413 | *======================================================================================*/ | 447 | *======================================================================================*/ |
414 | 448 | ||
415 | class OLLCPacket : public QObject | 449 | class OLLCPacket : public QObject |
416 | { | 450 | { |
417 | Q_OBJECT | 451 | Q_OBJECT |
418 | 452 | ||
419 | public: | 453 | public: |
420 | OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); | 454 | OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); |
421 | virtual ~OLLCPacket(); | 455 | virtual ~OLLCPacket(); |
422 | 456 | ||
423 | private: | 457 | private: |
424 | const struct ieee_802_11_802_2_header* _header; | 458 | const struct ieee_802_11_802_2_header* _header; |
459 | class Private; | ||
460 | Private *d; | ||
425 | }; | 461 | }; |
426 | 462 | ||
427 | /*====================================================================================== | 463 | /*====================================================================================== |
428 | * OIPPacket | 464 | * OIPPacket |
429 | *======================================================================================*/ | 465 | *======================================================================================*/ |
430 | 466 | ||
431 | class OIPPacket : public QObject | 467 | class OIPPacket : public QObject |
432 | { | 468 | { |
433 | Q_OBJECT | 469 | Q_OBJECT |
434 | 470 | ||
435 | public: | 471 | public: |
436 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); | 472 | OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); |
437 | virtual ~OIPPacket(); | 473 | virtual ~OIPPacket(); |
438 | 474 | ||
439 | QHostAddress fromIPAddress() const; | 475 | QHostAddress fromIPAddress() const; |
440 | QHostAddress toIPAddress() const; | 476 | QHostAddress toIPAddress() const; |
441 | 477 | ||
442 | int tos() const; | 478 | int tos() const; |
443 | int len() const; | 479 | int len() const; |
444 | int id() const; | 480 | int id() const; |
445 | int offset() const; | 481 | int offset() const; |
446 | int ttl() const; | 482 | int ttl() const; |
447 | int protocol() const; | 483 | int protocol() const; |
448 | int checksum() const; | 484 | int checksum() const; |
449 | 485 | ||
450 | private: | 486 | private: |
451 | const struct iphdr* _iphdr; | 487 | const struct iphdr* _iphdr; |
488 | class Private; | ||
489 | Private *d; | ||
452 | }; | 490 | }; |
453 | 491 | ||
454 | /*====================================================================================== | 492 | /*====================================================================================== |
455 | * OARPPacket | 493 | * OARPPacket |
456 | *======================================================================================*/ | 494 | *======================================================================================*/ |
457 | 495 | ||
458 | class OARPPacket : public QObject | 496 | class OARPPacket : public QObject |
459 | { | 497 | { |
460 | Q_OBJECT | 498 | Q_OBJECT |
461 | 499 | ||
462 | public: | 500 | public: |
463 | OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); | 501 | OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); |
464 | virtual ~OARPPacket(); | 502 | virtual ~OARPPacket(); |
465 | 503 | ||
466 | QHostAddress senderIPV4Address() const; | 504 | QHostAddress senderIPV4Address() const; |
467 | OMacAddress senderMacAddress() const; | 505 | OMacAddress senderMacAddress() const; |
468 | QHostAddress targetIPV4Address() const; | 506 | QHostAddress targetIPV4Address() const; |
469 | OMacAddress targetMacAddress() const; | 507 | OMacAddress targetMacAddress() const; |
470 | 508 | ||
471 | //int type() const; | 509 | //int type() const; |
472 | QString type() const; | 510 | QString type() const; |
473 | 511 | ||
474 | private: | 512 | private: |
475 | const struct myarphdr* _arphdr; | 513 | const struct myarphdr* _arphdr; |
514 | class Private; | ||
515 | Private *d; | ||
476 | }; | 516 | }; |
477 | 517 | ||
478 | /*====================================================================================== | 518 | /*====================================================================================== |
479 | * OUDPPacket | 519 | * OUDPPacket |
480 | *======================================================================================*/ | 520 | *======================================================================================*/ |
481 | 521 | ||
482 | class OUDPPacket : public QObject | 522 | class OUDPPacket : public QObject |
483 | { | 523 | { |
484 | Q_OBJECT | 524 | Q_OBJECT |
485 | 525 | ||
486 | public: | 526 | public: |
487 | OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); | 527 | OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); |
488 | virtual ~OUDPPacket(); | 528 | virtual ~OUDPPacket(); |
489 | 529 | ||
490 | int fromPort() const; | 530 | int fromPort() const; |
491 | int toPort() const; | 531 | int toPort() const; |
492 | int length() const; | 532 | int length() const; |
493 | int checksum() const; | 533 | int checksum() const; |
494 | 534 | ||
495 | private: | 535 | private: |
496 | const struct udphdr* _udphdr; | 536 | const struct udphdr* _udphdr; |
537 | class Private; | ||
538 | Private *d; | ||
497 | }; | 539 | }; |
498 | 540 | ||
499 | /*====================================================================================== | 541 | /*====================================================================================== |
500 | * ODHCPPacket | 542 | * ODHCPPacket |
501 | *======================================================================================*/ | 543 | *======================================================================================*/ |
502 | 544 | ||
503 | class ODHCPPacket : public QObject | 545 | class ODHCPPacket : public QObject |
504 | { | 546 | { |
505 | Q_OBJECT | 547 | Q_OBJECT |
506 | 548 | ||
507 | public: | 549 | public: |
508 | ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); | 550 | ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); |
509 | virtual ~ODHCPPacket(); | 551 | virtual ~ODHCPPacket(); |
510 | 552 | ||
511 | QHostAddress clientAddress() const; | 553 | QHostAddress clientAddress() const; |
512 | QHostAddress yourAddress() const; | 554 | QHostAddress yourAddress() const; |
513 | QHostAddress serverAddress() const; | 555 | QHostAddress serverAddress() const; |
514 | QHostAddress relayAddress() const; | 556 | QHostAddress relayAddress() const; |
515 | 557 | ||
516 | OMacAddress clientMacAddress() const; | 558 | OMacAddress clientMacAddress() const; |
517 | 559 | ||
518 | bool isRequest() const; | 560 | bool isRequest() const; |
519 | bool isReply() const; | 561 | bool isReply() const; |
520 | QString type() const; | 562 | QString type() const; |
521 | 563 | ||
522 | private: | 564 | private: |
523 | const struct dhcp_packet* _dhcphdr; | 565 | const struct dhcp_packet* _dhcphdr; |
524 | unsigned char _type; | 566 | unsigned char _type; |
567 | class Private; | ||
568 | Private *d; | ||
525 | }; | 569 | }; |
526 | 570 | ||
527 | /*====================================================================================== | 571 | /*====================================================================================== |
528 | * OTCPPacket | 572 | * OTCPPacket |
529 | *======================================================================================*/ | 573 | *======================================================================================*/ |
530 | 574 | ||
531 | class OTCPPacket : public QObject | 575 | class OTCPPacket : public QObject |
532 | { | 576 | { |
533 | Q_OBJECT | 577 | Q_OBJECT |
534 | 578 | ||
535 | public: | 579 | public: |
536 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); | 580 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); |
537 | virtual ~OTCPPacket(); | 581 | virtual ~OTCPPacket(); |
538 | 582 | ||
539 | int fromPort() const; | 583 | int fromPort() const; |
540 | int toPort() const; | 584 | int toPort() const; |
541 | int seq() const; | 585 | int seq() const; |
542 | int ack() const; | 586 | int ack() const; |
543 | int window() const; | 587 | int window() const; |
544 | int checksum() const; | 588 | int checksum() const; |
545 | 589 | ||
546 | private: | 590 | private: |
547 | const struct tcphdr* _tcphdr; | 591 | const struct tcphdr* _tcphdr; |
592 | class Private; | ||
593 | Private *d; | ||
548 | }; | 594 | }; |
549 | 595 | ||
550 | 596 | ||
551 | /*====================================================================================== | 597 | /*====================================================================================== |
552 | * OPacketCapturer | 598 | * OPacketCapturer |
553 | *======================================================================================*/ | 599 | *======================================================================================*/ |
554 | 600 | ||
555 | /** | 601 | /** |
556 | * @brief A class based wrapper for network packet capturing. | 602 | * @brief A class based wrapper for network packet capturing. |
557 | * | 603 | * |
558 | * This class is the base of a high-level interface to the well known packet capturing | 604 | * This class is the base of a high-level interface to the well known packet capturing |
559 | * library libpcap. | 605 | * library libpcap. |
560 | * @see http://tcpdump.org | 606 | * @see http://tcpdump.org |
561 | */ | 607 | */ |
562 | class OPacketCapturer : public QObject | 608 | class OPacketCapturer : public QObject |
563 | { | 609 | { |
@@ -652,20 +698,24 @@ class OPacketCapturer : public QObject | |||
652 | /** | 698 | /** |
653 | * This signal is emitted, when a packet has been received. | 699 | * This signal is emitted, when a packet has been received. |
654 | */ | 700 | */ |
655 | void receivedPacket( OPacket* ); | 701 | void receivedPacket( OPacket* ); |
656 | 702 | ||
657 | protected slots: | 703 | protected slots: |
658 | void readyToReceive(); | 704 | void readyToReceive(); |
659 | 705 | ||
660 | protected: | 706 | protected: |
661 | QString _name; // devicename | 707 | QString _name; // devicename |
662 | bool _open; // check this before doing pcap calls | 708 | bool _open; // check this before doing pcap calls |
663 | pcap_t* _pch; // pcap library handle | 709 | pcap_t* _pch; // pcap library handle |
664 | pcap_dumper_t* _pcd; // pcap dumper handle | 710 | pcap_dumper_t* _pcd; // pcap dumper handle |
665 | QSocketNotifier* _sn; // socket notifier for main loop | 711 | QSocketNotifier* _sn; // socket notifier for main loop |
666 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap | 712 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap |
667 | QMap<QString, int> _stats; // statistics; | 713 | QMap<QString, int> _stats; // statistics; |
714 | class Private; // Private Forward declaration | ||
715 | Private *d; // if we need to add data | ||
668 | }; | 716 | }; |
717 | } | ||
718 | } | ||
669 | 719 | ||
670 | #endif // OPCAP_H | 720 | #endif // OPCAP_H |
671 | 721 | ||
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp index 8c989d8..140b924 100644 --- a/libopie2/opienet/ostation.cpp +++ b/libopie2/opienet/ostation.cpp | |||
@@ -18,47 +18,55 @@ | |||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/ostation.h> | 31 | #include <opie2/ostation.h> |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | |||
35 | using namespace Opie::Core; | ||
36 | |||
37 | namespace Opie { | ||
38 | namespace Net { | ||
34 | /*====================================================================================== | 39 | /*====================================================================================== |
35 | * OStation | 40 | * OStation |
36 | *======================================================================================*/ | 41 | *======================================================================================*/ |
37 | 42 | ||
38 | OStation::OStation() | 43 | OStation::OStation() |
39 | { | 44 | { |
40 | odebug << "OStation::OStation()" << oendl; | 45 | odebug << "OStation::OStation()" << oendl; |
41 | 46 | ||
42 | type = "<unknown>"; | 47 | type = "<unknown>"; |
43 | macAddress = OMacAddress::unknown; | 48 | macAddress = OMacAddress::unknown; |
44 | ssid = "<unknown>"; | 49 | ssid = "<unknown>"; |
45 | channel = 0; | 50 | channel = 0; |
46 | apAddress = OMacAddress::unknown; | 51 | apAddress = OMacAddress::unknown; |
47 | 52 | ||
48 | } | 53 | } |
49 | 54 | ||
50 | 55 | ||
51 | OStation::~OStation() | 56 | OStation::~OStation() |
52 | { | 57 | { |
53 | odebug << "OStation::~OStation()" << oendl; | 58 | odebug << "OStation::~OStation()" << oendl; |
54 | } | 59 | } |
55 | 60 | ||
56 | 61 | ||
57 | void OStation::dump() | 62 | void OStation::dump() |
58 | { | 63 | { |
59 | odebug << "------- OStation::dump() ------------" << oendl; | 64 | odebug << "------- OStation::dump() ------------" << oendl; |
60 | qDebug( "type: %s", (const char*) type ); | 65 | qDebug( "type: %s", (const char*) type ); |
61 | qDebug( "mac: %s", (const char*) macAddress.toString() ); | 66 | qDebug( "mac: %s", (const char*) macAddress.toString() ); |
62 | qDebug( "ap: %s", (const char*) apAddress.toString() ); | 67 | qDebug( "ap: %s", (const char*) apAddress.toString() ); |
63 | qDebug( "ip: %s", (const char*) ipAddress.toString() ); | 68 | qDebug( "ip: %s", (const char*) ipAddress.toString() ); |
64 | } | 69 | } |
70 | |||
71 | } | ||
72 | } \ No newline at end of file | ||
diff --git a/libopie2/opienet/ostation.h b/libopie2/opienet/ostation.h index 1e7366d..68f1114 100644 --- a/libopie2/opienet/ostation.h +++ b/libopie2/opienet/ostation.h | |||
@@ -27,47 +27,56 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OSTATION_H | 31 | #ifndef OSTATION_H |
32 | #define OSTATION_H | 32 | #define OSTATION_H |
33 | 33 | ||
34 | #include <opie2/onetutils.h> | 34 | #include <opie2/onetutils.h> |
35 | 35 | ||
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qhostaddress.h> | 38 | #include <qhostaddress.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> |
42 | 42 | ||
43 | namespace Opie { | ||
44 | namespace Net { | ||
45 | |||
43 | class OStation; | 46 | class OStation; |
44 | 47 | ||
48 | |||
45 | typedef QList<OStation> OStationList; | 49 | typedef QList<OStation> OStationList; |
46 | 50 | ||
47 | /*====================================================================================== | 51 | /*====================================================================================== |
48 | * OStation | 52 | * OStation |
49 | *======================================================================================*/ | 53 | *======================================================================================*/ |
50 | 54 | ||
51 | class OStation | 55 | class OStation |
52 | { | 56 | { |
53 | public: | 57 | public: |
54 | OStation(); | 58 | OStation(); |
55 | ~OStation(); | 59 | ~OStation(); |
56 | 60 | ||
57 | void dump(); | 61 | void dump(); |
58 | 62 | ||
59 | /* Ethernet */ | 63 | /* Ethernet */ |
60 | QString type; | 64 | QString type; |
61 | OMacAddress macAddress; | 65 | OMacAddress macAddress; |
62 | QHostAddress ipAddress; | 66 | QHostAddress ipAddress; |
63 | 67 | ||
64 | /* WaveLan */ | 68 | /* WaveLan */ |
65 | QString ssid; | 69 | QString ssid; |
66 | OMacAddress apAddress; | 70 | OMacAddress apAddress; |
67 | int channel; | 71 | int channel; |
68 | bool encrypted; | 72 | bool encrypted; |
73 | private: | ||
74 | class Private; | ||
75 | Private *d; | ||
69 | }; | 76 | }; |
70 | 77 | ||
78 | } | ||
79 | } | ||
71 | 80 | ||
72 | #endif // OSTATION_H | 81 | #endif // OSTATION_H |
73 | 82 | ||
diff --git a/libopie2/opiepim/backend/backends.pro b/libopie2/opiepim/backend/backends.pro index 4231a00..d4867ba 100644 --- a/libopie2/opiepim/backend/backends.pro +++ b/libopie2/opiepim/backend/backends.pro | |||
@@ -1,31 +1,33 @@ | |||
1 | SOURCES += core/backends/ocontactaccessbackend_sql.cpp \ | 1 | SOURCES += core/backends/ocontactaccessbackend_sql.cpp \ |
2 | core/backends/ocontactaccessbackend_vcard.cpp \ | 2 | core/backends/ocontactaccessbackend_vcard.cpp \ |
3 | core/backends/ocontactaccessbackend_xml.cpp \ | 3 | core/backends/ocontactaccessbackend_xml.cpp \ |
4 | core/backends/ocontactaccess.cpp \ | 4 | core/backends/ocontactaccess.cpp \ |
5 | core/backends/odatebookaccessbackend.cpp \ | 5 | core/backends/odatebookaccessbackend.cpp \ |
6 | core/backends/odatebookaccessbackend_xml.cpp \ | 6 | core/backends/odatebookaccessbackend_xml.cpp \ |
7 | core/backends/otodoaccessbackend.cpp \ | 7 | core/backends/otodoaccessbackend.cpp \ |
8 | core/backends/otodoaccess.cpp \ | 8 | core/backends/otodoaccess.cpp \ |
9 | core/backends/otodoaccesssql.cpp \ | 9 | core/backends/otodoaccesssql.cpp \ |
10 | core/backends/otodoaccessvcal.cpp \ | 10 | core/backends/otodoaccessvcal.cpp \ |
11 | core/backends/otodoaccessxml.cpp \ | 11 | core/backends/otodoaccessxml.cpp \ |
12 | core/backends/odatebookaccess.cpp \ | 12 | core/backends/odatebookaccess.cpp \ |
13 | core/backends/odatebookaccessbackend_sql.cpp | 13 | core/backends/odatebookaccessbackend_sql.cpp \ |
14 | core/backends/private/xmltree.cc | ||
14 | 15 | ||
15 | HEADERS += core/backends/obackendfactory.h \ | 16 | HEADERS += core/backends/obackendfactory.h \ |
16 | core/backends/ocontactaccessbackend.h \ | 17 | core/backends/ocontactaccessbackend.h \ |
17 | core/backends/ocontactaccessbackend_sql.h \ | 18 | core/backends/ocontactaccessbackend_sql.h \ |
18 | core/backends/ocontactaccessbackend_vcard.h \ | 19 | core/backends/ocontactaccessbackend_vcard.h \ |
19 | core/backends/ocontactaccessbackend_xml.h \ | 20 | core/backends/ocontactaccessbackend_xml.h \ |
20 | core/backends/ocontactaccess.h \ | 21 | core/backends/ocontactaccess.h \ |
21 | core/backends/odatebookaccessbackend.h \ | 22 | core/backends/odatebookaccessbackend.h \ |
22 | core/backends/odatebookaccessbackend_sql.h \ | 23 | core/backends/odatebookaccessbackend_sql.h \ |
23 | core/backends/odatebookaccessbackend_xml.h \ | 24 | core/backends/odatebookaccessbackend_xml.h \ |
24 | core/backends/opimaccessbackend.h \ | 25 | core/backends/opimaccessbackend.h \ |
25 | core/backends/opimaccesstemplate.h \ | 26 | core/backends/opimaccesstemplate.h \ |
26 | core/backends/otodoaccessbackend.h \ | 27 | core/backends/otodoaccessbackend.h \ |
27 | core/backends/otodoaccess.h \ | 28 | core/backends/otodoaccess.h \ |
28 | core/backends/otodoaccesssql.h \ | 29 | core/backends/otodoaccesssql.h \ |
29 | core/backends/otodoaccessvcal.h \ | 30 | core/backends/otodoaccessvcal.h \ |
30 | core/backends/otodoaccessxml.h \ | 31 | core/backends/otodoaccessxml.h \ |
31 | core/backends/odatebookaccess.h | 32 | core/backends/odatebookaccess.h \ |
33 | core/backends/private/xmltree.h | ||
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index f121cc2..d16d692 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |||
@@ -33,33 +33,33 @@ | |||
33 | #include "ocontactaccessbackend_sql.h" | 33 | #include "ocontactaccessbackend_sql.h" |
34 | 34 | ||
35 | #include <qarray.h> | 35 | #include <qarray.h> |
36 | #include <qdatetime.h> | 36 | #include <qdatetime.h> |
37 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
38 | 38 | ||
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | #include <qpe/recordfields.h> | 40 | #include <qpe/recordfields.h> |
41 | 41 | ||
42 | #include <opie2/opimcontactfields.h> | 42 | #include <opie2/opimcontactfields.h> |
43 | #include <opie2/opimdateconversion.h> | 43 | #include <opie2/opimdateconversion.h> |
44 | #include <opie2/osqldriver.h> | 44 | #include <opie2/osqldriver.h> |
45 | #include <opie2/osqlresult.h> | 45 | #include <opie2/osqlresult.h> |
46 | #include <opie2/osqlmanager.h> | 46 | #include <opie2/osqlmanager.h> |
47 | #include <opie2/osqlquery.h> | 47 | #include <opie2/osqlquery.h> |
48 | 48 | ||
49 | 49 | using namespace Opie::DB; | |
50 | 50 | ||
51 | 51 | ||
52 | // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead | 52 | // If defined, we use a horizontal table ( uid, attr1, attr2, attr3, ..., attrn ) instead |
53 | // vertical like "uid, type, value". | 53 | // vertical like "uid, type, value". |
54 | // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! | 54 | // DON'T DEACTIVATE THIS DEFINE IN PRODUCTIVE ENVIRONMENTS !! |
55 | #define __STORE_HORIZONTAL_ | 55 | #define __STORE_HORIZONTAL_ |
56 | 56 | ||
57 | // Distinct loading is not very fast. If I expect that every person has just | 57 | // Distinct loading is not very fast. If I expect that every person has just |
58 | // one (and always one) 'Last Name', I can request all uid's for existing lastnames, | 58 | // one (and always one) 'Last Name', I can request all uid's for existing lastnames, |
59 | // which is faster.. | 59 | // which is faster.. |
60 | // But this may not be true for all entries, like company contacts.. | 60 | // But this may not be true for all entries, like company contacts.. |
61 | // The current AddressBook application handles this problem, but other may not.. (eilers) | 61 | // The current AddressBook application handles this problem, but other may not.. (eilers) |
62 | #define __USE_SUPERFAST_LOADQUERY | 62 | #define __USE_SUPERFAST_LOADQUERY |
63 | 63 | ||
64 | 64 | ||
65 | /* | 65 | /* |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h index 58ae2ae..ba122ec 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.h +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.h | |||
@@ -27,35 +27,39 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | /* | 29 | /* |
30 | * SQL Backend for the OPIE-Contact Database. | 30 | * SQL Backend for the OPIE-Contact Database. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef _OPimContactAccessBackend_SQL_ | 33 | #ifndef _OPimContactAccessBackend_SQL_ |
34 | #define _OPimContactAccessBackend_SQL_ | 34 | #define _OPimContactAccessBackend_SQL_ |
35 | 35 | ||
36 | #include <opie2/ocontactaccessbackend.h> | 36 | #include <opie2/ocontactaccessbackend.h> |
37 | #include <opie2/ocontactaccess.h> | 37 | #include <opie2/ocontactaccess.h> |
38 | 38 | ||
39 | #include <qlist.h> | 39 | #include <qlist.h> |
40 | #include <qdict.h> | 40 | #include <qdict.h> |
41 | 41 | ||
42 | /* aren't in namespace Opie yet - alwin */ | 42 | /* aren't in namespace Opie yet - alwin */ |
43 | namespace Opie { | ||
44 | namespace DB { | ||
43 | class OSQLDriver; | 45 | class OSQLDriver; |
44 | class OSQLResult; | 46 | class OSQLResult; |
45 | class OSQLResultItem; | 47 | class OSQLResultItem; |
48 | } | ||
49 | } | ||
46 | 50 | ||
47 | namespace Opie { | 51 | namespace Opie { |
48 | 52 | ||
49 | /* the default xml implementation */ | 53 | /* the default xml implementation */ |
50 | /** | 54 | /** |
51 | * This class is the SQL implementation of a Contact backend | 55 | * This class is the SQL implementation of a Contact backend |
52 | * it does implement everything available for OPimContact. | 56 | * it does implement everything available for OPimContact. |
53 | * @see OPimAccessBackend for more information of available methods | 57 | * @see OPimAccessBackend for more information of available methods |
54 | */ | 58 | */ |
55 | class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { | 59 | class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { |
56 | public: | 60 | public: |
57 | OPimContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); | 61 | OPimContactAccessBackend_SQL ( const QString& appname, const QString& filename = QString::null ); |
58 | 62 | ||
59 | ~OPimContactAccessBackend_SQL (); | 63 | ~OPimContactAccessBackend_SQL (); |
60 | 64 | ||
61 | bool save(); | 65 | bool save(); |
@@ -78,32 +82,32 @@ class OPimContactAccessBackend_SQL : public OPimContactAccessBackend { | |||
78 | QArray<int> matchRegexp( const QRegExp &r ) const; | 82 | QArray<int> matchRegexp( const QRegExp &r ) const; |
79 | 83 | ||
80 | const uint querySettings(); | 84 | const uint querySettings(); |
81 | 85 | ||
82 | bool hasQuerySettings (uint querySettings) const; | 86 | bool hasQuerySettings (uint querySettings) const; |
83 | 87 | ||
84 | // Currently only asc implemented.. | 88 | // Currently only asc implemented.. |
85 | QArray<int> sorted( bool asc, int , int , int ); | 89 | QArray<int> sorted( bool asc, int , int , int ); |
86 | bool add ( const OPimContact &newcontact ); | 90 | bool add ( const OPimContact &newcontact ); |
87 | 91 | ||
88 | bool replace ( const OPimContact &contact ); | 92 | bool replace ( const OPimContact &contact ); |
89 | 93 | ||
90 | bool remove ( int uid ); | 94 | bool remove ( int uid ); |
91 | bool reload(); | 95 | bool reload(); |
92 | 96 | ||
93 | private: | 97 | private: |
94 | QArray<int> extractUids( OSQLResult& res ) const; | 98 | QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; |
95 | QMap<int, QString> requestNonCustom( int uid ) const; | 99 | QMap<int, QString> requestNonCustom( int uid ) const; |
96 | QMap<QString, QString> requestCustom( int uid ) const; | 100 | QMap<QString, QString> requestCustom( int uid ) const; |
97 | void update(); | 101 | void update(); |
98 | 102 | ||
99 | protected: | 103 | protected: |
100 | bool m_changed; | 104 | bool m_changed; |
101 | QString m_fileName; | 105 | QString m_fileName; |
102 | QArray<int> m_uids; | 106 | QArray<int> m_uids; |
103 | 107 | ||
104 | OSQLDriver* m_driver; | 108 | Opie::DB::OSQLDriver* m_driver; |
105 | }; | 109 | }; |
106 | 110 | ||
107 | } | 111 | } |
108 | 112 | ||
109 | #endif | 113 | #endif |
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 5d92b8f..f5e76d5 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp | |||
@@ -28,40 +28,41 @@ | |||
28 | */ | 28 | */ |
29 | /* | 29 | /* |
30 | * XML Backend for the OPIE-Contact Database. | 30 | * XML Backend for the OPIE-Contact Database. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <opie2/ocontactaccessbackend_xml.h> | 33 | #include <opie2/ocontactaccessbackend_xml.h> |
34 | 34 | ||
35 | #include <qasciidict.h> | 35 | #include <qasciidict.h> |
36 | #include <qfile.h> | 36 | #include <qfile.h> |
37 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qarray.h> | 39 | #include <qarray.h> |
40 | #include <qmap.h> | 40 | #include <qmap.h> |
41 | 41 | ||
42 | #include <qpe/global.h> | 42 | #include <qpe/global.h> |
43 | 43 | ||
44 | #include <opie2/xmltree.h> | 44 | #include "private/xmltree.h" |
45 | #include <opie2/ocontactaccessbackend.h> | 45 | #include <opie2/ocontactaccessbackend.h> |
46 | #include <opie2/ocontactaccess.h> | 46 | #include <opie2/ocontactaccess.h> |
47 | 47 | ||
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | #include <errno.h> | 49 | #include <errno.h> |
50 | 50 | ||
51 | using namespace Opie; | 51 | using namespace Opie; |
52 | using namespace Opie::Pim::Private; | ||
52 | 53 | ||
53 | 54 | ||
54 | namespace Opie { | 55 | namespace Opie { |
55 | OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ): | 56 | OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ): |
56 | m_changed( false ) | 57 | m_changed( false ) |
57 | { | 58 | { |
58 | // Just m_contactlist should call delete if an entry | 59 | // Just m_contactlist should call delete if an entry |
59 | // is removed. | 60 | // is removed. |
60 | m_contactList.setAutoDelete( true ); | 61 | m_contactList.setAutoDelete( true ); |
61 | m_uidToContact.setAutoDelete( false ); | 62 | m_uidToContact.setAutoDelete( false ); |
62 | 63 | ||
63 | m_appName = appname; | 64 | m_appName = appname; |
64 | 65 | ||
65 | /* Set journalfile name ... */ | 66 | /* Set journalfile name ... */ |
66 | m_journalName = getenv("HOME"); | 67 | m_journalName = getenv("HOME"); |
67 | m_journalName +="/.abjournal" + appname; | 68 | m_journalName +="/.abjournal" + appname; |
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp index 2ee76cc..a779dc1 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp | |||
@@ -33,32 +33,34 @@ | |||
33 | 33 | ||
34 | #include <stdio.h> | 34 | #include <stdio.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | 36 | ||
37 | #include <qarray.h> | 37 | #include <qarray.h> |
38 | #include <qstringlist.h> | 38 | #include <qstringlist.h> |
39 | 39 | ||
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | 41 | ||
42 | #include <opie2/osqldriver.h> | 42 | #include <opie2/osqldriver.h> |
43 | #include <opie2/osqlmanager.h> | 43 | #include <opie2/osqlmanager.h> |
44 | #include <opie2/osqlquery.h> | 44 | #include <opie2/osqlquery.h> |
45 | 45 | ||
46 | #include <opie2/opimrecurrence.h> | 46 | #include <opie2/opimrecurrence.h> |
47 | #include <opie2/odatebookaccessbackend_sql.h> | 47 | #include <opie2/odatebookaccessbackend_sql.h> |
48 | 48 | ||
49 | using namespace Opie::DB; | ||
50 | |||
49 | namespace Opie { | 51 | namespace Opie { |
50 | 52 | ||
51 | 53 | ||
52 | ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , | 54 | ODateBookAccessBackend_SQL::ODateBookAccessBackend_SQL( const QString& , |
53 | const QString& fileName ) | 55 | const QString& fileName ) |
54 | : ODateBookAccessBackend(), m_driver( NULL ) | 56 | : ODateBookAccessBackend(), m_driver( NULL ) |
55 | { | 57 | { |
56 | m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; | 58 | m_fileName = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.db" ) : fileName; |
57 | 59 | ||
58 | // Get the standart sql-driver from the OSQLManager.. | 60 | // Get the standart sql-driver from the OSQLManager.. |
59 | OSQLManager man; | 61 | OSQLManager man; |
60 | m_driver = man.standard(); | 62 | m_driver = man.standard(); |
61 | m_driver->setUrl( m_fileName ); | 63 | m_driver->setUrl( m_fileName ); |
62 | 64 | ||
63 | initFields(); | 65 | initFields(); |
64 | 66 | ||
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h index cbfeb97..60d7f21 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.h +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.h | |||
@@ -21,33 +21,37 @@ | |||
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H | 29 | #ifndef OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H |
30 | #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H | 30 | #define OPIE_DATE_BOOK_ACCESS_BACKEND_SQL__H |
31 | 31 | ||
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #include <opie2/osqlresult.h> | 33 | #include <opie2/osqlresult.h> |
34 | 34 | ||
35 | #include <opie2/odatebookaccessbackend.h> | 35 | #include <opie2/odatebookaccessbackend.h> |
36 | 36 | ||
37 | namespace Opie { | ||
38 | namespace DB { | ||
37 | class OSQLDriver; | 39 | class OSQLDriver; |
40 | } | ||
41 | } | ||
38 | 42 | ||
39 | namespace Opie { | 43 | namespace Opie { |
40 | /** | 44 | /** |
41 | * This is the default SQL implementation for DateBoook SQL storage | 45 | * This is the default SQL implementation for DateBoook SQL storage |
42 | * It fully implements the interface | 46 | * It fully implements the interface |
43 | * @see ODateBookAccessBackend | 47 | * @see ODateBookAccessBackend |
44 | * @see OPimAccessBackend | 48 | * @see OPimAccessBackend |
45 | */ | 49 | */ |
46 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { | 50 | class ODateBookAccessBackend_SQL : public ODateBookAccessBackend { |
47 | public: | 51 | public: |
48 | ODateBookAccessBackend_SQL( const QString& appName, | 52 | ODateBookAccessBackend_SQL( const QString& appName, |
49 | const QString& fileName = QString::null); | 53 | const QString& fileName = QString::null); |
50 | ~ODateBookAccessBackend_SQL(); | 54 | ~ODateBookAccessBackend_SQL(); |
51 | 55 | ||
52 | bool load(); | 56 | bool load(); |
53 | bool reload(); | 57 | bool reload(); |
@@ -64,30 +68,30 @@ public: | |||
64 | 68 | ||
65 | QArray<UID> rawEvents()const; | 69 | QArray<UID> rawEvents()const; |
66 | QArray<UID> rawRepeats()const; | 70 | QArray<UID> rawRepeats()const; |
67 | QArray<UID> nonRepeats()const; | 71 | QArray<UID> nonRepeats()const; |
68 | 72 | ||
69 | OPimEvent::ValueList directNonRepeats(); | 73 | OPimEvent::ValueList directNonRepeats(); |
70 | OPimEvent::ValueList directRawRepeats(); | 74 | OPimEvent::ValueList directRawRepeats(); |
71 | 75 | ||
72 | private: | 76 | private: |
73 | bool loadFile(); | 77 | bool loadFile(); |
74 | QString m_fileName; | 78 | QString m_fileName; |
75 | QArray<int> m_uids; | 79 | QArray<int> m_uids; |
76 | 80 | ||
77 | QMap<int, QString> m_fieldMap; | 81 | QMap<int, QString> m_fieldMap; |
78 | QMap<QString, int> m_reverseFieldMap; | 82 | QMap<QString, int> m_reverseFieldMap; |
79 | 83 | ||
80 | OSQLDriver* m_driver; | 84 | Opie::DB::OSQLDriver* m_driver; |
81 | 85 | ||
82 | class Private; | 86 | class Private; |
83 | Private *d; | 87 | Private *d; |
84 | 88 | ||
85 | void initFields(); | 89 | void initFields(); |
86 | void update(); | 90 | void update(); |
87 | QArray<int> extractUids( OSQLResult& res ) const; | 91 | QArray<int> extractUids( Opie::DB::OSQLResult& res ) const; |
88 | 92 | ||
89 | }; | 93 | }; |
90 | 94 | ||
91 | } | 95 | } |
92 | 96 | ||
93 | #endif | 97 | #endif |
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 72232e5..d218090 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp | |||
@@ -28,32 +28,34 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | 31 | ||
32 | #include <qpe/global.h> | 32 | #include <qpe/global.h> |
33 | 33 | ||
34 | #include <opie2/osqldriver.h> | 34 | #include <opie2/osqldriver.h> |
35 | #include <opie2/osqlresult.h> | 35 | #include <opie2/osqlresult.h> |
36 | #include <opie2/osqlmanager.h> | 36 | #include <opie2/osqlmanager.h> |
37 | #include <opie2/osqlquery.h> | 37 | #include <opie2/osqlquery.h> |
38 | 38 | ||
39 | #include <opie2/otodoaccesssql.h> | 39 | #include <opie2/otodoaccesssql.h> |
40 | #include <opie2/opimstate.h> | 40 | #include <opie2/opimstate.h> |
41 | #include <opie2/opimnotifymanager.h> | 41 | #include <opie2/opimnotifymanager.h> |
42 | #include <opie2/opimrecurrence.h> | 42 | #include <opie2/opimrecurrence.h> |
43 | 43 | ||
44 | using namespace Opie::DB; | ||
45 | |||
44 | using namespace Opie; | 46 | using namespace Opie; |
45 | /* | 47 | /* |
46 | * first some query | 48 | * first some query |
47 | * CREATE query | 49 | * CREATE query |
48 | * LOAD query | 50 | * LOAD query |
49 | * INSERT | 51 | * INSERT |
50 | * REMOVE | 52 | * REMOVE |
51 | * CLEAR | 53 | * CLEAR |
52 | */ | 54 | */ |
53 | namespace { | 55 | namespace { |
54 | /** | 56 | /** |
55 | * CreateQuery for the Todolist Table | 57 | * CreateQuery for the Todolist Table |
56 | */ | 58 | */ |
57 | class CreateQuery : public OSQLQuery { | 59 | class CreateQuery : public OSQLQuery { |
58 | public: | 60 | public: |
59 | CreateQuery(); | 61 | CreateQuery(); |
diff --git a/libopie2/opiepim/backend/otodoaccesssql.h b/libopie2/opiepim/backend/otodoaccesssql.h index e945863..0ae2591 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.h +++ b/libopie2/opiepim/backend/otodoaccesssql.h | |||
@@ -20,35 +20,39 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #ifndef OPIE_PIM_ACCESS_SQL_H | 29 | #ifndef OPIE_PIM_ACCESS_SQL_H |
30 | #define OPIE_PIM_ACCESS_SQL_H | 30 | #define OPIE_PIM_ACCESS_SQL_H |
31 | 31 | ||
32 | #include <qasciidict.h> | 32 | #include <qasciidict.h> |
33 | 33 | ||
34 | #include <opie2/otodoaccessbackend.h> | 34 | #include <opie2/otodoaccessbackend.h> |
35 | 35 | ||
36 | namespace Opie { | ||
37 | namespace DB { | ||
36 | class OSQLDriver; | 38 | class OSQLDriver; |
37 | class OSQLResult; | 39 | class OSQLResult; |
38 | class OSQLResultItem; | 40 | class OSQLResultItem; |
41 | } | ||
42 | } | ||
39 | 43 | ||
40 | namespace Opie { | 44 | namespace Opie { |
41 | 45 | ||
42 | class OPimTodoAccessBackendSQL : public OPimTodoAccessBackend { | 46 | class OPimTodoAccessBackendSQL : public OPimTodoAccessBackend { |
43 | public: | 47 | public: |
44 | OPimTodoAccessBackendSQL( const QString& file ); | 48 | OPimTodoAccessBackendSQL( const QString& file ); |
45 | ~OPimTodoAccessBackendSQL(); | 49 | ~OPimTodoAccessBackendSQL(); |
46 | 50 | ||
47 | bool load(); | 51 | bool load(); |
48 | bool reload(); | 52 | bool reload(); |
49 | bool save(); | 53 | bool save(); |
50 | QArray<int> allRecords()const; | 54 | QArray<int> allRecords()const; |
51 | 55 | ||
52 | QArray<int> queryByExample( const OPimTodo& t, int settings, const QDateTime& d = QDateTime() ); | 56 | QArray<int> queryByExample( const OPimTodo& t, int settings, const QDateTime& d = QDateTime() ); |
53 | OPimTodo find(int uid)const; | 57 | OPimTodo find(int uid)const; |
54 | OPimTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; | 58 | OPimTodo find(int uid, const QArray<int>&, uint cur, Frontend::CacheDirection )const; |
@@ -58,31 +62,31 @@ public: | |||
58 | bool replace( const OPimTodo& t ); | 62 | bool replace( const OPimTodo& t ); |
59 | 63 | ||
60 | QArray<int> overDue(); | 64 | QArray<int> overDue(); |
61 | QArray<int> effectiveToDos( const QDate& start, | 65 | QArray<int> effectiveToDos( const QDate& start, |
62 | const QDate& end, bool includeNoDates ); | 66 | const QDate& end, bool includeNoDates ); |
63 | QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); | 67 | QArray<int> sorted(bool asc, int sortOrder, int sortFilter, int cat ); |
64 | 68 | ||
65 | QBitArray supports()const; | 69 | QBitArray supports()const; |
66 | QArray<int> matchRegexp( const QRegExp &r ) const; | 70 | QArray<int> matchRegexp( const QRegExp &r ) const; |
67 | void removeAllCompleted(); | 71 | void removeAllCompleted(); |
68 | 72 | ||
69 | 73 | ||
70 | private: | 74 | private: |
71 | void update()const; | 75 | void update()const; |
72 | void fillDict(); | 76 | void fillDict(); |
73 | inline bool date( QDate& date, const QString& )const; | 77 | inline bool date( QDate& date, const QString& )const; |
74 | inline OPimTodo todo( const OSQLResult& )const; | 78 | inline OPimTodo todo( const Opie::DB::OSQLResult& )const; |
75 | inline OPimTodo todo( OSQLResultItem& )const; | 79 | inline OPimTodo todo( Opie::DB::OSQLResultItem& )const; |
76 | inline QArray<int> uids( const OSQLResult& )const; | 80 | inline QArray<int> uids( const Opie::DB::OSQLResult& )const; |
77 | OPimTodo todo( int uid )const; | 81 | OPimTodo todo( int uid )const; |
78 | QBitArray sup() const; | 82 | QBitArray sup() const; |
79 | 83 | ||
80 | QAsciiDict<int> m_dict; | 84 | QAsciiDict<int> m_dict; |
81 | OSQLDriver* m_driver; | 85 | Opie::DB::OSQLDriver* m_driver; |
82 | QArray<int> m_uids; | 86 | QArray<int> m_uids; |
83 | bool m_dirty : 1; | 87 | bool m_dirty : 1; |
84 | }; | 88 | }; |
85 | 89 | ||
86 | } | 90 | } |
87 | 91 | ||
88 | #endif | 92 | #endif |
diff --git a/libopie2/opiecore/xmltree.cc b/libopie2/opiepim/core/backends/private/xmltree.cc index 059791b..40749ca 100644 --- a/libopie2/opiecore/xmltree.cc +++ b/libopie2/opiepim/core/backends/private/xmltree.cc | |||
@@ -4,41 +4,41 @@ | |||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <opie2/xmltree.h> | 20 | #include "xmltree.h" |
21 | 21 | ||
22 | #include <qpe/stringutil.h> | 22 | #include <qpe/stringutil.h> |
23 | 23 | ||
24 | #include <qxml.h> | 24 | #include <qxml.h> |
25 | 25 | ||
26 | #include <assert.h> | 26 | #include <assert.h> |
27 | 27 | ||
28 | using namespace Opie; | 28 | using namespace Opie::Pim::Private; |
29 | 29 | ||
30 | XMLElement::XMLElement() | 30 | XMLElement::XMLElement() |
31 | : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) | 31 | : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | XMLElement::~XMLElement() | 35 | XMLElement::~XMLElement() |
36 | { | 36 | { |
37 | XMLElement *n = m_first; | 37 | XMLElement *n = m_first; |
38 | 38 | ||
39 | while ( n ) | 39 | while ( n ) |
40 | { | 40 | { |
41 | XMLElement *tmp = n; | 41 | XMLElement *tmp = n; |
42 | n = n->m_next; | 42 | n = n->m_next; |
43 | delete tmp; | 43 | delete tmp; |
44 | } | 44 | } |
diff --git a/libopie2/opiecore/xmltree.h b/libopie2/opiepim/core/backends/private/xmltree.h index 4b6bdfa..9817a02 100644 --- a/libopie2/opiecore/xmltree.h +++ b/libopie2/opiepim/core/backends/private/xmltree.h | |||
@@ -12,34 +12,35 @@ | |||
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | 20 | ||
21 | #ifndef __bookmarks_h__ | 21 | #ifndef __bookmarks_h__ |
22 | #define __bookmarks_h__ | 22 | #define __bookmarks_h__ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qmap.h> | 25 | #include <qmap.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | 27 | ||
28 | namespace Opie | 28 | namespace Opie { |
29 | { | 29 | namespace Pim { |
30 | namespace Private{ | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * A small xml lib written by Simon Hausmann. | 33 | * A small xml lib written by Simon Hausmann. |
33 | */ | 34 | */ |
34 | class XMLElement | 35 | class XMLElement |
35 | { | 36 | { |
36 | public: | 37 | public: |
37 | typedef QMap<QString, QString> AttributeMap; | 38 | typedef QMap<QString, QString> AttributeMap; |
38 | 39 | ||
39 | /** | 40 | /** |
40 | * The constructor of XMLElement | 41 | * The constructor of XMLElement |
41 | */ | 42 | */ |
42 | XMLElement(); | 43 | XMLElement(); |
43 | ~XMLElement(); | 44 | ~XMLElement(); |
44 | 45 | ||
45 | /** appendChild appends a child to the XMLElement behind the last element. | 46 | /** appendChild appends a child to the XMLElement behind the last element. |
@@ -101,19 +102,21 @@ private: | |||
101 | QString m_tag; | 102 | QString m_tag; |
102 | QString m_value; | 103 | QString m_value; |
103 | AttributeMap m_attributes; | 104 | AttributeMap m_attributes; |
104 | 105 | ||
105 | XMLElement *m_parent; | 106 | XMLElement *m_parent; |
106 | XMLElement *m_next; | 107 | XMLElement *m_next; |
107 | XMLElement *m_prev; | 108 | XMLElement *m_prev; |
108 | XMLElement *m_first; | 109 | XMLElement *m_first; |
109 | XMLElement *m_last; | 110 | XMLElement *m_last; |
110 | 111 | ||
111 | XMLElement( const XMLElement &rhs ); | 112 | XMLElement( const XMLElement &rhs ); |
112 | XMLElement &operator=( const XMLElement &rhs ); | 113 | XMLElement &operator=( const XMLElement &rhs ); |
113 | class Private; | 114 | class Private; |
114 | Private* d; | 115 | Private* d; |
115 | }; | 116 | }; |
116 | 117 | ||
118 | } | ||
119 | } | ||
117 | } // namespace Opie | 120 | } // namespace Opie |
118 | 121 | ||
119 | #endif | 122 | #endif |
diff --git a/libopie2/opieui/big-screen/obigscreen_p.h b/libopie2/opieui/big-screen/obigscreen_p.h index db8fc83..a85a56c 100644 --- a/libopie2/opieui/big-screen/obigscreen_p.h +++ b/libopie2/opieui/big-screen/obigscreen_p.h | |||
@@ -1,28 +1,31 @@ | |||
1 | #ifndef OPIE_BIG_SCREEN_PRIVATE | 1 | #ifndef OPIE_BIG_SCREEN_PRIVATE |
2 | #define OPIE_BIG_SCREEN_PRIVATE | 2 | #define OPIE_BIG_SCREEN_PRIVATE |
3 | 3 | ||
4 | /* QT */ | 4 | /* QT */ |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | class QWidget; | 7 | class QWidget; |
8 | 8 | ||
9 | namespace Opie | 9 | namespace Opie { |
10 | { | 10 | namespace Ui { |
11 | namespace Private{ | ||
11 | 12 | ||
12 | struct OSplitterContainer | 13 | struct OSplitterContainer |
13 | { | 14 | { |
14 | bool operator==( const OSplitterContainer& o) const | 15 | bool operator==( const OSplitterContainer& o) const |
15 | { | 16 | { |
16 | if (widget != o.widget ) return false; | 17 | if (widget != o.widget ) return false; |
17 | if (icon != o.icon ) return false; | 18 | if (icon != o.icon ) return false; |
18 | if (name != o.name ) return false; | 19 | if (name != o.name ) return false; |
19 | return true; | 20 | return true; |
20 | } | 21 | } |
21 | QWidget* widget; | 22 | QWidget* widget; |
22 | QString icon; | 23 | QString icon; |
23 | QString name; | 24 | QString name; |
24 | }; | 25 | }; |
25 | 26 | ||
26 | }; | 27 | } |
28 | } | ||
29 | } | ||
27 | 30 | ||
28 | #endif | 31 | #endif |
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index 89f3793..bcfd3a6 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp | |||
@@ -22,33 +22,34 @@ | |||
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "osplitter.h" | 29 | #include "osplitter.h" |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | #include <opie2/otabwidget.h> | 32 | #include <opie2/otabwidget.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | 37 | ||
38 | using namespace Opie; | 38 | using namespace Opie::Ui; |
39 | using namespace Opie::Ui::Private; | ||
39 | 40 | ||
40 | /** | 41 | /** |
41 | * | 42 | * |
42 | * This is the constructor of OSplitter | 43 | * This is the constructor of OSplitter |
43 | * You might want to call setSizeChange to tell | 44 | * You might want to call setSizeChange to tell |
44 | * OSplitter to change its layout when a specefic | 45 | * OSplitter to change its layout when a specefic |
45 | * mark was crossed. OSplitter sets a default value. | 46 | * mark was crossed. OSplitter sets a default value. |
46 | * | 47 | * |
47 | * You cann add widget with addWidget to the OSplitter. | 48 | * You cann add widget with addWidget to the OSplitter. |
48 | * OSplitter supports also grouping of Splitters where they | 49 | * OSplitter supports also grouping of Splitters where they |
49 | * can share one OTabBar in small screen mode. This can be used | 50 | * can share one OTabBar in small screen mode. This can be used |
50 | * for email clients like vies but see the example. | 51 | * for email clients like vies but see the example. |
51 | * | 52 | * |
52 | * @param orient The orientation wether to layout horizontal or vertical | 53 | * @param orient The orientation wether to layout horizontal or vertical |
53 | * @param parent The parent of this widget | 54 | * @param parent The parent of this widget |
54 | * @param name The name passed on to QObject | 55 | * @param name The name passed on to QObject |
@@ -155,33 +156,33 @@ void OSplitter::setSizeChange( int width_height ) | |||
155 | /** | 156 | /** |
156 | * This functions allows to add another OSplitter and to share | 157 | * This functions allows to add another OSplitter and to share |
157 | * the OTabBar in small screen mode. The ownerships gets transfered. | 158 | * the OTabBar in small screen mode. The ownerships gets transfered. |
158 | * OSplitters are always added after normal widget items | 159 | * OSplitters are always added after normal widget items |
159 | */ | 160 | */ |
160 | void OSplitter::addWidget( OSplitter* split ) | 161 | void OSplitter::addWidget( OSplitter* split ) |
161 | { | 162 | { |
162 | m_splitter.append( split ); | 163 | m_splitter.append( split ); |
163 | 164 | ||
164 | /* | 165 | /* |
165 | * set tab widget | 166 | * set tab widget |
166 | */ | 167 | */ |
167 | if (m_tabWidget ) | 168 | if (m_tabWidget ) |
168 | setTabWidget( m_parentTab ); | 169 | setTabWidget( m_parentTab ); |
169 | else | 170 | else |
170 | { | 171 | { |
171 | Opie::OSplitterContainer con; | 172 | OSplitterContainer con; |
172 | con.widget =split; | 173 | con.widget =split; |
173 | addToBox( con ); | 174 | addToBox( con ); |
174 | } | 175 | } |
175 | } | 176 | } |
176 | 177 | ||
177 | /* | 178 | /* |
178 | * If in a tab it should be removed | 179 | * If in a tab it should be removed |
179 | * and if in a hbox the reparent kills it too | 180 | * and if in a hbox the reparent kills it too |
180 | */ | 181 | */ |
181 | /** | 182 | /** |
182 | * This removes the splitter again. You currently need to call this | 183 | * This removes the splitter again. You currently need to call this |
183 | * before you delete or otherwise you can get mem corruption | 184 | * before you delete or otherwise you can get mem corruption |
184 | * or other weird behaviour. | 185 | * or other weird behaviour. |
185 | * Owner ship gets transfered back to you it's current parent | 186 | * Owner ship gets transfered back to you it's current parent |
186 | * is 0 | 187 | * is 0 |
187 | */ | 188 | */ |
@@ -200,33 +201,33 @@ void OSplitter::removeWidget( OSplitter* split) | |||
200 | * Warning: No null checking of the widget is done. Only on debug | 201 | * Warning: No null checking of the widget is done. Only on debug |
201 | * a message will be outputtet | 202 | * a message will be outputtet |
202 | * | 203 | * |
203 | * @param wid The widget which will be added | 204 | * @param wid The widget which will be added |
204 | * @param icon The icon of the possible Tab | 205 | * @param icon The icon of the possible Tab |
205 | * @param label The label of the possible Tab | 206 | * @param label The label of the possible Tab |
206 | */ | 207 | */ |
207 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) | 208 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) |
208 | { | 209 | { |
209 | #ifdef DEBUG | 210 | #ifdef DEBUG |
210 | if (!wid ) | 211 | if (!wid ) |
211 | { | 212 | { |
212 | qWarning("Widget is not valid!"); | 213 | qWarning("Widget is not valid!"); |
213 | return; | 214 | return; |
214 | } | 215 | } |
215 | #endif | 216 | #endif |
216 | Opie::OSplitterContainer cont; | 217 | OSplitterContainer cont; |
217 | cont.widget = wid; | 218 | cont.widget = wid; |
218 | cont.icon =icon; | 219 | cont.icon =icon; |
219 | cont.name = label; | 220 | cont.name = label; |
220 | 221 | ||
221 | m_container.append( cont ); | 222 | m_container.append( cont ); |
222 | 223 | ||
223 | /* | 224 | /* |
224 | * | 225 | * |
225 | */ | 226 | */ |
226 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | 227 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) |
227 | setTabWidget( m_parentTab ); | 228 | setTabWidget( m_parentTab ); |
228 | else | 229 | else |
229 | { | 230 | { |
230 | if (m_hbox ) | 231 | if (m_hbox ) |
231 | addToBox( cont ); | 232 | addToBox( cont ); |
232 | else | 233 | else |
@@ -383,47 +384,47 @@ void OSplitter::resizeEvent( QResizeEvent* res ) | |||
383 | } | 384 | } |
384 | else if ( res->size().height() > m_size_policy && | 385 | else if ( res->size().height() > m_size_policy && |
385 | m_orient == Vertical ) | 386 | m_orient == Vertical ) |
386 | { | 387 | { |
387 | qWarning("Changng to vbox %s", name() ); | 388 | qWarning("Changng to vbox %s", name() ); |
388 | changeVBox(); | 389 | changeVBox(); |
389 | mode = false; | 390 | mode = false; |
390 | } | 391 | } |
391 | 392 | ||
392 | emit sizeChanged(mode, m_orient ); | 393 | emit sizeChanged(mode, m_orient ); |
393 | } | 394 | } |
394 | 395 | ||
395 | /* | 396 | /* |
396 | * Adds a container to a tab either the parent tab | 397 | * Adds a container to a tab either the parent tab |
397 | * or our own | 398 | * or our own |
398 | */ | 399 | */ |
399 | void OSplitter::addToTab( const Opie::OSplitterContainer& con ) | 400 | void OSplitter::addToTab( const Opie::Ui::Private::OSplitterContainer& con ) |
400 | { | 401 | { |
401 | QWidget *wid = con.widget; | 402 | QWidget *wid = con.widget; |
402 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); | 403 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); |
403 | if (m_parentTab ) | 404 | if (m_parentTab ) |
404 | m_parentTab->addTab( wid, con.icon, con.name ); | 405 | m_parentTab->addTab( wid, con.icon, con.name ); |
405 | else | 406 | else |
406 | m_tabWidget->addTab( wid, con.icon, con.name ); | 407 | m_tabWidget->addTab( wid, con.icon, con.name ); |
407 | } | 408 | } |
408 | 409 | ||
409 | 410 | ||
410 | /* | 411 | /* |
411 | * adds a container to the box | 412 | * adds a container to the box |
412 | */ | 413 | */ |
413 | void OSplitter::addToBox( const Opie::OSplitterContainer& con ) | 414 | void OSplitter::addToBox( const Opie::Ui::Private::OSplitterContainer& con ) |
414 | { | 415 | { |
415 | QWidget* wid = con.widget; | 416 | QWidget* wid = con.widget; |
416 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); | 417 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); |
417 | } | 418 | } |
418 | 419 | ||
419 | 420 | ||
420 | /* | 421 | /* |
421 | * Removes a widget from the tab | 422 | * Removes a widget from the tab |
422 | */ | 423 | */ |
423 | void OSplitter::removeFromTab( QWidget* wid ) | 424 | void OSplitter::removeFromTab( QWidget* wid ) |
424 | { | 425 | { |
425 | if (m_parentTab ) | 426 | if (m_parentTab ) |
426 | m_parentTab->removePage( wid ); | 427 | m_parentTab->removePage( wid ); |
427 | else | 428 | else |
428 | m_tabWidget->removePage( wid ); | 429 | m_tabWidget->removePage( wid ); |
429 | } | 430 | } |
@@ -532,33 +533,33 @@ void OSplitter::changeVBox() | |||
532 | void OSplitter::commonChangeBox() | 533 | void OSplitter::commonChangeBox() |
533 | { | 534 | { |
534 | qWarning(" Name of Splitters is %s", name() ); | 535 | qWarning(" Name of Splitters is %s", name() ); |
535 | 536 | ||
536 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) | 537 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) |
537 | { | 538 | { |
538 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ | 539 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ |
539 | if (m_parentTab ) | 540 | if (m_parentTab ) |
540 | removeFromTab( (*it).widget ); | 541 | removeFromTab( (*it).widget ); |
541 | qWarning("Adding to box %s", (*it).name.latin1() ); | 542 | qWarning("Adding to box %s", (*it).name.latin1() ); |
542 | addToBox( (*it) ); | 543 | addToBox( (*it) ); |
543 | } | 544 | } |
544 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) | 545 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) |
545 | { | 546 | { |
546 | /* tell them the world had changed */ | 547 | /* tell them the world had changed */ |
547 | split->setTabWidget( 0 ); | 548 | split->setTabWidget( 0 ); |
548 | Opie::OSplitterContainer con; | 549 | OSplitterContainer con; |
549 | con.widget = split; | 550 | con.widget = split; |
550 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) | 551 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) |
551 | // : static_cast<QWidget*>(split->m_hbox); | 552 | // : static_cast<QWidget*>(split->m_hbox); |
552 | addToBox( con ); | 553 | addToBox( con ); |
553 | } | 554 | } |
554 | 555 | ||
555 | 556 | ||
556 | 557 | ||
557 | if (m_parentTab ) | 558 | if (m_parentTab ) |
558 | m_parentTab->addTab(m_hbox, iconName(), label() ); | 559 | m_parentTab->addTab(m_hbox, iconName(), label() ); |
559 | else | 560 | else |
560 | { | 561 | { |
561 | qWarning(" setting Box geometry for %s", name() ); | 562 | qWarning(" setting Box geometry for %s", name() ); |
562 | m_hbox->setGeometry( frameRect() ); | 563 | m_hbox->setGeometry( frameRect() ); |
563 | m_hbox->show(); | 564 | m_hbox->show(); |
564 | delete m_tabWidget; | 565 | delete m_tabWidget; |
diff --git a/libopie2/opieui/big-screen/osplitter.h b/libopie2/opieui/big-screen/osplitter.h index 2daae7f..7b5ea53 100644 --- a/libopie2/opieui/big-screen/osplitter.h +++ b/libopie2/opieui/big-screen/osplitter.h | |||
@@ -10,83 +10,83 @@ | |||
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef OSPLITTER_H | 29 | #ifndef OSPLITTER_H |
30 | #define OSPLITTER_H | 30 | #define OSPLITTER_H |
31 | 31 | ||
32 | #include "obigscreen_p.h" | 32 | #include "obigscreen_p.h" |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qframe.h> | 35 | #include <qframe.h> |
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qvaluelist.h> | 38 | #include <qvaluelist.h> |
39 | 39 | ||
40 | class QHBox; | 40 | class QHBox; |
41 | 41 | ||
42 | //template class QValueList<Opie::OSplitterContainer>; | 42 | //template class QValueList<Opie::OSplitterContainer>; |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * TODO | 45 | * TODO |
46 | * -check API docu | 46 | * -check API docu |
47 | * -one more example | 47 | * -one more example |
48 | * -allow inserting at a position | 48 | * -allow inserting at a position |
49 | */ | 49 | */ |
50 | 50 | ||
51 | namespace Opie | 51 | namespace Opie{ |
52 | { | 52 | namespace Ui { |
53 | class OTabWidget; | 53 | class OTabWidget; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * | 56 | * |
57 | * If you've widgets that could be placed side by side but you think | 57 | * If you've widgets that could be placed side by side but you think |
58 | * on small resolutions is not enough place but it would really make sense | 58 | * on small resolutions is not enough place but it would really make sense |
59 | * on bigger resolutions this class will help you. | 59 | * on bigger resolutions this class will help you. |
60 | * You can add as many widgets you want to it. Set a poliy on which width/height it | 60 | * You can add as many widgets you want to it. Set a poliy on which width/height it |
61 | * should switch the layout. | 61 | * should switch the layout. |
62 | * You can either say to place widgets vertical or horizontal. | 62 | * You can either say to place widgets vertical or horizontal. |
63 | * This class uses QHBox, QVBox and QTAbWidget internally. | 63 | * This class uses QHBox, QVBox and QTAbWidget internally. |
64 | * OSplitter takes ownership of the widgets | 64 | * OSplitter takes ownership of the widgets |
65 | * | 65 | * |
66 | * @since 1.2 | 66 | * @since 1.2 |
67 | * | 67 | * |
68 | * @short a small dynamically changing its layout to store two or more widgets side by side | 68 | * @short a small dynamically changing its layout to store two or more widgets side by side |
69 | * @version 0.1 | 69 | * @version 0.1 |
70 | * @author zecke | 70 | * @author zecke |
71 | */ | 71 | */ |
72 | class OSplitter : public QFrame | 72 | class OSplitter : public QFrame |
73 | { | 73 | { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | public: | 75 | public: |
76 | typedef QValueList<Opie::OSplitterContainer> ContainerList; | 76 | typedef QValueList<Opie::Ui::Private::OSplitterContainer> ContainerList; |
77 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, | 77 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, |
78 | const char* name = 0, WFlags fl = 0 ); | 78 | const char* name = 0, WFlags fl = 0 ); |
79 | ~OSplitter(); | 79 | ~OSplitter(); |
80 | 80 | ||
81 | void setLabel( const QString& name ); | 81 | void setLabel( const QString& name ); |
82 | void setIconName( const QString& name ); | 82 | void setIconName( const QString& name ); |
83 | QString label()const; | 83 | QString label()const; |
84 | QString iconName()const; | 84 | QString iconName()const; |
85 | 85 | ||
86 | void setSizeChange( int width_height ); | 86 | void setSizeChange( int width_height ); |
87 | 87 | ||
88 | void addWidget( OSplitter* splitter ); | 88 | void addWidget( OSplitter* splitter ); |
89 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); | 89 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); |
90 | void removeWidget( QWidget* ); | 90 | void removeWidget( QWidget* ); |
91 | void removeWidget( OSplitter* ); | 91 | void removeWidget( OSplitter* ); |
92 | 92 | ||
@@ -111,40 +111,41 @@ signals: | |||
111 | * @param b The layout mode | 111 | * @param b The layout mode |
112 | * @param ori The orientation | 112 | * @param ori The orientation |
113 | */ | 113 | */ |
114 | void sizeChanged( bool b, Orientation ori); | 114 | void sizeChanged( bool b, Orientation ori); |
115 | public: | 115 | public: |
116 | // QSize sizeHint()const; | 116 | // QSize sizeHint()const; |
117 | // QSize minimumSizeHint()const; | 117 | // QSize minimumSizeHint()const; |
118 | 118 | ||
119 | protected: | 119 | protected: |
120 | void resizeEvent( QResizeEvent* ); | 120 | void resizeEvent( QResizeEvent* ); |
121 | 121 | ||
122 | private: | 122 | private: |
123 | /* true if OTabMode */ | 123 | /* true if OTabMode */ |
124 | bool layoutMode()const; | 124 | bool layoutMode()const; |
125 | // void reparentAll(); | 125 | // void reparentAll(); |
126 | void setTabWidget( OTabWidget*); | 126 | void setTabWidget( OTabWidget*); |
127 | void addToTab( const Opie::OSplitterContainer& ); | 127 | void addToTab( const Opie::Ui::Private::OSplitterContainer& ); |
128 | void addToBox( const Opie::OSplitterContainer& ); | 128 | void addToBox( const Opie::Ui::Private::OSplitterContainer& ); |
129 | void removeFromTab( QWidget* ); | 129 | void removeFromTab( QWidget* ); |
130 | void changeTab(); | 130 | void changeTab(); |
131 | void changeHBox(); | 131 | void changeHBox(); |
132 | void changeVBox(); | 132 | void changeVBox(); |
133 | void commonChangeBox(); | 133 | void commonChangeBox(); |
134 | QHBox *m_hbox; | 134 | QHBox *m_hbox; |
135 | OTabWidget *m_tabWidget; | 135 | OTabWidget *m_tabWidget; |
136 | OTabWidget *m_parentTab; | 136 | OTabWidget *m_parentTab; |
137 | Orientation m_orient; | 137 | Orientation m_orient; |
138 | int m_size_policy; | 138 | int m_size_policy; |
139 | 139 | ||
140 | ContainerList m_container; | 140 | ContainerList m_container; |
141 | QList<OSplitter> m_splitter; | 141 | QList<OSplitter> m_splitter; |
142 | 142 | ||
143 | QString m_icon, m_name; | 143 | QString m_icon, m_name; |
144 | 144 | ||
145 | struct Private; | 145 | struct Private; |
146 | Private *d; | 146 | Private *d; |
147 | }; | 147 | }; |
148 | }; | 148 | } |
149 | } | ||
149 | 150 | ||
150 | #endif | 151 | #endif |
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index 57e97e3..a0a6355 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp | |||
@@ -19,37 +19,37 @@ | |||
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "owidgetstack.h" | 29 | #include "owidgetstack.h" |
30 | 30 | ||
31 | /* QT */ | 31 | /* QT */ |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
34 | 34 | ||
35 | namespace { | 35 | namespace Opie { |
36 | namespace Ui { | ||
36 | const int mode_size = 330; | 37 | const int mode_size = 330; |
37 | } | ||
38 | 38 | ||
39 | using namespace Opie; | 39 | |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * This is the standard widget. For simple usage see the example. Normally this widget | 42 | * This is the standard widget. For simple usage see the example. Normally this widget |
43 | * is the central widget of a QMainWindow. | 43 | * is the central widget of a QMainWindow. |
44 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not | 44 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not |
45 | * yet recognize removal of children. | 45 | * yet recognize removal of children. |
46 | * | 46 | * |
47 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. | 47 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. |
48 | * Or you use QPEApplication::showMainWidget(). | 48 | * Or you use QPEApplication::showMainWidget(). |
49 | * @param name Name will be passed on to QObject | 49 | * @param name Name will be passed on to QObject |
50 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags | 50 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags |
51 | */ | 51 | */ |
52 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) | 52 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) |
53 | : QFrame( parent, name, fl ) | 53 | : QFrame( parent, name, fl ) |
54 | { | 54 | { |
55 | m_last = m_mWidget = 0; | 55 | m_last = m_mWidget = 0; |
@@ -420,16 +420,19 @@ void OWidgetStack::switchTop() { | |||
420 | QMap<int, QWidget*>::Iterator it = m_list.begin(); | 420 | QMap<int, QWidget*>::Iterator it = m_list.begin(); |
421 | for ( ; it != m_list.end(); ++it ) { | 421 | for ( ; it != m_list.end(); ++it ) { |
422 | /* better than reparenting twice */ | 422 | /* better than reparenting twice */ |
423 | if ( it.data() == m_mWidget ) { | 423 | if ( it.data() == m_mWidget ) { |
424 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); | 424 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); |
425 | m_mWidget->setGeometry( frameRect() ); | 425 | m_mWidget->setGeometry( frameRect() ); |
426 | m_mWidget->show(); | 426 | m_mWidget->show(); |
427 | }else | 427 | }else |
428 | /* ### FIXME we need to place the widget better */ | 428 | /* ### FIXME we need to place the widget better */ |
429 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); | 429 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | delete m_stack; | 433 | delete m_stack; |
434 | m_stack = 0; | 434 | m_stack = 0; |
435 | } | 435 | } |
436 | |||
437 | } | ||
438 | } \ No newline at end of file | ||
diff --git a/libopie2/opieui/big-screen/owidgetstack.h b/libopie2/opieui/big-screen/owidgetstack.h index 53818c8..d2f9a9f 100644 --- a/libopie2/opieui/big-screen/owidgetstack.h +++ b/libopie2/opieui/big-screen/owidgetstack.h | |||
@@ -22,34 +22,34 @@ | |||
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef OWIDGETSTACK_H | 29 | #ifndef OWIDGETSTACK_H |
30 | #define OWIDGETSTACK_H | 30 | #define OWIDGETSTACK_H |
31 | 31 | ||
32 | /* QT*/ | 32 | /* QT*/ |
33 | #include <qframe.h> | 33 | #include <qframe.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | 35 | ||
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | 37 | ||
38 | namespace Opie | 38 | namespace Opie { |
39 | { | 39 | namespace Ui { |
40 | /** | 40 | /** |
41 | * | 41 | * |
42 | * OWidgetStack is the answer to the problem of using Opie at different screen | 42 | * OWidgetStack is the answer to the problem of using Opie at different screen |
43 | * sizes and to have a different behaviour. Most applications use a QWidgetStack | 43 | * sizes and to have a different behaviour. Most applications use a QWidgetStack |
44 | * to supply a view on click. And by clicking the (X) you go back but this | 44 | * to supply a view on click. And by clicking the (X) you go back but this |
45 | * behaviour feels strange on bigger screens. It's ok on smaller one because | 45 | * behaviour feels strange on bigger screens. It's ok on smaller one because |
46 | * one can't determine the difference. | 46 | * one can't determine the difference. |
47 | * This stack reads the default out of the size of the desktop widget but | 47 | * This stack reads the default out of the size of the desktop widget but |
48 | * can be forced to have either the one or the other behaviour. | 48 | * can be forced to have either the one or the other behaviour. |
49 | * The first widget added is considered the 'main' widget and its | 49 | * The first widget added is considered the 'main' widget and its |
50 | * sizeHint will be taking if in BigScreen mode. | 50 | * sizeHint will be taking if in BigScreen mode. |
51 | * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen | 51 | * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen |
52 | * mode it'll use the MainWindow as child of this widget and arranges the others as | 52 | * mode it'll use the MainWindow as child of this widget and arranges the others as |
53 | * hidden top level widgets. | 53 | * hidden top level widgets. |
54 | * | 54 | * |
55 | * @version 0.1 | 55 | * @version 0.1 |
@@ -114,19 +114,20 @@ protected: | |||
114 | 114 | ||
115 | private: | 115 | private: |
116 | void switchStack(); | 116 | void switchStack(); |
117 | void switchTop(); | 117 | void switchTop(); |
118 | QMap<int, QWidget*> m_list; | 118 | QMap<int, QWidget*> m_list; |
119 | QWidgetStack *m_stack; | 119 | QWidgetStack *m_stack; |
120 | QWidget *m_mWidget; | 120 | QWidget *m_mWidget; |
121 | QWidget *m_last; | 121 | QWidget *m_last; |
122 | 122 | ||
123 | enum Mode m_mode; | 123 | enum Mode m_mode; |
124 | bool m_forced : 1; | 124 | bool m_forced : 1; |
125 | 125 | ||
126 | struct Private; | 126 | struct Private; |
127 | Private *d; | 127 | Private *d; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | }; | 130 | } |
131 | } | ||
131 | 132 | ||
132 | #endif | 133 | #endif |
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp index e7daead..beb4d6c 100644 --- a/libopie2/opieui/fileselector/ofiledialog.cpp +++ b/libopie2/opieui/fileselector/ofiledialog.cpp | |||
@@ -26,33 +26,33 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/ofiledialog.h> | 31 | #include <opie2/ofiledialog.h> |
32 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | 41 | ||
42 | using namespace Opie; | 42 | using namespace Opie::Ui; |
43 | 43 | ||
44 | namespace | 44 | namespace |
45 | { | 45 | { |
46 | /* | 46 | /* |
47 | * helper functions to load the start dir | 47 | * helper functions to load the start dir |
48 | * and to save it | 48 | * and to save it |
49 | * helper to extract the dir out of a file name | 49 | * helper to extract the dir out of a file name |
50 | */ | 50 | */ |
51 | /** | 51 | /** |
52 | * This method will use Config( argv[0] ); | 52 | * This method will use Config( argv[0] ); |
53 | * @param key The group key used | 53 | * @param key The group key used |
54 | */ | 54 | */ |
55 | QString lastUsedDir( const QString& key ) | 55 | QString lastUsedDir( const QString& key ) |
56 | { | 56 | { |
57 | if ( qApp->argc() < 1 ) | 57 | if ( qApp->argc() < 1 ) |
58 | return QString::null; | 58 | return QString::null; |
diff --git a/libopie2/opieui/fileselector/ofiledialog.h b/libopie2/opieui/fileselector/ofiledialog.h index 01a599b..dfecf3d 100644 --- a/libopie2/opieui/fileselector/ofiledialog.h +++ b/libopie2/opieui/fileselector/ofiledialog.h | |||
@@ -22,34 +22,34 @@ | |||
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef OFILEDIALOG_H | 29 | #ifndef OFILEDIALOG_H |
30 | #define OFILEDIALOG_H | 30 | #define OFILEDIALOG_H |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/ofileselector.h> | 33 | #include <opie2/ofileselector.h> |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qdialog.h> | 36 | #include <qdialog.h> |
37 | 37 | ||
38 | namespace Opie | 38 | namespace Opie { |
39 | { | 39 | namespace Ui { |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * This class places a OFileSelector inside a QDialog. | 42 | * This class places a OFileSelector inside a QDialog. |
43 | * It provides static method for letting a user chose | 43 | * It provides static method for letting a user chose |
44 | * a file for either opening or saving. | 44 | * a file for either opening or saving. |
45 | * Most of the time the c'tor will not be used instead using | 45 | * Most of the time the c'tor will not be used instead using |
46 | * the static member functions is prefered. | 46 | * the static member functions is prefered. |
47 | * | 47 | * |
48 | * <pre> | 48 | * <pre> |
49 | * QMap<QString, QStringList> mimeTypes; | 49 | * QMap<QString, QStringList> mimeTypes; |
50 | * QStringList types; | 50 | * QStringList types; |
51 | * types << "text[slash]* "; | 51 | * types << "text[slash]* "; |
52 | * mimeTypes.insert( tr("Text"), types ); | 52 | * mimeTypes.insert( tr("Text"), types ); |
53 | * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment | 53 | * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment |
54 | * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 54 | * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
55 | * "foo","bar", mimeTypes); | 55 | * "foo","bar", mimeTypes); |
@@ -91,19 +91,20 @@ public: | |||
91 | 91 | ||
92 | //let's OFileSelector catch up first | 92 | //let's OFileSelector catch up first |
93 | //static QString getExistingDirectory(const QString& startDir = QString::null, | 93 | //static QString getExistingDirectory(const QString& startDir = QString::null, |
94 | //QWidget *parent = 0, const QString& caption = QString::null ); | 94 | //QWidget *parent = 0, const QString& caption = QString::null ); |
95 | 95 | ||
96 | private: | 96 | private: |
97 | class OFileDialogPrivate; | 97 | class OFileDialogPrivate; |
98 | OFileDialogPrivate *d; | 98 | OFileDialogPrivate *d; |
99 | OFileSelector *file; | 99 | OFileSelector *file; |
100 | 100 | ||
101 | private slots: | 101 | private slots: |
102 | void slotFileSelected( const QString & ); | 102 | void slotFileSelected( const QString & ); |
103 | void slotDirSelected(const QString & ); | 103 | void slotDirSelected(const QString & ); |
104 | void slotSelectorOk(); | 104 | void slotSelectorOk(); |
105 | }; | 105 | }; |
106 | 106 | ||
107 | }; | 107 | } |
108 | } | ||
108 | 109 | ||
109 | #endif | 110 | #endif |
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 15cadd4..c4d5033 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -42,34 +42,37 @@ | |||
42 | #include <qpe/storage.h> | 42 | #include <qpe/storage.h> |
43 | 43 | ||
44 | /* QT */ | 44 | /* QT */ |
45 | #include <qcombobox.h> | 45 | #include <qcombobox.h> |
46 | #include <qdir.h> | 46 | #include <qdir.h> |
47 | #include <qhbox.h> | 47 | #include <qhbox.h> |
48 | #include <qheader.h> | 48 | #include <qheader.h> |
49 | #include <qlabel.h> | 49 | #include <qlabel.h> |
50 | #include <qlayout.h> | 50 | #include <qlayout.h> |
51 | #include <qlineedit.h> | 51 | #include <qlineedit.h> |
52 | #include <qlistview.h> | 52 | #include <qlistview.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | #include <qwidgetstack.h> | 54 | #include <qwidgetstack.h> |
55 | #include <qregexp.h> | 55 | #include <qregexp.h> |
56 | #include <qobjectlist.h> | 56 | #include <qobjectlist.h> |
57 | 57 | ||
58 | using namespace Opie; | 58 | using namespace Opie::Ui::Private; |
59 | 59 | ||
60 | namespace Opie { | ||
61 | namespace Ui { | ||
62 | namespace Private { | ||
60 | OFileViewInterface::OFileViewInterface( OFileSelector* selector ) | 63 | OFileViewInterface::OFileViewInterface( OFileSelector* selector ) |
61 | : m_selector( selector ) | 64 | : m_selector( selector ) |
62 | {} | 65 | {} |
63 | 66 | ||
64 | OFileViewInterface::~OFileViewInterface() | 67 | OFileViewInterface::~OFileViewInterface() |
65 | {} | 68 | {} |
66 | 69 | ||
67 | QString OFileViewInterface::name()const | 70 | QString OFileViewInterface::name()const |
68 | { | 71 | { |
69 | return m_name; | 72 | return m_name; |
70 | } | 73 | } |
71 | 74 | ||
72 | void OFileViewInterface::setName( const QString& name ) | 75 | void OFileViewInterface::setName( const QString& name ) |
73 | { | 76 | { |
74 | m_name = name; | 77 | m_name = name; |
75 | } | 78 | } |
@@ -797,32 +800,34 @@ int OFileViewFileSystem::fileCount()const | |||
797 | } | 800 | } |
798 | 801 | ||
799 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) | 802 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) |
800 | { | 803 | { |
801 | if (!m_view ) | 804 | if (!m_view ) |
802 | { | 805 | { |
803 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); | 806 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); |
804 | } | 807 | } |
805 | return m_view; | 808 | return m_view; |
806 | } | 809 | } |
807 | 810 | ||
808 | void OFileViewFileSystem::activate( const QString& str) | 811 | void OFileViewFileSystem::activate( const QString& str) |
809 | { | 812 | { |
810 | m_all = (str != QObject::tr("Files") ); | 813 | m_all = (str != QObject::tr("Files") ); |
811 | } | 814 | } |
812 | 815 | ||
816 | |||
817 | } | ||
813 | /* Selector */ | 818 | /* Selector */ |
814 | /** | 819 | /** |
815 | * @short new and complete c'tor | 820 | * @short new and complete c'tor |
816 | * | 821 | * |
817 | * Create a OFileSelector to let the user select a file. It can | 822 | * Create a OFileSelector to let the user select a file. It can |
818 | * either be used to open a file, select a save name in a dir or | 823 | * either be used to open a file, select a save name in a dir or |
819 | * as a dropin for the FileSelector. | 824 | * as a dropin for the FileSelector. |
820 | * | 825 | * |
821 | * <pre> | 826 | * <pre> |
822 | * QMap<QString, QStringList> mimeTypes; | 827 | * QMap<QString, QStringList> mimeTypes; |
823 | * QStringList types; | 828 | * QStringList types; |
824 | * types << "text@slash* "; | 829 | * types << "text@slash* "; |
825 | * types << "audio@slash*"; | 830 | * types << "audio@slash*"; |
826 | * mimeTypes.insert( tr("Audio and Text"), types ); | 831 | * mimeTypes.insert( tr("Audio and Text"), types ); |
827 | * mimeTypes.insert( tr("All"), "*@slash*); | 832 | * mimeTypes.insert( tr("All"), "*@slash*); |
828 | * | 833 | * |
@@ -1151,16 +1156,18 @@ void OFileSelector::setNewVisible( bool b ) | |||
1151 | } | 1156 | } |
1152 | 1157 | ||
1153 | void OFileSelector::setCloseVisible( bool b ) | 1158 | void OFileSelector::setCloseVisible( bool b ) |
1154 | { | 1159 | { |
1155 | m_shClose = b; | 1160 | m_shClose = b; |
1156 | currentView()->reread(); | 1161 | currentView()->reread(); |
1157 | } | 1162 | } |
1158 | 1163 | ||
1159 | void OFileSelector::setNameVisible( bool b ) | 1164 | void OFileSelector::setNameVisible( bool b ) |
1160 | { | 1165 | { |
1161 | if ( b ) | 1166 | if ( b ) |
1162 | m_nameBox->show(); | 1167 | m_nameBox->show(); |
1163 | else | 1168 | else |
1164 | m_nameBox->hide(); | 1169 | m_nameBox->hide(); |
1165 | } | 1170 | } |
1166 | 1171 | ||
1172 | } | ||
1173 | } | ||
diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h index 7fa657b..2205963 100644 --- a/libopie2/opieui/fileselector/ofileselector.h +++ b/libopie2/opieui/fileselector/ofileselector.h | |||
@@ -39,55 +39,57 @@ | |||
39 | #include <qpe/applnk.h> | 39 | #include <qpe/applnk.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qlist.h> | 42 | #include <qlist.h> |
43 | #include <qwidget.h> | 43 | #include <qwidget.h> |
44 | #include <qmap.h> | 44 | #include <qmap.h> |
45 | #include <qvaluelist.h> | 45 | #include <qvaluelist.h> |
46 | #include <qstringlist.h> | 46 | #include <qstringlist.h> |
47 | 47 | ||
48 | class QLineEdit; | 48 | class QLineEdit; |
49 | class QComboBox; | 49 | class QComboBox; |
50 | class QWidgetStack; | 50 | class QWidgetStack; |
51 | class QHBox; | 51 | class QHBox; |
52 | 52 | ||
53 | typedef QMap<QString, QStringList> MimeTypes; | 53 | typedef QMap<QString, QStringList> MimeTypes; |
54 | 54 | ||
55 | namespace Opie | 55 | namespace Opie { |
56 | { | 56 | namespace Ui { |
57 | 57 | ||
58 | namespace Private { | ||
58 | class OFileViewInterface; | 59 | class OFileViewInterface; |
59 | class OFileViewFileListView; | 60 | class OFileViewFileListView; |
61 | } | ||
60 | 62 | ||
61 | 63 | ||
62 | /** | 64 | /** |
63 | * @short a dropin replacement for the FileSelector | 65 | * @short a dropin replacement for the FileSelector |
64 | * | 66 | * |
65 | * This class is first used insert the OFileDialog. | 67 | * This class is first used insert the OFileDialog. |
66 | * It supports multiple view and mimetype filtering for now. | 68 | * It supports multiple view and mimetype filtering for now. |
67 | * | 69 | * |
68 | * @see OFileDialog | 70 | * @see OFileDialog |
69 | * @see FileSelector | 71 | * @see FileSelector |
70 | * @author zecke | 72 | * @author zecke |
71 | * @version 0.1 | 73 | * @version 0.1 |
72 | */ | 74 | */ |
73 | class OFileSelector : public QWidget | 75 | class OFileSelector : public QWidget |
74 | { | 76 | { |
75 | Q_OBJECT | 77 | Q_OBJECT |
76 | friend class Opie::OFileViewInterface; | 78 | friend class Private::OFileViewInterface; |
77 | friend class Opie::OFileViewFileListView; | 79 | friend class Private::OFileViewFileListView; |
78 | 80 | ||
79 | public: | 81 | public: |
80 | /** | 82 | /** |
81 | * The Mode of the Fileselector | 83 | * The Mode of the Fileselector |
82 | * Open = Open A File | 84 | * Open = Open A File |
83 | * Save = Save a File | 85 | * Save = Save a File |
84 | * FILESELECTOR = As A GUI in a screen to select a file | 86 | * FILESELECTOR = As A GUI in a screen to select a file |
85 | */ | 87 | */ |
86 | enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; | 88 | enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; |
87 | // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; | 89 | // enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; |
88 | /** | 90 | /** |
89 | * Normal = The old FileSelector | 91 | * Normal = The old FileSelector |
90 | * Extended = Dir View | 92 | * Extended = Dir View |
91 | * ExtendedAll = Dir View with all hidden files | 93 | * ExtendedAll = Dir View with all hidden files |
92 | * Default = What the vendor considers best | 94 | * Default = What the vendor considers best |
93 | */ | 95 | */ |
@@ -172,48 +174,49 @@ private: | |||
172 | bool showClose()const; | 174 | bool showClose()const; |
173 | MimeTypes mimeTypes()const; | 175 | MimeTypes mimeTypes()const; |
174 | QStringList currentMimeType()const; | 176 | QStringList currentMimeType()const; |
175 | 177 | ||
176 | private: | 178 | private: |
177 | /* inits the Widgets */ | 179 | /* inits the Widgets */ |
178 | void initUI(); | 180 | void initUI(); |
179 | /* inits the MimeType ComboBox content + connects signals and slots */ | 181 | /* inits the MimeType ComboBox content + connects signals and slots */ |
180 | void initMime(); | 182 | void initMime(); |
181 | /* init the Views :) */ | 183 | /* init the Views :) */ |
182 | void initViews(); | 184 | void initViews(); |
183 | 185 | ||
184 | private: | 186 | private: |
185 | QLineEdit* m_lneEdit; // the LineEdit for the Name | 187 | QLineEdit* m_lneEdit; // the LineEdit for the Name |
186 | QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType | 188 | QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType |
187 | QWidgetStack* m_stack; // our widget stack which will contain the views | 189 | QWidgetStack* m_stack; // our widget stack which will contain the views |
188 | OFileViewInterface* currentView() const; // returns the currentView | 190 | Private::OFileViewInterface* currentView() const; // returns the currentView |
189 | OFileViewInterface* m_current; // here is the view saved | 191 | Private::OFileViewInterface* m_current; // here is the view saved |
190 | bool m_shNew : 1; // should we show New? | 192 | bool m_shNew : 1; // should we show New? |
191 | bool m_shClose : 1; // should we show Close? | 193 | bool m_shClose : 1; // should we show Close? |
192 | MimeTypes m_mimeType; // list of mimetypes | 194 | MimeTypes m_mimeType; // list of mimetypes |
193 | 195 | ||
194 | QMap<QString, OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr | 196 | QMap<QString, Private::OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr |
195 | QHBox* m_nameBox; // the LineEdit + Label is hold here | 197 | QHBox* m_nameBox; // the LineEdit + Label is hold here |
196 | QHBox* m_cmbBox; // this holds the two combo boxes | 198 | QHBox* m_cmbBox; // this holds the two combo boxes |
197 | 199 | ||
198 | QString m_startDir; | 200 | QString m_startDir; |
199 | int m_mode; | 201 | int m_mode; |
200 | int m_selector; | 202 | int m_selector; |
201 | 203 | ||
202 | struct Data; // used for future versions | 204 | struct Data; // used for future versions |
203 | Data *d; | 205 | Data *d; |
204 | 206 | ||
205 | private slots: | 207 | private slots: |
206 | void slotMimeTypeChanged(); | 208 | void slotMimeTypeChanged(); |
207 | 209 | ||
208 | /* will set the text of the lineedit and emit a fileChanged signal */ | 210 | /* will set the text of the lineedit and emit a fileChanged signal */ |
209 | void slotDocLnkBridge( const DocLnk& ); | 211 | void slotDocLnkBridge( const DocLnk& ); |
210 | void slotFileBridge( const QString& ); | 212 | void slotFileBridge( const QString& ); |
211 | void slotViewChange( const QString& ); | 213 | void slotViewChange( const QString& ); |
212 | 214 | ||
213 | bool eventFilter (QObject *o, QEvent *e); | 215 | bool eventFilter (QObject *o, QEvent *e); |
214 | 216 | ||
215 | }; | 217 | }; |
216 | 218 | ||
217 | }; | 219 | } |
220 | } | ||
218 | 221 | ||
219 | #endif | 222 | #endif |
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index 818ced9..376dc98 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h | |||
@@ -43,36 +43,36 @@ | |||
43 | * How to avoid having really two different objects | 43 | * How to avoid having really two different objects |
44 | * for Extended and ExtendedAll | 44 | * for Extended and ExtendedAll |
45 | * The only difference is the Lister... | 45 | * The only difference is the Lister... |
46 | * a) static object? | 46 | * a) static object? |
47 | * b) leave some object inside the OFileSelector which can be used? | 47 | * b) leave some object inside the OFileSelector which can be used? |
48 | * c) when switching views tell which view we want o have.. internally we can switch then | 48 | * c) when switching views tell which view we want o have.. internally we can switch then |
49 | * | 49 | * |
50 | * I'll take c) -zecke | 50 | * I'll take c) -zecke |
51 | */ | 51 | */ |
52 | 52 | ||
53 | typedef QMap<QString, QStringList> MimeTypes; | 53 | typedef QMap<QString, QStringList> MimeTypes; |
54 | 54 | ||
55 | /* the View Interface */ | 55 | /* the View Interface */ |
56 | class QFileInfo; | 56 | class QFileInfo; |
57 | class QToolButton; | 57 | class QToolButton; |
58 | 58 | ||
59 | namespace Opie | 59 | namespace Opie{ |
60 | { | 60 | namespace Ui{ |
61 | |||
62 | class OFileSelector; | 61 | class OFileSelector; |
62 | namespace Private { | ||
63 | 63 | ||
64 | class OFileViewInterface | 64 | class OFileViewInterface |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | OFileViewInterface( OFileSelector* selector ); | 67 | OFileViewInterface( OFileSelector* selector ); |
68 | virtual ~OFileViewInterface(); | 68 | virtual ~OFileViewInterface(); |
69 | virtual QString selectedName()const = 0; | 69 | virtual QString selectedName()const = 0; |
70 | virtual QString selectedPath()const = 0; | 70 | virtual QString selectedPath()const = 0; |
71 | virtual QString directory()const = 0; | 71 | virtual QString directory()const = 0; |
72 | virtual void reread() = 0; | 72 | virtual void reread() = 0; |
73 | virtual int fileCount()const = 0; | 73 | virtual int fileCount()const = 0; |
74 | virtual DocLnk selectedDocument()const; | 74 | virtual DocLnk selectedDocument()const; |
75 | virtual QWidget* widget( QWidget* parent) = 0; | 75 | virtual QWidget* widget( QWidget* parent) = 0; |
76 | virtual void activate( const QString& ); | 76 | virtual void activate( const QString& ); |
77 | QString name()const; | 77 | QString name()const; |
78 | protected: | 78 | protected: |
@@ -173,19 +173,21 @@ private: | |||
173 | OFileSelector* m_sel; | 173 | OFileSelector* m_sel; |
174 | QPopupMenu* m_fsPop; | 174 | QPopupMenu* m_fsPop; |
175 | bool compliesMime( const QString& ); | 175 | bool compliesMime( const QString& ); |
176 | QStringList m_mimes; // used in compy mime | 176 | QStringList m_mimes; // used in compy mime |
177 | QString m_currentDir; | 177 | QString m_currentDir; |
178 | QToolButton *m_btnNew, *m_btnClose; | 178 | QToolButton *m_btnNew, *m_btnClose; |
179 | void connectSlots(); | 179 | void connectSlots(); |
180 | void addFile( QFileInfo* info, bool symlink = FALSE ); | 180 | void addFile( QFileInfo* info, bool symlink = FALSE ); |
181 | void addDir ( QFileInfo* info, bool symlink = FALSE ); | 181 | void addDir ( QFileInfo* info, bool symlink = FALSE ); |
182 | void addSymlink( QFileInfo* info, bool = FALSE ); | 182 | void addSymlink( QFileInfo* info, bool = FALSE ); |
183 | 183 | ||
184 | 184 | ||
185 | private: | 185 | private: |
186 | QListView* m_view; | 186 | QListView* m_view; |
187 | }; | 187 | }; |
188 | 188 | ||
189 | }; | 189 | } |
190 | } | ||
191 | } | ||
190 | 192 | ||
191 | #endif | 193 | #endif |
diff --git a/libopie2/opieui/fileselector/ofileview.h b/libopie2/opieui/fileselector/ofileview.h index 495401b..aaf56b1 100644 --- a/libopie2/opieui/fileselector/ofileview.h +++ b/libopie2/opieui/fileselector/ofileview.h | |||
@@ -24,34 +24,35 @@ | |||
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef OFILEVIEW_H | 29 | #ifndef OFILEVIEW_H |
30 | #define OFILEVIEW_H | 30 | #define OFILEVIEW_H |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qobject.h> | 33 | #include <qobject.h> |
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | 35 | ||
36 | class QFileInfo; | 36 | class QFileInfo; |
37 | class QDir; | 37 | class QDir; |
38 | class DocLnk; | 38 | class DocLnk; |
39 | 39 | ||
40 | namespace Opie | 40 | namespace Opie { |
41 | { | 41 | namespace Ui { |
42 | namespace Private { | ||
42 | 43 | ||
43 | /** | 44 | /** |
44 | * A OFileView is a specialised View for the | 45 | * A OFileView is a specialised View for the |
45 | * OFileSelector | 46 | * OFileSelector |
46 | * With a View you can chage the user visible | 47 | * With a View you can chage the user visible |
47 | * representation of a OFileLister | 48 | * representation of a OFileLister |
48 | * OFileView is just a basic interface which helps you to | 49 | * OFileView is just a basic interface which helps you to |
49 | * write new views | 50 | * write new views |
50 | */ | 51 | */ |
51 | class OFileView : public QWidget | 52 | class OFileView : public QWidget |
52 | { | 53 | { |
53 | Q_OBJECT | 54 | Q_OBJECT |
54 | public: | 55 | public: |
55 | OFileView(QWidget *widget, | 56 | OFileView(QWidget *widget, |
56 | const char *name ); | 57 | const char *name ); |
57 | 58 | ||
@@ -77,19 +78,21 @@ signals: | |||
77 | void changedDir(const QString &); | 78 | void changedDir(const QString &); |
78 | void changedDir(const QDir & ); | 79 | void changedDir(const QDir & ); |
79 | }; | 80 | }; |
80 | 81 | ||
81 | 82 | ||
82 | class OFileViewFactory | 83 | class OFileViewFactory |
83 | { | 84 | { |
84 | // Q_OBJECT | 85 | // Q_OBJECT |
85 | public: | 86 | public: |
86 | OFileViewFactory() {} ; | 87 | OFileViewFactory() {} ; |
87 | virtual ~OFileViewFactory() = 0; | 88 | virtual ~OFileViewFactory() = 0; |
88 | 89 | ||
89 | OFileView* newView(QWidget *parent, const char *name ); | 90 | OFileView* newView(QWidget *parent, const char *name ); |
90 | QString name()const; | 91 | QString name()const; |
91 | }; | 92 | }; |
92 | 93 | ||
93 | }; | 94 | } |
95 | } | ||
96 | } | ||
94 | 97 | ||
95 | #endif | 98 | #endif |
diff --git a/libopie2/opieui/oclickablelabel.cpp b/libopie2/opieui/oclickablelabel.cpp index 4c4e581..53cb77a 100644 --- a/libopie2/opieui/oclickablelabel.cpp +++ b/libopie2/opieui/oclickablelabel.cpp | |||
@@ -16,33 +16,33 @@ | |||
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <opie2/oclickablelabel.h> | 30 | #include <opie2/oclickablelabel.h> |
31 | 31 | ||
32 | using namespace Opie; | 32 | using namespace Opie::Ui; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * This constructs the clickable ButtonLabel | 35 | * This constructs the clickable ButtonLabel |
36 | * | 36 | * |
37 | * @param parent The parent of this label | 37 | * @param parent The parent of this label |
38 | * @param name A name of this label @see QObject | 38 | * @param name A name of this label @see QObject |
39 | * @param fl The windowing flags | 39 | * @param fl The windowing flags |
40 | */ | 40 | */ |
41 | OClickableLabel::OClickableLabel(QWidget* parent, const char* name, WFlags fl) | 41 | OClickableLabel::OClickableLabel(QWidget* parent, const char* name, WFlags fl) |
42 | :QLabel(parent,name,fl) | 42 | :QLabel(parent,name,fl) |
43 | { | 43 | { |
44 | textInverted=false; | 44 | textInverted=false; |
45 | isToggle=false; | 45 | isToggle=false; |
46 | isDown=false; | 46 | isDown=false; |
47 | showState(false); | 47 | showState(false); |
48 | setFrameShadow(Sunken); | 48 | setFrameShadow(Sunken); |
diff --git a/libopie2/opieui/oclickablelabel.h b/libopie2/opieui/oclickablelabel.h index b224d61..90859a0 100644 --- a/libopie2/opieui/oclickablelabel.h +++ b/libopie2/opieui/oclickablelabel.h | |||
@@ -20,34 +20,34 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OCLICKABLELABEL_H | 30 | #ifndef OCLICKABLELABEL_H |
31 | #define OCLICKABLELABEL_H | 31 | #define OCLICKABLELABEL_H |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | 35 | ||
36 | namespace Opie | 36 | namespace Opie{ |
37 | { | 37 | namespace Ui { |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * This class is a special QLabel which can behave | 40 | * This class is a special QLabel which can behave |
41 | * as a QPushButton or QToggleButton. | 41 | * as a QPushButton or QToggleButton. |
42 | * The reason to use a clickable is if you want to save space | 42 | * The reason to use a clickable is if you want to save space |
43 | * or you want to skip the border of a normal button | 43 | * or you want to skip the border of a normal button |
44 | * | 44 | * |
45 | * <pre> | 45 | * <pre> |
46 | * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); | 46 | * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); |
47 | * lbl->setPixmap( "config" ); | 47 | * lbl->setPixmap( "config" ); |
48 | * QWhatsThis::add( lbl, tr("Click here to do something") ); | 48 | * QWhatsThis::add( lbl, tr("Click here to do something") ); |
49 | * </pre> | 49 | * </pre> |
50 | * | 50 | * |
51 | * @short A Label behaving as button | 51 | * @short A Label behaving as button |
52 | * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) | 52 | * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) |
53 | * @see QLabel | 53 | * @see QLabel |
@@ -85,19 +85,20 @@ signals: | |||
85 | * @param on the new new state of the label | 85 | * @param on the new new state of the label |
86 | */ | 86 | */ |
87 | void toggled(bool on); | 87 | void toggled(bool on); |
88 | private: | 88 | private: |
89 | bool isToggle : 1; | 89 | bool isToggle : 1; |
90 | bool isDown : 1; | 90 | bool isDown : 1; |
91 | bool textInverted : 1; | 91 | bool textInverted : 1; |
92 | 92 | ||
93 | void showState(bool on); | 93 | void showState(bool on); |
94 | void setInverted(bool on); | 94 | void setInverted(bool on); |
95 | 95 | ||
96 | private: | 96 | private: |
97 | class Private; | 97 | class Private; |
98 | Private *d; // private d pointer | 98 | Private *d; // private d pointer |
99 | }; | 99 | }; |
100 | 100 | ||
101 | }; | 101 | } |
102 | } | ||
102 | 103 | ||
103 | #endif | 104 | #endif |
diff --git a/libopie2/opieui/odialog.cpp b/libopie2/opieui/odialog.cpp index 4d269d4..27f8d20 100644 --- a/libopie2/opieui/odialog.cpp +++ b/libopie2/opieui/odialog.cpp | |||
@@ -19,32 +19,34 @@ | |||
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/odialog.h> | 31 | #include <opie2/odialog.h> |
32 | 32 | ||
33 | #warning Make Margin and Spacing device dependend and configurable! | 33 | #warning Make Margin and Spacing device dependend and configurable! |
34 | 34 | ||
35 | using namespace Opie::Ui; | ||
36 | |||
35 | int ODialog::mMarginSize = 5; | 37 | int ODialog::mMarginSize = 5; |
36 | int ODialog::mSpacingSize = 2; | 38 | int ODialog::mSpacingSize = 2; |
37 | 39 | ||
38 | ODialog::ODialog(QWidget *parent, const char *name, bool modal, WFlags f) | 40 | ODialog::ODialog(QWidget *parent, const char *name, bool modal, WFlags f) |
39 | :QDialog(parent, name, modal, f) | 41 | :QDialog(parent, name, modal, f) |
40 | { | 42 | { |
41 | // d = new ODialogPrivate(); | 43 | // d = new ODialogPrivate(); |
42 | } | 44 | } |
43 | 45 | ||
44 | int ODialog::marginHint() | 46 | int ODialog::marginHint() |
45 | { | 47 | { |
46 | return( mMarginSize ); | 48 | return( mMarginSize ); |
47 | } | 49 | } |
48 | 50 | ||
49 | 51 | ||
50 | int ODialog::spacingHint() | 52 | int ODialog::spacingHint() |
diff --git a/libopie2/opieui/odialog.h b/libopie2/opieui/odialog.h index ceff612..57f534c 100644 --- a/libopie2/opieui/odialog.h +++ b/libopie2/opieui/odialog.h | |||
@@ -42,32 +42,35 @@ class QLayoutItem; | |||
42 | * The @ref marginHint() and @ref spacingHint() sizes shall be used | 42 | * The @ref marginHint() and @ref spacingHint() sizes shall be used |
43 | * whenever you layout the interior of a dialog. One special note. If | 43 | * whenever you layout the interior of a dialog. One special note. If |
44 | * you make your own action buttons (OK, Cancel etc), the space | 44 | * you make your own action buttons (OK, Cancel etc), the space |
45 | * beteween the buttons shall be @ref spacingHint(), whereas the space | 45 | * beteween the buttons shall be @ref spacingHint(), whereas the space |
46 | * above, below, to the right and to the left shall be @ref marginHint(). | 46 | * above, below, to the right and to the left shall be @ref marginHint(). |
47 | * If you add a separator line above the buttons, there shall be a | 47 | * If you add a separator line above the buttons, there shall be a |
48 | * @ref marginHint() between the buttons and the separator and a | 48 | * @ref marginHint() between the buttons and the separator and a |
49 | * @ref marginHint() above the separator as well. | 49 | * @ref marginHint() above the separator as well. |
50 | * | 50 | * |
51 | * @author Michael 'Mickey' Lauer <mickey@Vanille.de> | 51 | * @author Michael 'Mickey' Lauer <mickey@Vanille.de> |
52 | */ | 52 | */ |
53 | 53 | ||
54 | // lets fix up Qt instead! Size does matter. -zecke | 54 | // lets fix up Qt instead! Size does matter. -zecke |
55 | // while that may be true, reducing maintainance effort for the future does also matter - | 55 | // while that may be true, reducing maintainance effort for the future does also matter - |
56 | // and I believe that maintaining a patch against QtE is more work than our classes -mml | 56 | // and I believe that maintaining a patch against QtE is more work than our classes -mml |
57 | 57 | ||
58 | namespace Opie { | ||
59 | namespace Ui { | ||
60 | |||
58 | class ODialog : public QDialog | 61 | class ODialog : public QDialog |
59 | { | 62 | { |
60 | Q_OBJECT | 63 | Q_OBJECT |
61 | 64 | ||
62 | public: | 65 | public: |
63 | 66 | ||
64 | /** | 67 | /** |
65 | * Constructor. | 68 | * Constructor. |
66 | * | 69 | * |
67 | * Takes the same arguments as @ref QDialog. | 70 | * Takes the same arguments as @ref QDialog. |
68 | */ | 71 | */ |
69 | ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); | 72 | ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0); |
70 | 73 | ||
71 | /** | 74 | /** |
72 | * Return the number of pixels you shall use between a | 75 | * Return the number of pixels you shall use between a |
73 | * dialog edge and the outermost widget(s) according to the KDE standard. | 76 | * dialog edge and the outermost widget(s) according to the KDE standard. |
@@ -75,17 +78,19 @@ class ODialog : public QDialog | |||
75 | static int marginHint(); | 78 | static int marginHint(); |
76 | 79 | ||
77 | /** | 80 | /** |
78 | * Return the number of pixels you shall use between | 81 | * Return the number of pixels you shall use between |
79 | * widgets inside a dialog according to the KDE standard. | 82 | * widgets inside a dialog according to the KDE standard. |
80 | */ | 83 | */ |
81 | static int spacingHint(); | 84 | static int spacingHint(); |
82 | 85 | ||
83 | private: | 86 | private: |
84 | static int mMarginSize; | 87 | static int mMarginSize; |
85 | static int mSpacingSize; | 88 | static int mSpacingSize; |
86 | 89 | ||
87 | class ODialogPrivate; | 90 | class ODialogPrivate; |
88 | ODialogPrivate *d; | 91 | ODialogPrivate *d; |
89 | 92 | ||
90 | }; | 93 | }; |
94 | } | ||
95 | } | ||
91 | #endif // ODIALOG_H | 96 | #endif // ODIALOG_H |
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index f93781f..b19c26e 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp | |||
@@ -25,55 +25,50 @@ | |||
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/ofontselector.h> | 31 | #include <opie2/ofontselector.h> |
32 | #include <qpe/fontdatabase.h> | 32 | #include <qpe/fontdatabase.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qlistbox.h> | 36 | #include <qlistbox.h> |
37 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qmultilineedit.h> | 39 | #include <qmultilineedit.h> |
40 | 40 | ||
41 | using namespace Opie; | ||
42 | 41 | ||
43 | namespace Opie | 42 | namespace Opie { |
44 | { | 43 | namespace Ui { |
44 | namespace Private { | ||
45 | 45 | ||
46 | class OFontSelectorPrivate | 46 | class OFontSelectorPrivate |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | QListBox * m_font_family_list; | 49 | QListBox * m_font_family_list; |
50 | QComboBox * m_font_style_list; | 50 | QComboBox * m_font_style_list; |
51 | QComboBox * m_font_size_list; | 51 | QComboBox * m_font_size_list; |
52 | QMultiLineEdit *m_preview; | 52 | QMultiLineEdit *m_preview; |
53 | 53 | ||
54 | bool m_pointbug : 1; | 54 | bool m_pointbug : 1; |
55 | 55 | ||
56 | FontDatabase m_fdb; | 56 | FontDatabase m_fdb; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | }; | ||
60 | |||
61 | namespace | ||
62 | { | ||
63 | |||
64 | class FontListItem : public QListBoxText | 59 | class FontListItem : public QListBoxText |
65 | { | 60 | { |
66 | public: | 61 | public: |
67 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() | 62 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() |
68 | { | 63 | { |
69 | m_name = t; | 64 | m_name = t; |
70 | m_styles = styles; | 65 | m_styles = styles; |
71 | m_sizes = sizes; | 66 | m_sizes = sizes; |
72 | 67 | ||
73 | QString str = t; | 68 | QString str = t; |
74 | str [0] = str [0]. upper(); | 69 | str [0] = str [0]. upper(); |
75 | setText ( str ); | 70 | setText ( str ); |
76 | } | 71 | } |
77 | 72 | ||
78 | QString family() const | 73 | QString family() const |
79 | { | 74 | { |
@@ -82,45 +77,50 @@ public: | |||
82 | 77 | ||
83 | const QStringList &styles() const | 78 | const QStringList &styles() const |
84 | { | 79 | { |
85 | return m_styles; | 80 | return m_styles; |
86 | } | 81 | } |
87 | 82 | ||
88 | const QValueList<int> &sizes() const | 83 | const QValueList<int> &sizes() const |
89 | { | 84 | { |
90 | return m_sizes; | 85 | return m_sizes; |
91 | } | 86 | } |
92 | 87 | ||
93 | private: | 88 | private: |
94 | QStringList m_styles; | 89 | QStringList m_styles; |
95 | QValueList<int> m_sizes; | 90 | QValueList<int> m_sizes; |
96 | QString m_name; | 91 | QString m_name; |
97 | }; | 92 | }; |
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
98 | 97 | ||
98 | using namespace Opie::Ui; | ||
99 | using namespace Opie::Ui::Private; | ||
99 | 100 | ||
100 | static int findItemCB( QComboBox *box, const QString &str ) | 101 | static int findItemCB( QComboBox *box, const QString &str ) |
101 | { | 102 | { |
102 | for ( int i = 0; i < box->count(); i++ ) | 103 | for ( int i = 0; i < box->count(); i++ ) |
103 | { | 104 | { |
104 | if ( box->text ( i ) == str ) | 105 | if ( box->text ( i ) == str ) |
105 | return i; | 106 | return i; |
106 | } | 107 | } |
107 | return -1; | 108 | return -1; |
108 | } | 109 | } |
109 | 110 | ||
110 | } | ||
111 | /* static same as anon. namespace */ | 111 | /* static same as anon. namespace */ |
112 | static int qt_version() | 112 | static int qt_version() |
113 | { | 113 | { |
114 | const char *qver = qVersion(); | 114 | const char *qver = qVersion(); |
115 | 115 | ||
116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Constructs the Selector object | 120 | * Constructs the Selector object |
121 | * @param withpreview If a font preview should be given | 121 | * @param withpreview If a font preview should be given |
122 | * @param parent The parent of the Font Selector | 122 | * @param parent The parent of the Font Selector |
123 | * @param name The name of the object | 123 | * @param name The name of the object |
124 | * @param fl WidgetFlags | 124 | * @param fl WidgetFlags |
125 | */ | 125 | */ |
126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
@@ -413,16 +413,17 @@ QFont OFontSelector::selectedFont() | |||
413 | } | 413 | } |
414 | 414 | ||
415 | void OFontSelector::resizeEvent ( QResizeEvent *re ) | 415 | void OFontSelector::resizeEvent ( QResizeEvent *re ) |
416 | { | 416 | { |
417 | if ( d->m_preview ) | 417 | if ( d->m_preview ) |
418 | { | 418 | { |
419 | d->m_preview->setMinimumHeight ( 1 ); | 419 | d->m_preview->setMinimumHeight ( 1 ); |
420 | d->m_preview->setMaximumHeight ( 32767 ); | 420 | d->m_preview->setMaximumHeight ( 32767 ); |
421 | } | 421 | } |
422 | 422 | ||
423 | QWidget::resizeEvent ( re ); | 423 | QWidget::resizeEvent ( re ); |
424 | 424 | ||
425 | if ( d->m_preview ) | 425 | if ( d->m_preview ) |
426 | d->m_preview->setFixedHeight ( d->m_preview->height()); | 426 | d->m_preview->setFixedHeight ( d->m_preview->height()); |
427 | 427 | ||
428 | } | 428 | } |
429 | |||
diff --git a/libopie2/opieui/ofontselector.h b/libopie2/opieui/ofontselector.h index ad51819..1d97233 100644 --- a/libopie2/opieui/ofontselector.h +++ b/libopie2/opieui/ofontselector.h | |||
@@ -22,36 +22,37 @@ | |||
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OFONTSELECTOR_H | 30 | #ifndef OFONTSELECTOR_H |
31 | #define OFONTSELECTOR_H | 31 | #define OFONTSELECTOR_H |
32 | 32 | ||
33 | /* QT */ | 33 | /* QT */ |
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | 35 | ||
36 | class QListBox; | 36 | class QListBox; |
37 | 37 | ||
38 | namespace Opie | 38 | namespace Opie { |
39 | { | 39 | namespace Ui { |
40 | 40 | namespace Private { | |
41 | class OFontSelectorPrivate; | 41 | class OFontSelectorPrivate; |
42 | } | ||
42 | 43 | ||
43 | /** | 44 | /** |
44 | * This class lets you chose a Font out of a list of Fonts. | 45 | * This class lets you chose a Font out of a list of Fonts. |
45 | * It can show a preview too. This selector will use all available | 46 | * It can show a preview too. This selector will use all available |
46 | * fonts | 47 | * fonts |
47 | * | 48 | * |
48 | * | 49 | * |
49 | * @short A widget to select a font | 50 | * @short A widget to select a font |
50 | * @see QWidget | 51 | * @see QWidget |
51 | * @see QFont | 52 | * @see QFont |
52 | * @author Rober Griebl | 53 | * @author Rober Griebl |
53 | */ | 54 | */ |
54 | class OFontSelector : public QWidget | 55 | class OFontSelector : public QWidget |
55 | { | 56 | { |
56 | Q_OBJECT | 57 | Q_OBJECT |
57 | 58 | ||
@@ -82,23 +83,24 @@ protected slots: | |||
82 | /** @internal */ | 83 | /** @internal */ |
83 | virtual void fontFamilyClicked ( int ); | 84 | virtual void fontFamilyClicked ( int ); |
84 | /** @internal */ | 85 | /** @internal */ |
85 | virtual void fontStyleClicked ( int ); | 86 | virtual void fontStyleClicked ( int ); |
86 | /** @internal */ | 87 | /** @internal */ |
87 | virtual void fontSizeClicked ( int ); | 88 | virtual void fontSizeClicked ( int ); |
88 | 89 | ||
89 | protected: | 90 | protected: |
90 | virtual void resizeEvent ( QResizeEvent *re ); | 91 | virtual void resizeEvent ( QResizeEvent *re ); |
91 | 92 | ||
92 | private: | 93 | private: |
93 | void loadFonts ( QListBox * ); | 94 | void loadFonts ( QListBox * ); |
94 | 95 | ||
95 | void changeFont ( ); | 96 | void changeFont ( ); |
96 | 97 | ||
97 | private: | 98 | private: |
98 | OFontSelectorPrivate *d; | 99 | Private::OFontSelectorPrivate *d; |
99 | }; | 100 | }; |
100 | 101 | ||
101 | }; | 102 | } |
103 | } | ||
102 | 104 | ||
103 | #endif | 105 | #endif |
104 | 106 | ||
diff --git a/libopie2/opieui/oimageeffect.cpp b/libopie2/opieui/oimageeffect.cpp index 9a58bb9..be47eb2 100644 --- a/libopie2/opieui/oimageeffect.cpp +++ b/libopie2/opieui/oimageeffect.cpp | |||
@@ -28,32 +28,36 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | // $Id$ | 30 | // $Id$ |
31 | 31 | ||
32 | #include <math.h> | 32 | #include <math.h> |
33 | 33 | ||
34 | #include <qimage.h> | 34 | #include <qimage.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | 36 | ||
37 | #include <opie2/oimageeffect.h> | 37 | #include <opie2/oimageeffect.h> |
38 | #include <opie2/odebug.h> | 38 | #include <opie2/odebug.h> |
39 | 39 | ||
40 | #define MaxRGB 255L | 40 | #define MaxRGB 255L |
41 | #define DegreesToRadians(x) ((x)*M_PI/180.0) | 41 | #define DegreesToRadians(x) ((x)*M_PI/180.0) |
42 | 42 | ||
43 | using namespace std; | 43 | using namespace std; |
44 | using namespace Opie::Core; | ||
45 | |||
46 | namespace Opie { | ||
47 | namespace Ui { | ||
44 | 48 | ||
45 | inline unsigned int intensityValue(unsigned int color) | 49 | inline unsigned int intensityValue(unsigned int color) |
46 | { | 50 | { |
47 | return((unsigned int)((0.299*qRed(color) + | 51 | return((unsigned int)((0.299*qRed(color) + |
48 | 0.587*qGreen(color) + | 52 | 0.587*qGreen(color) + |
49 | 0.1140000000000001*qBlue(color)))); | 53 | 0.1140000000000001*qBlue(color)))); |
50 | } | 54 | } |
51 | 55 | ||
52 | //====================================================================== | 56 | //====================================================================== |
53 | // | 57 | // |
54 | // Gradient effects | 58 | // Gradient effects |
55 | // | 59 | // |
56 | //====================================================================== | 60 | //====================================================================== |
57 | 61 | ||
58 | QImage OImageEffect::gradient(const QSize &size, const QColor &ca, | 62 | QImage OImageEffect::gradient(const QSize &size, const QColor &ca, |
59 | const QColor &cb, GradientType eff, int ncols) | 63 | const QColor &cb, GradientType eff, int ncols) |
@@ -3752,17 +3756,18 @@ void OImageEffect::contrastHSV(QImage &img, bool sharpen) | |||
3752 | brightness = v/255.0; | 3756 | brightness = v/255.0; |
3753 | theta=(brightness-0.5)*M_PI; | 3757 | theta=(brightness-0.5)*M_PI; |
3754 | brightness+=scale*(((scale*((sin(theta)+1.0)))-brightness)*sign); | 3758 | brightness+=scale*(((scale*((sin(theta)+1.0)))-brightness)*sign); |
3755 | if (brightness > 1.0) | 3759 | if (brightness > 1.0) |
3756 | brightness=1.0; | 3760 | brightness=1.0; |
3757 | else | 3761 | else |
3758 | if (brightness < 0) | 3762 | if (brightness < 0) |
3759 | brightness=0.0; | 3763 | brightness=0.0; |
3760 | v = (int)(brightness*255); | 3764 | v = (int)(brightness*255); |
3761 | c.setHsv(h, s, v); | 3765 | c.setHsv(h, s, v); |
3762 | data[i] = qRgba(c.red(), c.green(), c.blue(), qAlpha(data[i])); | 3766 | data[i] = qRgba(c.red(), c.green(), c.blue(), qAlpha(data[i])); |
3763 | } | 3767 | } |
3764 | } | 3768 | } |
3765 | 3769 | ||
3766 | 3770 | ||
3767 | 3771 | ||
3768 | 3772 | } | |
3773 | } | ||
diff --git a/libopie2/opieui/oimageeffect.h b/libopie2/opieui/oimageeffect.h index fb4d22d..4f86d5b 100644 --- a/libopie2/opieui/oimageeffect.h +++ b/libopie2/opieui/oimageeffect.h | |||
@@ -26,32 +26,34 @@ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
29 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | // $Id$ | 33 | // $Id$ |
34 | 34 | ||
35 | #ifndef OIMAGEEFFECT_H | 35 | #ifndef OIMAGEEFFECT_H |
36 | #define OIMAGEEFFECT_H | 36 | #define OIMAGEEFFECT_H |
37 | 37 | ||
38 | class QImage; | 38 | class QImage; |
39 | class QSize; | 39 | class QSize; |
40 | class QColor; | 40 | class QColor; |
41 | 41 | ||
42 | namespace Opie { | ||
43 | namespace Ui { | ||
42 | /** | 44 | /** |
43 | * This class includes various @ref QImage based graphical effects. | 45 | * This class includes various @ref QImage based graphical effects. |
44 | * | 46 | * |
45 | * Everything is | 47 | * Everything is |
46 | * static, so there is no need to create an instance of this class. You can | 48 | * static, so there is no need to create an instance of this class. You can |
47 | * just call the static methods. They are encapsulated here merely to provide | 49 | * just call the static methods. They are encapsulated here merely to provide |
48 | * a common namespace. | 50 | * a common namespace. |
49 | */ | 51 | */ |
50 | 52 | ||
51 | class OImageEffect | 53 | class OImageEffect |
52 | { | 54 | { |
53 | public: | 55 | public: |
54 | enum GradientType { VerticalGradient, HorizontalGradient, | 56 | enum GradientType { VerticalGradient, HorizontalGradient, |
55 | DiagonalGradient, CrossDiagonalGradient, | 57 | DiagonalGradient, CrossDiagonalGradient, |
56 | PyramidGradient, RectangleGradient, | 58 | PyramidGradient, RectangleGradient, |
57 | PipeCrossGradient, EllipticGradient }; | 59 | PipeCrossGradient, EllipticGradient }; |
@@ -543,17 +545,20 @@ private: | |||
543 | static unsigned int lHash(unsigned int c); | 545 | static unsigned int lHash(unsigned int c); |
544 | static unsigned int uHash(unsigned int c); | 546 | static unsigned int uHash(unsigned int c); |
545 | 547 | ||
546 | /** | 548 | /** |
547 | * Helper function to find the nearest color to the RBG triplet | 549 | * Helper function to find the nearest color to the RBG triplet |
548 | */ | 550 | */ |
549 | static int nearestColor( int r, int g, int b, const QColor *pal, int size ); | 551 | static int nearestColor( int r, int g, int b, const QColor *pal, int size ); |
550 | 552 | ||
551 | static void hull(const int x_offset, const int y_offset, const int polarity, | 553 | static void hull(const int x_offset, const int y_offset, const int polarity, |
552 | const int width, const int height, | 554 | const int width, const int height, |
553 | unsigned int *f, unsigned int *g); | 555 | unsigned int *f, unsigned int *g); |
554 | static unsigned int generateNoise(unsigned int pixel, NoiseType type); | 556 | static unsigned int generateNoise(unsigned int pixel, NoiseType type); |
555 | static unsigned int interpolateColor(QImage *image, double x, double y, | 557 | static unsigned int interpolateColor(QImage *image, double x, double y, |
556 | unsigned int background); | 558 | unsigned int background); |
557 | }; | 559 | }; |
558 | 560 | ||
561 | } | ||
562 | } | ||
563 | |||
559 | #endif | 564 | #endif |
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index 0ee2fde..38670b4 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp | |||
@@ -23,32 +23,37 @@ | |||
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* QT */ | 30 | /* QT */ |
31 | 31 | ||
32 | #include <qpixmap.h> | 32 | #include <qpixmap.h> |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | 35 | ||
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | #include <opie2/olistview.h> | 37 | #include <opie2/olistview.h> |
38 | 38 | ||
39 | using namespace Opie::Core; | ||
40 | |||
41 | |||
42 | namespace Opie { | ||
43 | namespace Ui { | ||
39 | /*====================================================================================== | 44 | /*====================================================================================== |
40 | * OListView | 45 | * OListView |
41 | *======================================================================================*/ | 46 | *======================================================================================*/ |
42 | 47 | ||
43 | OListView::OListView( QWidget *parent, const char *name ) | 48 | OListView::OListView( QWidget *parent, const char *name ) |
44 | :QListView( parent, name ) | 49 | :QListView( parent, name ) |
45 | { | 50 | { |
46 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* | 51 | //FIXME: get from global settings and calculate ==> see oglobalsettings.* |
47 | 52 | ||
48 | m_alternateBackground = QColor( 238, 246, 255 ); | 53 | m_alternateBackground = QColor( 238, 246, 255 ); |
49 | m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); | 54 | m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); |
50 | m_fullWidth = true; | 55 | m_fullWidth = true; |
51 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); | 56 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); |
52 | } | 57 | } |
53 | 58 | ||
54 | OListView::~OListView() | 59 | OListView::~OListView() |
@@ -742,16 +747,18 @@ void ONamedListViewItem::setText( const QString& column, const QString& text ) | |||
742 | 747 | ||
743 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const | 748 | ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const |
744 | { | 749 | { |
745 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); | 750 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); |
746 | } | 751 | } |
747 | 752 | ||
748 | 753 | ||
749 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const | 754 | ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const |
750 | { | 755 | { |
751 | int col = ( (ONamedListView*) listView() )->findColumn( column ); | 756 | int col = ( (ONamedListView*) listView() )->findColumn( column ); |
752 | if ( col != -1 ) | 757 | if ( col != -1 ) |
753 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); | 758 | return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); |
754 | else | 759 | else |
755 | return 0; | 760 | return 0; |
756 | } | 761 | } |
757 | 762 | ||
763 | } | ||
764 | } | ||
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h index 59b0973..8195a62 100644 --- a/libopie2/opieui/olistview.h +++ b/libopie2/opieui/olistview.h | |||
@@ -23,50 +23,54 @@ | |||
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OLISTVIEW_H | 30 | #ifndef OLISTVIEW_H |
31 | #define OLISTVIEW_H | 31 | #define OLISTVIEW_H |
32 | 32 | ||
33 | #include <qcolor.h> | 33 | #include <qcolor.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qpen.h> | 35 | #include <qpen.h> |
36 | #include <qdatastream.h> | 36 | #include <qdatastream.h> |
37 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
38 | 38 | ||
39 | |||
40 | namespace Opie { | ||
41 | namespace Ui { | ||
39 | class OListViewItem; | 42 | class OListViewItem; |
40 | 43 | ||
41 | 44 | ||
42 | /*====================================================================================== | 45 | /*====================================================================================== |
43 | * OListView | 46 | * OListView |
44 | *======================================================================================*/ | 47 | *======================================================================================*/ |
45 | 48 | ||
46 | /** | 49 | /** |
47 | * @brief A list/tree widget. | 50 | * @brief A list/tree widget. |
48 | * | 51 | * |
49 | * A @ref QListView variant featuring visual and functional enhancements | 52 | * A @ref QListView variant featuring visual and functional enhancements |
50 | * like an alternate background for odd rows, an autostretch mode | 53 | * like an alternate background for odd rows, an autostretch mode |
51 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. | 54 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. |
52 | * | 55 | * |
53 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 56 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
54 | */ | 57 | */ |
55 | class OListView: public QListView | 58 | class OListView: public QListView |
56 | { | 59 | { |
60 | Q_OBJECT | ||
57 | public: | 61 | public: |
58 | /** | 62 | /** |
59 | * Constructor. | 63 | * Constructor. |
60 | * | 64 | * |
61 | * The parameters @a parent and @a name are handled by | 65 | * The parameters @a parent and @a name are handled by |
62 | * @ref QListView, as usual. | 66 | * @ref QListView, as usual. |
63 | */ | 67 | */ |
64 | OListView( QWidget* parent = 0, const char* name = 0 ); | 68 | OListView( QWidget* parent = 0, const char* name = 0 ); |
65 | /** | 69 | /** |
66 | * Destructor. | 70 | * Destructor. |
67 | */ | 71 | */ |
68 | virtual ~OListView(); | 72 | virtual ~OListView(); |
69 | /** | 73 | /** |
70 | * Let the last column fit exactly all the available width. | 74 | * Let the last column fit exactly all the available width. |
71 | */ | 75 | */ |
72 | void setFullWidth( bool fullWidth ); | 76 | void setFullWidth( bool fullWidth ); |
@@ -126,34 +130,36 @@ class OListView: public QListView | |||
126 | * Expand all items | 130 | * Expand all items |
127 | */ | 131 | */ |
128 | void expand(); | 132 | void expand(); |
129 | /** | 133 | /** |
130 | * Collapse all items | 134 | * Collapse all items |
131 | */ | 135 | */ |
132 | void collapse(); | 136 | void collapse(); |
133 | 137 | ||
134 | protected slots: | 138 | protected slots: |
135 | /** | 139 | /** |
136 | * expand the current OListViewItem | 140 | * expand the current OListViewItem |
137 | */ | 141 | */ |
138 | void expand(QListViewItem*); | 142 | void expand(QListViewItem*); |
139 | 143 | ||
140 | private: | 144 | private: |
141 | QColor m_alternateBackground; | 145 | QColor m_alternateBackground; |
142 | bool m_fullWidth; | 146 | bool m_fullWidth : 1; |
143 | QPen m_columnSeparator; | 147 | QPen m_columnSeparator; |
148 | class Private; | ||
149 | Private *d; | ||
144 | }; | 150 | }; |
145 | 151 | ||
146 | #ifndef QT_NO_DATASTREAM | 152 | #ifndef QT_NO_DATASTREAM |
147 | /** | 153 | /** |
148 | * @relates OListView | 154 | * @relates OListView |
149 | * Writes @a listview to the @a stream and returns a reference to the stream. | 155 | * Writes @a listview to the @a stream and returns a reference to the stream. |
150 | */ | 156 | */ |
151 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); | 157 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); |
152 | /** | 158 | /** |
153 | * @relates OListView | 159 | * @relates OListView |
154 | * Reads @a listview from the @a stream and returns a reference to the stream. | 160 | * Reads @a listview from the @a stream and returns a reference to the stream. |
155 | */ | 161 | */ |
156 | QDataStream& operator>>( QDataStream& stream, OListView& listview ); | 162 | QDataStream& operator>>( QDataStream& stream, OListView& listview ); |
157 | #endif // QT_NO_DATASTREAM | 163 | #endif // QT_NO_DATASTREAM |
158 | 164 | ||
159 | /*====================================================================================== | 165 | /*====================================================================================== |
@@ -229,34 +235,36 @@ class OListViewItem: public QListViewItem | |||
229 | */ | 235 | */ |
230 | virtual void serializeTo( QDataStream& s ) const; | 236 | virtual void serializeTo( QDataStream& s ) const; |
231 | 237 | ||
232 | /** | 238 | /** |
233 | * serialize this object to or from a @ref QDataStream | 239 | * serialize this object to or from a @ref QDataStream |
234 | * @param s the stream used to serialize this object. | 240 | * @param s the stream used to serialize this object. |
235 | */ | 241 | */ |
236 | virtual void serializeFrom( QDataStream& s ); | 242 | virtual void serializeFrom( QDataStream& s ); |
237 | #endif | 243 | #endif |
238 | 244 | ||
239 | /** | 245 | /** |
240 | * expand the the item | 246 | * expand the the item |
241 | */ | 247 | */ |
242 | virtual void expand(){}; | 248 | virtual void expand(){}; |
243 | 249 | ||
244 | private: | 250 | private: |
245 | bool m_known; | 251 | bool m_known : 1; |
246 | bool m_odd; | 252 | bool m_odd : 1; |
253 | class Private; | ||
254 | Private *d; | ||
247 | }; | 255 | }; |
248 | 256 | ||
249 | #ifndef QT_NO_DATASTREAM | 257 | #ifndef QT_NO_DATASTREAM |
250 | /** | 258 | /** |
251 | * @relates QListViewItem | 259 | * @relates QListViewItem |
252 | * Writes listview @a item and all subitems recursively to @a stream | 260 | * Writes listview @a item and all subitems recursively to @a stream |
253 | * and returns a reference to the stream. | 261 | * and returns a reference to the stream. |
254 | */ | 262 | */ |
255 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); | 263 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); |
256 | /** | 264 | /** |
257 | * @relates QListViewItem | 265 | * @relates QListViewItem |
258 | * Reads listview @a item from @a stream and returns a reference to the stream. | 266 | * Reads listview @a item from @a stream and returns a reference to the stream. |
259 | */ | 267 | */ |
260 | QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); | 268 | QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); |
261 | #endif // QT_NO_DATASTREAM | 269 | #endif // QT_NO_DATASTREAM |
262 | 270 | ||
@@ -341,32 +349,35 @@ class ONamedListView: public OListView | |||
341 | */ | 349 | */ |
342 | virtual int findColumn( const QString& text ) const; | 350 | virtual int findColumn( const QString& text ) const; |
343 | /** | 351 | /** |
344 | * @returns the first item which has a @a text in column @a column. | 352 | * @returns the first item which has a @a text in column @a column. |
345 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> | 353 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> |
346 | * <li>set it to 0 to search only among direct childs, | 354 | * <li>set it to 0 to search only among direct childs, |
347 | * <li>set it to 1 to search direct childs and all 1st order subchilds | 355 | * <li>set it to 1 to search direct childs and all 1st order subchilds |
348 | * <li>set it to -1 for maximum recursion. | 356 | * <li>set it to -1 for maximum recursion. |
349 | * </ul> | 357 | * </ul> |
350 | * @sa ONamedListViewItem::find() | 358 | * @sa ONamedListViewItem::find() |
351 | */ | 359 | */ |
352 | virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; | 360 | virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; |
353 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; | 361 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; |
354 | 362 | ||
355 | virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; | 363 | virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; |
356 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; | 364 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; |
365 | private: | ||
366 | class Private; | ||
367 | Private *d; | ||
357 | }; | 368 | }; |
358 | 369 | ||
359 | /*====================================================================================== | 370 | /*====================================================================================== |
360 | * ONamedListViewItem | 371 | * ONamedListViewItem |
361 | *======================================================================================*/ | 372 | *======================================================================================*/ |
362 | 373 | ||
363 | /** | 374 | /** |
364 | * @brief An OListView variant with named columns. | 375 | * @brief An OListView variant with named columns. |
365 | * | 376 | * |
366 | * This class provides a higher-level interface to an OListViewItem. | 377 | * This class provides a higher-level interface to an OListViewItem. |
367 | * | 378 | * |
368 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 379 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
369 | */ | 380 | */ |
370 | class ONamedListViewItem: public OListViewItem | 381 | class ONamedListViewItem: public OListViewItem |
371 | { | 382 | { |
372 | public: | 383 | public: |
@@ -390,20 +401,26 @@ class ONamedListViewItem: public OListViewItem | |||
390 | virtual void setText( const QString& column, const QString& text ); | 401 | virtual void setText( const QString& column, const QString& text ); |
391 | /** | 402 | /** |
392 | * Sets a number of @a texts for this item. | 403 | * Sets a number of @a texts for this item. |
393 | */ | 404 | */ |
394 | virtual void setText( const QStringList& texts ); | 405 | virtual void setText( const QStringList& texts ); |
395 | /** | 406 | /** |
396 | * @returns the first child which has a @a text in column @a column. | 407 | * @returns the first child which has a @a text in column @a column. |
397 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> | 408 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> |
398 | * <li>set it to 0 to search only among direct childs, | 409 | * <li>set it to 0 to search only among direct childs, |
399 | * <li>set it to 1 to search direct childs and all 1st order subchilds | 410 | * <li>set it to 1 to search direct childs and all 1st order subchilds |
400 | * <li>set it to -1 for maximum recursion. | 411 | * <li>set it to -1 for maximum recursion. |
401 | * </ul> | 412 | * </ul> |
402 | * @sa ONamedListView::find() | 413 | * @sa ONamedListView::find() |
403 | */ | 414 | */ |
404 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; | 415 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; |
405 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; | 416 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; |
406 | }; | ||
407 | 417 | ||
418 | private: | ||
419 | class Private; | ||
420 | Private *d; | ||
421 | |||
422 | }; | ||
423 | } | ||
424 | } | ||
408 | 425 | ||
409 | #endif // OLISTVIEW_H | 426 | #endif // OLISTVIEW_H |
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro index 1be8db5..e895edc 100644 --- a/libopie2/opieui/opieui.pro +++ b/libopie2/opieui/opieui.pro | |||
@@ -1,50 +1,47 @@ | |||
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 = oclickablelabel.h \ | 4 | HEADERS = oclickablelabel.h \ |
5 | odialog.h \ | 5 | odialog.h \ |
6 | ofontselector.h \ | 6 | ofontselector.h \ |
7 | oimageeffect.h \ | 7 | oimageeffect.h \ |
8 | olistview.h \ | 8 | olistview.h \ |
9 | omessagebox.h \ | ||
10 | opixmapeffect.h \ | 9 | opixmapeffect.h \ |
11 | opopupmenu.h \ | 10 | opopupmenu.h \ |
12 | opixmapprovider.h \ | 11 | opixmapprovider.h \ |
13 | oresource.h \ | ||
14 | oselector.h \ | 12 | oselector.h \ |
15 | oseparator.h \ | 13 | oseparator.h \ |
16 | otabinfo.h \ | 14 | otabinfo.h \ |
17 | otabbar.h \ | 15 | otabbar.h \ |
18 | otabwidget.h \ | 16 | otabwidget.h \ |
19 | otaskbarapplet.h \ | 17 | otaskbarapplet.h \ |
20 | oticker.h \ | 18 | oticker.h \ |
21 | otimepicker.h \ | 19 | otimepicker.h \ |
22 | oversatileview.h \ | 20 | oversatileview.h \ |
23 | oversatileviewitem.h \ | 21 | oversatileviewitem.h \ |
24 | owait.h | 22 | owait.h |
25 | 23 | ||
26 | SOURCES = oclickablelabel.cpp \ | 24 | SOURCES = oclickablelabel.cpp \ |
27 | odialog.cpp \ | 25 | odialog.cpp \ |
28 | ofontselector.cpp \ | 26 | ofontselector.cpp \ |
29 | oimageeffect.cpp \ | 27 | oimageeffect.cpp \ |
30 | olistview.cpp \ | 28 | olistview.cpp \ |
31 | opixmapeffect.cpp \ | 29 | opixmapeffect.cpp \ |
32 | opopupmenu.cpp \ | 30 | opopupmenu.cpp \ |
33 | opixmapprovider.cpp \ | 31 | opixmapprovider.cpp \ |
34 | oresource.cpp \ | ||
35 | oselector.cpp \ | 32 | oselector.cpp \ |
36 | oseparator.cpp \ | 33 | oseparator.cpp \ |
37 | otabbar.cpp \ | 34 | otabbar.cpp \ |
38 | otabwidget.cpp \ | 35 | otabwidget.cpp \ |
39 | otaskbarapplet.cpp \ | 36 | otaskbarapplet.cpp \ |
40 | oticker.cpp \ | 37 | oticker.cpp \ |
41 | otimepicker.cpp \ | 38 | otimepicker.cpp \ |
42 | oversatileview.cpp \ | 39 | oversatileview.cpp \ |
43 | oversatileviewitem.cpp \ | 40 | oversatileviewitem.cpp \ |
44 | owait.cpp | 41 | owait.cpp |
45 | 42 | ||
46 | include ( big-screen/big-screen.pro ) | 43 | include ( big-screen/big-screen.pro ) |
47 | include ( fileselector/fileselector.pro ) | 44 | include ( fileselector/fileselector.pro ) |
48 | 45 | ||
49 | INTERFACES = otimepickerbase.ui | 46 | INTERFACES = otimepickerbase.ui |
50 | 47 | ||
diff --git a/libopie2/opieui/opixmapeffect.cpp b/libopie2/opieui/opixmapeffect.cpp index 05f851d..794c7b2 100644 --- a/libopie2/opieui/opixmapeffect.cpp +++ b/libopie2/opieui/opixmapeffect.cpp | |||
@@ -4,32 +4,34 @@ | |||
4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> | 4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> |
5 | 5 | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | // $Id$ | 8 | // $Id$ |
9 | 9 | ||
10 | /* QT */ | 10 | /* QT */ |
11 | 11 | ||
12 | #include <qimage.h> | 12 | #include <qimage.h> |
13 | #include <qpainter.h> | 13 | #include <qpainter.h> |
14 | 14 | ||
15 | /* OPIE */ | 15 | /* OPIE */ |
16 | 16 | ||
17 | #include <opie2/opixmapeffect.h> | 17 | #include <opie2/opixmapeffect.h> |
18 | #include <opie2/oimageeffect.h> | 18 | #include <opie2/oimageeffect.h> |
19 | 19 | ||
20 | |||
21 | using namespace Opie::Ui; | ||
20 | //====================================================================== | 22 | //====================================================================== |
21 | // | 23 | // |
22 | // Gradient effects | 24 | // Gradient effects |
23 | // | 25 | // |
24 | //====================================================================== | 26 | //====================================================================== |
25 | 27 | ||
26 | 28 | ||
27 | OPixmap& OPixmapEffect::gradient(OPixmap &pixmap, const QColor &ca, | 29 | OPixmap& OPixmapEffect::gradient(OPixmap &pixmap, const QColor &ca, |
28 | const QColor &cb, GradientType eff, int ncols) | 30 | const QColor &cb, GradientType eff, int ncols) |
29 | { | 31 | { |
30 | if(pixmap.depth() > 8 && | 32 | if(pixmap.depth() > 8 && |
31 | (eff == VerticalGradient || eff == HorizontalGradient)) { | 33 | (eff == VerticalGradient || eff == HorizontalGradient)) { |
32 | 34 | ||
33 | int rDiff, gDiff, bDiff; | 35 | int rDiff, gDiff, bDiff; |
34 | int rca, gca, bca /*, rcb, gcb, bcb*/; | 36 | int rca, gca, bca /*, rcb, gcb, bcb*/; |
35 | 37 | ||
diff --git a/libopie2/opieui/opixmapeffect.h b/libopie2/opieui/opixmapeffect.h index 283fe2d..b780f9f 100644 --- a/libopie2/opieui/opixmapeffect.h +++ b/libopie2/opieui/opixmapeffect.h | |||
@@ -2,32 +2,35 @@ | |||
2 | Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> | 2 | Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> |
3 | (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> | 3 | (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> |
4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> | 4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> |
5 | 5 | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | // $Id$ | 8 | // $Id$ |
9 | 9 | ||
10 | #ifndef __OPIXMAP_EFFECT_H | 10 | #ifndef __OPIXMAP_EFFECT_H |
11 | #define __OPIXMAP_EFFECT_H | 11 | #define __OPIXMAP_EFFECT_H |
12 | 12 | ||
13 | 13 | ||
14 | #include <qsize.h> | 14 | #include <qsize.h> |
15 | typedef QPixmap OPixmap; | 15 | typedef QPixmap OPixmap; |
16 | class QColor; | 16 | class QColor; |
17 | 17 | ||
18 | |||
19 | namespace Opie { | ||
20 | namespace Ui { | ||
18 | /** | 21 | /** |
19 | * This class includes various pixmap-based graphical effects. | 22 | * This class includes various pixmap-based graphical effects. |
20 | * | 23 | * |
21 | * Everything is | 24 | * Everything is |
22 | * static, so there is no need to create an instance of this class. You can | 25 | * static, so there is no need to create an instance of this class. You can |
23 | * just call the static methods. They are encapsulated here merely to provide | 26 | * just call the static methods. They are encapsulated here merely to provide |
24 | * a common namespace. | 27 | * a common namespace. |
25 | */ | 28 | */ |
26 | class OPixmapEffect | 29 | class OPixmapEffect |
27 | { | 30 | { |
28 | public: | 31 | public: |
29 | enum GradientType { VerticalGradient, HorizontalGradient, | 32 | enum GradientType { VerticalGradient, HorizontalGradient, |
30 | DiagonalGradient, CrossDiagonalGradient, | 33 | DiagonalGradient, CrossDiagonalGradient, |
31 | PyramidGradient, RectangleGradient, | 34 | PyramidGradient, RectangleGradient, |
32 | PipeCrossGradient, EllipticGradient }; | 35 | PipeCrossGradient, EllipticGradient }; |
33 | enum RGBComponent { Red, Green, Blue }; | 36 | enum RGBComponent { Red, Green, Blue }; |
@@ -197,19 +200,20 @@ public: | |||
197 | * | 200 | * |
198 | * @param pixmap The pixmap to process. | 201 | * @param pixmap The pixmap to process. |
199 | * @param palette The color palette to use. | 202 | * @param palette The color palette to use. |
200 | * @param size The size of the palette. | 203 | * @param size The size of the palette. |
201 | * @return Returns the @ref pixmap(), provided for convenience. | 204 | * @return Returns the @ref pixmap(), provided for convenience. |
202 | */ | 205 | */ |
203 | static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); | 206 | static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); |
204 | 207 | ||
205 | /** | 208 | /** |
206 | * Calculate a 'selected' pixmap, for instance a selected icon | 209 | * Calculate a 'selected' pixmap, for instance a selected icon |
207 | * on the desktop. | 210 | * on the desktop. |
208 | * @param pixmap the pixmap to select | 211 | * @param pixmap the pixmap to select |
209 | * @param col the selected color, usually from QColorGroup::highlight(). | 212 | * @param col the selected color, usually from QColorGroup::highlight(). |
210 | */ | 213 | */ |
211 | static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col ); | 214 | static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col ); |
212 | }; | 215 | }; |
213 | 216 | } | |
217 | } | ||
214 | 218 | ||
215 | #endif | 219 | #endif |
diff --git a/libopie2/opieui/opixmapprovider.cpp b/libopie2/opieui/opixmapprovider.cpp index 7be9e3b..7eb67a2 100644 --- a/libopie2/opieui/opixmapprovider.cpp +++ b/libopie2/opieui/opixmapprovider.cpp | |||
@@ -7,21 +7,23 @@ | |||
7 | License (LGPL) as published by the Free Software Foundation; either | 7 | License (LGPL) as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <opie2/opixmapprovider.h> | 21 | #include <opie2/opixmapprovider.h> |
22 | 22 | ||
23 | using namespace Opie::Ui; | ||
24 | |||
23 | OPixmapProvider::~OPixmapProvider() {} | 25 | OPixmapProvider::~OPixmapProvider() {} |
24 | 26 | ||
25 | void OPixmapProvider::virtual_hook( int , void* ) | 27 | void OPixmapProvider::virtual_hook( int , void* ) |
26 | { /*BASE::virtual_hook( id, data );*/ } | 28 | { /*BASE::virtual_hook( id, data );*/ } |
27 | 29 | ||
diff --git a/libopie2/opieui/opixmapprovider.h b/libopie2/opieui/opixmapprovider.h index 5b76647..9d9bd69 100644 --- a/libopie2/opieui/opixmapprovider.h +++ b/libopie2/opieui/opixmapprovider.h | |||
@@ -10,45 +10,53 @@ | |||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef OPIXMAPPROVIDER_H | 21 | #ifndef OPIXMAPPROVIDER_H |
22 | #define OPIXMAPPROVIDER_H | 22 | #define OPIXMAPPROVIDER_H |
23 | 23 | ||
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | 25 | ||
26 | namespace Opie { | ||
27 | namespace Ui { | ||
26 | /** | 28 | /** |
29 | * \todo make usefull | ||
27 | * A tiny abstract class with just one method: | 30 | * A tiny abstract class with just one method: |
28 | * @ref pixmapFor() | 31 | * @ref pixmapFor() |
29 | * | 32 | * |
30 | * It will be called whenever an icon is searched for @p text. | 33 | * It will be called whenever an icon is searched for @p text. |
31 | * | 34 | * |
32 | * Used e.g. by @ref KHistoryCombo | 35 | * Used e.g. by @ref KHistoryCombo |
33 | * | 36 | * |
34 | * @author Carsten Pfeiffer <pfeiffer@kde.org> | 37 | * @author Carsten Pfeiffer <pfeiffer@kde.org> |
35 | * @short an abstract interface for looking up icons | 38 | * @short an abstract interface for looking up icons |
36 | */ | 39 | */ |
37 | class OPixmapProvider | 40 | class OPixmapProvider |
38 | { | 41 | { |
39 | public: | 42 | public: |
40 | virtual ~OPixmapProvider(); | 43 | virtual ~OPixmapProvider(); |
41 | /** | 44 | /** |
42 | * You may subclass this and return a pixmap of size @p size for @p text. | 45 | * You may subclass this and return a pixmap of size @p size for @p text. |
43 | * @param text the text that is associated with the pixmap | 46 | * @param text the text that is associated with the pixmap |
44 | * @param size the size of the icon in pixels, 0 for defaylt size. | 47 | * @param size the size of the icon in pixels, 0 for defaylt size. |
45 | * See @ref KIcon::StdSize. | 48 | * See @ref KIcon::StdSize. |
46 | * @return the pixmap for the arguments, or null if there is none | 49 | * @return the pixmap for the arguments, or null if there is none |
47 | */ | 50 | */ |
48 | virtual QPixmap pixmapFor( const QString& text, int size = 0 ) = 0; | 51 | virtual QPixmap pixmapFor( const QString& text, int size = 0 ) = 0; |
49 | protected: | 52 | protected: |
50 | virtual void virtual_hook( int id, void* data ); | 53 | virtual void virtual_hook( int id, void* data ); |
54 | private: | ||
55 | class Private; | ||
56 | Private *d; | ||
51 | }; | 57 | }; |
52 | 58 | ||
59 | } | ||
60 | } | ||
53 | 61 | ||
54 | #endif // OPIXMAPPROVIDER_H | 62 | #endif // OPIXMAPPROVIDER_H |
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp index d5cc575..3ab8490 100644 --- a/libopie2/opieui/opopupmenu.cpp +++ b/libopie2/opieui/opopupmenu.cpp | |||
@@ -14,32 +14,35 @@ | |||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | /* QT */ | 20 | /* QT */ |
21 | 21 | ||
22 | #include <qdrawutil.h> | 22 | #include <qdrawutil.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | 24 | ||
25 | /* OPIE */ | 25 | /* OPIE */ |
26 | 26 | ||
27 | #include <opie2/opopupmenu.h> | 27 | #include <opie2/opopupmenu.h> |
28 | #include <opie2/oconfig.h> | 28 | #include <opie2/oconfig.h> |
29 | 29 | ||
30 | using namespace Opie::Core; | ||
31 | using namespace Opie::Ui; | ||
32 | |||
30 | OPopupTitle::OPopupTitle(QWidget *parent, const char *name) | 33 | OPopupTitle::OPopupTitle(QWidget *parent, const char *name) |
31 | : QWidget(parent, name) | 34 | : QWidget(parent, name) |
32 | { | 35 | { |
33 | setMinimumSize(16, fontMetrics().height()+8); | 36 | setMinimumSize(16, fontMetrics().height()+8); |
34 | } | 37 | } |
35 | 38 | ||
36 | OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */, | 39 | OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */, |
37 | const QColor &/* color */, const QColor &/* textColor */, | 40 | const QColor &/* color */, const QColor &/* textColor */, |
38 | QWidget *parent, const char *name) | 41 | QWidget *parent, const char *name) |
39 | : QWidget(parent, name) | 42 | : QWidget(parent, name) |
40 | { | 43 | { |
41 | setMinimumSize(16, fontMetrics().height()+8); | 44 | setMinimumSize(16, fontMetrics().height()+8); |
42 | } | 45 | } |
43 | 46 | ||
44 | OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */, | 47 | OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */, |
45 | const QColor &/* textColor */, QWidget *parent, | 48 | const QColor &/* textColor */, QWidget *parent, |
diff --git a/libopie2/opieui/opopupmenu.h b/libopie2/opieui/opopupmenu.h index 54e4301..419a954 100644 --- a/libopie2/opieui/opopupmenu.h +++ b/libopie2/opieui/opopupmenu.h | |||
@@ -18,32 +18,34 @@ | |||
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #ifndef _OPOPUP_H | 21 | #ifndef _OPOPUP_H |
22 | #define _OPOPUP_H | 22 | #define _OPOPUP_H |
23 | 23 | ||
24 | #define INCLUDE_MENUITEM_DEF | 24 | #define INCLUDE_MENUITEM_DEF |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
27 | 27 | ||
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | 31 | ||
32 | #include <opie2/opixmapeffect.h> | 32 | #include <opie2/opixmapeffect.h> |
33 | 33 | ||
34 | namespace Opie { | ||
35 | namespace Ui { | ||
34 | /** | 36 | /** |
35 | * Title widget for use in @ref OPopupMenu. | 37 | * Title widget for use in @ref OPopupMenu. |
36 | * | 38 | * |
37 | * You usually don't have to create this manually since | 39 | * You usually don't have to create this manually since |
38 | * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if | 40 | * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if |
39 | * you wish to customize it's look. | 41 | * you wish to customize it's look. |
40 | * | 42 | * |
41 | * @author Daniel M. Duley <mosfet@kde.org> | 43 | * @author Daniel M. Duley <mosfet@kde.org> |
42 | * @short OPopupMenu title widget. | 44 | * @short OPopupMenu title widget. |
43 | */ | 45 | */ |
44 | class OPopupTitle : public QWidget | 46 | class OPopupTitle : public QWidget |
45 | { | 47 | { |
46 | Q_OBJECT | 48 | Q_OBJECT |
47 | 49 | ||
48 | public: | 50 | public: |
49 | /** | 51 | /** |
@@ -243,17 +245,20 @@ protected: | |||
243 | virtual void virtual_hook( int id, void* data ); | 245 | virtual void virtual_hook( int id, void* data ); |
244 | 246 | ||
245 | protected slots: | 247 | protected slots: |
246 | /// @since 3.1 | 248 | /// @since 3.1 |
247 | QString underlineText(const QString& text, uint length); | 249 | QString underlineText(const QString& text, uint length); |
248 | /// @since 3.1 | 250 | /// @since 3.1 |
249 | void resetKeyboardVars(bool noMatches = false); | 251 | void resetKeyboardVars(bool noMatches = false); |
250 | void itemHighlighted(int whichItem); | 252 | void itemHighlighted(int whichItem); |
251 | void showCtxMenu(QPoint pos); | 253 | void showCtxMenu(QPoint pos); |
252 | void ctxMenuHiding(); | 254 | void ctxMenuHiding(); |
253 | 255 | ||
254 | private: | 256 | private: |
255 | class OPopupMenuPrivate; | 257 | class OPopupMenuPrivate; |
256 | OPopupMenuPrivate *d; | 258 | OPopupMenuPrivate *d; |
257 | }; | 259 | }; |
258 | 260 | ||
261 | } | ||
262 | } | ||
263 | |||
259 | #endif | 264 | #endif |
diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp index 23b3ce3..5f6f10f 100644 --- a/libopie2/opieui/oselector.cpp +++ b/libopie2/opieui/oselector.cpp | |||
@@ -23,32 +23,34 @@ | |||
23 | #include <qdrawutil.h> | 23 | #include <qdrawutil.h> |
24 | 24 | ||
25 | /* OPIE */ | 25 | /* OPIE */ |
26 | 26 | ||
27 | #include <opie2/oimageeffect.h> | 27 | #include <opie2/oimageeffect.h> |
28 | #include <opie2/oselector.h> | 28 | #include <opie2/oselector.h> |
29 | 29 | ||
30 | #define STORE_W 8 | 30 | #define STORE_W 8 |
31 | #define STORE_W2 STORE_W * 2 | 31 | #define STORE_W2 STORE_W * 2 |
32 | 32 | ||
33 | //----------------------------------------------------------------------------- | 33 | //----------------------------------------------------------------------------- |
34 | /* | 34 | /* |
35 | * 2D value selector. | 35 | * 2D value selector. |
36 | * The contents of the selector are drawn by derived class. | 36 | * The contents of the selector are drawn by derived class. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | using namespace Opie::Ui; | ||
40 | |||
39 | OXYSelector::OXYSelector( QWidget *parent, const char *name ) | 41 | OXYSelector::OXYSelector( QWidget *parent, const char *name ) |
40 | : QWidget( parent, name ) | 42 | : QWidget( parent, name ) |
41 | { | 43 | { |
42 | xPos = 0; | 44 | xPos = 0; |
43 | yPos = 0; | 45 | yPos = 0; |
44 | minX = 0; | 46 | minX = 0; |
45 | minY = 0; | 47 | minY = 0; |
46 | maxX = 100; | 48 | maxX = 100; |
47 | maxY = 100; | 49 | maxY = 100; |
48 | store.setOptimization( QPixmap::BestOptim ); | 50 | store.setOptimization( QPixmap::BestOptim ); |
49 | store.resize( STORE_W2, STORE_W2 ); | 51 | store.resize( STORE_W2, STORE_W2 ); |
50 | } | 52 | } |
51 | 53 | ||
52 | 54 | ||
53 | OXYSelector::~OXYSelector() | 55 | OXYSelector::~OXYSelector() |
54 | {} | 56 | {} |
@@ -60,33 +62,33 @@ void OXYSelector::setRange( int _minX, int _minY, int _maxX, int _maxY ) | |||
60 | py = 2; | 62 | py = 2; |
61 | minX = _minX; | 63 | minX = _minX; |
62 | minY = _minY; | 64 | minY = _minY; |
63 | maxX = _maxX; | 65 | maxX = _maxX; |
64 | maxY = _maxY; | 66 | maxY = _maxY; |
65 | } | 67 | } |
66 | 68 | ||
67 | void OXYSelector::setValues( int _xPos, int _yPos ) | 69 | void OXYSelector::setValues( int _xPos, int _yPos ) |
68 | { | 70 | { |
69 | xPos = _xPos; | 71 | xPos = _xPos; |
70 | yPos = _yPos; | 72 | yPos = _yPos; |
71 | 73 | ||
72 | if ( xPos > maxX ) | 74 | if ( xPos > maxX ) |
73 | xPos = maxX; | 75 | xPos = maxX; |
74 | else if ( xPos < minX ) | 76 | else if ( xPos < minX ) |
75 | xPos = minX; | 77 | xPos = minX; |
76 | 78 | ||
77 | if ( yPos > maxY ) | 79 | if ( yPos > maxY ) |
78 | yPos = maxY; | 80 | yPos = maxY; |
79 | else if ( yPos < minY ) | 81 | else if ( yPos < minY ) |
80 | yPos = minY; | 82 | yPos = minY; |
81 | 83 | ||
82 | int xp = 2 + (width() - 4) * xPos / (maxX - minX); | 84 | int xp = 2 + (width() - 4) * xPos / (maxX - minX); |
83 | int yp = height() - 2 - (height() - 4) * yPos / (maxY - minY); | 85 | int yp = height() - 2 - (height() - 4) * yPos / (maxY - minY); |
84 | 86 | ||
85 | setPosition( xp, yp ); | 87 | setPosition( xp, yp ); |
86 | } | 88 | } |
87 | 89 | ||
88 | QRect OXYSelector::contentsRect() const | 90 | QRect OXYSelector::contentsRect() const |
89 | { | 91 | { |
90 | return QRect( 2, 2, width()-4, height()-4 ); | 92 | return QRect( 2, 2, width()-4, height()-4 ); |
91 | } | 93 | } |
92 | 94 | ||
@@ -245,66 +247,66 @@ void OSelector::paintEvent( QPaintEvent * ) | |||
245 | 247 | ||
246 | drawContents( &painter ); | 248 | drawContents( &painter ); |
247 | 249 | ||
248 | QBrush brush; | 250 | QBrush brush; |
249 | 251 | ||
250 | if ( indent() ) | 252 | if ( indent() ) |
251 | { | 253 | { |
252 | if ( orientation() == Vertical ) | 254 | if ( orientation() == Vertical ) |
253 | qDrawShadePanel( &painter, 0, 3, width()-5, height()-6, | 255 | qDrawShadePanel( &painter, 0, 3, width()-5, height()-6, |
254 | colorGroup(), TRUE, 2, &brush ); | 256 | colorGroup(), TRUE, 2, &brush ); |
255 | else | 257 | else |
256 | qDrawShadePanel( &painter, 3, 0, width()-6, height()-5, | 258 | qDrawShadePanel( &painter, 3, 0, width()-6, height()-5, |
257 | colorGroup(), TRUE, 2, &brush ); | 259 | colorGroup(), TRUE, 2, &brush ); |
258 | } | 260 | } |
259 | 261 | ||
260 | QPoint pos = calcArrowPos( value() ); | 262 | QPoint pos = calcArrowPos( value() ); |
261 | drawArrow( &painter, TRUE, pos ); | 263 | drawArrow( &painter, TRUE, pos ); |
262 | 264 | ||
263 | painter.end(); | 265 | painter.end(); |
264 | } | 266 | } |
265 | 267 | ||
266 | void OSelector::mousePressEvent( QMouseEvent *e ) | 268 | void OSelector::mousePressEvent( QMouseEvent *e ) |
267 | { | 269 | { |
268 | moveArrow( e->pos() ); | 270 | moveArrow( e->pos() ); |
269 | } | 271 | } |
270 | 272 | ||
271 | void OSelector::mouseMoveEvent( QMouseEvent *e ) | 273 | void OSelector::mouseMoveEvent( QMouseEvent *e ) |
272 | { | 274 | { |
273 | moveArrow( e->pos() ); | 275 | moveArrow( e->pos() ); |
274 | } | 276 | } |
275 | 277 | ||
276 | void OSelector::wheelEvent( QWheelEvent *e ) | 278 | void OSelector::wheelEvent( QWheelEvent *e ) |
277 | { | 279 | { |
278 | int val = value() + e->delta()/120; | 280 | int val = value() + e->delta()/120; |
279 | emit valueChanged( val ); | 281 | emit valueChanged( val ); |
280 | setValue( val ); | 282 | setValue( val ); |
281 | } | 283 | } |
282 | 284 | ||
283 | void OSelector::valueChange() | 285 | void OSelector::valueChange() |
284 | { | 286 | { |
285 | QPainter painter; | 287 | QPainter painter; |
286 | QPoint pos; | 288 | QPoint pos; |
287 | 289 | ||
288 | painter.begin( this ); | 290 | painter.begin( this ); |
289 | 291 | ||
290 | pos = calcArrowPos( prevValue() ); | 292 | pos = calcArrowPos( prevValue() ); |
291 | drawArrow( &painter, FALSE, pos ); | 293 | drawArrow( &painter, FALSE, pos ); |
292 | 294 | ||
293 | pos = calcArrowPos( value() ); | 295 | pos = calcArrowPos( value() ); |
294 | drawArrow( &painter, TRUE, pos ); | 296 | drawArrow( &painter, TRUE, pos ); |
295 | 297 | ||
296 | painter.end(); | 298 | painter.end(); |
297 | } | 299 | } |
298 | 300 | ||
299 | void OSelector::moveArrow( const QPoint &pos ) | 301 | void OSelector::moveArrow( const QPoint &pos ) |
300 | { | 302 | { |
301 | int val; | 303 | int val; |
302 | 304 | ||
303 | if ( orientation() == Vertical ) | 305 | if ( orientation() == Vertical ) |
304 | val = ( maxValue() - minValue() ) * (height()-pos.y()-3) | 306 | val = ( maxValue() - minValue() ) * (height()-pos.y()-3) |
305 | / (height()-10) + minValue(); | 307 | / (height()-10) + minValue(); |
306 | else | 308 | else |
307 | val = ( maxValue() - minValue() ) * (width()-pos.x()-3) | 309 | val = ( maxValue() - minValue() ) * (width()-pos.x()-3) |
308 | / (width()-10) + minValue(); | 310 | / (width()-10) + minValue(); |
309 | 311 | ||
310 | if ( val > maxValue() ) | 312 | if ( val > maxValue() ) |
@@ -348,34 +350,34 @@ void OSelector::drawArrow( QPainter *painter, bool show, const QPoint &pos ) | |||
348 | painter->setPen( QPen() ); | 350 | painter->setPen( QPen() ); |
349 | painter->setBrush( QBrush( colorGroup().buttonText() ) ); | 351 | painter->setBrush( QBrush( colorGroup().buttonText() ) ); |
350 | if ( orientation() == Vertical ) | 352 | if ( orientation() == Vertical ) |
351 | { | 353 | { |
352 | array.setPoint( 0, pos.x()+0, pos.y()+0 ); | 354 | array.setPoint( 0, pos.x()+0, pos.y()+0 ); |
353 | array.setPoint( 1, pos.x()+5, pos.y()+5 ); | 355 | array.setPoint( 1, pos.x()+5, pos.y()+5 ); |
354 | array.setPoint( 2, pos.x()+5, pos.y()-5 ); | 356 | array.setPoint( 2, pos.x()+5, pos.y()-5 ); |
355 | } | 357 | } |
356 | else | 358 | else |
357 | { | 359 | { |
358 | array.setPoint( 0, pos.x()+0, pos.y()+0 ); | 360 | array.setPoint( 0, pos.x()+0, pos.y()+0 ); |
359 | array.setPoint( 1, pos.x()+5, pos.y()+5 ); | 361 | array.setPoint( 1, pos.x()+5, pos.y()+5 ); |
360 | array.setPoint( 2, pos.x()-5, pos.y()+5 ); | 362 | array.setPoint( 2, pos.x()-5, pos.y()+5 ); |
361 | } | 363 | } |
362 | 364 | ||
363 | painter->drawPolygon( array ); | 365 | painter->drawPolygon( array ); |
364 | } | 366 | } |
365 | else | 367 | else |
366 | { | 368 | { |
367 | if ( orientation() == Vertical ) | 369 | if ( orientation() == Vertical ) |
368 | { | 370 | { |
369 | repaint(pos.x(), pos.y()-5, 6, 11, true); | 371 | repaint(pos.x(), pos.y()-5, 6, 11, true); |
370 | } | 372 | } |
371 | else | 373 | else |
372 | { | 374 | { |
373 | repaint(pos.x()-5, pos.y(), 11, 6, true); | 375 | repaint(pos.x()-5, pos.y(), 11, 6, true); |
374 | } | 376 | } |
375 | } | 377 | } |
376 | } | 378 | } |
377 | 379 | ||
378 | //---------------------------------------------------------------------------- | 380 | //---------------------------------------------------------------------------- |
379 | 381 | ||
380 | OGradientSelector::OGradientSelector( QWidget *parent, const char *name ) | 382 | OGradientSelector::OGradientSelector( QWidget *parent, const char *name ) |
381 | : OSelector( parent, name ) | 383 | : OSelector( parent, name ) |
@@ -387,33 +389,33 @@ OGradientSelector::OGradientSelector( QWidget *parent, const char *name ) | |||
387 | OGradientSelector::OGradientSelector( Orientation o, QWidget *parent, | 389 | OGradientSelector::OGradientSelector( Orientation o, QWidget *parent, |
388 | const char *name ) | 390 | const char *name ) |
389 | : OSelector( o, parent, name ) | 391 | : OSelector( o, parent, name ) |
390 | { | 392 | { |
391 | init(); | 393 | init(); |
392 | } | 394 | } |
393 | 395 | ||
394 | 396 | ||
395 | OGradientSelector::~OGradientSelector() | 397 | OGradientSelector::~OGradientSelector() |
396 | {} | 398 | {} |
397 | 399 | ||
398 | 400 | ||
399 | void OGradientSelector::init() | 401 | void OGradientSelector::init() |
400 | { | 402 | { |
401 | color1.setRgb( 0, 0, 0 ); | 403 | color1.setRgb( 0, 0, 0 ); |
402 | color2.setRgb( 255, 255, 255 ); | 404 | color2.setRgb( 255, 255, 255 ); |
403 | 405 | ||
404 | text1 = text2 = ""; | 406 | text1 = text2 = ""; |
405 | } | 407 | } |
406 | 408 | ||
407 | 409 | ||
408 | void OGradientSelector::drawContents( QPainter *painter ) | 410 | void OGradientSelector::drawContents( QPainter *painter ) |
409 | { | 411 | { |
410 | QImage image( contentsRect().width(), contentsRect().height(), 32 ); | 412 | QImage image( contentsRect().width(), contentsRect().height(), 32 ); |
411 | 413 | ||
412 | QColor col; | 414 | QColor col; |
413 | float scale; | 415 | float scale; |
414 | 416 | ||
415 | int redDiff = color2.red() - color1.red(); | 417 | int redDiff = color2.red() - color1.red(); |
416 | int greenDiff = color2.green() - color1.green(); | 418 | int greenDiff = color2.green() - color1.green(); |
417 | int blueDiff = color2.blue() - color1.blue(); | 419 | int blueDiff = color2.blue() - color1.blue(); |
418 | 420 | ||
419 | if ( orientation() == Vertical ) | 421 | if ( orientation() == Vertical ) |
@@ -459,33 +461,33 @@ void OGradientSelector::drawContents( QPainter *painter ) | |||
459 | 461 | ||
460 | QPixmap p; | 462 | QPixmap p; |
461 | p.convertFromImage( image ); | 463 | p.convertFromImage( image ); |
462 | 464 | ||
463 | painter->drawPixmap( contentsRect().x(), contentsRect().y(), p ); | 465 | painter->drawPixmap( contentsRect().x(), contentsRect().y(), p ); |
464 | 466 | ||
465 | if ( orientation() == Vertical ) | 467 | if ( orientation() == Vertical ) |
466 | { | 468 | { |
467 | int yPos = contentsRect().top() + painter->fontMetrics().ascent() + 2; | 469 | int yPos = contentsRect().top() + painter->fontMetrics().ascent() + 2; |
468 | int xPos = contentsRect().left() + (contentsRect().width() - | 470 | int xPos = contentsRect().left() + (contentsRect().width() - |
469 | painter->fontMetrics().width( text2 )) / 2; | 471 | painter->fontMetrics().width( text2 )) / 2; |
470 | QPen pen( color2 ); | 472 | QPen pen( color2 ); |
471 | painter->setPen( pen ); | 473 | painter->setPen( pen ); |
472 | painter->drawText( xPos, yPos, text2 ); | 474 | painter->drawText( xPos, yPos, text2 ); |
473 | 475 | ||
474 | yPos = contentsRect().bottom() - painter->fontMetrics().descent() - 2; | 476 | yPos = contentsRect().bottom() - painter->fontMetrics().descent() - 2; |
475 | xPos = contentsRect().left() + (contentsRect().width() - | 477 | xPos = contentsRect().left() + (contentsRect().width() - |
476 | painter->fontMetrics().width( text1 )) / 2; | 478 | painter->fontMetrics().width( text1 )) / 2; |
477 | pen.setColor( color1 ); | 479 | pen.setColor( color1 ); |
478 | painter->setPen( pen ); | 480 | painter->setPen( pen ); |
479 | painter->drawText( xPos, yPos, text1 ); | 481 | painter->drawText( xPos, yPos, text1 ); |
480 | } | 482 | } |
481 | else | 483 | else |
482 | { | 484 | { |
483 | int yPos = contentsRect().bottom()-painter->fontMetrics().descent()-2; | 485 | int yPos = contentsRect().bottom()-painter->fontMetrics().descent()-2; |
484 | 486 | ||
485 | QPen pen( color2 ); | 487 | QPen pen( color2 ); |
486 | painter->setPen( pen ); | 488 | painter->setPen( pen ); |
487 | painter->drawText( contentsRect().left() + 2, yPos, text1 ); | 489 | painter->drawText( contentsRect().left() + 2, yPos, text1 ); |
488 | 490 | ||
489 | pen.setColor( color1 ); | 491 | pen.setColor( color1 ); |
490 | painter->setPen( pen ); | 492 | painter->setPen( pen ); |
491 | painter->drawText( contentsRect().right() - | 493 | painter->drawText( contentsRect().right() - |
diff --git a/libopie2/opieui/oselector.h b/libopie2/opieui/oselector.h index f832239..fe75a46 100644 --- a/libopie2/opieui/oselector.h +++ b/libopie2/opieui/oselector.h | |||
@@ -14,32 +14,35 @@ | |||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | //----------------------------------------------------------------------------- | 19 | //----------------------------------------------------------------------------- |
20 | // Selector widgets for KDE Color Selector, but probably useful for other | 20 | // Selector widgets for KDE Color Selector, but probably useful for other |
21 | // stuff also. | 21 | // stuff also. |
22 | 22 | ||
23 | #ifndef __OSELECT_H__ | 23 | #ifndef __OSELECT_H__ |
24 | #define __OSELECT_H__ | 24 | #define __OSELECT_H__ |
25 | 25 | ||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qrangecontrol.h> | 27 | #include <qrangecontrol.h> |
28 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
29 | 29 | ||
30 | |||
31 | namespace Opie { | ||
32 | namespace Ui { | ||
30 | /** | 33 | /** |
31 | * OXYSelector is the base class for other widgets which | 34 | * OXYSelector is the base class for other widgets which |
32 | * provides the ability to choose from a two-dimensional | 35 | * provides the ability to choose from a two-dimensional |
33 | * range of values. The currently chosen value is indicated | 36 | * range of values. The currently chosen value is indicated |
34 | * by a cross. An example is the @ref OHSSelector which | 37 | * by a cross. An example is the @ref OHSSelector which |
35 | * allows to choose from a range of colors, and which is | 38 | * allows to choose from a range of colors, and which is |
36 | * used in OColorDialog. | 39 | * used in OColorDialog. |
37 | * | 40 | * |
38 | * A custom drawing routine for the widget surface has | 41 | * A custom drawing routine for the widget surface has |
39 | * to be provided by the subclass. | 42 | * to be provided by the subclass. |
40 | */ | 43 | */ |
41 | class OXYSelector : public QWidget | 44 | class OXYSelector : public QWidget |
42 | { | 45 | { |
43 | Q_OBJECT | 46 | Q_OBJECT |
44 | 47 | ||
45 | public: | 48 | public: |
@@ -499,20 +502,22 @@ public: | |||
499 | 502 | ||
500 | void rgb(int *_r, int *_g, int *_b) const; | 503 | void rgb(int *_r, int *_g, int *_b) const; |
501 | void hsv(int *_h, int *_s, int *_v) const; | 504 | void hsv(int *_h, int *_s, int *_v) const; |
502 | protected: | 505 | protected: |
503 | int h; | 506 | int h; |
504 | int s; | 507 | int s; |
505 | int v; | 508 | int v; |
506 | int r; | 509 | int r; |
507 | int g; | 510 | int g; |
508 | int b; | 511 | int b; |
509 | 512 | ||
510 | private: | 513 | private: |
511 | class OColorPrivate; | 514 | class OColorPrivate; |
512 | OColorPrivate *d; | 515 | OColorPrivate *d; |
513 | }; | 516 | }; |
514 | 517 | ||
518 | } | ||
519 | } | ||
515 | 520 | ||
516 | 521 | ||
517 | #endif // __OSELECT_H__ | 522 | #endif // __OSELECT_H__ |
518 | 523 | ||
diff --git a/libopie2/opieui/oseparator.cpp b/libopie2/opieui/oseparator.cpp index b93c225..bbc4381 100644 --- a/libopie2/opieui/oseparator.cpp +++ b/libopie2/opieui/oseparator.cpp | |||
@@ -23,32 +23,34 @@ | |||
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 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | 33 | ||
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/oseparator.h> | 35 | #include <opie2/oseparator.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | 38 | ||
39 | using namespace Opie::Core; | ||
40 | using namespace Opie::Ui; | ||
39 | 41 | ||
40 | OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) | 42 | OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) |
41 | : QFrame(parent, name, f) | 43 | : QFrame(parent, name, f) |
42 | { | 44 | { |
43 | setLineWidth(1); | 45 | setLineWidth(1); |
44 | setMidLineWidth(0); | 46 | setMidLineWidth(0); |
45 | setOrientation( HLine ); | 47 | setOrientation( HLine ); |
46 | } | 48 | } |
47 | 49 | ||
48 | 50 | ||
49 | 51 | ||
50 | OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) | 52 | OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) |
51 | : QFrame(parent, name, f) | 53 | : QFrame(parent, name, f) |
52 | { | 54 | { |
53 | setLineWidth(1); | 55 | setLineWidth(1); |
54 | setMidLineWidth(0); | 56 | setMidLineWidth(0); |
diff --git a/libopie2/opieui/oseparator.h b/libopie2/opieui/oseparator.h index e59b3f4..6fc4344 100644 --- a/libopie2/opieui/oseparator.h +++ b/libopie2/opieui/oseparator.h | |||
@@ -22,32 +22,35 @@ | |||
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 | 32 | ||
33 | #ifndef OSEPARATOR_H | 33 | #ifndef OSEPARATOR_H |
34 | #define OSEPARATOR_H | 34 | #define OSEPARATOR_H |
35 | 35 | ||
36 | #include <qframe.h> | 36 | #include <qframe.h> |
37 | 37 | ||
38 | namespace Opie { | ||
39 | namespace Ui { | ||
40 | |||
38 | /** | 41 | /** |
39 | * Standard horizontal or vertical separator. | 42 | * Standard horizontal or vertical separator. |
40 | * | 43 | * |
41 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 44 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
42 | * @author Michael Roth <mroth@wirlweb.de> | 45 | * @author Michael Roth <mroth@wirlweb.de> |
43 | * @version $Id$ | 46 | * @version $Id$ |
44 | */ | 47 | */ |
45 | class OSeparator : public QFrame | 48 | class OSeparator : public QFrame |
46 | { | 49 | { |
47 | Q_OBJECT | 50 | Q_OBJECT |
48 | Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) | 51 | Q_PROPERTY( int orientation READ orientation WRITE setOrientation ) |
49 | public: | 52 | public: |
50 | /** | 53 | /** |
51 | * Constructor. | 54 | * Constructor. |
52 | **/ | 55 | **/ |
53 | OSeparator(QWidget* parent=0, const char* name=0, WFlags f=0); | 56 | OSeparator(QWidget* parent=0, const char* name=0, WFlags f=0); |
@@ -73,18 +76,20 @@ class OSeparator : public QFrame | |||
73 | * Possible values are VLine and HLine. | 76 | * Possible values are VLine and HLine. |
74 | */ | 77 | */ |
75 | void setOrientation(int orient); | 78 | void setOrientation(int orient); |
76 | 79 | ||
77 | /** | 80 | /** |
78 | * The recommended height (width) for a horizontal (vertical) separator. | 81 | * The recommended height (width) for a horizontal (vertical) separator. |
79 | **/ | 82 | **/ |
80 | virtual QSize sizeHint() const; | 83 | virtual QSize sizeHint() const; |
81 | 84 | ||
82 | protected: | 85 | protected: |
83 | virtual void drawFrame( QPainter * ); | 86 | virtual void drawFrame( QPainter * ); |
84 | 87 | ||
85 | private: | 88 | private: |
86 | class OSeparatorPrivate* d; | 89 | class OSeparatorPrivate* d; |
87 | }; | 90 | }; |
88 | 91 | ||
92 | } | ||
93 | } | ||
89 | 94 | ||
90 | #endif // OSEPARATOR_H | 95 | #endif // OSEPARATOR_H |
diff --git a/libopie2/opieui/otabbar.cpp b/libopie2/opieui/otabbar.cpp index cd3a34b..a62e18b 100644 --- a/libopie2/opieui/otabbar.cpp +++ b/libopie2/opieui/otabbar.cpp | |||
@@ -18,33 +18,33 @@ | |||
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 | 31 | ||
32 | #include <opie2/otabbar.h> | 32 | #include <opie2/otabbar.h> |
33 | 33 | ||
34 | using namespace Opie; | 34 | using namespace Opie::Ui; |
35 | 35 | ||
36 | OTabBar::OTabBar( QWidget *parent , const char *name ) | 36 | OTabBar::OTabBar( QWidget *parent , const char *name ) |
37 | :QTabBar( parent, name ) | 37 | :QTabBar( parent, name ) |
38 | {} | 38 | {} |
39 | 39 | ||
40 | void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const | 40 | void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const |
41 | { | 41 | { |
42 | 42 | ||
43 | QRect r = br; | 43 | QRect r = br; |
44 | if ( t->iconset) | 44 | if ( t->iconset) |
45 | { | 45 | { |
46 | QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 46 | QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
47 | if ( mode == QIconSet::Normal && has_focus ) | 47 | if ( mode == QIconSet::Normal && has_focus ) |
48 | { | 48 | { |
49 | mode = QIconSet::Active; | 49 | mode = QIconSet::Active; |
50 | } | 50 | } |
diff --git a/libopie2/opieui/otabbar.h b/libopie2/opieui/otabbar.h index 2f35c85..925ae96 100644 --- a/libopie2/opieui/otabbar.h +++ b/libopie2/opieui/otabbar.h | |||
@@ -22,34 +22,34 @@ | |||
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 | 31 | ||
32 | #ifndef OTABBAR_H | 32 | #ifndef OTABBAR_H |
33 | #define OTABBAR_H | 33 | #define OTABBAR_H |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qtabbar.h> | 36 | #include <qtabbar.h> |
37 | 37 | ||
38 | namespace Opie | 38 | namespace Opie { |
39 | { | 39 | namespace Ui { |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * @class OTabBar | 42 | * @class OTabBar |
43 | * @brief The OTabBar class is a derivative of QTabBar. | 43 | * @brief The OTabBar class is a derivative of QTabBar. |
44 | * | 44 | * |
45 | * OTabBar is a derivation of TrollTech's QTabBar which provides | 45 | * OTabBar is a derivation of TrollTech's QTabBar which provides |
46 | * a row of tabs for selection. The only difference between this | 46 | * a row of tabs for selection. The only difference between this |
47 | * class and QTabBar is that there is no dotted line box around | 47 | * class and QTabBar is that there is no dotted line box around |
48 | * the label of the tab with the current focus. | 48 | * the label of the tab with the current focus. |
49 | */ | 49 | */ |
50 | class OTabBar : public QTabBar | 50 | class OTabBar : public QTabBar |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | /** | 55 | /** |
@@ -67,19 +67,20 @@ protected: | |||
67 | /** | 67 | /** |
68 | * @fn paintLabel( QPainter* p, const QRect& br , QTab* t, bool has_focus)const | 68 | * @fn paintLabel( QPainter* p, const QRect& br , QTab* t, bool has_focus)const |
69 | * @brief Internal function to draw a tab's label. | 69 | * @brief Internal function to draw a tab's label. |
70 | * | 70 | * |
71 | * @param p Pointer to QPainter used for drawing. | 71 | * @param p Pointer to QPainter used for drawing. |
72 | * @param br QRect providing region to draw label in. | 72 | * @param br QRect providing region to draw label in. |
73 | * @param t Tab to draw label for. | 73 | * @param t Tab to draw label for. |
74 | * @param has_focus Boolean value not used, retained for compatibility reasons. | 74 | * @param has_focus Boolean value not used, retained for compatibility reasons. |
75 | */ | 75 | */ |
76 | void paintLabel( QPainter *, const QRect &, QTab *, bool ) const; | 76 | void paintLabel( QPainter *, const QRect &, QTab *, bool ) const; |
77 | 77 | ||
78 | private: | 78 | private: |
79 | class Private; | 79 | class Private; |
80 | Private *d; | 80 | Private *d; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | }; | 83 | } |
84 | } | ||
84 | 85 | ||
85 | #endif | 86 | #endif |
diff --git a/libopie2/opieui/otabinfo.h b/libopie2/opieui/otabinfo.h index 4a6ce14..426c45a 100644 --- a/libopie2/opieui/otabinfo.h +++ b/libopie2/opieui/otabinfo.h | |||
@@ -25,34 +25,34 @@ | |||
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 | 31 | ||
32 | #ifndef OTABINFO_H | 32 | #ifndef OTABINFO_H |
33 | #define OTABINFO_H | 33 | #define OTABINFO_H |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | #include <qlist.h> | 36 | #include <qlist.h> |
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | 38 | ||
39 | class QWidget; | 39 | class QWidget; |
40 | 40 | ||
41 | namespace Opie | 41 | namespace Opie{ |
42 | { | 42 | namespace Ui { |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @class OTabInfo | 45 | * @class OTabInfo |
46 | * @brief The OTabInfo class is used internally by OTabWidget to keep track | 46 | * @brief The OTabInfo class is used internally by OTabWidget to keep track |
47 | * of widgets added to the control. | 47 | * of widgets added to the control. |
48 | * | 48 | * |
49 | * OTabInfo provides the following information about a widget added to an | 49 | * OTabInfo provides the following information about a widget added to an |
50 | * OTabWidget control: | 50 | * OTabWidget control: |
51 | * | 51 | * |
52 | * ID - integer tab bar ID | 52 | * ID - integer tab bar ID |
53 | * Control - QWidget pointer to child widget | 53 | * Control - QWidget pointer to child widget |
54 | * Label - QString text label for OTabWidget selection control | 54 | * Label - QString text label for OTabWidget selection control |
55 | * Icon - QString name of icon file | 55 | * Icon - QString name of icon file |
56 | */ | 56 | */ |
57 | class OTabInfo | 57 | class OTabInfo |
58 | { | 58 | { |
@@ -122,19 +122,20 @@ public: | |||
122 | 122 | ||
123 | private: | 123 | private: |
124 | int i; | 124 | int i; |
125 | QWidget *c; | 125 | QWidget *c; |
126 | QString p; | 126 | QString p; |
127 | QString l; | 127 | QString l; |
128 | class Private; | 128 | class Private; |
129 | Private *d; | 129 | Private *d; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * @class OTabInfoList | 133 | * @class OTabInfoList |
134 | * @brief A list of OTabInfo objects used by OTabWidget. | 134 | * @brief A list of OTabInfo objects used by OTabWidget. |
135 | */ | 135 | */ |
136 | typedef QList<OTabInfo> OTabInfoList; | 136 | typedef QList<OTabInfo> OTabInfoList; |
137 | 137 | ||
138 | }; | 138 | } |
139 | } | ||
139 | 140 | ||
140 | #endif | 141 | #endif |
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp index f47c90b..a9f7da9 100644 --- a/libopie2/opieui/otabwidget.cpp +++ b/libopie2/opieui/otabwidget.cpp | |||
@@ -28,33 +28,33 @@ | |||
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/otabwidget.h> | 32 | #include <opie2/otabwidget.h> |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | #include <opie2/otabbar.h> | 38 | #include <opie2/otabbar.h> |
39 | 39 | ||
40 | /* QT */ | 40 | /* QT */ |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qwidgetstack.h> | 42 | #include <qwidgetstack.h> |
43 | 43 | ||
44 | using namespace Opie; | 44 | using namespace Opie::Ui; |
45 | 45 | ||
46 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) | 46 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) |
47 | : QWidget( parent, name ) | 47 | : QWidget( parent, name ) |
48 | { | 48 | { |
49 | if ( s == Global ) | 49 | if ( s == Global ) |
50 | { | 50 | { |
51 | Config config( "qpe" ); | 51 | Config config( "qpe" ); |
52 | config.setGroup( "Appearance" ); | 52 | config.setGroup( "Appearance" ); |
53 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); | 53 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); |
54 | if ( s <= Global || s > IconList) | 54 | if ( s <= Global || s > IconList) |
55 | { | 55 | { |
56 | s = IconTab; | 56 | s = IconTab; |
57 | } | 57 | } |
58 | QString pos = config.readEntry( "TabPosition", "Top"); | 58 | QString pos = config.readEntry( "TabPosition", "Top"); |
59 | if ( pos == "Bottom" ) | 59 | if ( pos == "Bottom" ) |
60 | { | 60 | { |
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h index 092f22c..6a64b7d 100644 --- a/libopie2/opieui/otabwidget.h +++ b/libopie2/opieui/otabwidget.h | |||
@@ -25,41 +25,40 @@ | |||
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OTABWIDGET_H | 31 | #ifndef OTABWIDGET_H |
32 | #define OTABWIDGET_H | 32 | #define OTABWIDGET_H |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/otabinfo.h> | 35 | #include <opie2/otabinfo.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | #include <qlist.h> | 39 | #include <qlist.h> |
40 | 40 | ||
41 | using namespace Opie; | ||
42 | 41 | ||
43 | class QComboBox; | 42 | class QComboBox; |
44 | class QPixmap; | 43 | class QPixmap; |
45 | class QTabBar; | 44 | class QTabBar; |
46 | class QWidgetStack; | 45 | class QWidgetStack; |
47 | 46 | ||
48 | namespace Opie | 47 | namespace Opie { |
49 | { | 48 | namespace Ui { |
50 | 49 | ||
51 | class OTabBar; | 50 | class OTabBar; |
52 | 51 | ||
53 | /** | 52 | /** |
54 | * @class OTabWidget | 53 | * @class OTabWidget |
55 | * @brief The OTabWidget class provides a stack of widgets. | 54 | * @brief The OTabWidget class provides a stack of widgets. |
56 | * | 55 | * |
57 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides | 56 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides |
58 | * a stack of widgets. Widgets can be selected using either a tab bar or | 57 | * a stack of widgets. Widgets can be selected using either a tab bar or |
59 | * drop down list box. | 58 | * drop down list box. |
60 | * | 59 | * |
61 | * The normal way to use OTabWidget is to do the following in the | 60 | * The normal way to use OTabWidget is to do the following in the |
62 | * constructor: | 61 | * constructor: |
63 | * - Create a OTabWidget. | 62 | * - Create a OTabWidget. |
64 | * - Create a QWidget for each of the pages in the control, insert | 63 | * - Create a QWidget for each of the pages in the control, insert |
65 | * children into it, set up geometry management for it, and use addTab() | 64 | * children into it, set up geometry management for it, and use addTab() |
@@ -274,19 +273,20 @@ private: | |||
274 | * @fn slotTabBarSelected( int id ) | 273 | * @fn slotTabBarSelected( int id ) |
275 | * @brief Slot which is called when a tab is selected. | 274 | * @brief Slot which is called when a tab is selected. |
276 | * | 275 | * |
277 | * @param id ID of widget selected. | 276 | * @param id ID of widget selected. |
278 | */ | 277 | */ |
279 | void slotTabBarSelected( int ); | 278 | void slotTabBarSelected( int ); |
280 | 279 | ||
281 | /** | 280 | /** |
282 | * @fn slotTabListSelected( int index ) | 281 | * @fn slotTabListSelected( int index ) |
283 | * @brief Slot which is called when a drop down selection is made. | 282 | * @brief Slot which is called when a drop down selection is made. |
284 | * | 283 | * |
285 | * @param id Index of widget selected. | 284 | * @param id Index of widget selected. |
286 | */ | 285 | */ |
287 | void slotTabListSelected( int ); | 286 | void slotTabListSelected( int ); |
288 | }; | 287 | }; |
289 | 288 | ||
290 | }; | 289 | } |
290 | } | ||
291 | 291 | ||
292 | #endif | 292 | #endif |
diff --git a/libopie2/opieui/otaskbarapplet.cpp b/libopie2/opieui/otaskbarapplet.cpp index a67356d..b5268f0 100644 --- a/libopie2/opieui/otaskbarapplet.cpp +++ b/libopie2/opieui/otaskbarapplet.cpp | |||
@@ -15,18 +15,68 @@ | |||
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/otaskbarapplet.h> | ||
32 | |||
33 | #include <qpe/qpeapplication.h> | ||
34 | #include <qframe.h> | ||
35 | |||
36 | using namespace Opie::Ui; | ||
37 | |||
38 | |||
39 | /** | ||
40 | * \todo no example yet!!! | ||
41 | * If you want to implement an Applet for the Opie Taskbar | ||
42 | * use this interface. | ||
43 | * The only specail thing about applets is that you need to build | ||
44 | * it as plugin/library and do EXPORT_OPIE_APPLET_v1( YourApplet ) | ||
45 | * at the bottom of your application. This takes care of | ||
46 | * the activation and implementing the TaskbarAppletInterface. | ||
47 | * You also need to add a static int position() functions to your | ||
48 | * application. | ||
49 | * \code | ||
50 | * class MyApplet : public OTaskBarApplet { | ||
51 | * public: | ||
52 | * static int position() { return 3: } | ||
53 | * void doStuff() { | ||
54 | * popup( myWidget ); | ||
55 | * } | ||
56 | * }; | ||
57 | * EXPORT_OPIE_APPLET_v1( MyApplet ) | ||
58 | * \endcode | ||
59 | * | ||
60 | * @author Michael Lauer | ||
61 | * @version 0.5 | ||
62 | * @see TaskbarAppletInterface | ||
63 | */ | ||
64 | OTaskbarApplet::OTaskbarApplet( QWidget* parent, const char* name ) | ||
65 | :QWidget( parent, name ){ | ||
66 | setFixedHeight( 18 ); | ||
67 | setFixedWidth( 14 ); | ||
68 | } | ||
69 | |||
70 | OTaskbarApplet::~OTaskbarApplet(){ | ||
71 | } | ||
72 | |||
73 | void OTaskbarApplet::popup( QWidget* widget ){ | ||
74 | QPoint curPos = mapToGlobal( QPoint( 0, 0 ) ); | ||
75 | int w = widget->sizeHint().width(); | ||
76 | int x = curPos.x() - (w/2 ); | ||
77 | if ( (x+w) > QPEApplication::desktop()->width() ) | ||
78 | x = QPEApplication::desktop()->width()-w; | ||
79 | widget->move( x, curPos.y()-widget->sizeHint().height() ); | ||
80 | widget->show(); | ||
81 | } | ||
31 | 82 | ||
32 | // Empty on purpose until we shipped Opie 1.0 (see otaskbarapplet.h for explanation) | ||
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h index 074367f..0c85ee7 100644 --- a/libopie2/opieui/otaskbarapplet.h +++ b/libopie2/opieui/otaskbarapplet.h | |||
@@ -20,37 +20,46 @@ | |||
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 | 31 | ||
32 | #ifndef OTASKBARAPPLET_H | 32 | #ifndef OTASKBARAPPLET_H |
33 | #define OTASKBARAPPLET_H | 33 | #define OTASKBARAPPLET_H |
34 | 34 | ||
35 | #include <qpe/taskbarappletinterface.h> | 35 | #include <qpe/taskbarappletinterface.h> |
36 | #include <qpe/qcom.h> | ||
36 | 37 | ||
38 | #include <qwidget.h> | ||
39 | |||
40 | class QMouseEvent; | ||
41 | |||
42 | namespace Opie { | ||
43 | namespace Ui { | ||
44 | namespace Private { | ||
37 | /*====================================================================================== | 45 | /*====================================================================================== |
38 | * OTaskbarAppletWrapper | 46 | * OTaskbarAppletWrapper |
39 | *======================================================================================*/ | 47 | *======================================================================================*/ |
40 | 48 | ||
49 | class OTaskbarAppletWrapperPrivate; | ||
41 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | 50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface |
42 | { | 51 | { |
43 | public: | 52 | public: |
44 | OTaskbarAppletWrapper():_applet( 0 ) | 53 | OTaskbarAppletWrapper():_applet( 0 ) |
45 | { | 54 | { |
46 | } | 55 | } |
47 | 56 | ||
48 | virtual ~OTaskbarAppletWrapper() | 57 | virtual ~OTaskbarAppletWrapper() |
49 | { | 58 | { |
50 | delete _applet; | 59 | delete _applet; |
51 | } | 60 | } |
52 | 61 | ||
53 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) | 62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) |
54 | { | 63 | { |
55 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); | 64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); |
56 | *iface = 0; | 65 | *iface = 0; |
@@ -67,64 +76,54 @@ template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | |||
67 | 76 | ||
68 | Q_REFCOUNT | 77 | Q_REFCOUNT |
69 | 78 | ||
70 | virtual T* applet( QWidget* parent ) | 79 | virtual T* applet( QWidget* parent ) |
71 | { | 80 | { |
72 | if ( !_applet ) _applet = new T( parent ); | 81 | if ( !_applet ) _applet = new T( parent ); |
73 | return _applet; | 82 | return _applet; |
74 | } | 83 | } |
75 | 84 | ||
76 | virtual int position() const | 85 | virtual int position() const |
77 | { | 86 | { |
78 | return T::position(); | 87 | return T::position(); |
79 | } | 88 | } |
80 | 89 | ||
81 | private: | 90 | private: |
82 | T* _applet; | 91 | T* _applet; |
92 | OTaskbarAppletWrapperPrivate *d; | ||
83 | }; | 93 | }; |
84 | 94 | ||
85 | #include <qframe.h> | 95 | } |
86 | #include <qwidget.h> | ||
87 | #include <qpe/qpeapplication.h> | ||
88 | |||
89 | class QMouseEvent; | ||
90 | |||
91 | /*====================================================================================== | 96 | /*====================================================================================== |
92 | * OTaskbarApplet | 97 | * OTaskbarApplet |
93 | *======================================================================================*/ | 98 | *======================================================================================*/ |
94 | 99 | ||
95 | // Must be inline until after we shipped Opie 1.0 | 100 | // Must be inline until after we shipped Opie 1.0 |
96 | 101 | ||
97 | // Having OTaskBarApplet reside in libopieui2 is not possible | 102 | // Having OTaskBarApplet reside in libopieui2 is not possible |
98 | // until we link the launcher binary against libopieui2 - | 103 | // until we link the launcher binary against libopieui2 - |
99 | // otherwise the necessary symbols are not present, when | 104 | // otherwise the necessary symbols are not present, when |
100 | // the dynamic loader [dlopen] tries to resolve an applet which | 105 | // the dynamic loader [dlopen] tries to resolve an applet which |
101 | // inherits OTaskbarApplet | 106 | // inherits OTaskbarApplet |
102 | 107 | ||
103 | class OTaskbarApplet : public QWidget | 108 | class OTaskbarApplet : public QWidget |
104 | { | 109 | { |
105 | public: | 110 | public: |
106 | OTaskbarApplet( QWidget* parent, const char* name = 0 ):QWidget( parent, name ) | 111 | OTaskbarApplet( QWidget* parent, const char* name = 0 ); |
107 | { | 112 | virtual ~OTaskbarApplet(); |
108 | setFixedHeight( 18 ); | ||
109 | setFixedWidth( 14 ); | ||
110 | } | ||
111 | |||
112 | virtual ~OTaskbarApplet() | ||
113 | { | ||
114 | } | ||
115 | 113 | ||
116 | protected: | 114 | protected: |
117 | virtual void popup( QWidget* widget ) | 115 | virtual void popup( QWidget* widget ); |
118 | { | 116 | private: |
119 | QPoint curPos = mapToGlobal( QPoint( 0, 0 ) ); | 117 | class Private; |
120 | int w = widget->sizeHint().width(); | 118 | Private *d; |
121 | int x = curPos.x() - (w/2 ); | ||
122 | if ( (x+w) > QPEApplication::desktop()->width() ) | ||
123 | x = QPEApplication::desktop()->width()-w; | ||
124 | widget->move( x, curPos.y()-widget->sizeHint().height() ); | ||
125 | widget->show(); | ||
126 | } | ||
127 | }; | 119 | }; |
120 | } | ||
121 | } | ||
122 | |||
123 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ | ||
124 | Q_EXPORT_INTERFACE() { \ | ||
125 | Q_CREATE_INSTANCE( Opie::Ui::Private::OTaskbarAppletWrapper<AppLet> ) \ | ||
126 | } | ||
128 | 127 | ||
129 | #endif | 128 | #endif |
130 | 129 | ||
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp index 66f9ce0..7de0fd3 100644 --- a/libopie2/opieui/otimepicker.cpp +++ b/libopie2/opieui/otimepicker.cpp | |||
@@ -14,40 +14,44 @@ | |||
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* OPIE */ | ||
31 | #include <opie2/otimepicker.h> | ||
32 | |||
30 | /* QT */ | 33 | /* QT */ |
34 | #include <qgroupbox.h> | ||
31 | #include <qlayout.h> | 35 | #include <qlayout.h> |
32 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
33 | 37 | ||
34 | /* OPIE */ | ||
35 | #include <opie2/otimepicker.h> | ||
36 | 38 | ||
37 | using namespace Opie; | 39 | |
40 | namespace Opie { | ||
41 | namespace Ui { | ||
38 | 42 | ||
39 | /** | 43 | /** |
40 | * Constructs the widget | 44 | * Constructs the widget |
41 | * @param parent The parent of the OTimePicker | 45 | * @param parent The parent of the OTimePicker |
42 | * @param name The name of the object | 46 | * @param name The name of the object |
43 | * @param fl Window Flags | 47 | * @param fl Window Flags |
44 | */ | 48 | */ |
45 | OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl) | 49 | OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl) |
46 | :QWidget(parent,name,fl) | 50 | :QWidget(parent,name,fl) |
47 | { | 51 | { |
48 | QVBoxLayout *vbox=new QVBoxLayout(this); | 52 | QVBoxLayout *vbox=new QVBoxLayout(this); |
49 | 53 | ||
50 | OClickableLabel *r; | 54 | OClickableLabel *r; |
51 | QString s; | 55 | QString s; |
52 | 56 | ||
53 | // Hour Row | 57 | // Hour Row |
@@ -207,32 +211,34 @@ void OTimePicker::setHour(int h) | |||
207 | else (*it)->setOn(false); | 211 | else (*it)->setOn(false); |
208 | } | 212 | } |
209 | tm.setHMS(h,tm.minute(),0); | 213 | tm.setHMS(h,tm.minute(),0); |
210 | } | 214 | } |
211 | 215 | ||
212 | 216 | ||
213 | /** | 217 | /** |
214 | * This is a modal Dialog. | 218 | * This is a modal Dialog. |
215 | * | 219 | * |
216 | * @param parent The parent widget | 220 | * @param parent The parent widget |
217 | * @param name The name of the object | 221 | * @param name The name of the object |
218 | * @param fl Possible window flags | 222 | * @param fl Possible window flags |
219 | */ | 223 | */ |
220 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) | 224 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) |
221 | : OTimePickerDialogBase (parent , name, true , fl) | 225 | : OTimePickerDialogBase (parent , name, true , fl) |
222 | { | 226 | { |
227 | m_timePicker = new OTimePicker( GroupBox1, "m_timePicker" ); | ||
228 | GroupBox1Layout->addWidget( m_timePicker, 0, 0 ); | ||
223 | 229 | ||
224 | connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), | 230 | connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), |
225 | this, SLOT( setTime(const QTime&) ) ); | 231 | this, SLOT( setTime(const QTime&) ) ); |
226 | connect ( minuteField, SIGNAL( textChanged(const QString&) ), | 232 | connect ( minuteField, SIGNAL( textChanged(const QString&) ), |
227 | this, SLOT ( setMinute(const QString&) ) ); | 233 | this, SLOT ( setMinute(const QString&) ) ); |
228 | connect ( hourField, SIGNAL( textChanged(const QString&) ), | 234 | connect ( hourField, SIGNAL( textChanged(const QString&) ), |
229 | this, SLOT ( setHour(const QString&) ) ); | 235 | this, SLOT ( setHour(const QString&) ) ); |
230 | 236 | ||
231 | } | 237 | } |
232 | 238 | ||
233 | /** | 239 | /** |
234 | * @return the time | 240 | * @return the time |
235 | */ | 241 | */ |
236 | QTime OTimePickerDialog::time()const | 242 | QTime OTimePickerDialog::time()const |
237 | { | 243 | { |
238 | return m_time; | 244 | return m_time; |
@@ -277,16 +283,19 @@ void OTimePickerDialog::setHour ( const QString& hour ) | |||
277 | 283 | ||
278 | } | 284 | } |
279 | 285 | ||
280 | /** | 286 | /** |
281 | * Method to set a new minute. It tries to convert the string to int and | 287 | * Method to set a new minute. It tries to convert the string to int and |
282 | * if the resulting date is valid a new date is set. | 288 | * if the resulting date is valid a new date is set. |
283 | * @see setHour | 289 | * @see setHour |
284 | */ | 290 | */ |
285 | void OTimePickerDialog::setMinute ( const QString& minute ) | 291 | void OTimePickerDialog::setMinute ( const QString& minute ) |
286 | { | 292 | { |
287 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ) | 293 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ) |
288 | { | 294 | { |
289 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); | 295 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); |
290 | setTime ( m_time ); | 296 | setTime ( m_time ); |
291 | } | 297 | } |
292 | } | 298 | } |
299 | |||
300 | } | ||
301 | } | ||
diff --git a/libopie2/opieui/otimepicker.h b/libopie2/opieui/otimepicker.h index 2da7773..01bb557 100644 --- a/libopie2/opieui/otimepicker.h +++ b/libopie2/opieui/otimepicker.h | |||
@@ -19,57 +19,56 @@ | |||
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OTIMEPICKER_H | 30 | #ifndef OTIMEPICKER_H |
31 | #define OTIMEPICKER_H | 31 | #define OTIMEPICKER_H |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/oclickablelabel.h> | 34 | #include <opie2/oclickablelabel.h> |
35 | #include "otimepickerbase.h" | 35 | #include <opie2/otimepickerbase.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qdatetime.h> | 40 | #include <qdatetime.h> |
41 | #include <qdialog.h> | 41 | #include <qdialog.h> |
42 | 42 | ||
43 | using namespace Opie; | ||
44 | 43 | ||
45 | // namespace Opie | 44 | namespace Opie { |
46 | // { | 45 | namespace Ui { |
47 | 46 | ||
48 | /** | 47 | /** |
49 | * A class to pick time. It uses clickable labels | 48 | * A class to pick time. It uses clickable labels |
50 | * internally to allow a quick selection of a time. | 49 | * internally to allow a quick selection of a time. |
51 | * A time can be selected by two clicks of a user | 50 | * A time can be selected by two clicks of a user |
52 | * | 51 | * |
53 | * @short A widget to quickly pick a QTime | 52 | * @short A widget to quickly pick a QTime |
54 | * @version 1.0 | 53 | * @version 1.0 |
55 | * @see QWidget | 54 | * @see QWidget |
56 | * @see QTime | 55 | * @see QTime |
57 | * @author Hakan Ardo, Stefan Eilers | 56 | * @author Hakan Ardo, Stefan Eilers |
58 | */ | 57 | */ |
59 | class OTimePicker: public QWidget | 58 | class OTimePicker : public QWidget |
60 | { | 59 | { |
61 | Q_OBJECT | 60 | Q_OBJECT |
62 | 61 | ||
63 | public: | 62 | public: |
64 | OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 63 | OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
65 | 64 | ||
66 | public slots: | 65 | public slots: |
67 | void setHour(int h); | 66 | void setHour(int h); |
68 | void setMinute(int m); | 67 | void setMinute(int m); |
69 | void setTime( const QTime& ); | 68 | void setTime( const QTime& ); |
70 | void setTime( int h, int m ); | 69 | void setTime( int h, int m ); |
71 | 70 | ||
72 | public: | 71 | public: |
73 | QTime time()const; | 72 | QTime time()const; |
74 | 73 | ||
75 | private: | 74 | private: |
@@ -101,25 +100,33 @@ signals: | |||
101 | class OTimePickerDialog: public OTimePickerDialogBase | 100 | class OTimePickerDialog: public OTimePickerDialogBase |
102 | { | 101 | { |
103 | Q_OBJECT | 102 | Q_OBJECT |
104 | 103 | ||
105 | public: | 104 | public: |
106 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); | 105 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); |
107 | ~OTimePickerDialog() { }; | 106 | ~OTimePickerDialog() { }; |
108 | 107 | ||
109 | QTime time()const; | 108 | QTime time()const; |
110 | 109 | ||
111 | public slots: | 110 | public slots: |
112 | void setTime( const QTime& time ); | 111 | void setTime( const QTime& time ); |
113 | void setHour( const QString& hour ); | 112 | void setHour( const QString& hour ); |
114 | void setMinute( const QString& minute ); | 113 | void setMinute( const QString& minute ); |
115 | 114 | ||
116 | private: | 115 | private: |
116 | OTimePicker *m_timePicker; | ||
117 | QTime m_time; | 117 | QTime m_time; |
118 | class Private; | 118 | class Private; |
119 | Private* d; | 119 | Private* d; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | // }; | 122 | } |
123 | } | ||
123 | 124 | ||
125 | /* for Qt2 */ | ||
126 | #if ( QT_VERSION-0 >= 0x030000 ) | ||
127 | #error "Fix the UI File to use namespaces" | ||
128 | #else | ||
129 | typedef Opie::Ui::OTimePicker OUIOTimePicker; | ||
130 | #endif | ||
124 | #endif | 131 | #endif |
125 | 132 | ||
diff --git a/libopie2/opieui/otimepickerbase.ui b/libopie2/opieui/otimepickerbase.ui index 3e7f2fb..c2eb7c5 100644 --- a/libopie2/opieui/otimepickerbase.ui +++ b/libopie2/opieui/otimepickerbase.ui | |||
@@ -1,30 +1,30 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>OTimePickerDialogBase</class> | 2 | <class>OTimePickerDialogBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>OTimePickerDialogBase</cstring> | 7 | <cstring>OTimePickerDialogBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>210</width> | 14 | <width>182</width> |
15 | <height>137</height> | 15 | <height>137</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>sizePolicy</name> | 19 | <name>sizePolicy</name> |
20 | <sizepolicy> | 20 | <sizepolicy> |
21 | <hsizetype>3</hsizetype> | 21 | <hsizetype>3</hsizetype> |
22 | <vsizetype>1</vsizetype> | 22 | <vsizetype>1</vsizetype> |
23 | </sizepolicy> | 23 | </sizepolicy> |
24 | </property> | 24 | </property> |
25 | <property stdset="1"> | 25 | <property stdset="1"> |
26 | <name>caption</name> | 26 | <name>caption</name> |
27 | <string>OTimePickerDialogBase</string> | 27 | <string>OTimePickerDialogBase</string> |
28 | </property> | 28 | </property> |
29 | <property> | 29 | <property> |
30 | <name>layoutMargin</name> | 30 | <name>layoutMargin</name> |
@@ -236,57 +236,21 @@ | |||
236 | <name>margin</name> | 236 | <name>margin</name> |
237 | <number>0</number> | 237 | <number>0</number> |
238 | </property> | 238 | </property> |
239 | <property stdset="1"> | 239 | <property stdset="1"> |
240 | <name>title</name> | 240 | <name>title</name> |
241 | <string>Pick Time:</string> | 241 | <string>Pick Time:</string> |
242 | </property> | 242 | </property> |
243 | <grid> | 243 | <grid> |
244 | <property stdset="1"> | 244 | <property stdset="1"> |
245 | <name>margin</name> | 245 | <name>margin</name> |
246 | <number>11</number> | 246 | <number>11</number> |
247 | </property> | 247 | </property> |
248 | <property stdset="1"> | 248 | <property stdset="1"> |
249 | <name>spacing</name> | 249 | <name>spacing</name> |
250 | <number>6</number> | 250 | <number>6</number> |
251 | </property> | 251 | </property> |
252 | <widget row="0" column="0" > | ||
253 | <class>OTimePicker</class> | ||
254 | <property stdset="1"> | ||
255 | <name>name</name> | ||
256 | <cstring>m_timePicker</cstring> | ||
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>sizePolicy</name> | ||
260 | <sizepolicy> | ||
261 | <hsizetype>3</hsizetype> | ||
262 | <vsizetype>3</vsizetype> | ||
263 | </sizepolicy> | ||
264 | </property> | ||
265 | </widget> | ||
266 | </grid> | 252 | </grid> |
267 | </widget> | 253 | </widget> |
268 | </vbox> | 254 | </vbox> |
269 | </widget> | 255 | </widget> |
270 | <customwidgets> | ||
271 | <customwidget> | ||
272 | <class>OTimePicker</class> | ||
273 | <header location="local">otimepicker.h</header> | ||
274 | <sizehint> | ||
275 | <width>-1</width> | ||
276 | <height>-1</height> | ||
277 | </sizehint> | ||
278 | <container>0</container> | ||
279 | <sizepolicy> | ||
280 | <hordata>7</hordata> | ||
281 | <verdata>1</verdata> | ||
282 | </sizepolicy> | ||
283 | <pixmap>image0</pixmap> | ||
284 | </customwidget> | ||
285 | </customwidgets> | ||
286 | <images> | ||
287 | <image> | ||
288 | <name>image0</name> | ||
289 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
290 | </image> | ||
291 | </images> | ||
292 | </UI> | 256 | </UI> |
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp index 78154b7..f6c6410 100644 --- a/libopie2/opieui/oversatileview.cpp +++ b/libopie2/opieui/oversatileview.cpp | |||
@@ -27,32 +27,35 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | 32 | ||
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | #include <opie2/oversatileview.h> | 34 | #include <opie2/oversatileview.h> |
35 | #include <opie2/oversatileviewitem.h> | 35 | #include <opie2/oversatileviewitem.h> |
36 | #include <opie2/olistview.h> | 36 | #include <opie2/olistview.h> |
37 | 37 | ||
38 | /* QT */ | 38 | /* QT */ |
39 | 39 | ||
40 | #include <qaction.h> | 40 | #include <qaction.h> |
41 | #include <qpopupmenu.h> | 41 | #include <qpopupmenu.h> |
42 | 42 | ||
43 | using namespace Opie::Core; | ||
44 | using namespace Opie::Ui; | ||
45 | |||
43 | /* XPM */ | 46 | /* XPM */ |
44 | static const char * view_icon_xpm[] = { | 47 | static const char * view_icon_xpm[] = { |
45 | "16 16 16 1", | 48 | "16 16 16 1", |
46 | " c None", | 49 | " c None", |
47 | ".c #87BD88", | 50 | ".c #87BD88", |
48 | "+c #8BBE8B", | 51 | "+c #8BBE8B", |
49 | "@c #81BA81", | 52 | "@c #81BA81", |
50 | "#c #6DAF6D", | 53 | "#c #6DAF6D", |
51 | "$c #87BD87", | 54 | "$c #87BD87", |
52 | "%c #FCFDFC", | 55 | "%c #FCFDFC", |
53 | "&c #AED0AE", | 56 | "&c #AED0AE", |
54 | "*c #4E9C4C", | 57 | "*c #4E9C4C", |
55 | "=c #91BD91", | 58 | "=c #91BD91", |
56 | "-c #72B172", | 59 | "-c #72B172", |
57 | ";c #448643", | 60 | ";c #448643", |
58 | ">c #519F50", | 61 | ">c #519F50", |
@@ -119,119 +122,119 @@ OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode ) | |||
119 | _treeleaf(), _treeopened(), _treeclosed(), | 122 | _treeleaf(), _treeopened(), _treeclosed(), |
120 | _iconleaf(), _iconopened(), _iconclosed() | 123 | _iconleaf(), _iconopened(), _iconclosed() |
121 | { | 124 | { |
122 | // | 125 | // |
123 | // Create child widgets and set some reasonable default styles | 126 | // Create child widgets and set some reasonable default styles |
124 | // | 127 | // |
125 | 128 | ||
126 | _listview = new OListView( this, "oversatileview embedded listview" ); | 129 | _listview = new OListView( this, "oversatileview embedded listview" ); |
127 | _iconview = new QIconView( this, "oversatileview embedded iconview" ); | 130 | _iconview = new QIconView( this, "oversatileview embedded iconview" ); |
128 | 131 | ||
129 | _listview->setAllColumnsShowFocus( true ); | 132 | _listview->setAllColumnsShowFocus( true ); |
130 | _listview->setRootIsDecorated( true ); | 133 | _listview->setRootIsDecorated( true ); |
131 | _listview->setShowSortIndicator( true ); | 134 | _listview->setShowSortIndicator( true ); |
132 | _iconview->setGridX( 90 ); | 135 | _iconview->setGridX( 90 ); |
133 | _iconview->setGridY( 42 ); | 136 | _iconview->setGridY( 42 ); |
134 | _iconview->setAutoArrange( true ); | 137 | _iconview->setAutoArrange( true ); |
135 | 138 | ||
136 | #ifdef QWS // TODO: Let this depend on current geometry (rotation) | 139 | #ifdef QWS // TODO: Let this depend on current geometry (rotation) |
137 | _iconview->setArrangement( QIconView::TopToBottom ); | 140 | _iconview->setArrangement( QIconView::TopToBottom ); |
138 | #else | 141 | #else |
139 | _iconview->setArrangement( QIconView::LeftToRight ); | 142 | _iconview->setArrangement( QIconView::LeftToRight ); |
140 | #endif | 143 | #endif |
141 | 144 | ||
142 | _iconview->setResizeMode( QIconView::Adjust ); | 145 | _iconview->setResizeMode( QIconView::Adjust ); |
143 | 146 | ||
144 | // qt-embedded: map stylus right on hold to right button press | 147 | // qt-embedded: map stylus right on hold to right button press |
145 | 148 | ||
146 | #ifdef QWS | 149 | #ifdef QWS |
147 | ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); | 150 | ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); |
148 | ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); | 151 | ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); |
149 | #endif | 152 | #endif |
150 | 153 | ||
151 | setViewMode( mode ); // TODO: Read last style from config | 154 | setViewMode( mode ); // TODO: Read last style from config |
152 | // setSynchronization( true ); // TODO: Implement this | 155 | // setSynchronization( true ); // TODO: Implement this |
153 | 156 | ||
154 | // create context menu allowing to switch between the views | 157 | // create context menu allowing to switch between the views |
155 | 158 | ||
156 | _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); | 159 | _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); |
157 | _contextmenu->setCaption( "Style" ); | 160 | _contextmenu->setCaption( "Style" ); |
158 | _contextmenu->setCheckable( true ); | 161 | _contextmenu->setCheckable( true ); |
159 | QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); | 162 | QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); |
160 | QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), | 163 | QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), |
161 | "View Icons", 0, ag, "viewicon action", true ); | 164 | "View Icons", 0, ag, "viewicon action", true ); |
162 | QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), | 165 | QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), |
163 | "View Tree", 0, ag, "viewtree action", true ); | 166 | "View Tree", 0, ag, "viewtree action", true ); |
164 | ag->addTo( _contextmenu ); | 167 | ag->addTo( _contextmenu ); |
165 | if ( mode == Icons ) | 168 | if ( mode == Icons ) |
166 | a1->setOn( true ); | 169 | a1->setOn( true ); |
167 | else if ( mode == Tree ) | 170 | else if ( mode == Tree ) |
168 | a2->setOn( true ); | 171 | a2->setOn( true ); |
169 | connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); | 172 | connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); |
170 | connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); | 173 | connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); |
171 | 174 | ||
172 | #if (QT_VERSION >= 0x030000) | 175 | #if (QT_VERSION >= 0x030000) |
173 | connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 176 | connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
174 | connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); | 177 | connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); |
175 | #else | 178 | #else |
176 | connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 179 | connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
177 | connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); | 180 | connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); |
178 | #endif | 181 | #endif |
179 | 182 | ||
180 | // | 183 | // |
181 | // signal forwarders | 184 | // signal forwarders |
182 | // | 185 | // |
183 | // unfortunately we can't short-circuit all the QListView and QIconView signals | 186 | // unfortunately we can't short-circuit all the QListView and QIconView signals |
184 | // to OVersatileView signals, because the signal/slot mechanism doesn't allow | 187 | // to OVersatileView signals, because the signal/slot mechanism doesn't allow |
185 | // type-conversion :-( | 188 | // type-conversion :-( |
186 | 189 | ||
187 | // common signals for listview | 190 | // common signals for listview |
188 | 191 | ||
189 | connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); | 192 | connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); |
190 | connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) ); | 193 | connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) ); |
191 | connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) ); | 194 | connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) ); |
192 | connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) ); | 195 | connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) ); |
193 | connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) ); | 196 | connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) ); |
194 | 197 | ||
195 | connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) ); | 198 | connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) ); |
196 | connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) ); | 199 | connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) ); |
197 | 200 | ||
198 | connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) ); | 201 | connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) ); |
199 | connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); | 202 | connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); |
200 | 203 | ||
201 | // common signals for iconview | 204 | // common signals for iconview |
202 | 205 | ||
203 | connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); | 206 | connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); |
204 | connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) ); | 207 | connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) ); |
205 | connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) ); | 208 | connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) ); |
206 | connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) ); | 209 | connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) ); |
207 | connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) ); | 210 | connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) ); |
208 | 211 | ||
209 | connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) ); | 212 | connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) ); |
210 | connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) ); | 213 | connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) ); |
211 | 214 | ||
212 | connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) ); | 215 | connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) ); |
213 | connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); | 216 | connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); |
214 | 217 | ||
215 | // listview only signals | 218 | // listview only signals |
216 | 219 | ||
217 | connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) ); | 220 | connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) ); |
218 | connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) ); | 221 | connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) ); |
219 | 222 | ||
220 | // iconview only signals | 223 | // iconview only signals |
221 | 224 | ||
222 | connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); | 225 | connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); |
223 | } | 226 | } |
224 | 227 | ||
225 | OVersatileView::~OVersatileView() | 228 | OVersatileView::~OVersatileView() |
226 | { | 229 | { |
227 | } | 230 | } |
228 | 231 | ||
229 | QPopupMenu* OVersatileView::contextMenu() const | 232 | QPopupMenu* OVersatileView::contextMenu() const |
230 | { | 233 | { |
231 | return _contextmenu; | 234 | return _contextmenu; |
232 | } | 235 | } |
233 | 236 | ||
234 | void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) | 237 | void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) |
235 | { | 238 | { |
236 | // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, | 239 | // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, |
237 | // do not inherit from QObject - assuming here the programmer is | 240 | // do not inherit from QObject - assuming here the programmer is |
@@ -407,66 +410,66 @@ void OVersatileView::pressed( QIconViewItem * item ) | |||
407 | } | 410 | } |
408 | 411 | ||
409 | void OVersatileView::doubleClicked( QListViewItem * item ) | 412 | void OVersatileView::doubleClicked( QListViewItem * item ) |
410 | { | 413 | { |
411 | emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); | 414 | emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); |
412 | } | 415 | } |
413 | 416 | ||
414 | void OVersatileView::doubleClicked( QIconViewItem * item ) | 417 | void OVersatileView::doubleClicked( QIconViewItem * item ) |
415 | { | 418 | { |
416 | emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); | 419 | emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); |
417 | } | 420 | } |
418 | 421 | ||
419 | void OVersatileView::returnPressed( QListViewItem * item ) | 422 | void OVersatileView::returnPressed( QListViewItem * item ) |
420 | { | 423 | { |
421 | emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); | 424 | emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); |
422 | } | 425 | } |
423 | 426 | ||
424 | void OVersatileView::returnPressed( QIconViewItem * item ) | 427 | void OVersatileView::returnPressed( QIconViewItem * item ) |
425 | { | 428 | { |
426 | emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); | 429 | emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); |
427 | } | 430 | } |
428 | 431 | ||
429 | void OVersatileView::onItem( QListViewItem * item ) | 432 | void OVersatileView::onItem( QListViewItem * item ) |
430 | { | 433 | { |
431 | emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); | 434 | emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); |
432 | } | 435 | } |
433 | 436 | ||
434 | void OVersatileView::onItem( QIconViewItem * item ) | 437 | void OVersatileView::onItem( QIconViewItem * item ) |
435 | { | 438 | { |
436 | emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); | 439 | emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); |
437 | } | 440 | } |
438 | 441 | ||
439 | void OVersatileView::expanded( QListViewItem *item ) // QListView | 442 | void OVersatileView::expanded( QListViewItem *item ) // QListView |
440 | { | 443 | { |
441 | //odebug << "OVersatileView::expanded(): opening tree..." << oendl; | 444 | //odebug << "OVersatileView::expanded(): opening tree..." << oendl; |
442 | if ( !_treeopened.isNull() ) | 445 | if ( !_treeopened.isNull() ) |
443 | item->setPixmap( 0, _treeopened ); | 446 | item->setPixmap( 0, _treeopened ); |
444 | emit( expanded( static_cast<OVersatileViewItem*>( item ) ) ); | 447 | emit( expanded( static_cast<OVersatileViewItem*>( item ) ) ); |
445 | } | 448 | } |
446 | void OVersatileView::collapsed( QListViewItem *item ) // QListView | 449 | void OVersatileView::collapsed( QListViewItem *item ) // QListView |
447 | { | 450 | { |
448 | if ( !_treeclosed.isNull() ) | 451 | if ( !_treeclosed.isNull() ) |
449 | item->setPixmap( 0, _treeclosed ); | 452 | item->setPixmap( 0, _treeclosed ); |
450 | emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) ); | 453 | emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) ); |
451 | } | 454 | } |
452 | 455 | ||
453 | //=============================================================================================// | 456 | //=============================================================================================// |
454 | // OVersatileView Case I - API only existing in QListView or QIconView but not in both! | 457 | // OVersatileView Case I - API only existing in QListView or QIconView but not in both! |
455 | //==============================================================================================// | 458 | //==============================================================================================// |
456 | 459 | ||
457 | int OVersatileView::treeStepSize() const // QListView | 460 | int OVersatileView::treeStepSize() const // QListView |
458 | { | 461 | { |
459 | if ( !isValidViewMode( Tree ) ) | 462 | if ( !isValidViewMode( Tree ) ) |
460 | { | 463 | { |
461 | return -1; | 464 | return -1; |
462 | } | 465 | } |
463 | return _listview->treeStepSize(); | 466 | return _listview->treeStepSize(); |
464 | } | 467 | } |
465 | void OVersatileView::setTreeStepSize( int size ) // QListView | 468 | void OVersatileView::setTreeStepSize( int size ) // QListView |
466 | { | 469 | { |
467 | if ( !isValidViewMode( Tree ) ) | 470 | if ( !isValidViewMode( Tree ) ) |
468 | { | 471 | { |
469 | return; | 472 | return; |
470 | } | 473 | } |
471 | _listview->setTreeStepSize( size ); | 474 | _listview->setTreeStepSize( size ); |
472 | } | 475 | } |
@@ -732,33 +735,33 @@ bool OVersatileView::showSortIndicator() const // QListView | |||
732 | } | 735 | } |
733 | return _listview->showSortIndicator(); | 736 | return _listview->showSortIndicator(); |
734 | } | 737 | } |
735 | 738 | ||
736 | void OVersatileView::triggerUpdate() // QListView | 739 | void OVersatileView::triggerUpdate() // QListView |
737 | { | 740 | { |
738 | if ( !isValidViewMode( Tree ) ) | 741 | if ( !isValidViewMode( Tree ) ) |
739 | { | 742 | { |
740 | return; | 743 | return; |
741 | } | 744 | } |
742 | _listview->triggerUpdate(); | 745 | _listview->triggerUpdate(); |
743 | } | 746 | } |
744 | 747 | ||
745 | // | 748 | // |
746 | // only in QIconView | 749 | // only in QIconView |
747 | // | 750 | // |
748 | 751 | ||
749 | uint OVersatileView::count() const // QIconView | 752 | uint OVersatileView::count() const // QIconView |
750 | { | 753 | { |
751 | if ( !isValidViewMode( Icons ) ) | 754 | if ( !isValidViewMode( Icons ) ) |
752 | { | 755 | { |
753 | return 0; | 756 | return 0; |
754 | } | 757 | } |
755 | return _iconview->count(); | 758 | return _iconview->count(); |
756 | } | 759 | } |
757 | 760 | ||
758 | int OVersatileView::index( const OVersatileViewItem *item ) const // QIconView | 761 | int OVersatileView::index( const OVersatileViewItem *item ) const // QIconView |
759 | { | 762 | { |
760 | if ( !isValidViewMode( Icons ) ) | 763 | if ( !isValidViewMode( Icons ) ) |
761 | { | 764 | { |
762 | return -1; | 765 | return -1; |
763 | } | 766 | } |
764 | return _iconview->index( item ); | 767 | return _iconview->index( item ); |
diff --git a/libopie2/opieui/oversatileview.h b/libopie2/opieui/oversatileview.h index 8af21dc..61b61db 100644 --- a/libopie2/opieui/oversatileview.h +++ b/libopie2/opieui/oversatileview.h | |||
@@ -32,165 +32,168 @@ | |||
32 | #define OVERSATILEVIEW_H | 32 | #define OVERSATILEVIEW_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | 35 | ||
36 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
37 | #include <qiconview.h> | 37 | #include <qiconview.h> |
38 | 38 | ||
39 | /* OPIE */ | 39 | /* OPIE */ |
40 | 40 | ||
41 | #include <opie2/oapplication.h> | 41 | #include <opie2/oapplication.h> |
42 | 42 | ||
43 | /* FORWARDS */ | 43 | /* FORWARDS */ |
44 | 44 | ||
45 | class QHeader; | 45 | class QHeader; |
46 | class QIconSet; | 46 | class QIconSet; |
47 | class QIconViewItem; | 47 | class QIconViewItem; |
48 | class OListView; | ||
49 | class QListViewItem; | 48 | class QListViewItem; |
50 | class QPopupMenu; | 49 | class QPopupMenu; |
51 | class QString; | 50 | class QString; |
52 | 51 | ||
53 | #ifndef QT_NO_DRAGANDDROP | 52 | #ifndef QT_NO_DRAGANDDROP |
54 | class QIconDragItem; | 53 | class QIconDragItem; |
55 | #endif | 54 | #endif |
56 | 55 | ||
56 | namespace Opie { | ||
57 | namespace Ui { | ||
58 | class OListView; | ||
59 | |||
57 | class OVersatileView : public QWidgetStack | 60 | class OVersatileView : public QWidgetStack |
58 | { | 61 | { |
59 | Q_OBJECT | 62 | Q_OBJECT |
60 | 63 | ||
61 | friend class OVersatileViewItem; | 64 | friend class OVersatileViewItem; |
62 | 65 | ||
63 | //==============================================================================================// | 66 | //==============================================================================================// |
64 | // OVersatileView High Level API | 67 | // OVersatileView High Level API |
65 | //==============================================================================================// | 68 | //==============================================================================================// |
66 | 69 | ||
67 | public: | 70 | public: |
68 | OVersatileView( QWidget* parent = 0, const char* name = 0, int mode = 0 ); | 71 | OVersatileView( QWidget* parent = 0, const char* name = 0, int mode = 0 ); |
69 | ~OVersatileView(); | 72 | ~OVersatileView(); |
70 | 73 | ||
71 | QPopupMenu* contextMenu() const; | 74 | QPopupMenu* contextMenu() const; |
72 | 75 | ||
73 | void setSynchronization( bool sync ); | 76 | void setSynchronization( bool sync ); |
74 | bool synchronization(); | 77 | bool synchronization(); |
75 | 78 | ||
76 | enum ViewMode { Tree = 0, Icons }; | 79 | enum ViewMode { Tree = 0, Icons }; |
77 | int viewMode(); | 80 | int viewMode(); |
78 | 81 | ||
79 | QIconView* iconView() const; | 82 | QIconView* iconView() const; |
80 | OListView* listView() const; | 83 | OListView* listView() const; |
81 | 84 | ||
82 | enum WarningPolicy { None = 0, Warn, WarnReturn }; | 85 | enum WarningPolicy { None = 0, Warn, WarnReturn }; |
83 | 86 | ||
84 | void setWarningPolicy( int ) const; // warn, if calling a method which doesn't apply to the current viewmode | 87 | void setWarningPolicy( int ) const; // warn, if calling a method which doesn't apply to the current viewmode |
85 | bool warningPolicy() const; | 88 | bool warningPolicy() const; |
86 | 89 | ||
87 | void setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ); | 90 | void setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ); |
88 | 91 | ||
89 | public slots: | 92 | public slots: |
90 | void setViewMode( int mode ); | 93 | void setViewMode( int mode ); |
91 | void setIconViewMode(); | 94 | void setIconViewMode(); |
92 | void setTreeViewMode(); | 95 | void setTreeViewMode(); |
93 | 96 | ||
94 | protected: | 97 | protected: |
95 | virtual bool isValidViewMode( int mode ) const; | 98 | virtual bool isValidViewMode( int mode ) const; |
96 | virtual void popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col = 0 ); | 99 | virtual void popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col = 0 ); |
97 | 100 | ||
98 | private: | 101 | private: |
99 | int _viewmode; | 102 | int _viewmode; |
100 | bool _synchronization; | 103 | bool _synchronization; |
101 | mutable int _warningpolicy; | 104 | mutable int _warningpolicy; |
102 | 105 | ||
103 | OListView* _listview; | 106 | OListView* _listview; |
104 | QIconView* _iconview; | 107 | QIconView* _iconview; |
105 | 108 | ||
106 | QPixmap _treeleaf; | 109 | QPixmap _treeleaf; |
107 | QPixmap _treeopened; | 110 | QPixmap _treeopened; |
108 | QPixmap _treeclosed; | 111 | QPixmap _treeclosed; |
109 | 112 | ||
110 | QPixmap _iconleaf; | 113 | QPixmap _iconleaf; |
111 | QPixmap _iconopened; | 114 | QPixmap _iconopened; |
112 | QPixmap _iconclosed; | 115 | QPixmap _iconclosed; |
113 | 116 | ||
114 | QPopupMenu* _contextmenu; | 117 | QPopupMenu* _contextmenu; |
115 | 118 | ||
116 | int _iconstyle; | 119 | int _iconstyle; |
117 | int _treestyle; | 120 | int _treestyle; |
118 | 121 | ||
119 | private slots: | 122 | private slots: |
120 | 123 | ||
121 | void contextMenuRequested( QListViewItem*, const QPoint&, int ); | 124 | void contextMenuRequested( QListViewItem*, const QPoint&, int ); |
122 | void contextMenuRequested( QIconViewItem*, const QPoint& ); | 125 | void contextMenuRequested( QIconViewItem*, const QPoint& ); |
123 | 126 | ||
124 | // type converting signal forwarders | 127 | // type converting signal forwarders |
125 | 128 | ||
126 | void selectionChanged( QListViewItem * ); | 129 | void selectionChanged( QListViewItem * ); |
127 | void currentChanged( QListViewItem * ); | 130 | void currentChanged( QListViewItem * ); |
128 | void clicked( QListViewItem * ); | 131 | void clicked( QListViewItem * ); |
129 | void pressed( QListViewItem * ); | 132 | void pressed( QListViewItem * ); |
130 | void doubleClicked( QListViewItem * ); | 133 | void doubleClicked( QListViewItem * ); |
131 | void returnPressed( QListViewItem * ); | 134 | void returnPressed( QListViewItem * ); |
132 | void onItem( QListViewItem * ); | 135 | void onItem( QListViewItem * ); |
133 | 136 | ||
134 | void selectionChanged( QIconViewItem * ); | 137 | void selectionChanged( QIconViewItem * ); |
135 | void currentChanged( QIconViewItem * ); | 138 | void currentChanged( QIconViewItem * ); |
136 | void clicked( QIconViewItem * ); | 139 | void clicked( QIconViewItem * ); |
137 | void pressed( QIconViewItem * ); | 140 | void pressed( QIconViewItem * ); |
138 | void doubleClicked( QIconViewItem * ); | 141 | void doubleClicked( QIconViewItem * ); |
139 | void returnPressed( QIconViewItem * ); | 142 | void returnPressed( QIconViewItem * ); |
140 | void onItem( QIconViewItem * ); | 143 | void onItem( QIconViewItem * ); |
141 | 144 | ||
142 | void expanded( QListViewItem * item ); // QListView | 145 | void expanded( QListViewItem * item ); // QListView |
143 | void collapsed( QListViewItem * item ); // QListView | 146 | void collapsed( QListViewItem * item ); // QListView |
144 | 147 | ||
145 | signals: | 148 | signals: |
146 | 149 | ||
147 | void contextMenuRequested( OVersatileViewItem * item, const QPoint& pos, int col ); | 150 | void contextMenuRequested( OVersatileViewItem * item, const QPoint& pos, int col ); |
148 | 151 | ||
149 | /*#ifndef QT_NO_DRAGANDDROP | 152 | /*#ifndef QT_NO_DRAGANDDROP |
150 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView | 153 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView |
151 | #endif | 154 | #endif |
152 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView | 155 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView |
153 | void itemRenamed( OVersatileViewItem *item ); // QIconView | 156 | void itemRenamed( OVersatileViewItem *item ); // QIconView |
154 | */ | 157 | */ |
155 | 158 | ||
156 | //==============================================================================================// | 159 | //==============================================================================================// |
157 | // "Derived" API - Case 1: Methods existing either only in QListView or only in QIconView | 160 | // "Derived" API - Case 1: Methods existing either only in QListView or only in QIconView |
158 | //==============================================================================================// | 161 | //==============================================================================================// |
159 | 162 | ||
160 | public: | 163 | public: |
161 | 164 | ||
162 | /* | 165 | /* |
163 | enum Arrangement { // QIconView | 166 | enum Arrangement { // QIconView |
164 | LeftToRight = 0, | 167 | LeftToRight = 0, |
165 | TopToBottom | 168 | TopToBottom |
166 | }; | 169 | }; |
167 | enum ResizeMode { // QIconView | 170 | enum ResizeMode { // QIconView |
168 | Fixed = 0, | 171 | Fixed = 0, |
169 | Adjust | 172 | Adjust |
170 | }; | 173 | }; |
171 | enum ItemTextPos { // QIconView | 174 | enum ItemTextPos { // QIconView |
172 | Bottom = 0, | 175 | Bottom = 0, |
173 | Right | 176 | Right |
174 | }; | 177 | }; |
175 | */ | 178 | */ |
176 | 179 | ||
177 | // | 180 | // |
178 | // only in QListView | 181 | // only in QListView |
179 | // | 182 | // |
180 | 183 | ||
181 | int treeStepSize() const; // QListView | 184 | int treeStepSize() const; // QListView |
182 | virtual void setTreeStepSize( int ); // QListView | 185 | virtual void setTreeStepSize( int ); // QListView |
183 | 186 | ||
184 | QHeader * header() const; // QListView | 187 | QHeader * header() const; // QListView |
185 | 188 | ||
186 | virtual int addColumn( const QString &label, int size = -1); // QListView | 189 | virtual int addColumn( const QString &label, int size = -1); // QListView |
187 | virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1); // QListView | 190 | virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1); // QListView |
188 | void removeColumn( int index ); // #### make virtual in next major release! // QListView | 191 | void removeColumn( int index ); // #### make virtual in next major release! // QListView |
189 | virtual void setColumnText( int column, const QString &label ); // QListView | 192 | virtual void setColumnText( int column, const QString &label ); // QListView |
190 | virtual void setColumnText( int column, const QIconSet& iconset, const QString &label ); // QListView | 193 | virtual void setColumnText( int column, const QIconSet& iconset, const QString &label ); // QListView |
191 | QString columnText( int column ) const; // QListView | 194 | QString columnText( int column ) const; // QListView |
192 | virtual void setColumnWidth( int column, int width ); // QListView | 195 | virtual void setColumnWidth( int column, int width ); // QListView |
193 | int columnWidth( int column ) const; // QListView | 196 | int columnWidth( int column ) const; // QListView |
194 | enum WidthMode { Manual, Maximum }; // QListView | 197 | enum WidthMode { Manual, Maximum }; // QListView |
195 | virtual void setColumnWidthMode( int column, WidthMode ); // QListView | 198 | virtual void setColumnWidthMode( int column, WidthMode ); // QListView |
196 | WidthMode columnWidthMode( int column ) const; // QListView | 199 | WidthMode columnWidthMode( int column ) const; // QListView |
@@ -213,49 +216,49 @@ public: | |||
213 | bool isOpen( const OVersatileViewItem * ) const; // QListView | 216 | bool isOpen( const OVersatileViewItem * ) const; // QListView |
214 | 217 | ||
215 | OVersatileViewItem * firstChild() const; // QListView | 218 | OVersatileViewItem * firstChild() const; // QListView |
216 | int childCount() const; // QListView | 219 | int childCount() const; // QListView |
217 | 220 | ||
218 | virtual void setAllColumnsShowFocus( bool ); // QListView | 221 | virtual void setAllColumnsShowFocus( bool ); // QListView |
219 | bool allColumnsShowFocus() const; // QListView | 222 | bool allColumnsShowFocus() const; // QListView |
220 | 223 | ||
221 | virtual void setItemMargin( int ); // QListView | 224 | virtual void setItemMargin( int ); // QListView |
222 | int itemMargin() const; // QListView | 225 | int itemMargin() const; // QListView |
223 | 226 | ||
224 | virtual void setRootIsDecorated( bool ); // QListView | 227 | virtual void setRootIsDecorated( bool ); // QListView |
225 | bool rootIsDecorated() const; // QListView | 228 | bool rootIsDecorated() const; // QListView |
226 | 229 | ||
227 | void setShowSortIndicator( bool show ); // QListView | 230 | void setShowSortIndicator( bool show ); // QListView |
228 | bool showSortIndicator() const; // QListView | 231 | bool showSortIndicator() const; // QListView |
229 | 232 | ||
230 | int index( const OVersatileViewItem *item ) const; // QIconView | 233 | int index( const OVersatileViewItem *item ) const; // QIconView |
231 | 234 | ||
232 | public slots: | 235 | public slots: |
233 | void triggerUpdate(); // QListView | 236 | void triggerUpdate(); // QListView |
234 | 237 | ||
235 | signals: | 238 | signals: |
236 | void expanded( OVersatileViewItem *item ); // QListView | 239 | void expanded( OVersatileViewItem *item ); // QListView |
237 | void collapsed( OVersatileViewItem *item ); // QListView | 240 | void collapsed( OVersatileViewItem *item ); // QListView |
238 | 241 | ||
239 | // | 242 | // |
240 | // only in QIconView | 243 | // only in QIconView |
241 | // | 244 | // |
242 | 245 | ||
243 | public: | 246 | public: |
244 | uint count() const; // QIconView | 247 | uint count() const; // QIconView |
245 | 248 | ||
246 | OVersatileViewItem *firstItem() const; // QIconView | 249 | OVersatileViewItem *firstItem() const; // QIconView |
247 | OVersatileViewItem *lastItem() const; // QIconView | 250 | OVersatileViewItem *lastItem() const; // QIconView |
248 | 251 | ||
249 | OVersatileViewItem *findItem( const QPoint &pos ) const; // QIconView | 252 | OVersatileViewItem *findItem( const QPoint &pos ) const; // QIconView |
250 | OVersatileViewItem *findItem( const QString &text ) const; // QIconView | 253 | OVersatileViewItem *findItem( const QString &text ) const; // QIconView |
251 | 254 | ||
252 | OVersatileViewItem* findFirstVisibleItem( const QRect &r ) const; // QIconView | 255 | OVersatileViewItem* findFirstVisibleItem( const QRect &r ) const; // QIconView |
253 | OVersatileViewItem* findLastVisibleItem( const QRect &r ) const; // QIconView | 256 | OVersatileViewItem* findLastVisibleItem( const QRect &r ) const; // QIconView |
254 | 257 | ||
255 | virtual void setGridX( int rx ); // QIconView | 258 | virtual void setGridX( int rx ); // QIconView |
256 | virtual void setGridY( int ry ); // QIconView | 259 | virtual void setGridY( int ry ); // QIconView |
257 | int gridX() const; // QIconView | 260 | int gridX() const; // QIconView |
258 | int gridY() const; // QIconView | 261 | int gridY() const; // QIconView |
259 | virtual void setSpacing( int sp ); // QIconView | 262 | virtual void setSpacing( int sp ); // QIconView |
260 | int spacing() const; // QIconView | 263 | int spacing() const; // QIconView |
261 | virtual void setItemTextPos( QIconView::ItemTextPos pos ); // QIconView | 264 | virtual void setItemTextPos( QIconView::ItemTextPos pos ); // QIconView |
@@ -274,33 +277,33 @@ public: | |||
274 | bool autoArrange() const; // QIconView | 277 | bool autoArrange() const; // QIconView |
275 | virtual void setShowToolTips( bool b ); // QIconView | 278 | virtual void setShowToolTips( bool b ); // QIconView |
276 | bool showToolTips() const; // QIconView | 279 | bool showToolTips() const; // QIconView |
277 | 280 | ||
278 | bool sorting() const; // QIconView | 281 | bool sorting() const; // QIconView |
279 | bool sortDirection() const; // QIconView | 282 | bool sortDirection() const; // QIconView |
280 | 283 | ||
281 | virtual void setItemsMovable( bool b ); // QIconView | 284 | virtual void setItemsMovable( bool b ); // QIconView |
282 | bool itemsMovable() const; // QIconView | 285 | bool itemsMovable() const; // QIconView |
283 | virtual void setWordWrapIconText( bool b ); // QIconView | 286 | virtual void setWordWrapIconText( bool b ); // QIconView |
284 | bool wordWrapIconText() const; // QIconView | 287 | bool wordWrapIconText() const; // QIconView |
285 | 288 | ||
286 | public slots: | 289 | public slots: |
287 | virtual void arrangeItemsInGrid( const QSize &grid, bool update = TRUE ); // QIconView | 290 | virtual void arrangeItemsInGrid( const QSize &grid, bool update = TRUE ); // QIconView |
288 | virtual void arrangeItemsInGrid( bool update = TRUE ); // QIconView | 291 | virtual void arrangeItemsInGrid( bool update = TRUE ); // QIconView |
289 | virtual void updateContents(); // QIconView | 292 | virtual void updateContents(); // QIconView |
290 | 293 | ||
291 | signals: | 294 | signals: |
292 | /*#ifndef QT_NO_DRAGANDDROP | 295 | /*#ifndef QT_NO_DRAGANDDROP |
293 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView | 296 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView |
294 | #endif | 297 | #endif |
295 | */ | 298 | */ |
296 | void moved(); // QIconView | 299 | void moved(); // QIconView |
297 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView | 300 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView |
298 | void itemRenamed( OVersatileViewItem *item ); // QIconView | 301 | void itemRenamed( OVersatileViewItem *item ); // QIconView |
299 | 302 | ||
300 | //==============================================================================================// | 303 | //==============================================================================================// |
301 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with the same signatures | 304 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with the same signatures |
302 | //==============================================================================================// | 305 | //==============================================================================================// |
303 | 306 | ||
304 | public: | 307 | public: |
305 | enum SelectionMode { | 308 | enum SelectionMode { |
306 | Single = 0, | 309 | Single = 0, |
@@ -309,86 +312,88 @@ public: | |||
309 | NoSelection | 312 | NoSelection |
310 | }; | 313 | }; |
311 | 314 | ||
312 | virtual void clear(); | 315 | virtual void clear(); |
313 | 316 | ||
314 | virtual void setFont( const QFont & ); | 317 | virtual void setFont( const QFont & ); |
315 | virtual void setPalette( const QPalette & ); | 318 | virtual void setPalette( const QPalette & ); |
316 | 319 | ||
317 | virtual void takeItem( OVersatileViewItem * ); | 320 | virtual void takeItem( OVersatileViewItem * ); |
318 | 321 | ||
319 | void setSelectionMode( SelectionMode mode ); | 322 | void setSelectionMode( SelectionMode mode ); |
320 | SelectionMode selectionMode() const; | 323 | SelectionMode selectionMode() const; |
321 | 324 | ||
322 | virtual void selectAll( bool select ); | 325 | virtual void selectAll( bool select ); |
323 | virtual void clearSelection(); | 326 | virtual void clearSelection(); |
324 | virtual void invertSelection(); | 327 | virtual void invertSelection(); |
325 | 328 | ||
326 | void ensureItemVisible( const OVersatileViewItem * ); | 329 | void ensureItemVisible( const OVersatileViewItem * ); |
327 | virtual void repaintItem( const OVersatileViewItem * ) const; | 330 | virtual void repaintItem( const OVersatileViewItem * ) const; |
328 | 331 | ||
329 | virtual void setCurrentItem( OVersatileViewItem * ); | 332 | virtual void setCurrentItem( OVersatileViewItem * ); |
330 | OVersatileViewItem * currentItem() const; | 333 | OVersatileViewItem * currentItem() const; |
331 | 334 | ||
332 | // bool eventFilter( QObject * o, QEvent * ); // use QWidgetStack implementation | 335 | // bool eventFilter( QObject * o, QEvent * ); // use QWidgetStack implementation |
333 | 336 | ||
334 | // QSize minimumSizeHint() const; // use QWidgetStack implementation | 337 | // QSize minimumSizeHint() const; // use QWidgetStack implementation |
335 | // QSizePolicy sizePolicy() const; // use QWidgetStack implementation | 338 | // QSizePolicy sizePolicy() const; // use QWidgetStack implementation |
336 | // QSize sizeHint() const; // use QWidgetStack implementation | 339 | // QSize sizeHint() const; // use QWidgetStack implementation |
337 | 340 | ||
338 | signals: | 341 | signals: |
339 | void selectionChanged(); | 342 | void selectionChanged(); |
340 | void selectionChanged( OVersatileViewItem * ); | 343 | void selectionChanged( OVersatileViewItem * ); |
341 | void currentChanged( OVersatileViewItem * ); | 344 | void currentChanged( OVersatileViewItem * ); |
342 | void clicked( OVersatileViewItem * ); | 345 | void clicked( OVersatileViewItem * ); |
343 | void pressed( OVersatileViewItem * ); | 346 | void pressed( OVersatileViewItem * ); |
344 | 347 | ||
345 | void doubleClicked( OVersatileViewItem * ); | 348 | void doubleClicked( OVersatileViewItem * ); |
346 | void returnPressed( OVersatileViewItem * ); | 349 | void returnPressed( OVersatileViewItem * ); |
347 | 350 | ||
348 | void onItem( OVersatileViewItem * ); | 351 | void onItem( OVersatileViewItem * ); |
349 | void onViewport(); | 352 | void onViewport(); |
350 | 353 | ||
351 | //==============================================================================================// | 354 | //==============================================================================================// |
352 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with differing signatures | 355 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with differing signatures |
353 | //==============================================================================================// | 356 | //==============================================================================================// |
354 | 357 | ||
355 | /* | 358 | /* |
356 | 359 | ||
357 | public: | 360 | public: |
358 | virtual void insertItem( OVersatileViewItem * ); // QListView | 361 | virtual void insertItem( OVersatileViewItem * ); // QListView |
359 | virtual void insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ); // QIconView | 362 | virtual void insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ); // QIconView |
360 | 363 | ||
361 | virtual void setSelected( OVersatileViewItem *, bool ); // QListView | 364 | virtual void setSelected( OVersatileViewItem *, bool ); // QListView |
362 | virtual void setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ); // QIconView | 365 | virtual void setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ); // QIconView |
363 | 366 | ||
364 | virtual void setSorting( int column, bool increasing = TRUE ); // QListView | 367 | virtual void setSorting( int column, bool increasing = TRUE ); // QListView |
365 | void setSorting( bool sort, bool ascending = TRUE ); // QIconView | 368 | void setSorting( bool sort, bool ascending = TRUE ); // QIconView |
366 | 369 | ||
367 | void sort(); // #### make virtual in next major release // QListView | 370 | void sort(); // #### make virtual in next major release // QListView |
368 | virtual void sort( bool ascending = TRUE ); // QIconView | 371 | virtual void sort( bool ascending = TRUE ); // QIconView |
369 | 372 | ||
370 | */ | 373 | */ |
371 | 374 | ||
372 | signals: | 375 | signals: |
373 | void clicked( OVersatileViewItem *, const QPoint &, int ); // QListView | 376 | void clicked( OVersatileViewItem *, const QPoint &, int ); // QListView |
374 | void clicked( OVersatileViewItem *, const QPoint & ); // QIconView | 377 | void clicked( OVersatileViewItem *, const QPoint & ); // QIconView |
375 | 378 | ||
376 | void pressed( OVersatileViewItem *, const QPoint &, int ); // QListView | 379 | void pressed( OVersatileViewItem *, const QPoint &, int ); // QListView |
377 | void pressed( OVersatileViewItem *, const QPoint & ); // QIconView | 380 | void pressed( OVersatileViewItem *, const QPoint & ); // QIconView |
378 | 381 | ||
379 | void rightButtonClicked( OVersatileViewItem* item, const QPoint& pos ); // QIconView | 382 | void rightButtonClicked( OVersatileViewItem* item, const QPoint& pos ); // QIconView |
380 | void rightButtonClicked( OVersatileViewItem *, const QPoint&, int ); // QListView | 383 | void rightButtonClicked( OVersatileViewItem *, const QPoint&, int ); // QListView |
381 | 384 | ||
382 | void rightButtonPressed( OVersatileViewItem* item, const QPoint& pos ); // QIconView | 385 | void rightButtonPressed( OVersatileViewItem* item, const QPoint& pos ); // QIconView |
383 | void rightButtonPressed( OVersatileViewItem *, const QPoint&, int ); // QListView | 386 | void rightButtonPressed( OVersatileViewItem *, const QPoint&, int ); // QListView |
384 | 387 | ||
385 | void mouseButtonPressed( int, OVersatileViewItem *, const QPoint& , int ); // QListView | 388 | void mouseButtonPressed( int, OVersatileViewItem *, const QPoint& , int ); // QListView |
386 | void mouseButtonPressed( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView | 389 | void mouseButtonPressed( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView |
387 | 390 | ||
388 | void mouseButtonClicked( int, OVersatileViewItem *, const QPoint&, int ); // QListView | 391 | void mouseButtonClicked( int, OVersatileViewItem *, const QPoint&, int ); // QListView |
389 | void mouseButtonClicked( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView | 392 | void mouseButtonClicked( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView |
390 | 393 | ||
391 | }; | 394 | }; |
392 | 395 | ||
396 | } | ||
397 | } | ||
393 | #endif | 398 | #endif |
394 | 399 | ||
diff --git a/libopie2/opieui/oversatileviewitem.cpp b/libopie2/opieui/oversatileviewitem.cpp index 66de8eb..03c6738 100644 --- a/libopie2/opieui/oversatileviewitem.cpp +++ b/libopie2/opieui/oversatileviewitem.cpp | |||
@@ -18,32 +18,34 @@ | |||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/oversatileviewitem.h> | 31 | #include <opie2/oversatileviewitem.h> |
32 | #include <opie2/oversatileview.h> | 32 | #include <opie2/oversatileview.h> |
33 | 33 | ||
34 | using namespace Opie::Ui; | ||
35 | |||
34 | OVersatileViewItem::OVersatileViewItem( OVersatileView * parent ) | 36 | OVersatileViewItem::OVersatileViewItem( OVersatileView * parent ) |
35 | :OListViewItem( parent->_listview ), QIconViewItem( parent->_iconview ), | 37 | :OListViewItem( parent->_listview ), QIconViewItem( parent->_iconview ), |
36 | _versatileview( parent ) | 38 | _versatileview( parent ) |
37 | { | 39 | { |
38 | init(); | 40 | init(); |
39 | } | 41 | } |
40 | 42 | ||
41 | OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after ) | 43 | OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after ) |
42 | :OListViewItem( parent->_listview, after ), QIconViewItem( parent->_iconview, after ), | 44 | :OListViewItem( parent->_listview, after ), QIconViewItem( parent->_iconview, after ), |
43 | _versatileview( parent ) | 45 | _versatileview( parent ) |
44 | { | 46 | { |
45 | init(); | 47 | init(); |
46 | } | 48 | } |
47 | 49 | ||
48 | OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, | 50 | OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, |
49 | QString a, QString b, QString c, QString d, | 51 | QString a, QString b, QString c, QString d, |
diff --git a/libopie2/opieui/oversatileviewitem.h b/libopie2/opieui/oversatileviewitem.h index ee8ee20..c4977af 100644 --- a/libopie2/opieui/oversatileviewitem.h +++ b/libopie2/opieui/oversatileviewitem.h | |||
@@ -27,32 +27,35 @@ | |||
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 | 31 | ||
32 | #ifndef OVERSATILEVIEWITEM_H | 32 | #ifndef OVERSATILEVIEWITEM_H |
33 | #define OVERSATILEVIEWITEM_H | 33 | #define OVERSATILEVIEWITEM_H |
34 | 34 | ||
35 | /* QT */ | 35 | /* QT */ |
36 | 36 | ||
37 | #include <qiconview.h> | 37 | #include <qiconview.h> |
38 | 38 | ||
39 | /* OPIE */ | 39 | /* OPIE */ |
40 | 40 | ||
41 | #include <opie2/olistview.h> | 41 | #include <opie2/olistview.h> |
42 | 42 | ||
43 | namespace Opie { | ||
44 | namespace Ui { | ||
45 | |||
43 | class OVersatileView; | 46 | class OVersatileView; |
44 | 47 | ||
45 | class OVersatileViewItem : public OListViewItem, public QIconViewItem | 48 | class OVersatileViewItem : public OListViewItem, public QIconViewItem |
46 | { | 49 | { |
47 | public: | 50 | public: |
48 | OVersatileViewItem( OVersatileView * parent ); | 51 | OVersatileViewItem( OVersatileView * parent ); |
49 | 52 | ||
50 | OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after ); | 53 | OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after ); |
51 | 54 | ||
52 | OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem * after ); | 55 | OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem * after ); |
53 | 56 | ||
54 | OVersatileViewItem( OVersatileView * parent, QString, | 57 | OVersatileViewItem( OVersatileView * parent, QString, |
55 | QString = QString::null, QString = QString::null, | 58 | QString = QString::null, QString = QString::null, |
56 | QString = QString::null, QString = QString::null, | 59 | QString = QString::null, QString = QString::null, |
57 | QString = QString::null, QString = QString::null, | 60 | QString = QString::null, QString = QString::null, |
58 | QString = QString::null ); | 61 | QString = QString::null ); |
@@ -84,17 +87,19 @@ class OVersatileViewItem : public OListViewItem, public QIconViewItem | |||
84 | /* OIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon ); | 87 | /* OIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon ); |
85 | OIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon ); | 88 | OIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon ); |
86 | */ | 89 | */ |
87 | 90 | ||
88 | virtual void setRenameEnabled( bool ); | 91 | virtual void setRenameEnabled( bool ); |
89 | 92 | ||
90 | // TODO: Implement the remaining method multiplexers | 93 | // TODO: Implement the remaining method multiplexers |
91 | 94 | ||
92 | private: | 95 | private: |
93 | OVersatileView* _versatileview; | 96 | OVersatileView* _versatileview; |
94 | 97 | ||
95 | private: | 98 | private: |
96 | void init(); | 99 | void init(); |
97 | 100 | ||
98 | }; | 101 | }; |
99 | 102 | ||
103 | } | ||
104 | } | ||
100 | #endif | 105 | #endif |
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp index 8bb4ed6..9519888 100644 --- a/libopie2/opieui/owait.cpp +++ b/libopie2/opieui/owait.cpp | |||
@@ -25,32 +25,34 @@ | |||
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "owait.h" | 31 | #include "owait.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qpainter.h> | 39 | #include <qpainter.h> |
40 | 40 | ||
41 | using namespace Opie::Ui; | ||
42 | |||
41 | static int frame = 0; | 43 | static int frame = 0; |
42 | 44 | ||
43 | /** | 45 | /** |
44 | * This will construct a modal dialog. | 46 | * This will construct a modal dialog. |
45 | * | 47 | * |
46 | * The default timer length is 10. | 48 | * The default timer length is 10. |
47 | * | 49 | * |
48 | * @param parent The parent of the widget | 50 | * @param parent The parent of the widget |
49 | * @param msg The name of the object | 51 | * @param msg The name of the object |
50 | * @param dispIcon Display Icon? | 52 | * @param dispIcon Display Icon? |
51 | */ | 53 | */ |
52 | OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) | 54 | OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) |
53 | :QDialog( parent, msg, TRUE, WStyle_Customize ) | 55 | :QDialog( parent, msg, TRUE, WStyle_Customize ) |
54 | { | 56 | { |
55 | 57 | ||
56 | 58 | ||
diff --git a/libopie2/opieui/owait.h b/libopie2/opieui/owait.h index 3267064..03c33e4 100644 --- a/libopie2/opieui/owait.h +++ b/libopie2/opieui/owait.h | |||
@@ -24,32 +24,35 @@ | |||
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OWAIT_H | 31 | #ifndef OWAIT_H |
32 | #define OWAIT_H | 32 | #define OWAIT_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qdialog.h> | 35 | #include <qdialog.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | 39 | ||
40 | |||
41 | namespace Opie { | ||
42 | namespace Ui { | ||
40 | /** | 43 | /** |
41 | * This class displays a animated waiting icon in the middle of the screen. | 44 | * This class displays a animated waiting icon in the middle of the screen. |
42 | * | 45 | * |
43 | * @short modal hour glass dialog | 46 | * @short modal hour glass dialog |
44 | * @see QDialog | 47 | * @see QDialog |
45 | * @author Maximilian Reiß | 48 | * @author Maximilian Reiß |
46 | */ | 49 | */ |
47 | class OWait : public QDialog | 50 | class OWait : public QDialog |
48 | { | 51 | { |
49 | Q_OBJECT | 52 | Q_OBJECT |
50 | 53 | ||
51 | public: | 54 | public: |
52 | OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE ); | 55 | OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE ); |
53 | ~OWait(); | 56 | ~OWait(); |
54 | 57 | ||
55 | /** | 58 | /** |
@@ -69,18 +72,19 @@ class OWait : public QDialog | |||
69 | * reimplemented for control reasons | 72 | * reimplemented for control reasons |
70 | */ | 73 | */ |
71 | void hide(); | 74 | void hide(); |
72 | 75 | ||
73 | private: | 76 | private: |
74 | void timerEvent( QTimerEvent * ); | 77 | void timerEvent( QTimerEvent * ); |
75 | void paintEvent( QPaintEvent * ); | 78 | void paintEvent( QPaintEvent * ); |
76 | 79 | ||
77 | QPixmap m_pix; | 80 | QPixmap m_pix; |
78 | QLabel *m_lb; | 81 | QLabel *m_lb; |
79 | QTimer *m_waitTimer; | 82 | QTimer *m_waitTimer; |
80 | int m_timerLength; | 83 | int m_timerLength; |
81 | int m_aniSize; | 84 | int m_aniSize; |
82 | class Private; | 85 | class Private; |
83 | Private *d; | 86 | Private *d; |
84 | }; | 87 | }; |
85 | 88 | } | |
89 | } | ||
86 | #endif | 90 | #endif |
diff --git a/libqtaux/oticker.cpp b/libqtaux/oticker.cpp index 2d8397e..e954cc8 100644 --- a/libqtaux/oticker.cpp +++ b/libqtaux/oticker.cpp | |||
@@ -20,32 +20,34 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "oticker.h" | 31 | #include "oticker.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | 35 | ||
36 | using namespace Opie::Ui; | ||
37 | |||
36 | OTicker::OTicker( QWidget* parent ) | 38 | OTicker::OTicker( QWidget* parent ) |
37 | : QLabel( parent ) | 39 | : QLabel( parent ) |
38 | { | 40 | { |
39 | setTextFormat( Qt::RichText ); | 41 | setTextFormat( Qt::RichText ); |
40 | Config cfg( "qpe" ); | 42 | Config cfg( "qpe" ); |
41 | cfg.setGroup( "Appearance" ); | 43 | cfg.setGroup( "Appearance" ); |
42 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); | 44 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); |
43 | foregroundcolor = Qt::black; | 45 | foregroundcolor = Qt::black; |
44 | updateTimerTime = 50; | 46 | updateTimerTime = 50; |
45 | scrollLength = 1; | 47 | scrollLength = 1; |
46 | } | 48 | } |
47 | 49 | ||
48 | OTicker::~OTicker() | 50 | OTicker::~OTicker() |
49 | {} | 51 | {} |
50 | 52 | ||
51 | void OTicker::setBackgroundColor( const QColor& backcolor ) | 53 | void OTicker::setBackgroundColor( const QColor& backcolor ) |
diff --git a/libqtaux/oticker.h b/libqtaux/oticker.h index 4026eb5..a89d334 100644 --- a/libqtaux/oticker.h +++ b/libqtaux/oticker.h | |||
@@ -28,32 +28,35 @@ | |||
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OTICKER_H | 31 | #ifndef OTICKER_H |
32 | #define OTICKER_H | 32 | #define OTICKER_H |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpainter.h> | 35 | #include <qpainter.h> |
36 | #include <qdrawutil.h> | 36 | #include <qdrawutil.h> |
37 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qslider.h> | 39 | #include <qslider.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qframe.h> | 41 | #include <qframe.h> |
42 | #include <qcolor.h> | 42 | #include <qcolor.h> |
43 | 43 | ||
44 | |||
45 | namespace Opie { | ||
46 | namespace Ui { | ||
44 | /** | 47 | /** |
45 | * @class OTicker | 48 | * @class OTicker |
46 | * @brief The OTicker class provides a QLabel widget that scroll its contents | 49 | * @brief The OTicker class provides a QLabel widget that scroll its contents |
47 | * | 50 | * |
48 | */ | 51 | */ |
49 | class OTicker : public QLabel { | 52 | class OTicker : public QLabel { |
50 | Q_OBJECT | 53 | Q_OBJECT |
51 | 54 | ||
52 | public: | 55 | public: |
53 | 56 | ||
54 | /*! | 57 | /*! |
55 | * @fn OTicker( QWidget* parent = 0 ) | 58 | * @fn OTicker( QWidget* parent = 0 ) |
56 | * @brief Object constructor. | 59 | * @brief Object constructor. |
57 | * | 60 | * |
58 | * @param parent Pointer to parent of this control. | 61 | * @param parent Pointer to parent of this control. |
59 | 62 | ||
@@ -130,17 +133,19 @@ protected: | |||
130 | */ | 133 | */ |
131 | void drawContents( QPainter *p ); | 134 | void drawContents( QPainter *p ); |
132 | /*! | 135 | /*! |
133 | * @fn mouseReleaseEvent( QMouseEvent *e) | 136 | * @fn mouseReleaseEvent( QMouseEvent *e) |
134 | * @brief mouse release event | 137 | * @brief mouse release event |
135 | * @param e QMouseEvent. see QMouseEvent. | 138 | * @param e QMouseEvent. see QMouseEvent. |
136 | * | 139 | * |
137 | */ | 140 | */ |
138 | void mouseReleaseEvent( QMouseEvent *e); | 141 | void mouseReleaseEvent( QMouseEvent *e); |
139 | private: | 142 | private: |
140 | QColor backgroundcolor, foregroundcolor; | 143 | QColor backgroundcolor, foregroundcolor; |
141 | QString scrollText; | 144 | QString scrollText; |
142 | QPixmap scrollTextPixmap; | 145 | QPixmap scrollTextPixmap; |
143 | int pos, updateTimerTime, scrollLength; | 146 | int pos, updateTimerTime, scrollLength; |
144 | }; | 147 | }; |
145 | 148 | ||
149 | } | ||
150 | } | ||
146 | #endif | 151 | #endif |