summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/resources.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/resources.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp102
1 files changed, 88 insertions, 14 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp
index c95ac7f..71e84cd 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.cpp
+++ b/noncore/settings/networksettings2/networksettings2/resources.cpp
@@ -25,2 +25,4 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
+ detectCurrentUser();
+
// load available netnodes
@@ -82,3 +84,2 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
- detectCurrentUser();
}
@@ -89,2 +90,13 @@ TheNSResources::~TheNSResources( void ) {
+void TheNSResources::busy( bool B ) {
+/*
+ if( B ) {
+ ShowWait->show();
+ qApp->process
+ } else {
+ ShowWait->hide();
+ }
+*/
+}
+
/**
@@ -96,2 +108,3 @@ void TheNSResources::findAvailableNetNodes(const QString &path){
+ Log(("Locate plugins in %s\n", path.latin1() ));
QDir d(path);
@@ -129,2 +142,23 @@ void TheNSResources::findAvailableNetNodes(const QString &path){
+// used to find unique connection number
+int TheNSResources::assignConnectionNumber( void ) {
+ bool found = 1;
+ for( int trial = 0; ; trial ++ ) {
+ found = 1;
+ for( QDictIterator<NodeCollection> it(ConnectionsMap);
+ it.current();
+ ++it ) {
+ if( it.current()->number() == trial ) {
+ found = 0;
+ break;
+ }
+ }
+
+ if( found ) {
+ Log(("Assign profile number %d\n", trial ));
+ return trial;
+ }
+ }
+}
+
/**
@@ -169,3 +203,2 @@ bool TheNSResources::loadNetNode(
// store mapping
- printf( "Store %s\n", NN->NetNode->name() );
AllNodeTypes.insert( NN->NetNode->name(), NN );
@@ -177,6 +210,8 @@ bool TheNSResources::loadNetNode(
QPixmap TheNSResources::getPixmap( const QString & QS ) {
+ QPixmap P;
QString S("networksettings2/");
S += QS;
- fprintf( stderr, "%s\n", S.latin1() );
- return Resource::loadPixmap( S );
+ Log(("%s\n", S.latin1() ));
+ P = Resource::loadPixmap( S );
+ return ( P.isNull() ) ? QPixmap() : P;
}
@@ -227,2 +262,3 @@ NodeCollection * TheNSResources::findConnection( const QString & S ) {
+/*
void TheNSResources::renumberConnections( void ) {
@@ -241,2 +277,3 @@ void TheNSResources::renumberConnections( void ) {
}
+*/
@@ -265,6 +302,7 @@ void TheNSResources::detectCurrentUser( void ) {
- // open proc dir and find all dirs in it
- { QRegExp R("[0-9]+");
+ if( getenv( "OPIEDIR" ) == 0 ) {
+ // nothing known
+ { // open proc dir and find all dirs in it
+ QRegExp R("[0-9]+");
QDir ProcDir( "/proc" );
- QString QPELoc = QPEApplication::qpeDir() + "bin/qpe";
QFileInfo FI;
@@ -280,5 +318,5 @@ void TheNSResources::detectCurrentUser( void ) {
FI.setFile( S );
- // get the linke
+ // get the link
S = FI.readLink();
- if( S == QPELoc ) {
+ if( S.right( 8 ) == "/bin/qpe" ) {
// found running qpe
@@ -293,3 +331,3 @@ void TheNSResources::detectCurrentUser( void ) {
// could not find qpe
- fprintf( stderr, "Could not find qpe\n" );
+ Log(("Could not find qpe\n" ));
return;
@@ -306,4 +344,4 @@ void TheNSResources::detectCurrentUser( void ) {
if( fd < 0 ) {
- fprintf( stderr, "Could not open %s : %d\n",
- QPEEnvFile.latin1(), errno );
+ Log(("Could not open %s : %d\n",
+ QPEEnvFile.latin1(), errno ));
return;
@@ -339,2 +377,7 @@ void TheNSResources::detectCurrentUser( void ) {
strdup( Data );
+ // put OPIEDIR in env
+ if( strcmp( Run->Name, "OPIEDIR=" ) == 0 ) {
+ putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] );
+
+ }
break;
@@ -358,4 +401,4 @@ void TheNSResources::detectCurrentUser( void ) {
pwdres == 0 ) {
- fprintf( stderr, "Could not determine user %s : %d\n",
- CurrentUser.UserName.latin1(), errno );
+ Log(("Could not determine user %s : %d\n",
+ CurrentUser.UserName.latin1(), errno ));
return;
@@ -369,2 +412,33 @@ void TheNSResources::detectCurrentUser( void ) {
}
+
+ } else {
+ CurrentUser.UserName = getenv( "LOGNAME" );
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] =
+ strdup( CurrentUser.UserName );
+
+ CurrentUser.HomeDir = getenv( "HOME" );
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] =
+ strdup( CurrentUser.HomeDir );
+
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = getenv("USER");
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = getenv("LD_LIBRARY_PATH");
+
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = getenv("PATH");
+
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = getenv("QTDIR");
+
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = getenv("OPIEDIR");
+ CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
+ CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = getenv("SHELL");
+
+ CurrentUser.Uid = getuid();
+ CurrentUser.Gid = getgid();
+ }
}