summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/editconnection.cpp
authorwimpie <wimpie>2004-04-04 15:23:16 (UTC)
committer wimpie <wimpie>2004-04-04 15:23:16 (UTC)
commitfd9146de7698a796659b68606429da490f817138 (patch) (unidiff)
treef026bf2a7adcaaa3a0dd0429e7474f536787253d /noncore/settings/networksettings2/editconnection.cpp
parent5b52572e2ec9f0f6f39706aceb9ec1e98440fd3d (diff)
downloadopie-fd9146de7698a796659b68606429da490f817138.zip
opie-fd9146de7698a796659b68606429da490f817138.tar.gz
opie-fd9146de7698a796659b68606429da490f817138.tar.bz2
Many changes
Diffstat (limited to 'noncore/settings/networksettings2/editconnection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/editconnection.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp
index ce13573..4bbe502 100644
--- a/noncore/settings/networksettings2/editconnection.cpp
+++ b/noncore/settings/networksettings2/editconnection.cpp
@@ -95,56 +95,54 @@ EditConnection::EditConnection( QWidget* parent ) :
95 Nodes_LV->header()->hide(); 95 Nodes_LV->header()->hide();
96 // popluate tree with all NetNodes 96 // popluate tree with all NetNodes
97 buildFullTree(); 97 buildFullTree();
98} 98}
99 99
100NodeCollection * EditConnection::getTmpCollection( void ) { 100NodeCollection * EditConnection::getTmpCollection( void ) {
101 101
102 if( TmpIsValid ) 102 if( TmpIsValid )
103 // content is stil OK 103 // content is stil OK
104 return &(TmpCollection); 104 return &(TmpCollection);
105 105
106 // reset collection -> delete all NEW NetNodes 106 // reset collection -> delete all NEW NetNodes
107 { ANetNodeInstance * NNI; 107 for( QListIterator<ANetNodeInstance> it(TmpCollection);
108 for( QListIterator<ANetNodeInstance> it(TmpCollection); 108 it.current();
109 it.current(); 109 ++it ) {
110 ++it ) { 110 if( it.current()->isNew() ) {
111 if( it.current()->isNew() ) { 111 delete it.current();
112 delete it.current();
113 }
114 } 112 }
115 TmpCollection.clear();
116 } 113 }
114 TmpCollection.clear();
117 115
118 // update content 116 // update content
119 QListViewItem * it = Nodes_LV->firstChild(); 117 QListViewItem * it = Nodes_LV->firstChild();
120 ANetNode * NN; 118 ANetNode * NN;
121 // start iter 119 // start iter
122 ANetNodeInstance * NNI = 120 ANetNodeInstance * NNI =
123 (SelectedNodes) ? SelectedNodes->first() : 0 ; 121 (SelectedNodes) ? SelectedNodes->first() : 0 ;
124 122
125 TmpCollection.setModified( 0 ); 123 TmpCollection.setModified( 0 );
126 124
127 while ( it ) { 125 while ( it ) {
128 NN = (*Mapping)[it]; 126 NN = (*Mapping)[it];
129 if( NN == 0 ) { 127 if( NN == 0 ) {
130 // child is controller -> has sub radio 128 // child is controller -> has sub radio
131 // check if one radio is selected 129 // check if one radio is selected
132 it = it->firstChild(); 130 it = it->firstChild();
133 while( it ) { 131 while( it ) {
134 if( ((QCheckListItem *)it)->isOn() ) { 132 if( ((QCheckListItem *)it)->isOn() ) {
135 // this radio is selected -> go deeper 133 // this radio is selected -> go deeper
136 if( SelectedNodes == 0 || 134 if( SelectedNodes == 0 ||
137 NNI == 0 || 135 NNI == 0 ||
138 NNI->netNode()->nodeName() != it->text(0) ) { 136 NNI->nodeClass()->nodeName() != it->text(0) ) {
139 // new item not in previous collection 137 // new item not in previous collection
140 ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); 138 ANetNodeInstance * NNI = (*Mapping)[it]->createInstance();
141 NNI->initialize(); 139 NNI->initialize();
142 // this node type not in collection 140 // this node type not in collection
143 TmpCollection.append( NNI ); 141 TmpCollection.append( NNI );
144 // master collection changed because new item in it 142 // master collection changed because new item in it
145 TmpCollection.setModified( 1 ); 143 TmpCollection.setModified( 1 );
146 // no more valid items in old list 144 // no more valid items in old list
147 NNI = 0; 145 NNI = 0;
148 } else { 146 } else {
149 // already in list -> copy pointer 147 // already in list -> copy pointer
150 TmpCollection.append( NNI ); 148 TmpCollection.append( NNI );
@@ -189,28 +187,28 @@ void EditConnection::setConnection( NodeCollection * NC ) {
189 TmpIsValid = 0; 187 TmpIsValid = 0;
190 188
191 while ( it ) { 189 while ( it ) {
192 // listitem corresponds to netnode 190 // listitem corresponds to netnode
193 NN = (*Mapping)[it]; 191 NN = (*Mapping)[it];
194 if( NN == 0 ) { 192 if( NN == 0 ) {
195 // child is controller -> has sub radio 193 // child is controller -> has sub radio
196 QString Ctr = it->text(0); 194 QString Ctr = it->text(0);
197 // check if one radio is selected 195 // check if one radio is selected
198 it = it->firstChild(); 196 it = it->firstChild();
199 Found = 0; 197 Found = 0;
200 while( it ) { 198 while( it ) {
201 if( NNI && NNI->netNode()->nodeName() == it->text(0) ) { 199 if( NNI && NNI->nodeClass()->nodeName() == it->text(0) ) {
202 // this radio is part of the collection 200 // this radio is part of the collection
203 ((QCheckListItem *)it)->setOn( 1 ); 201 ((QCheckListItem *)it)->setOn( 1 );
204 updateGUI( it, NNI->netNode() ); 202 updateGUI( it, NNI->nodeClass() );
205 // check its children 203 // check its children
206 Found = 1; 204 Found = 1;
207 it = it->firstChild(); 205 it = it->firstChild();
208 NNI = SelectedNodes->next(); 206 NNI = SelectedNodes->next();
209 // do not bother to check other items 207 // do not bother to check other items
210 break; 208 break;
211 } 209 }
212 it = it->nextSibling(); 210 it = it->nextSibling();
213 } 211 }
214 if( ! Found ) { 212 if( ! Found ) {
215 // this means that this level is NOT present in collection 213 // this means that this level is NOT present in collection
216 // probably INCOMPATIBEL collection OR Missing plugin 214 // probably INCOMPATIBEL collection OR Missing plugin
@@ -231,31 +229,28 @@ void EditConnection::setConnection( NodeCollection * NC ) {
231// get result of editing (either new OR updated collection 229// get result of editing (either new OR updated collection
232NodeCollection * EditConnection::connection( void ) { 230NodeCollection * EditConnection::connection( void ) {
233 231
234 if( SelectedNodes == 0 ) { 232 if( SelectedNodes == 0 ) {
235 // new collection 233 // new collection
236 SelectedNodes = new NodeCollection; 234 SelectedNodes = new NodeCollection;
237 } 235 }
238 236
239 // clean out old entries 237 // clean out old entries
240 SelectedNodes->clear(); 238 SelectedNodes->clear();
241 239
242 // transfer 240 // transfer
243 { ANetNodeInstance * NNI; 241 for( QListIterator<ANetNodeInstance> it(TmpCollection);
244 242 it.current();
245 for( QListIterator<ANetNodeInstance> it(TmpCollection); 243 ++it ) {
246 it.current(); 244 SelectedNodes->append( it.current() );
247 ++it ) {
248 SelectedNodes->append( it.current() );
249 }
250 } 245 }
251 246
252 if( TmpCollection.isModified() ) 247 if( TmpCollection.isModified() )
253 SelectedNodes->setModified( 1 ); 248 SelectedNodes->setModified( 1 );
254 249
255 if( SelectedNodes->name() != Name_LE->text() ) { 250 if( SelectedNodes->name() != Name_LE->text() ) {
256 SelectedNodes->setName( Name_LE->text() ); 251 SelectedNodes->setName( Name_LE->text() );
257 SelectedNodes->setModified( 1 ); 252 SelectedNodes->setModified( 1 );
258 } 253 }
259 254
260 return SelectedNodes; 255 return SelectedNodes;
261} 256}
@@ -439,26 +434,26 @@ void EditConnection::SLOT_AlterTab( const QString & S ) {
439 } 434 }
440 435
441 // update CB 436 // update CB
442 // and populate WidgetStack 437 // and populate WidgetStack
443 { ANetNodeInstance * NNI; 438 { ANetNodeInstance * NNI;
444 QListIterator<ANetNodeInstance> it(TmpCollection); 439 QListIterator<ANetNodeInstance> it(TmpCollection);
445 int i = 0; 440 int i = 0;
446 QWidget * W; 441 QWidget * W;
447 442
448 for ( ; it.current(); ++it ) { 443 for ( ; it.current(); ++it ) {
449 NNI = it.current(); 444 NNI = it.current();
450 Devices_CB->insertItem( 445 Devices_CB->insertItem(
451 NSResources->getPixmap( NNI->netNode()->pixmapName() ), 446 NSResources->getPixmap( NNI->nodeClass()->pixmapName() ),
452 NNI->netNode()->nodeName() 447 NNI->nodeClass()->nodeName()
453 ); 448 );
454 449
455 // add edit widget 450 // add edit widget
456 W = NNI->edit( Setup_WS ); 451 W = NNI->edit( Setup_WS );
457 if( ! W) { 452 if( ! W) {
458 W = new QLabel( Setup_WS, 453 W = new QLabel( Setup_WS,
459 tr("No configuration required")); 454 tr("No configuration required"));
460 } 455 }
461 Setup_WS->addWidget( W , i ); 456 Setup_WS->addWidget( W , i );
462 i ++; 457 i ++;
463 } 458 }
464 } 459 }