Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index 78b6cce..80dcb3d 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -63,12 +63,12 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
63 | connect( Profiles_LB, | 63 | connect( Profiles_LB, |
64 | SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), | 64 | SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), |
65 | this, SLOT(SLOT_EditNode(QListBoxItem*)) ); | 65 | this, SLOT(SLOT_EditNode(QListBoxItem*)) ); |
66 | 66 | ||
67 | { Name2Connection_t & M = NSResources->connections(); | 67 | { Name2NetworkSetup_t & M = NSResources->networkSetups(); |
68 | NodeCollection * NC; | 68 | NetworkSetup * NC; |
69 | // for all connections | 69 | // for all NetworkSetups |
70 | for( QDictIterator<NodeCollection> it(M); | 70 | for( QDictIterator<NetworkSetup> it(M); |
71 | it.current(); | 71 | it.current(); |
72 | ++it ) { | 72 | ++it ) { |
73 | NC = it.current(); | 73 | NC = it.current(); |
74 | Profiles_LB->insertItem( NC->devicePixmap(), | 74 | Profiles_LB->insertItem( NC->devicePixmap(), |
@@ -80,9 +80,9 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
80 | Profiles_LB->setSelected( 0, TRUE ); | 80 | Profiles_LB->setSelected( 0, TRUE ); |
81 | } | 81 | } |
82 | 82 | ||
83 | // if no profiles -> auto popup editing | 83 | // if no profiles -> auto popup editing |
84 | if( NSResources->connections().count() == 0 ) { | 84 | if( NSResources->networkSetups().count() == 0 ) { |
85 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); | 85 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); |
86 | } | 86 | } |
87 | 87 | ||
88 | connect( &(NSResources->system()), | 88 | connect( &(NSResources->system()), |
@@ -135,12 +135,12 @@ void NetworkSettings::SLOT_CmdMessage( const QString & S ) { | |||
135 | void NetworkSettings::SLOT_RefreshStates( void ) { | 135 | void NetworkSettings::SLOT_RefreshStates( void ) { |
136 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember | 136 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
137 | 137 | ||
138 | if( LBI ) { | 138 | if( LBI ) { |
139 | NodeCollection * NC; | 139 | NetworkSetup * NC; |
140 | NSResources->system().probeInterfaces(); | 140 | NSResources->system().probeInterfaces(); |
141 | // update current selection only | 141 | // update current selection only |
142 | NC = NSResources->findConnection( LBI->text() ); | 142 | NC = NSResources->findNetworkSetup( LBI->text() ); |
143 | if( NC ) { | 143 | if( NC ) { |
144 | State_t OldS = NC->state(); | 144 | State_t OldS = NC->state(); |
145 | State_t NewS = NC->state(1); | 145 | State_t NewS = NC->state(1); |
146 | if( OldS != NewS ) { | 146 | if( OldS != NewS ) { |
@@ -151,12 +151,12 @@ void NetworkSettings::SLOT_RefreshStates( void ) { | |||
151 | 151 | ||
152 | 152 | ||
153 | /* -> LATER !! | 153 | /* -> LATER !! |
154 | bool is; | 154 | bool is; |
155 | NodeCollection * NC; | 155 | NetworkSetup * NC; |
156 | 156 | ||
157 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { | 157 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { |
158 | NC = NSResources->findConnection( Profiles_LB->text(i) ); | 158 | NC = NSResources->findNetworkSetup( Profiles_LB->text(i) ); |
159 | if( NC ) { | 159 | if( NC ) { |
160 | State_t OldS = NC->state(); | 160 | State_t OldS = NC->state(); |
161 | State_t NewS = NC->state(1); | 161 | State_t NewS = NC->state(1); |
162 | if( OldS != NewS ) { | 162 | if( OldS != NewS ) { |
@@ -189,26 +189,26 @@ void NetworkSettings::SLOT_DeleteNode( void ) { | |||
189 | 0, | 189 | 0, |
190 | tr( "Removing profile" ), | 190 | tr( "Removing profile" ), |
191 | tr( "Remove selected profile ?" ), | 191 | tr( "Remove selected profile ?" ), |
192 | 1, 0 ) == 1 ) { | 192 | 1, 0 ) == 1 ) { |
193 | NSResources->removeConnection( LBI->text() ); | 193 | NSResources->removeNetworkSetup( LBI->text() ); |
194 | delete LBI; | 194 | delete LBI; |
195 | NSD.setModified( 1 ); | 195 | NSD.setModified( 1 ); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | 199 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
200 | QString OldName = ""; | 200 | QString OldName = ""; |
201 | 201 | ||
202 | EditConnection EC( this ); | 202 | EditNetworkSetup EC( this ); |
203 | 203 | ||
204 | if( LBI ) { | 204 | if( LBI ) { |
205 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 205 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
206 | if( ! NC ) { | 206 | if( ! NC ) { |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | OldName = NC->name(); | 209 | OldName = NC->name(); |
210 | EC.setConnection( NC ); | 210 | EC.setNetworkSetup( NC ); |
211 | } | 211 | } |
212 | 212 | ||
213 | EC.showMaximized(); | 213 | EC.showMaximized(); |
214 | // disable refresh timer | 214 | // disable refresh timer |
@@ -217,14 +217,14 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
217 | // we need to retry | 217 | // we need to retry |
218 | while( 1 ) { | 218 | while( 1 ) { |
219 | if( EC.exec() == QDialog::Accepted ) { | 219 | if( EC.exec() == QDialog::Accepted ) { |
220 | // toplevel item -> store | 220 | // toplevel item -> store |
221 | NodeCollection * NC = EC.connection(); | 221 | NetworkSetup * NC = EC.networkSetup(); |
222 | if( NC->isModified() ) { | 222 | if( NC->isModified() ) { |
223 | if( LBI ) { | 223 | if( LBI ) { |
224 | if( NC->name() != OldName ) { | 224 | if( NC->name() != OldName ) { |
225 | // find if new name is free | 225 | // find if new name is free |
226 | NodeCollection * LCN = NSResources->findConnection( | 226 | NetworkSetup * LCN = NSResources->findNetworkSetup( |
227 | NC->name() ); | 227 | NC->name() ); |
228 | if( LCN ) { | 228 | if( LCN ) { |
229 | QMessageBox::warning( | 229 | QMessageBox::warning( |
230 | 0, | 230 | 0, |
@@ -233,10 +233,10 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
233 | ); | 233 | ); |
234 | continue; // restart exec | 234 | continue; // restart exec |
235 | } // else new name | 235 | } // else new name |
236 | // new name -> remove item | 236 | // new name -> remove item |
237 | NSResources->removeConnection( OldName ); | 237 | NSResources->removeNetworkSetup( OldName ); |
238 | NSResources->addConnection( NC, 0 ); | 238 | NSResources->addNetworkSetup( NC, 0 ); |
239 | } // else not changed | 239 | } // else not changed |
240 | 240 | ||
241 | // must add it here since change will trigger event | 241 | // must add it here since change will trigger event |
242 | Profiles_LB->changeItem( NC->devicePixmap(), | 242 | Profiles_LB->changeItem( NC->devicePixmap(), |
@@ -245,19 +245,19 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
245 | ); | 245 | ); |
246 | } else { | 246 | } else { |
247 | // new item | 247 | // new item |
248 | int ci = Profiles_LB->count(); | 248 | int ci = Profiles_LB->count(); |
249 | NSResources->addConnection( NC, 0 ); | 249 | NSResources->addNetworkSetup( NC, 0 ); |
250 | NC->setNumber( NSResources->assignConnectionNumber() ); | 250 | NC->setNumber( NSResources->assignNetworkSetupNumber() ); |
251 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); | 251 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
252 | Profiles_LB->setSelected( ci, TRUE ); | 252 | Profiles_LB->setSelected( ci, TRUE ); |
253 | } | 253 | } |
254 | updateProfileState( LBI ); | 254 | updateProfileState( LBI ); |
255 | } | 255 | } |
256 | } else { | 256 | } else { |
257 | // cancelled : reset connection | 257 | // cancelled : reset NetworkSetup |
258 | if( LBI ) { | 258 | if( LBI ) { |
259 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 259 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
260 | NC->reassign(); | 260 | NC->reassign(); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | break; | 263 | break; |
@@ -269,9 +269,9 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
269 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { | 269 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
270 | if( LBI == 0 ) | 270 | if( LBI == 0 ) |
271 | return; | 271 | return; |
272 | 272 | ||
273 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 273 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
274 | 274 | ||
275 | if( NC->description().isEmpty() ) { | 275 | if( NC->description().isEmpty() ) { |
276 | Description_LBL->setText( tr( "<<No description>>" ) ); | 276 | Description_LBL->setText( tr( "<<No description>>" ) ); |
277 | } else { | 277 | } else { |
@@ -352,9 +352,9 @@ void NetworkSettings::SLOT_Disable( bool T ) { | |||
352 | 352 | ||
353 | if ( ! LBI ) | 353 | if ( ! LBI ) |
354 | return; | 354 | return; |
355 | 355 | ||
356 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 356 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
357 | 357 | ||
358 | Log(( "Prepare to %sable\n", (T) ? "en" : "dis" )); | 358 | Log(( "Prepare to %sable\n", (T) ? "en" : "dis" )); |
359 | Msg = NC->setState( (T) ? Disable : Enable ); | 359 | Msg = NC->setState( (T) ? Disable : Enable ); |
360 | if( ! Msg.isEmpty() ) { | 360 | if( ! Msg.isEmpty() ) { |
@@ -381,10 +381,10 @@ void NetworkSettings::SLOT_Up( void ) { | |||
381 | 381 | ||
382 | if ( ! LBI ) | 382 | if ( ! LBI ) |
383 | return; | 383 | return; |
384 | 384 | ||
385 | NodeCollection * NC = | 385 | NetworkSetup * NC = |
386 | NSResources->findConnection( LBI->text() ); | 386 | NSResources->findNetworkSetup( LBI->text() ); |
387 | 387 | ||
388 | switch( NC->state() ) { | 388 | switch( NC->state() ) { |
389 | case Disabled : // cannot modify this state | 389 | case Disabled : // cannot modify this state |
390 | case Unknown : // cannot modify this state | 390 | case Unknown : // cannot modify this state |
@@ -437,10 +437,10 @@ void NetworkSettings::SLOT_Down( void ) { | |||
437 | 437 | ||
438 | if ( ! LBI ) | 438 | if ( ! LBI ) |
439 | return; | 439 | return; |
440 | 440 | ||
441 | NodeCollection * NC = | 441 | NetworkSetup * NC = |
442 | NSResources->findConnection( LBI->text() ); | 442 | NSResources->findNetworkSetup( LBI->text() ); |
443 | 443 | ||
444 | switch( NC->state() ) { | 444 | switch( NC->state() ) { |
445 | case Disabled : // cannot modify this state | 445 | case Disabled : // cannot modify this state |
446 | case Unknown : // cannot modify this state | 446 | case Unknown : // cannot modify this state |