author | wimpie <wimpie> | 2005-01-12 00:29:48 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-12 00:29:48 (UTC) |
commit | a846a0be197d3a6ff7f8c76a3ba322db0da7d058 (patch) (side-by-side diff) | |
tree | 0db1eccb73b0756ff49029dcfa71ff1a3699cab0 | |
parent | 4b1d4fc9f4170ec22d196dd352cae5d9c1ecb232 (diff) | |
download | opie-a846a0be197d3a6ff7f8c76a3ba322db0da7d058.zip opie-a846a0be197d3a6ff7f8c76a3ba322db0da7d058.tar.gz opie-a846a0be197d3a6ff7f8c76a3ba322db0da7d058.tar.bz2 |
Fixed Crash in editing new profiles
-rw-r--r-- | noncore/settings/networksettings2/editconnection.cpp | 13 | ||||
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 2 |
2 files changed, 12 insertions, 3 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 ) : Mapping = new QPtrDict<ANetNode>; Mapping->setAutoDelete( FALSE ); Nodes_LV->header()->hide(); // popluate tree with all NetNodes buildFullTree(); } NetworkSetup * EditNetworkSetup::getTmpCollection( void ) { if( TmpIsValid ) // content is stil OK return &(TmpCollection); // reset collection -> delete all NEW NetNodes for( QListIterator<ANetNodeInstance> it(TmpCollection); it.current(); ++it ) { if( it.current()->isNew() ) { delete it.current(); } } TmpCollection.clear(); + if( SelectedNodes ) { + // initialize like original TmpCollection.copyFrom( *SelectedNodes ); + } // update content QListViewItem * it = Nodes_LV->firstChild(); ANetNode * NN; // start iter (if there is a collection) /* a node collection is sorted from the toplevel node to the deepest node */ ANetNodeInstance * NNI = (SelectedNodes) ? SelectedNodes->first() : 0 ; TmpCollection.setModified( 0 ); // the listview always starts with the toplevel // hierarchy. This is always a controller item while ( it ) { NN = (*Mapping)[it]; if( NN == 0 ) { // this item is a controller -> // has radio items as children -> @@ -435,52 +438,58 @@ void EditNetworkSetup::SLOT_SelectNode( QListViewItem * it ) { } // store conversion from lvitem to node NN = (*Mapping)[ it ]; if( ! NN ) { // intermediate node NN = (*Mapping)[ it->parent() ]; if( NN ) { // figure out type of this node -> produce mesage Description_LBL->setText( NSResources->netNode2Description( NN->needs()[0]) ); } else { Description_LBL->setText( "" ); } return; } Description_LBL->setText( NN->nodeDescription() ); if( ! it->isSelectable() ) { return; } - if( ! ((QCheckListItem *)it)->isOn() ) { - // clicked on line but NOT on Check or Radio item + ANetNode::NetNodeList & NNL = NN->alternatives(); + + if( NNL.size() != 1 ) { + if( NNL.size() == 0 || + ! ((MyQCheckListItem *)it)->isOn() + ) { + // not clicked on Check or Radio item return; } + } // item has really changed -> update TmpIsValid = 0; updateGUI( it, NN ); } // cliecked on TAB to go to setup void EditNetworkSetup::SLOT_AlterTab( const QString & S ) { if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { // switched to setup -> update CB and populate ws with // forms for devices if( ! TmpIsValid ) { getTmpCollection(); // clear CB and Ws { QWidget * W; int i = 0; Devices_CB->clear(); while( ( W = Setup_WS->widget( i ) ) ) { Setup_WS->removeWidget( W ); 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 ) { switch( NC->state() ) { case Unchecked : case Unknown : case Unavailable : case Disabled : // this profile does not allow interface to be UP // -> try others break; case Off : // try to UP the device { QString S= NC->setState( Activate ); if( ! S.isEmpty() ) { // could not bring device Online -> try other alters Log(( "disallow %ld for %s : %s\n", NC->number(), Interface.latin1(), S.latin1() )); break; } // interface assigned } // FT case Available : case IsUp : // also called for 'ifdown' // device is ready -> done Log(( "allow %ld for %s\n", NC->number(), Interface.latin1())); - printf( "A%ld%s\n", NC->number(), Interface.latin1() ); + printf( "A%d%s\n", NC->number(), Interface.latin1() ); return 0; } } // if we come here no alternatives are possible Log(( "disallow %s\n", Interface.latin1())); printf( "D-%s\n", Interface.latin1() ); return 0; } bool NetworkSettingsData::isModified( void ) { if( ForceModified ) return 1; for( QDictIterator<NetworkSetup> it(NSResources->networkSetups()); it.current(); ++it ) { if( it.current()->isModified() ) { return 1; } } return 0; } |