summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/nsdata.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp
index d709c0a..e2dd5b5 100644
--- a/noncore/settings/networksettings2/nsdata.cpp
+++ b/noncore/settings/networksettings2/nsdata.cpp
@@ -6,24 +6,31 @@
#include <qfileinfo.h>
#include "nsdata.h"
#include <asdevice.h>
#include <resources.h>
static QString CfgFile;
NetworkSettingsData::NetworkSettingsData( void ) {
// init global resources structure
new TheNSResources();
+ if( ! NSResources->userKnown() ) {
+ Log(( "Cannot detect qpe user HOME=\"%s\" USER=\"%s\"\n",
+ NSResources->currentUser().HomeDir.latin1(),
+ NSResources->currentUser().UserName.latin1() ));
+ return;
+ }
+
CfgFile.sprintf( "%s/Settings/NS2.conf",
NSResources->currentUser().HomeDir.latin1() );
Log(( "Cfg from %s\n", CfgFile.latin1() ));
// load settings
IsModified = 0;
loadSettings();
}
// saving is done by caller
NetworkSettingsData::~NetworkSettingsData( void ) {
delete NSResources;
@@ -530,25 +537,26 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
Called by the system to see if interface can be brought UP
if allowed, echo Interface-allowed else Interface-disallowed
*/
bool NetworkSettingsData::canStart( const char * Interface ) {
// load situation
NodeCollection * NC = 0;
QList<NodeCollection> PossibleConnections;
PossibleConnections = collectPossible( Interface );
- Log( ( "Possiblilies %d\n", PossibleConnections.count() ));
+ Log( ( "for %s : Possiblilies %d\n",
+ Interface, PossibleConnections.count() ));
switch( PossibleConnections.count() ) {
case 0 : // no connections
break;
case 1 : // one connection
NC = PossibleConnections.first();
break;
default : // need to ask user ?
return 1;
}
if( NC ) {
switch( NC->state() ) {
@@ -560,30 +568,32 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
// -> try others
break;
case Off :
// try to UP the device
if( ! NC->setState( Activate ) ) {
// cannot bring device Online -> try other alters
break;
}
// FT
case Available :
case IsUp : // also called for 'ifdown'
// device is ready -> done
+ Log(( "%s-c%d-allowed\n", Interface, NC->number() ));
printf( "%s-c%d-allowed\n", Interface, NC->number() );
return 0;
}
}
// if we come here no alternatives are possible
+ Log(( "%s-cnn-disallowed\n", Interface ));
printf( "%s-cnn-disallowed\n", Interface );
return 0;
}
/*
Called by the system to regenerate config files
*/
bool NetworkSettingsData::regenerate( void ) {
QString S = generateSettings();
if( ! S.isEmpty() ) {
fprintf( stdout, "%s\n", S.latin1() );