serversievesettings.h 2.79 KB
Newer Older
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   Copyright (C) 2013-2020 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
18
19
20
21
22
23
*/

#ifndef SERVERSIEVESETTINGS_H
#define SERVERSIEVESETTINGS_H

#include <QWidget>
24
#include "sieveeditorutil.h"
Laurent Montel's avatar
Laurent Montel committed
25
#include "libsieveeditor_private_export.h"
26

Laurent Montel's avatar
Laurent Montel committed
27
namespace Ui {
28
29
class ServerSieveSettings;
}
Laurent Montel's avatar
Laurent Montel committed
30
namespace MailTransport {
Laurent Montel's avatar
Laurent Montel committed
31
32
class ServerTest;
}
Laurent Montel's avatar
Laurent Montel committed
33
class QComboBox;
Laurent Montel's avatar
Laurent Montel committed
34
class LIBSIEVEEDITOR_TESTS_EXPORT ServerSieveSettings : public QWidget
35
36
37
38
{
    Q_OBJECT

public:
Laurent Montel's avatar
Laurent Montel committed
39
    explicit ServerSieveSettings(QWidget *parent = nullptr);
40
41
    ~ServerSieveSettings();

Laurent Montel's avatar
Laurent Montel committed
42
    Q_REQUIRED_RESULT QString serverName() const;
Laurent Montel's avatar
Laurent Montel committed
43
44
    void setServerName(const QString &name);

Laurent Montel's avatar
Laurent Montel committed
45
    Q_REQUIRED_RESULT int port() const;
Laurent Montel's avatar
Laurent Montel committed
46
47
    void setPort(int value);

Laurent Montel's avatar
Laurent Montel committed
48
    Q_REQUIRED_RESULT QString userName() const;
Laurent Montel's avatar
Laurent Montel committed
49
50
    void setUserName(const QString &name);

Laurent Montel's avatar
Laurent Montel committed
51
    Q_REQUIRED_RESULT QString password() const;
Laurent Montel's avatar
Laurent Montel committed
52
53
    void setPassword(const QString &pass);

54
    void setServerSieveConfig(const SieveEditorUtil::SieveServerConfig &conf);
Laurent Montel's avatar
Laurent Montel committed
55
    Q_REQUIRED_RESULT SieveEditorUtil::SieveServerConfig serverSieveConfig() const;
56

Laurent Montel's avatar
Laurent Montel committed
57
    Q_REQUIRED_RESULT QString imapServerName() const;
58
59
    void setImapServerName(const QString &name);

Laurent Montel's avatar
Laurent Montel committed
60
    Q_REQUIRED_RESULT int imapPort() const;
61
62
    void setImapPort(int value);

Laurent Montel's avatar
Laurent Montel committed
63
    Q_REQUIRED_RESULT QString imapUserName() const;
64
65
    void setImapUserName(const QString &name);

Laurent Montel's avatar
Laurent Montel committed
66
    Q_REQUIRED_RESULT QString imapPassword() const;
67
68
    void setImapPassword(const QString &pass);

69
    void setAuthenticationType(KSieveUi::SieveImapAccountSettings::AuthenticationMode type);
Laurent Montel's avatar
Laurent Montel committed
70
    Q_REQUIRED_RESULT KSieveUi::SieveImapAccountSettings::AuthenticationMode authenticationType() const;
Laurent Montel's avatar
Laurent Montel committed
71
72
73
Q_SIGNALS:
    void enableOkButton(bool enabled);

Laurent Montel's avatar
Laurent Montel committed
74
private:
75
    void slotUserServerNameChanged();
Laurent Montel's avatar
Laurent Montel committed
76
    void slotTest();
Laurent Montel's avatar
Laurent Montel committed
77

Laurent Montel's avatar
Laurent Montel committed
78
    void slotFinished(const QVector<int> &testResult);
Laurent Montel's avatar
Laurent Montel committed
79
    void slotEncryptionRadioChanged();
80
private:
Laurent Montel's avatar
Laurent Montel committed
81
82
83
    void populateDefaultAuthenticationOptions(QComboBox *combobox);
    void slotSafetyChanged();
    void populateDefaultComboBoxAuthenticationOptions();
Laurent Montel's avatar
Laurent Montel committed
84
    Ui::ServerSieveSettings *const ui;
Laurent Montel's avatar
Laurent Montel committed
85
    MailTransport::ServerTest *mServerTest = nullptr;
86
87
88
};

#endif // SERVERSIEVESETTINGS_H