summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/main.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/main.cpp15
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 @@
#include "nsdata.h"
#include "activateprofile.h"
#include "networksettings.h"
+
#include <qpe/qpeapplication.h>
#include <opie/oapplicationfactory.h>
#ifdef GONE
OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
#else
// just standard GUI
#define ACT_GUI 0
// used by interfaces to request for allow of up/down
#define ACT_REQUEST 1
// regenerate config files
#define ACT_REGEN 2
// used by interfaces to request user prompt
#define ACT_PROMPT 3
int main( int argc, char * argv[] ) {
int rv = 0;
int Action = ACT_GUI;
// could be overruled by -qws
QApplication::Type GuiType = QApplication::GuiClient;
@@ -55,49 +56,61 @@ int main( int argc, char * argv[] ) {
// called from system to request something
GuiType = QApplication::Tty;
Action = ACT_REQUEST;
}
// Start Qt
#ifdef _WS_QWS_
// because QPEApplication does not handle GuiType well
if( GuiType == QApplication::Tty ) {
// this cast is NOT correct but we do not use
// TheApp anymore ...
TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType );
} else {
TheApp = new QPEApplication( argc, argv, GuiType );
}
#else
TheApp = new QApplication( argc, argv, GuiType );
#endif
// init qt with app widget
switch( Action ) {
case ACT_REQUEST :
{ NetworkSettingsData NS;
- NS.canStart( argv[1] );
+ if( NS.canStart( argv[1] ) ) {
+ QString S;
+ S.sprintf( QPEApplication::qpeDir()+
+ "/bin/networksettings2" );
+ char * MyArgv[4];
+ MyArgv[0] = "networksettings2";
+ MyArgv[1] = "--prompt";
+ MyArgv[2] = argv[1];
+ MyArgv[3] = NULL;
+ NSResources->system().execAsUser( S, MyArgv );
+ // if we come here , failed
+ printf( "%s-cNN-disallowed", argv[1] );
+ }
}
break;
case ACT_REGEN :
{ NetworkSettingsData NS;
// regen returns 0 if OK
rv = (NS.regenerate()) ? 1 : 0;
}
break;
case ACT_PROMPT :
{ ActivateProfile AP(argv[1]);
if( AP.exec() == QDialog::Accepted ) {
printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() );
} else {
printf( "%s-cNN-disallowed", argv[1] );
}
}
break;
case ACT_GUI :
{ QWidget * W = new NetworkSettings(0);
TheApp->setMainWidget( W );
W->show();
#ifdef _WS_QWS_
W->showMaximized();
#else