author | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-08-12 12:46:55 (UTC) |
commit | 8f215ba9ceb395f262517855a99d7d2d303ca760 (patch) (unidiff) | |
tree | aa5f9b14c249217b4d3fc30f4771bdaf1c3545d3 /noncore/settings/networksettings2/main.cpp | |
parent | ef64880308b5035cc8ca2e4e79325db613af525b (diff) | |
download | opie-8f215ba9ceb395f262517855a99d7d2d303ca760.zip opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.gz opie-8f215ba9ceb395f262517855a99d7d2d303ca760.tar.bz2 |
MANY changes
- now generates peers/pap-chap secrets files
(no chatscript yet)
(not all usefull ppp options included yet)
- still not ready for prime time yet
Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/main.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index 6c969fc..b32b323 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "activateprofile.h" | 2 | #include "activateprofile.h" |
3 | #include "activatevpn.h" | ||
3 | #include "networksettings.h" | 4 | #include "networksettings.h" |
4 | 5 | ||
5 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
6 | 7 | ||
7 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
8 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
@@ -18,12 +19,14 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | |||
18 | // used by interfaces to request for allow of up/down | 19 | // used by interfaces to request for allow of up/down |
19 | #define ACT_REQUEST 1 | 20 | #define ACT_REQUEST 1 |
20 | // regenerate config files | 21 | // regenerate config files |
21 | #define ACT_REGEN 2 | 22 | #define ACT_REGEN 2 |
22 | // used by interfaces to request user prompt | 23 | // used by interfaces to request user prompt |
23 | #define ACT_PROMPT 3 | 24 | #define ACT_PROMPT 3 |
25 | // used by interfaces to trigger VPN | ||
26 | #define ACT_VPN 4 | ||
24 | 27 | ||
25 | int main( int argc, char * argv[] ) { | 28 | int main( int argc, char * argv[] ) { |
26 | int rv = 0; | 29 | int rv = 0; |
27 | int Action = ACT_GUI; | 30 | int Action = ACT_GUI; |
28 | // could be overruled by -qws | 31 | // could be overruled by -qws |
29 | QApplication::Type GuiType = QApplication::GuiClient; | 32 | QApplication::Type GuiType = QApplication::GuiClient; |
@@ -41,12 +44,15 @@ int main( int argc, char * argv[] ) { | |||
41 | Action = ACT_REGEN; | 44 | Action = ACT_REGEN; |
42 | GuiType = QApplication::Tty; | 45 | GuiType = QApplication::Tty; |
43 | rmv = 1; | 46 | rmv = 1; |
44 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { | 47 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { |
45 | Action = ACT_PROMPT; | 48 | Action = ACT_PROMPT; |
46 | rmv = 1; | 49 | rmv = 1; |
50 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { | ||
51 | Action = ACT_VPN; | ||
52 | rmv = 1; | ||
47 | } | 53 | } |
48 | if( rmv ) { | 54 | if( rmv ) { |
49 | memmove( argv+i, argv+i+rmv, | 55 | memmove( argv+i, argv+i+rmv, |
50 | sizeof( char * ) * (argc-i-rmv) ); | 56 | sizeof( char * ) * (argc-i-rmv) ); |
51 | i --; | 57 | i --; |
52 | argc -= rmv; | 58 | argc -= rmv; |
@@ -75,16 +81,14 @@ int main( int argc, char * argv[] ) { | |||
75 | 81 | ||
76 | // init qt with app widget | 82 | // init qt with app widget |
77 | 83 | ||
78 | switch( Action ) { | 84 | switch( Action ) { |
79 | case ACT_REQUEST : | 85 | case ACT_REQUEST : |
80 | { NetworkSettingsData NS; | 86 | { NetworkSettingsData NS; |
81 | Log(("ACT_REQUEST\n")); | ||
82 | if( NS.canStart( argv[1] ) ) { | 87 | if( NS.canStart( argv[1] ) ) { |
83 | QString S; | 88 | QString S; |
84 | Log(("NEED FOR PROMPT\n" )); | ||
85 | S.sprintf( QPEApplication::qpeDir()+ | 89 | S.sprintf( QPEApplication::qpeDir()+ |
86 | "/bin/networksettings2" ); | 90 | "/bin/networksettings2" ); |
87 | char * MyArgv[4]; | 91 | char * MyArgv[4]; |
88 | MyArgv[0] = "networksettings2"; | 92 | MyArgv[0] = "networksettings2"; |
89 | MyArgv[1] = "--prompt"; | 93 | MyArgv[1] = "--prompt"; |
90 | MyArgv[2] = argv[1]; | 94 | MyArgv[2] = argv[1]; |
@@ -94,30 +98,32 @@ int main( int argc, char * argv[] ) { | |||
94 | printf( "%s-cNN-disallowed", argv[1] ); | 98 | printf( "%s-cNN-disallowed", argv[1] ); |
95 | } | 99 | } |
96 | } | 100 | } |
97 | break; | 101 | break; |
98 | case ACT_REGEN : | 102 | case ACT_REGEN : |
99 | { NetworkSettingsData NS; | 103 | { NetworkSettingsData NS; |
100 | Log(("REGEN\n" )); | ||
101 | // regen returns 0 if OK | 104 | // regen returns 0 if OK |
102 | rv = (NS.regenerate()) ? 1 : 0; | 105 | rv = (NS.regenerate()) ? 1 : 0; |
103 | } | 106 | } |
104 | break; | 107 | break; |
105 | case ACT_PROMPT : | 108 | case ACT_PROMPT : |
106 | { ActivateProfile AP(argv[1]); | 109 | { ActivateProfile AP(argv[1]); |
107 | Log(("PROMPT\n" )); | ||
108 | if( AP.exec() == QDialog::Accepted ) { | 110 | if( AP.exec() == QDialog::Accepted ) { |
109 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); | 111 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); |
110 | } else { | 112 | } else { |
111 | printf( "%s-cNN-disallowed", argv[1] ); | 113 | printf( "%s-cNN-disallowed", argv[1] ); |
112 | } | 114 | } |
113 | } | 115 | } |
114 | break; | 116 | break; |
117 | case ACT_VPN : | ||
118 | { ActivateVPN AVPN; | ||
119 | AVPN.exec(); | ||
120 | } | ||
121 | break; | ||
115 | case ACT_GUI : | 122 | case ACT_GUI : |
116 | { QWidget * W = new NetworkSettings(0); | 123 | { QWidget * W = new NetworkSettings(0); |
117 | Log(("GUI\n" )); | ||
118 | TheApp->setMainWidget( W ); | 124 | TheApp->setMainWidget( W ); |
119 | W->show(); | 125 | W->show(); |
120 | #ifdef _WS_QWS_ | 126 | #ifdef _WS_QWS_ |
121 | W->showMaximized(); | 127 | W->showMaximized(); |
122 | #else | 128 | #else |
123 | W->resize( W->sizeHint() ); | 129 | W->resize( W->sizeHint() ); |