summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/editconnection.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/editconnection.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/editconnection.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp
index bda9d7e..a9bef65 100644
--- a/noncore/settings/networksettings2/editconnection.cpp
+++ b/noncore/settings/networksettings2/editconnection.cpp
@@ -420,75 +420,79 @@ void EditNetworkSetup::accept( void ) {
}
QDialog::accept();
}
// triggered by CB
void EditNetworkSetup::SLOT_AutoCollapse( bool b ) {
AutoCollapse = b;
}
// clicked on node in tree -> update GUI
void EditNetworkSetup::SLOT_SelectNode( QListViewItem * it ) {
ANetNode * NN;
if( it == 0 || it->depth() == 0 ) {
Description_LBL->setText(
NSResources->netNode2Description( "fullsetup" ) );
// topevel or no selection
return;
}
// store conversion from lvitem to node
NN = (*Mapping)[ it ];
if( ! NN ) {
- // intermediate node
+ // intermediate (controller) node
NN = (*Mapping)[ it->parent() ];
if( NN ) {
- // figure out type of this node -> produce mesage
+ // figure out type of this node -> produce message
Description_LBL->setText( NSResources->netNode2Description(
NN->needs()[0]) );
} else {
Description_LBL->setText( "" );
}
return;
}
+ // clicked on regular node
Description_LBL->setText( NN->nodeDescription() );
if( ! it->isSelectable() ) {
return;
}
ANetNode::NetNodeList & NNL = NN->alternatives();
- if( NNL.size() != 1 ) {
- if( NNL.size() == 0 ||
- ! ((MyQCheckListItem *)it)->isOn()
- ) {
- // not clicked on Check or Radio item
+ if( NNL.size() == 0 ) {
+ // this item has no alternatives -> end node
+ TmpIsValid = 0;
+ updateGUI( it, NN );
return;
}
+
+ if( ! ((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 ++;
@@ -508,48 +512,49 @@ void EditNetworkSetup::SLOT_AlterTab( const QString & S ) {
NSResources->getPixmap( NNI->nodeClass()->pixmapName() ),
NNI->nodeClass()->name()
);
// add edit widget
W = NNI->edit( Setup_WS );
if( ! W) {
W = new QLabel( Setup_WS,
tr("No configuration required"));
}
Setup_WS->addWidget( W , i );
i ++;
}
}
Setup_WS->raiseWidget( 0 );
} // still valid
}
}
// update visual feedback of selection state
void EditNetworkSetup::updateGUI( QListViewItem * it, ANetNode * NN ) {
bool HCC = haveCompleteConfig( it );
Tab_TB->setTabEnabled( Setup_FRM, HCC );
+ Log(( "COMPLETE CONFIG %d\n", HCC ));
Setup_FRM->setEnabled( HCC );
// disable children of all siblings at same level
QListViewItem * Sbl = it->parent()->firstChild();
while( Sbl ) {
if ( Sbl != it ) {
disableTree( Sbl->firstChild(), FALSE );
Sbl->setSelectable( TRUE );
if( AutoCollapse )
Sbl->setOpen( FALSE );
}
Sbl = Sbl->nextSibling();
}
// enable selected path (as deep as it goes
it->setOpen( TRUE );
enablePath( it->firstChild(),
(it->depth()==1) ?
1 : // toplevel always alternatives
(NN->alternatives().size() > 1) );
}
void EditNetworkSetup::disableTree( QListViewItem * it, bool Mode ) {
while( it ) {
@@ -605,36 +610,37 @@ bool EditNetworkSetup::haveCompleteConfig( QListViewItem * it ) {
// check if all below this level is selected
it = ( it ) ?it : Nodes_LV->firstChild();
ANetNode *NN;
bool Found;
while ( it ) {
NN = (*Mapping)[it];
if( NN == 0 ) {
// this item is a controller ->
// has radio items as children ->
// find selected one
it = it->firstChild();
Found = 0;
while( it ) {
if( ((QCheckListItem *)it)->isOn() ) {
Found = 1;
// go deeper
it = it->firstChild();
break;
}
it = it->nextSibling();
}
if( ! Found ) {
+ Log(( "Setup not complete\n" ));
return 0; // no not complete -> a radio should have been chkd
}
// it now contains selected radio
NN = (*Mapping)[it];
} else {
// automatic selection
it = it->firstChild();
}
}
return 1;
}