Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index 7ec26a7..e2c00f6 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -1,27 +1,28 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "activateprofile.h" | 2 | #include "activateprofile.h" |
3 | #include "networksettings.h" | 3 | #include "networksettings.h" |
4 | |||
4 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
5 | 6 | ||
6 | #include <opie/oapplicationfactory.h> | 7 | #include <opie/oapplicationfactory.h> |
7 | 8 | ||
8 | #ifdef GONE | 9 | #ifdef GONE |
9 | 10 | ||
10 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | 11 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) |
11 | 12 | ||
12 | #else | 13 | #else |
13 | 14 | ||
14 | // just standard GUI | 15 | // just standard GUI |
15 | #define ACT_GUI 0 | 16 | #define ACT_GUI 0 |
16 | // used by interfaces to request for allow of up/down | 17 | // used by interfaces to request for allow of up/down |
17 | #define ACT_REQUEST 1 | 18 | #define ACT_REQUEST 1 |
18 | // regenerate config files | 19 | // regenerate config files |
19 | #define ACT_REGEN 2 | 20 | #define ACT_REGEN 2 |
20 | // used by interfaces to request user prompt | 21 | // used by interfaces to request user prompt |
21 | #define ACT_PROMPT 3 | 22 | #define ACT_PROMPT 3 |
22 | 23 | ||
23 | int main( int argc, char * argv[] ) { | 24 | int main( int argc, char * argv[] ) { |
24 | int rv = 0; | 25 | int rv = 0; |
25 | int Action = ACT_GUI; | 26 | int Action = ACT_GUI; |
26 | // could be overruled by -qws | 27 | // could be overruled by -qws |
27 | QApplication::Type GuiType = QApplication::GuiClient; | 28 | QApplication::Type GuiType = QApplication::GuiClient; |
@@ -55,49 +56,61 @@ int main( int argc, char * argv[] ) { | |||
55 | // called from system to request something | 56 | // called from system to request something |
56 | GuiType = QApplication::Tty; | 57 | GuiType = QApplication::Tty; |
57 | Action = ACT_REQUEST; | 58 | Action = ACT_REQUEST; |
58 | } | 59 | } |
59 | 60 | ||
60 | // Start Qt | 61 | // Start Qt |
61 | #ifdef _WS_QWS_ | 62 | #ifdef _WS_QWS_ |
62 | // because QPEApplication does not handle GuiType well | 63 | // because QPEApplication does not handle GuiType well |
63 | if( GuiType == QApplication::Tty ) { | 64 | if( GuiType == QApplication::Tty ) { |
64 | // this cast is NOT correct but we do not use | 65 | // this cast is NOT correct but we do not use |
65 | // TheApp anymore ... | 66 | // TheApp anymore ... |
66 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); | 67 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); |
67 | } else { | 68 | } else { |
68 | TheApp = new QPEApplication( argc, argv, GuiType ); | 69 | TheApp = new QPEApplication( argc, argv, GuiType ); |
69 | } | 70 | } |
70 | #else | 71 | #else |
71 | TheApp = new QApplication( argc, argv, GuiType ); | 72 | TheApp = new QApplication( argc, argv, GuiType ); |
72 | #endif | 73 | #endif |
73 | 74 | ||
74 | // init qt with app widget | 75 | // init qt with app widget |
75 | 76 | ||
76 | switch( Action ) { | 77 | switch( Action ) { |
77 | case ACT_REQUEST : | 78 | case ACT_REQUEST : |
78 | { NetworkSettingsData NS; | 79 | { NetworkSettingsData NS; |
79 | NS.canStart( argv[1] ); | 80 | if( NS.canStart( argv[1] ) ) { |
81 | QString S; | ||
82 | S.sprintf( QPEApplication::qpeDir()+ | ||
83 | "/bin/networksettings2" ); | ||
84 | char * MyArgv[4]; | ||
85 | MyArgv[0] = "networksettings2"; | ||
86 | MyArgv[1] = "--prompt"; | ||
87 | MyArgv[2] = argv[1]; | ||
88 | MyArgv[3] = NULL; | ||
89 | NSResources->system().execAsUser( S, MyArgv ); | ||
90 | // if we come here , failed | ||
91 | printf( "%s-cNN-disallowed", argv[1] ); | ||
92 | } | ||
80 | } | 93 | } |
81 | break; | 94 | break; |
82 | case ACT_REGEN : | 95 | case ACT_REGEN : |
83 | { NetworkSettingsData NS; | 96 | { NetworkSettingsData NS; |
84 | // regen returns 0 if OK | 97 | // regen returns 0 if OK |
85 | rv = (NS.regenerate()) ? 1 : 0; | 98 | rv = (NS.regenerate()) ? 1 : 0; |
86 | } | 99 | } |
87 | break; | 100 | break; |
88 | case ACT_PROMPT : | 101 | case ACT_PROMPT : |
89 | { ActivateProfile AP(argv[1]); | 102 | { ActivateProfile AP(argv[1]); |
90 | if( AP.exec() == QDialog::Accepted ) { | 103 | if( AP.exec() == QDialog::Accepted ) { |
91 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); | 104 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); |
92 | } else { | 105 | } else { |
93 | printf( "%s-cNN-disallowed", argv[1] ); | 106 | printf( "%s-cNN-disallowed", argv[1] ); |
94 | } | 107 | } |
95 | } | 108 | } |
96 | break; | 109 | break; |
97 | case ACT_GUI : | 110 | case ACT_GUI : |
98 | { QWidget * W = new NetworkSettings(0); | 111 | { QWidget * W = new NetworkSettings(0); |
99 | TheApp->setMainWidget( W ); | 112 | TheApp->setMainWidget( W ); |
100 | W->show(); | 113 | W->show(); |
101 | #ifdef _WS_QWS_ | 114 | #ifdef _WS_QWS_ |
102 | W->showMaximized(); | 115 | W->showMaximized(); |
103 | #else | 116 | #else |