-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 36b101c..1748e8d 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -5,12 +5,13 @@ /* OPIE */ #include <opie2/odebug.h> #include <opie2/ostorageinfo.h> using namespace Opie::Core; #include <opie2/ofiledialog.h> +#include <opie2/owait.h> using namespace Opie::Ui; #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> @@ -248,13 +249,17 @@ void BackupAndRestore::backup() { QMessageBox::critical(this, "Message", "No items selected.",QString("Ok") ); return; } - setCaption(tr("Backup and Restore... working...")); + OWait *owait = new OWait(); + Global::statusMessage( tr( "Backing up..." ) ); + owait->show(); + qApp->processEvents(); + QString outputFile = backupLocations[storeToLocation->currentText()]; QDateTime datetime = QDateTime::currentDateTime(); QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + QString::number( datetime.date().day() ).rightJustify(2, '0'); @@ -281,12 +286,16 @@ void BackupAndRestore::backup() .arg( tempFileName.latin1() ); odebug << commandLine << oendl; int r = system( commandLine ); + owait->hide(); + delete owait; + + //Error-Handling if(r != 0) { perror("Error: "); QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" @@ -431,13 +440,17 @@ void BackupAndRestore::restore() if(!restoreItem) { QMessageBox::critical(this, tr( "Message" ), tr( "Please select something to restore." ),QString( tr( "Ok") ) ); return; } - setCaption(tr("Backup and Restore... working...")); + + OWait *owait = new OWait(); + Global::statusMessage( tr( "Restore Backup..." ) ); + owait->show(); + qApp->processEvents(); QString restoreFile = backupLocations[restoreSource->currentText()]; restoreFile += "/" + restoreItem->text(0); odebug << restoreFile << oendl; @@ -464,12 +477,15 @@ void BackupAndRestore::restore() .arg( tempFileName.latin1() ); odebug << commandLine << oendl; r = system( commandLine ); + owait->hide(); + delete owait; + //error handling if(r != 0) { QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) |