summaryrefslogtreecommitdiff
authorzecke <zecke>2004-12-20 22:27:21 (UTC)
committer zecke <zecke>2004-12-20 22:27:21 (UTC)
commit89b3fd61bdd13e62ff64bd7ab0b15c10a964b867 (patch) (side-by-side diff)
tree6cc25286965e93788e9e47b7743f2379ec328bf5
parent2be4d5bf420dc4aff71cf78601c095a96ed88c47 (diff)
downloadopie-89b3fd61bdd13e62ff64bd7ab0b15c10a964b867.zip
opie-89b3fd61bdd13e62ff64bd7ab0b15c10a964b867.tar.gz
opie-89b3fd61bdd13e62ff64bd7ab0b15c10a964b867.tar.bz2
Restore change
-QPEApplication::qpeDir() is guranteed to be '/' terminated
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
index 9004d19..18bf652 100644
--- a/noncore/settings/networksettings2/main.cpp
+++ b/noncore/settings/networksettings2/main.cpp
@@ -27,125 +27,125 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
int main( int argc, char * argv[] ) {
int rv = 0;
int Action = ACT_GUI;
// could be overruled by -qws
QApplication::Type GuiType = QApplication::GuiClient;
#ifdef _WS_QWS_
QPEApplication * TheApp;
#else
QApplication * TheApp;
#endif
for ( int i = 1; i < argc; i ++ ) {
int rmv;
rmv = 0;
if( strcmp( argv[i], "--regen" ) == 0 ) {
Action = ACT_REGEN;
GuiType = QApplication::Tty;
rmv = 1;
} else if( strcmp( argv[i], "--prompt" ) == 0 ) {
Action = ACT_PROMPT;
rmv = 1;
} else if( strcmp( argv[i], "--triggervpn" ) == 0 ) {
Action = ACT_VPN;
rmv = 1;
}
if( rmv ) {
memmove( argv+i, argv+i+rmv,
sizeof( char * ) * (argc-i-rmv) );
i --;
argc -= rmv;
}
}
if( strstr( argv[0], "-request" ) ) {
// called from system to request something
GuiType = QApplication::Tty;
Action = ACT_REQUEST;
Log(("Request : %s\n", argv[1] ));
}
// 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;
if( NS.canStart( argv[1] ) ) {
QString S;
S.sprintf( QPEApplication::qpeDir()+
- "/bin/networksettings2" );
+ "bin/networksettings2" );
char * MyArgv[4];
MyArgv[0] = "networksettings2";
MyArgv[1] = "--prompt";
MyArgv[2] = argv[1];
MyArgv[3] = NULL;
NSResources->system().execAsUser( S, MyArgv );
Log(("FAILED %s-cNN-allowed\n", argv[1] ));
// 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 ) {
Log(("%s-c%ld-allowed\n",
argv[1], AP.selectedProfile() ));
printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() );
} else {
Log(("%s-c%NN-disallowed\n", argv[1] ));
printf( "%s-cNN-disallowed", argv[1] );
}
}
break;
case ACT_VPN :
{ ActivateVPN AVPN;
AVPN.exec();
}
break;
case ACT_GUI :
{ QWidget * W = new NetworkSettings(0);
TheApp->setMainWidget( W );
W->show();
#ifdef _WS_QWS_
W->showMaximized();
#else
W->resize( W->sizeHint() );
#endif
rv = TheApp->exec();
delete W;
}
break;
}
LogClose();
return rv;
}
#endif
// main.cpp