author | ar <ar> | 2004-07-25 14:35:09 (UTC) |
---|---|---|
committer | ar <ar> | 2004-07-25 14:35:09 (UTC) |
commit | 8b3a81d53c7db43bf748c2390b429dde2ab9aa82 (patch) (side-by-side diff) | |
tree | eb0da156fba85f8ade489a42382ace3a88df87af /noncore/settings/backup/backuprestore.cpp | |
parent | da9a436a866e608451115316c7374a6730174130 (diff) | |
download | opie-8b3a81d53c7db43bf748c2390b429dde2ab9aa82.zip opie-8b3a81d53c7db43bf748c2390b429dde2ab9aa82.tar.gz opie-8b3a81d53c7db43bf748c2390b429dde2ab9aa82.tar.bz2 |
- begin implementation of custom backup- and restore-locations
Diffstat (limited to 'noncore/settings/backup/backuprestore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 127 |
1 files changed, 84 insertions, 43 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 @@ + /* OPIE */ @@ -6,5 +7,8 @@ #include <opie2/ostorageinfo.h> -#include <qpe/qpeapplication.h> using namespace Opie::Core; +#include <qpe/qpeapplication.h> +#include <qpe/resource.h> +#include <qpe/config.h> + /* QT */ @@ -18,4 +22,2 @@ using namespace Opie::Core; #include <qheader.h> -#include <qpe/resource.h> -#include <qpe/config.h> #include <qmessagebox.h> @@ -23,3 +25,2 @@ using namespace Opie::Core; #include <qlist.h> -#include <stdlib.h> #include <qregexp.h> @@ -27,2 +28,3 @@ using namespace Opie::Core; #include <qtextview.h> +#include <qlineedit.h> @@ -48,12 +50,10 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f restoreList->header()->hide(); - connect(backupButton, SIGNAL(clicked()), - this, SLOT(backup())); - connect(restoreButton, SIGNAL(clicked()), - this, SLOT(restore())); - connect(backupList, SIGNAL(clicked(QListViewItem*)), - this, SLOT(selectItem(QListViewItem*))); - connect(restoreSource, SIGNAL(activated(int)), - this, SLOT(sourceDirChanged(int))); - connect(updateList, SIGNAL(clicked()), - this, SLOT( fileListUpdate())); + locationList->header()->hide(); + connect( backupButton, SIGNAL( clicked() ), this, SLOT( backup() ) ); + connect( restoreButton, SIGNAL( clicked() ), this, SLOT( restore() ) ); + connect( backupList, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) ); + connect( restoreSource, SIGNAL( activated( int ) ), this, SLOT( sourceDirChanged( int ) ) ); + connect( addLocationButton, SIGNAL( clicked() ), this, SLOT( addLocation() ) ); + connect( removeLocationButton, SIGNAL( clicked() ), this, SLOT( removeLocation() ) ); + connect( saveLocationsButton, SIGNAL( clicked() ), this, SLOT( saveLocations() ) ); @@ -68,21 +68,4 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags f scanForApplicationSettings(); - - Opie::Core::OStorageInfo storage; - - backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); - if ( storage.hasCf() ) - { - backupLocations.insert( "CF", storage.cfPath() ); - odebug << "Cf Path: " + storage.cfPath() << oendl; - } - if ( storage.hasSd() ) - { - backupLocations.insert( "SD", storage.sdPath() ); - odebug << " Sd Path: " + storage.sdPath() << oendl; - } - if ( storage.hasMmc() ) - { - backupLocations.insert( "MMC", storage.mmcPath() ); - odebug << "Mmc Path: " + storage.mmcPath() << oendl; - } + refreshBackupLocations(); + refreshLocations(); @@ -162,2 +145,28 @@ BackupAndRestore::~BackupAndRestore() +void BackupAndRestore::refreshBackupLocations() +{ + backupLocations.clear(); + // Add cards + Opie::Core::OStorageInfo storage; + backupLocations.insert( "Documents", QDir::homeDirPath() + "/Documents" ); + if ( storage.hasCf() ) + { + backupLocations.insert( "CF", storage.cfPath() ); + odebug << "Cf Path: " + storage.cfPath() << oendl; + } + if ( storage.hasSd() ) + { + backupLocations.insert( "SD", storage.sdPath() ); + odebug << " Sd Path: " + storage.sdPath() << oendl; + } + if ( storage.hasMmc() ) + { + backupLocations.insert( "MMC", storage.mmcPath() ); + odebug << "Mmc Path: " + storage.mmcPath() << oendl; + } + + // Add own locations from locationList + // todo implementation +} + QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) @@ -205,3 +214,3 @@ void BackupAndRestore::scanForApplicationSettings() { - //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; + //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) @@ -251,3 +260,3 @@ void BackupAndRestore::backup() // for debugging.. - odebug << "Storing file: " << outputFile.latin1() << "" << oendl; + odebug << "Storing file: " << outputFile.latin1() << "" << oendl; outputFile += EXTENSION; @@ -260,3 +269,3 @@ void BackupAndRestore::backup() - odebug << commandLine << oendl; + odebug << commandLine << oendl; @@ -274,3 +283,3 @@ void BackupAndRestore::backup() case 1: - owarn << "Details pressed !" << oendl; + owarn << "Details pressed !" << oendl; ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); @@ -361,3 +370,3 @@ void BackupAndRestore::fileListUpdate() { - owarn << "void BackupAndRestore::fileListUpdate()" << oendl; + owarn << "void BackupAndRestore::fileListUpdate()" << oendl; restoreList->clear(); @@ -373,3 +382,3 @@ void BackupAndRestore::rescanFolder(QString directory) { - //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; + //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; QDir d(directory); @@ -421,3 +430,3 @@ void BackupAndRestore::restore() - odebug << restoreFile << oendl; + odebug << restoreFile << oendl; @@ -444,3 +453,3 @@ void BackupAndRestore::restore() - odebug << commandLine << oendl; + odebug << commandLine << oendl; @@ -456,3 +465,3 @@ void BackupAndRestore::restore() case 1: - owarn << "Details pressed !" << oendl; + owarn << "Details pressed !" << oendl; ErrorDialog* pErrDialog = new ErrorDialog( this, NULL, true ); @@ -501,3 +510,3 @@ void BackupAndRestore::restore() * If it does not exist, the function will create the file with *.bck as content - * The exclude_files is read by tar and will provide to exclude special files out from backup. + * The exclude_files is read by tar and will provide to exclude special files out from backup. * e.g. alle *.bck files (backup-files) will not be backed up by default @@ -526,2 +535,34 @@ QString BackupAndRestore::getExcludeFile() +void BackupAndRestore::refreshLocations() +{ + locationList->clear(); + //todo: implement add locations + odebug << "not implemented yet" << oendl; +} + +void BackupAndRestore::addLocation() +{ + if ( ( !locationEdit->text().isEmpty() ) && + ( QDir( locationEdit->text() ).exists() ) ) + { + (void) new QListViewItem( locationList, locationEdit->text() ); + locationEdit->setText( "" ); + } +} + +void BackupAndRestore::removeLocation() +{ + if ( locationList->selectedItem() ) + { + delete( locationList->selectedItem() ); + } +} + +void BackupAndRestore::saveLocation() +{ + //todo: implement + odebug << "not implemented yet" << oendl; +} + + // backuprestore.cpp |