Diffstat (limited to 'noncore/settings/networksettings2/editconnection.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/editconnection.cpp | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 717d9e9..6ab2dd6 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -85,10 +85,10 @@ void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, | |||
85 | // | 85 | // |
86 | // | 86 | // |
87 | 87 | ||
88 | bool EditConnection::AutoCollapse = 1; | 88 | bool EditNetworkSetup::AutoCollapse = 1; |
89 | 89 | ||
90 | EditConnection::EditConnection( QWidget* parent ) : | 90 | EditNetworkSetup::EditNetworkSetup( QWidget* parent ) : |
91 | EditConnectionGUI( parent, 0, TRUE ), TmpCollection() { | 91 | EditNetworkSetupGUI( parent, 0, TRUE ), TmpCollection() { |
92 | 92 | ||
93 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 93 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
94 | Setup_FRM->setEnabled( FALSE ); | 94 | Setup_FRM->setEnabled( FALSE ); |
@@ -105,7 +105,7 @@ EditConnection::EditConnection( QWidget* parent ) : | |||
105 | buildFullTree(); | 105 | buildFullTree(); |
106 | } | 106 | } |
107 | 107 | ||
108 | NodeCollection * EditConnection::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 |
@@ -119,7 +119,9 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
119 | delete it.current(); | 119 | delete it.current(); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | |||
122 | TmpCollection.clear(); | 123 | TmpCollection.clear(); |
124 | TmpCollection.copyFrom( *SelectedNodes ); | ||
123 | 125 | ||
124 | // update content | 126 | // update content |
125 | QListViewItem * it = Nodes_LV->firstChild(); | 127 | QListViewItem * it = Nodes_LV->firstChild(); |
@@ -193,8 +195,8 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
193 | return &(TmpCollection); | 195 | return &(TmpCollection); |
194 | } | 196 | } |
195 | 197 | ||
196 | // pass a connection NodeCollection to be edited | 198 | // pass a NetworkSetup NetworkSetup to be edited |
197 | void EditConnection::setConnection( NodeCollection * NC ) { | 199 | void EditNetworkSetup::setNetworkSetup( NetworkSetup * NC ) { |
198 | ANetNodeInstance * NNI; | 200 | ANetNodeInstance * NNI; |
199 | ANetNode * NN; | 201 | ANetNode * NN; |
200 | 202 | ||
@@ -243,8 +245,8 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
243 | // probably INCOMPATIBEL collection OR Missing plugin | 245 | // probably INCOMPATIBEL collection OR Missing plugin |
244 | QMessageBox::warning( | 246 | QMessageBox::warning( |
245 | 0, | 247 | 0, |
246 | tr( "Error presentig Connection" ), | 248 | tr( "Error presentig NetworkSetup" ), |
247 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 249 | tr( "<p>Old NetworkSetup or missing plugin \"<i>%1</i>\"</p>" ). |
248 | arg(NNI->nodeClass()->name()) ); | 250 | arg(NNI->nodeClass()->name()) ); |
249 | return; | 251 | return; |
250 | } | 252 | } |
@@ -258,14 +260,14 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
258 | if( NNI ) { | 260 | if( NNI ) { |
259 | QMessageBox::warning( | 261 | QMessageBox::warning( |
260 | 0, | 262 | 0, |
261 | tr( "Error presentig Connection" ), | 263 | tr( "Error presentig NetworkSetup" ), |
262 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 264 | tr( "<p>Old NetworkSetup or missing plugin \"<i>%1</i>\"</p>" ). |
263 | arg(NNI->nodeClass()->name()) ); | 265 | arg(NNI->nodeClass()->name()) ); |
264 | } else { | 266 | } else { |
265 | QMessageBox::warning( | 267 | QMessageBox::warning( |
266 | 0, | 268 | 0, |
267 | tr( "Error presentig Connection" ), | 269 | tr( "Error presentig NetworkSetup" ), |
268 | tr( "<p>Missing connection\"<i>%1</i>\"</p>" ). | 270 | tr( "<p>Missing NetworkSetup\"<i>%1</i>\"</p>" ). |
269 | arg(it->text(0)) ); | 271 | arg(it->text(0)) ); |
270 | } | 272 | } |
271 | return; | 273 | return; |
@@ -276,11 +278,11 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
276 | } | 278 | } |
277 | 279 | ||
278 | // get result of editing (either new OR updated collection | 280 | // get result of editing (either new OR updated collection |
279 | NodeCollection * EditConnection::connection( void ) { | 281 | NetworkSetup * EditNetworkSetup::networkSetup( void ) { |
280 | 282 | ||
281 | if( SelectedNodes == 0 ) { | 283 | if( SelectedNodes == 0 ) { |
282 | // new collection | 284 | // new collection |
283 | SelectedNodes = new NodeCollection; | 285 | SelectedNodes = new NetworkSetup; |
284 | } | 286 | } |
285 | 287 | ||
286 | // clean out old entries | 288 | // clean out old entries |
@@ -305,7 +307,7 @@ NodeCollection * EditConnection::connection( void ) { | |||
305 | } | 307 | } |
306 | 308 | ||
307 | // Build device tree -> start | 309 | // Build device tree -> start |
308 | void EditConnection::buildFullTree( void ) { | 310 | void EditNetworkSetup::buildFullTree( void ) { |
309 | ANetNode * NN; | 311 | ANetNode * NN; |
310 | 312 | ||
311 | // toplevel item | 313 | // toplevel item |
@@ -319,7 +321,7 @@ void EditConnection::buildFullTree( void ) { | |||
319 | Nodes_LV->setSelected( TheTop, TRUE ); | 321 | Nodes_LV->setSelected( TheTop, TRUE ); |
320 | 322 | ||
321 | // find all Nodes that are toplevel nodes -> ie provide | 323 | // find all Nodes that are toplevel nodes -> ie provide |
322 | // TCP/IP Connection | 324 | // TCP/IP NetworkSetup |
323 | for( QDictIterator<ANetNode> Iter(NSResources->netNodes()); | 325 | for( QDictIterator<ANetNode> Iter(NSResources->netNodes()); |
324 | Iter.current(); | 326 | Iter.current(); |
325 | ++Iter ) { | 327 | ++Iter ) { |
@@ -342,7 +344,7 @@ void EditConnection::buildFullTree( void ) { | |||
342 | } | 344 | } |
343 | 345 | ||
344 | // Build device tree -> help function | 346 | // Build device tree -> help function |
345 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | 347 | void EditNetworkSetup::buildSubTree( QListViewItem * it, ANetNode *NN ) { |
346 | ANetNode::NetNodeList & NNL = NN->alternatives(); | 348 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
347 | 349 | ||
348 | if( NNL.size() > 1 ) { | 350 | if( NNL.size() > 1 ) { |
@@ -378,11 +380,11 @@ void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | |||
378 | } | 380 | } |
379 | 381 | ||
380 | // Clicked ok OK button | 382 | // Clicked ok OK button |
381 | void EditConnection::accept( void ) { | 383 | void EditNetworkSetup::accept( void ) { |
382 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { | 384 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { |
383 | QMessageBox::warning( | 385 | QMessageBox::warning( |
384 | 0, | 386 | 0, |
385 | tr( "Closing Connection Setup" ), | 387 | tr( "Closing NetworkSetup Setup" ), |
386 | tr( "Definition not complete or no name" ) ); | 388 | tr( "Definition not complete or no name" ) ); |
387 | return; | 389 | return; |
388 | } | 390 | } |
@@ -418,12 +420,12 @@ void EditConnection::accept( void ) { | |||
418 | } | 420 | } |
419 | 421 | ||
420 | // triggered by CB | 422 | // triggered by CB |
421 | void EditConnection::SLOT_AutoCollapse( bool b ) { | 423 | void EditNetworkSetup::SLOT_AutoCollapse( bool b ) { |
422 | AutoCollapse = b; | 424 | AutoCollapse = b; |
423 | } | 425 | } |
424 | 426 | ||
425 | // clicked on node in tree -> update GUI | 427 | // clicked on node in tree -> update GUI |
426 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | 428 | void EditNetworkSetup::SLOT_SelectNode( QListViewItem * it ) { |
427 | ANetNode * NN; | 429 | ANetNode * NN; |
428 | if( it == 0 || it->depth() == 0 ) { | 430 | if( it == 0 || it->depth() == 0 ) { |
429 | Description_LBL->setText( | 431 | Description_LBL->setText( |
@@ -465,7 +467,7 @@ void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | |||
465 | } | 467 | } |
466 | 468 | ||
467 | // cliecked on TAB to go to setup | 469 | // cliecked on TAB to go to setup |
468 | void EditConnection::SLOT_AlterTab( const QString & S ) { | 470 | void EditNetworkSetup::SLOT_AlterTab( const QString & S ) { |
469 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { | 471 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { |
470 | // switched to setup -> update CB and populate ws with | 472 | // switched to setup -> update CB and populate ws with |
471 | // forms for devices | 473 | // forms for devices |
@@ -514,7 +516,7 @@ void EditConnection::SLOT_AlterTab( const QString & S ) { | |||
514 | } | 516 | } |
515 | 517 | ||
516 | // update visual feedback of selection state | 518 | // update visual feedback of selection state |
517 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | 519 | void EditNetworkSetup::updateGUI( QListViewItem * it, ANetNode * NN ) { |
518 | 520 | ||
519 | bool HCC = haveCompleteConfig( it ); | 521 | bool HCC = haveCompleteConfig( it ); |
520 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); | 522 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); |
@@ -540,7 +542,7 @@ void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | |||
540 | (NN->alternatives().size() > 1) ); | 542 | (NN->alternatives().size() > 1) ); |
541 | } | 543 | } |
542 | 544 | ||
543 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | 545 | void EditNetworkSetup::disableTree( QListViewItem * it, bool Mode ) { |
544 | while( it ) { | 546 | while( it ) { |
545 | // disable sbl's chidren | 547 | // disable sbl's chidren |
546 | it->setSelectable( Mode ); | 548 | it->setSelectable( Mode ); |
@@ -552,7 +554,7 @@ void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | |||
552 | } | 554 | } |
553 | 555 | ||
554 | // pah : ParentHasAlternatives | 556 | // pah : ParentHasAlternatives |
555 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { | 557 | void EditNetworkSetup::enablePath( QListViewItem * it, bool pha ) { |
556 | while( it ) { | 558 | while( it ) { |
557 | ANetNode * NN; | 559 | ANetNode * NN; |
558 | NN = (*Mapping)[it]; | 560 | NN = (*Mapping)[it]; |
@@ -589,7 +591,7 @@ void EditConnection::enablePath( QListViewItem * it, bool pha ) { | |||
589 | } | 591 | } |
590 | 592 | ||
591 | // do we have a complete configuration (all needs are provided for ?) | 593 | // do we have a complete configuration (all needs are provided for ?) |
592 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { | 594 | bool EditNetworkSetup::haveCompleteConfig( QListViewItem * it ) { |
593 | 595 | ||
594 | // check if all below this level is selected | 596 | // check if all below this level is selected |
595 | it = ( it ) ?it : Nodes_LV->firstChild(); | 597 | it = ( it ) ?it : Nodes_LV->firstChild(); |