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 @@ #include <qpe/qpeapplication.h> -#include <qiconset.h> +#include <qlistbox.h> #include <qgroupbox.h> @@ -37,7 +37,5 @@ NetworkSettings::NetworkSettings( QWidget *parent, // populate main Listbox - Profiles_IV->clear(); + Profiles_LB->clear(); { Name2Connection_t & M = NSResources->connections(); NodeCollection * NC; - QIconViewItem * IVI; - // for all connections @@ -47,5 +45,4 @@ NetworkSettings::NetworkSettings( QWidget *parent, NC = it.current(); - IVI = new QIconViewItem( Profiles_IV, - NC->name(), - NC->devicePixmap() ); + Profiles_LB->insertItem( NC->devicePixmap(), + NC->name() ); } @@ -53,4 +50,4 @@ NetworkSettings::NetworkSettings( QWidget *parent, - if( Profiles_IV->count() ) { - Profiles_IV->setSelected( Profiles_IV->firstItem(), TRUE ); + if( Profiles_LB->count() ) { + Profiles_LB->setSelected( 0, TRUE ); } @@ -93,5 +90,5 @@ NetworkSettings::~NetworkSettings() { void NetworkSettings::SLOT_RefreshStates( void ) { - QIconViewItem * IVI = Profiles_IV->currentItem(); // remeber + QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember - if( IVI ) { + if( LBI ) { NodeCollection * NC; @@ -99,3 +96,3 @@ void NetworkSettings::SLOT_RefreshStates( void ) { // update current selection only - NC = NSResources->findConnection( IVI->text() ); + NC = NSResources->findConnection( LBI->text() ); if( NC ) { @@ -104,3 +101,3 @@ void NetworkSettings::SLOT_RefreshStates( void ) { if( OldS != NewS ) { - updateProfileState( IVI ); + updateProfileState( LBI ); } @@ -140,5 +137,5 @@ void NetworkSettings::SLOT_AddNode( void ) { void NetworkSettings::SLOT_DeleteNode( void ) { - QIconViewItem * IVI = Profiles_IV->currentItem(); + QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); - if ( ! IVI ) + if ( ! LBI ) return; @@ -150,4 +147,4 @@ void NetworkSettings::SLOT_DeleteNode( void ) { 1, 0 ) == 1 ) { - NSResources->removeConnection( IVI->text() ); - delete IVI; + NSResources->removeConnection( LBI->text() ); + delete LBI; setModified( 1 ); @@ -157,3 +154,3 @@ void NetworkSettings::SLOT_DeleteNode( void ) { -void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { +void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { QString OldName = ""; @@ -161,4 +158,4 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { - if( IVI ) { - NodeCollection * NC = NSResources->findConnection( IVI->text() ); + if( LBI ) { + NodeCollection * NC = NSResources->findConnection( LBI->text() ); if( ! NC ) { @@ -178,3 +175,3 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { setModified( 1 ); - if( IVI ) { + if( LBI ) { // new name -> remove item @@ -183,15 +180,15 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { NSResources->addConnection( NC ); - IVI->setText( NC->name() ); - IVI->setPixmap( NC->devicePixmap() ); + Profiles_LB->changeItem( NC->devicePixmap(), + NC->name(), + Profiles_LB->index( LBI ) + ); } else { // new item + int ci = Profiles_LB->count(); NSResources->addConnection( NC ); NC->setNumber( NC->maxConnectionNumber()+1 ); - IVI = new QIconViewItem( Profiles_IV, - NC->name(), - NC->devicePixmap() - ); - Profiles_IV->setSelected( IVI, TRUE ); + Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); + Profiles_LB->setSelected( ci, TRUE ); } - updateProfileState( IVI ); + updateProfileState( LBI ); } @@ -199,4 +196,4 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { // cancelled : reset connection - if( IVI ) { - NodeCollection * NC = NSResources->findConnection( IVI->text() ); + if( LBI ) { + NodeCollection * NC = NSResources->findConnection( LBI->text() ); NC->reassign(); @@ -208,7 +205,7 @@ void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { -void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { - if( IVI == 0 ) +void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { + if( LBI == 0 ) return; - NodeCollection * NC = NSResources->findConnection( IVI->text() ); + NodeCollection * NC = NSResources->findConnection( LBI->text() ); @@ -263,3 +260,3 @@ void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { - CurProfile_GB->setTitle( IVI->text() ); + CurProfile_GB->setTitle( LBI->text() ); State_LBL->setText( NC->stateName() ); @@ -268,11 +265,11 @@ void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { void NetworkSettings::SLOT_CheckState( void ) { - QIconViewItem * IVI = Profiles_IV->currentItem(); - if ( ! IVI ) + QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); + if ( ! LBI ) return; - updateProfileState( IVI ); + updateProfileState( LBI ); } -void NetworkSettings::updateProfileState( QIconViewItem * IVI ) { - if( IVI == Profiles_IV->currentItem() ) { - SLOT_ShowNode( IVI ); +void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { + if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { + SLOT_ShowNode( LBI ); } @@ -293,5 +290,5 @@ void NetworkSettings::SLOT_GenerateConfig( void ) { void NetworkSettings::SLOT_Enable( void ) { - QIconViewItem * IVI = Profiles_IV->currentItem(); + QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); QString Msg; - if ( ! IVI ) + if ( ! LBI ) return; @@ -299,3 +296,3 @@ void NetworkSettings::SLOT_Enable( void ) { NodeCollection * NC = - NSResources->findConnection( IVI->text() ); + NSResources->findConnection( LBI->text() ); @@ -320,3 +317,3 @@ void NetworkSettings::SLOT_Enable( void ) { } - updateProfileState( IVI ); + updateProfileState( LBI ); } @@ -324,5 +321,5 @@ void NetworkSettings::SLOT_Enable( void ) { void NetworkSettings::SLOT_On( void ) { - QIconViewItem * IVI = Profiles_IV->currentItem(); + QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); - if ( ! IVI ) + if ( ! LBI ) return; @@ -330,3 +327,3 @@ void NetworkSettings::SLOT_On( void ) { NodeCollection * NC = - NSResources->findConnection( IVI->text() ); + NSResources->findConnection( LBI->text() ); @@ -359,3 +356,3 @@ void NetworkSettings::SLOT_On( void ) { } - updateProfileState( IVI ); + updateProfileState( LBI ); } @@ -363,5 +360,5 @@ void NetworkSettings::SLOT_On( void ) { void NetworkSettings::SLOT_Connect( void ) { - QIconViewItem * IVI = Profiles_IV->currentItem(); + QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); - if ( ! IVI ) + if ( ! LBI ) return; @@ -369,3 +366,3 @@ void NetworkSettings::SLOT_Connect( void ) { NodeCollection * NC = - NSResources->findConnection( IVI->text() ); + NSResources->findConnection( LBI->text() ); |