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(), | |||
47 | 47 | ||
48 | const char * Provides = InnerIt.current()->NetNode->provides(); | 48 | const char ** Provides = InnerIt.current()->NetNode->provides(); |
49 | NeedsRun = OuterIt.current()->NetNode->needs(); | 49 | NeedsRun = OuterIt.current()->NetNode->needs(); |
50 | |||
50 | for( ; *NeedsRun; NeedsRun ++ ) { | 51 | for( ; *NeedsRun; NeedsRun ++ ) { |
51 | if( strcmp( Provides, *NeedsRun ) == 0 ) { | 52 | const char ** PRun; |
53 | PRun = Provides; | ||
54 | for( ; *PRun; PRun ++ ) { | ||
55 | if( strcmp( *PRun, *NeedsRun ) == 0 ) { | ||
52 | // inner provides what outer needs | 56 | // inner provides what outer needs |
@@ -59,2 +63,3 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | |||
59 | } | 63 | } |
64 | } | ||
60 | OuterIt.current()->NetNode->setAlternatives( NNLP ); | 65 | OuterIt.current()->NetNode->setAlternatives( NNLP ); |
@@ -63,19 +68,13 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | |||
63 | 68 | ||
64 | // define Node types to Description map | 69 | // define built in Node types to Description map |
65 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); | 70 | addNodeType( "device", tr( "Network Device" ), |
66 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); | ||
67 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); | ||
68 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); | ||
69 | |||
70 | NodeTypeDescriptionMap.insert( "device", | ||
71 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 71 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
72 | NodeTypeDescriptionMap.insert( "line", | 72 | addNodeType( "line", tr( "Character device" ), |
73 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 73 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
74 | NodeTypeDescriptionMap.insert( "connection", | 74 | addNodeType( "connection", tr( "IP Connection" ), |
75 | tr( "<p>Nodes that provide working IP connections</p>" ) ); | 75 | tr( "<p>Nodes that provide working IP connections</p>" ) ); |
76 | NodeTypeDescriptionMap.insert( "fullsetup", | 76 | addNodeType( "fullsetup", tr( "Connection Profile" ), |
77 | tr( "<p>Fully configured connection profile</p>" ) ); | 77 | tr( "<p>Fully configured connection profile</p>" ) ); |
78 | 78 | addNodeType( "GPRS", tr( "Connection to GPRS device" ), | |
79 | // define system files | 79 | tr( "<p>Connection to a GPRS capable device</p>" ) ); |
80 | addSystemFile( "interfaces", "/tmp/interfaces", 1 ); | ||
81 | 80 | ||
@@ -90,2 +89,11 @@ TheNSResources::~TheNSResources( void ) { | |||
90 | 89 | ||
90 | void TheNSResources::addNodeType( const QString & ID, | ||
91 | const QString & Name, | ||
92 | const QString & Descr ) { | ||
93 | if( NodeTypeNameMap[ID].isEmpty() ) { | ||
94 | NodeTypeNameMap.insert( ID, Name ); | ||
95 | NodeTypeDescriptionMap.insert( ID, Descr ); | ||
96 | } | ||
97 | } | ||
98 | |||
91 | void TheNSResources::addSystemFile( const QString & ID, | 99 | void TheNSResources::addSystemFile( const QString & ID, |
@@ -222,4 +230,6 @@ QPixmap TheNSResources::getPixmap( const QString & QS ) { | |||
222 | S += QS; | 230 | S += QS; |
223 | Log(("%s\n", S.latin1() )); | ||
224 | P = Resource::loadPixmap( S ); | 231 | P = Resource::loadPixmap( S ); |
232 | if( P.isNull() ) { | ||
233 | Log(( "Cannot load %s\n", S.latin1() )); | ||
234 | } | ||
225 | return ( P.isNull() ) ? QPixmap() : P; | 235 | return ( P.isNull() ) ? QPixmap() : P; |
@@ -271,2 +281,12 @@ NodeCollection * TheNSResources::findConnection( const QString & S ) { | |||
271 | 281 | ||
282 | NodeCollection * TheNSResources::getConnection( int nr ) { | ||
283 | for( QDictIterator<NodeCollection> it(ConnectionsMap); | ||
284 | it.current(); | ||
285 | ++it ) { | ||
286 | if( it.current()->number() == nr ) { | ||
287 | return it.current(); | ||
288 | } | ||
289 | } | ||
290 | return 0; | ||
291 | } | ||
272 | /* | 292 | /* |