Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 39031ed..b4622fc 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -41,32 +41,32 @@ NetworkSettingsData::NetworkSettingsData( void ) { | |||
41 | 41 | ||
42 | Log(( "System reports %d interfaces. Found %d up\n", | 42 | Log(( "System reports %d interfaces. Found %d up\n", |
43 | NSResources->system().interfaces().count(), | 43 | NSResources->system().interfaces().count(), |
44 | SL.count() )); | 44 | SL.count() )); |
45 | 45 | ||
46 | for ( QStringList::Iterator it = SL.begin(); | 46 | for ( QStringList::Iterator it = SL.begin(); |
47 | it != SL.end(); | 47 | it != SL.end(); |
48 | ++it ) { | 48 | ++it ) { |
49 | profilenr = atol( (*it).mid( 8 ).latin1() ); | 49 | profilenr = atol( (*it).mid( 8 ).latin1() ); |
50 | // read the interface store int 'up' | 50 | // read the interface store int 'up' |
51 | F->setName( D.path() + "/" + (*it) ); | 51 | F->setName( D.path() + "/" + (*it) ); |
52 | if( F->open( IO_ReadOnly ) ) { | 52 | if( F->open( IO_ReadOnly ) ) { |
53 | NodeCollection * NC; | 53 | NetworkSetup * NC; |
54 | interfacename = TS.readLine(); | 54 | interfacename = TS.readLine(); |
55 | F->close(); | 55 | F->close(); |
56 | 56 | ||
57 | Log(( "Assign interface %s to Profile nr %d\n", | 57 | Log(( "Assign interface %s to Profile nr %d\n", |
58 | interfacename.latin1(), profilenr )); | 58 | interfacename.latin1(), profilenr )); |
59 | 59 | ||
60 | NC = NSResources->getConnection( profilenr ); | 60 | NC = NSResources->getNetworkSetup( profilenr ); |
61 | if( NC ) { | 61 | if( NC ) { |
62 | NC->assignInterface( | 62 | NC->assignInterface( |
63 | NSResources->system().findInterface( interfacename ) ); | 63 | NSResources->system().findInterface( interfacename ) ); |
64 | Log(( "Assign interface %p\n", | 64 | Log(( "Assign interface %p\n", |
65 | NC->assignedInterface() )); | 65 | NC->assignedInterface() )); |
66 | } else { | 66 | } else { |
67 | Log(( "Profile nr %d no longer defined\n", | 67 | Log(( "Profile nr %d no longer defined\n", |
68 | profilenr )); | 68 | profilenr )); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
@@ -90,46 +90,46 @@ void NetworkSettingsData::loadSettings( void ) { | |||
90 | do { | 90 | do { |
91 | 91 | ||
92 | if( ! F.open(IO_ReadOnly) ) | 92 | if( ! F.open(IO_ReadOnly) ) |
93 | break; | 93 | break; |
94 | 94 | ||
95 | /* load the file -> | 95 | /* load the file -> |
96 | 96 | ||
97 | FORMAT : | 97 | FORMAT : |
98 | 98 | ||
99 | [NETNODETYPE] | 99 | [NETNODETYPE] |
100 | Entries ... | 100 | Entries ... |
101 | <EMPTYLINE> | 101 | <EMPTYLINE> |
102 | [connection] | 102 | [NetworkSetup] |
103 | Name=Name | 103 | Name=Name |
104 | Node=Name | 104 | Node=Name |
105 | <EMPTYLINE> | 105 | <EMPTYLINE> |
106 | */ | 106 | */ |
107 | while( ! TS.atEnd() ) { | 107 | while( ! TS.atEnd() ) { |
108 | S = Line = TS.readLine(); | 108 | S = Line = TS.readLine(); |
109 | 109 | ||
110 | if ( S.isEmpty() || S[0] != '[' ) | 110 | if ( S.isEmpty() || S[0] != '[' ) |
111 | continue; | 111 | continue; |
112 | 112 | ||
113 | S = S.mid( 1, S.length()-2 ); | 113 | S = S.mid( 1, S.length()-2 ); |
114 | 114 | ||
115 | if( ! NSResources ) { | 115 | if( ! NSResources ) { |
116 | continue; | 116 | continue; |
117 | } | 117 | } |
118 | 118 | ||
119 | if( S == "connection" ) { | 119 | if( S == "NetworkSetup" ) { |
120 | // load connections -> collections of nodes | 120 | // load NetworkSetups -> collections of nodes |
121 | bool Dangling; | 121 | bool Dangling; |
122 | NodeCollection * NC = new NodeCollection( TS, Dangling ); | 122 | NetworkSetup * NC = new NetworkSetup( TS, Dangling ); |
123 | NSResources->addConnection( NC, Dangling ); | 123 | NSResources->addNetworkSetup( NC, Dangling ); |
124 | } else { | 124 | } else { |
125 | ANetNode * NN = 0; | 125 | ANetNode * NN = 0; |
126 | ANetNodeInstance* NNI = 0; | 126 | ANetNodeInstance* NNI = 0; |
127 | if( S.startsWith( "nodetype " ) ) { | 127 | if( S.startsWith( "nodetype " ) ) { |
128 | S = S.mid( 9, S.length()-9 ); | 128 | S = S.mid( 9, S.length()-9 ); |
129 | S = deQuote(S); | 129 | S = deQuote(S); |
130 | // try to find netnode | 130 | // try to find netnode |
131 | NN = NSResources->findNetNode( S ); | 131 | NN = NSResources->findNetNode( S ); |
132 | } else { | 132 | } else { |
133 | // try to find instance | 133 | // try to find instance |
134 | NNI = NSResources->createNodeInstance( S ); | 134 | NNI = NSResources->createNodeInstance( S ); |
135 | } | 135 | } |
@@ -242,70 +242,70 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
242 | ++nit ) { | 242 | ++nit ) { |
243 | // header | 243 | // header |
244 | NNI = nit.current(); | 244 | NNI = nit.current(); |
245 | TS << '[' | 245 | TS << '[' |
246 | << QString(NNI->nodeClass()->name()) | 246 | << QString(NNI->nodeClass()->name()) |
247 | << ']' | 247 | << ']' |
248 | << endl; | 248 | << endl; |
249 | NNI->saveAttributes( TS ); | 249 | NNI->saveAttributes( TS ); |
250 | TS << endl; | 250 | TS << endl; |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | // good connections | 254 | // good NetworkSetups |
255 | { Name2Connection_t & M = NSResources->connections(); | 255 | { Name2NetworkSetup_t & M = NSResources->networkSetups(); |
256 | 256 | ||
257 | // for all connections | 257 | // for all NetworkSetups |
258 | for( QDictIterator<NodeCollection> it(M); | 258 | for( QDictIterator<NetworkSetup> it(M); |
259 | it.current(); | 259 | it.current(); |
260 | ++it ) { | 260 | ++it ) { |
261 | TS << "[connection]" << endl; | 261 | TS << "[NetworkSetup]" << endl; |
262 | it.current()->save(TS); | 262 | it.current()->save(TS); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | // save dangling connections | 266 | // save dangling NetworkSetups |
267 | { Name2Connection_t & M = NSResources->danglingConnections(); | 267 | { Name2NetworkSetup_t & M = NSResources->danglingNetworkSetups(); |
268 | 268 | ||
269 | // for all connections | 269 | // for all NetworkSetups |
270 | for( QDictIterator<NodeCollection> it(M); | 270 | for( QDictIterator<NetworkSetup> it(M); |
271 | it.current(); | 271 | it.current(); |
272 | ++it ) { | 272 | ++it ) { |
273 | TS << "[connection]" << endl; | 273 | TS << "[NetworkSetup]" << endl; |
274 | it.current()->save(TS); | 274 | it.current()->save(TS); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | QDir D("."); | 278 | QDir D("."); |
279 | D.rename( CfgFile + ".bup", CfgFile ); | 279 | D.rename( CfgFile + ".bup", CfgFile ); |
280 | 280 | ||
281 | // | 281 | // |
282 | // proper files AND system files regenerated | 282 | // proper files AND system files regenerated |
283 | // | 283 | // |
284 | 284 | ||
285 | 285 | ||
286 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | 286 | for( QDictIterator<NetworkSetup> it(NSResources->networkSetups()); |
287 | it.current(); | 287 | it.current(); |
288 | ++it ) { | 288 | ++it ) { |
289 | it.current()->setModified( 0 ); | 289 | it.current()->setModified( 0 ); |
290 | } | 290 | } |
291 | 291 | ||
292 | return ErrS; | 292 | return ErrS; |
293 | } | 293 | } |
294 | 294 | ||
295 | QString NetworkSettingsData::generateSettings( void ) { | 295 | QString NetworkSettingsData::generateSettings( void ) { |
296 | QString S = ""; | 296 | QString S = ""; |
297 | Name2SystemFile_t & SFM = NSResources->systemFiles(); | 297 | Name2SystemFile_t & SFM = NSResources->systemFiles(); |
298 | Name2Connection_t & M = NSResources->connections(); | 298 | Name2NetworkSetup_t & M = NSResources->networkSetups(); |
299 | NodeCollection * NC; | 299 | NetworkSetup * NC; |
300 | ANetNodeInstance * NNI; | 300 | ANetNodeInstance * NNI; |
301 | ANetNodeInstance * FirstWithData; | 301 | ANetNodeInstance * FirstWithData; |
302 | RuntimeInfo * CurDev; | 302 | RuntimeInfo * CurDev; |
303 | ANetNode * NN, * CurDevNN = 0; | 303 | ANetNode * NN, * CurDevNN = 0; |
304 | long NoOfDevs; | 304 | long NoOfDevs; |
305 | long DevCtStart; | 305 | long DevCtStart; |
306 | bool needToGenerate; | 306 | bool needToGenerate; |
307 | 307 | ||
308 | // regenerate system files | 308 | // regenerate system files |
309 | Log( ( "Generating settings from %s\n", CfgFile.latin1() )); | 309 | Log( ( "Generating settings from %s\n", CfgFile.latin1() )); |
310 | 310 | ||
311 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); | 311 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); |
@@ -419,25 +419,25 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
419 | nnit.current(); | 419 | nnit.current(); |
420 | ++nnit ) { | 420 | ++nnit ) { |
421 | nnit.current()->setDone(0); | 421 | nnit.current()->setDone(0); |
422 | } | 422 | } |
423 | 423 | ||
424 | for( QDictIterator<ANetNodeInstance> nniit( | 424 | for( QDictIterator<ANetNodeInstance> nniit( |
425 | NSResources->netNodeInstances() ); | 425 | NSResources->netNodeInstances() ); |
426 | nniit.current(); | 426 | nniit.current(); |
427 | ++nniit ) { | 427 | ++nniit ) { |
428 | nniit.current()->setDone(0); | 428 | nniit.current()->setDone(0); |
429 | } | 429 | } |
430 | 430 | ||
431 | for( QDictIterator<NodeCollection> ncit(M); | 431 | for( QDictIterator<NetworkSetup> ncit(M); |
432 | ncit.current(); | 432 | ncit.current(); |
433 | ++ncit ) { | 433 | ++ncit ) { |
434 | ncit.current()->setDone(0); | 434 | ncit.current()->setDone(0); |
435 | } | 435 | } |
436 | 436 | ||
437 | Log( ( "Generating system file %s\n", SF->name().latin1() )); | 437 | Log( ( "Generating system file %s\n", SF->name().latin1() )); |
438 | 438 | ||
439 | needToGenerate = 0; | 439 | needToGenerate = 0; |
440 | 440 | ||
441 | // are there netnodes that have instances and need | 441 | // are there netnodes that have instances and need |
442 | // to write data in this system file ? | 442 | // to write data in this system file ? |
443 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); | 443 | for( QDictIterator<ANetNode> nnit( NSResources->netNodes() ); |
@@ -479,47 +479,47 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
479 | arg( SF->name() ); | 479 | arg( SF->name() ); |
480 | return S; | 480 | return S; |
481 | } | 481 | } |
482 | 482 | ||
483 | // global presection for this system file | 483 | // global presection for this system file |
484 | if( ! SF->preSection() ) { | 484 | if( ! SF->preSection() ) { |
485 | S = qApp->translate( "NetworkSettings", | 485 | S = qApp->translate( "NetworkSettings", |
486 | "<p>Error in section \"Preamble\" for file \"%1\"</p>" ). | 486 | "<p>Error in section \"Preamble\" for file \"%1\"</p>" ). |
487 | arg( SF->name() ); | 487 | arg( SF->name() ); |
488 | return S; | 488 | return S; |
489 | } | 489 | } |
490 | 490 | ||
491 | // find connections that want to write to this file | 491 | // find NetworkSetups that want to write to this file |
492 | for( QDictIterator<NodeCollection> ncit(M); | 492 | for( QDictIterator<NetworkSetup> ncit(M); |
493 | ncit.current(); | 493 | ncit.current(); |
494 | ++ncit ) { | 494 | ++ncit ) { |
495 | 495 | ||
496 | NC = ncit.current(); | 496 | NC = ncit.current(); |
497 | 497 | ||
498 | if( NC->done() ) { | 498 | if( NC->done() ) { |
499 | // already done | 499 | // already done |
500 | continue; | 500 | continue; |
501 | } | 501 | } |
502 | 502 | ||
503 | if( ! NC->hasDataForFile( *SF ) ) { | 503 | if( ! NC->hasDataForFile( *SF ) ) { |
504 | // no data | 504 | // no data |
505 | continue; | 505 | continue; |
506 | } | 506 | } |
507 | 507 | ||
508 | Log(("Generating %s for connection %s\n", | 508 | Log(("Generating %s for NetworkSetup %s\n", |
509 | SF->name().latin1(), NC->name().latin1() )); | 509 | SF->name().latin1(), NC->name().latin1() )); |
510 | // find highest item that wants to write data to this file | 510 | // find highest item that wants to write data to this file |
511 | FirstWithData = NC->firstWithDataForFile( *SF ); | 511 | FirstWithData = NC->firstWithDataForFile( *SF ); |
512 | 512 | ||
513 | // find device on which this connection works | 513 | // find device on which this NetworkSetup works |
514 | CurDev = NC->device(); | 514 | CurDev = NC->device(); |
515 | // class of that node | 515 | // class of that node |
516 | CurDevNN = CurDev->netNode()->nodeClass(); | 516 | CurDevNN = CurDev->netNode()->nodeClass(); |
517 | 517 | ||
518 | if( ! FirstWithData->nodeClass()->done() ) { | 518 | if( ! FirstWithData->nodeClass()->done() ) { |
519 | // generate fixed part | 519 | // generate fixed part |
520 | if( ! SF->preDeviceSection( CurDevNN ) ) { | 520 | if( ! SF->preDeviceSection( CurDevNN ) ) { |
521 | S = qApp->translate( "NetworkSettings", | 521 | S = qApp->translate( "NetworkSettings", |
522 | "<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ). | 522 | "<p>Error in section \"Pre-Device\" for file \"%1\"</p>" ). |
523 | arg( SF->name() ); | 523 | arg( SF->name() ); |
524 | return S; | 524 | return S; |
525 | } | 525 | } |
@@ -562,35 +562,35 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
562 | return S; | 562 | return S; |
563 | } | 563 | } |
564 | } | 564 | } |
565 | CurDev->netNode()->nodeClass()->setDone( 1 ); | 565 | CurDev->netNode()->nodeClass()->setDone( 1 ); |
566 | 566 | ||
567 | Log(( "Systemfile %s for Nodeclass %s is done\n", | 567 | Log(( "Systemfile %s for Nodeclass %s is done\n", |
568 | SF->name().latin1(), | 568 | SF->name().latin1(), |
569 | CurDev->netNode()->nodeClass()->name() | 569 | CurDev->netNode()->nodeClass()->name() |
570 | )); | 570 | )); |
571 | } | 571 | } |
572 | 572 | ||
573 | // generate profile specific info | 573 | // generate profile specific info |
574 | // for all nodeconnections that work on the same device | 574 | // for all nodeNetworkSetups that work on the same device |
575 | for( QDictIterator<NodeCollection> ncit2(M); | 575 | for( QDictIterator<NetworkSetup> ncit2(M); |
576 | ncit2.current(); | 576 | ncit2.current(); |
577 | ++ncit2 ) { | 577 | ++ncit2 ) { |
578 | 578 | ||
579 | if( ncit2.current()->device() != CurDev ) { | 579 | if( ncit2.current()->device() != CurDev ) { |
580 | // different device | 580 | // different device |
581 | continue; | 581 | continue; |
582 | } | 582 | } |
583 | 583 | ||
584 | Log(("Connection %s of family %s\n", | 584 | Log(("NetworkSetup %s of family %s\n", |
585 | ncit2.current()->name().latin1(), | 585 | ncit2.current()->name().latin1(), |
586 | CurDev->name() )); | 586 | CurDev->name() )); |
587 | // generate | 587 | // generate |
588 | NNI = ncit2.current()->firstWithDataForFile( *SF ); | 588 | NNI = ncit2.current()->firstWithDataForFile( *SF ); |
589 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { | 589 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { |
590 | if( ! SF->preNodeSection( NNI, i ) ) { | 590 | if( ! SF->preNodeSection( NNI, i ) ) { |
591 | S = qApp->translate( "NetworkSettings", | 591 | S = qApp->translate( "NetworkSettings", |
592 | "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ). | 592 | "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ). |
593 | arg( SF->name() ). | 593 | arg( SF->name() ). |
594 | arg( CurDevNN->name() ); | 594 | arg( CurDevNN->name() ); |
595 | return S; | 595 | return S; |
596 | } | 596 | } |
@@ -636,70 +636,70 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
636 | S = qApp->translate( "NetworkSettings", | 636 | S = qApp->translate( "NetworkSettings", |
637 | "<p>Error in section \"Closure\" for file \"%1\"</p>" ). | 637 | "<p>Error in section \"Closure\" for file \"%1\"</p>" ). |
638 | arg( SF->name() ); | 638 | arg( SF->name() ); |
639 | return S; | 639 | return S; |
640 | } | 640 | } |
641 | 641 | ||
642 | // end of file | 642 | // end of file |
643 | SF->close(); | 643 | SF->close(); |
644 | } | 644 | } |
645 | return S; | 645 | return S; |
646 | } | 646 | } |
647 | 647 | ||
648 | QList<NodeCollection> NetworkSettingsData::collectPossible( | 648 | QList<NetworkSetup> NetworkSettingsData::collectPossible( |
649 | const QString & Interface ) { | 649 | const QString & Interface ) { |
650 | // collect connections that can work on top of this interface | 650 | // collect NetworkSetups that can work on top of this interface |
651 | NodeCollection * NC; | 651 | NetworkSetup * NC; |
652 | QList<NodeCollection> PossibleConnections; | 652 | QList<NetworkSetup> PossibleNetworkSetups; |
653 | Name2Connection_t & M = NSResources->connections(); | 653 | Name2NetworkSetup_t & M = NSResources->networkSetups(); |
654 | 654 | ||
655 | // for all connections | 655 | // for all NetworkSetups |
656 | for( QDictIterator<NodeCollection> it(M); | 656 | for( QDictIterator<NetworkSetup> it(M); |
657 | it.current(); | 657 | it.current(); |
658 | ++it ) { | 658 | ++it ) { |
659 | NC = it.current(); | 659 | NC = it.current(); |
660 | // check if this profile handles the requested interface | 660 | // check if this profile handles the requested interface |
661 | if( NC->handlesInterface( Interface ) && // if different Intf. | 661 | if( NC->handlesInterface( Interface ) && // if different Intf. |
662 | NC->state() != Disabled && // if enabled | 662 | NC->state() != Disabled && // if enabled |
663 | NC->state() != IsUp // if already used | 663 | NC->state() != IsUp // if already used |
664 | ) { | 664 | ) { |
665 | Log( ( "Append %s for %s\n", | 665 | Log( ( "Append %s for %s\n", |
666 | NC->name().latin1(), Interface.latin1() )); | 666 | NC->name().latin1(), Interface.latin1() )); |
667 | PossibleConnections.append( NC ); | 667 | PossibleNetworkSetups.append( NC ); |
668 | } | 668 | } |
669 | } | 669 | } |
670 | return PossibleConnections; | 670 | return PossibleNetworkSetups; |
671 | } | 671 | } |
672 | 672 | ||
673 | 673 | ||
674 | /* | 674 | /* |
675 | Called by the system to see if interface can be brought UP | 675 | Called by the system to see if interface can be brought UP |
676 | 676 | ||
677 | if allowed, echo Interface-allowed else Interface-disallowed | 677 | if allowed, echo Interface-allowed else Interface-disallowed |
678 | */ | 678 | */ |
679 | 679 | ||
680 | bool NetworkSettingsData::canStart( const QString & Interface ) { | 680 | bool NetworkSettingsData::canStart( const QString & Interface ) { |
681 | // load situation | 681 | // load situation |
682 | NodeCollection * NC = 0; | 682 | NetworkSetup * NC = 0; |
683 | QList<NodeCollection> PossibleConnections; | 683 | QList<NetworkSetup> PossibleNetworkSetups; |
684 | 684 | ||
685 | PossibleConnections = collectPossible( Interface ); | 685 | PossibleNetworkSetups = collectPossible( Interface ); |
686 | 686 | ||
687 | Log( ( "for %s : Possiblilies %d\n", | 687 | Log( ( "for %s : Possiblilies %d\n", |
688 | Interface.latin1(), PossibleConnections.count() )); | 688 | Interface.latin1(), PossibleNetworkSetups.count() )); |
689 | switch( PossibleConnections.count() ) { | 689 | switch( PossibleNetworkSetups.count() ) { |
690 | case 0 : // no connections | 690 | case 0 : // no NetworkSetups |
691 | break; | 691 | break; |
692 | case 1 : // one connection | 692 | case 1 : // one NetworkSetup |
693 | NC = PossibleConnections.first(); | 693 | NC = PossibleNetworkSetups.first(); |
694 | break; | 694 | break; |
695 | default : // need to ask user ? | 695 | default : // need to ask user ? |
696 | return 1; | 696 | return 1; |
697 | } | 697 | } |
698 | 698 | ||
699 | if( NC ) { | 699 | if( NC ) { |
700 | switch( NC->state() ) { | 700 | switch( NC->state() ) { |
701 | case Unchecked : | 701 | case Unchecked : |
702 | case Unknown : | 702 | case Unknown : |
703 | case Unavailable : | 703 | case Unavailable : |
704 | case Disabled : | 704 | case Disabled : |
705 | // this profile does not allow interface to be UP | 705 | // this profile does not allow interface to be UP |
@@ -727,57 +727,57 @@ bool NetworkSettingsData::canStart( const QString & Interface ) { | |||
727 | } | 727 | } |
728 | 728 | ||
729 | // if we come here no alternatives are possible | 729 | // if we come here no alternatives are possible |
730 | Log(( "disallow %s\n", Interface.latin1())); | 730 | Log(( "disallow %s\n", Interface.latin1())); |
731 | printf( "D-%s\n", Interface.latin1() ); | 731 | printf( "D-%s\n", Interface.latin1() ); |
732 | return 0; | 732 | return 0; |
733 | } | 733 | } |
734 | 734 | ||
735 | bool NetworkSettingsData::isModified( void ) { | 735 | bool NetworkSettingsData::isModified( void ) { |
736 | if( ForceModified ) | 736 | if( ForceModified ) |
737 | return 1; | 737 | return 1; |
738 | 738 | ||
739 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | 739 | for( QDictIterator<NetworkSetup> it(NSResources->networkSetups()); |
740 | it.current(); | 740 | it.current(); |
741 | ++it ) { | 741 | ++it ) { |
742 | if( it.current()->isModified() ) { | 742 | if( it.current()->isModified() ) { |
743 | return 1; | 743 | return 1; |
744 | } | 744 | } |
745 | } | 745 | } |
746 | return 0; | 746 | return 0; |
747 | } | 747 | } |
748 | 748 | ||
749 | bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) { | 749 | bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) { |
750 | // load situation | 750 | // load situation |
751 | QList<NodeCollection> PossibleTriggered; | 751 | QList<NetworkSetup> PossibleTriggered; |
752 | 752 | ||
753 | PossibleTriggered = collectTriggered( Interface ); | 753 | PossibleTriggered = collectTriggered( Interface ); |
754 | 754 | ||
755 | Log( ( "for %s : Possiblilies %d\n", | 755 | Log( ( "for %s : Possiblilies %d\n", |
756 | Interface.latin1(), PossibleTriggered.count() )); | 756 | Interface.latin1(), PossibleTriggered.count() )); |
757 | 757 | ||
758 | return ( PossibleTriggered.count() ) ? 1 : 0; | 758 | return ( PossibleTriggered.count() ) ? 1 : 0; |
759 | } | 759 | } |
760 | 760 | ||
761 | QList<NodeCollection> NetworkSettingsData::collectTriggered( | 761 | QList<NetworkSetup> NetworkSettingsData::collectTriggered( |
762 | const QString & Interface ) { | 762 | const QString & Interface ) { |
763 | 763 | ||
764 | // collect connections that could be triggered by this interface | 764 | // collect NetworkSetups that could be triggered by this interface |
765 | NodeCollection * NC; | 765 | NetworkSetup * NC; |
766 | QList<NodeCollection> PossibleTriggered; | 766 | QList<NetworkSetup> PossibleTriggered; |
767 | 767 | ||
768 | // for all connections | 768 | // for all NetworkSetups |
769 | Name2Connection_t & M = NSResources->connections(); | 769 | Name2NetworkSetup_t & M = NSResources->networkSetups(); |
770 | 770 | ||
771 | for( QDictIterator<NodeCollection> it(M); | 771 | for( QDictIterator<NetworkSetup> it(M); |
772 | it.current(); | 772 | it.current(); |
773 | ++it ) { | 773 | ++it ) { |
774 | NC = it.current(); | 774 | NC = it.current(); |
775 | // check if this profile handles the requested interface | 775 | // check if this profile handles the requested interface |
776 | if( NC->triggeredBy( Interface ) && // if different Intf. | 776 | if( NC->triggeredBy( Interface ) && // if different Intf. |
777 | NC->state() != Disabled && // if enabled | 777 | NC->state() != Disabled && // if enabled |
778 | NC->state() != IsUp // if already used | 778 | NC->state() != IsUp // if already used |
779 | ) { | 779 | ) { |
780 | Log( ( "Append %s for %s\n", | 780 | Log( ( "Append %s for %s\n", |
781 | NC->name().latin1(), Interface.latin1() )); | 781 | NC->name().latin1(), Interface.latin1() )); |
782 | PossibleTriggered.append( NC ); | 782 | PossibleTriggered.append( NC ); |
783 | } | 783 | } |