File indexing completed on 2024-05-12 05:25:37

0001 /*
0002    SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 #include "utils.h"
0009 #include <KXmlGuiWindow>
0010 class LogWidget;
0011 class KRecentFilesMenu;
0012 class QAction;
0013 class QCommandLineParser;
0014 class PimDataBackupRestoreUI;
0015 class PimDataTrayIcon;
0016 class PimDataExporterWindow : public KXmlGuiWindow
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit PimDataExporterWindow(QWidget *parent = nullptr);
0021     ~PimDataExporterWindow() override;
0022     void handleCommandLine(const QCommandLineParser &parser);
0023 
0024 private:
0025     void slotBackupData();
0026     void slotRestoreData();
0027     void slotAddInfo(const QString &info);
0028     void slotAddError(const QString &info);
0029     void slotAddTitle(const QString &info);
0030     void slotAddEndLine();
0031     void slotSaveLog();
0032     void slotShowStructureInfos();
0033     void slotRestoreFile(const QUrl &url);
0034     void slotShowArchiveInformations();
0035     void slotUpdateActions(bool inAction);
0036     void slotShowBackupFinishDialogInformation();
0037     void slotJobFailed();
0038     void slotJobFinished();
0039     void slotShowCurrentArchiveInformations();
0040     void slotAddResourceToSync(const QString &name, const QString &identifier);
0041     void slotFullSyncFinished();
0042     void slotFullSyncInstanceDone(const QString &identifier);
0043     void slotFullSyncInstanceFailed(const QString &identifier);
0044     void slotRestoreDone();
0045     void slotConfigure();
0046 
0047 private:
0048     void initializeBackupRestoreUi();
0049     void backupData(const QString &filename = QString(), const QString &templateFile = QString());
0050     void loadData(const QString &filename = QString(), const QString &templateFile = QString());
0051     void setupActions(bool canZipFile);
0052     void showFinishInformation();
0053     void importDone();
0054     QString mLastArchiveFileName;
0055     bool mInProgress = false;
0056     // Name, identifier
0057     QHash<QString, QString> mNeedToSyncResources;
0058     LogWidget *const mLogWidget;
0059     KRecentFilesMenu *mRecentFilesMenu = nullptr;
0060     QAction *mBackupAction = nullptr;
0061     QAction *mRestoreAction = nullptr;
0062     QAction *mSaveLogAction = nullptr;
0063     QAction *mArchiveStructureInfo = nullptr;
0064     QAction *mShowArchiveInformationsAction = nullptr;
0065     QAction *mShowArchiveInformationsAboutCurrentArchiveAction = nullptr;
0066     PimDataBackupRestoreUI *mPimDataBackupRestoreUI = nullptr;
0067     PimDataTrayIcon *mTrayIcon = nullptr;
0068 };