-rw-r--r-- | noncore/settings/networksettings2/editconnection.cpp | 17 | ||||
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 6ab2dd6..bda9d7e 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -100,49 +100,52 @@ EditNetworkSetup::EditNetworkSetup( QWidget* parent ) : | |||
100 | 100 | ||
101 | Mapping = new QPtrDict<ANetNode>; | 101 | Mapping = new QPtrDict<ANetNode>; |
102 | Mapping->setAutoDelete( FALSE ); | 102 | Mapping->setAutoDelete( FALSE ); |
103 | Nodes_LV->header()->hide(); | 103 | Nodes_LV->header()->hide(); |
104 | // popluate tree with all NetNodes | 104 | // popluate tree with all NetNodes |
105 | buildFullTree(); | 105 | buildFullTree(); |
106 | } | 106 | } |
107 | 107 | ||
108 | NetworkSetup * EditNetworkSetup::getTmpCollection( void ) { | 108 | NetworkSetup * EditNetworkSetup::getTmpCollection( void ) { |
109 | 109 | ||
110 | if( TmpIsValid ) | 110 | if( TmpIsValid ) |
111 | // content is stil OK | 111 | // content is stil OK |
112 | return &(TmpCollection); | 112 | return &(TmpCollection); |
113 | 113 | ||
114 | // reset collection -> delete all NEW NetNodes | 114 | // reset collection -> delete all NEW NetNodes |
115 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 115 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
116 | it.current(); | 116 | it.current(); |
117 | ++it ) { | 117 | ++it ) { |
118 | if( it.current()->isNew() ) { | 118 | if( it.current()->isNew() ) { |
119 | delete it.current(); | 119 | delete it.current(); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | TmpCollection.clear(); | 123 | TmpCollection.clear(); |
124 | TmpCollection.copyFrom( *SelectedNodes ); | 124 | if( SelectedNodes ) { |
125 | // initialize like original | ||
126 | TmpCollection.copyFrom( *SelectedNodes ); | ||
127 | } | ||
125 | 128 | ||
126 | // update content | 129 | // update content |
127 | QListViewItem * it = Nodes_LV->firstChild(); | 130 | QListViewItem * it = Nodes_LV->firstChild(); |
128 | ANetNode * NN; | 131 | ANetNode * NN; |
129 | 132 | ||
130 | // start iter (if there is a collection) | 133 | // start iter (if there is a collection) |
131 | /* | 134 | /* |
132 | 135 | ||
133 | a node collection is sorted from the toplevel | 136 | a node collection is sorted from the toplevel |
134 | node to the deepest node | 137 | node to the deepest node |
135 | 138 | ||
136 | */ | 139 | */ |
137 | ANetNodeInstance * NNI = | 140 | ANetNodeInstance * NNI = |
138 | (SelectedNodes) ? SelectedNodes->first() : 0 ; | 141 | (SelectedNodes) ? SelectedNodes->first() : 0 ; |
139 | 142 | ||
140 | TmpCollection.setModified( 0 ); | 143 | TmpCollection.setModified( 0 ); |
141 | 144 | ||
142 | // the listview always starts with the toplevel | 145 | // the listview always starts with the toplevel |
143 | // hierarchy. This is always a controller item | 146 | // hierarchy. This is always a controller item |
144 | while ( it ) { | 147 | while ( it ) { |
145 | NN = (*Mapping)[it]; | 148 | NN = (*Mapping)[it]; |
146 | if( NN == 0 ) { | 149 | if( NN == 0 ) { |
147 | // this item is a controller -> | 150 | // this item is a controller -> |
148 | // has radio items as children -> | 151 | // has radio items as children -> |
@@ -435,51 +438,57 @@ void EditNetworkSetup::SLOT_SelectNode( QListViewItem * it ) { | |||
435 | } | 438 | } |
436 | 439 | ||
437 | // store conversion from lvitem to node | 440 | // store conversion from lvitem to node |
438 | NN = (*Mapping)[ it ]; | 441 | NN = (*Mapping)[ it ]; |
439 | 442 | ||
440 | if( ! NN ) { | 443 | if( ! NN ) { |
441 | // intermediate node | 444 | // intermediate node |
442 | NN = (*Mapping)[ it->parent() ]; | 445 | NN = (*Mapping)[ it->parent() ]; |
443 | if( NN ) { | 446 | if( NN ) { |
444 | // figure out type of this node -> produce mesage | 447 | // figure out type of this node -> produce mesage |
445 | Description_LBL->setText( NSResources->netNode2Description( | 448 | Description_LBL->setText( NSResources->netNode2Description( |
446 | NN->needs()[0]) ); | 449 | NN->needs()[0]) ); |
447 | } else { | 450 | } else { |
448 | Description_LBL->setText( "" ); | 451 | Description_LBL->setText( "" ); |
449 | } | 452 | } |
450 | return; | 453 | return; |
451 | } | 454 | } |
452 | 455 | ||
453 | Description_LBL->setText( NN->nodeDescription() ); | 456 | Description_LBL->setText( NN->nodeDescription() ); |
454 | 457 | ||
455 | if( ! it->isSelectable() ) { | 458 | if( ! it->isSelectable() ) { |
456 | return; | 459 | return; |
457 | } | 460 | } |
458 | 461 | ||
459 | if( ! ((QCheckListItem *)it)->isOn() ) { | 462 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
460 | // clicked on line but NOT on Check or Radio item | 463 | |
461 | return; | 464 | if( NNL.size() != 1 ) { |
465 | if( NNL.size() == 0 || | ||
466 | ! ((MyQCheckListItem *)it)->isOn() | ||
467 | ) { | ||
468 | // not clicked on Check or Radio item | ||
469 | return; | ||
470 | } | ||
462 | } | 471 | } |
463 | 472 | ||
464 | // item has really changed -> update | 473 | // item has really changed -> update |
465 | TmpIsValid = 0; | 474 | TmpIsValid = 0; |
466 | updateGUI( it, NN ); | 475 | updateGUI( it, NN ); |
467 | } | 476 | } |
468 | 477 | ||
469 | // cliecked on TAB to go to setup | 478 | // cliecked on TAB to go to setup |
470 | void EditNetworkSetup::SLOT_AlterTab( const QString & S ) { | 479 | void EditNetworkSetup::SLOT_AlterTab( const QString & S ) { |
471 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { | 480 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { |
472 | // switched to setup -> update CB and populate ws with | 481 | // switched to setup -> update CB and populate ws with |
473 | // forms for devices | 482 | // forms for devices |
474 | 483 | ||
475 | if( ! TmpIsValid ) { | 484 | if( ! TmpIsValid ) { |
476 | getTmpCollection(); | 485 | getTmpCollection(); |
477 | 486 | ||
478 | // clear CB and Ws | 487 | // clear CB and Ws |
479 | { QWidget * W; | 488 | { QWidget * W; |
480 | int i = 0; | 489 | int i = 0; |
481 | 490 | ||
482 | Devices_CB->clear(); | 491 | Devices_CB->clear(); |
483 | while( ( W = Setup_WS->widget( i ) ) ) { | 492 | while( ( W = Setup_WS->widget( i ) ) ) { |
484 | Setup_WS->removeWidget( W ); | 493 | Setup_WS->removeWidget( W ); |
485 | i ++; | 494 | i ++; |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index b4622fc..835c7c3 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -700,49 +700,49 @@ bool NetworkSettingsData::canStart( const QString & Interface ) { | |||
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 |
706 | // -> try others | 706 | // -> try others |
707 | break; | 707 | break; |
708 | case Off : | 708 | case Off : |
709 | // try to UP the device | 709 | // try to UP the device |
710 | { QString S= NC->setState( Activate ); | 710 | { QString S= NC->setState( Activate ); |
711 | if( ! S.isEmpty() ) { | 711 | if( ! S.isEmpty() ) { |
712 | // could not bring device Online -> try other alters | 712 | // could not bring device Online -> try other alters |
713 | Log(( "disallow %ld for %s : %s\n", | 713 | Log(( "disallow %ld for %s : %s\n", |
714 | NC->number(), Interface.latin1(), S.latin1() )); | 714 | NC->number(), Interface.latin1(), S.latin1() )); |
715 | break; | 715 | break; |
716 | } | 716 | } |
717 | // interface assigned | 717 | // interface assigned |
718 | } | 718 | } |
719 | // FT | 719 | // FT |
720 | case Available : | 720 | case Available : |
721 | case IsUp : // also called for 'ifdown' | 721 | case IsUp : // also called for 'ifdown' |
722 | // device is ready -> done | 722 | // device is ready -> done |
723 | Log(( "allow %ld for %s\n", NC->number(), Interface.latin1())); | 723 | Log(( "allow %ld for %s\n", NC->number(), Interface.latin1())); |
724 | printf( "A%ld%s\n", NC->number(), Interface.latin1() ); | 724 | printf( "A%d%s\n", NC->number(), Interface.latin1() ); |
725 | return 0; | 725 | return 0; |
726 | } | 726 | } |
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<NetworkSetup> it(NSResources->networkSetups()); | 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 | ||