Diffstat (limited to 'noncore/settings/backup/backuprestore.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 107 |
1 files changed, 74 insertions, 33 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 | |||
@@ -3,2 +3,3 @@ | |||
3 | 3 | ||
4 | |||
4 | /* OPIE */ | 5 | /* OPIE */ |
@@ -6,5 +7,8 @@ | |||
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 */ |
@@ -18,4 +22,2 @@ using namespace Opie::Core; | |||
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> |
@@ -23,3 +25,2 @@ using namespace Opie::Core; | |||
23 | #include <qlist.h> | 25 | #include <qlist.h> |
24 | #include <stdlib.h> | ||
25 | #include <qregexp.h> | 26 | #include <qregexp.h> |
@@ -27,2 +28,3 @@ using namespace Opie::Core; | |||
27 | #include <qtextview.h> | 28 | #include <qtextview.h> |
29 | #include <qlineedit.h> | ||
28 | 30 | ||
@@ -48,12 +50,10 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
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 | ||
@@ -68,21 +68,4 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f | |||
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 | ||
@@ -162,2 +145,28 @@ BackupAndRestore::~BackupAndRestore() | |||
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) |
@@ -526,2 +535,34 @@ QString BackupAndRestore::getExcludeFile() | |||
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 |