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.cpp54
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
@@ -55,42 +55,42 @@ NetworkSettings::NetworkSettings( QWidget *parent,
SLOT_ToProfile();
// populate main Listbox
Profiles_LB->clear();
QPEApplication::setStylusOperation(
Profiles_LB->viewport(), QPEApplication::RightOnHold );
connect( Profiles_LB,
SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)),
this, SLOT(SLOT_EditNode(QListBoxItem*)) );
- { Name2Connection_t & M = NSResources->connections();
- NodeCollection * NC;
- // for all connections
- for( QDictIterator<NodeCollection> it(M);
+ { Name2NetworkSetup_t & M = NSResources->networkSetups();
+ NetworkSetup * NC;
+ // for all NetworkSetups
+ for( QDictIterator<NetworkSetup> it(M);
it.current();
++it ) {
NC = it.current();
Profiles_LB->insertItem( NC->devicePixmap(),
NC->name() );
}
}
if( Profiles_LB->count() ) {
Profiles_LB->setSelected( 0, TRUE );
}
// if no profiles -> auto popup editing
- if( NSResources->connections().count() == 0 ) {
+ if( NSResources->networkSetups().count() == 0 ) {
QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) );
}
connect( &(NSResources->system()),
SIGNAL( stdoutLine(const QString &) ),
this, SLOT( SLOT_CmdMessage(const QString &) ) );
connect( &(NSResources->system()),
SIGNAL( stderrLine(const QString &) ),
this, SLOT( SLOT_CmdMessage(const QString &) ) );
connect( &(NSResources->system()),
@@ -127,44 +127,44 @@ 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
if( LBI ) {
- NodeCollection * NC;
+ NetworkSetup * NC;
NSResources->system().probeInterfaces();
// update current selection only
- NC = NSResources->findConnection( LBI->text() );
+ NC = NSResources->findNetworkSetup( LBI->text() );
if( NC ) {
State_t OldS = NC->state();
State_t NewS = NC->state(1);
if( OldS != NewS ) {
updateProfileState( LBI );
}
}
}
/* -> LATER !!
bool is;
- NodeCollection * NC;
+ NetworkSetup * NC;
for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) {
- NC = NSResources->findConnection( Profiles_LB->text(i) );
+ NC = NSResources->findNetworkSetup( Profiles_LB->text(i) );
if( NC ) {
State_t OldS = NC->state();
State_t NewS = NC->state(1);
if( OldS != NewS ) {
is = Profiles_LB->isSelected(i);
Profiles_LB->changeItem( NC->statePixmap(NewS),
NC->name(),
i );
if( is ) {
Profiles_LB->setSelected( i, TRUE );
}
}
@@ -181,105 +181,105 @@ void NetworkSettings::SLOT_AddNode( void ) {
void NetworkSettings::SLOT_DeleteNode( void ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
if ( ! LBI )
return;
if( QMessageBox::warning(
0,
tr( "Removing profile" ),
tr( "Remove selected profile ?" ),
1, 0 ) == 1 ) {
- NSResources->removeConnection( LBI->text() );
+ NSResources->removeNetworkSetup( LBI->text() );
delete LBI;
NSD.setModified( 1 );
}
}
void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
QString OldName = "";
- EditConnection EC( this );
+ EditNetworkSetup EC( this );
if( LBI ) {
- NodeCollection * NC = NSResources->findConnection( LBI->text() );
+ NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
if( ! NC ) {
return;
}
OldName = NC->name();
- EC.setConnection( NC );
+ EC.setNetworkSetup( NC );
}
EC.showMaximized();
// disable refresh timer
UpdateTimer->stop();
// we need to retry
while( 1 ) {
if( EC.exec() == QDialog::Accepted ) {
// toplevel item -> store
- NodeCollection * NC = EC.connection();
+ NetworkSetup * NC = EC.networkSetup();
if( NC->isModified() ) {
if( LBI ) {
if( NC->name() != OldName ) {
// find if new name is free
- NodeCollection * LCN = NSResources->findConnection(
+ NetworkSetup * LCN = NSResources->findNetworkSetup(
NC->name() );
if( LCN ) {
QMessageBox::warning(
0,
tr( "In System Config" ),
tr( "Name %1 already exists" ).arg(NC->name())
);
continue; // restart exec
} // else new name
// new name -> remove item
- NSResources->removeConnection( OldName );
- NSResources->addConnection( NC, 0 );
+ NSResources->removeNetworkSetup( OldName );
+ NSResources->addNetworkSetup( NC, 0 );
} // else not changed
// must add it here since change will trigger event
Profiles_LB->changeItem( NC->devicePixmap(),
NC->name(),
Profiles_LB->index( LBI )
);
} else {
// new item
int ci = Profiles_LB->count();
- NSResources->addConnection( NC, 0 );
- NC->setNumber( NSResources->assignConnectionNumber() );
+ NSResources->addNetworkSetup( NC, 0 );
+ NC->setNumber( NSResources->assignNetworkSetupNumber() );
Profiles_LB->insertItem( NC->devicePixmap(), NC->name() );
Profiles_LB->setSelected( ci, TRUE );
}
updateProfileState( LBI );
}
} else {
- // cancelled : reset connection
+ // cancelled : reset NetworkSetup
if( LBI ) {
- NodeCollection * NC = NSResources->findConnection( LBI->text() );
+ NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
NC->reassign();
}
}
break;
}
// reenable
UpdateTimer->start( 5000 );
}
void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
if( LBI == 0 )
return;
- NodeCollection * NC = NSResources->findConnection( LBI->text() );
+ NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
if( NC->description().isEmpty() ) {
Description_LBL->setText( tr( "<<No description>>" ) );
} else {
Description_LBL->setText( NC->description() );
}
Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
bool FrmActive = 1;
bool IsEnabled = 1;
int leds = 0;
@@ -344,25 +344,25 @@ void NetworkSettings::SLOT_GenerateConfig( void ) {
tr( "Generate config" ),
S);
}
}
void NetworkSettings::SLOT_Disable( bool T ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
QString Msg;
if ( ! LBI )
return;
- NodeCollection * NC = NSResources->findConnection( LBI->text() );
+ NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
Log(( "Prepare to %sable\n", (T) ? "en" : "dis" ));
Msg = NC->setState( (T) ? Disable : Enable );
if( ! Msg.isEmpty() ) {
Msg.insert( 0, "<p>" );
Msg.append( "</p>" );
QMessageBox::warning(
0,
tr( "Activating profile" ),
Msg );
return;
}
@@ -373,26 +373,26 @@ void NetworkSettings::SLOT_Disable( bool T ) {
}
void NetworkSettings::SLOT_Up( void ) {
// bring more up
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
QString Msg;
int led = -1;
if ( ! LBI )
return;
- NodeCollection * NC =
- NSResources->findConnection( LBI->text() );
+ NetworkSetup * NC =
+ NSResources->findNetworkSetup( LBI->text() );
switch( NC->state() ) {
case Disabled : // cannot modify this state
case Unknown : // cannot modify this state
case Unchecked : // cannot modify this state
case Unavailable : // cannot modify this state
case IsUp : // highest UP state
return;
case Off : // -> activate
led = 1;
Down_TB->setEnabled( true );
Log(( "Activate interface %s\n", NC->name().latin1() ));
@@ -429,26 +429,26 @@ void NetworkSettings::SLOT_Up( void ) {
}
void NetworkSettings::SLOT_Down( void ) {
// bring more down
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
int led = -1;
QString Msg;
if ( ! LBI )
return;
- NodeCollection * NC =
- NSResources->findConnection( LBI->text() );
+ NetworkSetup * NC =
+ NSResources->findNetworkSetup( LBI->text() );
switch( NC->state() ) {
case Disabled : // cannot modify this state
case Unknown : // cannot modify this state
case Unchecked : // cannot modify this state
case Unavailable : // cannot modify this state
case Off : // highest DOWN state
break;
case Available : // -> down
led = 0;
Log(( "Deactivate interface %s\n", NC->name().latin1() ));
Msg = NC->setState( Deactivate );