summaryrefslogtreecommitdiff
authorzecke <zecke>2004-12-20 22:27:21 (UTC)
committer zecke <zecke>2004-12-20 22:27:21 (UTC)
commit89b3fd61bdd13e62ff64bd7ab0b15c10a964b867 (patch) (unidiff)
tree6cc25286965e93788e9e47b7743f2379ec328bf5
parent2be4d5bf420dc4aff71cf78601c095a96ed88c47 (diff)
downloadopie-89b3fd61bdd13e62ff64bd7ab0b15c10a964b867.zip
opie-89b3fd61bdd13e62ff64bd7ab0b15c10a964b867.tar.gz
opie-89b3fd61bdd13e62ff64bd7ab0b15c10a964b867.tar.bz2
Restore change
-QPEApplication::qpeDir() is guranteed to be '/' terminated
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
index 9004d19..18bf652 100644
--- a/noncore/settings/networksettings2/main.cpp
+++ b/noncore/settings/networksettings2/main.cpp
@@ -27,125 +27,125 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
27 27
28int main( int argc, char * argv[] ) { 28int main( int argc, char * argv[] ) {
29 int rv = 0; 29 int rv = 0;
30 int Action = ACT_GUI; 30 int Action = ACT_GUI;
31 // could be overruled by -qws 31 // could be overruled by -qws
32 QApplication::Type GuiType = QApplication::GuiClient; 32 QApplication::Type GuiType = QApplication::GuiClient;
33 33
34#ifdef _WS_QWS_ 34#ifdef _WS_QWS_
35 QPEApplication * TheApp; 35 QPEApplication * TheApp;
36#else 36#else
37 QApplication * TheApp; 37 QApplication * TheApp;
38#endif 38#endif
39 39
40 for ( int i = 1; i < argc; i ++ ) { 40 for ( int i = 1; i < argc; i ++ ) {
41 int rmv; 41 int rmv;
42 rmv = 0; 42 rmv = 0;
43 if( strcmp( argv[i], "--regen" ) == 0 ) { 43 if( strcmp( argv[i], "--regen" ) == 0 ) {
44 Action = ACT_REGEN; 44 Action = ACT_REGEN;
45 GuiType = QApplication::Tty; 45 GuiType = QApplication::Tty;
46 rmv = 1; 46 rmv = 1;
47 } else if( strcmp( argv[i], "--prompt" ) == 0 ) { 47 } else if( strcmp( argv[i], "--prompt" ) == 0 ) {
48 Action = ACT_PROMPT; 48 Action = ACT_PROMPT;
49 rmv = 1; 49 rmv = 1;
50 } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { 50 } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) {
51 Action = ACT_VPN; 51 Action = ACT_VPN;
52 rmv = 1; 52 rmv = 1;
53 } 53 }
54 if( rmv ) { 54 if( rmv ) {
55 memmove( argv+i, argv+i+rmv, 55 memmove( argv+i, argv+i+rmv,
56 sizeof( char * ) * (argc-i-rmv) ); 56 sizeof( char * ) * (argc-i-rmv) );
57 i --; 57 i --;
58 argc -= rmv; 58 argc -= rmv;
59 } 59 }
60 } 60 }
61 61
62 if( strstr( argv[0], "-request" ) ) { 62 if( strstr( argv[0], "-request" ) ) {
63 // called from system to request something 63 // called from system to request something
64 GuiType = QApplication::Tty; 64 GuiType = QApplication::Tty;
65 Action = ACT_REQUEST; 65 Action = ACT_REQUEST;
66 Log(("Request : %s\n", argv[1] )); 66 Log(("Request : %s\n", argv[1] ));
67 } 67 }
68 68
69 // Start Qt 69 // Start Qt
70#ifdef _WS_QWS_ 70#ifdef _WS_QWS_
71 // because QPEApplication does not handle GuiType well 71 // because QPEApplication does not handle GuiType well
72 if( GuiType == QApplication::Tty ) { 72 if( GuiType == QApplication::Tty ) {
73 // this cast is NOT correct but we do not use 73 // this cast is NOT correct but we do not use
74 // TheApp anymore ... 74 // TheApp anymore ...
75 TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); 75 TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType );
76 } else { 76 } else {
77 TheApp = new QPEApplication( argc, argv, GuiType ); 77 TheApp = new QPEApplication( argc, argv, GuiType );
78 } 78 }
79#else 79#else
80 TheApp = new QApplication( argc, argv, GuiType ); 80 TheApp = new QApplication( argc, argv, GuiType );
81#endif 81#endif
82 82
83 // init qt with app widget 83 // init qt with app widget
84 84
85 switch( Action ) { 85 switch( Action ) {
86 case ACT_REQUEST : 86 case ACT_REQUEST :
87 { NetworkSettingsData NS; 87 { NetworkSettingsData NS;
88 if( NS.canStart( argv[1] ) ) { 88 if( NS.canStart( argv[1] ) ) {
89 QString S; 89 QString S;
90 S.sprintf( QPEApplication::qpeDir()+ 90 S.sprintf( QPEApplication::qpeDir()+
91 "/bin/networksettings2" ); 91 "bin/networksettings2" );
92 char * MyArgv[4]; 92 char * MyArgv[4];
93 MyArgv[0] = "networksettings2"; 93 MyArgv[0] = "networksettings2";
94 MyArgv[1] = "--prompt"; 94 MyArgv[1] = "--prompt";
95 MyArgv[2] = argv[1]; 95 MyArgv[2] = argv[1];
96 MyArgv[3] = NULL; 96 MyArgv[3] = NULL;
97 NSResources->system().execAsUser( S, MyArgv ); 97 NSResources->system().execAsUser( S, MyArgv );
98 Log(("FAILED %s-cNN-allowed\n", argv[1] )); 98 Log(("FAILED %s-cNN-allowed\n", argv[1] ));
99 // if we come here , failed 99 // if we come here , failed
100 printf( "%s-cNN-disallowed", argv[1] ); 100 printf( "%s-cNN-disallowed", argv[1] );
101 } 101 }
102 } 102 }
103 break; 103 break;
104 case ACT_REGEN : 104 case ACT_REGEN :
105 { NetworkSettingsData NS; 105 { NetworkSettingsData NS;
106 // regen returns 0 if OK 106 // regen returns 0 if OK
107 rv = (NS.regenerate()) ? 1 : 0; 107 rv = (NS.regenerate()) ? 1 : 0;
108 } 108 }
109 break; 109 break;
110 case ACT_PROMPT : 110 case ACT_PROMPT :
111 { ActivateProfile AP(argv[1]); 111 { ActivateProfile AP(argv[1]);
112 if( AP.exec() == QDialog::Accepted ) { 112 if( AP.exec() == QDialog::Accepted ) {
113 Log(("%s-c%ld-allowed\n", 113 Log(("%s-c%ld-allowed\n",
114 argv[1], AP.selectedProfile() )); 114 argv[1], AP.selectedProfile() ));
115 printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); 115 printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() );
116 } else { 116 } else {
117 Log(("%s-c%NN-disallowed\n", argv[1] )); 117 Log(("%s-c%NN-disallowed\n", argv[1] ));
118 printf( "%s-cNN-disallowed", argv[1] ); 118 printf( "%s-cNN-disallowed", argv[1] );
119 } 119 }
120 } 120 }
121 break; 121 break;
122 case ACT_VPN : 122 case ACT_VPN :
123 { ActivateVPN AVPN; 123 { ActivateVPN AVPN;
124 AVPN.exec(); 124 AVPN.exec();
125 } 125 }
126 break; 126 break;
127 case ACT_GUI : 127 case ACT_GUI :
128 { QWidget * W = new NetworkSettings(0); 128 { QWidget * W = new NetworkSettings(0);
129 TheApp->setMainWidget( W ); 129 TheApp->setMainWidget( W );
130 W->show(); 130 W->show();
131#ifdef _WS_QWS_ 131#ifdef _WS_QWS_
132 W->showMaximized(); 132 W->showMaximized();
133#else 133#else
134 W->resize( W->sizeHint() ); 134 W->resize( W->sizeHint() );
135#endif 135#endif
136 rv = TheApp->exec(); 136 rv = TheApp->exec();
137 delete W; 137 delete W;
138 } 138 }
139 break; 139 break;
140 } 140 }
141 141
142 LogClose(); 142 LogClose();
143 143
144 return rv; 144 return rv;
145} 145}
146 146
147#endif 147#endif
148 148
149 149
150// main.cpp 150// main.cpp
151 151