author | wimpie <wimpie> | 2005-01-12 01:40:53 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-12 01:40:53 (UTC) |
commit | f9a83585111afa08a47176097a150d9f468bfcdf (patch) (unidiff) | |
tree | 6d5a3b5f9716f7c6ca6e7fae8b0e2bac8d6c57da /noncore/settings/networksettings2/nsdata.cpp | |
parent | b2e60aa0222b348f34aab501feb8bc854e94413c (diff) | |
download | opie-f9a83585111afa08a47176097a150d9f468bfcdf.zip opie-f9a83585111afa08a47176097a150d9f468bfcdf.tar.gz opie-f9a83585111afa08a47176097a150d9f468bfcdf.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 835c7c3..6b87399 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -336,12 +336,23 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
336 | 336 | ||
337 | // open proper file | 337 | // open proper file |
338 | { SystemFile SF( (*it) ); | 338 | { SystemFile SF( (*it) ); |
339 | QStringList SL; | ||
339 | 340 | ||
340 | if( ! CurDevNN->openFile( SF, nniit.current()) ) { | 341 | if( ! CurDevNN->openFile( SF, nniit.current(), SL) ) { |
341 | // cannot open | 342 | // cannot open |
342 | S = qApp->translate( "NetworkSettings", | 343 | S = qApp->translate( "NetworkSettings", |
343 | "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ). | 344 | "<p>Cannot build proper file \"%1\" for node \"%2\"</p>" ). |
344 | arg( (*it) ).arg( CurDevNN->name() ); | 345 | arg( (*it) ). |
346 | arg( CurDevNN->name() ); | ||
347 | return S; | ||
348 | } | ||
349 | |||
350 | if( ! createPath( SL ) ) { | ||
351 | S = qApp->translate( "NetworkSettings", | ||
352 | "<p>Cannot create path \"%1\" for proper file \"%2\" for node \"%3\"</p>" ). | ||
353 | arg( SL.join("/") ). | ||
354 | arg( (*it) ). | ||
355 | arg( CurDevNN->name() ); | ||
345 | return S; | 356 | return S; |
346 | } | 357 | } |
347 | 358 | ||
@@ -379,15 +390,26 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
379 | 390 | ||
380 | if( Generated ) { | 391 | if( Generated ) { |
381 | SystemFile SF( (*it) ); | 392 | SystemFile SF( (*it) ); |
393 | QStringList SL; | ||
382 | 394 | ||
383 | if( CurDevNN->openFile( SF, 0 ) && | 395 | if( CurDevNN->openFile( SF, 0, SL ) && |
384 | ! SF.path().isEmpty() | 396 | ! SF.path().isEmpty() |
385 | ) { | 397 | ) { |
386 | 398 | ||
399 | if( ! createPath( SL ) ) { | ||
400 | S = qApp->translate( "NetworkSettings", | ||
401 | "<p>Cannot create path \"%1\" for proper file \"%2\" for node \"%3\"</p>" ). | ||
402 | arg( SL.join("/") ). | ||
403 | arg( (*it) ). | ||
404 | arg( CurDevNN->name() ); | ||
405 | return S; | ||
406 | } | ||
407 | |||
387 | if( ! SF.open() ) { | 408 | if( ! SF.open() ) { |
388 | S = qApp->translate( "NetworkSettings", | 409 | S = qApp->translate( "NetworkSettings", |
389 | "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ). | 410 | "<p>Cannot open proper file \"%1\" for node \"%2\"</p>" ). |
390 | arg( (*it) ).arg( CurDevNN->name() ); | 411 | arg( (*it) ). |
412 | arg( CurDevNN->name() ); | ||
391 | return S; | 413 | return S; |
392 | } | 414 | } |
393 | 415 | ||
@@ -785,3 +807,26 @@ QList<NetworkSetup> NetworkSettingsData::collectTriggered( | |||
785 | return PossibleTriggered; | 807 | return PossibleTriggered; |
786 | } | 808 | } |
787 | 809 | ||
810 | bool NetworkSettingsData::createPath( const QStringList & SL ) { | ||
811 | |||
812 | QDir D( SL[0] ); | ||
813 | |||
814 | for ( QStringList::ConstIterator it = SL.begin(); | ||
815 | it != SL.end(); | ||
816 | ++it ) { | ||
817 | |||
818 | printf( "Create %s\n", (*it).latin1() ); | ||
819 | if( it == SL.begin() ) | ||
820 | continue; | ||
821 | |||
822 | if( ! D.exists( *it ) ) { | ||
823 | if( ! D.mkdir( *it ) ) { | ||
824 | printf( "Failed %s %s\n", D.path().latin1(), (*it).latin1() ); | ||
825 | return 0; | ||
826 | } | ||
827 | } | ||
828 | |||
829 | D.cd( *it ); | ||
830 | } | ||
831 | return 1; | ||
832 | } | ||