summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index b36c7a0..6ee4106 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -1,3 +1,4 @@
#include <stdio.h>
+#include <unistd.h>
#include <qpe/qpeapplication.h>
@@ -62,4 +63,8 @@ NetworkSettings::NetworkSettings( QWidget *parent,
}
+ connect( &(NSResources->system()),
+ SIGNAL( lineFromCommand(const QString &) ),
+ this, SLOT( SLOT_CmdMessage(const QString &) ) );
+
UpdateTimer->start( 5000 );
connect( UpdateTimer, SIGNAL( timeout() ),
@@ -92,4 +97,10 @@ NetworkSettings::~NetworkSettings() {
}
+void NetworkSettings::SLOT_CmdMessage( const QString & S ) {
+ Messages_LB->insertItem( S );
+ Messages_LB->setCurrentItem( Messages_LB->count()-1 );
+ Messages_LB->ensureCurrentVisible();
+}
+
void NetworkSettings::SLOT_RefreshStates( void ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember
@@ -135,4 +146,7 @@ void NetworkSettings::SLOT_RefreshStates( void ) {
}
+void NetworkSettings::SLOT_NoLongerBusy( void ) {
+ NSResources->busy( FALSE );
+}
void NetworkSettings::SLOT_AddNode( void ) {
SLOT_EditNode( 0 );
@@ -173,4 +187,6 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
// disable refresh timer
UpdateTimer->stop();
+ NSResources->busy( TRUE );
+ QTimer::singleShot( 1000, this, SLOT( SLOT_NoLongerBusy() ));
// we need to retry
while( 1 ) {
@@ -207,5 +223,5 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
int ci = Profiles_LB->count();
NSResources->addConnection( NC );
- NC->setNumber( NC->maxConnectionNumber()+1 );
+ NC->setNumber( NSResources->assignConnectionNumber() );
Profiles_LB->insertItem( NC->devicePixmap(), NC->name() );
Profiles_LB->setSelected( ci, TRUE );
@@ -258,12 +274,18 @@ void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
case Available :
OnOn = 1;
+ Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) );
DisabledOn = 0;
break;
case IsUp :
OnOn = ConnectOn = 1;
+ Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) );
DisabledOn = 0;
break;
}
+ if( ! OnOn ) {
+ Connect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) );
+ }
+
// set button state
Enable_TB->setEnabled( EnabledPossible );
@@ -276,11 +298,10 @@ void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
if( NC->description().isEmpty() ) {
- Description_LBL->setText( tr( "No description" ) );
+ Description_LBL->setText( tr( "<<No description>>" ) );
} else {
Description_LBL->setText( NC->description() );
}
- Profile_GB->setTitle( LBI->text() );
- State_LBL->setText( NC->stateName() );
+ Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
}
@@ -415,4 +436,5 @@ void NetworkSettings::SLOT_Connect( void ) {
void NetworkSettings::SLOT_Disconnect( void ) {
+ QString S;
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
@@ -423,5 +445,9 @@ void NetworkSettings::SLOT_Disconnect( void ) {
NSResources->findConnection( LBI->text() );
+ Log(( "Force interface %s down\n", NC->name().latin1() ));
NC->setState( Down, 1 );
+ // remove 'up' file to make sure
+ S.sprintf( "/tmp/Profile-%d.up", NC->number() );
+ unlink( S.latin1() );
}