10 files changed, 651 insertions, 479 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index bcef631..1e1270e 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -1 +1,3 @@ | |||
1 | #include "nsdata.h" | ||
2 | #include "activateprofile.h" | ||
1 | #include "networksettings.h" | 3 | #include "networksettings.h" |
@@ -11,5 +13,10 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | |||
11 | 13 | ||
14 | // just standard GUI | ||
12 | #define ACT_GUI 0 | 15 | #define ACT_GUI 0 |
16 | // used by interfaces to request for allow of up/down | ||
13 | #define ACT_REQUEST 1 | 17 | #define ACT_REQUEST 1 |
18 | // regenerate config files | ||
14 | #define ACT_REGEN 2 | 19 | #define ACT_REGEN 2 |
20 | // used by interfaces to request user prompt | ||
21 | #define ACT_PROMPT 3 | ||
15 | 22 | ||
@@ -34,2 +41,5 @@ int main( int argc, char * argv[] ) { | |||
34 | rmv = 1; | 41 | rmv = 1; |
42 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { | ||
43 | Action = ACT_PROMPT; | ||
44 | rmv = 1; | ||
35 | } | 45 | } |
@@ -64,24 +74,37 @@ int main( int argc, char * argv[] ) { | |||
64 | // init qt with app widget | 74 | // init qt with app widget |
65 | if( GuiType != QApplication::Tty ) { | 75 | |
66 | QWidget * W = 0; | 76 | switch( Action ) { |
67 | W = new NetworkSettings(0); | 77 | case ACT_REQUEST : |
68 | TheApp->setMainWidget( W ); | 78 | { NetworkSettingsData NS; |
69 | W->show(); | 79 | NS.canStart( argv[1] ); |
80 | } | ||
81 | break; | ||
82 | case ACT_REGEN : | ||
83 | { NetworkSettingsData NS; | ||
84 | // regen returns 0 if OK | ||
85 | rv = (NS.regenerate()) ? 1 : 0; | ||
86 | } | ||
87 | break; | ||
88 | case ACT_PROMPT : | ||
89 | { ActivateProfile AP(argv[1]); | ||
90 | if( AP.exec() == QDialog::Accepted ) { | ||
91 | printf( "%s-c%d-allowed", AP.selectedProfile() ); | ||
92 | } else { | ||
93 | printf( "%s-cNN-disallowed" ); | ||
94 | } | ||
95 | } | ||
96 | break; | ||
97 | case ACT_GUI : | ||
98 | { QWidget * W = new NetworkSettings(0); | ||
99 | TheApp->setMainWidget( W ); | ||
100 | W->show(); | ||
70 | #ifdef _WS_QWS_ | 101 | #ifdef _WS_QWS_ |
71 | W->showMaximized(); | 102 | W->showMaximized(); |
72 | #else | 103 | #else |
73 | W->resize( W->sizeHint() ); | 104 | W->resize( W->sizeHint() ); |
74 | #endif | 105 | #endif |
75 | rv = TheApp->exec(); | 106 | rv = TheApp->exec(); |
76 | delete W; | 107 | delete W; |
77 | } else { | 108 | } |
78 | switch( Action ) { | 109 | break; |
79 | case ACT_REQUEST : | ||
80 | NetworkSettings::canStart( argv[1] ); | ||
81 | break; | ||
82 | case ACT_REGEN : | ||
83 | // regen returns 0 if OK | ||
84 | rv = (NetworkSettings::regenerate()) ? 1 : 0; | ||
85 | break; | ||
86 | } | ||
87 | } | 110 | } |
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index ffe130c..f72fa8e 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -10,6 +10,2 @@ | |||
10 | #include <qiconview.h> | 10 | #include <qiconview.h> |
11 | #include <qtextstream.h> | ||
12 | #include <qdir.h> | ||
13 | #include <qfile.h> | ||
14 | #include <qfileinfo.h> | ||
15 | #include <qtimer.h> | 11 | #include <qtimer.h> |
@@ -23,355 +19,2 @@ | |||
23 | 19 | ||
24 | static QString CfgFile; | ||
25 | |||
26 | NetworkSettingsData::NetworkSettingsData( void ) { | ||
27 | // init global resources structure | ||
28 | new TheNSResources(); | ||
29 | |||
30 | CfgFile.sprintf( "%s/NETCONFIG", getenv("HOME") ); | ||
31 | |||
32 | // load settings | ||
33 | Force = 0; | ||
34 | loadSettings(); | ||
35 | } | ||
36 | |||
37 | // saving is done by caller | ||
38 | NetworkSettingsData::~NetworkSettingsData( void ) { | ||
39 | delete NSResources; | ||
40 | } | ||
41 | |||
42 | void NetworkSettingsData::loadSettings( void ) { | ||
43 | QString S; | ||
44 | ANetNodeInstance* NNI; | ||
45 | QString Attr, Value; | ||
46 | long idx; | ||
47 | |||
48 | QFile F( CfgFile ); | ||
49 | QTextStream TS( &F ); | ||
50 | |||
51 | do { | ||
52 | |||
53 | if( ! F.open(IO_ReadOnly) ) | ||
54 | break; | ||
55 | |||
56 | /* load the file -> | ||
57 | |||
58 | FORMAT : | ||
59 | |||
60 | [NETNODETYPE] | ||
61 | Entries ... | ||
62 | <EMPTYLINE> | ||
63 | [connection] | ||
64 | Name=Name | ||
65 | Node=Name | ||
66 | <EMPTYLINE> | ||
67 | */ | ||
68 | while( ! TS.atEnd() ) { | ||
69 | S = TS.readLine(); | ||
70 | |||
71 | if ( S.isEmpty() || S[0] != '[' ) | ||
72 | continue; | ||
73 | |||
74 | S = S.mid( 1, S.length()-2 ); | ||
75 | |||
76 | if( ! NSResources ) { | ||
77 | continue; | ||
78 | } | ||
79 | |||
80 | if( S == "connection" ) { | ||
81 | // load connections -> collections of nodes | ||
82 | NodeCollection * NC = new NodeCollection( TS ); | ||
83 | if ( NC->count() == 0 ) { | ||
84 | if( QMessageBox::warning( | ||
85 | 0, | ||
86 | qApp->translate( "NetworkSettings2", "Invalid connection" ), | ||
87 | qApp->translate( "NetworkSettings2", | ||
88 | "<p>Connection %1 contains unrecognized nodes and cannot be loaded</p>" ).arg(NC->name()), | ||
89 | qApp->translate( "NetworkSettings2", | ||
90 | "Remove node"), | ||
91 | qApp->translate( "NetworkSettings2", | ||
92 | "Exit program") ) == 1 ) { | ||
93 | exit( 0 ); | ||
94 | } | ||
95 | delete NC; | ||
96 | } else | ||
97 | NSResources->addConnection( NC ); | ||
98 | } else { | ||
99 | // load nodes | ||
100 | NNI = NSResources->createNodeInstance( S ); | ||
101 | if( ! NNI ) { | ||
102 | printf( "SKIPPING %s\n", S.latin1() ); | ||
103 | } | ||
104 | |||
105 | do { | ||
106 | S = TS.readLine(); | ||
107 | if( S.isEmpty() ) { | ||
108 | // empty line | ||
109 | break; | ||
110 | } | ||
111 | // node found ? | ||
112 | if( NNI ) { | ||
113 | idx = S.find( '=' ); | ||
114 | if( idx > 0 ) { | ||
115 | Attr = S.left( idx ); | ||
116 | Value = S.mid( idx+1, S.length() ); | ||
117 | } else { | ||
118 | Value=""; | ||
119 | Attr = S; | ||
120 | } | ||
121 | |||
122 | Value.stripWhiteSpace(); | ||
123 | Attr.stripWhiteSpace(); | ||
124 | Attr.lower(); | ||
125 | // dequote Attr | ||
126 | Value = deQuote(Value); | ||
127 | |||
128 | // set the attribute | ||
129 | NNI->setAttribute( Attr, Value ); | ||
130 | } | ||
131 | |||
132 | } while( 1 ); | ||
133 | if( NNI ) { | ||
134 | // loading from file -> exists | ||
135 | NNI->setNew( FALSE ); | ||
136 | NSResources->addNodeInstance( NNI ); | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | |||
141 | } while( 0 ); | ||
142 | |||
143 | } | ||
144 | |||
145 | QString NetworkSettingsData::saveSettings( void ) { | ||
146 | QString ErrS = ""; | ||
147 | |||
148 | if( ! isModified() ) | ||
149 | return ErrS; | ||
150 | |||
151 | QString S; | ||
152 | QFile F( CfgFile + ".bup" ); | ||
153 | |||
154 | printf( "Saving settings to %s\n", CfgFile.latin1() ); | ||
155 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | ||
156 | ErrS = qApp->translate( "NetworkSettings", | ||
157 | "<p>Could not save setup to %1 !</p>" ). | ||
158 | arg(CfgFile); | ||
159 | // problem | ||
160 | return ErrS; | ||
161 | } | ||
162 | |||
163 | QTextStream TS( &F ); | ||
164 | { Name2Connection_t & M = NSResources->connections(); | ||
165 | ANetNodeInstance * NNI; | ||
166 | |||
167 | // for all connections | ||
168 | for( QDictIterator<NodeCollection> it(M); | ||
169 | it.current(); | ||
170 | ++it ) { | ||
171 | // all nodes in those connections | ||
172 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | ||
173 | nit.current(); | ||
174 | ++nit ) { | ||
175 | // header | ||
176 | NNI = nit.current(); | ||
177 | TS << '[' <<NNI->netNode()->nodeName() << ']' << endl; | ||
178 | NNI->saveAttributes( TS ); | ||
179 | TS << endl; | ||
180 | } | ||
181 | |||
182 | TS << "[connection]" << endl; | ||
183 | it.current()->save(TS); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | QDir D("."); | ||
188 | D.rename( CfgFile + ".bup", CfgFile ); | ||
189 | |||
190 | // | ||
191 | // proper files AND system files regenerated | ||
192 | // | ||
193 | |||
194 | setModified( 0 ); | ||
195 | return ErrS; | ||
196 | } | ||
197 | |||
198 | QString NetworkSettingsData::generateSettings( bool ForceReq ) { | ||
199 | bool ForceIt; | ||
200 | QString S = ""; | ||
201 | |||
202 | // include own force flag | ||
203 | ForceIt = (Force) ? 1 : ForceReq; | ||
204 | |||
205 | if( ! ForceIt && ! isModified() ) | ||
206 | return S; | ||
207 | |||
208 | // regenerate system files | ||
209 | printf( "Generating settings from %s\n", CfgFile.latin1() ); | ||
210 | |||
211 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); | ||
212 | Name2Connection_t & M = NSResources->connections(); | ||
213 | NodeCollection * NC; | ||
214 | ANetNodeInstance * NNI; | ||
215 | SystemFile * SF; | ||
216 | bool needToRegenerate = ForceIt; | ||
217 | |||
218 | // | ||
219 | // check if we need to generate at least one of the system files | ||
220 | // | ||
221 | if( ! ForceIt ) { | ||
222 | for( QDictIterator<SystemFile> sfit(SFM); | ||
223 | sfit.current(); | ||
224 | ++sfit ) { | ||
225 | SF = sfit.current(); | ||
226 | |||
227 | // check if there are nodes that are modified and require | ||
228 | // data for this system file | ||
229 | |||
230 | // for all connections | ||
231 | for( QDictIterator<NodeCollection> ncit(M); | ||
232 | ncit.current(); | ||
233 | ++ncit ) { | ||
234 | NC = ncit.current(); | ||
235 | |||
236 | if( NC->isModified() ) { | ||
237 | // does this connection 'touch' this system file ? | ||
238 | for( QListIterator<ANetNodeInstance> cncit(*NC); | ||
239 | cncit.current(); | ||
240 | ++cncit ) { | ||
241 | NNI = cncit.current(); | ||
242 | if( NNI->netNode()->hasDataFor( SF->name() ) && | ||
243 | NNI->isModified() ) { | ||
244 | needToRegenerate = 1; | ||
245 | break; | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | if( needToRegenerate ) | ||
250 | break; | ||
251 | } | ||
252 | if( needToRegenerate ) | ||
253 | break; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | // we cannot renumber with a FORCE request since | ||
258 | // we probably are NOT going to save the config | ||
259 | // e.g. when using --regen option | ||
260 | if( ! ForceReq && needToRegenerate ) { | ||
261 | NSResources->renumberConnections(); | ||
262 | setModified(1); | ||
263 | } | ||
264 | |||
265 | // | ||
266 | // generate files proper to each netnodeinstance | ||
267 | // | ||
268 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); | ||
269 | ANetNodeInstance * NNI; | ||
270 | |||
271 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); | ||
272 | NNIIt.current(); | ||
273 | ++NNIIt | ||
274 | ){ | ||
275 | // for all nodes find those that are modified | ||
276 | NNI = NNIIt.current(); | ||
277 | |||
278 | if( ForceIt || NNI->isModified() ) { | ||
279 | if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) { | ||
280 | // problem generating | ||
281 | S = qApp->translate( "NetworkSettings", | ||
282 | "<p>Cannot generate files proper to %1</p>" ). | ||
283 | arg(NNI->netNode()->nodeName()) ; | ||
284 | return S; | ||
285 | } | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | |||
290 | // | ||
291 | // generate system files | ||
292 | // | ||
293 | for( QDictIterator<SystemFile> sfit(SFM); | ||
294 | sfit.current(); | ||
295 | ++sfit ) { | ||
296 | SF = sfit.current(); | ||
297 | |||
298 | // | ||
299 | // regenerate current file | ||
300 | // | ||
301 | printf( "Generating %s\n", SF->name().latin1() ); | ||
302 | SF->open(); | ||
303 | |||
304 | do { // so we can break; | ||
305 | |||
306 | if( SF->preSection() ) { | ||
307 | S = qApp->translate( "NetworkSettings", | ||
308 | "<p>Error in preSection for file %1</p>" ). | ||
309 | arg( SF->name() ); | ||
310 | return S; | ||
311 | } | ||
312 | |||
313 | for( QDictIterator<NodeCollection> ncit(M); | ||
314 | ncit.current(); | ||
315 | ++ncit ) { | ||
316 | NC = ncit.current(); | ||
317 | |||
318 | // get the netnode that serves as the device for this | ||
319 | // connection | ||
320 | AsDevice * Dev = NC->device(); | ||
321 | |||
322 | // generate 'entry' for every possible device this profile handles | ||
323 | |||
324 | for( QListIterator<ANetNodeInstance> cncit(*NC); | ||
325 | cncit.current(); | ||
326 | ++cncit ) { | ||
327 | NNI = cncit.current(); | ||
328 | for( int i = 0; i < Dev->count(); i ++ ) { | ||
329 | if( NNI->netNode()->hasDataFor( SF->name() ) ) { | ||
330 | if( SF->preNodeSection( NNI, i ) ) { | ||
331 | S = qApp->translate( "NetworkSettings", | ||
332 | "<p>Error in preNodeSection for file %1 and node %2</p>" ). | ||
333 | arg( SF->name() ). | ||
334 | arg( NNI->netNode()->nodeName() ); | ||
335 | return S; | ||
336 | } | ||
337 | |||
338 | if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) { | ||
339 | S = qApp->translate( "NetworkSettings", | ||
340 | "<p>Error in node part for file %1 and node %2</p>" ). | ||
341 | arg( SF->name() ). | ||
342 | arg( NNI->netNode()->nodeName() ); | ||
343 | return S; | ||
344 | } | ||
345 | |||
346 | if( SF->postNodeSection( NNI, i ) ) { | ||
347 | S = qApp->translate( "NetworkSettings", | ||
348 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). | ||
349 | arg( SF->name() ). | ||
350 | arg( NNI->netNode()->nodeName() ); | ||
351 | return S; | ||
352 | } | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | *SF << endl; | ||
357 | } | ||
358 | |||
359 | if( SF->postSection() ) { | ||
360 | S = qApp->translate( "NetworkSettings", | ||
361 | "<p>Error in postSection for file %1</p>" ). | ||
362 | arg( SF->name() ); | ||
363 | return S; | ||
364 | } | ||
365 | } while( 0 ); | ||
366 | SF->close(); | ||
367 | } | ||
368 | } | ||
369 | Force = 0; | ||
370 | return S; | ||
371 | } | ||
372 | |||
373 | // | ||
374 | // GUI part | ||
375 | // | ||
376 | |||
377 | NetworkSettings::NetworkSettings( QWidget *parent, | 20 | NetworkSettings::NetworkSettings( QWidget *parent, |
@@ -422,2 +65,6 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
422 | this, SLOT( SLOT_RefreshStates() ) ); | 65 | this, SLOT( SLOT_RefreshStates() ) ); |
66 | |||
67 | /* Add QCopChannel */ | ||
68 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | ||
69 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); | ||
423 | } | 70 | } |
@@ -755,66 +402,13 @@ void NetworkSettings::SLOT_Connect( void ) { | |||
755 | 402 | ||
756 | /* | 403 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { |
757 | Called by the system to see if interface can be brought UP | 404 | QDataStream stream( data, IO_ReadOnly ); |
758 | |||
759 | if allowed, echo Interface-allowed else Interface-disallowed | ||
760 | */ | ||
761 | |||
762 | void NetworkSettings::canStart( const char * Interface ) { | ||
763 | // load situation | ||
764 | NetworkSettingsData NSD; | ||
765 | |||
766 | { Name2Connection_t & M = NSResources->connections(); | ||
767 | NodeCollection * NC; | ||
768 | |||
769 | // for all connections | ||
770 | for( QDictIterator<NodeCollection> it(M); | ||
771 | it.current(); | ||
772 | ++it ) { | ||
773 | NC = it.current(); | ||
774 | // check if this profile handles the requested interface | ||
775 | if( NC->handlesInterface( Interface ) ) { | ||
776 | switch( NC->state() ) { | ||
777 | case Unchecked : | ||
778 | case Unknown : | ||
779 | case Unavailable : | ||
780 | case Disabled : | ||
781 | // this profile does not allow interface to be UP | ||
782 | // -> try others | ||
783 | break; | ||
784 | case Off : | ||
785 | // try to UP the device | ||
786 | if( ! NC->setState( Activate ) ) { | ||
787 | // cannot bring device Online -> try other alters | ||
788 | break; | ||
789 | } | ||
790 | // FT | ||
791 | case Available : | ||
792 | case IsUp : // also called for 'down' | ||
793 | // device is ready -> done | ||
794 | printf( "%s-c%d-allowed\n", | ||
795 | Interface, NC->number() ); | ||
796 | return; | ||
797 | } | ||
798 | } | ||
799 | } | ||
800 | } | ||
801 | // if we come here no alternatives are possible | ||
802 | printf( "%s-cnn-disallowed\n", Interface ); | ||
803 | } | ||
804 | |||
805 | /* | ||
806 | Called by the system to regenerate config files | ||
807 | */ | ||
808 | |||
809 | bool NetworkSettings::regenerate( void ) { | ||
810 | QString S; | ||
811 | // load situation | ||
812 | NetworkSettingsData NSD; | ||
813 | 405 | ||
814 | S = NSD.generateSettings( TRUE ); | 406 | if( msg == "raise" ) { |
815 | if( ! S.isEmpty() ) { | 407 | raise(); |
816 | fprintf( stdout, "%s\n", S.latin1() ); | 408 | return; |
817 | return 1; | 409 | } /* if ( msg == "someMessage(int,int,int)" ) { |
818 | } | 410 | int a,b,c; |
819 | return 0; | 411 | stream >> a >> b >> c; |
412 | ... | ||
413 | } */ | ||
820 | } | 414 | } |
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h index eb475a3..fadf81b 100644 --- a/noncore/settings/networksettings2/networksettings.h +++ b/noncore/settings/networksettings2/networksettings.h | |||
@@ -1 +1,2 @@ | |||
1 | #include "nsdata.h" | ||
1 | #include "networksettingsGUI.h" | 2 | #include "networksettingsGUI.h" |
@@ -8,29 +9,2 @@ class QIconViewItem; | |||
8 | 9 | ||
9 | class NetworkSettingsData { | ||
10 | |||
11 | public : | ||
12 | |||
13 | NetworkSettingsData( void ); | ||
14 | ~NetworkSettingsData( void ); | ||
15 | |||
16 | void loadSettings( void ); | ||
17 | QString saveSettings( void ); | ||
18 | |||
19 | QString generateSettings( bool Force = FALSE ); | ||
20 | |||
21 | bool isModified( void ) | ||
22 | { return IsModified; } | ||
23 | void setModified( bool m ) | ||
24 | { IsModified = m; } | ||
25 | |||
26 | void forceGeneration( bool m ) | ||
27 | { Force = m; } | ||
28 | |||
29 | private : | ||
30 | |||
31 | bool IsModified; | ||
32 | bool Force; | ||
33 | |||
34 | }; | ||
35 | |||
36 | class NetworkSettings : public NetworkSettingsGUI { | 10 | class NetworkSettings : public NetworkSettingsGUI { |
@@ -49,5 +23,2 @@ public : | |||
49 | 23 | ||
50 | static void canStart( const char * Interface ); | ||
51 | static bool regenerate( void ); | ||
52 | |||
53 | bool isModified( void ) | 24 | bool isModified( void ) |
@@ -69,2 +40,3 @@ public slots : | |||
69 | void SLOT_RefreshStates( void ); | 40 | void SLOT_RefreshStates( void ); |
41 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); | ||
70 | 42 | ||
diff --git a/noncore/settings/networksettings2/networksettings.pro b/noncore/settings/networksettings2/networksettings.pro index fb1f2cf..fe47971 100644 --- a/noncore/settings/networksettings2/networksettings.pro +++ b/noncore/settings/networksettings2/networksettings.pro | |||
@@ -4,2 +4,3 @@ CONFIG = qt warn_on debug quick-app | |||
4 | HEADERS = networksettings.h \ | 4 | HEADERS = networksettings.h \ |
5 | activateprofile.h \ | ||
5 | editconnection.h | 6 | editconnection.h |
@@ -7,2 +8,4 @@ SOURCES = main.cpp \ | |||
7 | networksettings.cpp \ | 8 | networksettings.cpp \ |
9 | nsdata.cpp \ | ||
10 | activateprofile.cpp \ | ||
8 | editconnection.cpp | 11 | editconnection.cpp |
@@ -11,3 +14,5 @@ DEPENDPATH += $(OPIEDIR)/include networksettings2/ | |||
11 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopie | 14 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings2 -lnetworksettings2 -lopie |
12 | INTERFACES = networksettingsGUI.ui editconnectionGUI.ui | 15 | INTERFACES = networksettingsGUI.ui \ |
16 | editconnectionGUI.ui \ | ||
17 | activateprofileGUI.ui | ||
13 | TARGET = networksettings2 | 18 | TARGET = networksettings2 |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index a5b572b..d36a1e5 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -278 +278,25 @@ AsDevice * RuntimeInfo::device( void ) { | |||
278 | } | 278 | } |
279 | |||
280 | ANetNodeInstance * FakeNetNode::createInstance( void ) { | ||
281 | return new FakeNetNodeInstance( this ); | ||
282 | } | ||
283 | |||
284 | void FakeNetNodeInstance::setSpecificAttribute( | ||
285 | QString & A, QString & V ) { | ||
286 | ValAttrPairs.insert( A, new QString(V) ); | ||
287 | } | ||
288 | |||
289 | void FakeNetNodeInstance::saveSpecificAttribute( QTextStream &TS ) { | ||
290 | for( QDictIterator<QString> it( ValAttrPairs ); | ||
291 | it.current(); | ||
292 | ++ it ) { | ||
293 | TS << it.currentKey().latin1() | ||
294 | << "=" | ||
295 | << quote( *(it.current())) | ||
296 | << endl ; | ||
297 | ++it; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | // collects all info that no plugin acceps | ||
302 | FakeNetNode * FakeNode = 0; | ||
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 0ecd64e..56333c5 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -5,2 +5,3 @@ | |||
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qdict.h> | ||
6 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
@@ -360,2 +361,80 @@ private : | |||
360 | 361 | ||
362 | // | ||
363 | // special node that is used to remember entries for plugins | ||
364 | // that seem missing. This way we never loose data | ||
365 | // | ||
366 | |||
367 | class FakeNetNode : public ANetNode { | ||
368 | |||
369 | public: | ||
370 | |||
371 | FakeNetNode( ) { }; | ||
372 | virtual ~FakeNetNode(){}; | ||
373 | |||
374 | const QString pixmapName() | ||
375 | { return QString(""); } | ||
376 | const QString nodeName() | ||
377 | { return QString("Fake node" ); } | ||
378 | const QString nodeDescription() | ||
379 | { return QString("Fake node" ); } | ||
380 | ANetNodeInstance * createInstance( void ); | ||
381 | const char * provides( void ) | ||
382 | { return ""; } | ||
383 | virtual const char ** needs( void ) | ||
384 | { return 0; } | ||
385 | virtual bool generateProperFilesFor( ANetNodeInstance * ) | ||
386 | { return 0; } | ||
387 | virtual bool hasDataFor( const QString & ) | ||
388 | { return 0; } | ||
389 | virtual bool generateDataForCommonFile( | ||
390 | SystemFile & , long , ANetNodeInstance * ) | ||
391 | {return 1; } | ||
392 | |||
393 | private : | ||
394 | |||
395 | }; | ||
396 | |||
397 | class FakeNetNodeInstance : public ANetNodeInstance { | ||
398 | |||
399 | public: | ||
400 | |||
401 | FakeNetNodeInstance( ANetNode * NN ) : | ||
402 | ANetNodeInstance( NN ), ValAttrPairs() { } | ||
403 | virtual ~FakeNetNodeInstance( void ) { } | ||
404 | |||
405 | virtual RuntimeInfo * runtime( void ) | ||
406 | { return 0; } | ||
407 | |||
408 | // create edit widget under parent | ||
409 | virtual QWidget * edit( QWidget * ) | ||
410 | { return 0; } | ||
411 | // is given data acceptable | ||
412 | virtual QString acceptable( void ) | ||
413 | { return QString(""); } | ||
414 | |||
415 | // get data from GUI and store in node | ||
416 | virtual void commit( void ) {} | ||
417 | |||
418 | // get next node | ||
419 | ANetNodeInstance * nextNode() | ||
420 | { return 0; } | ||
421 | // return NetNode this is an instance of | ||
422 | |||
423 | // intialize am instance of a net node | ||
424 | void initialize( void ){} | ||
425 | |||
426 | // returns node specific data -> only useful for 'buddy' | ||
427 | virtual void * data( void ) | ||
428 | { return 0; } | ||
429 | |||
430 | protected : | ||
431 | |||
432 | virtual void setSpecificAttribute( QString & , QString & ); | ||
433 | virtual void saveSpecificAttribute( QTextStream & ); | ||
434 | |||
435 | QDict<QString> ValAttrPairs; | ||
436 | }; | ||
437 | |||
438 | extern FakeNetNode * FakeNode; | ||
439 | |||
361 | #endif | 440 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index ff6e457..15e1b64 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -4,2 +4,3 @@ | |||
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <opie2/odebug.h> | ||
5 | #include <qtopia/resource.h> | 6 | #include <qtopia/resource.h> |
@@ -134,5 +135,2 @@ bool TheNSResources::loadNetNode( | |||
134 | if( ! res ){ | 135 | if( ! res ){ |
135 | #ifdef DEBUG | ||
136 | qDebug("loadNetNode: Warning: %s is not a plugin", pluginFileName.latin1()); | ||
137 | #endif | ||
138 | delete lib; | 136 | delete lib; |
@@ -148,5 +146,2 @@ bool TheNSResources::loadNetNode( | |||
148 | if( PNN.isEmpty() ) { | 146 | if( PNN.isEmpty() ) { |
149 | #ifdef DEBUG | ||
150 | qDebug("loadNetNode: Couldn't get node list, but did load library!"); | ||
151 | #endif | ||
152 | delete lib; | 147 | delete lib; |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index cfa0b7a..4df3ce3 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -54,6 +54,11 @@ public : | |||
54 | NetNode_t * NNT = AllNodeTypes[S]; | 54 | NetNode_t * NNT = AllNodeTypes[S]; |
55 | if( NNT ) { | 55 | ANetNode * NN; |
56 | NNI = NNT->NetNode->createInstance(); | 56 | if( ! NNT ) { |
57 | NNI->initialize(); | 57 | NN = FakeNode = |
58 | ( FakeNode ) ? FakeNode : new FakeNetNode(); | ||
59 | } else { | ||
60 | NN = NNT->NetNode; | ||
58 | } | 61 | } |
62 | NNI = NN->createInstance(); | ||
63 | NNI->initialize(); | ||
59 | return NNI; | 64 | return NNI; |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp new file mode 100644 index 0000000..9b2ad3a --- a/dev/null +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -0,0 +1,438 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <qpe/qpeapplication.h> | ||
3 | #include <qtextstream.h> | ||
4 | #include <qdir.h> | ||
5 | #include <qfile.h> | ||
6 | #include <qfileinfo.h> | ||
7 | |||
8 | #include "nsdata.h" | ||
9 | #include <asdevice.h> | ||
10 | #include <resources.h> | ||
11 | |||
12 | static QString CfgFile; | ||
13 | |||
14 | NetworkSettingsData::NetworkSettingsData( void ) { | ||
15 | // init global resources structure | ||
16 | new TheNSResources(); | ||
17 | |||
18 | CfgFile.sprintf( "%s/NETCONFIG", getenv("HOME") ); | ||
19 | |||
20 | // load settings | ||
21 | Force = 0; | ||
22 | loadSettings(); | ||
23 | } | ||
24 | |||
25 | // saving is done by caller | ||
26 | NetworkSettingsData::~NetworkSettingsData( void ) { | ||
27 | delete NSResources; | ||
28 | } | ||
29 | |||
30 | void NetworkSettingsData::loadSettings( void ) { | ||
31 | QString S; | ||
32 | ANetNodeInstance* NNI; | ||
33 | QString Attr, Value; | ||
34 | long idx; | ||
35 | |||
36 | QFile F( CfgFile ); | ||
37 | QTextStream TS( &F ); | ||
38 | |||
39 | do { | ||
40 | |||
41 | if( ! F.open(IO_ReadOnly) ) | ||
42 | break; | ||
43 | |||
44 | /* load the file -> | ||
45 | |||
46 | FORMAT : | ||
47 | |||
48 | [NETNODETYPE] | ||
49 | Entries ... | ||
50 | <EMPTYLINE> | ||
51 | [connection] | ||
52 | Name=Name | ||
53 | Node=Name | ||
54 | <EMPTYLINE> | ||
55 | */ | ||
56 | while( ! TS.atEnd() ) { | ||
57 | S = TS.readLine(); | ||
58 | |||
59 | if ( S.isEmpty() || S[0] != '[' ) | ||
60 | continue; | ||
61 | |||
62 | S = S.mid( 1, S.length()-2 ); | ||
63 | |||
64 | if( ! NSResources ) { | ||
65 | continue; | ||
66 | } | ||
67 | |||
68 | if( S == "connection" ) { | ||
69 | // load connections -> collections of nodes | ||
70 | NodeCollection * NC = new NodeCollection( TS ); | ||
71 | NSResources->addConnection( NC ); | ||
72 | } else { | ||
73 | // load nodes | ||
74 | NNI = NSResources->createNodeInstance( S ); | ||
75 | if( ! NNI ) { | ||
76 | printf( "SKIPPING %s\n", S.latin1() ); | ||
77 | } | ||
78 | |||
79 | do { | ||
80 | S = TS.readLine(); | ||
81 | if( S.isEmpty() ) { | ||
82 | // empty line | ||
83 | break; | ||
84 | } | ||
85 | // node found ? | ||
86 | if( NNI ) { | ||
87 | idx = S.find( '=' ); | ||
88 | if( idx > 0 ) { | ||
89 | Attr = S.left( idx ); | ||
90 | Value = S.mid( idx+1, S.length() ); | ||
91 | } else { | ||
92 | Value=""; | ||
93 | Attr = S; | ||
94 | } | ||
95 | |||
96 | Value.stripWhiteSpace(); | ||
97 | Attr.stripWhiteSpace(); | ||
98 | Attr.lower(); | ||
99 | // dequote Attr | ||
100 | Value = deQuote(Value); | ||
101 | |||
102 | // set the attribute | ||
103 | NNI->setAttribute( Attr, Value ); | ||
104 | } | ||
105 | |||
106 | } while( 1 ); | ||
107 | if( NNI ) { | ||
108 | // loading from file -> exists | ||
109 | NNI->setNew( FALSE ); | ||
110 | NSResources->addNodeInstance( NNI ); | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | |||
115 | } while( 0 ); | ||
116 | |||
117 | } | ||
118 | |||
119 | QString NetworkSettingsData::saveSettings( void ) { | ||
120 | QString ErrS = ""; | ||
121 | |||
122 | if( ! isModified() ) | ||
123 | return ErrS; | ||
124 | |||
125 | QString S; | ||
126 | QFile F( CfgFile + ".bup" ); | ||
127 | |||
128 | printf( "Saving settings to %s\n", CfgFile.latin1() ); | ||
129 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | ||
130 | ErrS = qApp->translate( "NetworkSettings", | ||
131 | "<p>Could not save setup to %1 !</p>" ). | ||
132 | arg(CfgFile); | ||
133 | // problem | ||
134 | return ErrS; | ||
135 | } | ||
136 | |||
137 | QTextStream TS( &F ); | ||
138 | { Name2Connection_t & M = NSResources->connections(); | ||
139 | ANetNodeInstance * NNI; | ||
140 | |||
141 | // for all connections | ||
142 | for( QDictIterator<NodeCollection> it(M); | ||
143 | it.current(); | ||
144 | ++it ) { | ||
145 | // all nodes in those connections | ||
146 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | ||
147 | nit.current(); | ||
148 | ++nit ) { | ||
149 | // header | ||
150 | NNI = nit.current(); | ||
151 | TS << '[' <<NNI->netNode()->nodeName() << ']' << endl; | ||
152 | NNI->saveAttributes( TS ); | ||
153 | TS << endl; | ||
154 | } | ||
155 | |||
156 | TS << "[connection]" << endl; | ||
157 | it.current()->save(TS); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | QDir D("."); | ||
162 | D.rename( CfgFile + ".bup", CfgFile ); | ||
163 | |||
164 | // | ||
165 | // proper files AND system files regenerated | ||
166 | // | ||
167 | |||
168 | setModified( 0 ); | ||
169 | return ErrS; | ||
170 | } | ||
171 | |||
172 | QString NetworkSettingsData::generateSettings( bool ForceReq ) { | ||
173 | bool ForceIt; | ||
174 | QString S = ""; | ||
175 | |||
176 | // include own force flag | ||
177 | ForceIt = (Force) ? 1 : ForceReq; | ||
178 | |||
179 | if( ! ForceIt && ! isModified() ) | ||
180 | return S; | ||
181 | |||
182 | // regenerate system files | ||
183 | printf( "Generating settings from %s\n", CfgFile.latin1() ); | ||
184 | |||
185 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); | ||
186 | Name2Connection_t & M = NSResources->connections(); | ||
187 | NodeCollection * NC; | ||
188 | ANetNodeInstance * NNI; | ||
189 | SystemFile * SF; | ||
190 | bool needToRegenerate = ForceIt; | ||
191 | |||
192 | // | ||
193 | // check if we need to generate at least one of the system files | ||
194 | // | ||
195 | if( ! ForceIt ) { | ||
196 | for( QDictIterator<SystemFile> sfit(SFM); | ||
197 | sfit.current(); | ||
198 | ++sfit ) { | ||
199 | SF = sfit.current(); | ||
200 | |||
201 | // check if there are nodes that are modified and require | ||
202 | // data for this system file | ||
203 | |||
204 | // for all connections | ||
205 | for( QDictIterator<NodeCollection> ncit(M); | ||
206 | ncit.current(); | ||
207 | ++ncit ) { | ||
208 | NC = ncit.current(); | ||
209 | |||
210 | if( NC->isModified() ) { | ||
211 | // does this connection 'touch' this system file ? | ||
212 | for( QListIterator<ANetNodeInstance> cncit(*NC); | ||
213 | cncit.current(); | ||
214 | ++cncit ) { | ||
215 | NNI = cncit.current(); | ||
216 | if( NNI->netNode()->hasDataFor( SF->name() ) && | ||
217 | NNI->isModified() ) { | ||
218 | needToRegenerate = 1; | ||
219 | break; | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | if( needToRegenerate ) | ||
224 | break; | ||
225 | } | ||
226 | if( needToRegenerate ) | ||
227 | break; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | // we cannot renumber with a FORCE request since | ||
232 | // we probably are NOT going to save the config | ||
233 | // e.g. when using --regen option | ||
234 | if( ! ForceReq && needToRegenerate ) { | ||
235 | NSResources->renumberConnections(); | ||
236 | setModified(1); | ||
237 | } | ||
238 | |||
239 | // | ||
240 | // generate files proper to each netnodeinstance | ||
241 | // | ||
242 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); | ||
243 | ANetNodeInstance * NNI; | ||
244 | |||
245 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); | ||
246 | NNIIt.current(); | ||
247 | ++NNIIt | ||
248 | ){ | ||
249 | // for all nodes find those that are modified | ||
250 | NNI = NNIIt.current(); | ||
251 | |||
252 | if( ForceIt || NNI->isModified() ) { | ||
253 | if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) { | ||
254 | // problem generating | ||
255 | S = qApp->translate( "NetworkSettings", | ||
256 | "<p>Cannot generate files proper to %1</p>" ). | ||
257 | arg(NNI->netNode()->nodeName()) ; | ||
258 | return S; | ||
259 | } | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | |||
264 | // | ||
265 | // generate system files | ||
266 | // | ||
267 | for( QDictIterator<SystemFile> sfit(SFM); | ||
268 | sfit.current(); | ||
269 | ++sfit ) { | ||
270 | SF = sfit.current(); | ||
271 | |||
272 | // | ||
273 | // regenerate current file | ||
274 | // | ||
275 | printf( "Generating %s\n", SF->name().latin1() ); | ||
276 | SF->open(); | ||
277 | |||
278 | do { // so we can break; | ||
279 | |||
280 | if( SF->preSection() ) { | ||
281 | S = qApp->translate( "NetworkSettings", | ||
282 | "<p>Error in preSection for file %1</p>" ). | ||
283 | arg( SF->name() ); | ||
284 | return S; | ||
285 | } | ||
286 | |||
287 | for( QDictIterator<NodeCollection> ncit(M); | ||
288 | ncit.current(); | ||
289 | ++ncit ) { | ||
290 | NC = ncit.current(); | ||
291 | |||
292 | // get the netnode that serves as the device for this | ||
293 | // connection | ||
294 | AsDevice * Dev = NC->device(); | ||
295 | |||
296 | // generate 'entry' for every possible device this profile handles | ||
297 | |||
298 | for( QListIterator<ANetNodeInstance> cncit(*NC); | ||
299 | cncit.current(); | ||
300 | ++cncit ) { | ||
301 | NNI = cncit.current(); | ||
302 | for( int i = 0; i < Dev->count(); i ++ ) { | ||
303 | if( NNI->netNode()->hasDataFor( SF->name() ) ) { | ||
304 | if( SF->preNodeSection( NNI, i ) ) { | ||
305 | S = qApp->translate( "NetworkSettings", | ||
306 | "<p>Error in preNodeSection for file %1 and node %2</p>" ). | ||
307 | arg( SF->name() ). | ||
308 | arg( NNI->netNode()->nodeName() ); | ||
309 | return S; | ||
310 | } | ||
311 | |||
312 | if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) { | ||
313 | S = qApp->translate( "NetworkSettings", | ||
314 | "<p>Error in node part for file %1 and node %2</p>" ). | ||
315 | arg( SF->name() ). | ||
316 | arg( NNI->netNode()->nodeName() ); | ||
317 | return S; | ||
318 | } | ||
319 | |||
320 | if( SF->postNodeSection( NNI, i ) ) { | ||
321 | S = qApp->translate( "NetworkSettings", | ||
322 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). | ||
323 | arg( SF->name() ). | ||
324 | arg( NNI->netNode()->nodeName() ); | ||
325 | return S; | ||
326 | } | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | *SF << endl; | ||
331 | } | ||
332 | |||
333 | if( SF->postSection() ) { | ||
334 | S = qApp->translate( "NetworkSettings", | ||
335 | "<p>Error in postSection for file %1</p>" ). | ||
336 | arg( SF->name() ); | ||
337 | return S; | ||
338 | } | ||
339 | } while( 0 ); | ||
340 | SF->close(); | ||
341 | } | ||
342 | } | ||
343 | Force = 0; | ||
344 | return S; | ||
345 | } | ||
346 | |||
347 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { | ||
348 | // collect connections that can work on top of this interface | ||
349 | NodeCollection * NC; | ||
350 | QList<NodeCollection> PossibleConnections; | ||
351 | Name2Connection_t & M = NSResources->connections(); | ||
352 | |||
353 | // for all connections | ||
354 | for( QDictIterator<NodeCollection> it(M); | ||
355 | it.current(); | ||
356 | ++it ) { | ||
357 | NC = it.current(); | ||
358 | // check if this profile handles the requested interface | ||
359 | if( NC->handlesInterface( Interface ) && // if different Intf. | ||
360 | NC->state() != Disabled && // if not enabled | ||
361 | NC->state() != IsUp // if already used | ||
362 | ) { | ||
363 | PossibleConnections.append( NC ); | ||
364 | } | ||
365 | } | ||
366 | return PossibleConnections; | ||
367 | } | ||
368 | |||
369 | |||
370 | /* | ||
371 | Called by the system to see if interface can be brought UP | ||
372 | |||
373 | if allowed, echo Interface-allowed else Interface-disallowed | ||
374 | */ | ||
375 | |||
376 | void NetworkSettingsData::canStart( const char * Interface ) { | ||
377 | // load situation | ||
378 | NodeCollection * NC = 0; | ||
379 | QList<NodeCollection> PossibleConnections; | ||
380 | |||
381 | PossibleConnections = collectPossible( Interface ); | ||
382 | |||
383 | switch( PossibleConnections.count() ) { | ||
384 | case 0 : // no connections | ||
385 | break; | ||
386 | case 1 : // one connection | ||
387 | NC = PossibleConnections.first(); | ||
388 | break; | ||
389 | default : // need to ask user ? | ||
390 | // are we connected to a server | ||
391 | // system( "su %d networksettings2 --prompt %s\n", | ||
392 | // "", Interface ); | ||
393 | break; | ||
394 | } | ||
395 | |||
396 | if( NC ) { | ||
397 | switch( NC->state() ) { | ||
398 | case Unchecked : | ||
399 | case Unknown : | ||
400 | case Unavailable : | ||
401 | case Disabled : | ||
402 | // this profile does not allow interface to be UP | ||
403 | // -> try others | ||
404 | break; | ||
405 | case Off : | ||
406 | // try to UP the device | ||
407 | if( ! NC->setState( Activate ) ) { | ||
408 | // cannot bring device Online -> try other alters | ||
409 | break; | ||
410 | } | ||
411 | // FT | ||
412 | case Available : | ||
413 | case IsUp : // also called for 'ifdown' | ||
414 | // device is ready -> done | ||
415 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); | ||
416 | return; | ||
417 | } | ||
418 | } else { | ||
419 | // if we come here no alternatives are possible | ||
420 | printf( "%s-cnn-disallowed\n", Interface ); | ||
421 | } | ||
422 | } | ||
423 | |||
424 | /* | ||
425 | Called by the system to regenerate config files | ||
426 | */ | ||
427 | |||
428 | bool NetworkSettingsData::regenerate( void ) { | ||
429 | QString S; | ||
430 | // load situation | ||
431 | S = generateSettings( TRUE ); | ||
432 | if( ! S.isEmpty() ) { | ||
433 | fprintf( stdout, "%s\n", S.latin1() ); | ||
434 | return 1; | ||
435 | } | ||
436 | return 0; | ||
437 | } | ||
438 | |||
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h new file mode 100644 index 0000000..55f8c71 --- a/dev/null +++ b/noncore/settings/networksettings2/nsdata.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __NSDATA_H | ||
2 | #define __NSDATA_H | ||
3 | |||
4 | #include "netnode.h" | ||
5 | |||
6 | class NetworkSettingsData { | ||
7 | |||
8 | public : | ||
9 | |||
10 | NetworkSettingsData( void ); | ||
11 | ~NetworkSettingsData( void ); | ||
12 | |||
13 | void loadSettings( void ); | ||
14 | QString saveSettings( void ); | ||
15 | |||
16 | QString generateSettings( bool Force = FALSE ); | ||
17 | |||
18 | bool isModified( void ) | ||
19 | { return IsModified; } | ||
20 | void setModified( bool m ) | ||
21 | { IsModified = m; } | ||
22 | |||
23 | QList<NodeCollection> collectPossible( const char * Interface ); | ||
24 | void canStart( const char * Interface ); | ||
25 | bool regenerate( void ); | ||
26 | |||
27 | void forceGeneration( bool m ) | ||
28 | { Force = m; } | ||
29 | |||
30 | private : | ||
31 | |||
32 | bool IsModified; | ||
33 | bool Force; | ||
34 | |||
35 | }; | ||
36 | |||
37 | #endif | ||