summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/netnode.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/netnode.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnode.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp
index f8f2d1e..f00e0b3 100644
--- a/noncore/settings/networksettings2/networksettings2/netnode.cpp
+++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp
@@ -141,13 +141,17 @@ NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() {
141 IsNew = 1; 141 IsNew = 1;
142 CurrentState = Unchecked; 142 CurrentState = Unchecked;
143 AssignedInterface = 0; 143 AssignedInterface = 0;
144 Number = -1;
145 Done = 0;
144} 146}
145 147
146NodeCollection::NodeCollection( QTextStream & TS ) : 148NodeCollection::NodeCollection( QTextStream & TS, bool & Dangling ) :
147 QList<ANetNodeInstance>() { 149 QList<ANetNodeInstance>() {
148 long idx; 150 long idx;
149 bool InError = 0;
150 QString S, A, N; 151 QString S, A, N;
152
153 Number = -1;
154 Done = 0;
151 IsModified = 0; 155 IsModified = 0;
152 Index = -1; 156 Index = -1;
153 Name=""; 157 Name="";
@@ -155,13 +159,11 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
155 AssignedInterface = 0; 159 AssignedInterface = 0;
156 CurrentState = Unchecked; 160 CurrentState = Unchecked;
157 161
162 Dangling = 0; // by default node collection is ok
163
158 do { 164 do {
159 S = TS.readLine(); 165 S = TS.readLine();
160 if( S.isEmpty() ) { 166 if( S.isEmpty() ) {
161 if( InError ) {
162 // remove all nodes
163 clear();
164 }
165 // empty line 167 // empty line
166 break; 168 break;
167 } 169 }
@@ -181,11 +183,15 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
181 } else if( A == "node" ) { 183 } else if( A == "node" ) {
182 ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); 184 ANetNodeInstance * NNI = NSResources->findNodeInstance( N );
183 Log(( "Find node %s : %p\n", N.latin1(), NNI )); 185 Log(( "Find node %s : %p\n", N.latin1(), NNI ));
184 if( NNI && ! InError ) { 186 if( NNI ) {
185 append( NNI ); 187 append( NNI );
186 } else { 188 } else {
187 // could not find a node type -> collection invalid 189 // could not find a node type -> collection invalid
188 InError = 1; 190 Log(( "Node %s missing -> connection dangling\n",
191 N.latin1() ));
192 // create placeholder for this dangling NNI
193 NNI = new ErrorNNI( N );
194 Dangling = 1;
189 } 195 }
190 } 196 }
191 } while( 1 ); 197 } while( 1 );
@@ -194,7 +200,6 @@ NodeCollection::NodeCollection( QTextStream & TS ) :
194 Name.latin1(), count() )); 200 Name.latin1(), count() ));
195} 201}
196 202
197
198NodeCollection::~NodeCollection( void ) { 203NodeCollection::~NodeCollection( void ) {
199} 204}
200 205
@@ -229,11 +234,12 @@ ANetNodeInstance * NodeCollection::getToplevel( void ) {
229 it.current(); 234 it.current();
230 ++it ) { 235 ++it ) {
231 NNI = it.current(); 236 NNI = it.current();
232 if( NNI->nodeClass()->isToplevel() ) 237 if( NNI->nodeClass()->isToplevel() ) {
233 break;
234 }
235 return NNI; 238 return NNI;
236} 239}
240 }
241 return 0;
242}
237 243
238ANetNodeInstance * NodeCollection::findByName( const QString & S ) { 244ANetNodeInstance * NodeCollection::findByName( const QString & S ) {
239 ANetNodeInstance * NNI = 0; 245 ANetNodeInstance * NNI = 0;
@@ -241,11 +247,12 @@ ANetNodeInstance * NodeCollection::findByName( const QString & S ) {
241 it.current(); 247 it.current();
242 ++it ) { 248 ++it ) {
243 NNI = it.current(); 249 NNI = it.current();
244 if( NNI->name() == S ) 250 if( NNI->name() == S ) {
245 break;
246 }
247 return NNI; 251 return NNI;
248} 252}
253 }
254 return 0;
255}
249 256
250ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { 257ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) {
251 ANetNodeInstance * NNNI; 258 ANetNodeInstance * NNNI;