author | ar <ar> | 2004-01-22 21:50:55 (UTC) |
---|---|---|
committer | ar <ar> | 2004-01-22 21:50:55 (UTC) |
commit | 77ad4fd70864e36745dbee587ca959a2e56998a6 (patch) (unidiff) | |
tree | 719ea0c8f1a1ecf9338ceb05c1b56169dc56dbed | |
parent | 2061145634f91239c986b25ecc8d1e10b95046b3 (diff) | |
download | opie-77ad4fd70864e36745dbee587ca959a2e56998a6.zip opie-77ad4fd70864e36745dbee587ca959a2e56998a6.tar.gz opie-77ad4fd70864e36745dbee587ca959a2e56998a6.tar.bz2 |
- exclude *.bck files from backup
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 3500403..a00193d 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -220,65 +220,65 @@ void BackupAndRestore::backup() | |||
220 | { | 220 | { |
221 | QString backupFiles; | 221 | QString backupFiles; |
222 | if(getBackupFiles(backupFiles, NULL) == 0) | 222 | if(getBackupFiles(backupFiles, NULL) == 0) |
223 | { | 223 | { |
224 | QMessageBox::critical(this, "Message", | 224 | QMessageBox::critical(this, "Message", |
225 | "No items selected.",QString("Ok") ); | 225 | "No items selected.",QString("Ok") ); |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | setCaption(tr("Backup and Restore... working...")); | 229 | setCaption(tr("Backup and Restore... working...")); |
230 | QString outputFile = backupLocations[storeToLocation->currentText()]; | 230 | QString outputFile = backupLocations[storeToLocation->currentText()]; |
231 | 231 | ||
232 | QDateTime datetime = QDateTime::currentDateTime(); | 232 | QDateTime datetime = QDateTime::currentDateTime(); |
233 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + | 233 | QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + |
234 | QString::number( datetime.date().day() ).rightJustify(2, '0'); | 234 | QString::number( datetime.date().day() ).rightJustify(2, '0'); |
235 | 235 | ||
236 | outputFile += "/" + dateString; | 236 | outputFile += "/" + dateString; |
237 | 237 | ||
238 | QString t = outputFile; | 238 | QString t = outputFile; |
239 | int c = 1; | 239 | int c = 1; |
240 | while(QFile::exists(outputFile + EXTENSION)) | 240 | while(QFile::exists(outputFile + EXTENSION)) |
241 | { | 241 | { |
242 | outputFile = t + QString("%1").arg(c); | 242 | outputFile = t + QString("%1").arg(c); |
243 | c++; | 243 | c++; |
244 | } | 244 | } |
245 | 245 | ||
246 | // We execute tar and compressing its output with gzip.. | 246 | // We execute tar and compressing its output with gzip.. |
247 | // The error output will be written into a temp-file which could be provided | 247 | // The error output will be written into a temp-file which could be provided |
248 | // for debugging.. | 248 | // for debugging.. |
249 | qDebug( "Storing file: %s", outputFile.latin1() ); | 249 | qDebug( "Storing file: %s", outputFile.latin1() ); |
250 | outputFile += EXTENSION; | 250 | outputFile += EXTENSION; |
251 | 251 | ||
252 | QString commandLine = QString( "(tar -C %1 -c %2 | gzip > %3 ) 2> %4" ).arg( QDir::homeDirPath() ) | 252 | QString commandLine = QString( "(tar -C %1 -z --exclude=*.bck -c %2 > %3 ) 2> %4" ).arg( QDir::homeDirPath() ) |
253 | .arg( backupFiles ) | 253 | .arg( backupFiles ) |
254 | .arg( outputFile.latin1() ) | 254 | .arg( outputFile.latin1() ) |
255 | .arg( tempFileName.latin1() ); | 255 | .arg( tempFileName.latin1() ); |
256 | 256 | ||
257 | qDebug( commandLine ); | 257 | qDebug( commandLine ); |
258 | 258 | ||
259 | int r = system( commandLine ); | 259 | int r = system( commandLine ); |
260 | 260 | ||
261 | if(r != 0) | 261 | if(r != 0) |
262 | { | 262 | { |
263 | perror("Error: "); | 263 | perror("Error: "); |
264 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); | 264 | QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); |
265 | 265 | ||
266 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" | 266 | switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" |
267 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) | 267 | + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ) |
268 | { | 268 | { |
269 | 269 | ||
270 | case 1: | 270 | case 1: |
271 | qWarning("Details pressed !"); | 271 | qWarning("Details pressed !"); |
272 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); | 272 | ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); |
273 | QFile errorFile( tempFileName ); | 273 | QFile errorFile( tempFileName ); |
274 | if ( errorFile.open(IO_ReadOnly) ) | 274 | if ( errorFile.open(IO_ReadOnly) ) |
275 | { | 275 | { |
276 | QTextStream t( &errorFile ); | 276 | QTextStream t( &errorFile ); |
277 | QString s; | 277 | QString s; |
278 | while ( !t.eof() ) | 278 | while ( !t.eof() ) |
279 | { // until end of file... | 279 | { // until end of file... |
280 | s += t.readLine(); // line of text excluding '\n' | 280 | s += t.readLine(); // line of text excluding '\n' |
281 | } | 281 | } |
282 | errorFile.close(); | 282 | errorFile.close(); |
283 | 283 | ||
284 | pErrDialog->m_textarea->setText( s ); | 284 | pErrDialog->m_textarea->setText( s ); |