-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index cfba907..477e24d 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -76,4 +76,11 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
76 | } | 76 | } |
77 | 77 | ||
78 | Config config("BackupAndRestore"); | ||
79 | //read last locations | ||
80 | config.setGroup("LastLocation"); | ||
81 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | ||
82 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | ||
83 | int locationIndex = 0; | ||
84 | |||
78 | QMap<QString, QString>::Iterator it; | 85 | QMap<QString, QString>::Iterator it; |
79 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | 86 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) |
@@ -81,9 +88,14 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
81 | storeToLocation->insertItem(it.key()); | 88 | storeToLocation->insertItem(it.key()); |
82 | restoreSource->insertItem(it.key()); | 89 | restoreSource->insertItem(it.key()); |
90 | |||
91 | //check for last locations | ||
92 | if ( it.key() == lastStoreLocation ) | ||
93 | storeToLocation->setCurrentItem( locationIndex ); | ||
94 | if ( it.key() == lastRestoreLocation ) | ||
95 | restoreSource->setCurrentItem( locationIndex ); | ||
96 | locationIndex++; | ||
83 | } | 97 | } |
84 | 98 | ||
85 | // Read the list of items to ignore. | 99 | // Read the list of items to ignore. |
86 | Config config("BackupAndRestore"); | ||
87 | |||
88 | QList<QString> dontBackupList; | 100 | QList<QString> dontBackupList; |
89 | dontBackupList.setAutoDelete(true); | 101 | dontBackupList.setAutoDelete(true); |
@@ -280,4 +292,10 @@ void BackupAndRestore::backup() | |||
280 | 292 | ||
281 | } | 293 | } |
294 | |||
295 | //write store-location | ||
296 | Config config( "BackupAndRestore" ); | ||
297 | config.setGroup( "LastLocation" ); | ||
298 | config.writeEntry( "LastStoreLocation", storeToLocation->currentText() ); | ||
299 | |||
282 | setCaption(tr("Backup and Restore")); | 300 | setCaption(tr("Backup and Restore")); |
283 | } | 301 | } |
@@ -439,7 +457,12 @@ void BackupAndRestore::restore() | |||
439 | else | 457 | else |
440 | { | 458 | { |
441 | QMessageBox::critical(this, tr( "Message" ), | 459 | QMessageBox::information(this, tr( "Message" ), tr( "Restore Successfull." ), QString( tr( "Ok") ) ); |
442 | tr( "Restore Successfull." ), QString( tr( "Ok") ) ); | ||
443 | } | 460 | } |
461 | |||
462 | //write restore-location | ||
463 | Config config( "BackupAndRestore" ); | ||
464 | config.setGroup( "LastLocation" ); | ||
465 | config.writeEntry( "LastRestoreLocation", restoreSource->currentText() ); | ||
466 | |||
444 | setCaption(tr("Backup and Restore")); | 467 | setCaption(tr("Backup and Restore")); |
445 | } | 468 | } |