author | llornkcor <llornkcor> | 2002-11-14 13:33:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-14 13:33:20 (UTC) |
commit | b65957131fd1e12079aafe78abff9ad31356da72 (patch) (unidiff) | |
tree | b02895370efa055d9a830229a2adb557beb633a5 | |
parent | d7d53215cef9420872a4e0f42b547b4148ca33a9 (diff) | |
download | opie-b65957131fd1e12079aafe78abff9ad31356da72.zip opie-b65957131fd1e12079aafe78abff9ad31356da72.tar.gz opie-b65957131fd1e12079aafe78abff9ad31356da72.tar.bz2 |
caption
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 02998f0..618ce24 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -1,288 +1,311 @@ | |||
1 | |||
1 | #include "backuprestore.h" | 2 | #include "backuprestore.h" |
3 | #include "output.h" | ||
4 | |||
5 | #include <qapplication.h> | ||
6 | #include <qmultilineedit.h> | ||
7 | |||
2 | #include <qdir.h> | 8 | #include <qdir.h> |
3 | #include <qfile.h> | 9 | #include <qfile.h> |
4 | #include <qfileinfo.h> | 10 | #include <qfileinfo.h> |
5 | #include <qlistview.h> | 11 | #include <qlistview.h> |
6 | #include <qpushbutton.h> | 12 | #include <qpushbutton.h> |
7 | #include <qheader.h> | 13 | #include <qheader.h> |
8 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
10 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
11 | #include <qcombobox.h> | 17 | #include <qcombobox.h> |
12 | #include <qlist.h> | 18 | #include <qlist.h> |
13 | #include <stdlib.h> | 19 | #include <stdlib.h> |
14 | #include <qregexp.h> | 20 | #include <qregexp.h> |
15 | 21 | ||
22 | #include <errno.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <unistd.h> | ||
25 | #include <sys/stat.h> | ||
26 | #include <dirent.h> | ||
27 | |||
16 | #define HEADER_NAME 0 | 28 | #define HEADER_NAME 0 |
17 | #define HEADER_BACKUP 1 | 29 | #define HEADER_BACKUP 1 |
18 | #define BACKUP_LOCATION 2 | 30 | #define BACKUP_LOCATION 2 |
19 | 31 | ||
20 | #define EXTENSION ".bck" | 32 | #define EXTENSION ".bck" |
21 | 33 | ||
22 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) | 34 | BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) |
23 | : BackupAndRestoreBase(parent, name){ | 35 | : BackupAndRestoreBase(parent, name){ |
24 | this->showMaximized(); | 36 | this->showMaximized(); |
25 | backupList->header()->hide(); | 37 | backupList->header()->hide(); |
26 | restoreList->header()->hide(); | 38 | restoreList->header()->hide(); |
27 | connect(backupButton, SIGNAL(clicked()), | 39 | connect(backupButton, SIGNAL(clicked()), |
28 | this, SLOT(backupPressed())); | 40 | this, SLOT(backupPressed())); |
29 | connect(restoreButton, SIGNAL(clicked()), | 41 | connect(restoreButton, SIGNAL(clicked()), |
30 | this, SLOT(restore())); | 42 | this, SLOT(restore())); |
31 | connect(backupList, SIGNAL(clicked( QListViewItem * )), | 43 | connect(backupList, SIGNAL(clicked( QListViewItem * )), |
32 | this, SLOT(selectItem(QListViewItem*))); | 44 | this, SLOT(selectItem(QListViewItem*))); |
33 | connect(restoreSource, SIGNAL(activated( int )), | 45 | connect(restoreSource, SIGNAL(activated( int )), |
34 | this, SLOT(sourceDirChanged(int))); | 46 | this, SLOT(sourceDirChanged(int))); |
35 | 47 | ||
36 | systemSettings = new QListViewItem(backupList, "System Settings", "", | 48 | systemSettings = new QListViewItem(backupList, "System Settings", "", |
37 | "/etc"); | 49 | "/etc"); |
38 | // selectItem(systemSettings); | 50 | // selectItem(systemSettings); |
39 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", | 51 | applicationSettings = new QListViewItem(backupList, "Application Settings", "", |
40 | QDir::homeDirPath() + "/Settings/"); | 52 | QDir::homeDirPath() + "/Settings/"); |
41 | selectItem(applicationSettings); | 53 | selectItem(applicationSettings); |
42 | documents= new QListViewItem(backupList, "Documents", "", | 54 | documents= new QListViewItem(backupList, "Documents", "", |
43 | QDir::homeDirPath() + "/Documents/"); | 55 | QDir::homeDirPath() + "/Documents/"); |
44 | // selectItem(documents); | 56 | // selectItem(documents); |
45 | 57 | ||
46 | scanForApplicationSettings(); | 58 | scanForApplicationSettings(); |
47 | 59 | ||
48 | Config config("BackupAndRestore"); | 60 | Config config("BackupAndRestore"); |
49 | config.setGroup("General"); | 61 | config.setGroup("General"); |
50 | int totalLocations = config.readNumEntry("totalLocations",0); | 62 | int totalLocations = config.readNumEntry("totalLocations",0); |
51 | 63 | ||
52 | //todo make less static here and use Storage class to get infos | 64 | //todo make less static here and use Storage class to get infos |
53 | if(totalLocations == 0){ | 65 | if(totalLocations == 0){ |
54 | backupLocations.insert("Documents", "/root/Documents"); | 66 | backupLocations.insert("Documents", "/root/Documents"); |
55 | backupLocations.insert("CF", "/mnt/cf"); | 67 | backupLocations.insert("CF", "/mnt/cf"); |
56 | backupLocations.insert("SD", "/mnt/card"); | 68 | backupLocations.insert("SD", "/mnt/card"); |
57 | } | 69 | } |
58 | else{ | 70 | else{ |
59 | for(int i = 0; i < totalLocations; i++){ | 71 | for(int i = 0; i < totalLocations; i++){ |
60 | backupLocations.insert(config.readEntry(QString("backupLocationName_%1").arg(i)), | 72 | backupLocations.insert(config.readEntry(QString("backupLocationName_%1").arg(i)), |
61 | config.readEntry(QString("backupLocation_%1").arg(i))); | 73 | config.readEntry(QString("backupLocation_%1").arg(i))); |
62 | } | 74 | } |
63 | } | 75 | } |
64 | QMap<QString, QString>::Iterator it; | 76 | QMap<QString, QString>::Iterator it; |
65 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ){ | 77 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ){ |
66 | storeToLocation->insertItem(it.key()); | 78 | storeToLocation->insertItem(it.key()); |
67 | restoreSource->insertItem(it.key()); | 79 | restoreSource->insertItem(it.key()); |
68 | } | 80 | } |
69 | 81 | ||
70 | // Read the list of items to ignore. | 82 | // Read the list of items to ignore. |
71 | QList<QString> dontBackupList; | 83 | QList<QString> dontBackupList; |
72 | dontBackupList.setAutoDelete(true); | 84 | dontBackupList.setAutoDelete(true); |
73 | config.setGroup("DontBackup"); | 85 | config.setGroup("DontBackup"); |
74 | int total = config.readNumEntry("Total", 0); | 86 | int total = config.readNumEntry("Total", 0); |
75 | for(int i = 0; i < total; i++){ | 87 | for(int i = 0; i < total; i++){ |
76 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); | 88 | dontBackupList.append(new QString(config.readEntry(QString("%1").arg(i), ""))); |
77 | } | 89 | } |
78 | 90 | ||
79 | QList<QListViewItem> list; | 91 | QList<QListViewItem> list; |
80 | getAllItems(backupList->firstChild(), list); | 92 | getAllItems(backupList->firstChild(), list); |
81 | 93 | ||
82 | for(uint i = 0; i < list.count(); i++){ | 94 | for(uint i = 0; i < list.count(); i++){ |
83 | QString text = list.at(i)->text(HEADER_NAME); | 95 | QString text = list.at(i)->text(HEADER_NAME); |
84 | for(uint i2 = 0; i2 < dontBackupList.count(); i2++){ | 96 | for(uint i2 = 0; i2 < dontBackupList.count(); i2++){ |
85 | if(*dontBackupList.at(i2) == text){ | 97 | if(*dontBackupList.at(i2) == text){ |
86 | selectItem(list.at(i)); | 98 | selectItem(list.at(i)); |
87 | break; | 99 | break; |
88 | } | 100 | } |
89 | } | 101 | } |
90 | } | 102 | } |
91 | } | 103 | } |
92 | 104 | ||
93 | BackupAndRestore::~BackupAndRestore(){ | 105 | BackupAndRestore::~BackupAndRestore(){ |
94 | QList<QListViewItem> list; | 106 | QList<QListViewItem> list; |
95 | getAllItems(backupList->firstChild(), list); | 107 | getAllItems(backupList->firstChild(), list); |
96 | 108 | ||
97 | Config config("BackupAndRestore"); | 109 | Config config("BackupAndRestore"); |
98 | config.setGroup("DontBackup"); | 110 | config.setGroup("DontBackup"); |
99 | config.clearGroup(); | 111 | config.clearGroup(); |
100 | 112 | ||
101 | int count = 0; | 113 | int count = 0; |
102 | for(uint i = 0; i < list.count(); i++){ | 114 | for(uint i = 0; i < list.count(); i++){ |
103 | if(list.at(i)->text(HEADER_BACKUP) == ""){ | 115 | if(list.at(i)->text(HEADER_BACKUP) == ""){ |
104 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); | 116 | config.writeEntry(QString("%1").arg(count), list.at(i)->text(HEADER_NAME)); |
105 | count++; | 117 | count++; |
106 | } | 118 | } |
107 | } | 119 | } |
108 | config.writeEntry("Total", count); | 120 | config.writeEntry("Total", count); |
109 | } | 121 | } |
110 | 122 | ||
111 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list){ | 123 | QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list){ |
112 | while(item){ | 124 | while(item){ |
113 | if(item->childCount() > 0) | 125 | if(item->childCount() > 0) |
114 | getAllItems(item->firstChild(), list); | 126 | getAllItems(item->firstChild(), list); |
115 | list.append(item); | 127 | list.append(item); |
116 | item = item->nextSibling(); | 128 | item = item->nextSibling(); |
117 | } | 129 | } |
118 | return list; | 130 | return list; |
119 | } | 131 | } |
120 | 132 | ||
121 | /** | 133 | /** |
122 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. | 134 | * Selects and unselects the item by setting the HEADER_BACKUP to B or !. |
123 | * and changing the icon to match | 135 | * and changing the icon to match |
124 | * @param currentItem the item to swich the selection choice. | 136 | * @param currentItem the item to swich the selection choice. |
125 | */ | 137 | */ |
126 | void BackupAndRestore::selectItem(QListViewItem *currentItem){ | 138 | void BackupAndRestore::selectItem(QListViewItem *currentItem){ |
127 | if(!currentItem) | 139 | if(!currentItem) |
128 | return; | 140 | return; |
129 | 141 | ||
130 | if(currentItem->text(HEADER_BACKUP) == "B"){ | 142 | if(currentItem->text(HEADER_BACKUP) == "B"){ |
131 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("null")); | 143 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("null")); |
132 | currentItem->setText(HEADER_BACKUP, ""); | 144 | currentItem->setText(HEADER_BACKUP, ""); |
133 | } | 145 | } |
134 | else{ | 146 | else{ |
135 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("check")); | 147 | currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("check")); |
136 | currentItem->setText(HEADER_BACKUP, "B"); | 148 | currentItem->setText(HEADER_BACKUP, "B"); |
137 | } | 149 | } |
138 | } | 150 | } |
139 | 151 | ||
140 | void BackupAndRestore::scanForApplicationSettings(){ | 152 | void BackupAndRestore::scanForApplicationSettings(){ |
141 | QDir d(applicationSettings->text(BACKUP_LOCATION)); | 153 | QDir d(applicationSettings->text(BACKUP_LOCATION)); |
142 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 154 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
143 | const QFileInfoList *list = d.entryInfoList(); | 155 | const QFileInfoList *list = d.entryInfoList(); |
144 | QFileInfoListIterator it( *list ); | 156 | QFileInfoListIterator it( *list ); |
145 | QFileInfo *fi; | 157 | QFileInfo *fi; |
146 | while ( (fi=it.current()) ) { | 158 | while ( (fi=it.current()) ) { |
147 | //qDebug((d.path()+fi->fileName()).latin1()); | 159 | //qDebug((d.path()+fi->fileName()).latin1()); |
148 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); | 160 | QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); |
149 | selectItem(newItem); | 161 | selectItem(newItem); |
150 | ++it; | 162 | ++it; |
151 | } | 163 | } |
152 | } | 164 | } |
153 | 165 | ||
154 | /** | 166 | /** |
155 | * The "Backup" button has been pressed. Get a list of all of the files that | 167 | * The "Backup" button has been pressed. Get a list of all of the files that |
156 | * should be backed up. If there are no files, emit and error and exit. | 168 | * should be backed up. If there are no files, emit and error and exit. |
157 | * Determine the file name to store the backup in. Backup the file(s) using | 169 | * Determine the file name to store the backup in. Backup the file(s) using |
158 | * tar and gzip --best. Report failure or success | 170 | * tar and gzip --best. Report failure or success |
159 | */ | 171 | */ |
160 | void BackupAndRestore::backupPressed(){ | 172 | void BackupAndRestore::backupPressed(){ |
161 | QString backupFiles; | 173 | QString backupFiles; |
162 | if(getBackupFiles(backupFiles, NULL) == 0){ | 174 | if(getBackupFiles(backupFiles, NULL) == 0){ |
163 | QMessageBox::critical(this, "Message", | 175 | QMessageBox::critical(this, "Message", |
164 | "No items selected.",QString("Ok") ); | 176 | "No items selected.",QString("Ok") ); |
165 | return; | 177 | return; |
166 | } | 178 | } |
167 | 179 | ||
180 | setCaption(tr("Backup and Restore... working...")); | ||
168 | QString outputFile = backupLocations[storeToLocation->currentText()]; | 181 | QString outputFile = backupLocations[storeToLocation->currentText()]; |
169 | 182 | ||
170 | QDateTime time = QDateTime::currentDateTime(); | 183 | QDateTime time = QDateTime::currentDateTime(); |
171 | QString dateString = time.date().toString().replace(QRegExp(" "), ""); | 184 | QString dateString = time.date().toString().replace(QRegExp(" "), ""); |
172 | outputFile += "/" + dateString; | 185 | outputFile += "/" + dateString; |
173 | 186 | ||
174 | QString t = outputFile; | 187 | QString t = outputFile; |
175 | int c = 1; | 188 | int c = 1; |
176 | while(QFile::exists(outputFile + EXTENSION)){ | 189 | while(QFile::exists(outputFile + EXTENSION)){ |
177 | outputFile = t + QString("%1").arg(c); | 190 | outputFile = t + QString("%1").arg(c); |
178 | c++; | 191 | c++; |
179 | } | 192 | } |
193 | |||
194 | qDebug(QString("system(\"tar -c %1 | gzip > %2\")").arg(backupFiles).arg(outputFile).latin1()); | ||
180 | outputFile += EXTENSION; | 195 | outputFile += EXTENSION; |
181 | qDebug("system(\"tar -c %1 | gzip > %2\").arg(backupFiles).arg(outputFile).latin1())"); | 196 | |
182 | int r = system(QString("tar -c %1 | gzip > %2").arg(backupFiles).arg(outputFile).latin1() ); | 197 | int r = system( QString("tar -c %1 | gzip > %2").arg(backupFiles).arg(outputFile).latin1() ); |
183 | if(r != 0){ | 198 | |
184 | QMessageBox::critical(this, "Message", "Backup Failed.",QString("Ok") ); | 199 | |
185 | return; | 200 | |
186 | } | 201 | if(r != 0){ |
187 | else{ | 202 | perror("Error: "); |
188 | QMessageBox::critical(this, "Message", "Backup Successfull.",QString("Ok") ); | 203 | QString errorMsg="Error\n"+(QString)strerror(errno); |
189 | } | 204 | |
205 | QMessageBox::critical(this, "Message", "Backup Failed.\n"+errorMsg, QString("Ok") ); | ||
206 | return; | ||
207 | } | ||
208 | else{ | ||
209 | QMessageBox::critical(this, "Message", "Backup Successfull.",QString("Ok") ); | ||
210 | |||
211 | } | ||
212 | setCaption(tr("Backup and Restore")); | ||
190 | } | 213 | } |
191 | 214 | ||
192 | /*** | 215 | /*** |
193 | * Get a list of all of the files to backup. | 216 | * Get a list of all of the files to backup. |
194 | */ | 217 | */ |
195 | int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent){ | 218 | int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent){ |
196 | QListViewItem * currentItem; | 219 | QListViewItem * currentItem; |
197 | QString currentHome; | 220 | QString currentHome; |
198 | if(!parent) | 221 | if(!parent) |
199 | currentItem = backupList->firstChild(); | 222 | currentItem = backupList->firstChild(); |
200 | else{ | 223 | else{ |
201 | currentItem = parent->firstChild(); | 224 | currentItem = parent->firstChild(); |
202 | currentHome = parent->text(BACKUP_LOCATION); | 225 | currentHome = parent->text(BACKUP_LOCATION); |
203 | } | 226 | } |
204 | 227 | ||
205 | uint count = 0; | 228 | uint count = 0; |
206 | while( currentItem != 0 ){ | 229 | while( currentItem != 0 ){ |
207 | if(currentItem->text(HEADER_BACKUP) == "B" ){ | 230 | if(currentItem->text(HEADER_BACKUP) == "B" ){ |
208 | if(currentItem->childCount() == 0 ){ | 231 | if(currentItem->childCount() == 0 ){ |
209 | if(parent == NULL) | 232 | if(parent == NULL) |
210 | backupFiles += currentItem->text(BACKUP_LOCATION); | 233 | backupFiles += currentItem->text(BACKUP_LOCATION); |
211 | else | 234 | else |
212 | backupFiles += currentHome + currentItem->text(HEADER_NAME); | 235 | backupFiles += currentHome + currentItem->text(HEADER_NAME); |
213 | backupFiles += " "; | 236 | backupFiles += " "; |
214 | count++; | 237 | count++; |
215 | } | 238 | } |
216 | else{ | 239 | else{ |
217 | count += getBackupFiles(backupFiles, currentItem); | 240 | count += getBackupFiles(backupFiles, currentItem); |
218 | } | 241 | } |
219 | } | 242 | } |
220 | currentItem = currentItem->nextSibling(); | 243 | currentItem = currentItem->nextSibling(); |
221 | } | 244 | } |
222 | return count; | 245 | return count; |
223 | } | 246 | } |
224 | 247 | ||
225 | void BackupAndRestore::sourceDirChanged(int selection){ | 248 | void BackupAndRestore::sourceDirChanged(int selection){ |
226 | restoreList->clear(); | 249 | restoreList->clear(); |
227 | rescanFolder(backupLocations[restoreSource->text(selection)]); | 250 | rescanFolder(backupLocations[restoreSource->text(selection)]); |
228 | } | 251 | } |
229 | 252 | ||
230 | /** | 253 | /** |
231 | * Scans directory for any backup files. Will recursivly go down, | 254 | * Scans directory for any backup files. Will recursivly go down, |
232 | * but will not follow symlinks. | 255 | * but will not follow symlinks. |
233 | * @param directory - the directory to look in. | 256 | * @param directory - the directory to look in. |
234 | */ | 257 | */ |
235 | void BackupAndRestore::rescanFolder(QString directory){ | 258 | void BackupAndRestore::rescanFolder(QString directory){ |
236 | //qDebug(QString("rescanFolder: ") + directory.latin1()); | 259 | //qDebug(QString("rescanFolder: ") + directory.latin1()); |
237 | QDir d(directory); | 260 | QDir d(directory); |
238 | if(!d.exists()) | 261 | if(!d.exists()) |
239 | return; | 262 | return; |
240 | 263 | ||
241 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | 264 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); |
242 | const QFileInfoList *list = d.entryInfoList(); | 265 | const QFileInfoList *list = d.entryInfoList(); |
243 | QFileInfoListIterator it( *list ); | 266 | QFileInfoListIterator it( *list ); |
244 | QFileInfo *file; | 267 | QFileInfo *file; |
245 | while ( (file=it.current()) ) { // for each file... | 268 | while ( (file=it.current()) ) { // for each file... |
246 | // If it is a dir and not .. or . then add it as a tab and go down. | 269 | // If it is a dir and not .. or . then add it as a tab and go down. |
247 | if(file->isDir()){ | 270 | if(file->isDir()){ |
248 | if(file->fileName() != ".." && file->fileName() != ".") { | 271 | if(file->fileName() != ".." && file->fileName() != ".") { |
249 | rescanFolder(directory + "/" + file->fileName()); | 272 | rescanFolder(directory + "/" + file->fileName()); |
250 | } | 273 | } |
251 | } | 274 | } |
252 | else{ | 275 | else{ |
253 | // If it is a backup file add to list. | 276 | // If it is a backup file add to list. |
254 | if(file->fileName().contains(EXTENSION)) | 277 | if(file->fileName().contains(EXTENSION)) |
255 | (void)new QListViewItem(restoreList, file->fileName()); | 278 | (void)new QListViewItem(restoreList, file->fileName()); |
256 | } | 279 | } |
257 | ++it; | 280 | ++it; |
258 | } | 281 | } |
259 | } | 282 | } |
260 | 283 | ||
261 | /** | 284 | /** |
262 | * Restore a backup file. | 285 | * Restore a backup file. |
263 | * Report errors or success | 286 | * Report errors or success |
264 | */ | 287 | */ |
265 | void BackupAndRestore::restore(){ | 288 | void BackupAndRestore::restore(){ |
266 | QListViewItem *restoreItem = restoreList->currentItem(); | 289 | QListViewItem *restoreItem = restoreList->currentItem(); |
267 | if(!restoreItem){ | 290 | if(!restoreItem){ |
268 | QMessageBox::critical(this, "Message", | 291 | QMessageBox::critical(this, "Message", |
269 | "Please select something to restore.",QString("Ok") ); | 292 | "Please select something to restore.",QString("Ok") ); |
270 | return; | 293 | return; |
271 | } | 294 | } |
272 | QString restoreFile = backupLocations[restoreSource->currentText()]; | 295 | QString restoreFile = backupLocations[restoreSource->currentText()]; |
273 | 296 | ||
274 | restoreFile += "/" + restoreItem->text(0); | 297 | restoreFile += "/" + restoreItem->text(0); |
275 | 298 | ||
276 | int r = system(QString("tar -C / -zxf %1").arg(restoreFile).latin1()); | 299 | int r = system(QString("tar -C / -zxf %1").arg(restoreFile).latin1()); |
277 | if(r != 0){ | 300 | if(r != 0){ |
278 | QMessageBox::critical(this, "Message", | 301 | QMessageBox::critical(this, "Message", |
279 | "Restore Failed.",QString("Ok") ); | 302 | "Restore Failed.",QString("Ok") ); |
280 | } | 303 | } |
281 | else{ | 304 | else{ |
282 | QMessageBox::critical(this, "Message", | 305 | QMessageBox::critical(this, "Message", |
283 | "Restore Successfull.",QString("Ok") ); | 306 | "Restore Successfull.",QString("Ok") ); |
284 | } | 307 | } |
285 | } | 308 | } |
286 | 309 | ||
287 | // backuprestore.cpp | 310 | // backuprestore.cpp |
288 | 311 | ||