-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestorebase.ui | 308 |
2 files changed, 142 insertions, 169 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index d028379..8928cda 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,766 +1,767 @@ | |||
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> |
56 | #include <qlist.h> | 56 | #include <qlist.h> |
57 | #include <qregexp.h> | 57 | #include <qregexp.h> |
58 | #include <qtextstream.h> | 58 | #include <qtextstream.h> |
59 | #include <qtextview.h> | 59 | #include <qtextview.h> |
60 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
61 | #include <qstringlist.h> | 61 | #include <qstringlist.h> |
62 | 62 | ||
63 | /* STD */ | 63 | /* STD */ |
64 | #include <errno.h> | 64 | #include <errno.h> |
65 | #include <stdlib.h> | 65 | #include <stdlib.h> |
66 | #include <unistd.h> | 66 | #include <unistd.h> |
67 | #include <sys/stat.h> | 67 | #include <sys/stat.h> |
68 | #include <dirent.h> | 68 | #include <dirent.h> |
69 | 69 | ||
70 | #define HEADER_NAME 0 | 70 | #define HEADER_NAME 0 |
71 | #define HEADER_BACKUP 1 | 71 | #define HEADER_BACKUP 1 |
72 | #define BACKUP_LOCATION 2 | 72 | #define BACKUP_LOCATION 2 |
73 | 73 | ||
74 | #define EXTENSION ".bck" | 74 | #define EXTENSION ".bck" |
75 | 75 | ||
76 | const QString tempFileName = "/tmp/backup.err"; | 76 | const QString tempFileName = "/tmp/backup.err"; |
77 | 77 | ||
78 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) | 78 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) |
79 | : BackupAndRestoreBase(parent, name, fl) | 79 | : BackupAndRestoreBase(parent, name, fl) |
80 | { | 80 | { |
81 | backupList->header()->hide(); | 81 | backupList->header()->hide(); |
82 | restoreList->header()->hide(); | 82 | restoreList->header()->hide(); |
83 | locationList->header()->hide(); | 83 | locationList->header()->hide(); |
84 | connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); | 84 | connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); |
85 | connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); | 85 | connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); |
86 | connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); | 86 | connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); |
87 | connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); | 87 | connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); |
88 | connect( addLocationButton, SIGNAL( clicked() ), this, SLOT( addLocation() ) ); | 88 | connect( addLocationButton, SIGNAL( clicked() ), this, SLOT( addLocation() ) ); |
89 | connect( removeLocationButton, SIGNAL( clicked() ), this, SLOT( removeLocation() ) ); | 89 | connect( removeLocationButton, SIGNAL( clicked() ), this, SLOT( removeLocation() ) ); |
90 | connect( saveLocationsButton, SIGNAL( clicked() ), this, SLOT( saveLocations() ) ); | ||
91 | connect( selectLocationButton, SIGNAL( clicked() ), this, SLOT( selectLocation() ) ); | 90 | connect( selectLocationButton, SIGNAL( clicked() ), this, SLOT( selectLocation() ) ); |
92 | 91 | ||
93 | //add directorys for backing up | 92 | //add directorys for backing up |
94 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); | 93 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); |
95 | selectItem(applicationSettings); | 94 | selectItem(applicationSettings); |
96 | applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); | 95 | applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); |
97 | selectItem(applicationSettings); | 96 | selectItem(applicationSettings); |
98 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); | 97 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); |
99 | selectItem(documents); | 98 | selectItem(documents); |
100 | 99 | ||
101 | scanForApplicationSettings(); | 100 | scanForApplicationSettings(); |
102 | refreshLocations(); | 101 | refreshLocations(); |
103 | refreshBackupLocations(); | 102 | refreshBackupLocations(); |
104 | 103 | ||
105 | // Read the list of items to ignore. | 104 | // Read the list of items to ignore. |
106 | QList<QString> dontBackupList; | 105 | QList<QString> dontBackupList; |
107 | dontBackupList.setAutoDelete(true); | 106 | dontBackupList.setAutoDelete(true); |
108 | Config config("BackupAndRestore"); | 107 | Config config("BackupAndRestore"); |
109 | config.setGroup("DontBackup"); | 108 | config.setGroup("DontBackup"); |
110 | int total = config.readNumEntry("Total", 0); | 109 | int total = config.readNumEntry("Total", 0); |
111 | for(int i = 0; i < total; i++) | 110 | for(int i = 0; i < total; i++) |
112 | { | 111 | { |
113 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); | 112 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); |
114 | } | 113 | } |
115 | 114 | ||
116 | QList<QListViewItem> list; | 115 | QList<QListViewItem> list; |
117 | getAllItems(backupList->firstChild(), list); | 116 | getAllItems(backupList->firstChild(), list); |
118 | 117 | ||
119 | for(uint i = 0; i < list.count(); i++) | 118 | for(uint i = 0; i < list.count(); i++) |
120 | { | 119 | { |
121 | QString text = list.at(i)->text(HEADER_NAME); | 120 | QString text = list.at(i)->text(HEADER_NAME); |
122 | for(uint i2 = 0; i2 < dontBackupList.count(); i2++) | 121 | for(uint i2 = 0; i2 < dontBackupList.count(); i2++) |
123 | { | 122 | { |
124 | if(*dontBackupList.at(i2) == text) | 123 | if(*dontBackupList.at(i2) == text) |
125 | { | 124 | { |
126 | selectItem(list.at(i)); | 125 | selectItem(list.at(i)); |
127 | break; | 126 | break; |
128 | } | 127 | } |
129 | } | 128 | } |
130 | } | 129 | } |
131 | QPEApplication::showWidget( this ); | 130 | QPEApplication::showWidget( this ); |
132 | } | 131 | } |
133 | 132 | ||
134 | BackupAndRestore::~BackupAndRestore() | 133 | BackupAndRestore::~BackupAndRestore() |
135 | { | 134 | { |
136 | QList<QListViewItem> list; | 135 | QList<QListViewItem> list; |
137 | getAllItems(backupList->firstChild(), list); | 136 | getAllItems(backupList->firstChild(), list); |
138 | 137 | ||
139 | Config config("BackupAndRestore"); | 138 | Config config("BackupAndRestore"); |
140 | config.setGroup("DontBackup"); | 139 | config.setGroup("DontBackup"); |
141 | config.clearGroup(); | 140 | config.clearGroup(); |
142 | 141 | ||
143 | int count = 0; | 142 | int count = 0; |
144 | for(uint i = 0; i < list.count(); i++) | 143 | for(uint i = 0; i < list.count(); i++) |
145 | { | 144 | { |
146 | if(list.at(i)->text(HEADER_BACKUP) == "") | 145 | if(list.at(i)->text(HEADER_BACKUP) == "") |
147 | { | 146 | { |
148 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); | 147 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); |
149 | count++; | 148 | count++; |
150 | } | 149 | } |
151 | } | 150 | } |
152 | config.writeEntry("Total", count); | 151 | config.writeEntry("Total", count); |
153 | 152 | ||
154 | // Remove Temp File | 153 | // Remove Temp File |
155 | if ( QFile::exists( tempFileName ) ) | 154 | if ( QFile::exists( tempFileName ) ) |
156 | QFile::remove( tempFileName ); | 155 | QFile::remove( tempFileName ); |
157 | } | 156 | } |
158 | 157 | ||
159 | void BackupAndRestore::refreshBackupLocations() | 158 | void BackupAndRestore::refreshBackupLocations() |
160 | { | 159 | { |
161 | backupLocations.clear(); | 160 | backupLocations.clear(); |
162 | // Add cards | 161 | // Add cards |
163 | Opie::Core::OStorageInfo storage; | 162 | Opie::Core::OStorageInfo storage; |
164 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); | 163 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); |
165 | if ( storage.hasCf() ) | 164 | if ( storage.hasCf() ) |
166 | { | 165 | { |
167 | backupLocations.insert( "CF", storage.cfPath() ); | 166 | backupLocations.insert( "CF", storage.cfPath() ); |
168 | odebug << "Cf Path: " + storage.cfPath() << oendl; | 167 | odebug << "Cf Path: " + storage.cfPath() << oendl; |
169 | } | 168 | } |
170 | if ( storage.hasSd() ) | 169 | if ( storage.hasSd() ) |
171 | { | 170 | { |
172 | backupLocations.insert( "SD", storage.sdPath() ); | 171 | backupLocations.insert( "SD", storage.sdPath() ); |
173 | odebug << " Sd Path: " + storage.sdPath() << oendl; | 172 | odebug << " Sd Path: " + storage.sdPath() << oendl; |
174 | } | 173 | } |
175 | if ( storage.hasMmc() ) | 174 | if ( storage.hasMmc() ) |
176 | { | 175 | { |
177 | backupLocations.insert( "MMC", storage.mmcPath() ); | 176 | backupLocations.insert( "MMC", storage.mmcPath() ); |
178 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; | 177 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; |
179 | } | 178 | } |
180 | 179 | ||
181 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) | 180 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) |
182 | { | 181 | { |
183 | backupLocations.insert( it.current()->text( 0 ), it.current()->text( 0 ) ); | 182 | backupLocations.insert( it.current()->text( 0 ), it.current()->text( 0 ) ); |
184 | } | 183 | } |
185 | 184 | ||
186 | //update QComboBox | 185 | //update QComboBox |
187 | storeToLocation->clear(); | 186 | storeToLocation->clear(); |
188 | restoreSource->clear(); | 187 | restoreSource->clear(); |
189 | 188 | ||
190 | //read last locations | 189 | //read last locations |
191 | Config config("BackupAndRestore"); | 190 | Config config("BackupAndRestore"); |
192 | config.setGroup("LastLocation"); | 191 | config.setGroup("LastLocation"); |
193 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | 192 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); |
194 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | 193 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); |
195 | int locationIndex = 0; | 194 | int locationIndex = 0; |
196 | 195 | ||
197 | //fill QComboBox | 196 | //fill QComboBox |
198 | QMap<QString, QString>::Iterator it; | 197 | QMap<QString, QString>::Iterator it; |
199 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | 198 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) |
200 | { | 199 | { |
201 | storeToLocation->insertItem(it.key()); | 200 | storeToLocation->insertItem(it.key()); |
202 | restoreSource->insertItem(it.key()); | 201 | restoreSource->insertItem(it.key()); |
203 | 202 | ||
204 | //check for last locations | 203 | //check for last locations |
205 | if ( it.key() == lastStoreLocation ) | 204 | if ( it.key() == lastStoreLocation ) |
206 | storeToLocation->setCurrentItem( locationIndex ); | 205 | storeToLocation->setCurrentItem( locationIndex ); |
207 | if ( it.key() == lastRestoreLocation ) | 206 | if ( it.key() == lastRestoreLocation ) |
208 | restoreSource->setCurrentItem( locationIndex ); | 207 | restoreSource->setCurrentItem( locationIndex ); |
209 | locationIndex++; | 208 | locationIndex++; |
210 | } | 209 | } |
211 | } | 210 | } |
212 | 211 | ||
213 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) | 212 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) |
214 | { | 213 | { |
215 | while(item) | 214 | while(item) |
216 | { | 215 | { |
217 | if(item->childCount() > 0) | 216 | if(item->childCount() > 0) |
218 | getAllItems(item->firstChild(), list); | 217 | getAllItems(item->firstChild(), list); |
219 | list.append(item); | 218 | list.append(item); |
220 | item = item->nextSibling(); | 219 | item = item->nextSibling(); |
221 | } | 220 | } |
222 | return list; | 221 | return list; |
223 | } | 222 | } |
224 | 223 | ||
225 | /** | 224 | /** |
226 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. | 225 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. |
227 | * and changing the icon to match | 226 | * and changing the icon to match |
228 | * @param currentItem the item to swich the selection choice. | 227 | * @param currentItem the item to swich the selection choice. |
229 | */ | 228 | */ |
230 | void BackupAndRestore::selectItem(QListViewItem *currentItem) | 229 | void BackupAndRestore::selectItem(QListViewItem *currentItem) |
231 | { | 230 | { |
232 | if(!currentItem) | 231 | if(!currentItem) |
233 | return; | 232 | return; |
234 | 233 | ||
235 | if(currentItem->text(HEADER_BACKUP) == "B") | 234 | if(currentItem->text(HEADER_BACKUP) == "B") |
236 | { | 235 | { |
237 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); | 236 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); |
238 | currentItem->setText(HEADER_BACKUP, ""); | 237 | currentItem->setText(HEADER_BACKUP, ""); |
239 | } | 238 | } |
240 | else | 239 | else |
241 | { | 240 | { |
242 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); | 241 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); |
243 | currentItem->setText(HEADER_BACKUP, "B"); | 242 | currentItem->setText(HEADER_BACKUP, "B"); |
244 | } | 243 | } |
245 | } | 244 | } |
246 | 245 | ||
247 | void BackupAndRestore::scanForApplicationSettings() | 246 | void BackupAndRestore::scanForApplicationSettings() |
248 | { | 247 | { |
249 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); | 248 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); |
250 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); | 249 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); |
251 | const QFileInfoList *list = d.entryInfoList(); | 250 | const QFileInfoList *list = d.entryInfoList(); |
252 | QFileInfoListIterator it( *list ); | 251 | QFileInfoListIterator it( *list ); |
253 | QFileInfo *fi; | 252 | QFileInfo *fi; |
254 | while ( (fi=it.current()) ) | 253 | while ( (fi=it.current()) ) |
255 | { | 254 | { |
256 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; | 255 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; |
257 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) | 256 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) |
258 | { | 257 | { |
259 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 258 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
260 | selectItem(newItem); | 259 | selectItem(newItem); |
261 | } | 260 | } |
262 | ++it; | 261 | ++it; |
263 | } | 262 | } |
264 | } | 263 | } |
265 | 264 | ||
266 | /** | 265 | /** |
267 | * 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 |
268 | * 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. |
269 | * 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 |
270 | * tar and gzip --best. Report failure or success | 269 | * tar and gzip --best. Report failure or success |
271 | */ | 270 | */ |
272 | void BackupAndRestore::backup() | 271 | void BackupAndRestore::backup() |
273 | { | 272 | { |
274 | if ( cb_type_userdata->isChecked() ) | 273 | if ( cb_type_userdata->isChecked() ) |
275 | backupUserData(); | 274 | backupUserData(); |
276 | else | 275 | else |
277 | backupRootFs(); | 276 | backupRootFs(); |
278 | } | 277 | } |
279 | 278 | ||
280 | 279 | ||
281 | void BackupAndRestore::backupRootFs() | 280 | void BackupAndRestore::backupRootFs() |
282 | { | 281 | { |
283 | if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) | 282 | if ( ( ODevice::inst()->model() != Model_Zaurus_SL5000 ) && ( ODevice::inst()->model() != Model_Zaurus_SL5500 ) ) |
284 | { | 283 | { |
285 | QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); | 284 | QMessageBox::critical( this, "Not yet implemented!", "<qt>Sorry, support for this model is not yet done.</qt>", "Ok" ); |
286 | return; | 285 | return; |
287 | } | 286 | } |
288 | 287 | ||
289 | if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) | 288 | if ( !QFile::exists( "/usr/bin/mkfs.jffs2" ) && !QFile::exists( "/usr/sbin/mkfs.jffs2" ) ) |
290 | { | 289 | { |
291 | QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); | 290 | QMessageBox::critical( this, "Can't find utility!", "<qt>Can't find mkfs.jffs2 - Install mtd-utils.</qt>", "Ok" ); |
292 | return; | 291 | return; |
293 | } | 292 | } |
294 | 293 | ||
295 | // call 'mount' and parse its output to gather the device on which the root partition is mounted | 294 | // call 'mount' and parse its output to gather the device on which the root partition is mounted |
296 | FILE* mountp = popen( "mount", "r" ); | 295 | FILE* mountp = popen( "mount", "r" ); |
297 | QString device; | 296 | QString device; |
298 | QString mountpoint; | 297 | QString mountpoint; |
299 | { | 298 | { |
300 | QTextStream mounto( mountp, IO_ReadOnly ); | 299 | QTextStream mounto( mountp, IO_ReadOnly ); |
301 | QString on; | 300 | QString on; |
302 | QString type; | 301 | QString type; |
303 | QString filesystem; | 302 | QString filesystem; |
304 | QString options; | 303 | QString options; |
305 | while ( !mounto.atEnd() ) | 304 | while ( !mounto.atEnd() ) |
306 | { | 305 | { |
307 | mounto >> device >> on >> mountpoint >> type >> filesystem >> options; | 306 | mounto >> device >> on >> mountpoint >> type >> filesystem >> options; |
308 | if ( mountpoint == "/" ) break; | 307 | if ( mountpoint == "/" ) break; |
309 | } | 308 | } |
310 | odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl; | 309 | odebug << device << " is formatted w/ '" << filesystem << "' and mounted on '" << mountpoint << "'" << oendl; |
311 | 310 | ||
312 | if ( !device.startsWith( "/dev/mtdblock" ) ) | 311 | if ( !device.startsWith( "/dev/mtdblock" ) ) |
313 | { | 312 | { |
314 | QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" ); | 313 | QMessageBox::critical( this, "Can't backup!", QString( "<qt>unsupported root device '%1' - needs to be /dev/mtdblockN</qt>").arg( device ), "Ok" ); |
315 | return; | 314 | return; |
316 | } | 315 | } |
317 | } // at this point, the QTextStream has been destroy and we can close the FILE* | 316 | } // at this point, the QTextStream has been destroy and we can close the FILE* |
318 | pclose( mountp ); | 317 | pclose( mountp ); |
319 | 318 | ||
320 | #if 1 | 319 | #if 1 |
321 | int rootmtd = device.right( 1 ).toInt(); | 320 | int rootmtd = device.right( 1 ).toInt(); |
322 | #else | 321 | #else |
323 | int rootmtd = 0; | 322 | int rootmtd = 0; |
324 | #endif | 323 | #endif |
325 | odebug << "root mtdblock seems to be '" << rootmtd << "'" << oendl; | 324 | odebug << "root mtdblock seems to be '" << rootmtd << "'" << oendl; |
326 | 325 | ||
327 | // scan /proc/mtd to gather the size and erasesize of the root mtdblock | 326 | // scan /proc/mtd to gather the size and erasesize of the root mtdblock |
328 | QFile procmtdf( "/proc/mtd" ); | 327 | QFile procmtdf( "/proc/mtd" ); |
329 | if ( !procmtdf.open( IO_ReadOnly ) ) | 328 | if ( !procmtdf.open( IO_ReadOnly ) ) |
330 | { | 329 | { |
331 | QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" ); | 330 | QMessageBox::critical( this, "Can't backup!", "<qt>Can't open /proc/mtd</qt>", "Ok" ); |
332 | return; | 331 | return; |
333 | } | 332 | } |
334 | 333 | ||
335 | QTextStream procmtd( &procmtdf ); | 334 | QTextStream procmtd( &procmtdf ); |
336 | for ( int i = 0; i <= rootmtd; ++i ) procmtd.readLine(); // skip uninteresting things | 335 | for ( int i = 0; i <= rootmtd; ++i ) procmtd.readLine(); // skip uninteresting things |
337 | QString dev; | 336 | QString dev; |
338 | QString size; | 337 | QString size; |
339 | QString erasesize; | 338 | QString erasesize; |
340 | QString devname; | 339 | QString devname; |
341 | procmtd >> dev >> size >> erasesize >> devname; | 340 | procmtd >> dev >> size >> erasesize >> devname; |
342 | 341 | ||
343 | odebug << "device " << dev << " size = " << size << ", erase size = " << erasesize << ", name = " << devname << "\"" << oendl; | 342 | odebug << "device " << dev << " size = " << size << ", erase size = " << erasesize << ", name = " << devname << "\"" << oendl; |
344 | 343 | ||
345 | // compute pad | 344 | // compute pad |
346 | QString pad = "--pad"; | 345 | QString pad = "--pad"; |
347 | switch ( ODevice::inst()->model() ) | 346 | switch ( ODevice::inst()->model() ) |
348 | { | 347 | { |
349 | case Model_Zaurus_SL5000: pad = "--pad=14680064"; break; | 348 | case Model_Zaurus_SL5000: pad = "--pad=14680064"; break; |
350 | case Model_Zaurus_SL5500: pad = "--pad=14680064"; break; | 349 | case Model_Zaurus_SL5500: pad = "--pad=14680064"; break; |
351 | // FIXME: Add Beagle and SIMpad | 350 | // FIXME: Add Beagle and SIMpad |
352 | } | 351 | } |
353 | 352 | ||
354 | // compute eraseblock | 353 | // compute eraseblock |
355 | QString eraseblock = "--eraseblock=0x" + erasesize; | 354 | QString eraseblock = "--eraseblock=0x" + erasesize; |
356 | 355 | ||
357 | // compute output | 356 | // compute output |
358 | QString outputFile = "--output=" + backupLocations[storeToLocation->currentText()]; | 357 | QString outputFile = "--output=" + backupLocations[storeToLocation->currentText()]; |
359 | QDateTime datetime = QDateTime::currentDateTime(); | 358 | QDateTime datetime = QDateTime::currentDateTime(); |
360 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 359 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
361 | QString::number( datetime.date().day() ).rightJustify(2, '0'); | 360 | QString::number( datetime.date().day() ).rightJustify(2, '0'); |
362 | outputFile += "/initrd.bin-" + dateString; | 361 | outputFile += "/initrd.bin-" + dateString; |
363 | 362 | ||
364 | // call mkfs.jffs2 to create the backup | 363 | // call mkfs.jffs2 to create the backup |
365 | QString cmdline = QString( "mkfs.jffs2 --faketime --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock ); | 364 | QString cmdline = QString( "mkfs.jffs2 --faketime --root=/ %1 --little-endian %2 %3 -n" ).arg( outputFile ).arg( pad ).arg( eraseblock ); |
366 | cmdline.append( " --ignore=/tmp --ignore=/mnt --ignore=/var --ignore=/proc" ); | 365 | cmdline.append( " --ignore=/tmp --ignore=/mnt --ignore=/var --ignore=/proc" ); |
367 | owarn << "Calling '" << cmdline << "'" << oendl; | 366 | owarn << "Calling '" << cmdline << "'" << oendl; |
368 | 367 | ||
369 | OWait *owait = new OWait(); | 368 | OWait *owait = new OWait(); |
370 | Global::statusMessage( tr( "Backing up..." ) ); | 369 | Global::statusMessage( tr( "Backing up..." ) ); |
371 | owait->show(); | 370 | owait->show(); |
372 | qApp->processEvents(); | 371 | qApp->processEvents(); |
373 | 372 | ||
374 | int r = ::system( cmdline ); | 373 | int r = ::system( cmdline ); |
375 | 374 | ||
376 | owait->hide(); | 375 | owait->hide(); |
377 | delete owait; | 376 | delete owait; |
378 | 377 | ||
379 | if ( r != 0 ) | 378 | if ( r != 0 ) |
380 | { | 379 | { |
381 | perror("Error: "); | 380 | perror("Error: "); |
382 | QString errorMsg = QString( tr( "<qt>%1</qt>" ).arg( strerror( errno ) ) ); | 381 | QString errorMsg = QString( tr( "<qt>%1</qt>" ).arg( strerror( errno ) ) ); |
383 | QMessageBox::critical(this, tr( "Backup Failed!" ), errorMsg, QString( tr( "Ok" ) ) ); | 382 | QMessageBox::critical(this, tr( "Backup Failed!" ), errorMsg, QString( tr( "Ok" ) ) ); |
384 | } | 383 | } |
385 | 384 | ||
386 | // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad | 385 | // FIXME: Add image postprocessing for C7x0 and C8x0, for Beagle, for SIMpad |
387 | } | 386 | } |
388 | 387 | ||
389 | void BackupAndRestore::backupUserData() | 388 | void BackupAndRestore::backupUserData() |
390 | { | 389 | { |
391 | QString backupFiles; | 390 | QString backupFiles; |
392 | if(getBackupFiles(backupFiles, NULL) == 0) | 391 | if(getBackupFiles(backupFiles, NULL) == 0) |
393 | { | 392 | { |
394 | QMessageBox::critical(this, "Message", | 393 | QMessageBox::critical(this, "Message", |
395 | "No items selected.",QString("Ok") ); | 394 | "No items selected.",QString("Ok") ); |
396 | return; | 395 | return; |
397 | } | 396 | } |
398 | 397 | ||
399 | OWait *owait = new OWait(); | 398 | OWait *owait = new OWait(); |
400 | Global::statusMessage( tr( "Backing up..." ) ); | 399 | Global::statusMessage( tr( "Backing up..." ) ); |
401 | owait->show(); | 400 | owait->show(); |
402 | qApp->processEvents(); | 401 | qApp->processEvents(); |
403 | 402 | ||
404 | QString outputFile = backupLocations[storeToLocation->currentText()]; | 403 | QString outputFile = backupLocations[storeToLocation->currentText()]; |
405 | 404 | ||
406 | QDateTime datetime = QDateTime::currentDateTime(); | 405 | QDateTime datetime = QDateTime::currentDateTime(); |
407 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 406 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
408 | QString::number( datetime.date().day() ).rightJustify(2, '0'); | 407 | QString::number( datetime.date().day() ).rightJustify(2, '0'); |
409 | 408 | ||
410 | outputFile += "/" + dateString; | 409 | outputFile += "/" + dateString; |
411 | 410 | ||
412 | QString t = outputFile; | 411 | QString t = outputFile; |
413 | int c = 1; | 412 | int c = 1; |
414 | while(QFile::exists(outputFile + EXTENSION)) | 413 | while(QFile::exists(outputFile + EXTENSION)) |
415 | { | 414 | { |
416 | outputFile = t + QString("%1").arg(c); | 415 | outputFile = t + QString("%1").arg(c); |
417 | c++; | 416 | c++; |
418 | } | 417 | } |
419 | 418 | ||
420 | // We execute tar and compressing its output with gzip.. | 419 | // We execute tar and compressing its output with gzip.. |
421 | // The error output will be written into a temp-file which could be provided | 420 | // The error output will be written into a temp-file which could be provided |
422 | // for debugging.. | 421 | // for debugging.. |
423 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; | 422 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; |
424 | outputFile += EXTENSION; | 423 | outputFile += EXTENSION; |
425 | 424 | ||
426 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) | 425 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) |
427 | .arg( getExcludeFile() ) | 426 | .arg( getExcludeFile() ) |
428 | .arg( backupFiles ) | 427 | .arg( backupFiles ) |
429 | .arg( outputFile.latin1() ) | 428 | .arg( outputFile.latin1() ) |
430 | .arg( tempFileName.latin1() ); | 429 | .arg( tempFileName.latin1() ); |
431 | 430 | ||
432 | odebug << commandLine << oendl; | 431 | odebug << commandLine << oendl; |
433 | 432 | ||
434 | int r = system( commandLine ); | 433 | int r = system( commandLine ); |
435 | 434 | ||
436 | owait->hide(); | 435 | owait->hide(); |
437 | delete owait; | 436 | delete owait; |
438 | 437 | ||
439 | //Error-Handling | 438 | //Error-Handling |
440 | if(r != 0) | 439 | if(r != 0) |
441 | { | 440 | { |
442 | perror("Error: "); | 441 | perror("Error: "); |
443 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 442 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
444 | 443 | ||
445 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" | 444 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" |
446 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) | 445 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) |
447 | { | 446 | { |
448 | 447 | ||
449 | case 1: | 448 | case 1: |
450 | owarn << "Details pressed !" << oendl; | 449 | owarn << "Details pressed !" << oendl; |
451 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 450 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
452 | QFile errorFile( tempFileName ); | 451 | QFile errorFile( tempFileName ); |
453 | if ( errorFile.open(IO_ReadOnly) ) | 452 | if ( errorFile.open(IO_ReadOnly) ) |
454 | { | 453 | { |
455 | QTextStream t( &errorFile ); | 454 | QTextStream t( &errorFile ); |
456 | QString s; | 455 | QString s; |
457 | while ( !t.eof() ) | 456 | while ( !t.eof() ) |
458 | { // until end of file... | 457 | { // until end of file... |
459 | s += t.readLine(); // line of text excluding '\n' | 458 | s += t.readLine(); // line of text excluding '\n' |
460 | } | 459 | } |
461 | errorFile.close(); | 460 | errorFile.close(); |
462 | 461 | ||
463 | pErrDialog->m_textarea->setText( s ); | 462 | pErrDialog->m_textarea->setText( s ); |
464 | } | 463 | } |
465 | else | 464 | else |
466 | { | 465 | { |
467 | pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); | 466 | pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); |
468 | } | 467 | } |
469 | QPEApplication::execDialog( pErrDialog ); | 468 | QPEApplication::execDialog( pErrDialog ); |
470 | delete pErrDialog; | 469 | delete pErrDialog; |
471 | break; | 470 | break; |
472 | } | 471 | } |
473 | setCaption(tr("Backup and Restore.. Failed !!")); | 472 | setCaption(tr("Backup and Restore.. Failed !!")); |
474 | return; | 473 | return; |
475 | } | 474 | } |
476 | else | 475 | else |
477 | { | 476 | { |
478 | QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) ); | 477 | QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) ); |
479 | } | 478 | } |
480 | 479 | ||
481 | //write store-location | 480 | //write store-location |
482 | Config config( "BackupAndRestore" ); | 481 | Config config( "BackupAndRestore" ); |
483 | config.setGroup( "LastLocation" ); | 482 | config.setGroup( "LastLocation" ); |
484 | config.writeEntry( "LastStoreLocation", storeToLocation->currentText() ); | 483 | config.writeEntry( "LastStoreLocation", storeToLocation->currentText() ); |
485 | 484 | ||
486 | setCaption(tr("Backup and Restore")); | 485 | setCaption(tr("Backup and Restore")); |
487 | } | 486 | } |
488 | 487 | ||
489 | /*** | 488 | /*** |
490 | * Get a list of all of the files to backup. | 489 | * Get a list of all of the files to backup. |
491 | */ | 490 | */ |
492 | int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent) | 491 | int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent) |
493 | { | 492 | { |
494 | QListViewItem * currentItem; | 493 | QListViewItem * currentItem; |
495 | QString currentHome; | 494 | QString currentHome; |
496 | if(!parent) | 495 | if(!parent) |
497 | currentItem = backupList->firstChild(); | 496 | currentItem = backupList->firstChild(); |
498 | else | 497 | else |
499 | { | 498 | { |
500 | currentItem = parent->firstChild(); | 499 | currentItem = parent->firstChild(); |
501 | currentHome = parent->text(BACKUP_LOCATION); | 500 | currentHome = parent->text(BACKUP_LOCATION); |
502 | } | 501 | } |
503 | 502 | ||
504 | uint count = 0; | 503 | uint count = 0; |
505 | while( currentItem != 0 ) | 504 | while( currentItem != 0 ) |
506 | { | 505 | { |
507 | if(currentItem->text(HEADER_BACKUP) == "B" ) | 506 | if(currentItem->text(HEADER_BACKUP) == "B" ) |
508 | { | 507 | { |
509 | if(currentItem->childCount() == 0 ) | 508 | if(currentItem->childCount() == 0 ) |
510 | { | 509 | { |
511 | if(parent == NULL) | 510 | if(parent == NULL) |
512 | backupFiles += currentItem->text(BACKUP_LOCATION); | 511 | backupFiles += currentItem->text(BACKUP_LOCATION); |
513 | else | 512 | else |
514 | backupFiles += currentHome + currentItem->text(HEADER_NAME); | 513 | backupFiles += currentHome + currentItem->text(HEADER_NAME); |
515 | backupFiles += " "; | 514 | backupFiles += " "; |
516 | count++; | 515 | count++; |
517 | } | 516 | } |
518 | else | 517 | else |
519 | { | 518 | { |
520 | count += getBackupFiles(backupFiles, currentItem); | 519 | count += getBackupFiles(backupFiles, currentItem); |
521 | } | 520 | } |
522 | } | 521 | } |
523 | currentItem = currentItem->nextSibling(); | 522 | currentItem = currentItem->nextSibling(); |
524 | } | 523 | } |
525 | return count; | 524 | return count; |
526 | } | 525 | } |
527 | 526 | ||
528 | void BackupAndRestore::sourceDirChanged(int selection) | 527 | void BackupAndRestore::sourceDirChanged(int selection) |
529 | { | 528 | { |
530 | restoreList->clear(); | 529 | restoreList->clear(); |
531 | rescanFolder(backupLocations[restoreSource->text(selection)]); | 530 | rescanFolder(backupLocations[restoreSource->text(selection)]); |
532 | } | 531 | } |
533 | 532 | ||
534 | void BackupAndRestore::fileListUpdate() | 533 | void BackupAndRestore::fileListUpdate() |
535 | { | 534 | { |
536 | owarn << "void BackupAndRestore::fileListUpdate()" << oendl; | 535 | owarn << "void BackupAndRestore::fileListUpdate()" << oendl; |
537 | restoreList->clear(); | 536 | restoreList->clear(); |
538 | rescanFolder( backupLocations[restoreSource->currentText()] ); | 537 | rescanFolder( backupLocations[restoreSource->currentText()] ); |
539 | } | 538 | } |
540 | 539 | ||
541 | /** | 540 | /** |
542 | * Scans directory for any backup files. Will recursivly go down, | 541 | * Scans directory for any backup files. Will recursivly go down, |
543 | * but will not follow symlinks. | 542 | * but will not follow symlinks. |
544 | * @param directory - the directory to look in. | 543 | * @param directory - the directory to look in. |
545 | */ | 544 | */ |
546 | void BackupAndRestore::rescanFolder(QString directory) | 545 | void BackupAndRestore::rescanFolder(QString directory) |
547 | { | 546 | { |
548 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; | 547 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
549 | QDir d(directory); | 548 | QDir d(directory); |
550 | if(!d.exists()) | 549 | if(!d.exists()) |
551 | return; | 550 | return; |
552 | 551 | ||
553 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | 552 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); |
554 | const QFileInfoList *list = d.entryInfoList(); | 553 | const QFileInfoList *list = d.entryInfoList(); |
555 | QFileInfoListIterator it( *list ); | 554 | QFileInfoListIterator it( *list ); |
556 | QFileInfo *file; | 555 | QFileInfo *file; |
557 | while ( (file=it.current()) ) | 556 | while ( (file=it.current()) ) |
558 | { // for each file... | 557 | { // for each file... |
559 | // If it is a dir and not .. or . then add it as a tab and go down. | 558 | // If it is a dir and not .. or . then add it as a tab and go down. |
560 | if(file->isDir()) | 559 | if(file->isDir()) |
561 | { | 560 | { |
562 | if(file->fileName() != ".." && file->fileName() != ".") | 561 | if(file->fileName() != ".." && file->fileName() != ".") |
563 | { | 562 | { |
564 | rescanFolder(directory + "/" + file->fileName()); | 563 | rescanFolder(directory + "/" + file->fileName()); |
565 | } | 564 | } |
566 | } | 565 | } |
567 | else | 566 | else |
568 | { | 567 | { |
569 | // If it is a backup file add to list. | 568 | // If it is a backup file add to list. |
570 | if(file->fileName().contains(EXTENSION)) | 569 | if(file->fileName().contains(EXTENSION)) |
571 | (void)new QListViewItem(restoreList, file->fileName()); | 570 | (void)new QListViewItem(restoreList, file->fileName()); |
572 | } | 571 | } |
573 | ++it; | 572 | ++it; |
574 | } | 573 | } |
575 | } | 574 | } |
576 | 575 | ||
577 | /** | 576 | /** |
578 | * Restore a backup file. | 577 | * Restore a backup file. |
579 | * Report errors or success | 578 | * Report errors or success |
580 | */ | 579 | */ |
581 | void BackupAndRestore::restore() | 580 | void BackupAndRestore::restore() |
582 | { | 581 | { |
583 | QListViewItem *restoreItem = restoreList->currentItem(); | 582 | QListViewItem *restoreItem = restoreList->currentItem(); |
584 | if(!restoreItem) | 583 | if(!restoreItem) |
585 | { | 584 | { |
586 | QMessageBox::critical(this, tr( "Message" ), | 585 | QMessageBox::critical(this, tr( "Message" ), |
587 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); | 586 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); |
588 | return; | 587 | return; |
589 | } | 588 | } |
590 | 589 | ||
591 | OWait *owait = new OWait(); | 590 | OWait *owait = new OWait(); |
592 | Global::statusMessage( tr( "Restore Backup..." ) ); | 591 | Global::statusMessage( tr( "Restore Backup..." ) ); |
593 | owait->show(); | 592 | owait->show(); |
594 | qApp->processEvents(); | 593 | qApp->processEvents(); |
595 | 594 | ||
596 | QString restoreFile = backupLocations[restoreSource->currentText()]; | 595 | QString restoreFile = backupLocations[restoreSource->currentText()]; |
597 | 596 | ||
598 | restoreFile += "/" + restoreItem->text(0); | 597 | restoreFile += "/" + restoreItem->text(0); |
599 | 598 | ||
600 | odebug << restoreFile << oendl; | 599 | odebug << restoreFile << oendl; |
601 | 600 | ||
602 | //check if backup file come from opie 1.0.x | 601 | //check if backup file come from opie 1.0.x |
603 | 602 | ||
604 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); | 603 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); |
605 | 604 | ||
606 | int r = system( commandLine ); | 605 | int r = system( commandLine ); |
607 | 606 | ||
608 | QString startDir; | 607 | QString startDir; |
609 | 608 | ||
610 | if( r != 0 ) //Applications/backup/exclude not found - old backup file | 609 | if( r != 0 ) //Applications/backup/exclude not found - old backup file |
611 | { | 610 | { |
612 | startDir = QString( "/" ); | 611 | startDir = QString( "/" ); |
613 | } else | 612 | } else |
614 | { | 613 | { |
615 | startDir = QDir::homeDirPath(); | 614 | startDir = QDir::homeDirPath(); |
616 | } | 615 | } |
617 | 616 | ||
618 | //unpack backup file | 617 | //unpack backup file |
619 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) | 618 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) |
620 | .arg( restoreFile.latin1() ) | 619 | .arg( restoreFile.latin1() ) |
621 | .arg( tempFileName.latin1() ); | 620 | .arg( tempFileName.latin1() ); |
622 | 621 | ||
623 | odebug << commandLine << oendl; | 622 | odebug << commandLine << oendl; |
624 | 623 | ||
625 | r = system( commandLine ); | 624 | r = system( commandLine ); |
626 | 625 | ||
627 | owait->hide(); | 626 | owait->hide(); |
628 | delete owait; | 627 | delete owait; |
629 | 628 | ||
630 | //error handling | 629 | //error handling |
631 | if(r != 0) | 630 | if(r != 0) |
632 | { | 631 | { |
633 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 632 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
634 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" | 633 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" |
635 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) | 634 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) |
636 | { | 635 | { |
637 | case 1: | 636 | case 1: |
638 | owarn << "Details pressed !" << oendl; | 637 | owarn << "Details pressed !" << oendl; |
639 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 638 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
640 | QFile errorFile( tempFileName ); | 639 | QFile errorFile( tempFileName ); |
641 | if ( errorFile.open(IO_ReadOnly) ) | 640 | if ( errorFile.open(IO_ReadOnly) ) |
642 | { | 641 | { |
643 | QTextStream t( &errorFile ); | 642 | QTextStream t( &errorFile ); |
644 | QString s; | 643 | QString s; |
645 | while ( !t.eof() ) | 644 | while ( !t.eof() ) |
646 | { // until end of file... | 645 | { // until end of file... |
647 | s += t.readLine(); // line of text excluding '\n' | 646 | s += t.readLine(); // line of text excluding '\n' |
648 | } | 647 | } |
649 | errorFile.close(); | 648 | errorFile.close(); |
650 | 649 | ||
651 | pErrDialog->m_textarea->setText( s ); | 650 | pErrDialog->m_textarea->setText( s ); |
652 | } | 651 | } |
653 | else | 652 | else |
654 | { | 653 | { |
655 | pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) ); | 654 | pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) ); |
656 | } | 655 | } |
657 | QPEApplication::execDialog( pErrDialog ); | 656 | QPEApplication::execDialog( pErrDialog ); |
658 | delete pErrDialog; | 657 | delete pErrDialog; |
659 | 658 | ||
660 | setCaption(tr("Backup and Restore.. Failed !!")); | 659 | setCaption(tr("Backup and Restore.. Failed !!")); |
661 | return; | 660 | return; |
662 | 661 | ||
663 | break; | 662 | break; |
664 | 663 | ||
665 | } | 664 | } |
666 | } | 665 | } |
667 | else | 666 | else |
668 | { | 667 | { |
669 | QMessageBox::information(this, tr( "Message" ), tr( "Restore Successful." ), QString( tr( "Ok") ) ); | 668 | QMessageBox::information(this, tr( "Message" ), tr( "Restore Successful." ), QString( tr( "Ok") ) ); |
670 | } | 669 | } |
671 | 670 | ||
672 | //write restore-location | 671 | //write restore-location |
673 | Config config( "BackupAndRestore" ); | 672 | Config config( "BackupAndRestore" ); |
674 | config.setGroup( "LastLocation" ); | 673 | config.setGroup( "LastLocation" ); |
675 | config.writeEntry( "LastRestoreLocation", restoreSource->currentText() ); | 674 | config.writeEntry( "LastRestoreLocation", restoreSource->currentText() ); |
676 | 675 | ||
677 | setCaption(tr("Backup and Restore")); | 676 | setCaption(tr("Backup and Restore")); |
678 | } | 677 | } |
679 | 678 | ||
680 | /** | 679 | /** |
681 | * Check for exclude in Applications/backup | 680 | * Check for exclude in Applications/backup |
682 | * If it does not exist, the function will create the file with *.bck as content | 681 | * If it does not exist, the function will create the file with *.bck as content |
683 | * The exclude_files is read by tar and will provide to exclude special files out from backup. | 682 | * The exclude_files is read by tar and will provide to exclude special files out from backup. |
684 | * e.g. alle *.bck files (backup-files) will not be backed up by default | 683 | * e.g. alle *.bck files (backup-files) will not be backed up by default |
685 | */ | 684 | */ |
686 | 685 | ||
687 | QString BackupAndRestore::getExcludeFile() | 686 | QString BackupAndRestore::getExcludeFile() |
688 | { | 687 | { |
689 | QString excludeFileName = Global::applicationFileName( "backup", "exclude" ); | 688 | QString excludeFileName = Global::applicationFileName( "backup", "exclude" ); |
690 | if ( !QFile::exists( excludeFileName ) ) | 689 | if ( !QFile::exists( excludeFileName ) ) |
691 | { | 690 | { |
692 | QFile excludeFile( excludeFileName); | 691 | QFile excludeFile( excludeFileName); |
693 | if ( excludeFile.open( IO_WriteOnly ) == true ) | 692 | if ( excludeFile.open( IO_WriteOnly ) == true ) |
694 | { | 693 | { |
695 | QTextStream writeStream( &excludeFile ); | 694 | QTextStream writeStream( &excludeFile ); |
696 | writeStream << "*.bck" << "\n"; | 695 | writeStream << "*.bck" << "\n"; |
697 | excludeFile.close(); | 696 | excludeFile.close(); |
698 | } | 697 | } |
699 | else | 698 | else |
700 | { | 699 | { |
701 | return QString::null; | 700 | return QString::null; |
702 | } | 701 | } |
703 | } | 702 | } |
704 | 703 | ||
705 | return excludeFileName; | 704 | return excludeFileName; |
706 | } | 705 | } |
707 | 706 | ||
708 | void BackupAndRestore::refreshLocations() | 707 | void BackupAndRestore::refreshLocations() |
709 | { | 708 | { |
710 | locationList->clear(); | 709 | locationList->clear(); |
711 | 710 | ||
712 | //todo: implement add locations | 711 | //todo: implement add locations |
713 | Config config( "BackupAndRestore" ); | 712 | Config config( "BackupAndRestore" ); |
714 | config.setGroup( "Locations" ); | 713 | config.setGroup( "Locations" ); |
715 | 714 | ||
716 | QStringList locations( config.readListEntry( "locations", '|' ) ); | 715 | QStringList locations( config.readListEntry( "locations", '|' ) ); |
717 | 716 | ||
718 | for ( QStringList::Iterator it = locations.begin(); it != locations.end(); ++it ) { | 717 | for ( QStringList::Iterator it = locations.begin(); it != locations.end(); ++it ) { |
719 | (void) new QListViewItem( locationList, *it ); | 718 | (void) new QListViewItem( locationList, *it ); |
720 | } | 719 | } |
721 | } | 720 | } |
722 | 721 | ||
723 | void BackupAndRestore::addLocation() | 722 | void BackupAndRestore::addLocation() |
724 | { | 723 | { |
725 | if ( ( !locationEdit->text().isEmpty() ) && | 724 | if ( ( !locationEdit->text().isEmpty() ) && |
726 | ( QDir( locationEdit->text() ).exists() ) ) | 725 | ( QDir( locationEdit->text() ).exists() ) ) |
727 | { | 726 | { |
728 | (void) new QListViewItem( locationList, locationEdit->text() ); | 727 | (void) new QListViewItem( locationList, locationEdit->text() ); |
729 | locationEdit->setText( "" ); | 728 | locationEdit->setText( "" ); |
729 | saveLocations(); | ||
730 | } | 730 | } |
731 | } | 731 | } |
732 | 732 | ||
733 | void BackupAndRestore::removeLocation() | 733 | void BackupAndRestore::removeLocation() |
734 | { | 734 | { |
735 | if ( locationList->selectedItem() ) | 735 | if ( locationList->selectedItem() ) |
736 | { | 736 | { |
737 | delete( locationList->selectedItem() ); | 737 | delete( locationList->selectedItem() ); |
738 | saveLocations(); | ||
738 | } | 739 | } |
739 | } | 740 | } |
740 | 741 | ||
741 | void BackupAndRestore::saveLocations() | 742 | void BackupAndRestore::saveLocations() |
742 | { | 743 | { |
743 | Config config("BackupAndRestore"); | 744 | Config config("BackupAndRestore"); |
744 | config.setGroup("Locations"); | 745 | config.setGroup("Locations"); |
745 | 746 | ||
746 | QStringList locations; | 747 | QStringList locations; |
747 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) | 748 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) |
748 | { | 749 | { |
749 | locations.append( it.current()->text( 0 ) ); | 750 | locations.append( it.current()->text( 0 ) ); |
750 | } | 751 | } |
751 | config.writeEntry( "locations", locations, '|' ); | 752 | config.writeEntry( "locations", locations, '|' ); |
752 | 753 | ||
753 | refreshBackupLocations(); | 754 | refreshBackupLocations(); |
754 | } | 755 | } |
755 | 756 | ||
756 | void BackupAndRestore::selectLocation() | 757 | void BackupAndRestore::selectLocation() |
757 | { | 758 | { |
758 | QString location = OFileDialog::getDirectory( OFileSelector::DIRECTORYSELECTOR ); | 759 | QString location = OFileDialog::getDirectory( OFileSelector::DIRECTORYSELECTOR ); |
759 | if ( !location.isEmpty() ) | 760 | if ( !location.isEmpty() ) |
760 | { | 761 | { |
761 | locationEdit->setText( location ); | 762 | locationEdit->setText( location ); |
762 | } | 763 | } |
763 | } | 764 | } |
764 | 765 | ||
765 | // backuprestore.cpp | 766 | // backuprestore.cpp |
766 | 767 | ||
diff --git a/noncore/settings/backup/backuprestorebase.ui b/noncore/settings/backup/backuprestorebase.ui index 6186d68..cca3dee 100644 --- a/noncore/settings/backup/backuprestorebase.ui +++ b/noncore/settings/backup/backuprestorebase.ui | |||
@@ -1,393 +1,365 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>BackupAndRestoreBase</class> | 2 | <class>BackupAndRestoreBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>BackupAndRestoreBase</cstring> | 7 | <cstring>BackupAndRestoreBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>278</width> | 14 | <width>246</width> |
15 | <height>298</height> | 15 | <height>338</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Backup And Restore</string> | 20 | <string>Backup And Restore</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <grid> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>0</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget row="0" column="0" > |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>tabWidget</cstring> | 41 | <cstring>tabWidget</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>Widget2</cstring> | 53 | <cstring>Widget2</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Backup</string> | 57 | <string>Backup</string> |
58 | </attribute> | 58 | </attribute> |
59 | <grid> | 59 | <grid> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>4</number> | 62 | <number>4</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>2</number> | 66 | <number>2</number> |
67 | </property> | 67 | </property> |
68 | <widget row="0" column="0" > | 68 | <widget row="1" column="1" > |
69 | <class>QLayoutWidget</class> | 69 | <class>QComboBox</class> |
70 | <property stdset="1"> | ||
71 | <name>name</name> | ||
72 | <cstring>storeToLocation</cstring> | ||
73 | </property> | ||
74 | <property stdset="1"> | ||
75 | <name>sizePolicy</name> | ||
76 | <sizepolicy> | ||
77 | <hsizetype>3</hsizetype> | ||
78 | <vsizetype>1</vsizetype> | ||
79 | </sizepolicy> | ||
80 | </property> | ||
81 | </widget> | ||
82 | <widget row="1" column="0" > | ||
83 | <class>QLabel</class> | ||
84 | <property stdset="1"> | ||
85 | <name>name</name> | ||
86 | <cstring>labelDestination</cstring> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>text</name> | ||
90 | <string>Destination</string> | ||
91 | </property> | ||
92 | </widget> | ||
93 | <widget row="3" column="0" rowspan="1" colspan="2" > | ||
94 | <class>QPushButton</class> | ||
95 | <property stdset="1"> | ||
96 | <name>name</name> | ||
97 | <cstring>backupButton</cstring> | ||
98 | </property> | ||
99 | <property stdset="1"> | ||
100 | <name>text</name> | ||
101 | <string>&Backup</string> | ||
102 | </property> | ||
103 | </widget> | ||
104 | <widget row="2" column="0" rowspan="1" colspan="2" > | ||
105 | <class>QListView</class> | ||
106 | <column> | ||
107 | <property> | ||
108 | <name>text</name> | ||
109 | <string>Applications</string> | ||
110 | </property> | ||
111 | <property> | ||
112 | <name>clickable</name> | ||
113 | <bool>true</bool> | ||
114 | </property> | ||
115 | <property> | ||
116 | <name>resizeable</name> | ||
117 | <bool>true</bool> | ||
118 | </property> | ||
119 | </column> | ||
70 | <property stdset="1"> | 120 | <property stdset="1"> |
71 | <name>name</name> | 121 | <name>name</name> |
72 | <cstring>Layout1</cstring> | 122 | <cstring>backupList</cstring> |
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>allColumnsShowFocus</name> | ||
126 | <bool>true</bool> | ||
127 | </property> | ||
128 | <property stdset="1"> | ||
129 | <name>rootIsDecorated</name> | ||
130 | <bool>true</bool> | ||
131 | </property> | ||
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> | ||
73 | </property> | 148 | </property> |
74 | <grid> | 149 | <grid> |
75 | <property stdset="1"> | 150 | <property stdset="1"> |
76 | <name>margin</name> | 151 | <name>margin</name> |
77 | <number>0</number> | 152 | <number>6</number> |
78 | </property> | 153 | </property> |
79 | <property stdset="1"> | 154 | <property stdset="1"> |
80 | <name>spacing</name> | 155 | <name>spacing</name> |
81 | <number>6</number> | 156 | <number>2</number> |
82 | </property> | 157 | </property> |
83 | <widget row="1" column="1" > | ||
84 | <class>QComboBox</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>storeToLocation</cstring> | ||
88 | </property> | ||
89 | <property stdset="1"> | ||
90 | <name>sizePolicy</name> | ||
91 | <sizepolicy> | ||
92 | <hsizetype>3</hsizetype> | ||
93 | <vsizetype>1</vsizetype> | ||
94 | </sizepolicy> | ||
95 | </property> | ||
96 | </widget> | ||
97 | <widget row="1" column="0" > | 158 | <widget row="1" column="0" > |
98 | <class>QLabel</class> | 159 | <class>QRadioButton</class> |
99 | <property stdset="1"> | 160 | <property stdset="1"> |
100 | <name>name</name> | 161 | <name>name</name> |
101 | <cstring>TextLabel1</cstring> | 162 | <cstring>cb_type_fullbackup</cstring> |
102 | </property> | 163 | </property> |
103 | <property stdset="1"> | 164 | <property stdset="1"> |
104 | <name>text</name> | 165 | <name>text</name> |
105 | <string>Destination</string> | 166 | <string>Full Backup (Root File System)</string> |
106 | </property> | 167 | </property> |
107 | </widget> | 168 | </widget> |
108 | <widget row="3" column="0" rowspan="1" colspan="2" > | 169 | <widget row="0" column="0" > |
109 | <class>QPushButton</class> | 170 | <class>QRadioButton</class> |
110 | <property stdset="1"> | 171 | <property stdset="1"> |
111 | <name>name</name> | 172 | <name>name</name> |
112 | <cstring>backupButton</cstring> | 173 | <cstring>cb_type_userdata</cstring> |
113 | </property> | 174 | </property> |
114 | <property stdset="1"> | 175 | <property stdset="1"> |
115 | <name>text</name> | 176 | <name>text</name> |
116 | <string>&Backup</string> | 177 | <string>User Data (Configuration + PIM)</string> |
117 | </property> | 178 | </property> |
118 | </widget> | ||
119 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
120 | <class>QButtonGroup</class> | ||
121 | <property stdset="1"> | 179 | <property stdset="1"> |
122 | <name>name</name> | 180 | <name>checked</name> |
123 | <cstring>frame_type</cstring> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>title</name> | ||
127 | <string>Type</string> | ||
128 | </property> | ||
129 | <property> | ||
130 | <name>layoutMargin</name> | ||
131 | </property> | ||
132 | <property> | ||
133 | <name>layoutSpacing</name> | ||
134 | </property> | ||
135 | <vbox> | ||
136 | <property stdset="1"> | ||
137 | <name>margin</name> | ||
138 | <number>4</number> | ||
139 | </property> | ||
140 | <property stdset="1"> | ||
141 | <name>spacing</name> | ||
142 | <number>2</number> | ||
143 | </property> | ||
144 | <widget> | ||
145 | <class>QRadioButton</class> | ||
146 | <property stdset="1"> | ||
147 | <name>name</name> | ||
148 | <cstring>cb_type_userdata</cstring> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>text</name> | ||
152 | <string>User Data (Configuration + PIM)</string> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>checked</name> | ||
156 | <bool>true</bool> | ||
157 | </property> | ||
158 | </widget> | ||
159 | <widget> | ||
160 | <class>QRadioButton</class> | ||
161 | <property stdset="1"> | ||
162 | <name>name</name> | ||
163 | <cstring>cb_type_fullbackup</cstring> | ||
164 | </property> | ||
165 | <property stdset="1"> | ||
166 | <name>text</name> | ||
167 | <string>Full Backup (Root File System)</string> | ||
168 | </property> | ||
169 | </widget> | ||
170 | </vbox> | ||
171 | </widget> | ||
172 | <widget row="2" column="0" rowspan="1" colspan="2" > | ||
173 | <class>QListView</class> | ||
174 | <column> | ||
175 | <property> | ||
176 | <name>text</name> | ||
177 | <string>Applications</string> | ||
178 | </property> | ||
179 | <property> | ||
180 | <name>clickable</name> | ||
181 | <bool>true</bool> | ||
182 | </property> | ||
183 | <property> | ||
184 | <name>resizeable</name> | ||
185 | <bool>true</bool> | ||
186 | </property> | ||
187 | </column> | ||
188 | <property stdset="1"> | ||
189 | <name>name</name> | ||
190 | <cstring>backupList</cstring> | ||
191 | </property> | ||
192 | <property stdset="1"> | ||
193 | <name>allColumnsShowFocus</name> | ||
194 | <bool>true</bool> | ||
195 | </property> | ||
196 | <property stdset="1"> | ||
197 | <name>rootIsDecorated</name> | ||
198 | <bool>true</bool> | 181 | <bool>true</bool> |
199 | </property> | 182 | </property> |
200 | </widget> | 183 | </widget> |
201 | </grid> | 184 | </grid> |
202 | </widget> | 185 | </widget> |
203 | </grid> | 186 | </grid> |
204 | </widget> | 187 | </widget> |
205 | <widget> | 188 | <widget> |
206 | <class>QWidget</class> | 189 | <class>QWidget</class> |
207 | <property stdset="1"> | 190 | <property stdset="1"> |
208 | <name>name</name> | 191 | <name>name</name> |
209 | <cstring>Widget3</cstring> | 192 | <cstring>Widget3</cstring> |
210 | </property> | 193 | </property> |
211 | <attribute> | 194 | <attribute> |
212 | <name>title</name> | 195 | <name>title</name> |
213 | <string>Restore</string> | 196 | <string>Restore</string> |
214 | </attribute> | 197 | </attribute> |
215 | <grid> | 198 | <grid> |
216 | <property stdset="1"> | 199 | <property stdset="1"> |
217 | <name>margin</name> | 200 | <name>margin</name> |
218 | <number>4</number> | 201 | <number>4</number> |
219 | </property> | 202 | </property> |
220 | <property stdset="1"> | 203 | <property stdset="1"> |
221 | <name>spacing</name> | 204 | <name>spacing</name> |
222 | <number>4</number> | 205 | <number>2</number> |
223 | </property> | 206 | </property> |
224 | <widget row="0" column="1" > | 207 | <widget row="0" column="1" > |
225 | <class>QComboBox</class> | 208 | <class>QComboBox</class> |
226 | <property stdset="1"> | 209 | <property stdset="1"> |
227 | <name>name</name> | 210 | <name>name</name> |
228 | <cstring>restoreSource</cstring> | 211 | <cstring>restoreSource</cstring> |
229 | </property> | 212 | </property> |
230 | </widget> | 213 | </widget> |
231 | <widget row="2" column="0" rowspan="1" colspan="2" > | 214 | <widget row="2" column="0" rowspan="1" colspan="2" > |
232 | <class>QPushButton</class> | 215 | <class>QPushButton</class> |
233 | <property stdset="1"> | 216 | <property stdset="1"> |
234 | <name>name</name> | 217 | <name>name</name> |
235 | <cstring>restoreButton</cstring> | 218 | <cstring>restoreButton</cstring> |
236 | </property> | 219 | </property> |
237 | <property stdset="1"> | 220 | <property stdset="1"> |
238 | <name>text</name> | 221 | <name>text</name> |
239 | <string>&Restore</string> | 222 | <string>&Restore</string> |
240 | </property> | 223 | </property> |
241 | </widget> | 224 | </widget> |
242 | <widget row="0" column="0" > | 225 | <widget row="0" column="0" > |
243 | <class>QLabel</class> | 226 | <class>QLabel</class> |
244 | <property stdset="1"> | 227 | <property stdset="1"> |
245 | <name>name</name> | 228 | <name>name</name> |
246 | <cstring>TextLabel1_2</cstring> | 229 | <cstring>destinationLabel</cstring> |
247 | </property> | 230 | </property> |
248 | <property stdset="1"> | 231 | <property stdset="1"> |
249 | <name>text</name> | 232 | <name>text</name> |
250 | <string>Select Source</string> | 233 | <string>Select Source</string> |
251 | </property> | 234 | </property> |
252 | </widget> | 235 | </widget> |
253 | <widget row="1" column="0" rowspan="1" colspan="2" > | 236 | <widget row="1" column="0" rowspan="1" colspan="2" > |
254 | <class>QListView</class> | 237 | <class>QListView</class> |
255 | <column> | 238 | <column> |
256 | <property> | 239 | <property> |
257 | <name>text</name> | 240 | <name>text</name> |
258 | <string>Column 1</string> | 241 | <string>Column 1</string> |
259 | </property> | 242 | </property> |
260 | <property> | 243 | <property> |
261 | <name>clickable</name> | 244 | <name>clickable</name> |
262 | <bool>true</bool> | 245 | <bool>true</bool> |
263 | </property> | 246 | </property> |
264 | <property> | 247 | <property> |
265 | <name>resizeable</name> | 248 | <name>resizeable</name> |
266 | <bool>true</bool> | 249 | <bool>true</bool> |
267 | </property> | 250 | </property> |
268 | </column> | 251 | </column> |
269 | <property stdset="1"> | 252 | <property stdset="1"> |
270 | <name>name</name> | 253 | <name>name</name> |
271 | <cstring>restoreList</cstring> | 254 | <cstring>restoreList</cstring> |
272 | </property> | 255 | </property> |
273 | <property stdset="1"> | 256 | <property stdset="1"> |
274 | <name>minimumSize</name> | 257 | <name>minimumSize</name> |
275 | <size> | 258 | <size> |
276 | <width>0</width> | 259 | <width>0</width> |
277 | <height>100</height> | 260 | <height>100</height> |
278 | </size> | 261 | </size> |
279 | </property> | 262 | </property> |
280 | </widget> | 263 | </widget> |
281 | </grid> | 264 | </grid> |
282 | </widget> | 265 | </widget> |
283 | <widget> | 266 | <widget> |
284 | <class>QWidget</class> | 267 | <class>QWidget</class> |
285 | <property stdset="1"> | 268 | <property stdset="1"> |
286 | <name>name</name> | 269 | <name>name</name> |
287 | <cstring>tab</cstring> | 270 | <cstring>tab</cstring> |
288 | </property> | 271 | </property> |
289 | <attribute> | 272 | <attribute> |
290 | <name>title</name> | 273 | <name>title</name> |
291 | <string>Locations</string> | 274 | <string>Locations</string> |
292 | </attribute> | 275 | </attribute> |
293 | <grid> | 276 | <grid> |
294 | <property stdset="1"> | 277 | <property stdset="1"> |
295 | <name>margin</name> | 278 | <name>margin</name> |
296 | <number>4</number> | 279 | <number>4</number> |
297 | </property> | 280 | </property> |
298 | <property stdset="1"> | 281 | <property stdset="1"> |
299 | <name>spacing</name> | 282 | <name>spacing</name> |
300 | <number>4</number> | 283 | <number>2</number> |
301 | </property> | 284 | </property> |
302 | <widget row="1" column="0" rowspan="1" colspan="4" > | 285 | <widget row="0" column="2" > |
303 | <class>QListView</class> | 286 | <class>QPushButton</class> |
304 | <column> | ||
305 | <property> | ||
306 | <name>text</name> | ||
307 | <string>Locations</string> | ||
308 | </property> | ||
309 | <property> | ||
310 | <name>clickable</name> | ||
311 | <bool>true</bool> | ||
312 | </property> | ||
313 | <property> | ||
314 | <name>resizeable</name> | ||
315 | <bool>true</bool> | ||
316 | </property> | ||
317 | </column> | ||
318 | <property stdset="1"> | 287 | <property stdset="1"> |
319 | <name>name</name> | 288 | <name>name</name> |
320 | <cstring>locationList</cstring> | 289 | <cstring>selectLocationButton</cstring> |
321 | </property> | 290 | </property> |
322 | </widget> | ||
323 | <widget row="2" column="0" > | ||
324 | <class>QPushButton</class> | ||
325 | <property stdset="1"> | 291 | <property stdset="1"> |
326 | <name>name</name> | 292 | <name>sizePolicy</name> |
327 | <cstring>addLocationButton</cstring> | 293 | <sizepolicy> |
294 | <hsizetype>0</hsizetype> | ||
295 | <vsizetype>0</vsizetype> | ||
296 | </sizepolicy> | ||
297 | </property> | ||
298 | <property stdset="1"> | ||
299 | <name>maximumSize</name> | ||
300 | <size> | ||
301 | <width>20</width> | ||
302 | <height>30</height> | ||
303 | </size> | ||
328 | </property> | 304 | </property> |
329 | <property stdset="1"> | 305 | <property stdset="1"> |
330 | <name>text</name> | 306 | <name>text</name> |
331 | <string>Add</string> | 307 | <string>...</string> |
332 | </property> | 308 | </property> |
333 | </widget> | 309 | </widget> |
334 | <widget row="2" column="1" > | 310 | <widget row="0" column="0" rowspan="1" colspan="2" > |
335 | <class>QPushButton</class> | 311 | <class>QLineEdit</class> |
336 | <property stdset="1"> | 312 | <property stdset="1"> |
337 | <name>name</name> | 313 | <name>name</name> |
338 | <cstring>removeLocationButton</cstring> | 314 | <cstring>locationEdit</cstring> |
339 | </property> | ||
340 | <property stdset="1"> | ||
341 | <name>text</name> | ||
342 | <string>Remove</string> | ||
343 | </property> | 315 | </property> |
344 | </widget> | 316 | </widget> |
345 | <widget row="2" column="2" rowspan="1" colspan="2" > | 317 | <widget row="2" column="0" > |
346 | <class>QPushButton</class> | 318 | <class>QPushButton</class> |
347 | <property stdset="1"> | 319 | <property stdset="1"> |
348 | <name>name</name> | 320 | <name>name</name> |
349 | <cstring>saveLocationsButton</cstring> | 321 | <cstring>addLocationButton</cstring> |
350 | </property> | 322 | </property> |
351 | <property stdset="1"> | 323 | <property stdset="1"> |
352 | <name>text</name> | 324 | <name>text</name> |
353 | <string>Save</string> | 325 | <string>Add</string> |
354 | </property> | 326 | </property> |
355 | </widget> | 327 | </widget> |
356 | <widget row="0" column="3" > | 328 | <widget row="2" column="1" rowspan="1" colspan="2" > |
357 | <class>QPushButton</class> | 329 | <class>QPushButton</class> |
358 | <property stdset="1"> | 330 | <property stdset="1"> |
359 | <name>name</name> | 331 | <name>name</name> |
360 | <cstring>selectLocationButton</cstring> | 332 | <cstring>removeLocationButton</cstring> |
361 | </property> | ||
362 | <property stdset="1"> | ||
363 | <name>sizePolicy</name> | ||
364 | <sizepolicy> | ||
365 | <hsizetype>0</hsizetype> | ||
366 | <vsizetype>0</vsizetype> | ||
367 | </sizepolicy> | ||
368 | </property> | ||
369 | <property stdset="1"> | ||
370 | <name>maximumSize</name> | ||
371 | <size> | ||
372 | <width>20</width> | ||
373 | <height>30</height> | ||
374 | </size> | ||
375 | </property> | 333 | </property> |
376 | <property stdset="1"> | 334 | <property stdset="1"> |
377 | <name>text</name> | 335 | <name>text</name> |
378 | <string>...</string> | 336 | <string>Remove</string> |
379 | </property> | 337 | </property> |
380 | </widget> | 338 | </widget> |
381 | <widget row="0" column="0" rowspan="1" colspan="3" > | 339 | <widget row="1" column="0" rowspan="1" colspan="3" > |
382 | <class>QLineEdit</class> | 340 | <class>QListView</class> |
341 | <column> | ||
342 | <property> | ||
343 | <name>text</name> | ||
344 | <string>Locations</string> | ||
345 | </property> | ||
346 | <property> | ||
347 | <name>clickable</name> | ||
348 | <bool>true</bool> | ||
349 | </property> | ||
350 | <property> | ||
351 | <name>resizeable</name> | ||
352 | <bool>true</bool> | ||
353 | </property> | ||
354 | </column> | ||
383 | <property stdset="1"> | 355 | <property stdset="1"> |
384 | <name>name</name> | 356 | <name>name</name> |
385 | <cstring>locationEdit</cstring> | 357 | <cstring>locationList</cstring> |
386 | </property> | 358 | </property> |
387 | </widget> | 359 | </widget> |
388 | </grid> | 360 | </grid> |
389 | </widget> | 361 | </widget> |
390 | </widget> | 362 | </widget> |
391 | </vbox> | 363 | </grid> |
392 | </widget> | 364 | </widget> |
393 | </UI> | 365 | </UI> |