Merge remote-tracking branch 'origin/Applications/16.08'
[kdepim.git] / importwizard / src / importwizard.h
blobecdf739cb50513682992e7a488d9ef2fb5b3f410
1 /*
2 Copyright (C) 2012-2016 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
19 #ifndef IMPORTWIZARD_H
20 #define IMPORTWIZARD_H
22 #include "abstractimporter.h"
24 #include <KAssistantDialog>
26 class KPageWidgetItem;
27 class SelectProgramPage;
28 class SelectComponentPage;
29 class ImportMailPage;
30 class ImportFilterPage;
31 class ImportSettingPage;
32 class ImportAddressbookPage;
33 class ImportFinishPage;
34 class ImportCalendarPage;
35 class AbstractImporter;
36 class ManualSelectFilterPage;
37 class ManualImportMailPage;
39 namespace Akonadi
41 class Collection;
43 class ImportWizard : public KAssistantDialog
45 Q_OBJECT
46 public:
47 enum WizardMode {
48 AutoDetect = 0,
49 Manual = 1
52 explicit ImportWizard(WizardMode mode, QWidget *parent = Q_NULLPTR);
53 ~ImportWizard();
55 void next() Q_DECL_OVERRIDE;
56 void reject() Q_DECL_OVERRIDE;
57 void back() Q_DECL_OVERRIDE;
59 ImportMailPage *importMailPage() const;
60 ImportFilterPage *importFilterPage() const;
61 ImportAddressbookPage *importAddressBookPage() const;
62 ImportSettingPage *importSettingPage() const;
63 ImportFinishPage *importFinishPage() const;
64 ImportCalendarPage *importCalendarPage() const;
66 void addFinishInfo(const QString &log);
67 void addFinishError(const QString &log);
69 private Q_SLOTS:
70 void slotProgramSelected(const QString &program);
71 void slotImportMailsClicked();
72 void slotImportFiltersClicked();
73 void slotProgramDoubleClicked();
74 void slotAtLeastOneComponentSelected(bool b);
75 void slotImportSettingsClicked();
76 void slotImportAddressbookClicked();
77 void slotImportCalendarClicked();
78 void slotSelectManualSelectionChanged(bool b);
79 void slotCollectionChanged(const Akonadi::Collection &selectedCollection);
81 private:
82 void readConfig();
83 void writeConfig();
84 void initializeImportModule();
85 void createAutomaticModePage();
86 void addImportModule(AbstractImporter *);
87 void checkModules();
88 void setAppropriatePage(AbstractImporter::TypeSupportedOptions options);
89 void enableAllImportButton();
90 void createManualModePage();
91 void updatePagesFromMode();
93 QMap<QString, AbstractImporter *> mlistImport;
95 WizardMode mMode;
96 AbstractImporter *mSelectedPim;
98 KPageWidgetItem *mSelectProgramPageItem;
99 KPageWidgetItem *mSelectComponentPageItem;
100 KPageWidgetItem *mImportMailPageItem;
101 KPageWidgetItem *mImportFilterPageItem;
102 KPageWidgetItem *mImportSettingPageItem;
103 KPageWidgetItem *mImportAddressbookPageItem;
104 KPageWidgetItem *mImportCalendarPageItem;
105 KPageWidgetItem *mImportFinishPageItem;
107 SelectProgramPage *mSelectProgramPage;
108 SelectComponentPage *mSelectComponentPage;
109 ImportMailPage *mImportMailPage;
110 ImportFilterPage *mImportFilterPage;
111 ImportSettingPage *mImportSettingPage;
112 ImportAddressbookPage *mImportAddressbookPage;
113 ImportFinishPage *mImportFinishPage;
114 ImportCalendarPage *mImportCalendarPage;
116 ManualSelectFilterPage *mSelfilterpage;
117 ManualImportMailPage *mImportpage;
118 KPageWidgetItem *mSelfilterpageItem;
119 KPageWidgetItem *mImportpageItem;
122 #endif /* IMPORTWIZARD_H */