summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/main.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/main.cpp46
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
@@ -5,2 +5,3 @@
5 5
6#include <opie2/odebug.h>
6#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
@@ -26,2 +27,13 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
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>
33using namespace Opietooth2;
34
35#include <qpushbutton.h>
36#include <qlayout.h>
37#include <qframe.h>
38#include <qlabel.h>
27 39
@@ -52,2 +64,5 @@ int main( int argc, char * argv[] ) {
52 rmv = 1; 64 rmv = 1;
65 } else if( strcmp( argv[i], "--opietooth" ) == 0 ) {
66 Action = ACT_OT;
67 rmv = 1;
53 } 68 }
@@ -66,2 +81,4 @@ int main( int argc, char * argv[] ) {
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 }
@@ -88,11 +105,8 @@ int main( int argc, char * argv[] ) {
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] ));
@@ -105,4 +119,5 @@ int main( int argc, char * argv[] ) {
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 }
@@ -127,4 +142,12 @@ int main( int argc, char * argv[] ) {
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();
@@ -136,2 +159,3 @@ int main( int argc, char * argv[] ) {
136 rv = TheApp->exec(); 159 rv = TheApp->exec();
160
137 delete W; 161 delete W;