author | drw <drw> | 2005-02-23 17:35:32 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-23 17:35:32 (UTC) |
commit | 9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262 (patch) (unidiff) | |
tree | a0fc4cdf1afdb5a75377a61f738286da0ac27594 | |
parent | 62010b750741307bf56d4db289dcf22f4a6eeb0d (diff) | |
download | opie-9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262.zip opie-9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262.tar.gz opie-9e2e6d962e1e2d3e5c17641d9a9b21a5906bd262.tar.bz2 |
Disable full backup option for Opie 1.2, since it might not work correctly due to memory constraints
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 51 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestorebase.ui | 53 |
2 files changed, 26 insertions, 78 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 180980a..5a4e284 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,55 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> | 4 | .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "backuprestore.h" | 29 | #include "backuprestore.h" |
30 | #include "errordialog.h" | 30 | #include "errordialog.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | #include <opie2/odevice.h> | 37 | #include <opie2/odevice.h> |
38 | #include <opie2/ostorageinfo.h> | 38 | #include <opie2/ostorageinfo.h> |
39 | #include <opie2/ofiledialog.h> | 39 | #include <opie2/ofiledialog.h> |
40 | #include <opie2/owait.h> | 40 | #include <opie2/owait.h> |
41 | using namespace Opie::Core; | 41 | using namespace Opie::Core; |
42 | using namespace Opie::Ui; | 42 | using namespace Opie::Ui; |
43 | 43 | ||
44 | /* QT */ | 44 | /* QT */ |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qmultilineedit.h> | 46 | #include <qmultilineedit.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qfile.h> | 48 | #include <qfile.h> |
49 | #include <qfileinfo.h> | 49 | #include <qfileinfo.h> |
50 | #include <qlistview.h> | 50 | #include <qlistview.h> |
51 | #include <qpushbutton.h> | 51 | #include <qpushbutton.h> |
52 | #include <qradiobutton.h> | 52 | #include <qradiobutton.h> |
53 | #include <qheader.h> | 53 | #include <qheader.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | #include <qcombobox.h> | 55 | #include <qcombobox.h> |
@@ -241,68 +241,69 @@ void BackupAndRestore::selectItem(QListViewItem *currentItem) | |||
241 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); | 241 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); |
242 | currentItem->setText(HEADER_BACKUP, "B"); | 242 | currentItem->setText(HEADER_BACKUP, "B"); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | void BackupAndRestore::scanForApplicationSettings() | 246 | void BackupAndRestore::scanForApplicationSettings() |
247 | { | 247 | { |
248 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); | 248 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); |
249 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); | 249 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); |
250 | const QFileInfoList *list = d.entryInfoList(); | 250 | const QFileInfoList *list = d.entryInfoList(); |
251 | QFileInfoListIterator it( *list ); | 251 | QFileInfoListIterator it( *list ); |
252 | QFileInfo *fi; | 252 | QFileInfo *fi; |
253 | while ( (fi=it.current()) ) | 253 | while ( (fi=it.current()) ) |
254 | { | 254 | { |
255 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; | 255 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; |
256 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) | 256 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) |
257 | { | 257 | { |
258 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 258 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
259 | selectItem(newItem); | 259 | selectItem(newItem); |
260 | } | 260 | } |
261 | ++it; | 261 | ++it; |
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * The "Backup" button has been pressed. Get a list of all of the files that | 266 | * The "Backup" button has been pressed. Get a list of all of the files that |
267 | * should be backed up. If there are no files, emit and error and exit. | 267 | * should be backed up. If there are no files, emit and error and exit. |
268 | * Determine the file name to store the backup in. Backup the file(s) using | 268 | * Determine the file name to store the backup in. Backup the file(s) using |
269 | * tar and gzip --best. Report failure or success | 269 | * tar and gzip --best. Report failure or success |
270 | */ | 270 | */ |
271 | void BackupAndRestore::backup() | 271 | void BackupAndRestore::backup() |
272 | { | 272 | { |
273 | if ( cb_type_userdata->isChecked() ) | 273 | backupUserData(); |
274 | /* if ( cb_type_userdata->isChecked() ) | ||
274 | backupUserData(); | 275 | backupUserData(); |
275 | else | 276 | else |
276 | backupRootFs(); | 277 | backupRootFs();*/ |
277 | } | 278 | } |
278 | 279 | ||
279 | 280 | ||
280 | void BackupAndRestore::backupRootFs() | 281 | void BackupAndRestore::backupRootFs() |
281 | { | 282 | { |
282 | if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) | 283 | if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) |
283 | { | 284 | { |
284 | QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); | 285 | QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); |
285 | return; | 286 | return; |
286 | } | 287 | } |
287 | 288 | ||
288 | if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) | 289 | if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) |
289 | { | 290 | { |
290 | QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); | 291 | QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); |
291 | return; | 292 | return; |
292 | } | 293 | } |
293 | 294 | ||
294 | // call 'mount' and parse its output to gather the device on which the root partition is mounted | 295 | // call 'mount' and parse its output to gather the device on which the root partition is mounted |
295 | FILE* mountp = popen( "mount", "r" ); | 296 | FILE* mountp = popen( "mount", "r" ); |
296 | QString device; | 297 | QString device; |
297 | QString mountpoint; | 298 | QString mountpoint; |
298 | { | 299 | { |
299 | QTextStream mounto( mountp, IO_ReadOnly ); | 300 | QTextStream mounto( mountp, IO_ReadOnly ); |
300 | QString on; | 301 | QString on; |
301 | QString type; | 302 | QString type; |
302 | QString filesystem; | 303 | QString filesystem; |
303 | QString options; | 304 | QString options; |
304 | while ( !mounto.atEnd() ) | 305 | while ( !mounto.atEnd() ) |
305 | { | 306 | { |
306 | mounto >> device >> on >> mountpoint >> type >> filesystem >> options; | 307 | mounto >> device >> on >> mountpoint >> type >> filesystem >> options; |
307 | if ( mountpoint == "/" ) break; | 308 | if ( mountpoint == "/" ) break; |
308 | } | 309 | } |
@@ -558,66 +559,66 @@ void BackupAndRestore::rescanFolder(QString directory) | |||
558 | // If it is a dir and not .. or . then add it as a tab and go down. | 559 | // If it is a dir and not .. or . then add it as a tab and go down. |
559 | if(file->isDir()) | 560 | if(file->isDir()) |
560 | { | 561 | { |
561 | if(file->fileName() != ".." && file->fileName() != ".") | 562 | if(file->fileName() != ".." && file->fileName() != ".") |
562 | { | 563 | { |
563 | rescanFolder(directory + "/" + file->fileName()); | 564 | rescanFolder(directory + "/" + file->fileName()); |
564 | } | 565 | } |
565 | } | 566 | } |
566 | else | 567 | else |
567 | { | 568 | { |
568 | // If it is a backup file add to list. | 569 | // If it is a backup file add to list. |
569 | if(file->fileName().contains(EXTENSION)) | 570 | if(file->fileName().contains(EXTENSION)) |
570 | (void)new QListViewItem(restoreList, file->fileName()); | 571 | (void)new QListViewItem(restoreList, file->fileName()); |
571 | } | 572 | } |
572 | ++it; | 573 | ++it; |
573 | } | 574 | } |
574 | } | 575 | } |
575 | 576 | ||
576 | /** | 577 | /** |
577 | * Restore a backup file. | 578 | * Restore a backup file. |
578 | * Report errors or success | 579 | * Report errors or success |
579 | */ | 580 | */ |
580 | void BackupAndRestore::restore() | 581 | void BackupAndRestore::restore() |
581 | { | 582 | { |
582 | QListViewItem *restoreItem = restoreList->currentItem(); | 583 | QListViewItem *restoreItem = restoreList->currentItem(); |
583 | if(!restoreItem) | 584 | if(!restoreItem) |
584 | { | 585 | { |
585 | QMessageBox::critical(this, tr( "Message" ), | 586 | QMessageBox::critical(this, tr( "Message" ), |
586 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); | 587 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); |
587 | return; | 588 | return; |
588 | } | 589 | } |
589 | 590 | ||
590 | if ( QMessageBox::warning( this, tr( "Restore" ), | 591 | if ( QMessageBox::warning( this, tr( "Restore" ), |
591 | tr( "Would you really overwrite your local data?" ), | 592 | tr( "Would you really overwrite your local data?" ), |
592 | tr( "Yes" ), tr( "No" ), "", 1 ) == 1 ) | 593 | tr( "Yes" ), tr( "No" ), "", 1 ) == 1 ) |
593 | return; | 594 | return; |
594 | 595 | ||
595 | OWait *owait = new OWait(); | 596 | OWait *owait = new OWait(); |
596 | Global::statusMessage( tr( "Restore Backup..." ) ); | 597 | Global::statusMessage( tr( "Restore Backup..." ) ); |
597 | owait->show(); | 598 | owait->show(); |
598 | qApp->processEvents(); | 599 | qApp->processEvents(); |
599 | 600 | ||
600 | QString restoreFile = backupLocations[restoreSource->currentText()]; | 601 | QString restoreFile = backupLocations[restoreSource->currentText()]; |
601 | 602 | ||
602 | restoreFile += "/" + restoreItem->text(0); | 603 | restoreFile += "/" + restoreItem->text(0); |
603 | 604 | ||
604 | odebug << restoreFile << oendl; | 605 | odebug << restoreFile << oendl; |
605 | 606 | ||
606 | //check if backup file come from opie 1.0.x | 607 | //check if backup file come from opie 1.0.x |
607 | 608 | ||
608 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); | 609 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); |
609 | 610 | ||
610 | int r = system( commandLine ); | 611 | int r = system( commandLine ); |
611 | 612 | ||
612 | QString startDir; | 613 | QString startDir; |
613 | 614 | ||
614 | if( r != 0 ) //Applications/backup/exclude not found - old backup file | 615 | if( r != 0 ) //Applications/backup/exclude not found - old backup file |
615 | { | 616 | { |
616 | startDir = QString( "/" ); | 617 | startDir = QString( "/" ); |
617 | } else | 618 | } else |
618 | { | 619 | { |
619 | startDir = QDir::homeDirPath(); | 620 | startDir = QDir::homeDirPath(); |
620 | } | 621 | } |
621 | 622 | ||
622 | //unpack backup file | 623 | //unpack backup file |
623 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) | 624 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) |
diff --git a/noncore/settings/backup/backuprestorebase.ui b/noncore/settings/backup/backuprestorebase.ui index c91f292..f2b7d75 100644 --- a/noncore/settings/backup/backuprestorebase.ui +++ b/noncore/settings/backup/backuprestorebase.ui | |||
@@ -101,117 +101,64 @@ | |||
101 | <string>&Backup</string> | 101 | <string>&Backup</string> |
102 | </property> | 102 | </property> |
103 | </widget> | 103 | </widget> |
104 | <widget row="2" column="0" rowspan="1" colspan="2" > | 104 | <widget row="2" column="0" rowspan="1" colspan="2" > |
105 | <class>QListView</class> | 105 | <class>QListView</class> |
106 | <column> | 106 | <column> |
107 | <property> | 107 | <property> |
108 | <name>text</name> | 108 | <name>text</name> |
109 | <string>Applications</string> | 109 | <string>Applications</string> |
110 | </property> | 110 | </property> |
111 | <property> | 111 | <property> |
112 | <name>clickable</name> | 112 | <name>clickable</name> |
113 | <bool>true</bool> | 113 | <bool>true</bool> |
114 | </property> | 114 | </property> |
115 | <property> | 115 | <property> |
116 | <name>resizeable</name> | 116 | <name>resizeable</name> |
117 | <bool>true</bool> | 117 | <bool>true</bool> |
118 | </property> | 118 | </property> |
119 | </column> | 119 | </column> |
120 | <property stdset="1"> | 120 | <property stdset="1"> |
121 | <name>name</name> | 121 | <name>name</name> |
122 | <cstring>backupList</cstring> | 122 | <cstring>backupList</cstring> |
123 | </property> | 123 | </property> |
124 | <property stdset="1"> | 124 | <property stdset="1"> |
125 | <name>allColumnsShowFocus</name> | 125 | <name>allColumnsShowFocus</name> |
126 | <bool>true</bool> | 126 | <bool>true</bool> |
127 | </property> | 127 | </property> |
128 | <property stdset="1"> | 128 | <property stdset="1"> |
129 | <name>rootIsDecorated</name> | 129 | <name>rootIsDecorated</name> |
130 | <bool>true</bool> | 130 | <bool>true</bool> |
131 | </property> | 131 | </property> |
132 | </widget> | 132 | </widget> |
133 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
134 | <class>QButtonGroup</class> | ||
135 | <property stdset="1"> | ||
136 | <name>name</name> | ||
137 | <cstring>frame_type</cstring> | ||
138 | </property> | ||
139 | <property stdset="1"> | ||
140 | <name>title</name> | ||
141 | <string>Type</string> | ||
142 | </property> | ||
143 | <property> | ||
144 | <name>layoutMargin</name> | ||
145 | </property> | ||
146 | <property> | ||
147 | <name>layoutSpacing</name> | ||
148 | </property> | ||
149 | <grid> | ||
150 | <property stdset="1"> | ||
151 | <name>margin</name> | ||
152 | <number>6</number> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>spacing</name> | ||
156 | <number>2</number> | ||
157 | </property> | ||
158 | <widget row="1" column="0" > | ||
159 | <class>QRadioButton</class> | ||
160 | <property stdset="1"> | ||
161 | <name>name</name> | ||
162 | <cstring>cb_type_fullbackup</cstring> | ||
163 | </property> | ||
164 | <property stdset="1"> | ||
165 | <name>text</name> | ||
166 | <string>Full Backup (Root File System)</string> | ||
167 | </property> | ||
168 | </widget> | ||
169 | <widget row="0" column="0" > | ||
170 | <class>QRadioButton</class> | ||
171 | <property stdset="1"> | ||
172 | <name>name</name> | ||
173 | <cstring>cb_type_userdata</cstring> | ||
174 | </property> | ||
175 | <property stdset="1"> | ||
176 | <name>text</name> | ||
177 | <string>User Data (Configuration + PIM)</string> | ||
178 | </property> | ||
179 | <property stdset="1"> | ||
180 | <name>checked</name> | ||
181 | <bool>true</bool> | ||
182 | </property> | ||
183 | </widget> | ||
184 | </grid> | ||
185 | </widget> | ||
186 | </grid> | 133 | </grid> |
187 | </widget> | 134 | </widget> |
188 | <widget> | 135 | <widget> |
189 | <class>QWidget</class> | 136 | <class>QWidget</class> |
190 | <property stdset="1"> | 137 | <property stdset="1"> |
191 | <name>name</name> | 138 | <name>name</name> |
192 | <cstring>Widget3</cstring> | 139 | <cstring>Widget3</cstring> |
193 | </property> | 140 | </property> |
194 | <attribute> | 141 | <attribute> |
195 | <name>title</name> | 142 | <name>title</name> |
196 | <string>Restore</string> | 143 | <string>Restore</string> |
197 | </attribute> | 144 | </attribute> |
198 | <grid> | 145 | <grid> |
199 | <property stdset="1"> | 146 | <property stdset="1"> |
200 | <name>margin</name> | 147 | <name>margin</name> |
201 | <number>4</number> | 148 | <number>4</number> |
202 | </property> | 149 | </property> |
203 | <property stdset="1"> | 150 | <property stdset="1"> |
204 | <name>spacing</name> | 151 | <name>spacing</name> |
205 | <number>2</number> | 152 | <number>2</number> |
206 | </property> | 153 | </property> |
207 | <widget row="0" column="1" > | 154 | <widget row="0" column="1" > |
208 | <class>QComboBox</class> | 155 | <class>QComboBox</class> |
209 | <property stdset="1"> | 156 | <property stdset="1"> |
210 | <name>name</name> | 157 | <name>name</name> |
211 | <cstring>restoreSource</cstring> | 158 | <cstring>restoreSource</cstring> |
212 | </property> | 159 | </property> |
213 | </widget> | 160 | </widget> |
214 | <widget row="2" column="0" rowspan="1" colspan="2" > | 161 | <widget row="2" column="0" rowspan="1" colspan="2" > |
215 | <class>QPushButton</class> | 162 | <class>QPushButton</class> |
216 | <property stdset="1"> | 163 | <property stdset="1"> |
217 | <name>name</name> | 164 | <name>name</name> |