author | wimpie <wimpie> | 2005-01-11 21:42:31 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-11 21:42:31 (UTC) |
commit | 96678694f8952f60d0a895cede2b621404b4bfb8 (patch) (unidiff) | |
tree | 7138e554e5ba200b8f9ca8b51c89b47531dc34f2 /noncore/settings/networksettings2/networksettings.cpp | |
parent | f89120a7a1a3d0bf9c0805456490906ca914e560 (diff) | |
download | opie-96678694f8952f60d0a895cede2b621404b4bfb8.zip opie-96678694f8952f60d0a895cede2b621404b4bfb8.tar.gz opie-96678694f8952f60d0a895cede2b621404b4bfb8.tar.bz2 |
Major rename of NodeCollection to NetworkSetup
this commit is broken (missing symbols)
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 | |||
@@ -61,16 +61,16 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
61 | Profiles_LB->viewport(), QPEApplication::RightOnHold ); | 61 | Profiles_LB->viewport(), QPEApplication::RightOnHold ); |
62 | 62 | ||
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(), |
75 | NC->name() ); | 75 | NC->name() ); |
76 | } | 76 | } |
@@ -78,13 +78,13 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
78 | 78 | ||
79 | if( Profiles_LB->count() ) { | 79 | if( Profiles_LB->count() ) { |
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()), |
89 | SIGNAL( stdoutLine(const QString &) ), | 89 | SIGNAL( stdoutLine(const QString &) ), |
90 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); | 90 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); |
@@ -133,32 +133,32 @@ void NetworkSettings::SLOT_CmdMessage( const QString & S ) { | |||
133 | } | 133 | } |
134 | 134 | ||
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 ) { |
147 | updateProfileState( LBI ); | 147 | updateProfileState( LBI ); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
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 ) { |
163 | is = Profiles_LB->isSelected(i); | 163 | is = Profiles_LB->isSelected(i); |
164 | Profiles_LB->changeItem( NC->statePixmap(NewS), | 164 | Profiles_LB->changeItem( NC->statePixmap(NewS), |
@@ -187,79 +187,79 @@ void NetworkSettings::SLOT_DeleteNode( void ) { | |||
187 | 187 | ||
188 | if( QMessageBox::warning( | 188 | if( QMessageBox::warning( |
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 |
215 | UpdateTimer->stop(); | 215 | UpdateTimer->stop(); |
216 | 216 | ||
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, |
231 | tr( "In System Config" ), | 231 | tr( "In System Config" ), |
232 | tr( "Name %1 already exists" ).arg(NC->name()) | 232 | tr( "Name %1 already exists" ).arg(NC->name()) |
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(), |
243 | NC->name(), | 243 | NC->name(), |
244 | Profiles_LB->index( LBI ) | 244 | Profiles_LB->index( 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; |
264 | } | 264 | } |
265 | // reenable | 265 | // reenable |
@@ -267,13 +267,13 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
267 | } | 267 | } |
268 | 268 | ||
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 { |
278 | Description_LBL->setText( NC->description() ); | 278 | Description_LBL->setText( NC->description() ); |
279 | } | 279 | } |
@@ -350,13 +350,13 @@ void NetworkSettings::SLOT_Disable( bool T ) { | |||
350 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 350 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
351 | QString Msg; | 351 | QString Msg; |
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() ) { |
361 | Msg.insert( 0, "<p>" ); | 361 | Msg.insert( 0, "<p>" ); |
362 | Msg.append( "</p>" ); | 362 | Msg.append( "</p>" ); |
@@ -379,14 +379,14 @@ void NetworkSettings::SLOT_Up( void ) { | |||
379 | QString Msg; | 379 | QString Msg; |
380 | int led = -1; | 380 | int led = -1; |
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 |
391 | case Unchecked : // cannot modify this state | 391 | case Unchecked : // cannot modify this state |
392 | case Unavailable : // cannot modify this state | 392 | case Unavailable : // cannot modify this state |
@@ -435,14 +435,14 @@ void NetworkSettings::SLOT_Down( void ) { | |||
435 | int led = -1; | 435 | int led = -1; |
436 | QString Msg; | 436 | QString Msg; |
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 |
447 | case Unchecked : // cannot modify this state | 447 | case Unchecked : // cannot modify this state |
448 | case Unavailable : // cannot modify this state | 448 | case Unavailable : // cannot modify this state |