Diffstat (limited to 'noncore/settings/networksettings2/editconnection.cpp') (more/less context) (ignore 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 | |||
@@ -84,12 +84,12 @@ void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, | |||
84 | // REAL GUI | 84 | // REAL GUI |
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 ); |
95 | 95 | ||
@@ -104,9 +104,9 @@ EditConnection::EditConnection( QWidget* parent ) : | |||
104 | // popluate tree with all NetNodes | 104 | // popluate tree with all NetNodes |
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 |
112 | return &(TmpCollection); | 112 | return &(TmpCollection); |
@@ -118,9 +118,11 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
118 | if( it.current()->isNew() ) { | 118 | if( it.current()->isNew() ) { |
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(); |
126 | ANetNode * NN; | 128 | ANetNode * NN; |
@@ -192,10 +194,10 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
192 | TmpIsValid = 1; | 194 | TmpIsValid = 1; |
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 | ||
201 | SelectedNodes = NC; | 203 | SelectedNodes = NC; |
@@ -242,10 +244,10 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
242 | // this means that this level is NOT present in collection | 244 | // this means that this level is NOT present in collection |
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 | } |
251 | 253 | ||
@@ -257,16 +259,16 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
257 | // should exist and be the same | 259 | // should exist and be the same |
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; |
272 | } | 274 | } |
@@ -275,13 +277,13 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
275 | } | 277 | } |
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 |
287 | SelectedNodes->clear(); | 289 | SelectedNodes->clear(); |
@@ -304,9 +306,9 @@ NodeCollection * EditConnection::connection( void ) { | |||
304 | return SelectedNodes; | 306 | return SelectedNodes; |
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 |
312 | MyQCheckListItem * TheTop = new MyQCheckListItem( | 314 | MyQCheckListItem * TheTop = new MyQCheckListItem( |
@@ -318,9 +320,9 @@ void EditConnection::buildFullTree( void ) { | |||
318 | NSResources->netNode2Description( "fullsetup" ) ); | 320 | NSResources->netNode2Description( "fullsetup" ) ); |
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 ) { |
326 | NN = Iter.current(); | 328 | NN = Iter.current(); |
@@ -341,9 +343,9 @@ void EditConnection::buildFullTree( void ) { | |||
341 | } | 343 | } |
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 ) { |
349 | // this node has alternatives -> needs radio buttons | 351 | // this node has alternatives -> needs radio buttons |
@@ -377,13 +379,13 @@ void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | |||
377 | } | 379 | } |
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 | } |
389 | 391 | ||
@@ -417,14 +419,14 @@ void EditConnection::accept( void ) { | |||
417 | QDialog::accept(); | 419 | QDialog::accept(); |
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( |
430 | NSResources->netNode2Description( "fullsetup" ) ); | 432 | NSResources->netNode2Description( "fullsetup" ) ); |
@@ -464,9 +466,9 @@ void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | |||
464 | updateGUI( it, NN ); | 466 | updateGUI( it, NN ); |
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 |
472 | 474 | ||
@@ -513,9 +515,9 @@ void EditConnection::SLOT_AlterTab( const QString & S ) { | |||
513 | } | 515 | } |
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 ); |
521 | Setup_FRM->setEnabled( HCC ); | 523 | Setup_FRM->setEnabled( HCC ); |
@@ -539,9 +541,9 @@ void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | |||
539 | 1 : // toplevel always alternatives | 541 | 1 : // toplevel always alternatives |
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 ); |
547 | if( AutoCollapse ) | 549 | if( AutoCollapse ) |
@@ -551,9 +553,9 @@ void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | |||
551 | } | 553 | } |
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]; |
559 | if( NN ) { | 561 | if( NN ) { |
@@ -588,9 +590,9 @@ void EditConnection::enablePath( QListViewItem * it, bool pha ) { | |||
588 | } | 590 | } |
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(); |
596 | ANetNode *NN; | 598 | ANetNode *NN; |