-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 02998f0..618ce24 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -1,2 +1,8 @@ + #include "backuprestore.h" +#include "output.h" + +#include <qapplication.h> +#include <qmultilineedit.h> + #include <qdir.h> @@ -15,2 +21,8 @@ +#include <errno.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/stat.h> +#include <dirent.h> + #define HEADER_NAME 0 @@ -167,2 +179,3 @@ void BackupAndRestore::backupPressed(){ + setCaption(tr("Backup and Restore... working...")); QString outputFile = backupLocations[storeToLocation->currentText()]; @@ -179,12 +192,22 @@ void BackupAndRestore::backupPressed(){ } + + qDebug(QString("system(\"tar -c %1 | gzip > %2\")").arg(backupFiles).arg(outputFile).latin1()); outputFile += EXTENSION; - qDebug("system(\"tar -c %1 | gzip > %2\").arg(backupFiles).arg(outputFile).latin1())"); - int r = system(QString("tar -c %1 | gzip > %2").arg(backupFiles).arg(outputFile).latin1() ); - if(r != 0){ - QMessageBox::critical(this, "Message", "Backup Failed.",QString("Ok") ); - return; - } - else{ - QMessageBox::critical(this, "Message", "Backup Successfull.",QString("Ok") ); - } + + int r = system( QString("tar -c %1 | gzip > %2").arg(backupFiles).arg(outputFile).latin1() ); + + + + if(r != 0){ + perror("Error: "); + QString errorMsg="Error\n"+(QString)strerror(errno); + + QMessageBox::critical(this, "Message", "Backup Failed.\n"+errorMsg, QString("Ok") ); + return; + } + else{ + QMessageBox::critical(this, "Message", "Backup Successfull.",QString("Ok") ); + + } + setCaption(tr("Backup and Restore")); } |