summaryrefslogtreecommitdiff
authorwimpie <wimpie>2005-01-12 01:55:32 (UTC)
committer wimpie <wimpie>2005-01-12 01:55:32 (UTC)
commitc48160f6ac67b2f2fc4b6f982b641861ad078237 (patch) (side-by-side diff)
tree2922ac7b627091ef32f36d4e8b32630c255b00e1
parentf9a83585111afa08a47176097a150d9f468bfcdf (diff)
downloadopie-c48160f6ac67b2f2fc4b6f982b641861ad078237.zip
opie-c48160f6ac67b2f2fc4b6f982b641861ad078237.tar.gz
opie-c48160f6ac67b2f2fc4b6f982b641861ad078237.tar.bz2
Fixed problem with enabling profile from edit environment
rename disable to enable (much more clear)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp4
-rw-r--r--noncore/settings/networksettings2/profile/profileGUI.ui6
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp8
-rw-r--r--noncore/settings/networksettings2/profile/profiledata.h4
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.cpp4
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.cpp18
6 files changed, 24 insertions, 20 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index 2714dd5..469cec5 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -217,53 +217,55 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
// we need to retry
while( 1 ) {
if( EC.exec() == QDialog::Accepted ) {
// toplevel item -> store
NetworkSetup * NC = EC.networkSetup();
if( NC->isModified() ) {
if( LBI ) {
if( NC->name() != OldName ) {
// find if new name is free
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->removeNetworkSetup( OldName );
NSResources->addNetworkSetup( NC, 0 );
} // else not changed
- // must add it here since change will trigger event
+ // no update (will come later)
+ Profiles_LB->blockSignals( TRUE );
Profiles_LB->changeItem( NC->devicePixmap(),
NC->name(),
Profiles_LB->index( LBI )
);
+ Profiles_LB->blockSignals( FALSE );
} else {
// new item
int ci = Profiles_LB->count();
NSResources->addNetworkSetup( NC, 0 );
NC->setNumber( NSResources->assignNetworkSetupNumber() );
Profiles_LB->insertItem( NC->devicePixmap(), NC->name() );
Profiles_LB->setSelected( ci, TRUE );
}
SLOT_RefreshStates();
}
} else {
// cancelled : reset NetworkSetup
if( LBI ) {
NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
NC->reassign();
}
}
break;
}
// reenable
UpdateTimer->start( 5000 );
}
void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
diff --git a/noncore/settings/networksettings2/profile/profileGUI.ui b/noncore/settings/networksettings2/profile/profileGUI.ui
index 8b421e8..eeb2e75 100644
--- a/noncore/settings/networksettings2/profile/profileGUI.ui
+++ b/noncore/settings/networksettings2/profile/profileGUI.ui
@@ -1,38 +1,38 @@
<!DOCTYPE UI><UI>
<class>ProfileGUI</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Profile_FRM</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>551</width>
+ <width>547</width>
<height>547</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Profile</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>1</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QTabWidget</class>
@@ -111,57 +111,57 @@
</property>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>Confirm_CB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Ask</string>
</property>
<property>
<name>layoutMargin</name>
</property>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>Disabled_CB</cstring>
+ <cstring>Enabled_CB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Disabled</string>
+ <string>Enabled</string>
</property>
<property>
<name>layoutMargin</name>
</property>
</widget>
</vbox>
</widget>
<widget row="0" column="1" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>TriggersVPN_CB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Trigger VPN</string>
</property>
</widget>
<spacer row="1" column="1" >
<property>
<name>name</name>
<cstring>Spacer8</cstring>
</property>
<property stdset="1">
diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp
index fc2d809..0bc13d1 100644
--- a/noncore/settings/networksettings2/profile/profile_NNI.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp
@@ -1,59 +1,61 @@
#include <qpe/qpeapplication.h>
#include <opie2/odebug.h>
#include "profileedit.h"
#include "profile_NNI.h"
#include "profile_NN.h"
AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) {
Data.Automatic = 1;
Data.Confirm = 0;
Data.Description = "";
- Data.Disabled = 0;
+ Data.Enabled = 1;
Data.TriggerVPN = 0;
GUI = 0;
RT = 0;
}
void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) {
if ( Attr == "automatic" ) {
Data.Automatic = (Value=="yes");
} else if ( Attr == "preconfirm" ) {
Data.Confirm = (Value=="yes");
} else if ( Attr == "disabled" ) {
- Data.Disabled = (Value=="yes");
+ Data.Enabled = (Value=="no");
+ } else if ( Attr == "enabled" ) {
+ Data.Enabled = (Value=="yes");
} else if ( Attr == "triggervpn" ) {
Data.TriggerVPN = (Value=="yes");
} else if ( Attr == "description" ) {
Data.Description = Value;
}
}
void AProfile::saveSpecificAttribute( QTextStream & TS ) {
TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl;
TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl;
- TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl;
+ TS << "enabled=" << ((Data.Enabled) ? "yes" : "no") << endl;
TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl;
TS << "description=" << Data.Description << endl;
}
QWidget * AProfile::edit( QWidget * parent ) {
GUI = new ProfileEdit( parent, this );
GUI->showData( Data );
return GUI;
}
QString AProfile::acceptable( void ) {
return ( GUI ) ? GUI->acceptable( ) : QString();
}
void AProfile::commit( void ) {
if( GUI && GUI->commit( Data ) )
setModified( 1 );
}
short AProfile::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
short rvl, rvd;
diff --git a/noncore/settings/networksettings2/profile/profiledata.h b/noncore/settings/networksettings2/profile/profiledata.h
index 2f7060d..376b393 100644
--- a/noncore/settings/networksettings2/profile/profiledata.h
+++ b/noncore/settings/networksettings2/profile/profiledata.h
@@ -1,17 +1,17 @@
#ifndef PROFILE_DATA_H
#define PROFILE_DATA_H
#include <qstring.h>
class ProfileData {
public :
QString Description;
// start up automatically
bool Automatic;
// if started up automatically, ask user for confirmation
bool Confirm;
- // Do not bring this networkSetup up
- bool Disabled;
+ // bring this networkSetup up
+ bool Enabled;
bool TriggerVPN;
} ;
#endif
diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp
index 1713f0c..818bad6 100644
--- a/noncore/settings/networksettings2/profile/profileedit.cpp
+++ b/noncore/settings/networksettings2/profile/profileedit.cpp
@@ -49,59 +49,59 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
InterfaceName_LBL->setText( II->Name );
if( II->HasMulticast ) {
S += "Multicast";
}
if( ! S.isEmpty() ) {
S.prepend( " : " );
}
InterfaceOptions_LBL->setText( S );
connect( &RefreshTimer, SIGNAL( timeout() ),
this, SLOT( SLOT_Refresh() ) );
}
}
QString ProfileEdit::acceptable( void ) {
return QString();
}
void ProfileEdit::showData( ProfileData & Data ) {
Description_LE->setText( Data.Description );
Automatic_CB->setChecked( Data.Automatic );
TriggersVPN_CB->setChecked( Data.TriggerVPN );
Confirm_CB->setChecked( Data.Confirm );
- Disabled_CB->setChecked( Data.Disabled );
+ Enabled_CB->setChecked( Data.Enabled );
}
bool ProfileEdit::commit( ProfileData & Data ) {
bool SM = 0;
TXTM( Data.Description, Description_LE, SM );
CBM( Data.Automatic, Automatic_CB, SM );
CBM( Data.TriggerVPN, TriggersVPN_CB, SM );
- CBM( Data.Disabled, Disabled_CB, SM );
+ CBM( Data.Enabled, Enabled_CB, SM );
CBM( Data.Confirm, Confirm_CB, SM );
return SM;
}
void ProfileEdit::SLOT_Refresh( void ) {
InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
QString S;
NSResources->system().refreshStatistics( *II );
RcvBytes_LBL->setText( II->RcvBytes );
RcvPackets_LBL->setText( II->RcvPackets );
RcvErrors_LBL->setText( II->RcvErrors );
RcvDropped_LBL->setText( II->RcvDropped );
S.setNum( II->RcvBytes.toLong() - RcvODO );
RcvODO_LBL->setText( S );
SndBytes_LBL->setText( II->SndBytes );
SndPackets_LBL->setText( II->SndPackets );
SndErrors_LBL->setText( II->SndErrors );
SndDropped_LBL->setText( II->SndDropped );
S.setNum( II->SndBytes.toLong() - SndODO );
SndODO_LBL->setText( S );
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp
index 77bf9ac..faa7d66 100644
--- a/noncore/settings/networksettings2/profile/profilerun.cpp
+++ b/noncore/settings/networksettings2/profile/profilerun.cpp
@@ -1,30 +1,30 @@
#include <resources.h>
#include "profilerun.h"
State_t ProfileRun::detectState( void ) {
- Log(( "Profile %sabled\n", (Data->Disabled) ? "dis" : "en" ));
+ Log(( "Profile %sabled\n", (Data->Enabled) ? "en" : "dis" ));
- if( Data->Disabled ) {
- return Disabled;
- }
+ if( Data->Enabled ) {
return Unknown;
}
+ return Disabled;
+}
QString ProfileRun::setMyState( NetworkSetup * NC, Action_t A, bool ) {
- odebug << "Profile " << Data->Disabled << oendl;
+ odebug << "Profile " << Data->Enabled << oendl;
if( A == Disable ) {
- if( ! Data->Disabled ) {
- Data->Disabled = 1;
+ if( Data->Enabled ) {
+ Data->Enabled = 0;
NC->setModified( 1 );
}
} else if( A == Enable ) {
- if( Data->Disabled ) {
- Data->Disabled = 0;
+ if( ! Data->Enabled ) {
+ Data->Enabled = 1;
NC->setModified( 1 );
}
}
return QString();
}