author | wimpie <wimpie> | 2004-04-04 11:42:05 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-04 11:42:05 (UTC) |
commit | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (patch) (side-by-side diff) | |
tree | 3e3764f82d52f8c32b0ed9d92c13ec483dc34114 /noncore/settings/networksettings2/networksettings.cpp | |
parent | 321f82bb3d43cbab358434fef52fe76f17e7d1e3 (diff) | |
download | opie-8d2d2664e5f544b8292806e617deb7a0e4170dc0.zip opie-8d2d2664e5f544b8292806e617deb7a0e4170dc0.tar.gz opie-8d2d2664e5f544b8292806e617deb7a0e4170dc0.tar.bz2 |
Error in generation of files
Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 86 |
1 files changed, 49 insertions, 37 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index e1110e2..c3e6572 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp @@ -169,34 +169,52 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { // disable refresh timer UpdateTimer->stop(); - if( EC.exec() == QDialog::Accepted ) { - // toplevel item -> store - NodeCollection * NC = EC.connection(); - if( NC->isModified() ) { - setModified( 1 ); + // we need to retry + while( 1 ) { + if( EC.exec() == QDialog::Accepted ) { + // toplevel item -> store + NodeCollection * NC = EC.connection(); + if( NC->isModified() ) { + setModified( 1 ); + if( LBI ) { + if( NC->name() != OldName ) { + // find if new name is free + NodeCollection * LCN = NSResources->findConnection( + NC->name() ); + if( LCN ) { + QMessageBox::warning( + 0, + tr( "Generating system configuration" ), + tr( "Name %1 already exists" ).arg(NC->name()) + ); + continue; // restart exec + } // else new name + // new name -> remove item + NSResources->removeConnection( OldName ); + NSResources->addConnection( NC ); + } // else not changed + + // must add it here since change will trigger event + Profiles_LB->changeItem( NC->devicePixmap(), + NC->name(), + Profiles_LB->index( LBI ) + ); + } else { + // new item + int ci = Profiles_LB->count(); + NSResources->addConnection( NC ); + NC->setNumber( NC->maxConnectionNumber()+1 ); + Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); + Profiles_LB->setSelected( ci, TRUE ); + } + updateProfileState( LBI ); + } + } else { + // cancelled : reset connection if( LBI ) { - // new name -> remove item - NSResources->removeConnection( OldName ); - // must add it here since change will trigger event - NSResources->addConnection( NC ); - Profiles_LB->changeItem( NC->devicePixmap(), - NC->name(), - Profiles_LB->index( LBI ) - ); - } else { - // new item - int ci = Profiles_LB->count(); - NSResources->addConnection( NC ); - NC->setNumber( NC->maxConnectionNumber()+1 ); - Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); - Profiles_LB->setSelected( ci, TRUE ); + NodeCollection * NC = NSResources->findConnection( LBI->text() ); + NC->reassign(); } - updateProfileState( LBI ); - } - } else { - // cancelled : reset connection - if( LBI ) { - NodeCollection * NC = NSResources->findConnection( LBI->text() ); - NC->reassign(); } + break; } // reenable @@ -334,13 +352,8 @@ void NetworkSettings::SLOT_On( void ) { rv = NC->setState( Activate ); break; - case Available : - // deactivate + case Available : // deactivate + case IsUp : // deactivate (will also bring down if needed) rv = NC->setState( Deactivate ); break; - case IsUp : - // bring down and deactivate - rv = ( NC->setState( Down ) && - NC->setState( Deactivate ) ); - break; default : // others no change @@ -367,5 +380,5 @@ void NetworkSettings::SLOT_Connect( void ) { NSResources->findConnection( LBI->text() ); - bool rv; + bool rv = 1 ; switch( NC->state() ) { case IsUp : @@ -384,5 +397,5 @@ void NetworkSettings::SLOT_Connect( void ) { default : // others no change - return; + break; } @@ -392,5 +405,4 @@ void NetworkSettings::SLOT_Connect( void ) { tr( "Activating profile" ), tr( "Cannot enable profile" ) ); - return; } |