author | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
commit | a9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (unidiff) | |
tree | 13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/settings/networksettings2/main.cpp | |
parent | 48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff) | |
download | opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.zip opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.gz opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.bz2 |
CONTROL files : changed version string
NS2 many changes and first release of OT2
Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/main.cpp | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index 18bf652..8487e3e 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "activatevpn.h" | 3 | #include "activatevpn.h" |
4 | #include "networksettings.h" | 4 | #include "networksettings.h" |
5 | 5 | ||
6 | #include <opie2/odebug.h> | ||
6 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
7 | 8 | ||
8 | #include <opie2/oapplicationfactory.h> | 9 | #include <opie2/oapplicationfactory.h> |
@@ -24,6 +25,17 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | |||
24 | #define ACT_PROMPT 3 | 25 | #define ACT_PROMPT 3 |
25 | // used by interfaces to trigger VPN | 26 | // used by interfaces to trigger VPN |
26 | #define ACT_VPN 4 | 27 | #define ACT_VPN 4 |
28 | // activate opietooth | ||
29 | #define ACT_OT 5 | ||
30 | |||
31 | // include Opietooth GUI | ||
32 | #include <opietooth2/Opietooth.h> | ||
33 | using namespace Opietooth2; | ||
34 | |||
35 | #include <qpushbutton.h> | ||
36 | #include <qlayout.h> | ||
37 | #include <qframe.h> | ||
38 | #include <qlabel.h> | ||
27 | 39 | ||
28 | int main( int argc, char * argv[] ) { | 40 | int main( int argc, char * argv[] ) { |
29 | int rv = 0; | 41 | int rv = 0; |
@@ -50,6 +62,9 @@ int main( int argc, char * argv[] ) { | |||
50 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { | 62 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { |
51 | Action = ACT_VPN; | 63 | Action = ACT_VPN; |
52 | rmv = 1; | 64 | rmv = 1; |
65 | } else if( strcmp( argv[i], "--opietooth" ) == 0 ) { | ||
66 | Action = ACT_OT; | ||
67 | rmv = 1; | ||
53 | } | 68 | } |
54 | if( rmv ) { | 69 | if( rmv ) { |
55 | memmove( argv+i, argv+i+rmv, | 70 | memmove( argv+i, argv+i+rmv, |
@@ -64,6 +79,8 @@ int main( int argc, char * argv[] ) { | |||
64 | GuiType = QApplication::Tty; | 79 | GuiType = QApplication::Tty; |
65 | Action = ACT_REQUEST; | 80 | Action = ACT_REQUEST; |
66 | Log(("Request : %s\n", argv[1] )); | 81 | Log(("Request : %s\n", argv[1] )); |
82 | } else if( strstr( argv[0], "-opietooth" ) ) { | ||
83 | Action = ACT_OT; | ||
67 | } | 84 | } |
68 | 85 | ||
69 | // Start Qt | 86 | // Start Qt |
@@ -86,15 +103,12 @@ int main( int argc, char * argv[] ) { | |||
86 | case ACT_REQUEST : | 103 | case ACT_REQUEST : |
87 | { NetworkSettingsData NS; | 104 | { NetworkSettingsData NS; |
88 | if( NS.canStart( argv[1] ) ) { | 105 | if( NS.canStart( argv[1] ) ) { |
89 | QString S; | 106 | QStringList S; |
90 | S.sprintf( QPEApplication::qpeDir()+ | 107 | S << QPEApplication::qpeDir() + "/bin/networksettings2"; |
91 | "bin/networksettings2" ); | 108 | S << "networksettings2"; |
92 | char * MyArgv[4]; | 109 | S << "--prompt"; |
93 | MyArgv[0] = "networksettings2"; | 110 | S << argv[1]; |
94 | MyArgv[1] = "--prompt"; | 111 | NSResources->system().execAsUser( S ); |
95 | MyArgv[2] = argv[1]; | ||
96 | MyArgv[3] = NULL; | ||
97 | NSResources->system().execAsUser( S, MyArgv ); | ||
98 | Log(("FAILED %s-cNN-allowed\n", argv[1] )); | 112 | Log(("FAILED %s-cNN-allowed\n", argv[1] )); |
99 | // if we come here , failed | 113 | // if we come here , failed |
100 | printf( "%s-cNN-disallowed", argv[1] ); | 114 | printf( "%s-cNN-disallowed", argv[1] ); |
@@ -103,8 +117,9 @@ int main( int argc, char * argv[] ) { | |||
103 | break; | 117 | break; |
104 | case ACT_REGEN : | 118 | case ACT_REGEN : |
105 | { NetworkSettingsData NS; | 119 | { NetworkSettingsData NS; |
120 | QString S= NS.generateSettings(); | ||
106 | // regen returns 0 if OK | 121 | // regen returns 0 if OK |
107 | rv = (NS.regenerate()) ? 1 : 0; | 122 | rv = ( S.isEmpty() ) ? 0 : 1; |
108 | } | 123 | } |
109 | break; | 124 | break; |
110 | case ACT_PROMPT : | 125 | case ACT_PROMPT : |
@@ -125,8 +140,16 @@ int main( int argc, char * argv[] ) { | |||
125 | } | 140 | } |
126 | break; | 141 | break; |
127 | case ACT_GUI : | 142 | case ACT_GUI : |
128 | { QWidget * W = new NetworkSettings(0); | 143 | case ACT_OT : |
144 | { QWidget * W; | ||
145 | |||
146 | if( Action == ACT_OT ) { | ||
147 | W = new OTMain( 0 ); | ||
148 | } else { | ||
149 | W = new NetworkSettings(0); | ||
150 | } | ||
129 | TheApp->setMainWidget( W ); | 151 | TheApp->setMainWidget( W ); |
152 | |||
130 | W->show(); | 153 | W->show(); |
131 | #ifdef _WS_QWS_ | 154 | #ifdef _WS_QWS_ |
132 | W->showMaximized(); | 155 | W->showMaximized(); |
@@ -134,6 +157,7 @@ int main( int argc, char * argv[] ) { | |||
134 | W->resize( W->sizeHint() ); | 157 | W->resize( W->sizeHint() ); |
135 | #endif | 158 | #endif |
136 | rv = TheApp->exec(); | 159 | rv = TheApp->exec(); |
160 | |||
137 | delete W; | 161 | delete W; |
138 | } | 162 | } |
139 | break; | 163 | break; |