-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 78d1414..457282a 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -161,97 +161,97 @@ void BackupAndRestore::scanForApplicationSettings(){ selectItem(newItem); ++it; } } /** * The "Backup" button has been pressed. Get a list of all of the files that * should be backed up. If there are no files, emit and error and exit. * Determine the file name to store the backup in. Backup the file(s) using * tar and gzip --best. Report failure or success */ void BackupAndRestore::backupPressed(){ QString backupFiles; 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; 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") ); + QMessageBox::information(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){ QListViewItem * currentItem; QString currentHome; if(!parent) currentItem = backupList->firstChild(); else{ currentItem = parent->firstChild(); currentHome = parent->text(BACKUP_LOCATION); } uint count = 0; while( currentItem != 0 ){ if(currentItem->text(HEADER_BACKUP) == "B" ){ if(currentItem->childCount() == 0 ){ if(parent == NULL) backupFiles += currentItem->text(BACKUP_LOCATION); else backupFiles += currentHome + currentItem->text(HEADER_NAME); backupFiles += " "; count++; } else{ count += getBackupFiles(backupFiles, currentItem); } } currentItem = currentItem->nextSibling(); } return count; } void BackupAndRestore::sourceDirChanged(int selection){ restoreList->clear(); rescanFolder(backupLocations[restoreSource->text(selection)]); } /** * Scans directory for any backup files. Will recursivly go down, * but will not follow symlinks. * @param directory - the directory to look in. */ |