Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index 3ddcbde..b36c7a0 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -14,35 +14,39 @@ | |||
14 | 14 | ||
15 | #include <asdevice.h> | 15 | #include <asdevice.h> |
16 | #include "networksettings.h" | 16 | #include "networksettings.h" |
17 | #include "netnode.h" | 17 | #include "netnode.h" |
18 | #include "editconnection.h" | 18 | #include "editconnection.h" |
19 | 19 | ||
20 | NetworkSettings::NetworkSettings( QWidget *parent, | 20 | NetworkSettings::NetworkSettings( QWidget *parent, |
21 | const char *name, | 21 | const char *name, |
22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), | 22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), |
23 | NSD() { | 23 | NSD() { |
24 | 24 | ||
25 | UpdateTimer = new QTimer( this ); | 25 | UpdateTimer = new QTimer( this ); |
26 | |||
26 | // set pixmaps | 27 | // set pixmaps |
27 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 28 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
28 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 29 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
29 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); | 30 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); |
30 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); | 31 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); |
31 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); | 32 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); |
32 | 33 | ||
33 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); | 34 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); |
35 | Disconnect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); | ||
34 | 36 | ||
35 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); | 37 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); |
36 | 38 | ||
39 | SLOT_ToProfile(); | ||
40 | |||
37 | // populate main Listbox | 41 | // populate main Listbox |
38 | Profiles_LB->clear(); | 42 | Profiles_LB->clear(); |
39 | { Name2Connection_t & M = NSResources->connections(); | 43 | { Name2Connection_t & M = NSResources->connections(); |
40 | NodeCollection * NC; | 44 | NodeCollection * NC; |
41 | // for all connections | 45 | // for all connections |
42 | for( QDictIterator<NodeCollection> it(M); | 46 | for( QDictIterator<NodeCollection> it(M); |
43 | it.current(); | 47 | it.current(); |
44 | ++it ) { | 48 | ++it ) { |
45 | NC = it.current(); | 49 | NC = it.current(); |
46 | Profiles_LB->insertItem( NC->devicePixmap(), | 50 | Profiles_LB->insertItem( NC->devicePixmap(), |
47 | NC->name() ); | 51 | NC->name() ); |
48 | } | 52 | } |
@@ -267,25 +271,25 @@ void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { | |||
267 | Connect_TB->setEnabled( ConnectPossible ); | 271 | Connect_TB->setEnabled( ConnectPossible ); |
268 | 272 | ||
269 | Enable_TB->setOn( DisabledOn ); | 273 | Enable_TB->setOn( DisabledOn ); |
270 | On_TB->setOn( OnOn ); | 274 | On_TB->setOn( OnOn ); |
271 | Connect_TB->setOn( ConnectOn ); | 275 | Connect_TB->setOn( ConnectOn ); |
272 | 276 | ||
273 | if( NC->description().isEmpty() ) { | 277 | if( NC->description().isEmpty() ) { |
274 | Description_LBL->setText( tr( "No description" ) ); | 278 | Description_LBL->setText( tr( "No description" ) ); |
275 | } else { | 279 | } else { |
276 | Description_LBL->setText( NC->description() ); | 280 | Description_LBL->setText( NC->description() ); |
277 | } | 281 | } |
278 | 282 | ||
279 | CurProfile_GB->setTitle( LBI->text() ); | 283 | Profile_GB->setTitle( LBI->text() ); |
280 | State_LBL->setText( NC->stateName() ); | 284 | State_LBL->setText( NC->stateName() ); |
281 | } | 285 | } |
282 | 286 | ||
283 | void NetworkSettings::SLOT_CheckState( void ) { | 287 | void NetworkSettings::SLOT_CheckState( void ) { |
284 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 288 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
285 | if ( ! LBI ) | 289 | if ( ! LBI ) |
286 | return; | 290 | return; |
287 | updateProfileState( LBI ); | 291 | updateProfileState( LBI ); |
288 | } | 292 | } |
289 | 293 | ||
290 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { | 294 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { |
291 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { | 295 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { |
@@ -400,24 +404,46 @@ void NetworkSettings::SLOT_Connect( void ) { | |||
400 | } | 404 | } |
401 | 405 | ||
402 | if( ! rv ) { | 406 | if( ! rv ) { |
403 | QMessageBox::warning( | 407 | QMessageBox::warning( |
404 | 0, | 408 | 0, |
405 | tr( "Activating profile" ), | 409 | tr( "Activating profile" ), |
406 | tr( "Cannot enable profile" ) ); | 410 | tr( "Cannot enable profile" ) ); |
407 | } | 411 | } |
408 | 412 | ||
409 | // we do not update the GUI but wait for the REAL upping of the device | 413 | // we do not update the GUI but wait for the REAL upping of the device |
410 | } | 414 | } |
411 | 415 | ||
416 | void NetworkSettings::SLOT_Disconnect( void ) { | ||
417 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | ||
418 | |||
419 | if ( ! LBI ) | ||
420 | return; | ||
421 | |||
422 | NodeCollection * NC = | ||
423 | NSResources->findConnection( LBI->text() ); | ||
424 | |||
425 | NC->setState( Down, 1 ); | ||
426 | } | ||
427 | |||
428 | void NetworkSettings::SLOT_ToMessages( void ) { | ||
429 | Profile_GB->hide(); | ||
430 | Messages_GB->show(); | ||
431 | } | ||
432 | |||
433 | void NetworkSettings::SLOT_ToProfile( void ) { | ||
434 | Profile_GB->show(); | ||
435 | Messages_GB->hide(); | ||
436 | } | ||
437 | |||
412 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { | 438 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { |
413 | QDataStream stream( data, IO_ReadOnly ); | 439 | QDataStream stream( data, IO_ReadOnly ); |
414 | 440 | ||
415 | if( msg == "raise" ) { | 441 | if( msg == "raise" ) { |
416 | raise(); | 442 | raise(); |
417 | return; | 443 | return; |
418 | } /* if ( msg == "someMessage(int,int,int)" ) { | 444 | } /* if ( msg == "someMessage(int,int,int)" ) { |
419 | int a,b,c; | 445 | int a,b,c; |
420 | stream >> a >> b >> c; | 446 | stream >> a >> b >> c; |
421 | ... | 447 | ... |
422 | } */ | 448 | } */ |
423 | } | 449 | } |