Diffstat (limited to 'noncore/settings/backup/backuprestore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 62 |
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,29 +1,55 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
1 | #include "backuprestore.h" | 29 | #include "backuprestore.h" |
2 | #include "errordialog.h" | 30 | #include "errordialog.h" |
3 | 31 | ||
4 | |||
5 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <qpe/qpeapplication.h> | ||
34 | #include <qpe/resource.h> | ||
35 | #include <qpe/config.h> | ||
6 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
7 | #include <opie2/ostorageinfo.h> | 37 | #include <opie2/ostorageinfo.h> |
8 | using namespace Opie::Core; | ||
9 | |||
10 | #include <opie2/ofiledialog.h> | 38 | #include <opie2/ofiledialog.h> |
11 | #include <opie2/owait.h> | 39 | #include <opie2/owait.h> |
40 | using namespace Opie::Core; | ||
12 | using namespace Opie::Ui; | 41 | using namespace Opie::Ui; |
13 | 42 | ||
14 | #include <qpe/qpeapplication.h> | ||
15 | #include <qpe/resource.h> | ||
16 | #include <qpe/config.h> | ||
17 | |||
18 | /* QT */ | 43 | /* QT */ |
19 | #include <qapplication.h> | 44 | #include <qapplication.h> |
20 | #include <qmultilineedit.h> | 45 | #include <qmultilineedit.h> |
21 | #include <qdir.h> | 46 | #include <qdir.h> |
22 | #include <qfile.h> | 47 | #include <qfile.h> |
23 | #include <qfileinfo.h> | 48 | #include <qfileinfo.h> |
24 | #include <qlistview.h> | 49 | #include <qlistview.h> |
25 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
51 | #include <qradiobutton.h> | ||
26 | #include <qheader.h> | 52 | #include <qheader.h> |
27 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
28 | #include <qcombobox.h> | 54 | #include <qcombobox.h> |
29 | #include <qlist.h> | 55 | #include <qlist.h> |
@@ -243,8 +269,22 @@ void BackupAndRestore::scanForApplicationSettings() | |||
243 | * tar and gzip --best. Report failure or success | 269 | * tar and gzip --best. Report failure or success |
244 | */ | 270 | */ |
245 | void BackupAndRestore::backup() | 271 | void BackupAndRestore::backup() |
246 | { | 272 | { |
273 | if ( cb_type_userdata->isChecked() ) | ||
274 | backupUserData(); | ||
275 | else | ||
276 | backupRootFs(); | ||
277 | } | ||
278 | |||
279 | |||
280 | void BackupAndRestore::backupRootFs() | ||
281 | { | ||
282 | QMessageBox::critical(this, "Message", "Not Yet Implemented", "Ok" ); | ||
283 | } | ||
284 | |||
285 | void BackupAndRestore::backupUserData() | ||
286 | { | ||
247 | QString backupFiles; | 287 | QString backupFiles; |
248 | if(getBackupFiles(backupFiles, NULL) == 0) | 288 | if(getBackupFiles(backupFiles, NULL) == 0) |
249 | { | 289 | { |
250 | QMessageBox::critical(this, "Message", | 290 | QMessageBox::critical(this, "Message", |
@@ -255,9 +295,9 @@ void BackupAndRestore::backup() | |||
255 | OWait *owait = new OWait(); | 295 | OWait *owait = new OWait(); |
256 | Global::statusMessage( tr( "Backing up..." ) ); | 296 | Global::statusMessage( tr( "Backing up..." ) ); |
257 | owait->show(); | 297 | owait->show(); |
258 | qApp->processEvents(); | 298 | qApp->processEvents(); |
259 | 299 | ||
260 | QString outputFile = backupLocations[storeToLocation->currentText()]; | 300 | QString outputFile = backupLocations[storeToLocation->currentText()]; |
261 | 301 | ||
262 | QDateTime datetime = QDateTime::currentDateTime(); | 302 | QDateTime datetime = QDateTime::currentDateTime(); |
263 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 303 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
@@ -290,9 +330,9 @@ void BackupAndRestore::backup() | |||
290 | int r = system( commandLine ); | 330 | int r = system( commandLine ); |
291 | 331 | ||
292 | owait->hide(); | 332 | owait->hide(); |
293 | delete owait; | 333 | delete owait; |
294 | 334 | ||
295 | //Error-Handling | 335 | //Error-Handling |
296 | if(r != 0) | 336 | if(r != 0) |
297 | { | 337 | { |
298 | perror("Error: "); | 338 | perror("Error: "); |
@@ -442,9 +482,9 @@ void BackupAndRestore::restore() | |||
442 | QMessageBox::critical(this, tr( "Message" ), | 482 | QMessageBox::critical(this, tr( "Message" ), |
443 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); | 483 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); |
444 | return; | 484 | return; |
445 | } | 485 | } |
446 | 486 | ||
447 | OWait *owait = new OWait(); | 487 | OWait *owait = new OWait(); |
448 | Global::statusMessage( tr( "Restore Backup..." ) ); | 488 | Global::statusMessage( tr( "Restore Backup..." ) ); |
449 | owait->show(); | 489 | owait->show(); |
450 | qApp->processEvents(); | 490 | qApp->processEvents(); |
@@ -481,9 +521,9 @@ void BackupAndRestore::restore() | |||
481 | r = system( commandLine ); | 521 | r = system( commandLine ); |
482 | 522 | ||
483 | owait->hide(); | 523 | owait->hide(); |
484 | delete owait; | 524 | delete owait; |
485 | 525 | ||
486 | //error handling | 526 | //error handling |
487 | if(r != 0) | 527 | if(r != 0) |
488 | { | 528 | { |
489 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 529 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |