summaryrefslogtreecommitdiff
authorwimpie <wimpie>2005-01-12 01:55:32 (UTC)
committer wimpie <wimpie>2005-01-12 01:55:32 (UTC)
commitc48160f6ac67b2f2fc4b6f982b641861ad078237 (patch) (unidiff)
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) (ignore 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
@@ -193,101 +193,103 @@ void NetworkSettings::SLOT_DeleteNode( void ) {
193 NSResources->removeNetworkSetup( LBI->text() ); 193 NSResources->removeNetworkSetup( LBI->text() );
194 delete LBI; 194 delete LBI;
195 NSD.setModified( 1 ); 195 NSD.setModified( 1 );
196 } 196 }
197} 197}
198 198
199void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { 199void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
200 QString OldName = ""; 200 QString OldName = "";
201 201
202 EditNetworkSetup EC( this ); 202 EditNetworkSetup EC( this );
203 203
204 if( LBI ) { 204 if( LBI ) {
205 NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); 205 NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
206 if( ! NC ) { 206 if( ! NC ) {
207 return; 207 return;
208 } 208 }
209 OldName = NC->name(); 209 OldName = NC->name();
210 EC.setNetworkSetup( NC ); 210 EC.setNetworkSetup( NC );
211 } 211 }
212 212
213 EC.showMaximized(); 213 EC.showMaximized();
214 // disable refresh timer 214 // disable refresh timer
215 UpdateTimer->stop(); 215 UpdateTimer->stop();
216 216
217 // we need to retry 217 // we need to retry
218 while( 1 ) { 218 while( 1 ) {
219 if( EC.exec() == QDialog::Accepted ) { 219 if( EC.exec() == QDialog::Accepted ) {
220 // toplevel item -> store 220 // toplevel item -> store
221 NetworkSetup * NC = EC.networkSetup(); 221 NetworkSetup * NC = EC.networkSetup();
222 if( NC->isModified() ) { 222 if( NC->isModified() ) {
223 if( LBI ) { 223 if( LBI ) {
224 if( NC->name() != OldName ) { 224 if( NC->name() != OldName ) {
225 // find if new name is free 225 // find if new name is free
226 NetworkSetup * LCN = NSResources->findNetworkSetup( 226 NetworkSetup * LCN = NSResources->findNetworkSetup(
227 NC->name() ); 227 NC->name() );
228 if( LCN ) { 228 if( LCN ) {
229 QMessageBox::warning( 229 QMessageBox::warning(
230 0, 230 0,
231 tr( "In System Config" ), 231 tr( "In System Config" ),
232 tr( "Name %1 already exists" ).arg(NC->name()) 232 tr( "Name %1 already exists" ).arg(NC->name())
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 }
254 SLOT_RefreshStates(); 256 SLOT_RefreshStates();
255 } 257 }
256 } else { 258 } else {
257 // cancelled : reset NetworkSetup 259 // cancelled : reset NetworkSetup
258 if( LBI ) { 260 if( LBI ) {
259 NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); 261 NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
260 NC->reassign(); 262 NC->reassign();
261 } 263 }
262 } 264 }
263 break; 265 break;
264 } 266 }
265 // reenable 267 // reenable
266 UpdateTimer->start( 5000 ); 268 UpdateTimer->start( 5000 );
267} 269}
268 270
269void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { 271void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
270 if( LBI == 0 ) 272 if( LBI == 0 )
271 return; 273 return;
272 274
273 NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); 275 NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() );
274 276
275 if( NC->description().isEmpty() ) { 277 if( NC->description().isEmpty() ) {
276 Description_LBL->setText( tr( "<<No description>>" ) ); 278 Description_LBL->setText( tr( "<<No description>>" ) );
277 } else { 279 } else {
278 Description_LBL->setText( NC->description() ); 280 Description_LBL->setText( NC->description() );
279 } 281 }
280 282
281 Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); 283 Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
282 284
283 bool FrmActive = 1; 285 bool FrmActive = 1;
284 bool IsEnabled = 1; 286 bool IsEnabled = 1;
285 int leds = 0; 287 int leds = 0;
286 288
287 switch( NC->state() ) { 289 switch( NC->state() ) {
288 case Disabled : // no further work 290 case Disabled : // no further work
289 IsEnabled = 0; 291 IsEnabled = 0;
290 FrmActive = 0; 292 FrmActive = 0;
291 break; 293 break;
292 case Unknown : 294 case Unknown :
293 case Unchecked : 295 case Unchecked :
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,62 +1,62 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>ProfileGUI</class> 2<class>ProfileGUI</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
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>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>1</number> 31 <number>1</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>3</number> 35 <number>3</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QTabWidget</class> 38 <class>QTabWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>TabWidget6</cstring> 41 <cstring>TabWidget6</cstring>
42 </property> 42 </property>
43 <property> 43 <property>
44 <name>layoutMargin</name> 44 <name>layoutMargin</name>
45 </property> 45 </property>
46 <property> 46 <property>
47 <name>layoutSpacing</name> 47 <name>layoutSpacing</name>
48 </property> 48 </property>
49 <widget> 49 <widget>
50 <class>QWidget</class> 50 <class>QWidget</class>
51 <property stdset="1"> 51 <property stdset="1">
52 <name>name</name> 52 <name>name</name>
53 <cstring>tab</cstring> 53 <cstring>tab</cstring>
54 </property> 54 </property>
55 <attribute> 55 <attribute>
56 <name>title</name> 56 <name>title</name>
57 <string>Setup</string> 57 <string>Setup</string>
58 </attribute> 58 </attribute>
59 <vbox> 59 <vbox>
60 <property stdset="1"> 60 <property stdset="1">
61 <name>margin</name> 61 <name>margin</name>
62 <number>1</number> 62 <number>1</number>
@@ -87,105 +87,105 @@
87 <cstring>GroupBox1</cstring> 87 <cstring>GroupBox1</cstring>
88 </property> 88 </property>
89 <property stdset="1"> 89 <property stdset="1">
90 <name>title</name> 90 <name>title</name>
91 <string>Start</string> 91 <string>Start</string>
92 </property> 92 </property>
93 <vbox> 93 <vbox>
94 <property stdset="1"> 94 <property stdset="1">
95 <name>margin</name> 95 <name>margin</name>
96 <number>11</number> 96 <number>11</number>
97 </property> 97 </property>
98 <property stdset="1"> 98 <property stdset="1">
99 <name>spacing</name> 99 <name>spacing</name>
100 <number>6</number> 100 <number>6</number>
101 </property> 101 </property>
102 <widget> 102 <widget>
103 <class>QCheckBox</class> 103 <class>QCheckBox</class>
104 <property stdset="1"> 104 <property stdset="1">
105 <name>name</name> 105 <name>name</name>
106 <cstring>Automatic_CB</cstring> 106 <cstring>Automatic_CB</cstring>
107 </property> 107 </property>
108 <property stdset="1"> 108 <property stdset="1">
109 <name>text</name> 109 <name>text</name>
110 <string>Automatically</string> 110 <string>Automatically</string>
111 </property> 111 </property>
112 </widget> 112 </widget>
113 <widget> 113 <widget>
114 <class>QCheckBox</class> 114 <class>QCheckBox</class>
115 <property stdset="1"> 115 <property stdset="1">
116 <name>name</name> 116 <name>name</name>
117 <cstring>Confirm_CB</cstring> 117 <cstring>Confirm_CB</cstring>
118 </property> 118 </property>
119 <property stdset="1"> 119 <property stdset="1">
120 <name>enabled</name> 120 <name>enabled</name>
121 <bool>true</bool> 121 <bool>true</bool>
122 </property> 122 </property>
123 <property stdset="1"> 123 <property stdset="1">
124 <name>text</name> 124 <name>text</name>
125 <string>Ask</string> 125 <string>Ask</string>
126 </property> 126 </property>
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" >
152 <class>QCheckBox</class> 152 <class>QCheckBox</class>
153 <property stdset="1"> 153 <property stdset="1">
154 <name>name</name> 154 <name>name</name>
155 <cstring>TriggersVPN_CB</cstring> 155 <cstring>TriggersVPN_CB</cstring>
156 </property> 156 </property>
157 <property stdset="1"> 157 <property stdset="1">
158 <name>text</name> 158 <name>text</name>
159 <string>Trigger VPN</string> 159 <string>Trigger VPN</string>
160 </property> 160 </property>
161 </widget> 161 </widget>
162 <spacer row="1" column="1" > 162 <spacer row="1" column="1" >
163 <property> 163 <property>
164 <name>name</name> 164 <name>name</name>
165 <cstring>Spacer8</cstring> 165 <cstring>Spacer8</cstring>
166 </property> 166 </property>
167 <property stdset="1"> 167 <property stdset="1">
168 <name>orientation</name> 168 <name>orientation</name>
169 <enum>Vertical</enum> 169 <enum>Vertical</enum>
170 </property> 170 </property>
171 <property stdset="1"> 171 <property stdset="1">
172 <name>sizeType</name> 172 <name>sizeType</name>
173 <enum>Expanding</enum> 173 <enum>Expanding</enum>
174 </property> 174 </property>
175 <property> 175 <property>
176 <name>sizeHint</name> 176 <name>sizeHint</name>
177 <size> 177 <size>
178 <width>20</width> 178 <width>20</width>
179 <height>20</height> 179 <height>20</height>
180 </size> 180 </size>
181 </property> 181 </property>
182 </spacer> 182 </spacer>
183 </grid> 183 </grid>
184 </widget> 184 </widget>
185 <widget> 185 <widget>
186 <class>QLabel</class> 186 <class>QLabel</class>
187 <property stdset="1"> 187 <property stdset="1">
188 <name>name</name> 188 <name>name</name>
189 <cstring>TextLabel3</cstring> 189 <cstring>TextLabel3</cstring>
190 </property> 190 </property>
191 <property stdset="1"> 191 <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,81 +1,83 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <opie2/odebug.h> 2#include <opie2/odebug.h>
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
7AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { 7AProfile::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
17void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { 17void 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
32void AProfile::saveSpecificAttribute( QTextStream & TS ) { 34void 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
40QWidget * AProfile::edit( QWidget * parent ) { 42QWidget * 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;
44} 46}
45 47
46QString AProfile::acceptable( void ) { 48QString AProfile::acceptable( void ) {
47 return ( GUI ) ? GUI->acceptable( ) : QString(); 49 return ( GUI ) ? GUI->acceptable( ) : QString();
48} 50}
49 51
50void AProfile::commit( void ) { 52void AProfile::commit( void ) {
51 if( GUI && GUI->commit( Data ) ) 53 if( GUI && GUI->commit( Data ) )
52 setModified( 1 ); 54 setModified( 1 );
53} 55}
54 56
55short AProfile::generateFileEmbedded( SystemFile & SF, 57short AProfile::generateFileEmbedded( SystemFile & SF,
56 long DevNr ) { 58 long DevNr ) {
57 59
58 short rvl, rvd; 60 short rvl, rvd;
59 61
60 rvl = 1; 62 rvl = 1;
61 63
62 if( SF.name() == "interfaces" ) { 64 if( SF.name() == "interfaces" ) {
63 Log(("Generate Profile for %s\n", SF.name().latin1() )); 65 Log(("Generate Profile for %s\n", SF.name().latin1() ));
64 if( Data.TriggerVPN ) { 66 if( Data.TriggerVPN ) {
65 // this profile triggers VPN -> insert trigger 67 // this profile triggers VPN -> insert trigger
66 SF << " up " 68 SF << " up "
67 << QPEApplication::qpeDir() 69 << QPEApplication::qpeDir()
68 << "bin/networksettings2 --triggervpn " 70 << "bin/networksettings2 --triggervpn "
69 << runtime()->device()->netNode()->nodeClass()->genNic( DevNr ) 71 << runtime()->device()->netNode()->nodeClass()->genNic( DevNr )
70 << " || true" 72 << " || true"
71 << endl; 73 << endl;
72 rvl = 0; 74 rvl = 0;
73 } 75 }
74 } 76 }
75 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr ); 77 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
76 return (rvd == 2 || rvl == 2 ) ? 2 : 78 return (rvd == 2 || rvl == 2 ) ? 2 :
77 (rvd == 0 || rvl == 0 ) ? 0 : 1; 79 (rvd == 0 || rvl == 0 ) ? 0 : 1;
78} 80}
79 81
80 82
81 83
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 @@
1#ifndef PROFILE_DATA_H 1#ifndef PROFILE_DATA_H
2#define PROFILE_DATA_H 2#define PROFILE_DATA_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5class ProfileData { 5class ProfileData {
6public : 6public :
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
@@ -25,101 +25,101 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
25 if( ( II = NNI->networkSetup()->assignedInterface() ) ) { 25 if( ( II = NNI->networkSetup()->assignedInterface() ) ) {
26 26
27 Refresh_CB->setEnabled( TRUE ); 27 Refresh_CB->setEnabled( TRUE );
28 ResetODO_But->setEnabled( TRUE ); 28 ResetODO_But->setEnabled( TRUE );
29 Sending_GB->setEnabled( TRUE ); 29 Sending_GB->setEnabled( TRUE );
30 Receiving_GB->setEnabled( TRUE ); 30 Receiving_GB->setEnabled( TRUE );
31 Misc_GB->setEnabled( TRUE ); 31 Misc_GB->setEnabled( TRUE );
32 32
33 // show current content 33 // show current content
34 SLOT_Refresh(); 34 SLOT_Refresh();
35 35
36 // initialize ODO 36 // initialize ODO
37 SLOT_ResetODO(); 37 SLOT_ResetODO();
38 38
39 // fill in static data 39 // fill in static data
40 InterfaceName_LBL->setText( II->Name ); 40 InterfaceName_LBL->setText( II->Name );
41 IPAddress_LBL->setText( II->Address ); 41 IPAddress_LBL->setText( II->Address );
42 SubnetMask_LBL->setText( II->Netmask ); 42 SubnetMask_LBL->setText( II->Netmask );
43 Broadcast_LBL->setText( II->BCastAddress ); 43 Broadcast_LBL->setText( II->BCastAddress );
44 MACAddress_LBL->setText( II->MACAddress ); 44 MACAddress_LBL->setText( II->MACAddress );
45 if( II->IsPointToPoint ) { 45 if( II->IsPointToPoint ) {
46 PointToPoint_LBL->setText( II->DstAddress ); 46 PointToPoint_LBL->setText( II->DstAddress );
47 } 47 }
48 QString S; 48 QString S;
49 InterfaceName_LBL->setText( II->Name ); 49 InterfaceName_LBL->setText( II->Name );
50 if( II->HasMulticast ) { 50 if( II->HasMulticast ) {
51 S += "Multicast"; 51 S += "Multicast";
52 } 52 }
53 if( ! S.isEmpty() ) { 53 if( ! S.isEmpty() ) {
54 S.prepend( " : " ); 54 S.prepend( " : " );
55 } 55 }
56 InterfaceOptions_LBL->setText( S ); 56 InterfaceOptions_LBL->setText( S );
57 57
58 connect( &RefreshTimer, SIGNAL( timeout() ), 58 connect( &RefreshTimer, SIGNAL( timeout() ),
59 this, SLOT( SLOT_Refresh() ) ); 59 this, SLOT( SLOT_Refresh() ) );
60 } 60 }
61 61
62} 62}
63 63
64QString ProfileEdit::acceptable( void ) { 64QString ProfileEdit::acceptable( void ) {
65 return QString(); 65 return QString();
66} 66}
67 67
68void ProfileEdit::showData( ProfileData & Data ) { 68void 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
77bool ProfileEdit::commit( ProfileData & Data ) { 77bool 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
89void ProfileEdit::SLOT_Refresh( void ) { 89void ProfileEdit::SLOT_Refresh( void ) {
90 InterfaceInfo * II = NNI->networkSetup()->assignedInterface(); 90 InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
91 QString S; 91 QString S;
92 NSResources->system().refreshStatistics( *II ); 92 NSResources->system().refreshStatistics( *II );
93 93
94 RcvBytes_LBL->setText( II->RcvBytes ); 94 RcvBytes_LBL->setText( II->RcvBytes );
95 RcvPackets_LBL->setText( II->RcvPackets ); 95 RcvPackets_LBL->setText( II->RcvPackets );
96 RcvErrors_LBL->setText( II->RcvErrors ); 96 RcvErrors_LBL->setText( II->RcvErrors );
97 RcvDropped_LBL->setText( II->RcvDropped ); 97 RcvDropped_LBL->setText( II->RcvDropped );
98 S.setNum( II->RcvBytes.toLong() - RcvODO ); 98 S.setNum( II->RcvBytes.toLong() - RcvODO );
99 RcvODO_LBL->setText( S ); 99 RcvODO_LBL->setText( S );
100 100
101 SndBytes_LBL->setText( II->SndBytes ); 101 SndBytes_LBL->setText( II->SndBytes );
102 SndPackets_LBL->setText( II->SndPackets ); 102 SndPackets_LBL->setText( II->SndPackets );
103 SndErrors_LBL->setText( II->SndErrors ); 103 SndErrors_LBL->setText( II->SndErrors );
104 SndDropped_LBL->setText( II->SndDropped ); 104 SndDropped_LBL->setText( II->SndDropped );
105 S.setNum( II->SndBytes.toLong() - SndODO ); 105 S.setNum( II->SndBytes.toLong() - SndODO );
106 SndODO_LBL->setText( S ); 106 SndODO_LBL->setText( S );
107 107
108 Collisions_LBL->setText( II->Collisions ); 108 Collisions_LBL->setText( II->Collisions );
109} 109}
110 110
111void ProfileEdit::SLOT_AutoRefresh( bool ar ) { 111void ProfileEdit::SLOT_AutoRefresh( bool ar ) {
112 if( ar ) { 112 if( ar ) {
113 RefreshTimer.start( 1000 ); 113 RefreshTimer.start( 1000 );
114 SLOT_Refresh(); 114 SLOT_Refresh();
115 } else { 115 } else {
116 RefreshTimer.stop(); 116 RefreshTimer.stop();
117 } 117 }
118} 118}
119 119
120void ProfileEdit::SLOT_ResetODO( void ) { 120void ProfileEdit::SLOT_ResetODO( void ) {
121 InterfaceInfo * II = NNI->networkSetup()->assignedInterface(); 121 InterfaceInfo * II = NNI->networkSetup()->assignedInterface();
122 RcvODO = II->RcvBytes.toLong(); 122 RcvODO = II->RcvBytes.toLong();
123 SndODO = II->SndBytes.toLong(); 123 SndODO = II->SndBytes.toLong();
124 SLOT_Refresh(); 124 SLOT_Refresh();
125} 125}
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
5State_t ProfileRun::detectState( void ) { 5State_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
15QString ProfileRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { 15QString 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}