Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 101 |
1 files changed, 49 insertions, 52 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index f72fa8e..e1110e2 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -3,3 +3,3 @@ | |||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <qiconset.h> | 4 | #include <qlistbox.h> |
5 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
@@ -37,7 +37,5 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
37 | // populate main Listbox | 37 | // populate main Listbox |
38 | Profiles_IV->clear(); | 38 | Profiles_LB->clear(); |
39 | { Name2Connection_t & M = NSResources->connections(); | 39 | { Name2Connection_t & M = NSResources->connections(); |
40 | NodeCollection * NC; | 40 | NodeCollection * NC; |
41 | QIconViewItem * IVI; | ||
42 | |||
43 | // for all connections | 41 | // for all connections |
@@ -47,5 +45,4 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
47 | NC = it.current(); | 45 | NC = it.current(); |
48 | IVI = new QIconViewItem( Profiles_IV, | 46 | Profiles_LB->insertItem( NC->devicePixmap(), |
49 | NC->name(), | 47 | NC->name() ); |
50 | NC->devicePixmap() ); | ||
51 | } | 48 | } |
@@ -53,4 +50,4 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
53 | 50 | ||
54 | if( Profiles_IV->count() ) { | 51 | if( Profiles_LB->count() ) { |
55 | Profiles_IV->setSelected( Profiles_IV->firstItem(), TRUE ); | 52 | Profiles_LB->setSelected( 0, TRUE ); |
56 | } | 53 | } |
@@ -93,5 +90,5 @@ NetworkSettings::~NetworkSettings() { | |||
93 | void NetworkSettings::SLOT_RefreshStates( void ) { | 90 | void NetworkSettings::SLOT_RefreshStates( void ) { |
94 | QIconViewItem * IVI = Profiles_IV->currentItem(); // remeber | 91 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
95 | 92 | ||
96 | if( IVI ) { | 93 | if( LBI ) { |
97 | NodeCollection * NC; | 94 | NodeCollection * NC; |
@@ -99,3 +96,3 @@ void NetworkSettings::SLOT_RefreshStates( void ) { | |||
99 | // update current selection only | 96 | // update current selection only |
100 | NC = NSResources->findConnection( IVI->text() ); | 97 | NC = NSResources->findConnection( LBI->text() ); |
101 | if( NC ) { | 98 | if( NC ) { |
@@ -104,3 +101,3 @@ void NetworkSettings::SLOT_RefreshStates( void ) { | |||
104 | if( OldS != NewS ) { | 101 | if( OldS != NewS ) { |
105 | updateProfileState( IVI ); | 102 | updateProfileState( LBI ); |
106 | } | 103 | } |
@@ -140,5 +137,5 @@ void NetworkSettings::SLOT_AddNode( void ) { | |||
140 | void NetworkSettings::SLOT_DeleteNode( void ) { | 137 | void NetworkSettings::SLOT_DeleteNode( void ) { |
141 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 138 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
142 | 139 | ||
143 | if ( ! IVI ) | 140 | if ( ! LBI ) |
144 | return; | 141 | return; |
@@ -150,4 +147,4 @@ void NetworkSettings::SLOT_DeleteNode( void ) { | |||
150 | 1, 0 ) == 1 ) { | 147 | 1, 0 ) == 1 ) { |
151 | NSResources->removeConnection( IVI->text() ); | 148 | NSResources->removeConnection( LBI->text() ); |
152 | delete IVI; | 149 | delete LBI; |
153 | setModified( 1 ); | 150 | setModified( 1 ); |
@@ -157,3 +154,3 @@ void NetworkSettings::SLOT_DeleteNode( void ) { | |||
157 | 154 | ||
158 | void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | 155 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
159 | QString OldName = ""; | 156 | QString OldName = ""; |
@@ -161,4 +158,4 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | |||
161 | 158 | ||
162 | if( IVI ) { | 159 | if( LBI ) { |
163 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 160 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
164 | if( ! NC ) { | 161 | if( ! NC ) { |
@@ -178,3 +175,3 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | |||
178 | setModified( 1 ); | 175 | setModified( 1 ); |
179 | if( IVI ) { | 176 | if( LBI ) { |
180 | // new name -> remove item | 177 | // new name -> remove item |
@@ -183,15 +180,15 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | |||
183 | NSResources->addConnection( NC ); | 180 | NSResources->addConnection( NC ); |
184 | IVI->setText( NC->name() ); | 181 | Profiles_LB->changeItem( NC->devicePixmap(), |
185 | IVI->setPixmap( NC->devicePixmap() ); | 182 | NC->name(), |
183 | Profiles_LB->index( LBI ) | ||
184 | ); | ||
186 | } else { | 185 | } else { |
187 | // new item | 186 | // new item |
187 | int ci = Profiles_LB->count(); | ||
188 | NSResources->addConnection( NC ); | 188 | NSResources->addConnection( NC ); |
189 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 189 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
190 | IVI = new QIconViewItem( Profiles_IV, | 190 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
191 | NC->name(), | 191 | Profiles_LB->setSelected( ci, TRUE ); |
192 | NC->devicePixmap() | ||
193 | ); | ||
194 | Profiles_IV->setSelected( IVI, TRUE ); | ||
195 | } | 192 | } |
196 | updateProfileState( IVI ); | 193 | updateProfileState( LBI ); |
197 | } | 194 | } |
@@ -199,4 +196,4 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | |||
199 | // cancelled : reset connection | 196 | // cancelled : reset connection |
200 | if( IVI ) { | 197 | if( LBI ) { |
201 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 198 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
202 | NC->reassign(); | 199 | NC->reassign(); |
@@ -208,7 +205,7 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | |||
208 | 205 | ||
209 | void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { | 206 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
210 | if( IVI == 0 ) | 207 | if( LBI == 0 ) |
211 | return; | 208 | return; |
212 | 209 | ||
213 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 210 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
214 | 211 | ||
@@ -263,3 +260,3 @@ void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { | |||
263 | 260 | ||
264 | CurProfile_GB->setTitle( IVI->text() ); | 261 | CurProfile_GB->setTitle( LBI->text() ); |
265 | State_LBL->setText( NC->stateName() ); | 262 | State_LBL->setText( NC->stateName() ); |
@@ -268,11 +265,11 @@ void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { | |||
268 | void NetworkSettings::SLOT_CheckState( void ) { | 265 | void NetworkSettings::SLOT_CheckState( void ) { |
269 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 266 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
270 | if ( ! IVI ) | 267 | if ( ! LBI ) |
271 | return; | 268 | return; |
272 | updateProfileState( IVI ); | 269 | updateProfileState( LBI ); |
273 | } | 270 | } |
274 | 271 | ||
275 | void NetworkSettings::updateProfileState( QIconViewItem * IVI ) { | 272 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { |
276 | if( IVI == Profiles_IV->currentItem() ) { | 273 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { |
277 | SLOT_ShowNode( IVI ); | 274 | SLOT_ShowNode( LBI ); |
278 | } | 275 | } |
@@ -293,5 +290,5 @@ void NetworkSettings::SLOT_GenerateConfig( void ) { | |||
293 | void NetworkSettings::SLOT_Enable( void ) { | 290 | void NetworkSettings::SLOT_Enable( void ) { |
294 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 291 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
295 | QString Msg; | 292 | QString Msg; |
296 | if ( ! IVI ) | 293 | if ( ! LBI ) |
297 | return; | 294 | return; |
@@ -299,3 +296,3 @@ void NetworkSettings::SLOT_Enable( void ) { | |||
299 | NodeCollection * NC = | 296 | NodeCollection * NC = |
300 | NSResources->findConnection( IVI->text() ); | 297 | NSResources->findConnection( LBI->text() ); |
301 | 298 | ||
@@ -320,3 +317,3 @@ void NetworkSettings::SLOT_Enable( void ) { | |||
320 | } | 317 | } |
321 | updateProfileState( IVI ); | 318 | updateProfileState( LBI ); |
322 | } | 319 | } |
@@ -324,5 +321,5 @@ void NetworkSettings::SLOT_Enable( void ) { | |||
324 | void NetworkSettings::SLOT_On( void ) { | 321 | void NetworkSettings::SLOT_On( void ) { |
325 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 322 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
326 | 323 | ||
327 | if ( ! IVI ) | 324 | if ( ! LBI ) |
328 | return; | 325 | return; |
@@ -330,3 +327,3 @@ void NetworkSettings::SLOT_On( void ) { | |||
330 | NodeCollection * NC = | 327 | NodeCollection * NC = |
331 | NSResources->findConnection( IVI->text() ); | 328 | NSResources->findConnection( LBI->text() ); |
332 | 329 | ||
@@ -359,3 +356,3 @@ void NetworkSettings::SLOT_On( void ) { | |||
359 | } | 356 | } |
360 | updateProfileState( IVI ); | 357 | updateProfileState( LBI ); |
361 | } | 358 | } |
@@ -363,5 +360,5 @@ void NetworkSettings::SLOT_On( void ) { | |||
363 | void NetworkSettings::SLOT_Connect( void ) { | 360 | void NetworkSettings::SLOT_Connect( void ) { |
364 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 361 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
365 | 362 | ||
366 | if ( ! IVI ) | 363 | if ( ! LBI ) |
367 | return; | 364 | return; |
@@ -369,3 +366,3 @@ void NetworkSettings::SLOT_Connect( void ) { | |||
369 | NodeCollection * NC = | 366 | NodeCollection * NC = |
370 | NSResources->findConnection( IVI->text() ); | 367 | NSResources->findConnection( LBI->text() ); |
371 | 368 | ||