Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 18b0f7b1 authored by Laurent Montel's avatar Laurent Montel 😁

Start to use pimsettingsbackuprestoreui.h

parent 157e6473
......@@ -51,6 +51,7 @@
#include "dialog/selectiontypedialog.h"
#include "utils.h"
#include "archivestorage.h"
#include "pimsettingsbackuprestoreui.h"
#include "dialog/backupfilestructureinfodialog.h"
......@@ -84,7 +85,8 @@ PimSettingExporterWindow::PimSettingExporterWindow(QWidget *parent)
mRestoreAction(0),
mSaveLogAction(0),
mArchiveStructureInfo(0),
mShowArchiveInformationsAction(0)
mShowArchiveInformationsAction(0),
mPimSettingsBackupRestoreUI(0)
{
KGlobal::locale()->insertCatalog( QLatin1String("libmailcommon") );
KGlobal::locale()->insertCatalog( QLatin1String("libpimcommon") );
......@@ -106,6 +108,7 @@ PimSettingExporterWindow::PimSettingExporterWindow(QWidget *parent)
KMessageBox::error(this,i18n("Zip program not found. Install it before to launch this application."),i18n("Zip program not found."));
}
statusBar()->hide();
initializeBackupRestoreUi();
}
PimSettingExporterWindow::~PimSettingExporterWindow()
......@@ -116,6 +119,29 @@ PimSettingExporterWindow::~PimSettingExporterWindow()
mRecentFilesAction->saveEntries(groupConfig);
}
void PimSettingExporterWindow::initializeBackupRestoreUi()
{
mPimSettingsBackupRestoreUI = new PimSettingsBackupRestoreUI(this, this);
connect(mPimSettingsBackupRestoreUI, SIGNAL(addInfo(QString)), this, SLOT(slotAddInfo(QString)));
connect(mPimSettingsBackupRestoreUI, SIGNAL(addEndLine()), this, SLOT(slotAddEndLine()));
connect(mPimSettingsBackupRestoreUI, SIGNAL(addError(QString)), this, SLOT(slotAddError(QString)));
connect(mPimSettingsBackupRestoreUI, SIGNAL(addTitle(QString)), this, SLOT(slotAddTitle(QString)));
connect(mPimSettingsBackupRestoreUI, SIGNAL(updateActions(bool)), this, SLOT(slotUpdateActions(bool)));
connect(mPimSettingsBackupRestoreUI, SIGNAL(jobFinished()), this, SLOT(slotJobFinished()));
connect(mPimSettingsBackupRestoreUI, SIGNAL(backupDone()), this, SLOT(slotShowBackupFinishDialogInformation()));
connect(mPimSettingsBackupRestoreUI, SIGNAL(jobFailed()), this, SLOT(slotJobFailed()));
}
void PimSettingExporterWindow::slotJobFailed()
{
//Nothing
}
void PimSettingExporterWindow::slotShowBackupFinishDialogInformation()
{
KMessageBox::information(this, i18n("For restoring data, you must use \"pimsettingexporter\". Be careful it can overwrite existing settings, data."), i18n("Backup infos."), QLatin1String("ShowInfoBackupInfos"));
}
void PimSettingExporterWindow::handleCommandLine()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
......@@ -165,7 +191,7 @@ void PimSettingExporterWindow::setupActions(bool canZipFile)
mRecentFilesAction->loadEntries(groupConfig);
}
void PimSettingExporterWindow::updateActions(bool inAction)
void PimSettingExporterWindow::slotUpdateActions(bool inAction)
{
mBackupAction->setEnabled(!inAction);
mRestoreAction->setEnabled(!inAction);
......@@ -243,7 +269,7 @@ void PimSettingExporterWindow::backupData(const QString &filename, const QString
void PimSettingExporterWindow::backupStart()
{
updateActions(true);
slotUpdateActions(true);
mAction = Backup;
mStoreIterator = mStored.constBegin();
const QDateTime now = QDateTime::currentDateTime();
......@@ -331,7 +357,7 @@ void PimSettingExporterWindow::backupFinished()
delete mImportExportData;
mImportExportData = 0;
KMessageBox::information(this, i18n("For restoring data, you must use \"pimsettingexporter\". Be careful it can overwrite existing settings, data."), i18n("Backup infos."), QLatin1String("ShowInfoBackupInfos"));
updateActions(false);
slotUpdateActions(false);
}
void PimSettingExporterWindow::slotAddInfo(const QString& info)
......@@ -458,7 +484,7 @@ void PimSettingExporterWindow::restoreNextStep()
void PimSettingExporterWindow::restoreStart()
{
updateActions(true);
slotUpdateActions(true);
mAction = Restore;
mStoreIterator = mStored.constBegin();
const int version = Utils::archiveVersion(mArchiveStorage->archive());
......@@ -486,7 +512,7 @@ void PimSettingExporterWindow::restoreFinished()
mArchiveStorage = 0;
delete mImportExportData;
mImportExportData = 0;
updateActions(false);
slotUpdateActions(false);
}
void PimSettingExporterWindow::executeJob()
......
......@@ -27,6 +27,7 @@ class KRecentFilesAction;
class KUrl;
class ArchiveStorage;
class KAction;
class PimSettingsBackupRestoreUI;
class PIMSETTINGEXPORT_EXPORT PimSettingExporterWindow: public KXmlGuiWindow
{
......@@ -48,14 +49,15 @@ private Q_SLOTS:
void slotShowStructureInfos();
void slotRestoreFile(const KUrl &url);
void slotShowArchiveInformations();
void slotUpdateActions(bool inAction);
void slotShowBackupFinishDialogInformation();
void slotJobFailed();
private:
enum Action {
Backup,
Restore
};
void updateActions(bool inAction);
void initializeBackupRestoreUi();
void backupNextStep();
void restoreNextStep();
void backupFinished();
......@@ -79,6 +81,8 @@ private:
KAction *mSaveLogAction;
KAction *mArchiveStructureInfo;
KAction *mShowArchiveInformationsAction;
PimSettingsBackupRestoreUI *mPimSettingsBackupRestoreUI;
};
......
......@@ -182,7 +182,6 @@ void PimSettingsBackupRestore::backupFinished()
delete mImportExportData;
mImportExportData = 0;
Q_EMIT backupDone();
Q_EMIT showBackupFinishDialogInformation();
Q_EMIT updateActions(false);
deleteLater();
}
......
......@@ -48,7 +48,6 @@ Q_SIGNALS:
void jobFinished();
void backupDone();
void jobFailed();
void showBackupFinishDialogInformation();
protected:
virtual bool continueToRestore();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment