Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 88 |
1 files changed, 53 insertions, 35 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 698a941..d76353a 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp @@ -118,4 +118,5 @@ void NetworkSettingsData::loadSettings( void ) { // load connections -> collections of nodes - NodeCollection * NC = new NodeCollection( TS ); - NSResources->addConnection( NC ); + bool Dangling; + NodeCollection * NC = new NodeCollection( TS, Dangling ); + NSResources->addConnection( NC, Dangling ); } else { @@ -135,4 +136,13 @@ void NetworkSettingsData::loadSettings( void ) { LeftOvers.append( Line ); + do { + Line = TS.readLine(); + // store even delimiter + LeftOvers.append( Line ); + } while ( ! Line.isEmpty() ); + + //next section + continue; } + // read entries of this section do { @@ -140,3 +150,2 @@ void NetworkSettingsData::loadSettings( void ) { - if( NN || NNI ) { if( S.isEmpty() ) { @@ -167,10 +176,2 @@ void NetworkSettingsData::loadSettings( void ) { } - } else { - LeftOvers.append( Line ); - // add empty line too as delimiter - if( S.isEmpty() ) { - // empty line - break; - } - } } while( 1 ); @@ -183,2 +184,3 @@ void NetworkSettingsData::loadSettings( void ) { } + if( NN ) { @@ -213,10 +215,4 @@ QString NetworkSettingsData::saveSettings( void ) { - // save leftovers - for ( QStringList::Iterator it = LeftOvers.begin(); - it != LeftOvers.end(); ++it ) { - TS << (*it) << endl; - } - // save global configs - for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); + for( QDictIterator<ANetNode> it( NSResources->netNodes() ); it.current(); @@ -224,3 +220,3 @@ QString NetworkSettingsData::saveSettings( void ) { TS << "[nodetype " - << quote( QString( it.current()->NetNode->name() ) ) + << quote( QString( it.current()->name() ) ) << "]" @@ -228,3 +224,3 @@ QString NetworkSettingsData::saveSettings( void ) { - it.current()->NetNode->saveAttributes( TS ); + it.current()->saveAttributes( TS ); TS << endl; @@ -232,11 +228,12 @@ QString NetworkSettingsData::saveSettings( void ) { - { Name2Connection_t & M = NSResources->connections(); - ANetNodeInstance * NNI; + // save leftovers + for ( QStringList::Iterator it = LeftOvers.begin(); + it != LeftOvers.end(); ++it ) { + TS << (*it) << endl; + } - // for all connections - for( QDictIterator<NodeCollection> it(M); - it.current(); - ++it ) { - // all nodes in those connections - for( QListIterator<ANetNodeInstance> nit(*(it.current())); + // save all netnode instances + { ANetNodeInstance * NNI; + for( QDictIterator<ANetNodeInstance> nit( + NSResources->netNodeInstances()); nit.current(); @@ -252,3 +249,23 @@ QString NetworkSettingsData::saveSettings( void ) { } + } + // good connections + { Name2Connection_t & M = NSResources->connections(); + + // for all connections + for( QDictIterator<NodeCollection> it(M); + it.current(); + ++it ) { + TS << "[connection]" << endl; + it.current()->save(TS); + } + } + + // save dangling connections + { Name2Connection_t & M = NSResources->danglingConnections(); + + // for all connections + for( QDictIterator<NodeCollection> it(M); + it.current(); + ++it ) { TS << "[connection]" << endl; @@ -291,6 +308,5 @@ QString NetworkSettingsData::generateSettings( void ) { - for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); + for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); nnit.current(); ++nnit ) { - { QStringList SL; bool FirstItem = 1; @@ -298,3 +314,5 @@ QString NetworkSettingsData::generateSettings( void ) { - CurDevNN = nnit.current()->NetNode; + CurDevNN = nnit.current(); + + { QStringList SL; SL = CurDevNN->properFiles(); @@ -397,6 +415,6 @@ QString NetworkSettingsData::generateSettings( void ) { // reset all - for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); + for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); nnit.current(); ++nnit ) { - nnit.current()->NetNode->setDone(0); + nnit.current()->setDone(0); } @@ -422,3 +440,3 @@ QString NetworkSettingsData::generateSettings( void ) { // to write data in this system file ? - for( QDictIterator<NetNode_t> nnit( NSResources->netNodes() ); + for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); ! needToGenerate && nnit.current(); @@ -426,3 +444,3 @@ QString NetworkSettingsData::generateSettings( void ) { - NN = nnit.current()->NetNode; + NN = nnit.current(); |