summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/main.cpp
authorwimpie <wimpie>2004-04-02 18:29:49 (UTC)
committer wimpie <wimpie>2004-04-02 18:29:49 (UTC)
commit5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (patch) (unidiff)
treef55aebd4314ab878bc39b6b08b8323a8ef78d803 /noncore/settings/networksettings2/main.cpp
parent7c8922b37b5bb7696c0ff2cbc999e2936b9b509f (diff)
downloadopie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.zip
opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.gz
opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.bz2
First import of NS2 app
Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/main.cpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
new file mode 100644
index 0000000..bcef631
--- a/dev/null
+++ b/noncore/settings/networksettings2/main.cpp
@@ -0,0 +1,96 @@
1#include "networksettings.h"
2#include <qpe/qpeapplication.h>
3
4#include <opie/oapplicationfactory.h>
5
6#ifdef GONE
7
8OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
9
10#else
11
12#define ACT_GUI 0
13#define ACT_REQUEST 1
14#define ACT_REGEN 2
15
16int main( int argc, char * argv[] ) {
17 int rv = 0;
18 int Action = ACT_GUI;
19 // could be overruled by -qws
20 QApplication::Type GuiType = QApplication::GuiClient;
21
22#ifdef _WS_QWS_
23 QPEApplication * TheApp;
24#else
25 QApplication * TheApp;
26#endif
27
28 for ( int i = 1; i < argc; i ++ ) {
29 int rmv;
30 rmv = 0;
31 if( strcmp( argv[i], "--regen" ) == 0 ) {
32 Action = ACT_REGEN;
33 GuiType = QApplication::Tty;
34 rmv = 1;
35 }
36 if( rmv ) {
37 memmove( argv+i, argv+i+rmv,
38 sizeof( char * ) * (argc-i-rmv) );
39 i --;
40 argc -= rmv;
41 }
42 }
43
44 if( strstr( argv[0], "-request" ) ) {
45 // called from system to request something
46 GuiType = QApplication::Tty;
47 Action = ACT_REQUEST;
48 }
49
50 // Start Qt
51#ifdef _WS_QWS_
52 // because QPEApplication does not handle GuiType well
53 if( GuiType == QApplication::Tty ) {
54 // this cast is NOT correct but we do not use
55 // TheApp anymore ...
56 TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType );
57 } else {
58 TheApp = new QPEApplication( argc, argv, GuiType );
59 }
60#else
61 TheApp = new QApplication( argc, argv, GuiType );
62#endif
63
64 // init qt with app widget
65 if( GuiType != QApplication::Tty ) {
66 QWidget * W = 0;
67 W = new NetworkSettings(0);
68 TheApp->setMainWidget( W );
69 W->show();
70#ifdef _WS_QWS_
71 W->showMaximized();
72#else
73 W->resize( W->sizeHint() );
74#endif
75 rv = TheApp->exec();
76 delete W;
77 } else {
78 switch( Action ) {
79 case ACT_REQUEST :
80 NetworkSettings::canStart( argv[1] );
81 break;
82 case ACT_REGEN :
83 // regen returns 0 if OK
84 rv = (NetworkSettings::regenerate()) ? 1 : 0;
85 break;
86 }
87 }
88
89 return rv;
90}
91
92#endif
93
94
95// main.cpp
96