Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 34 |
1 files changed, 23 insertions, 11 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 | |||
@@ -168,16 +168,32 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
168 | EC.showMaximized(); | 168 | EC.showMaximized(); |
169 | // disable refresh timer | 169 | // disable refresh timer |
170 | UpdateTimer->stop(); | 170 | UpdateTimer->stop(); |
171 | // we need to retry | ||
172 | while( 1 ) { | ||
171 | if( EC.exec() == QDialog::Accepted ) { | 173 | if( EC.exec() == QDialog::Accepted ) { |
172 | // toplevel item -> store | 174 | // toplevel item -> store |
173 | NodeCollection * NC = EC.connection(); | 175 | NodeCollection * NC = EC.connection(); |
174 | if( NC->isModified() ) { | 176 | if( NC->isModified() ) { |
175 | setModified( 1 ); | 177 | setModified( 1 ); |
176 | if( LBI ) { | 178 | if( LBI ) { |
179 | if( NC->name() != OldName ) { | ||
180 | // find if new name is free | ||
181 | NodeCollection * LCN = NSResources->findConnection( | ||
182 | NC->name() ); | ||
183 | if( LCN ) { | ||
184 | QMessageBox::warning( | ||
185 | 0, | ||
186 | tr( "Generating system configuration" ), | ||
187 | tr( "Name %1 already exists" ).arg(NC->name()) | ||
188 | ); | ||
189 | continue; // restart exec | ||
190 | } // else new name | ||
177 | // new name -> remove item | 191 | // new name -> remove item |
178 | NSResources->removeConnection( OldName ); | 192 | NSResources->removeConnection( OldName ); |
179 | // must add it here since change will trigger event | ||
180 | NSResources->addConnection( NC ); | 193 | NSResources->addConnection( NC ); |
194 | } // else not changed | ||
195 | |||
196 | // must add it here since change will trigger event | ||
181 | Profiles_LB->changeItem( NC->devicePixmap(), | 197 | Profiles_LB->changeItem( NC->devicePixmap(), |
182 | NC->name(), | 198 | NC->name(), |
183 | Profiles_LB->index( LBI ) | 199 | Profiles_LB->index( LBI ) |
@@ -199,6 +215,8 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
199 | NC->reassign(); | 215 | NC->reassign(); |
200 | } | 216 | } |
201 | } | 217 | } |
218 | break; | ||
219 | } | ||
202 | // reenable | 220 | // reenable |
203 | UpdateTimer->start( 5000 ); | 221 | UpdateTimer->start( 5000 ); |
204 | } | 222 | } |
@@ -333,15 +351,10 @@ void NetworkSettings::SLOT_On( void ) { | |||
333 | // activate interface | 351 | // activate interface |
334 | rv = NC->setState( Activate ); | 352 | rv = NC->setState( Activate ); |
335 | break; | 353 | break; |
336 | case Available : | 354 | case Available : // deactivate |
337 | // deactivate | 355 | case IsUp : // deactivate (will also bring down if needed) |
338 | rv = NC->setState( Deactivate ); | 356 | rv = NC->setState( Deactivate ); |
339 | break; | 357 | break; |
340 | case IsUp : | ||
341 | // bring down and deactivate | ||
342 | rv = ( NC->setState( Down ) && | ||
343 | NC->setState( Deactivate ) ); | ||
344 | break; | ||
345 | default : | 358 | default : |
346 | // others no change | 359 | // others no change |
347 | return; | 360 | return; |
@@ -366,7 +379,7 @@ void NetworkSettings::SLOT_Connect( void ) { | |||
366 | NodeCollection * NC = | 379 | NodeCollection * NC = |
367 | NSResources->findConnection( LBI->text() ); | 380 | NSResources->findConnection( LBI->text() ); |
368 | 381 | ||
369 | bool rv; | 382 | bool rv = 1 ; |
370 | switch( NC->state() ) { | 383 | switch( NC->state() ) { |
371 | case IsUp : | 384 | case IsUp : |
372 | // down interface | 385 | // down interface |
@@ -383,7 +396,7 @@ void NetworkSettings::SLOT_Connect( void ) { | |||
383 | break; | 396 | break; |
384 | default : | 397 | default : |
385 | // others no change | 398 | // others no change |
386 | return; | 399 | break; |
387 | } | 400 | } |
388 | 401 | ||
389 | if( ! rv ) { | 402 | if( ! rv ) { |
@@ -391,7 +404,6 @@ void NetworkSettings::SLOT_Connect( void ) { | |||
391 | 0, | 404 | 0, |
392 | tr( "Activating profile" ), | 405 | tr( "Activating profile" ), |
393 | tr( "Cannot enable profile" ) ); | 406 | tr( "Cannot enable profile" ) ); |
394 | return; | ||
395 | } | 407 | } |
396 | 408 | ||
397 | // we do not update the GUI but wait for the REAL upping of the device | 409 | // we do not update the GUI but wait for the REAL upping of the device |