summaryrefslogtreecommitdiff
path: root/noncore
authorkergoth <kergoth>2003-01-26 05:28:35 (UTC)
committer kergoth <kergoth>2003-01-26 05:28:35 (UTC)
commit32b223ae83b3af61ecdcdd47d93d2bb852608c20 (patch) (side-by-side diff)
treef93f06b9eab62211b0210d1d9bcae409b0723507 /noncore
parentc3347d556ea8caf355c17a169070a4c052f266de (diff)
downloadopie-32b223ae83b3af61ecdcdd47d93d2bb852608c20.zip
opie-32b223ae83b3af61ecdcdd47d93d2bb852608c20.tar.gz
opie-32b223ae83b3af61ecdcdd47d93d2bb852608c20.tar.bz2
use an information messagebox rather than critical on success, as pointed out by Ken Bantoft.
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp2
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.
*/