author | ar <ar> | 2004-07-25 21:41:01 (UTC) |
---|---|---|
committer | ar <ar> | 2004-07-25 21:41:01 (UTC) |
commit | d61db324b7bac184b067b6f798ec3c85749bac15 (patch) (unidiff) | |
tree | 14f9d2f24a82fa8eaf12bb378f2d4125979f7751 /noncore/settings/backup/backuprestore.cpp | |
parent | 8b3a81d53c7db43bf748c2390b429dde2ab9aa82 (diff) | |
download | opie-d61db324b7bac184b067b6f798ec3c85749bac15.zip opie-d61db324b7bac184b067b6f798ec3c85749bac15.tar.gz opie-d61db324b7bac184b067b6f798ec3c85749bac15.tar.bz2 |
- implementation of custom backup- and restore-locations
Diffstat (limited to 'noncore/settings/backup/backuprestore.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 82 |
1 files changed, 53 insertions, 29 deletions
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 3889744..478b22f 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp | |||
@@ -29,2 +29,3 @@ using namespace Opie::Core; | |||
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qstringlist.h> | ||
30 | 31 | ||
@@ -68,25 +69,4 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
68 | scanForApplicationSettings(); | 69 | scanForApplicationSettings(); |
69 | refreshBackupLocations(); | ||
70 | refreshLocations(); | 70 | refreshLocations(); |
71 | 71 | refreshBackupLocations(); | |
72 | Config config("BackupAndRestore"); | ||
73 | //read last locations | ||
74 | config.setGroup("LastLocation"); | ||
75 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | ||
76 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | ||
77 | int locationIndex = 0; | ||
78 | |||
79 | QMap<QString, QString>::Iterator it; | ||
80 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | ||
81 | { | ||
82 | storeToLocation->insertItem(it.key()); | ||
83 | restoreSource->insertItem(it.key()); | ||
84 | |||
85 | //check for last locations | ||
86 | if ( it.key() == lastStoreLocation ) | ||
87 | storeToLocation->setCurrentItem( locationIndex ); | ||
88 | if ( it.key() == lastRestoreLocation ) | ||
89 | restoreSource->setCurrentItem( locationIndex ); | ||
90 | locationIndex++; | ||
91 | } | ||
92 | 72 | ||
@@ -95,2 +75,3 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
95 | dontBackupList.setAutoDelete(true); | 75 | dontBackupList.setAutoDelete(true); |
76 | Config config("BackupAndRestore"); | ||
96 | config.setGroup("DontBackup"); | 77 | config.setGroup("DontBackup"); |
@@ -167,4 +148,32 @@ void BackupAndRestore::refreshBackupLocations() | |||
167 | 148 | ||
168 | // Add own locations from locationList | 149 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) |
169 | // todo implementation | 150 | { |
151 | backupLocations.insert( it.current()->text( 0 ), it.current()->text( 0 ) ); | ||
152 | } | ||
153 | |||
154 | //update QComboBox | ||
155 | storeToLocation->clear(); | ||
156 | restoreSource->clear(); | ||
157 | |||
158 | //read last locations | ||
159 | Config config("BackupAndRestore"); | ||
160 | config.setGroup("LastLocation"); | ||
161 | QString lastStoreLocation = config.readEntry( "LastStoreLocation", "" ); | ||
162 | QString lastRestoreLocation = config.readEntry( "LastRestoreLocation", "" ); | ||
163 | int locationIndex = 0; | ||
164 | |||
165 | //fill QComboBox | ||
166 | QMap<QString, QString>::Iterator it; | ||
167 | for( it = backupLocations.begin(); it != backupLocations.end(); ++it ) | ||
168 | { | ||
169 | storeToLocation->insertItem(it.key()); | ||
170 | restoreSource->insertItem(it.key()); | ||
171 | |||
172 | //check for last locations | ||
173 | if ( it.key() == lastStoreLocation ) | ||
174 | storeToLocation->setCurrentItem( locationIndex ); | ||
175 | if ( it.key() == lastRestoreLocation ) | ||
176 | restoreSource->setCurrentItem( locationIndex ); | ||
177 | locationIndex++; | ||
178 | } | ||
170 | } | 179 | } |
@@ -312,3 +321,2 @@ void BackupAndRestore::backup() | |||
312 | QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) ); | 321 | QMessageBox::information(this, tr( "Message" ), tr( "Backup Successful." ), QString(tr( "Ok" ) ) ); |
313 | |||
314 | } | 322 | } |
@@ -538,4 +546,12 @@ void BackupAndRestore::refreshLocations() | |||
538 | locationList->clear(); | 546 | locationList->clear(); |
547 | |||
539 | //todo: implement add locations | 548 | //todo: implement add locations |
540 | odebug << "not implemented yet" << oendl; | 549 | Config config( "BackupAndRestore" ); |
550 | config.setGroup( "Locations" ); | ||
551 | |||
552 | QStringList locations( config.readListEntry( "locations", '|' ) ); | ||
553 | |||
554 | for ( QStringList::Iterator it = locations.begin(); it != locations.end(); ++it ) { | ||
555 | (void) new QListViewItem( locationList, *it ); | ||
556 | } | ||
541 | } | 557 | } |
@@ -560,8 +576,16 @@ void BackupAndRestore::removeLocation() | |||
560 | 576 | ||
561 | void BackupAndRestore::saveLocation() | 577 | void BackupAndRestore::saveLocations() |
562 | { | 578 | { |
563 | //todo: implement | 579 | Config config("BackupAndRestore"); |
564 | odebug << "not implemented yet" << oendl; | 580 | config.setGroup("Locations"); |
581 | |||
582 | QStringList locations; | ||
583 | for ( QListViewItemIterator it( locationList ); it.current(); ++it ) | ||
584 | { | ||
585 | locations.append( it.current()->text( 0 ) ); | ||
565 | } | 586 | } |
587 | config.writeEntry( "locations", locations, '|' ); | ||
566 | 588 | ||
589 | refreshBackupLocations(); | ||
590 | } | ||
567 | 591 | ||