summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp41
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,7 +1,13 @@
+
#include "backuprestore.h"
+#include "output.h"
+
+#include <qapplication.h>
+#include <qmultilineedit.h>
+
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qheader.h>
@@ -10,12 +16,18 @@
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qlist.h>
#include <stdlib.h>
#include <qregexp.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
#define HEADER_NAME 0
#define HEADER_BACKUP 1
#define BACKUP_LOCATION 2
#define EXTENSION ".bck"
@@ -162,34 +174,45 @@ void BackupAndRestore::backupPressed(){
if(getBackupFiles(backupFiles, NULL) == 0){
QMessageBox::critical(this, "Message",
"No items selected.",QString("Ok") );
return;
}
+ setCaption(tr("Backup and Restore... working..."));
QString outputFile = backupLocations[storeToLocation->currentText()];
QDateTime time = QDateTime::currentDateTime();
QString dateString = time.date().toString().replace(QRegExp(" "), "");
outputFile += "/" + dateString;
QString t = outputFile;
int c = 1;
while(QFile::exists(outputFile + EXTENSION)){
outputFile = t + QString("%1").arg(c);
c++;
}
+
+ 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"));
}
/***
* Get a list of all of the files to backup.
*/
int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent){