summaryrefslogtreecommitdiff
path: root/noncore/settings/backup/backuprestore.cpp
authormickeyl <mickeyl>2004-11-04 15:12:01 (UTC)
committer mickeyl <mickeyl>2004-11-04 15:12:01 (UTC)
commit5f56ab623c99c12ce246f775e065632fbfbbfc1f (patch) (side-by-side diff)
tree0035922070d36de69226bfcefc4d959b5a453f61 /noncore/settings/backup/backuprestore.cpp
parent18684ddb43d4d79304dee6b20ab62513ee50b883 (diff)
downloadopie-5f56ab623c99c12ce246f775e065632fbfbbfc1f.zip
opie-5f56ab623c99c12ce246f775e065632fbfbbfc1f.tar.gz
opie-5f56ab623c99c12ce246f775e065632fbfbbfc1f.tar.bz2
- prepare for backing up root file systems (aka clone)
- add file headers - add version to .pro
Diffstat (limited to 'noncore/settings/backup/backuprestore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp62
1 files changed, 51 insertions, 11 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 1748e8d..c944c6d 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,31 +1,57 @@
+/*
+                This file is part of the Opie Project
+ =.
+             .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
#include "backuprestore.h"
#include "errordialog.h"
-
/* OPIE */
+#include <qpe/qpeapplication.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
#include <opie2/odebug.h>
#include <opie2/ostorageinfo.h>
-using namespace Opie::Core;
-
#include <opie2/ofiledialog.h>
#include <opie2/owait.h>
+using namespace Opie::Core;
using namespace Opie::Ui;
-#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
-#include <qpe/config.h>
-
/* QT */
#include <qapplication.h>
#include <qmultilineedit.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlistview.h>
#include <qpushbutton.h>
+#include <qradiobutton.h>
#include <qheader.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qlist.h>
#include <qregexp.h>
#include <qtextstream.h>
@@ -241,25 +267,39 @@ void BackupAndRestore::scanForApplicationSettings()
* 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::backup()
{
+ if ( cb_type_userdata->isChecked() )
+ backupUserData();
+ else
+ backupRootFs();
+}
+
+
+void BackupAndRestore::backupRootFs()
+{
+ QMessageBox::critical(this, "Message", "Not Yet Implemented", "Ok" );
+}
+
+void BackupAndRestore::backupUserData()
+{
QString backupFiles;
if(getBackupFiles(backupFiles, NULL) == 0)
{
QMessageBox::critical(this, "Message",
"No items selected.",QString("Ok") );
return;
}
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');
@@ -288,13 +328,13 @@ void BackupAndRestore::backup()
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 );
@@ -440,13 +480,13 @@ void BackupAndRestore::restore()
if(!restoreItem)
{
QMessageBox::critical(this, tr( "Message" ),
tr( "Please select something to restore." ),QString( tr( "Ok") ) );
return;
}
-
+
OWait *owait = new OWait();
Global::statusMessage( tr( "Restore Backup..." ) );
owait->show();
qApp->processEvents();
QString restoreFile = backupLocations[restoreSource->currentText()];
@@ -479,13 +519,13 @@ void BackupAndRestore::restore()
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" ) ) ) )