Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/resources.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/resources.cpp | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 2f17693..8b3b4fe 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp @@ -47,6 +47,10 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), - const char * Provides = InnerIt.current()->NetNode->provides(); + const char ** Provides = InnerIt.current()->NetNode->provides(); NeedsRun = OuterIt.current()->NetNode->needs(); + for( ; *NeedsRun; NeedsRun ++ ) { - if( strcmp( Provides, *NeedsRun ) == 0 ) { + const char ** PRun; + PRun = Provides; + for( ; *PRun; PRun ++ ) { + if( strcmp( *PRun, *NeedsRun ) == 0 ) { // inner provides what outer needs @@ -59,2 +63,3 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), } + } OuterIt.current()->NetNode->setAlternatives( NNLP ); @@ -63,19 +68,13 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), - // define Node types to Description map - NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); - NodeTypeNameMap.insert( "line", tr( "Character device" ) ); - NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); - NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); - - NodeTypeDescriptionMap.insert( "device", + // define built in Node types to Description map + addNodeType( "device", tr( "Network Device" ), tr( "<p>Devices that can handle IP packets</p>" ) ); - NodeTypeDescriptionMap.insert( "line", + addNodeType( "line", tr( "Character device" ), tr( "<p>Devices that can handle single bytes</p>" ) ); - NodeTypeDescriptionMap.insert( "connection", + addNodeType( "connection", tr( "IP Connection" ), tr( "<p>Nodes that provide working IP connections</p>" ) ); - NodeTypeDescriptionMap.insert( "fullsetup", + addNodeType( "fullsetup", tr( "Connection Profile" ), tr( "<p>Fully configured connection profile</p>" ) ); - - // define system files - addSystemFile( "interfaces", "/tmp/interfaces", 1 ); + addNodeType( "GPRS", tr( "Connection to GPRS device" ), + tr( "<p>Connection to a GPRS capable device</p>" ) ); @@ -90,2 +89,11 @@ TheNSResources::~TheNSResources( void ) { +void TheNSResources::addNodeType( const QString & ID, + const QString & Name, + const QString & Descr ) { + if( NodeTypeNameMap[ID].isEmpty() ) { + NodeTypeNameMap.insert( ID, Name ); + NodeTypeDescriptionMap.insert( ID, Descr ); + } +} + void TheNSResources::addSystemFile( const QString & ID, @@ -222,4 +230,6 @@ QPixmap TheNSResources::getPixmap( const QString & QS ) { S += QS; - Log(("%s\n", S.latin1() )); P = Resource::loadPixmap( S ); + if( P.isNull() ) { + Log(( "Cannot load %s\n", S.latin1() )); + } return ( P.isNull() ) ? QPixmap() : P; @@ -271,2 +281,12 @@ NodeCollection * TheNSResources::findConnection( const QString & S ) { +NodeCollection * TheNSResources::getConnection( int nr ) { + for( QDictIterator<NodeCollection> it(ConnectionsMap); + it.current(); + ++it ) { + if( it.current()->number() == nr ) { + return it.current(); + } + } + return 0; +} /* |