-rw-r--r-- | noncore/settings/backup/backup.pro | 7 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.cpp | 68 | ||||
-rw-r--r-- | noncore/settings/backup/backuprestore.h | 13 | ||||
-rw-r--r-- | noncore/settings/backup/main.cpp | 10 |
4 files changed, 44 insertions, 54 deletions
diff --git a/noncore/settings/backup/backup.pro b/noncore/settings/backup/backup.pro index cadb381..1e9af61 100644 --- a/noncore/settings/backup/backup.pro +++ b/noncore/settings/backup/backup.pro @@ -1,4 +1,2 @@ -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = backuprestore.h @@ -10,3 +8,2 @@ INTERFACES = backuprestorebase.ui errordialog.ui TARGET = backup -DESTDIR = $(OPIEDIR)/bin @@ -32,4 +29,2 @@ TRANSLATIONS = ../../../i18n/de/backup.ts \ - - include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp index 922523b..1c854d9 100644 --- a/noncore/settings/backup/backuprestore.cpp +++ b/noncore/settings/backup/backuprestore.cpp @@ -39,4 +39,4 @@ const QString tempFileName = "/tmp/backup.err"; -BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) - : BackupAndRestoreBase(parent, name){ +BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name, WFlags fl) + : BackupAndRestoreBase(parent, name, fl){ this->showMaximized(); @@ -49,7 +49,7 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) connect(backupList, SIGNAL(clicked( QListViewItem * )), - this, SLOT(selectItem(QListViewItem*))); + this, SLOT(selectItem(QListViewItem*))); connect(restoreSource, SIGNAL(activated( int )), - this, SLOT(sourceDirChanged(int))); + this, SLOT(sourceDirChanged(int))); connect(updateList, SIGNAL(clicked()), - this, SLOT( fileListUpdate())); + this, SLOT( fileListUpdate())); @@ -64,5 +64,5 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) selectItem(documents); - + scanForApplicationSettings(); - + Config config("BackupAndRestore"); @@ -70,3 +70,3 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) int totalLocations = config.readNumEntry("totalLocations",0); - + //todo make less static here and use Storage class to get infos @@ -88,4 +88,4 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) } - - // Read the list of items to ignore. + + // Read the list of items to ignore. QList<QString> dontBackupList; @@ -100,3 +100,3 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name) getAllItems(backupList->firstChild(), list); - + for(uint i = 0; i < list.count(); i++){ @@ -115,3 +115,3 @@ BackupAndRestore::~BackupAndRestore(){ getAllItems(backupList->firstChild(), list); - + Config config("BackupAndRestore"); @@ -119,3 +119,3 @@ BackupAndRestore::~BackupAndRestore(){ config.clearGroup(); - + int count = 0; @@ -137,3 +137,3 @@ QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QL if(item->childCount() > 0) - getAllItems(item->firstChild(), list); + getAllItems(item->firstChild(), list); list.append(item); @@ -181,6 +181,6 @@ void BackupAndRestore::scanForApplicationSettings(){ * The "Backup" button has been pressed. Get a list of all of the files that - * should be backed up. If there are no files, emit and error and exit. + * should be backed up. If there are no files, emit and error and exit. * Determine the file name to store the backup in. Backup the file(s) using * tar and gzip --best. Report failure or success - */ + */ void BackupAndRestore::backupPressed(){ @@ -190,3 +190,3 @@ void BackupAndRestore::backupPressed(){ "No items selected.",QString("Ok") ); - return; + return; } @@ -197,3 +197,3 @@ void BackupAndRestore::backupPressed(){ QDateTime datetime = QDateTime::currentDateTime(); - QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + + QString dateString = QString::number( datetime.date().year() ) + QString::number( datetime.date().month() ).rightJustify(2, '0') + QString::number( datetime.date().day() ).rightJustify(2, '0'); @@ -201,3 +201,3 @@ void BackupAndRestore::backupPressed(){ outputFile += "/" + dateString; - + QString t = outputFile; @@ -209,3 +209,3 @@ void BackupAndRestore::backupPressed(){ - // We execute tar and compressing its output with gzip.. + // We execute tar and compressing its output with gzip.. // The error output will be written into a temp-file which could be provided @@ -230,3 +230,3 @@ void BackupAndRestore::backupPressed(){ - switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" + switch( QMessageBox::critical(this, tr( "Message" ), tr( "Backup Failed!" ) + "\n" + errorMsg, QString( tr( "Ok" ) ), QString( tr( "Details" ) ) ) ){ @@ -244,3 +244,3 @@ void BackupAndRestore::backupPressed(){ errorFile.close(); - + pErrDialog->m_textarea->setText( s ); @@ -255,3 +255,3 @@ void BackupAndRestore::backupPressed(){ setCaption(tr("Backup and Restore.. Failed !!")); - return; + return; } @@ -259,3 +259,3 @@ void BackupAndRestore::backupPressed(){ QMessageBox::information(this, tr( "Message" ), tr( "Backup Successfull." ), QString(tr( "Ok" ) ) ); - + } @@ -266,3 +266,3 @@ void BackupAndRestore::backupPressed(){ * Get a list of all of the files to backup. - */ + */ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent){ @@ -276,3 +276,3 @@ int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent } - + uint count = 0; @@ -319,3 +319,3 @@ void BackupAndRestore::rescanFolder(QString directory){ return; - + d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); @@ -343,3 +343,3 @@ void BackupAndRestore::rescanFolder(QString directory){ * Report errors or success - */ + */ void BackupAndRestore::restore(){ @@ -349,3 +349,3 @@ void BackupAndRestore::restore(){ tr( "Please select something to restore." ),QString( tr( "Ok") ) ); - return; + return; } @@ -354,5 +354,5 @@ void BackupAndRestore::restore(){ QString restoreFile = backupLocations[restoreSource->currentText()]; - + restoreFile += "/" + restoreItem->text(0); - + int r = system(QString("tar -C / -zxf %1 2> %3") @@ -362,3 +362,3 @@ void BackupAndRestore::restore(){ QString errorMsg= tr( "Error from System:\n" ) + (QString)strerror( errno ); - switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" + switch( QMessageBox::critical(this, tr( "Message" ), tr( "Restore Failed." ) + "\n" + errorMsg, QString( tr( "Ok") ), QString( tr( "Details" ) ) ) ) { @@ -375,3 +375,3 @@ void BackupAndRestore::restore(){ errorFile.close(); - + pErrDialog->m_textarea->setText( s ); @@ -385,3 +385,3 @@ void BackupAndRestore::restore(){ setCaption(tr("Backup and Restore.. Failed !!")); - return; + return; diff --git a/noncore/settings/backup/backuprestore.h b/noncore/settings/backup/backuprestore.h index 8c733e3..4bdc758 100644 --- a/noncore/settings/backup/backuprestore.h +++ b/noncore/settings/backup/backuprestore.h @@ -1,2 +1,2 @@ -#ifndef WINDOW_H +#ifndef WINDOW_H #define WINDOW_H @@ -10,12 +10,13 @@ class QListViewItem; -class BackupAndRestore : public BackupAndRestoreBase { +class BackupAndRestore : public BackupAndRestoreBase { Q_OBJECT - + public: - BackupAndRestore( QWidget* parent = 0, const char* name = 0); + BackupAndRestore( QWidget* parent = 0, const char* name = 0, WFlags fl = 0); ~BackupAndRestore(); - - + + static QString appName() { return QString::fromLatin1("backup"); } + private slots: diff --git a/noncore/settings/backup/main.cpp b/noncore/settings/backup/main.cpp index 676e1f0..b375a3b 100644 --- a/noncore/settings/backup/main.cpp +++ b/noncore/settings/backup/main.cpp @@ -3,12 +3,6 @@ #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main(int argc, char *argv[]) { - QPEApplication a( argc, argv ); - - BackupAndRestore app(0, "mainwindow"); - a.showMainWidget(&app); - return a.exec(); -} -// main.cpp +OPIE_EXPORT_APP( OApplicationFactory<BackupAndRestore> ) |