author | wimpie <wimpie> | 2005-01-12 01:55:32 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-12 01:55:32 (UTC) |
commit | c48160f6ac67b2f2fc4b6f982b641861ad078237 (patch) (unidiff) | |
tree | 2922ac7b627091ef32f36d4e8b32630c255b00e1 | |
parent | f9a83585111afa08a47176097a150d9f468bfcdf (diff) | |
download | opie-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)
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 | |||
@@ -233,21 +233,23 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | |||
233 | ); | 233 | ); |
234 | continue; // restart exec | 234 | continue; // restart exec |
235 | } // else new name | 235 | } // else new name |
236 | // new name -> remove item | 236 | // new name -> remove item |
237 | NSResources->removeNetworkSetup( OldName ); | 237 | NSResources->removeNetworkSetup( OldName ); |
238 | NSResources->addNetworkSetup( NC, 0 ); | 238 | NSResources->addNetworkSetup( NC, 0 ); |
239 | } // else not changed | 239 | } // else not changed |
240 | 240 | ||
241 | // must add it here since change will trigger event | 241 | // no update (will come later) |
242 | Profiles_LB->blockSignals( TRUE ); | ||
242 | Profiles_LB->changeItem( NC->devicePixmap(), | 243 | Profiles_LB->changeItem( NC->devicePixmap(), |
243 | NC->name(), | 244 | NC->name(), |
244 | Profiles_LB->index( LBI ) | 245 | Profiles_LB->index( LBI ) |
245 | ); | 246 | ); |
247 | Profiles_LB->blockSignals( FALSE ); | ||
246 | } else { | 248 | } else { |
247 | // new item | 249 | // new item |
248 | int ci = Profiles_LB->count(); | 250 | int ci = Profiles_LB->count(); |
249 | NSResources->addNetworkSetup( NC, 0 ); | 251 | NSResources->addNetworkSetup( NC, 0 ); |
250 | NC->setNumber( NSResources->assignNetworkSetupNumber() ); | 252 | NC->setNumber( NSResources->assignNetworkSetupNumber() ); |
251 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); | 253 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
252 | Profiles_LB->setSelected( ci, TRUE ); | 254 | Profiles_LB->setSelected( ci, TRUE ); |
253 | } | 255 | } |
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 | |||
@@ -6,17 +6,17 @@ | |||
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>Profile_FRM</cstring> | 7 | <cstring>Profile_FRM</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>551</width> | 14 | <width>547</width> |
15 | <height>547</height> | 15 | <height>547</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Profile</string> | 20 | <string>Profile</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
@@ -127,25 +127,25 @@ | |||
127 | <property> | 127 | <property> |
128 | <name>layoutMargin</name> | 128 | <name>layoutMargin</name> |
129 | </property> | 129 | </property> |
130 | </widget> | 130 | </widget> |
131 | <widget> | 131 | <widget> |
132 | <class>QCheckBox</class> | 132 | <class>QCheckBox</class> |
133 | <property stdset="1"> | 133 | <property stdset="1"> |
134 | <name>name</name> | 134 | <name>name</name> |
135 | <cstring>Disabled_CB</cstring> | 135 | <cstring>Enabled_CB</cstring> |
136 | </property> | 136 | </property> |
137 | <property stdset="1"> | 137 | <property stdset="1"> |
138 | <name>enabled</name> | 138 | <name>enabled</name> |
139 | <bool>true</bool> | 139 | <bool>true</bool> |
140 | </property> | 140 | </property> |
141 | <property stdset="1"> | 141 | <property stdset="1"> |
142 | <name>text</name> | 142 | <name>text</name> |
143 | <string>Disabled</string> | 143 | <string>Enabled</string> |
144 | </property> | 144 | </property> |
145 | <property> | 145 | <property> |
146 | <name>layoutMargin</name> | 146 | <name>layoutMargin</name> |
147 | </property> | 147 | </property> |
148 | </widget> | 148 | </widget> |
149 | </vbox> | 149 | </vbox> |
150 | </widget> | 150 | </widget> |
151 | <widget row="0" column="1" > | 151 | <widget row="0" column="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 | |||
@@ -3,41 +3,43 @@ | |||
3 | #include "profileedit.h" | 3 | #include "profileedit.h" |
4 | #include "profile_NNI.h" | 4 | #include "profile_NNI.h" |
5 | #include "profile_NN.h" | 5 | #include "profile_NN.h" |
6 | 6 | ||
7 | AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { | 7 | AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { |
8 | Data.Automatic = 1; | 8 | Data.Automatic = 1; |
9 | Data.Confirm = 0; | 9 | Data.Confirm = 0; |
10 | Data.Description = ""; | 10 | Data.Description = ""; |
11 | Data.Disabled = 0; | 11 | Data.Enabled = 1; |
12 | Data.TriggerVPN = 0; | 12 | Data.TriggerVPN = 0; |
13 | GUI = 0; | 13 | GUI = 0; |
14 | RT = 0; | 14 | RT = 0; |
15 | } | 15 | } |
16 | 16 | ||
17 | void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { | 17 | void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { |
18 | 18 | ||
19 | if ( Attr == "automatic" ) { | 19 | if ( Attr == "automatic" ) { |
20 | Data.Automatic = (Value=="yes"); | 20 | Data.Automatic = (Value=="yes"); |
21 | } else if ( Attr == "preconfirm" ) { | 21 | } else if ( Attr == "preconfirm" ) { |
22 | Data.Confirm = (Value=="yes"); | 22 | Data.Confirm = (Value=="yes"); |
23 | } else if ( Attr == "disabled" ) { | 23 | } else if ( Attr == "disabled" ) { |
24 | Data.Disabled = (Value=="yes"); | 24 | Data.Enabled = (Value=="no"); |
25 | } else if ( Attr == "enabled" ) { | ||
26 | Data.Enabled = (Value=="yes"); | ||
25 | } else if ( Attr == "triggervpn" ) { | 27 | } else if ( Attr == "triggervpn" ) { |
26 | Data.TriggerVPN = (Value=="yes"); | 28 | Data.TriggerVPN = (Value=="yes"); |
27 | } else if ( Attr == "description" ) { | 29 | } else if ( Attr == "description" ) { |
28 | Data.Description = Value; | 30 | Data.Description = Value; |
29 | } | 31 | } |
30 | } | 32 | } |
31 | 33 | ||
32 | void AProfile::saveSpecificAttribute( QTextStream & TS ) { | 34 | void AProfile::saveSpecificAttribute( QTextStream & TS ) { |
33 | TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl; | 35 | TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl; |
34 | TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl; | 36 | TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl; |
35 | TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl; | 37 | TS << "enabled=" << ((Data.Enabled) ? "yes" : "no") << endl; |
36 | TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl; | 38 | TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl; |
37 | TS << "description=" << Data.Description << endl; | 39 | TS << "description=" << Data.Description << endl; |
38 | } | 40 | } |
39 | 41 | ||
40 | QWidget * AProfile::edit( QWidget * parent ) { | 42 | QWidget * AProfile::edit( QWidget * parent ) { |
41 | GUI = new ProfileEdit( parent, this ); | 43 | GUI = new ProfileEdit( parent, this ); |
42 | GUI->showData( Data ); | 44 | GUI->showData( Data ); |
43 | return GUI; | 45 | return GUI; |
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 | |||
@@ -4,14 +4,14 @@ | |||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | class ProfileData { | 5 | class ProfileData { |
6 | public : | 6 | public : |
7 | QString Description; | 7 | QString Description; |
8 | // start up automatically | 8 | // start up automatically |
9 | bool Automatic; | 9 | bool Automatic; |
10 | // if started up automatically, ask user for confirmation | 10 | // if started up automatically, ask user for confirmation |
11 | bool Confirm; | 11 | bool Confirm; |
12 | // Do not bring this networkSetup up | 12 | // bring this networkSetup up |
13 | bool Disabled; | 13 | bool Enabled; |
14 | bool TriggerVPN; | 14 | bool TriggerVPN; |
15 | } ; | 15 | } ; |
16 | 16 | ||
17 | #endif | 17 | #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 | |||
@@ -65,27 +65,27 @@ QString ProfileEdit::acceptable( void ) { | |||
65 | return QString(); | 65 | return QString(); |
66 | } | 66 | } |
67 | 67 | ||
68 | void ProfileEdit::showData( ProfileData & Data ) { | 68 | void ProfileEdit::showData( ProfileData & Data ) { |
69 | Description_LE->setText( Data.Description ); | 69 | Description_LE->setText( Data.Description ); |
70 | Automatic_CB->setChecked( Data.Automatic ); | 70 | Automatic_CB->setChecked( Data.Automatic ); |
71 | TriggersVPN_CB->setChecked( Data.TriggerVPN ); | 71 | TriggersVPN_CB->setChecked( Data.TriggerVPN ); |
72 | Confirm_CB->setChecked( Data.Confirm ); | 72 | Confirm_CB->setChecked( Data.Confirm ); |
73 | Disabled_CB->setChecked( Data.Disabled ); | 73 | Enabled_CB->setChecked( Data.Enabled ); |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | bool ProfileEdit::commit( ProfileData & Data ) { | 77 | bool ProfileEdit::commit( ProfileData & Data ) { |
78 | bool SM = 0; | 78 | bool SM = 0; |
79 | TXTM( Data.Description, Description_LE, SM ); | 79 | TXTM( Data.Description, Description_LE, SM ); |
80 | 80 | ||
81 | CBM( Data.Automatic, Automatic_CB, SM ); | 81 | CBM( Data.Automatic, Automatic_CB, SM ); |
82 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); | 82 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); |
83 | CBM( Data.Disabled, Disabled_CB, SM ); | 83 | CBM( Data.Enabled, Enabled_CB, SM ); |
84 | CBM( Data.Confirm, Confirm_CB, SM ); | 84 | CBM( Data.Confirm, Confirm_CB, SM ); |
85 | 85 | ||
86 | return SM; | 86 | return SM; |
87 | } | 87 | } |
88 | 88 | ||
89 | void ProfileEdit::SLOT_Refresh( void ) { | 89 | void ProfileEdit::SLOT_Refresh( void ) { |
90 | InterfaceInfo * II = NNI->networkSetup()->assignedInterface(); | 90 | InterfaceInfo * II = NNI->networkSetup()->assignedInterface(); |
91 | QString S; | 91 | QString 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 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | 2 | ||
3 | #include "profilerun.h" | 3 | #include "profilerun.h" |
4 | 4 | ||
5 | State_t ProfileRun::detectState( void ) { | 5 | State_t ProfileRun::detectState( void ) { |
6 | 6 | ||
7 | Log(( "Profile %sabled\n", (Data->Disabled) ? "dis" : "en" )); | 7 | Log(( "Profile %sabled\n", (Data->Enabled) ? "en" : "dis" )); |
8 | 8 | ||
9 | if( Data->Disabled ) { | 9 | if( Data->Enabled ) { |
10 | return Disabled; | 10 | return Unknown; |
11 | } | 11 | } |
12 | return Unknown; | 12 | return Disabled; |
13 | } | 13 | } |
14 | 14 | ||
15 | QString ProfileRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { | 15 | QString ProfileRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { |
16 | odebug << "Profile " << Data->Disabled << oendl; | 16 | odebug << "Profile " << Data->Enabled << oendl; |
17 | if( A == Disable ) { | 17 | if( A == Disable ) { |
18 | if( ! Data->Disabled ) { | 18 | if( Data->Enabled ) { |
19 | Data->Disabled = 1; | 19 | Data->Enabled = 0; |
20 | NC->setModified( 1 ); | 20 | NC->setModified( 1 ); |
21 | } | 21 | } |
22 | } else if( A == Enable ) { | 22 | } else if( A == Enable ) { |
23 | if( Data->Disabled ) { | 23 | if( ! Data->Enabled ) { |
24 | Data->Disabled = 0; | 24 | Data->Enabled = 1; |
25 | NC->setModified( 1 ); | 25 | NC->setModified( 1 ); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | return QString(); | 29 | return QString(); |
30 | } | 30 | } |