summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/backup/backuprestore.cpp127
-rw-r--r--noncore/settings/backup/backuprestore.h6
-rw-r--r--noncore/settings/backup/backuprestorebase.ui129
3 files changed, 202 insertions, 60 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>
8using namespace Opie::Core; 8using 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
146void 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
163QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) 172QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list)
@@ -205,3 +214,3 @@ void BackupAndRestore::scanForApplicationSettings()
205 { 214 {
206 //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; 215 //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl;
207 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) 216 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) )
@@ -251,3 +260,3 @@ void BackupAndRestore::backup()
251 // for debugging.. 260 // for debugging..
252 odebug << "Storing file: " << outputFile.latin1() << "" << oendl; 261 odebug << "Storing file: " << outputFile.latin1() << "" << oendl;
253 outputFile += EXTENSION; 262 outputFile += EXTENSION;
@@ -260,3 +269,3 @@ void BackupAndRestore::backup()
260 269
261 odebug << commandLine << oendl; 270 odebug << commandLine << oendl;
262 271
@@ -274,3 +283,3 @@ void BackupAndRestore::backup()
274 case 1: 283 case 1:
275 owarn << "Details pressed !" << oendl; 284 owarn << "Details pressed !" << oendl;
276 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); 285 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
@@ -361,3 +370,3 @@ void BackupAndRestore::fileListUpdate()
361{ 370{
362 owarn << "void BackupAndRestore::fileListUpdate()" << oendl; 371 owarn << "void BackupAndRestore::fileListUpdate()" << oendl;
363 restoreList->clear(); 372 restoreList->clear();
@@ -373,3 +382,3 @@ void BackupAndRestore::rescanFolder(QString directory)
373{ 382{
374 //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; 383 //odebug << QString("rescanFolder: ") + directory.latin1() << oendl;
375 QDir d(directory); 384 QDir d(directory);
@@ -421,3 +430,3 @@ void BackupAndRestore::restore()
421 430
422 odebug << restoreFile << oendl; 431 odebug << restoreFile << oendl;
423 432
@@ -444,3 +453,3 @@ void BackupAndRestore::restore()
444 453
445 odebug << commandLine << oendl; 454 odebug << commandLine << oendl;
446 455
@@ -456,3 +465,3 @@ void BackupAndRestore::restore()
456 case 1: 465 case 1:
457 owarn << "Details pressed !" << oendl; 466 owarn << "Details pressed !" << oendl;
458 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); 467 ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true );
@@ -501,3 +510,3 @@ void BackupAndRestore::restore()
501 * If it does not exist, the function will create the file with *.bck as content 510 * If it does not exist, the function will create the file with *.bck as content
502 * The exclude_files is read by tar and will provide to exclude special files out from backup. 511 * The exclude_files is read by tar and will provide to exclude special files out from backup.
503 * e.g. alle *.bck files (backup-files) will not be backed up by default 512 * e.g. alle *.bck files (backup-files) will not be backed up by default
@@ -526,2 +535,34 @@ QString BackupAndRestore::getExcludeFile()
526 535
536void BackupAndRestore::refreshLocations()
537{
538 locationList->clear();
539 //todo: implement add locations
540 odebug << "not implemented yet" << oendl;
541}
542
543void 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
553void BackupAndRestore::removeLocation()
554{
555 if ( locationList->selectedItem() )
556 {
557 delete( locationList->selectedItem() );
558 }
559}
560
561void BackupAndRestore::saveLocation()
562{
563 //todo: implement
564 odebug << "not implemented yet" << oendl;
565}
566
567
527// backuprestore.cpp 568// backuprestore.cpp
diff --git a/noncore/settings/backup/backuprestore.h b/noncore/settings/backup/backuprestore.h
index 0d88f8d..527b3cf 100644
--- a/noncore/settings/backup/backuprestore.h
+++ b/noncore/settings/backup/backuprestore.h
@@ -30,2 +30,6 @@ private slots:
30 30
31 void addLocation();
32 void removeLocation();
33 void saveLocation();
34
31private: 35private:
@@ -36,2 +40,4 @@ private:
36 QList<QListViewItem> getAllItems(QListViewItem *item, QList<QListViewItem> &list); 40 QList<QListViewItem> getAllItems(QListViewItem *item, QList<QListViewItem> &list);
41 void refreshBackupLocations();
42 void refreshLocations();
37 43
diff --git a/noncore/settings/backup/backuprestorebase.ui b/noncore/settings/backup/backuprestorebase.ui
index a52b42d..b4624bb 100644
--- a/noncore/settings/backup/backuprestorebase.ui
+++ b/noncore/settings/backup/backuprestorebase.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>231</width> 14 <width>290</width>
15 <height>275</height> 15 <height>243</height>
16 </rect> 16 </rect>
@@ -24,2 +24,5 @@
24 </property> 24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
25 <vbox> 28 <vbox>
@@ -31,3 +34,3 @@
31 <name>spacing</name> 34 <name>spacing</name>
32 <number>6</number> 35 <number>0</number>
33 </property> 36 </property>
@@ -42,2 +45,5 @@
42 </property> 45 </property>
46 <property>
47 <name>layoutSpacing</name>
48 </property>
43 <widget> 49 <widget>
@@ -55,3 +61,3 @@
55 <name>margin</name> 61 <name>margin</name>
56 <number>11</number> 62 <number>4</number>
57 </property> 63 </property>
@@ -59,3 +65,3 @@
59 <name>spacing</name> 65 <name>spacing</name>
60 <number>6</number> 66 <number>4</number>
61 </property> 67 </property>
@@ -134,3 +140,3 @@
134 <name>margin</name> 140 <name>margin</name>
135 <number>11</number> 141 <number>4</number>
136 </property> 142 </property>
@@ -138,3 +144,3 @@
138 <name>spacing</name> 144 <name>spacing</name>
139 <number>6</number> 145 <number>4</number>
140 </property> 146 </property>
@@ -148,2 +154,24 @@
148 <widget row="2" column="0" rowspan="1" colspan="2" > 154 <widget row="2" column="0" rowspan="1" colspan="2" >
155 <class>QPushButton</class>
156 <property stdset="1">
157 <name>name</name>
158 <cstring>restoreButton</cstring>
159 </property>
160 <property stdset="1">
161 <name>text</name>
162 <string>&amp;Restore</string>
163 </property>
164 </widget>
165 <widget row="0" column="0" >
166 <class>QLabel</class>
167 <property stdset="1">
168 <name>name</name>
169 <cstring>TextLabel1_2</cstring>
170 </property>
171 <property stdset="1">
172 <name>text</name>
173 <string>Select Source</string>
174 </property>
175 </widget>
176 <widget row="1" column="0" rowspan="1" colspan="2" >
149 <class>QListView</class> 177 <class>QListView</class>
@@ -175,3 +203,70 @@
175 </widget> 203 </widget>
176 <widget row="3" column="0" rowspan="1" colspan="2" > 204 </grid>
205 </widget>
206 <widget>
207 <class>QWidget</class>
208 <property stdset="1">
209 <name>name</name>
210 <cstring>tab</cstring>
211 </property>
212 <attribute>
213 <name>title</name>
214 <string>Locations</string>
215 </attribute>
216 <grid>
217 <property stdset="1">
218 <name>margin</name>
219 <number>4</number>
220 </property>
221 <property stdset="1">
222 <name>spacing</name>
223 <number>4</number>
224 </property>
225 <widget row="0" column="0" rowspan="1" colspan="3" >
226 <class>QLineEdit</class>
227 <property stdset="1">
228 <name>name</name>
229 <cstring>locationEdit</cstring>
230 </property>
231 </widget>
232 <widget row="0" column="3" >
233 <class>QToolButton</class>
234 <property stdset="1">
235 <name>name</name>
236 <cstring>locationSelectBtn</cstring>
237 </property>
238 <property stdset="1">
239 <name>maximumSize</name>
240 <size>
241 <width>20</width>
242 <height>30</height>
243 </size>
244 </property>
245 <property stdset="1">
246 <name>text</name>
247 <string>...</string>
248 </property>
249 </widget>
250 <widget row="1" column="0" rowspan="1" colspan="4" >
251 <class>QListView</class>
252 <column>
253 <property>
254 <name>text</name>
255 <string>Locations</string>
256 </property>
257 <property>
258 <name>clickable</name>
259 <bool>true</bool>
260 </property>
261 <property>
262 <name>resizeable</name>
263 <bool>true</bool>
264 </property>
265 </column>
266 <property stdset="1">
267 <name>name</name>
268 <cstring>locationList</cstring>
269 </property>
270 </widget>
271 <widget row="2" column="0" >
177 <class>QPushButton</class> 272 <class>QPushButton</class>
@@ -179,3 +274,3 @@
179 <name>name</name> 274 <name>name</name>
180 <cstring>restoreButton</cstring> 275 <cstring>addLocationButton</cstring>
181 </property> 276 </property>
@@ -183,10 +278,10 @@
183 <name>text</name> 278 <name>text</name>
184 <string>&amp;Restore</string> 279 <string>Add</string>
185 </property> 280 </property>
186 </widget> 281 </widget>
187 <widget row="0" column="0" > 282 <widget row="2" column="1" >
188 <class>QLabel</class> 283 <class>QPushButton</class>
189 <property stdset="1"> 284 <property stdset="1">
190 <name>name</name> 285 <name>name</name>
191 <cstring>TextLabel1_2</cstring> 286 <cstring>removeLocationButton</cstring>
192 </property> 287 </property>
@@ -194,6 +289,6 @@
194 <name>text</name> 289 <name>text</name>
195 <string>Select Source</string> 290 <string>Remove</string>
196 </property> 291 </property>
197 </widget> 292 </widget>
198 <widget row="1" column="0" rowspan="1" colspan="2" > 293 <widget row="2" column="2" rowspan="1" colspan="2" >
199 <class>QPushButton</class> 294 <class>QPushButton</class>
@@ -201,3 +296,3 @@
201 <name>name</name> 296 <name>name</name>
202 <cstring>updateList</cstring> 297 <cstring>saveLocationsButton</cstring>
203 </property> 298 </property>
@@ -205,3 +300,3 @@
205 <name>text</name> 300 <name>text</name>
206 <string>Update Filelist</string> 301 <string>Save</string>
207 </property> 302 </property>