-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 127 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.h | 6 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestorebase.ui | 129 |
3 files changed, 202 insertions, 60 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 2eccdfe..3889744 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,119 +1,102 @@ | |||
1 | #include "backuprestore.h" | 1 | #include "backuprestore.h" |
2 | #include "errordialog.h" | 2 | #include "errordialog.h" |
3 | 3 | ||
4 | |||
4 | /* OPIE */ | 5 | /* OPIE */ |
5 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
6 | #include <opie2/ostorageinfo.h> | 7 | #include <opie2/ostorageinfo.h> |
7 | #include <qpe/qpeapplication.h> | ||
8 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
9 | 9 | ||
10 | #include <qpe/qpeapplication.h> | ||
11 | #include <qpe/resource.h> | ||
12 | #include <qpe/config.h> | ||
13 | |||
10 | /* QT */ | 14 | /* QT */ |
11 | #include <qapplication.h> | 15 | #include <qapplication.h> |
12 | #include <qmultilineedit.h> | 16 | #include <qmultilineedit.h> |
13 | #include <qdir.h> | 17 | #include <qdir.h> |
14 | #include <qfile.h> | 18 | #include <qfile.h> |
15 | #include <qfileinfo.h> | 19 | #include <qfileinfo.h> |
16 | #include <qlistview.h> | 20 | #include <qlistview.h> |
17 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
18 | #include <qheader.h> | 22 | #include <qheader.h> |
19 | #include <qpe/resource.h> | ||
20 | #include <qpe/config.h> | ||
21 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
22 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
23 | #include <qlist.h> | 25 | #include <qlist.h> |
24 | #include <stdlib.h> | ||
25 | #include <qregexp.h> | 26 | #include <qregexp.h> |
26 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
27 | #include <qtextview.h> | 28 | #include <qtextview.h> |
29 | #include <qlineedit.h> | ||
28 | 30 | ||
29 | /* STD */ | 31 | /* STD */ |
30 | #include <errno.h> | 32 | #include <errno.h> |
31 | #include <stdlib.h> | 33 | #include <stdlib.h> |
32 | #include <unistd.h> | 34 | #include <unistd.h> |
33 | #include <sys/stat.h> | 35 | #include <sys/stat.h> |
34 | #include <dirent.h> | 36 | #include <dirent.h> |
35 | 37 | ||
36 | #define HEADER_NAME 0 | 38 | #define HEADER_NAME 0 |
37 | #define HEADER_BACKUP 1 | 39 | #define HEADER_BACKUP 1 |
38 | #define BACKUP_LOCATION 2 | 40 | #define BACKUP_LOCATION 2 |
39 | 41 | ||
40 | #define EXTENSION ".bck" | 42 | #define EXTENSION ".bck" |
41 | 43 | ||
42 | const QString tempFileName = "/tmp/backup.err"; | 44 | const QString tempFileName = "/tmp/backup.err"; |
43 | 45 | ||
44 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) | 46 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) |
45 | : BackupAndRestoreBase(parent, name, fl) | 47 | : BackupAndRestoreBase(parent, name, fl) |
46 | { | 48 | { |
47 | backupList->header()->hide(); | 49 | backupList->header()->hide(); |
48 | restoreList->header()->hide(); | 50 | restoreList->header()->hide(); |
49 | connect(backupButton, SIGNAL(clicked()), | 51 | locationList->header()->hide(); |
50 | this, SLOT(backup())); | 52 | connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); |
51 | connect(restoreButton, SIGNAL(clicked()), | 53 | connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); |
52 | this, SLOT(restore())); | 54 | connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); |
53 | connect(backupList, SIGNAL(clicked(QListViewItem*)), | 55 | connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); |
54 | this, SLOT(selectItem(QListViewItem*))); | 56 | connect( addLocationButton, SIGNAL( clicked() ), this, SLOT( addLocation() ) ); |
55 | connect(restoreSource, SIGNAL(activated(int)), | 57 | connect( removeLocationButton, SIGNAL( clicked() ), this, SLOT( removeLocation() ) ); |
56 | this, SLOT(sourceDirChanged(int))); | 58 | connect( saveLocationsButton, SIGNAL( clicked() ), this, SLOT( saveLocations() ) ); |
57 | connect(updateList, SIGNAL(clicked()), | ||
58 | this, SLOT( fileListUpdate())); | ||
59 | 59 | ||
60 | //add directorys for backing up | 60 | //add directorys for backing up |
61 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); | 61 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", "Settings/"); |
62 | selectItem(applicationSettings); | 62 | selectItem(applicationSettings); |
63 | applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); | 63 | applicationSettings = new QListViewItem(backupList, "Application Data", "", "Applications/"); |
64 | selectItem(applicationSettings); | 64 | selectItem(applicationSettings); |
65 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); | 65 | documents= new QListViewItem(backupList, "Documents", "", "Documents/"); |
66 | selectItem(documents); | 66 | selectItem(documents); |
67 | 67 | ||
68 | scanForApplicationSettings(); | 68 | scanForApplicationSettings(); |
69 | 69 | refreshBackupLocations(); | |
70 | Opie::Core::OStorageInfo storage; | 70 | refreshLocations(); |
71 | |||
72 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); | ||
73 | if ( storage.hasCf() ) | ||
74 | { | ||
75 | backupLocations.insert( "CF", storage.cfPath() ); | ||
76 | odebug << "Cf Path: " + storage.cfPath() << oendl; | ||
77 | } | ||
78 | if ( storage.hasSd() ) | ||
79 | { | ||
80 | backupLocations.insert( "SD", storage.sdPath() ); | ||
81 | odebug << " Sd Path: " + storage.sdPath() << oendl; | ||
82 | } | ||
83 | if ( storage.hasMmc() ) | ||
84 | { | ||
85 | backupLocations.insert( "MMC", storage.mmcPath() ); | ||
86 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; | ||
87 | } | ||
88 | 71 | ||
89 | Config config("BackupAndRestore"); | 72 | Config config("BackupAndRestore"); |
90 | //read last locations | 73 | //read last locations |
91 | config.setGroup("LastLocation"); | 74 | config.setGroup("LastLocation"); |
92 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | 75 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); |
93 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | 76 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); |
94 | int locationIndex = 0; | 77 | int locationIndex = 0; |
95 | 78 | ||
96 | QMap<QString, QString>::Iterator it; | 79 | QMap<QString, QString>::Iterator it; |
97 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | 80 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) |
98 | { | 81 | { |
99 | storeToLocation->insertItem(it.key()); | 82 | storeToLocation->insertItem(it.key()); |
100 | restoreSource->insertItem(it.key()); | 83 | restoreSource->insertItem(it.key()); |
101 | 84 | ||
102 | //check for last locations | 85 | //check for last locations |
103 | if ( it.key() == lastStoreLocation ) | 86 | if ( it.key() == lastStoreLocation ) |
104 | storeToLocation->setCurrentItem( locationIndex ); | 87 | storeToLocation->setCurrentItem( locationIndex ); |
105 | if ( it.key() == lastRestoreLocation ) | 88 | if ( it.key() == lastRestoreLocation ) |
106 | restoreSource->setCurrentItem( locationIndex ); | 89 | restoreSource->setCurrentItem( locationIndex ); |
107 | locationIndex++; | 90 | locationIndex++; |
108 | } | 91 | } |
109 | 92 | ||
110 | // Read the list of items to ignore. | 93 | // Read the list of items to ignore. |
111 | QList<QString> dontBackupList; | 94 | QList<QString> dontBackupList; |
112 | dontBackupList.setAutoDelete(true); | 95 | dontBackupList.setAutoDelete(true); |
113 | config.setGroup("DontBackup"); | 96 | config.setGroup("DontBackup"); |
114 | int total = config.readNumEntry("Total", 0); | 97 | int total = config.readNumEntry("Total", 0); |
115 | for(int i = 0; i < total; i++) | 98 | for(int i = 0; i < total; i++) |
116 | { | 99 | { |
117 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); | 100 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); |
118 | } | 101 | } |
119 | 102 | ||
@@ -131,177 +114,203 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
131 | break; | 114 | break; |
132 | } | 115 | } |
133 | } | 116 | } |
134 | } | 117 | } |
135 | QPEApplication::showWidget( this ); | 118 | QPEApplication::showWidget( this ); |
136 | } | 119 | } |
137 | 120 | ||
138 | BackupAndRestore::~BackupAndRestore() | 121 | BackupAndRestore::~BackupAndRestore() |
139 | { | 122 | { |
140 | QList<QListViewItem> list; | 123 | QList<QListViewItem> list; |
141 | getAllItems(backupList->firstChild(), list); | 124 | getAllItems(backupList->firstChild(), list); |
142 | 125 | ||
143 | Config config("BackupAndRestore"); | 126 | Config config("BackupAndRestore"); |
144 | config.setGroup("DontBackup"); | 127 | config.setGroup("DontBackup"); |
145 | config.clearGroup(); | 128 | config.clearGroup(); |
146 | 129 | ||
147 | int count = 0; | 130 | int count = 0; |
148 | for(uint i = 0; i < list.count(); i++) | 131 | for(uint i = 0; i < list.count(); i++) |
149 | { | 132 | { |
150 | if(list.at(i)->text(HEADER_BACKUP) == "") | 133 | if(list.at(i)->text(HEADER_BACKUP) == "") |
151 | { | 134 | { |
152 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); | 135 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); |
153 | count++; | 136 | count++; |
154 | } | 137 | } |
155 | } | 138 | } |
156 | config.writeEntry("Total", count); | 139 | config.writeEntry("Total", count); |
157 | 140 | ||
158 | // Remove Temp File | 141 | // Remove Temp File |
159 | if ( QFile::exists( tempFileName ) ) | 142 | if ( QFile::exists( tempFileName ) ) |
160 | QFile::remove( tempFileName ); | 143 | QFile::remove( tempFileName ); |
161 | } | 144 | } |
162 | 145 | ||
146 | void BackupAndRestore::refreshBackupLocations() | ||
147 | { | ||
148 | backupLocations.clear(); | ||
149 | // Add cards | ||
150 | Opie::Core::OStorageInfo storage; | ||
151 | backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); | ||
152 | if ( storage.hasCf() ) | ||
153 | { | ||
154 | backupLocations.insert( "CF", storage.cfPath() ); | ||
155 | odebug << "Cf Path: " + storage.cfPath() << oendl; | ||
156 | } | ||
157 | if ( storage.hasSd() ) | ||
158 | { | ||
159 | backupLocations.insert( "SD", storage.sdPath() ); | ||
160 | odebug << " Sd Path: " + storage.sdPath() << oendl; | ||
161 | } | ||
162 | if ( storage.hasMmc() ) | ||
163 | { | ||
164 | backupLocations.insert( "MMC", storage.mmcPath() ); | ||
165 | odebug << "Mmc Path: " + storage.mmcPath() << oendl; | ||
166 | } | ||
167 | |||
168 | // Add own locations from locationList | ||
169 | // todo implementation | ||
170 | } | ||
171 | |||
163 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) | 172 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) |
164 | { | 173 | { |
165 | while(item) | 174 | while(item) |
166 | { | 175 | { |
167 | if(item->childCount() > 0) | 176 | if(item->childCount() > 0) |
168 | getAllItems(item->firstChild(), list); | 177 | getAllItems(item->firstChild(), list); |
169 | list.append(item); | 178 | list.append(item); |
170 | item = item->nextSibling(); | 179 | item = item->nextSibling(); |
171 | } | 180 | } |
172 | return list; | 181 | return list; |
173 | } | 182 | } |
174 | 183 | ||
175 | /** | 184 | /** |
176 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. | 185 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. |
177 | * and changing the icon to match | 186 | * and changing the icon to match |
178 | * @param currentItem the item to swich the selection choice. | 187 | * @param currentItem the item to swich the selection choice. |
179 | */ | 188 | */ |
180 | void BackupAndRestore::selectItem(QListViewItem *currentItem) | 189 | void BackupAndRestore::selectItem(QListViewItem *currentItem) |
181 | { | 190 | { |
182 | if(!currentItem) | 191 | if(!currentItem) |
183 | return; | 192 | return; |
184 | 193 | ||
185 | if(currentItem->text(HEADER_BACKUP) == "B") | 194 | if(currentItem->text(HEADER_BACKUP) == "B") |
186 | { | 195 | { |
187 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); | 196 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); |
188 | currentItem->setText(HEADER_BACKUP, ""); | 197 | currentItem->setText(HEADER_BACKUP, ""); |
189 | } | 198 | } |
190 | else | 199 | else |
191 | { | 200 | { |
192 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); | 201 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); |
193 | currentItem->setText(HEADER_BACKUP, "B"); | 202 | currentItem->setText(HEADER_BACKUP, "B"); |
194 | } | 203 | } |
195 | } | 204 | } |
196 | 205 | ||
197 | void BackupAndRestore::scanForApplicationSettings() | 206 | void BackupAndRestore::scanForApplicationSettings() |
198 | { | 207 | { |
199 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); | 208 | QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); |
200 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); | 209 | d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); |
201 | const QFileInfoList *list = d.entryInfoList(); | 210 | const QFileInfoList *list = d.entryInfoList(); |
202 | QFileInfoListIterator it( *list ); | 211 | QFileInfoListIterator it( *list ); |
203 | QFileInfo *fi; | 212 | QFileInfo *fi; |
204 | while ( (fi=it.current()) ) | 213 | while ( (fi=it.current()) ) |
205 | { | 214 | { |
206 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; | 215 | //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; |
207 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) | 216 | if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) |
208 | { | 217 | { |
209 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 218 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
210 | selectItem(newItem); | 219 | selectItem(newItem); |
211 | } | 220 | } |
212 | ++it; | 221 | ++it; |
213 | } | 222 | } |
214 | } | 223 | } |
215 | 224 | ||
216 | /** | 225 | /** |
217 | * The "Backup" button has been pressed. Get a list of all of the files that | 226 | * The "Backup" button has been pressed. Get a list of all of the files that |
218 | * should be backed up. If there are no files, emit and error and exit. | 227 | * should be backed up. If there are no files, emit and error and exit. |
219 | * Determine the file name to store the backup in. Backup the file(s) using | 228 | * Determine the file name to store the backup in. Backup the file(s) using |
220 | * tar and gzip --best. Report failure or success | 229 | * tar and gzip --best. Report failure or success |
221 | */ | 230 | */ |
222 | void BackupAndRestore::backup() | 231 | void BackupAndRestore::backup() |
223 | { | 232 | { |
224 | QString backupFiles; | 233 | QString backupFiles; |
225 | if(getBackupFiles(backupFiles, NULL) == 0) | 234 | if(getBackupFiles(backupFiles, NULL) == 0) |
226 | { | 235 | { |
227 | QMessageBox::critical(this, "Message", | 236 | QMessageBox::critical(this, "Message", |
228 | "No items selected.",QString("Ok") ); | 237 | "No items selected.",QString("Ok") ); |
229 | return; | 238 | return; |
230 | } | 239 | } |
231 | 240 | ||
232 | setCaption(tr("Backup and Restore... working...")); | 241 | setCaption(tr("Backup and Restore... working...")); |
233 | QString outputFile = backupLocations[storeToLocation->currentText()]; | 242 | QString outputFile = backupLocations[storeToLocation->currentText()]; |
234 | 243 | ||
235 | QDateTime datetime = QDateTime::currentDateTime(); | 244 | QDateTime datetime = QDateTime::currentDateTime(); |
236 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 245 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
237 | QString::number( datetime.date().day() ).rightJustify(2, '0'); | 246 | QString::number( datetime.date().day() ).rightJustify(2, '0'); |
238 | 247 | ||
239 | outputFile += "/" + dateString; | 248 | outputFile += "/" + dateString; |
240 | 249 | ||
241 | QString t = outputFile; | 250 | QString t = outputFile; |
242 | int c = 1; | 251 | int c = 1; |
243 | while(QFile::exists(outputFile + EXTENSION)) | 252 | while(QFile::exists(outputFile + EXTENSION)) |
244 | { | 253 | { |
245 | outputFile = t + QString("%1").arg(c); | 254 | outputFile = t + QString("%1").arg(c); |
246 | c++; | 255 | c++; |
247 | } | 256 | } |
248 | 257 | ||
249 | // We execute tar and compressing its output with gzip.. | 258 | // We execute tar and compressing its output with gzip.. |
250 | // The error output will be written into a temp-file which could be provided | 259 | // The error output will be written into a temp-file which could be provided |
251 | // for debugging.. | 260 | // for debugging.. |
252 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; | 261 | odebug << "Storing file: " << outputFile.latin1() << "" << oendl; |
253 | outputFile += EXTENSION; | 262 | outputFile += EXTENSION; |
254 | 263 | ||
255 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) | 264 | QString commandLine = QString( "cd %1 && (tar -X %1 -cz %2 Applications/backup/exclude -f %3 ) 2> %4" ).arg( QDir::homeDirPath() ) |
256 | .arg( getExcludeFile() ) | 265 | .arg( getExcludeFile() ) |
257 | .arg( backupFiles ) | 266 | .arg( backupFiles ) |
258 | .arg( outputFile.latin1() ) | 267 | .arg( outputFile.latin1() ) |
259 | .arg( tempFileName.latin1() ); | 268 | .arg( tempFileName.latin1() ); |
260 | 269 | ||
261 | odebug << commandLine << oendl; | 270 | odebug << commandLine << oendl; |
262 | 271 | ||
263 | int r = system( commandLine ); | 272 | int r = system( commandLine ); |
264 | 273 | ||
265 | if(r != 0) | 274 | if(r != 0) |
266 | { | 275 | { |
267 | perror("Error: "); | 276 | perror("Error: "); |
268 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 277 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
269 | 278 | ||
270 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" | 279 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" |
271 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) | 280 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) |
272 | { | 281 | { |
273 | 282 | ||
274 | case 1: | 283 | case 1: |
275 | owarn << "Details pressed !" << oendl; | 284 | owarn << "Details pressed !" << oendl; |
276 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 285 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
277 | QFile errorFile( tempFileName ); | 286 | QFile errorFile( tempFileName ); |
278 | if ( errorFile.open(IO_ReadOnly) ) | 287 | if ( errorFile.open(IO_ReadOnly) ) |
279 | { | 288 | { |
280 | QTextStream t( &errorFile ); | 289 | QTextStream t( &errorFile ); |
281 | QString s; | 290 | QString s; |
282 | while ( !t.eof() ) | 291 | while ( !t.eof() ) |
283 | { // until end of file... | 292 | { // until end of file... |
284 | s += t.readLine(); // line of text excluding '\n' | 293 | s += t.readLine(); // line of text excluding '\n' |
285 | } | 294 | } |
286 | errorFile.close(); | 295 | errorFile.close(); |
287 | 296 | ||
288 | pErrDialog->m_textarea->setText( s ); | 297 | pErrDialog->m_textarea->setText( s ); |
289 | } | 298 | } |
290 | else | 299 | else |
291 | { | 300 | { |
292 | pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); | 301 | pErrDialog->m_textarea->setText( "Unable to open File: /tmp/backup.er" ); |
293 | } | 302 | } |
294 | QPEApplication::execDialog( pErrDialog ); | 303 | QPEApplication::execDialog( pErrDialog ); |
295 | delete pErrDialog; | 304 | delete pErrDialog; |
296 | break; | 305 | break; |
297 | } | 306 | } |
298 | setCaption(tr("Backup and Restore.. Failed !!")); | 307 | setCaption(tr("Backup and Restore.. Failed !!")); |
299 | return; | 308 | return; |
300 | } | 309 | } |
301 | else | 310 | else |
302 | { | 311 | { |
303 | QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) ); | 312 | QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) ); |
304 | 313 | ||
305 | } | 314 | } |
306 | 315 | ||
307 | //write store-location | 316 | //write store-location |
@@ -330,199 +339,231 @@ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent | |||
330 | uint count = 0; | 339 | uint count = 0; |
331 | while( currentItem != 0 ) | 340 | while( currentItem != 0 ) |
332 | { | 341 | { |
333 | if(currentItem->text(HEADER_BACKUP) == "B" ) | 342 | if(currentItem->text(HEADER_BACKUP) == "B" ) |
334 | { | 343 | { |
335 | if(currentItem->childCount() == 0 ) | 344 | if(currentItem->childCount() == 0 ) |
336 | { | 345 | { |
337 | if(parent == NULL) | 346 | if(parent == NULL) |
338 | backupFiles += currentItem->text(BACKUP_LOCATION); | 347 | backupFiles += currentItem->text(BACKUP_LOCATION); |
339 | else | 348 | else |
340 | backupFiles += currentHome + currentItem->text(HEADER_NAME); | 349 | backupFiles += currentHome + currentItem->text(HEADER_NAME); |
341 | backupFiles += " "; | 350 | backupFiles += " "; |
342 | count++; | 351 | count++; |
343 | } | 352 | } |
344 | else | 353 | else |
345 | { | 354 | { |
346 | count += getBackupFiles(backupFiles, currentItem); | 355 | count += getBackupFiles(backupFiles, currentItem); |
347 | } | 356 | } |
348 | } | 357 | } |
349 | currentItem = currentItem->nextSibling(); | 358 | currentItem = currentItem->nextSibling(); |
350 | } | 359 | } |
351 | return count; | 360 | return count; |
352 | } | 361 | } |
353 | 362 | ||
354 | void BackupAndRestore::sourceDirChanged(int selection) | 363 | void BackupAndRestore::sourceDirChanged(int selection) |
355 | { | 364 | { |
356 | restoreList->clear(); | 365 | restoreList->clear(); |
357 | rescanFolder(backupLocations[restoreSource->text(selection)]); | 366 | rescanFolder(backupLocations[restoreSource->text(selection)]); |
358 | } | 367 | } |
359 | 368 | ||
360 | void BackupAndRestore::fileListUpdate() | 369 | void BackupAndRestore::fileListUpdate() |
361 | { | 370 | { |
362 | owarn << "void BackupAndRestore::fileListUpdate()" << oendl; | 371 | owarn << "void BackupAndRestore::fileListUpdate()" << oendl; |
363 | restoreList->clear(); | 372 | restoreList->clear(); |
364 | rescanFolder( backupLocations[restoreSource->currentText()] ); | 373 | rescanFolder( backupLocations[restoreSource->currentText()] ); |
365 | } | 374 | } |
366 | 375 | ||
367 | /** | 376 | /** |
368 | * Scans directory for any backup files. Will recursivly go down, | 377 | * Scans directory for any backup files. Will recursivly go down, |
369 | * but will not follow symlinks. | 378 | * but will not follow symlinks. |
370 | * @param directory - the directory to look in. | 379 | * @param directory - the directory to look in. |
371 | */ | 380 | */ |
372 | void BackupAndRestore::rescanFolder(QString directory) | 381 | void BackupAndRestore::rescanFolder(QString directory) |
373 | { | 382 | { |
374 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; | 383 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
375 | QDir d(directory); | 384 | QDir d(directory); |
376 | if(!d.exists()) | 385 | if(!d.exists()) |
377 | return; | 386 | return; |
378 | 387 | ||
379 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | 388 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); |
380 | const QFileInfoList *list = d.entryInfoList(); | 389 | const QFileInfoList *list = d.entryInfoList(); |
381 | QFileInfoListIterator it( *list ); | 390 | QFileInfoListIterator it( *list ); |
382 | QFileInfo *file; | 391 | QFileInfo *file; |
383 | while ( (file=it.current()) ) | 392 | while ( (file=it.current()) ) |
384 | { // for each file... | 393 | { // for each file... |
385 | // If it is a dir and not .. or . then add it as a tab and go down. | 394 | // If it is a dir and not .. or . then add it as a tab and go down. |
386 | if(file->isDir()) | 395 | if(file->isDir()) |
387 | { | 396 | { |
388 | if(file->fileName() != ".." && file->fileName() != ".") | 397 | if(file->fileName() != ".." && file->fileName() != ".") |
389 | { | 398 | { |
390 | rescanFolder(directory + "/" + file->fileName()); | 399 | rescanFolder(directory + "/" + file->fileName()); |
391 | } | 400 | } |
392 | } | 401 | } |
393 | else | 402 | else |
394 | { | 403 | { |
395 | // If it is a backup file add to list. | 404 | // If it is a backup file add to list. |
396 | if(file->fileName().contains(EXTENSION)) | 405 | if(file->fileName().contains(EXTENSION)) |
397 | (void)new QListViewItem(restoreList, file->fileName()); | 406 | (void)new QListViewItem(restoreList, file->fileName()); |
398 | } | 407 | } |
399 | ++it; | 408 | ++it; |
400 | } | 409 | } |
401 | } | 410 | } |
402 | 411 | ||
403 | /** | 412 | /** |
404 | * Restore a backup file. | 413 | * Restore a backup file. |
405 | * Report errors or success | 414 | * Report errors or success |
406 | */ | 415 | */ |
407 | void BackupAndRestore::restore() | 416 | void BackupAndRestore::restore() |
408 | { | 417 | { |
409 | QListViewItem *restoreItem = restoreList->currentItem(); | 418 | QListViewItem *restoreItem = restoreList->currentItem(); |
410 | if(!restoreItem) | 419 | if(!restoreItem) |
411 | { | 420 | { |
412 | QMessageBox::critical(this, tr( "Message" ), | 421 | QMessageBox::critical(this, tr( "Message" ), |
413 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); | 422 | tr( "Please select something to restore." ),QString( tr( "Ok") ) ); |
414 | return; | 423 | return; |
415 | } | 424 | } |
416 | setCaption(tr("Backup and Restore... working...")); | 425 | setCaption(tr("Backup and Restore... working...")); |
417 | 426 | ||
418 | QString restoreFile = backupLocations[restoreSource->currentText()]; | 427 | QString restoreFile = backupLocations[restoreSource->currentText()]; |
419 | 428 | ||
420 | restoreFile += "/" + restoreItem->text(0); | 429 | restoreFile += "/" + restoreItem->text(0); |
421 | 430 | ||
422 | odebug << restoreFile << oendl; | 431 | odebug << restoreFile << oendl; |
423 | 432 | ||
424 | //check if backup file come from opie 1.0.x | 433 | //check if backup file come from opie 1.0.x |
425 | 434 | ||
426 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); | 435 | QString commandLine = QString( "tar -tzf %1 | grep Applications/backup/exclude" ).arg( restoreFile.latin1() ); |
427 | 436 | ||
428 | int r = system( commandLine ); | 437 | int r = system( commandLine ); |
429 | 438 | ||
430 | QString startDir; | 439 | QString startDir; |
431 | 440 | ||
432 | if( r != 0 ) //Applications/backup/exclude not found - old backup file | 441 | if( r != 0 ) //Applications/backup/exclude not found - old backup file |
433 | { | 442 | { |
434 | startDir = QString( "/" ); | 443 | startDir = QString( "/" ); |
435 | } else | 444 | } else |
436 | { | 445 | { |
437 | startDir = QDir::homeDirPath(); | 446 | startDir = QDir::homeDirPath(); |
438 | } | 447 | } |
439 | 448 | ||
440 | //unpack backup file | 449 | //unpack backup file |
441 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) | 450 | commandLine = QString( "cd %1 && tar -zxf %2 2> %3" ).arg( startDir ) |
442 | .arg( restoreFile.latin1() ) | 451 | .arg( restoreFile.latin1() ) |
443 | .arg( tempFileName.latin1() ); | 452 | .arg( tempFileName.latin1() ); |
444 | 453 | ||
445 | odebug << commandLine << oendl; | 454 | odebug << commandLine << oendl; |
446 | 455 | ||
447 | r = system( commandLine ); | 456 | r = system( commandLine ); |
448 | 457 | ||
449 | //error handling | 458 | //error handling |
450 | if(r != 0) | 459 | if(r != 0) |
451 | { | 460 | { |
452 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 461 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
453 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" | 462 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" |
454 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) | 463 | + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) |
455 | { | 464 | { |
456 | case 1: | 465 | case 1: |
457 | owarn << "Details pressed !" << oendl; | 466 | owarn << "Details pressed !" << oendl; |
458 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 467 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
459 | QFile errorFile( tempFileName ); | 468 | QFile errorFile( tempFileName ); |
460 | if ( errorFile.open(IO_ReadOnly) ) | 469 | if ( errorFile.open(IO_ReadOnly) ) |
461 | { | 470 | { |
462 | QTextStream t( &errorFile ); | 471 | QTextStream t( &errorFile ); |
463 | QString s; | 472 | QString s; |
464 | while ( !t.eof() ) | 473 | while ( !t.eof() ) |
465 | { // until end of file... | 474 | { // until end of file... |
466 | s += t.readLine(); // line of text excluding '\n' | 475 | s += t.readLine(); // line of text excluding '\n' |
467 | } | 476 | } |
468 | errorFile.close(); | 477 | errorFile.close(); |
469 | 478 | ||
470 | pErrDialog->m_textarea->setText( s ); | 479 | pErrDialog->m_textarea->setText( s ); |
471 | } | 480 | } |
472 | else | 481 | else |
473 | { | 482 | { |
474 | pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) ); | 483 | pErrDialog->m_textarea->setText( tr( "Unable to open File: %1" ).arg( "/tmp/backup.er" ) ); |
475 | } | 484 | } |
476 | QPEApplication::execDialog( pErrDialog ); | 485 | QPEApplication::execDialog( pErrDialog ); |
477 | delete pErrDialog; | 486 | delete pErrDialog; |
478 | 487 | ||
479 | setCaption(tr("Backup and Restore.. Failed !!")); | 488 | setCaption(tr("Backup and Restore.. Failed !!")); |
480 | return; | 489 | return; |
481 | 490 | ||
482 | break; | 491 | break; |
483 | 492 | ||
484 | } | 493 | } |
485 | } | 494 | } |
486 | else | 495 | else |
487 | { | 496 | { |
488 | QMessageBox::information(this, tr( "Message" ), tr( "Restore Successful." ), QString( tr( "Ok") ) ); | 497 | QMessageBox::information(this, tr( "Message" ), tr( "Restore Successful." ), QString( tr( "Ok") ) ); |
489 | } | 498 | } |
490 | 499 | ||
491 | //write restore-location | 500 | //write restore-location |
492 | Config config( "BackupAndRestore" ); | 501 | Config config( "BackupAndRestore" ); |
493 | config.setGroup( "LastLocation" ); | 502 | config.setGroup( "LastLocation" ); |
494 | config.writeEntry( "LastRestoreLocation", restoreSource->currentText() ); | 503 | config.writeEntry( "LastRestoreLocation", restoreSource->currentText() ); |
495 | 504 | ||
496 | setCaption(tr("Backup and Restore")); | 505 | setCaption(tr("Backup and Restore")); |
497 | } | 506 | } |
498 | 507 | ||
499 | /** | 508 | /** |
500 | * Check for exclude in Applications/backup | 509 | * Check for exclude in Applications/backup |
501 | * If it does not exist, the function will create the file with *.bck as content | 510 | * If it does not exist, the function will create the file with *.bck as content |
502 | * The exclude_files is read by tar and will provide to exclude special files out from backup. | 511 | * The exclude_files is read by tar and will provide to exclude special files out from backup. |
503 | * e.g. alle *.bck files (backup-files) will not be backed up by default | 512 | * e.g. alle *.bck files (backup-files) will not be backed up by default |
504 | */ | 513 | */ |
505 | 514 | ||
506 | QString BackupAndRestore::getExcludeFile() | 515 | QString BackupAndRestore::getExcludeFile() |
507 | { | 516 | { |
508 | QString excludeFileName = Global::applicationFileName( "backup", "exclude" ); | 517 | QString excludeFileName = Global::applicationFileName( "backup", "exclude" ); |
509 | if ( !QFile::exists( excludeFileName ) ) | 518 | if ( !QFile::exists( excludeFileName ) ) |
510 | { | 519 | { |
511 | QFile excludeFile( excludeFileName); | 520 | QFile excludeFile( excludeFileName); |
512 | if ( excludeFile.open( IO_WriteOnly ) == true ) | 521 | if ( excludeFile.open( IO_WriteOnly ) == true ) |
513 | { | 522 | { |
514 | QTextStream writeStream( &excludeFile ); | 523 | QTextStream writeStream( &excludeFile ); |
515 | writeStream << "*.bck" << "\n"; | 524 | writeStream << "*.bck" << "\n"; |
516 | excludeFile.close(); | 525 | excludeFile.close(); |
517 | } | 526 | } |
518 | else | 527 | else |
519 | { | 528 | { |
520 | return QString::null; | 529 | return QString::null; |
521 | } | 530 | } |
522 | } | 531 | } |
523 | 532 | ||
524 | return excludeFileName; | 533 | return excludeFileName; |
525 | } | 534 | } |
526 | 535 | ||
536 | void BackupAndRestore::refreshLocations() | ||
537 | { | ||
538 | locationList->clear(); | ||
539 | //todo: implement add locations | ||
540 | odebug << "not implemented yet" << oendl; | ||
541 | } | ||
542 | |||
543 | void BackupAndRestore::addLocation() | ||
544 | { | ||
545 | if ( ( !locationEdit->text().isEmpty() ) && | ||
546 | ( QDir( locationEdit->text() ).exists() ) ) | ||
547 | { | ||
548 | (void) new QListViewItem( locationList, locationEdit->text() ); | ||
549 | locationEdit->setText( "" ); | ||
550 | } | ||
551 | } | ||
552 | |||
553 | void BackupAndRestore::removeLocation() | ||
554 | { | ||
555 | if ( locationList->selectedItem() ) | ||
556 | { | ||
557 | delete( locationList->selectedItem() ); | ||
558 | } | ||
559 | } | ||
560 | |||
561 | void BackupAndRestore::saveLocation() | ||
562 | { | ||
563 | //todo: implement | ||
564 | odebug << "not implemented yet" << oendl; | ||
565 | } | ||
566 | |||
567 | |||
527 | // backuprestore.cpp | 568 | // backuprestore.cpp |
528 | 569 | ||
diff --git a/noncore/settings/backup/backuprestore.h b/noncore/settings/backup/backuprestore.h index 0d88f8d..527b3cf 100644 --- a/noncore/settings/backup/backuprestore.h +++ b/noncore/settings/backup/backuprestore.h | |||
@@ -1,47 +1,53 @@ | |||
1 | #ifndef WINDOW_H | 1 | #ifndef WINDOW_H |
2 | #define WINDOW_H | 2 | #define WINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include "backuprestorebase.h" | 5 | #include "backuprestorebase.h" |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qlist.h> | 7 | #include <qlist.h> |
8 | 8 | ||
9 | class QListViewItem; | 9 | class QListViewItem; |
10 | 10 | ||
11 | class BackupAndRestore : public BackupAndRestoreBase | 11 | class BackupAndRestore : public BackupAndRestoreBase |
12 | { | 12 | { |
13 | 13 | ||
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | 17 | ||
18 | BackupAndRestore( QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 18 | BackupAndRestore( QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
19 | ~BackupAndRestore(); | 19 | ~BackupAndRestore(); |
20 | 20 | ||
21 | static QString appName() { return QString::fromLatin1("backup"); } | 21 | static QString appName() { return QString::fromLatin1("backup"); } |
22 | 22 | ||
23 | private slots: | 23 | private slots: |
24 | void backup(); | 24 | void backup(); |
25 | void restore(); | 25 | void restore(); |
26 | void selectItem(QListViewItem *currentItem); | 26 | void selectItem(QListViewItem *currentItem); |
27 | void sourceDirChanged(int); | 27 | void sourceDirChanged(int); |
28 | void rescanFolder(QString directory); | 28 | void rescanFolder(QString directory); |
29 | void fileListUpdate(); | 29 | void fileListUpdate(); |
30 | 30 | ||
31 | void addLocation(); | ||
32 | void removeLocation(); | ||
33 | void saveLocation(); | ||
34 | |||
31 | private: | 35 | private: |
32 | void scanForApplicationSettings(); | 36 | void scanForApplicationSettings(); |
33 | int getBackupFiles(QString &backupFiles, QListViewItem *parent); | 37 | int getBackupFiles(QString &backupFiles, QListViewItem *parent); |
34 | QString getExcludeFile(); | 38 | QString getExcludeFile(); |
35 | QMap<QString, QString> backupLocations; | 39 | QMap<QString, QString> backupLocations; |
36 | QList<QListViewItem> getAllItems(QListViewItem *item, QList<QListViewItem> &list); | 40 | QList<QListViewItem> getAllItems(QListViewItem *item, QList<QListViewItem> &list); |
41 | void refreshBackupLocations(); | ||
42 | void refreshLocations(); | ||
37 | 43 | ||
38 | QListViewItem *systemSettings; | 44 | QListViewItem *systemSettings; |
39 | QListViewItem *applicationSettings; | 45 | QListViewItem *applicationSettings; |
40 | QListViewItem *documents; | 46 | QListViewItem *documents; |
41 | 47 | ||
42 | }; | 48 | }; |
43 | 49 | ||
44 | #endif | 50 | #endif |
45 | 51 | ||
46 | // backuprestore.h | 52 | // backuprestore.h |
47 | 53 | ||
diff --git a/noncore/settings/backup/backuprestorebase.ui b/noncore/settings/backup/backuprestorebase.ui index a52b42d..b4624bb 100644 --- a/noncore/settings/backup/backuprestorebase.ui +++ b/noncore/settings/backup/backuprestorebase.ui | |||
@@ -1,92 +1,98 @@ | |||
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>231</width> | 14 | <width>290</width> |
15 | <height>275</height> | 15 | <height>243</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> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
25 | <vbox> | 28 | <vbox> |
26 | <property stdset="1"> | 29 | <property stdset="1"> |
27 | <name>margin</name> | 30 | <name>margin</name> |
28 | <number>0</number> | 31 | <number>0</number> |
29 | </property> | 32 | </property> |
30 | <property stdset="1"> | 33 | <property stdset="1"> |
31 | <name>spacing</name> | 34 | <name>spacing</name> |
32 | <number>6</number> | 35 | <number>0</number> |
33 | </property> | 36 | </property> |
34 | <widget> | 37 | <widget> |
35 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
36 | <property stdset="1"> | 39 | <property stdset="1"> |
37 | <name>name</name> | 40 | <name>name</name> |
38 | <cstring>tabWidget</cstring> | 41 | <cstring>tabWidget</cstring> |
39 | </property> | 42 | </property> |
40 | <property> | 43 | <property> |
41 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
42 | </property> | 45 | </property> |
46 | <property> | ||
47 | <name>layoutSpacing</name> | ||
48 | </property> | ||
43 | <widget> | 49 | <widget> |
44 | <class>QWidget</class> | 50 | <class>QWidget</class> |
45 | <property stdset="1"> | 51 | <property stdset="1"> |
46 | <name>name</name> | 52 | <name>name</name> |
47 | <cstring>Widget2</cstring> | 53 | <cstring>Widget2</cstring> |
48 | </property> | 54 | </property> |
49 | <attribute> | 55 | <attribute> |
50 | <name>title</name> | 56 | <name>title</name> |
51 | <string>Backup</string> | 57 | <string>Backup</string> |
52 | </attribute> | 58 | </attribute> |
53 | <grid> | 59 | <grid> |
54 | <property stdset="1"> | 60 | <property stdset="1"> |
55 | <name>margin</name> | 61 | <name>margin</name> |
56 | <number>11</number> | 62 | <number>4</number> |
57 | </property> | 63 | </property> |
58 | <property stdset="1"> | 64 | <property stdset="1"> |
59 | <name>spacing</name> | 65 | <name>spacing</name> |
60 | <number>6</number> | 66 | <number>4</number> |
61 | </property> | 67 | </property> |
62 | <widget row="0" column="0" > | 68 | <widget row="0" column="0" > |
63 | <class>QLabel</class> | 69 | <class>QLabel</class> |
64 | <property stdset="1"> | 70 | <property stdset="1"> |
65 | <name>name</name> | 71 | <name>name</name> |
66 | <cstring>TextLabel1</cstring> | 72 | <cstring>TextLabel1</cstring> |
67 | </property> | 73 | </property> |
68 | <property stdset="1"> | 74 | <property stdset="1"> |
69 | <name>text</name> | 75 | <name>text</name> |
70 | <string>Save To</string> | 76 | <string>Save To</string> |
71 | </property> | 77 | </property> |
72 | </widget> | 78 | </widget> |
73 | <widget row="0" column="1" > | 79 | <widget row="0" column="1" > |
74 | <class>QComboBox</class> | 80 | <class>QComboBox</class> |
75 | <property stdset="1"> | 81 | <property stdset="1"> |
76 | <name>name</name> | 82 | <name>name</name> |
77 | <cstring>storeToLocation</cstring> | 83 | <cstring>storeToLocation</cstring> |
78 | </property> | 84 | </property> |
79 | </widget> | 85 | </widget> |
80 | <widget row="2" column="0" rowspan="1" colspan="2" > | 86 | <widget row="2" column="0" rowspan="1" colspan="2" > |
81 | <class>QPushButton</class> | 87 | <class>QPushButton</class> |
82 | <property stdset="1"> | 88 | <property stdset="1"> |
83 | <name>name</name> | 89 | <name>name</name> |
84 | <cstring>backupButton</cstring> | 90 | <cstring>backupButton</cstring> |
85 | </property> | 91 | </property> |
86 | <property stdset="1"> | 92 | <property stdset="1"> |
87 | <name>text</name> | 93 | <name>text</name> |
88 | <string>&Backup</string> | 94 | <string>&Backup</string> |
89 | </property> | 95 | </property> |
90 | </widget> | 96 | </widget> |
91 | <widget row="1" column="0" rowspan="1" colspan="2" > | 97 | <widget row="1" column="0" rowspan="1" colspan="2" > |
92 | <class>QListView</class> | 98 | <class>QListView</class> |
@@ -103,112 +109,201 @@ | |||
103 | <name>resizeable</name> | 109 | <name>resizeable</name> |
104 | <bool>true</bool> | 110 | <bool>true</bool> |
105 | </property> | 111 | </property> |
106 | </column> | 112 | </column> |
107 | <property stdset="1"> | 113 | <property stdset="1"> |
108 | <name>name</name> | 114 | <name>name</name> |
109 | <cstring>backupList</cstring> | 115 | <cstring>backupList</cstring> |
110 | </property> | 116 | </property> |
111 | <property stdset="1"> | 117 | <property stdset="1"> |
112 | <name>allColumnsShowFocus</name> | 118 | <name>allColumnsShowFocus</name> |
113 | <bool>true</bool> | 119 | <bool>true</bool> |
114 | </property> | 120 | </property> |
115 | <property stdset="1"> | 121 | <property stdset="1"> |
116 | <name>rootIsDecorated</name> | 122 | <name>rootIsDecorated</name> |
117 | <bool>true</bool> | 123 | <bool>true</bool> |
118 | </property> | 124 | </property> |
119 | </widget> | 125 | </widget> |
120 | </grid> | 126 | </grid> |
121 | </widget> | 127 | </widget> |
122 | <widget> | 128 | <widget> |
123 | <class>QWidget</class> | 129 | <class>QWidget</class> |
124 | <property stdset="1"> | 130 | <property stdset="1"> |
125 | <name>name</name> | 131 | <name>name</name> |
126 | <cstring>Widget3</cstring> | 132 | <cstring>Widget3</cstring> |
127 | </property> | 133 | </property> |
128 | <attribute> | 134 | <attribute> |
129 | <name>title</name> | 135 | <name>title</name> |
130 | <string>Restore</string> | 136 | <string>Restore</string> |
131 | </attribute> | 137 | </attribute> |
132 | <grid> | 138 | <grid> |
133 | <property stdset="1"> | 139 | <property stdset="1"> |
134 | <name>margin</name> | 140 | <name>margin</name> |
135 | <number>11</number> | 141 | <number>4</number> |
136 | </property> | 142 | </property> |
137 | <property stdset="1"> | 143 | <property stdset="1"> |
138 | <name>spacing</name> | 144 | <name>spacing</name> |
139 | <number>6</number> | 145 | <number>4</number> |
140 | </property> | 146 | </property> |
141 | <widget row="0" column="1" > | 147 | <widget row="0" column="1" > |
142 | <class>QComboBox</class> | 148 | <class>QComboBox</class> |
143 | <property stdset="1"> | 149 | <property stdset="1"> |
144 | <name>name</name> | 150 | <name>name</name> |
145 | <cstring>restoreSource</cstring> | 151 | <cstring>restoreSource</cstring> |
146 | </property> | 152 | </property> |
147 | </widget> | 153 | </widget> |
148 | <widget row="2" column="0" rowspan="1" colspan="2" > | 154 | <widget row="2" column="0" rowspan="1" colspan="2" > |
155 | <class>QPushButton</class> | ||
156 | <property stdset="1"> | ||
157 | <name>name</name> | ||
158 | <cstring>restoreButton</cstring> | ||
159 | </property> | ||
160 | <property stdset="1"> | ||
161 | <name>text</name> | ||
162 | <string>&Restore</string> | ||
163 | </property> | ||
164 | </widget> | ||
165 | <widget row="0" column="0" > | ||
166 | <class>QLabel</class> | ||
167 | <property stdset="1"> | ||
168 | <name>name</name> | ||
169 | <cstring>TextLabel1_2</cstring> | ||
170 | </property> | ||
171 | <property stdset="1"> | ||
172 | <name>text</name> | ||
173 | <string>Select Source</string> | ||
174 | </property> | ||
175 | </widget> | ||
176 | <widget row="1" column="0" rowspan="1" colspan="2" > | ||
149 | <class>QListView</class> | 177 | <class>QListView</class> |
150 | <column> | 178 | <column> |
151 | <property> | 179 | <property> |
152 | <name>text</name> | 180 | <name>text</name> |
153 | <string>Column 1</string> | 181 | <string>Column 1</string> |
154 | </property> | 182 | </property> |
155 | <property> | 183 | <property> |
156 | <name>clickable</name> | 184 | <name>clickable</name> |
157 | <bool>true</bool> | 185 | <bool>true</bool> |
158 | </property> | 186 | </property> |
159 | <property> | 187 | <property> |
160 | <name>resizeable</name> | 188 | <name>resizeable</name> |
161 | <bool>true</bool> | 189 | <bool>true</bool> |
162 | </property> | 190 | </property> |
163 | </column> | 191 | </column> |
164 | <property stdset="1"> | 192 | <property stdset="1"> |
165 | <name>name</name> | 193 | <name>name</name> |
166 | <cstring>restoreList</cstring> | 194 | <cstring>restoreList</cstring> |
167 | </property> | 195 | </property> |
168 | <property stdset="1"> | 196 | <property stdset="1"> |
169 | <name>minimumSize</name> | 197 | <name>minimumSize</name> |
170 | <size> | 198 | <size> |
171 | <width>0</width> | 199 | <width>0</width> |
172 | <height>100</height> | 200 | <height>100</height> |
173 | </size> | 201 | </size> |
174 | </property> | 202 | </property> |
175 | </widget> | 203 | </widget> |
176 | <widget row="3" column="0" rowspan="1" colspan="2" > | 204 | </grid> |
205 | </widget> | ||
206 | <widget> | ||
207 | <class>QWidget</class> | ||
208 | <property stdset="1"> | ||
209 | <name>name</name> | ||
210 | <cstring>tab</cstring> | ||
211 | </property> | ||
212 | <attribute> | ||
213 | <name>title</name> | ||
214 | <string>Locations</string> | ||
215 | </attribute> | ||
216 | <grid> | ||
217 | <property stdset="1"> | ||
218 | <name>margin</name> | ||
219 | <number>4</number> | ||
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>spacing</name> | ||
223 | <number>4</number> | ||
224 | </property> | ||
225 | <widget row="0" column="0" rowspan="1" colspan="3" > | ||
226 | <class>QLineEdit</class> | ||
227 | <property stdset="1"> | ||
228 | <name>name</name> | ||
229 | <cstring>locationEdit</cstring> | ||
230 | </property> | ||
231 | </widget> | ||
232 | <widget row="0" column="3" > | ||
233 | <class>QToolButton</class> | ||
234 | <property stdset="1"> | ||
235 | <name>name</name> | ||
236 | <cstring>locationSelectBtn</cstring> | ||
237 | </property> | ||
238 | <property stdset="1"> | ||
239 | <name>maximumSize</name> | ||
240 | <size> | ||
241 | <width>20</width> | ||
242 | <height>30</height> | ||
243 | </size> | ||
244 | </property> | ||
245 | <property stdset="1"> | ||
246 | <name>text</name> | ||
247 | <string>...</string> | ||
248 | </property> | ||
249 | </widget> | ||
250 | <widget row="1" column="0" rowspan="1" colspan="4" > | ||
251 | <class>QListView</class> | ||
252 | <column> | ||
253 | <property> | ||
254 | <name>text</name> | ||
255 | <string>Locations</string> | ||
256 | </property> | ||
257 | <property> | ||
258 | <name>clickable</name> | ||
259 | <bool>true</bool> | ||
260 | </property> | ||
261 | <property> | ||
262 | <name>resizeable</name> | ||
263 | <bool>true</bool> | ||
264 | </property> | ||
265 | </column> | ||
266 | <property stdset="1"> | ||
267 | <name>name</name> | ||
268 | <cstring>locationList</cstring> | ||
269 | </property> | ||
270 | </widget> | ||
271 | <widget row="2" column="0" > | ||
177 | <class>QPushButton</class> | 272 | <class>QPushButton</class> |
178 | <property stdset="1"> | 273 | <property stdset="1"> |
179 | <name>name</name> | 274 | <name>name</name> |
180 | <cstring>restoreButton</cstring> | 275 | <cstring>addLocationButton</cstring> |
181 | </property> | 276 | </property> |
182 | <property stdset="1"> | 277 | <property stdset="1"> |
183 | <name>text</name> | 278 | <name>text</name> |
184 | <string>&Restore</string> | 279 | <string>Add</string> |
185 | </property> | 280 | </property> |
186 | </widget> | 281 | </widget> |
187 | <widget row="0" column="0" > | 282 | <widget row="2" column="1" > |
188 | <class>QLabel</class> | 283 | <class>QPushButton</class> |
189 | <property stdset="1"> | 284 | <property stdset="1"> |
190 | <name>name</name> | 285 | <name>name</name> |
191 | <cstring>TextLabel1_2</cstring> | 286 | <cstring>removeLocationButton</cstring> |
192 | </property> | 287 | </property> |
193 | <property stdset="1"> | 288 | <property stdset="1"> |
194 | <name>text</name> | 289 | <name>text</name> |
195 | <string>Select Source</string> | 290 | <string>Remove</string> |
196 | </property> | 291 | </property> |
197 | </widget> | 292 | </widget> |
198 | <widget row="1" column="0" rowspan="1" colspan="2" > | 293 | <widget row="2" column="2" rowspan="1" colspan="2" > |
199 | <class>QPushButton</class> | 294 | <class>QPushButton</class> |
200 | <property stdset="1"> | 295 | <property stdset="1"> |
201 | <name>name</name> | 296 | <name>name</name> |
202 | <cstring>updateList</cstring> | 297 | <cstring>saveLocationsButton</cstring> |
203 | </property> | 298 | </property> |
204 | <property stdset="1"> | 299 | <property stdset="1"> |
205 | <name>text</name> | 300 | <name>text</name> |
206 | <string>Update Filelist</string> | 301 | <string>Save</string> |
207 | </property> | 302 | </property> |
208 | </widget> | 303 | </widget> |
209 | </grid> | 304 | </grid> |
210 | </widget> | 305 | </widget> |
211 | </widget> | 306 | </widget> |
212 | </vbox> | 307 | </vbox> |
213 | </widget> | 308 | </widget> |
214 | </UI> | 309 | </UI> |