File indexing completed on 2024-11-17 04:45:10

0001 /* This file is part of the KDE project
0002    SPDX-FileCopyrightText: 2010 Casey Link <unnamedrambler@gmail.com>
0003    SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0004    SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
0005    SPDX-FileCopyrightText: 2006-2008 Omat Holding B.V. <info@omat.nl>
0006 
0007    SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 class KJob;
0013 #include <Akonadi/Collection>
0014 #include <QDialog>
0015 
0016 #include <QRegularExpressionValidator>
0017 class QPushButton;
0018 class QComboBox;
0019 namespace Ui
0020 {
0021 class SetupServerView;
0022 }
0023 
0024 namespace MailTransport
0025 {
0026 class ServerTest;
0027 }
0028 namespace KIdentityManagementWidgets
0029 {
0030 class IdentityCombo;
0031 }
0032 class FolderArchiveSettingPage;
0033 class ImapResourceBase;
0034 
0035 /**
0036  * @class SetupServer
0037  * These contain the account settings
0038  * @author Tom Albers <tomalbers@kde.nl>
0039  */
0040 class SetupServer : public QDialog
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     /**
0046      * Constructor
0047      * @param parentResource The resource this dialog belongs to
0048      * @param parent Parent WId
0049      */
0050     explicit SetupServer(ImapResourceBase *parentResource, WId parent);
0051 
0052     /**
0053      * Destructor
0054      */
0055     ~SetupServer() override;
0056 
0057     [[nodiscard]] bool shouldClearCache() const;
0058 
0059 private:
0060     /**
0061      * Call this if you want the settings saved from this page.
0062      */
0063     void applySettings();
0064     void slotMailCheckboxChanged();
0065     void slotEncryptionRadioChanged();
0066     void slotSubcriptionCheckboxChanged();
0067     void slotShowServerInfo();
0068     void readSettings();
0069     void populateDefaultAuthenticationOptions();
0070 
0071     ImapResourceBase *const m_parentResource;
0072     Ui::SetupServerView *const m_ui;
0073     MailTransport::ServerTest *m_serverTest = nullptr;
0074     bool m_subscriptionsChanged = false;
0075     bool m_shouldClearCache = false;
0076     QString m_vacationFileName;
0077     KIdentityManagementWidgets::IdentityCombo *m_identityCombobox = nullptr;
0078     QString m_oldResourceName;
0079     QRegularExpressionValidator mValidator;
0080     Akonadi::Collection mOldTrash;
0081     FolderArchiveSettingPage *m_folderArchiveSettingPage = nullptr;
0082     QPushButton *mOkButton = nullptr;
0083 
0084 private Q_SLOTS:
0085     void slotTest();
0086     void slotFinished(const QList<int> &testResult);
0087     void slotCustomSieveChanged();
0088 
0089     void slotServerChanged();
0090     void slotTestChanged();
0091     void slotComplete();
0092     void slotSafetyChanged();
0093     void slotManageSubscriptions();
0094     void slotEnableWidgets();
0095     void targetCollectionReceived(const Akonadi::Collection::List &collections);
0096     void localFolderRequestJobFinished(KJob *job);
0097     void populateDefaultAuthenticationOptions(QComboBox *combo);
0098 };