author | wimpie <wimpie> | 2005-01-11 15:35:46 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-11 15:35:46 (UTC) |
commit | 4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9 (patch) (unidiff) | |
tree | 0e8adcc616a1d20b637aad3de568dcb45af05f71 /noncore/settings/networksettings2/main.cpp | |
parent | 32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e (diff) | |
download | opie-4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9.zip opie-4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9.tar.gz opie-4c4cdd76caea5a8be4a971892375c7c6b4f4a8b9.tar.bz2 |
vpn should now work IF only the vpn plugin would do something.
shortened logical interface names (busybox only supports 10 characters
and then ONLY if you recompile it with mappings enabled)
Other small fixes
Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/main.cpp | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index 973b4b7..2243826 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -23,10 +23,12 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | |||
23 | #define ACT_REGEN 2 | 23 | #define ACT_REGEN 2 |
24 | // used by interfaces to request user prompt | 24 | // used by interfaces to request user prompt |
25 | #define ACT_PROMPT 3 | 25 | #define ACT_PROMPT 3 |
26 | // used by interfaces to trigger VPN | 26 | // used by interfaces to trigger VPN prompting |
27 | #define ACT_VPN 4 | 27 | #define ACT_TRIGGERVPN 4 |
28 | // activate opietooth | 28 | // activate opietooth |
29 | #define ACT_OT 5 | 29 | #define ACT_OT 5 |
30 | // prompt for VPN networks | ||
31 | #define ACT_PROMPTVPN 6 | ||
30 | 32 | ||
31 | // include Opietooth GUI | 33 | // include Opietooth GUI |
32 | #include <opietooth2/Opietooth.h> | 34 | #include <opietooth2/Opietooth.h> |
@@ -56,7 +58,11 @@ int main( int argc, char * argv[] ) { | |||
56 | Action = ACT_PROMPT; | 58 | Action = ACT_PROMPT; |
57 | rmv = 1; | 59 | rmv = 1; |
58 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { | 60 | } else if( strcmp( argv[i], "--triggervpn" ) == 0 ) { |
59 | Action = ACT_VPN; | 61 | GuiType = QApplication::Tty; |
62 | Action = ACT_TRIGGERVPN; | ||
63 | rmv = 1; | ||
64 | } else if( strcmp( argv[i], "--promptvpn" ) == 0 ) { | ||
65 | Action = ACT_PROMPTVPN; | ||
60 | rmv = 1; | 66 | rmv = 1; |
61 | } else if( strcmp( argv[i], "--opietooth" ) == 0 ) { | 67 | } else if( strcmp( argv[i], "--opietooth" ) == 0 ) { |
62 | Action = ACT_OT; | 68 | Action = ACT_OT; |
@@ -95,15 +101,24 @@ int main( int argc, char * argv[] ) { | |||
95 | case ACT_REQUEST : | 101 | case ACT_REQUEST : |
96 | { NetworkSettingsData NS; | 102 | { NetworkSettingsData NS; |
97 | if( NS.canStart( argv[1] ) ) { | 103 | if( NS.canStart( argv[1] ) ) { |
104 | QStringList SL; | ||
105 | SL << QPEApplication::qpeDir() + "bin/networksettings2" | ||
106 | << "--prompt" | ||
107 | << argv[1]; | ||
108 | // exec synchronous -> blocks | ||
109 | NSResources->system().execAsUser( SL, 1 ); | ||
110 | } | ||
111 | } | ||
112 | break; | ||
113 | case ACT_TRIGGERVPN : | ||
114 | { NetworkSettingsData NS; | ||
115 | if( NS.couldBeTriggered( argv[1] ) ) { | ||
116 | // there are VPNS that can be triggered | ||
98 | QStringList S; | 117 | QStringList S; |
99 | S << QPEApplication::qpeDir() + "/bin/networksettings2"; | 118 | S << QPEApplication::qpeDir() + "bin/networksettings2"; |
100 | S << "networksettings2"; | 119 | S << "--promptvpn"; |
101 | S << "--prompt"; | ||
102 | S << argv[1]; | 120 | S << argv[1]; |
103 | NSResources->system().execAsUser( S ); | 121 | NSResources->system().execAsUser( S ); |
104 | Log(("FAILED %s-cNN-allowed\n", argv[1] )); | ||
105 | // if we come here , failed | ||
106 | printf( "%s-cNN-disallowed", argv[1] ); | ||
107 | } | 122 | } |
108 | } | 123 | } |
109 | break; | 124 | break; |
@@ -117,17 +132,18 @@ int main( int argc, char * argv[] ) { | |||
117 | case ACT_PROMPT : | 132 | case ACT_PROMPT : |
118 | { ActivateProfile AP(argv[1]); | 133 | { ActivateProfile AP(argv[1]); |
119 | if( AP.exec() == QDialog::Accepted ) { | 134 | if( AP.exec() == QDialog::Accepted ) { |
120 | Log(("%s-c%ld-allowed\n", | 135 | Log(("allow profile %ld for %s\n", |
121 | argv[1], AP.selectedProfile() )); | 136 | AP.selectedProfile(), argv[1] )); |
122 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); | 137 | printf( "A%ld%s\n", AP.selectedProfile(), argv[1] ); |
123 | } else { | 138 | } else { |
124 | Log(("%s-c%NN-disallowed\n", argv[1] )); | 139 | Log(("disallow %s\n", argv[1] )); |
125 | printf( "%s-cNN-disallowed", argv[1] ); | 140 | printf( "D-%s\n", argv[1] ); |
126 | } | 141 | } |
127 | } | 142 | } |
128 | break; | 143 | break; |
129 | case ACT_VPN : | 144 | case ACT_PROMPTVPN : |
130 | { ActivateVPN AVPN; | 145 | { ActivateVPN AVPN( argv[1] ); |
146 | Log(("Trigger vpns on interface %s\n", argv[1] )); | ||
131 | AVPN.exec(); | 147 | AVPN.exec(); |
132 | } | 148 | } |
133 | break; | 149 | break; |