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.cpp48
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
@@ -25,6 +25,8 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
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
@@ -58,3 +60,7 @@ int main( int argc, char * argv[] ) {
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;
@@ -97,11 +103,20 @@ int main( int argc, char * argv[] ) {
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 }
@@ -119,8 +134,8 @@ int main( int argc, char * argv[] ) {
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 }
@@ -128,4 +143,5 @@ int main( int argc, char * argv[] ) {
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();