-rw-r--r-- | noncore/settings/backup/backup.pro | 2 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 62 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.h | 31 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestorebase.ui | 185 |
4 files changed, 214 insertions, 66 deletions
diff --git a/noncore/settings/backup/backup.pro b/noncore/settings/backup/backup.pro index 390c599..e964c3a 100644 --- a/noncore/settings/backup/backup.pro +++ b/noncore/settings/backup/backup.pro @@ -5,6 +5,6 @@ INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 INTERFACES = backuprestorebase.ui errordialog.ui TARGET = backup - +VERSION = 0.8.1 include ( $(OPIEDIR)/include.pro ) 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 @@ +/* + 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> @@ -243,8 +269,22 @@ void BackupAndRestore::scanForApplicationSettings() * 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", @@ -255,9 +295,9 @@ void BackupAndRestore::backup() 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') + @@ -290,9 +330,9 @@ void BackupAndRestore::backup() int r = system( commandLine ); owait->hide(); delete owait; - + //Error-Handling if(r != 0) { perror("Error: "); @@ -442,9 +482,9 @@ void BackupAndRestore::restore() 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(); @@ -481,9 +521,9 @@ void BackupAndRestore::restore() r = system( commandLine ); owait->hide(); delete owait; - + //error handling if(r != 0) { QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); diff --git a/noncore/settings/backup/backuprestore.h b/noncore/settings/backup/backuprestore.h index 332123a..015f854 100644 --- a/noncore/settings/backup/backuprestore.h +++ b/noncore/settings/backup/backuprestore.h @@ -1,4 +1,32 @@ +/* + 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. + +*/ + #ifndef WINDOW_H #define WINDOW_H #include <qmainwindow.h> @@ -42,8 +70,11 @@ private: QList<QListViewItem> getAllItems(QListViewItem *item, QList<QListViewItem> &list); void refreshBackupLocations(); void refreshLocations(); + void backupUserData(); + void backupRootFs(); + QListViewItem *systemSettings; QListViewItem *applicationSettings; QListViewItem *documents; }; diff --git a/noncore/settings/backup/backuprestorebase.ui b/noncore/settings/backup/backuprestorebase.ui index b464556..6186d68 100644 --- a/noncore/settings/backup/backuprestorebase.ui +++ b/noncore/settings/backup/backuprestorebase.ui @@ -10,10 +10,10 @@ <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>282</width> - <height>243</height> + <width>278</width> + <height>298</height> </rect> </property> <property stdset="1"> <name>caption</name> @@ -62,67 +62,144 @@ <number>4</number> </property> <property stdset="1"> <name>spacing</name> - <number>4</number> + <number>2</number> </property> <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Save To</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QComboBox</class> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>storeToLocation</cstring> + <cstring>Layout1</cstring> </property> - </widget> - <widget row="2" column="0" rowspan="1" colspan="2" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>backupButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>&Backup</string> - </property> - </widget> - <widget row="1" column="0" rowspan="1" colspan="2" > - <class>QListView</class> - <column> - <property> - <name>text</name> - <string>Applications</string> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> </property> - <property> - <name>clickable</name> - <bool>true</bool> - </property> - <property> - <name>resizeable</name> - <bool>true</bool> + <property stdset="1"> + <name>spacing</name> + <number>6</number> </property> - </column> - <property stdset="1"> - <name>name</name> - <cstring>backupList</cstring> - </property> - <property stdset="1"> - <name>allColumnsShowFocus</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>rootIsDecorated</name> - <bool>true</bool> - </property> + <widget row="1" column="1" > + <class>QComboBox</class> + <property stdset="1"> + <name>name</name> + <cstring>storeToLocation</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="1" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Destination</string> + </property> + </widget> + <widget row="3" column="0" rowspan="1" colspan="2" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>backupButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Backup</string> + </property> + </widget> + <widget row="0" column="0" rowspan="1" colspan="2" > + <class>QButtonGroup</class> + <property stdset="1"> + <name>name</name> + <cstring>frame_type</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Type</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>4</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget> + <class>QRadioButton</class> + <property stdset="1"> + <name>name</name> + <cstring>cb_type_userdata</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>User Data (Configuration + PIM)</string> + </property> + <property stdset="1"> + <name>checked</name> + <bool>true</bool> + </property> + </widget> + <widget> + <class>QRadioButton</class> + <property stdset="1"> + <name>name</name> + <cstring>cb_type_fullbackup</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Full Backup (Root File System)</string> + </property> + </widget> + </vbox> + </widget> + <widget row="2" column="0" rowspan="1" colspan="2" > + <class>QListView</class> + <column> + <property> + <name>text</name> + <string>Applications</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <property stdset="1"> + <name>name</name> + <cstring>backupList</cstring> + </property> + <property stdset="1"> + <name>allColumnsShowFocus</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>rootIsDecorated</name> + <bool>true</bool> + </property> + </widget> + </grid> </widget> </grid> </widget> <widget> |