Diffstat (limited to 'noncore/settings/backup/backuprestore.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 58e5c71..2eccdfe 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,11 +1,12 @@ | |||
1 | |||
2 | #include "backuprestore.h" | 1 | #include "backuprestore.h" |
3 | #include "errordialog.h" | 2 | #include "errordialog.h" |
4 | 3 | ||
5 | /* OPIE */ | 4 | /* OPIE */ |
5 | #include <opie2/odebug.h> | ||
6 | #include <opie2/ostorageinfo.h> | 6 | #include <opie2/ostorageinfo.h> |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | using namespace Opie::Core; | ||
8 | 9 | ||
9 | /* QT */ | 10 | /* QT */ |
10 | #include <qapplication.h> | 11 | #include <qapplication.h> |
11 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
@@ -39,9 +40,8 @@ | |||
39 | #define EXTENSION ".bck" | 40 | #define EXTENSION ".bck" |
40 | 41 | ||
41 | const QString tempFileName = "/tmp/backup.err"; | 42 | const QString tempFileName = "/tmp/backup.err"; |
42 | 43 | ||
43 | |||
44 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) | 44 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) |
45 | : BackupAndRestoreBase(parent, name, fl) | 45 | : BackupAndRestoreBase(parent, name, fl) |
46 | { | 46 | { |
47 | backupList->header()->hide(); | 47 | backupList->header()->hide(); |
@@ -72,19 +72,19 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
72 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); | 72 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); |
73 | if ( storage.hasCf() ) | 73 | if ( storage.hasCf() ) |
74 | { | 74 | { |
75 | backupLocations.insert( "CF", storage.cfPath() ); | 75 | backupLocations.insert( "CF", storage.cfPath() ); |
76 | qDebug( "Cf Path: " + storage.cfPath() ); | 76 | odebug << "Cf Path: " + storage.cfPath() << oendl; |
77 | } | 77 | } |
78 | if ( storage.hasSd() ) | 78 | if ( storage.hasSd() ) |
79 | { | 79 | { |
80 | backupLocations.insert( "SD", storage.sdPath() ); | 80 | backupLocations.insert( "SD", storage.sdPath() ); |
81 | qDebug( " Sd Path: " + storage.sdPath() ); | 81 | odebug << " Sd Path: " + storage.sdPath() << oendl; |
82 | } | 82 | } |
83 | if ( storage.hasMmc() ) | 83 | if ( storage.hasMmc() ) |
84 | { | 84 | { |
85 | backupLocations.insert( "MMC", storage.mmcPath() ); | 85 | backupLocations.insert( "MMC", storage.mmcPath() ); |
86 | qDebug( "Mmc Path: " + storage.mmcPath() ); | 86 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; |
87 | } | 87 | } |
88 | 88 | ||
89 | Config config("BackupAndRestore"); | 89 | Config config("BackupAndRestore"); |
90 | //read last locations | 90 | //read last locations |
@@ -202,9 +202,9 @@ void BackupAndRestore::scanForApplicationSettings() | |||
202 | QFileInfoListIterator it( *list ); | 202 | QFileInfoListIterator it( *list ); |
203 | QFileInfo *fi; | 203 | QFileInfo *fi; |
204 | while ( (fi=it.current()) ) | 204 | while ( (fi=it.current()) ) |
205 | { | 205 | { |
206 | //qDebug((d.path()+"/"+fi->fileName()).latin1()); | 206 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; |
207 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) | 207 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) |
208 | { | 208 | { |
209 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 209 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
210 | selectItem(newItem); | 210 | selectItem(newItem); |
@@ -248,18 +248,18 @@ void BackupAndRestore::backup() | |||
248 | 248 | ||
249 | // We execute tar and compressing its output with gzip.. | 249 | // We execute tar and compressing its output with gzip.. |
250 | // The error output will be written into a temp-file which could be provided | 250 | // The error output will be written into a temp-file which could be provided |
251 | // for debugging.. | 251 | // for debugging.. |
252 | qDebug( "Storing file: %s", outputFile.latin1() ); | 252 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; |
253 | outputFile += EXTENSION; | 253 | outputFile += EXTENSION; |
254 | 254 | ||
255 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) | 255 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) |
256 | .arg( getExcludeFile() ) | 256 | .arg( getExcludeFile() ) |
257 | .arg( backupFiles ) | 257 | .arg( backupFiles ) |
258 | .arg( outputFile.latin1() ) | 258 | .arg( outputFile.latin1() ) |
259 | .arg( tempFileName.latin1() ); | 259 | .arg( tempFileName.latin1() ); |
260 | 260 | ||
261 | qDebug( commandLine ); | 261 | odebug << commandLine << oendl; |
262 | 262 | ||
263 | int r = system( commandLine ); | 263 | int r = system( commandLine ); |
264 | 264 | ||
265 | if(r != 0) | 265 | if(r != 0) |
@@ -271,9 +271,9 @@ void BackupAndRestore::backup() | |||
271 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) | 271 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) |
272 | { | 272 | { |
273 | 273 | ||
274 | case 1: | 274 | case 1: |
275 | qWarning("Details pressed !"); | 275 | owarn << "Details pressed !" << oendl; |
276 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 276 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
277 | QFile errorFile( tempFileName ); | 277 | QFile errorFile( tempFileName ); |
278 | if ( errorFile.open(IO_ReadOnly) ) | 278 | if ( errorFile.open(IO_ReadOnly) ) |
279 | { | 279 | { |
@@ -358,9 +358,9 @@ void BackupAndRestore::sourceDirChanged(int selection) | |||
358 | } | 358 | } |
359 | 359 | ||
360 | void BackupAndRestore::fileListUpdate() | 360 | void BackupAndRestore::fileListUpdate() |
361 | { | 361 | { |
362 | qWarning("void BackupAndRestore::fileListUpdate()"); | 362 | owarn << "void BackupAndRestore::fileListUpdate()" << oendl; |
363 | restoreList->clear(); | 363 | restoreList->clear(); |
364 | rescanFolder( backupLocations[restoreSource->currentText()] ); | 364 | rescanFolder( backupLocations[restoreSource->currentText()] ); |
365 | } | 365 | } |
366 | 366 | ||
@@ -370,9 +370,9 @@ void BackupAndRestore::fileListUpdate() | |||
370 | * @param directory - the directory to look in. | 370 | * @param directory - the directory to look in. |
371 | */ | 371 | */ |
372 | void BackupAndRestore::rescanFolder(QString directory) | 372 | void BackupAndRestore::rescanFolder(QString directory) |
373 | { | 373 | { |
374 | //qDebug(QString("rescanFolder: ") + directory.latin1()); | 374 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
375 | QDir d(directory); | 375 | QDir d(directory); |
376 | if(!d.exists()) | 376 | if(!d.exists()) |
377 | return; | 377 | return; |
378 | 378 | ||
@@ -418,9 +418,9 @@ void BackupAndRestore::restore() | |||
418 | QString restoreFile = backupLocations[restoreSource->currentText()]; | 418 | QString restoreFile = backupLocations[restoreSource->currentText()]; |
419 | 419 | ||
420 | restoreFile += "/" + restoreItem->text(0); | 420 | restoreFile += "/" + restoreItem->text(0); |
421 | 421 | ||
422 | qDebug( restoreFile ); | 422 | odebug << restoreFile << oendl; |
423 | 423 | ||
424 | //check if backup file come from opie 1.0.x | 424 | //check if backup file come from opie 1.0.x |
425 | 425 | ||
426 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); | 426 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); |
@@ -441,9 +441,9 @@ void BackupAndRestore::restore() | |||
441 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) | 441 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) |
442 | .arg( restoreFile.latin1() ) | 442 | .arg( restoreFile.latin1() ) |
443 | .arg( tempFileName.latin1() ); | 443 | .arg( tempFileName.latin1() ); |
444 | 444 | ||
445 | qDebug( commandLine ); | 445 | odebug << commandLine << oendl; |
446 | 446 | ||
447 | r = system( commandLine ); | 447 | r = system( commandLine ); |
448 | 448 | ||
449 | //error handling | 449 | //error handling |
@@ -453,9 +453,9 @@ void BackupAndRestore::restore() | |||
453 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" | 453 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" |
454 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) | 454 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) |
455 | { | 455 | { |
456 | case 1: | 456 | case 1: |
457 | qWarning("Details pressed !"); | 457 | owarn << "Details pressed !" << oendl; |
458 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 458 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
459 | QFile errorFile( tempFileName ); | 459 | QFile errorFile( tempFileName ); |
460 | if ( errorFile.open(IO_ReadOnly) ) | 460 | if ( errorFile.open(IO_ReadOnly) ) |
461 | { | 461 | { |