1 /* This file is part of the KDE project
2    SPDX-FileCopyrightText: 2010 Casey Link <unnamedrambler@gmail.com>
3    SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4    SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
5    SPDX-FileCopyrightText: 2006-2008 Omat Holding B.V. <info@omat.nl>
6 
7    SPDX-License-Identifier: GPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 class KJob;
13 #include <Akonadi/Collection>
14 #include <QDialog>
15 
16 #include <QRegularExpressionValidator>
17 class QPushButton;
18 class QComboBox;
19 namespace Ui
20 {
21 class SetupServerView;
22 }
23 
24 namespace MailTransport
25 {
26 class ServerTest;
27 }
28 namespace KIdentityManagement
29 {
30 class IdentityCombo;
31 }
32 class FolderArchiveSettingPage;
33 class ImapResourceBase;
34 
35 /**
36  * @class SetupServer
37  * These contain the account settings
38  * @author Tom Albers <tomalbers@kde.nl>
39  */
40 class SetupServer : public QDialog
41 {
42     Q_OBJECT
43 
44 public:
45     /**
46      * Constructor
47      * @param parentResource The resource this dialog belongs to
48      * @param parent Parent WId
49      */
50     SetupServer(ImapResourceBase *parentResource, WId parent);
51 
52     /**
53      * Destructor
54      */
55     ~SetupServer() override;
56 
57     bool shouldClearCache() const;
58 
59 private Q_SLOTS:
60     /**
61      * Call this if you want the settings saved from this page.
62      */
63     void applySettings();
64     void slotMailCheckboxChanged();
65     void slotEncryptionRadioChanged();
66     void slotSubcriptionCheckboxChanged();
67     void slotShowServerInfo();
68 
69 private:
70     void readSettings();
71     void populateDefaultAuthenticationOptions();
72 
73     ImapResourceBase *const m_parentResource;
74     Ui::SetupServerView *const m_ui;
75     MailTransport::ServerTest *m_serverTest = nullptr;
76     bool m_subscriptionsChanged = false;
77     bool m_shouldClearCache = false;
78     QString m_vacationFileName;
79     KIdentityManagement::IdentityCombo *m_identityCombobox = nullptr;
80     QString m_oldResourceName;
81     QRegularExpressionValidator mValidator;
82     Akonadi::Collection mOldTrash;
83     FolderArchiveSettingPage *m_folderArchiveSettingPage = nullptr;
84     QPushButton *mOkButton = nullptr;
85 
86 private Q_SLOTS:
87     void slotTest();
88     void slotFinished(const QVector<int> &testResult);
89     void slotCustomSieveChanged();
90 
91     void slotServerChanged();
92     void slotTestChanged();
93     void slotComplete();
94     void slotSafetyChanged();
95     void slotManageSubscriptions();
96     void slotEnableWidgets();
97     void targetCollectionReceived(const Akonadi::Collection::List &collections);
98     void localFolderRequestJobFinished(KJob *job);
99     void populateDefaultAuthenticationOptions(QComboBox *combo);
100 };
101 
102