Libksieve

sieveimapaccountsettings.cpp
1 /*
2  SPDX-FileCopyrightText: 2016-2020 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "sieveimapaccountsettings.h"
8 
9 using namespace KSieveUi;
10 
11 SieveImapAccountSettings::SieveImapAccountSettings()
12 {
13 }
14 
15 QString SieveImapAccountSettings::identifier() const
16 {
17  return mUserName + QLatin1Char('_') + mServerName;
18 }
19 
20 void SieveImapAccountSettings::setServerName(const QString &server)
21 {
22  mServerName = server;
23 }
24 
25 QString SieveImapAccountSettings::serverName() const
26 {
27  return mServerName;
28 }
29 
30 void SieveImapAccountSettings::setPort(int port)
31 {
32  mPort = port;
33 }
34 
35 int SieveImapAccountSettings::port() const
36 {
37  return mPort;
38 }
39 
40 void SieveImapAccountSettings::setUserName(const QString &userName)
41 {
42  mUserName = userName;
43 }
44 
45 QString SieveImapAccountSettings::userName() const
46 {
47  return mUserName;
48 }
49 
50 void SieveImapAccountSettings::setPassword(const QString &password)
51 {
52  mPassword = password;
53 }
54 
55 QString SieveImapAccountSettings::password() const
56 {
57  return mPassword;
58 }
59 
60 void SieveImapAccountSettings::setAuthenticationType(AuthenticationMode type)
61 {
62  mAuthenticationType = type;
63 }
64 
65 KSieveUi::SieveImapAccountSettings::AuthenticationMode SieveImapAccountSettings::authenticationType() const
66 {
67  return mAuthenticationType;
68 }
69 
70 bool SieveImapAccountSettings::operator==(const SieveImapAccountSettings &other) const
71 {
72  return (mServerName == other.serverName())
73  && (mPassword == other.password())
74  && (mPort == other.port())
75  && (mUserName == other.userName())
76  && (mAuthenticationType == other.authenticationType())
77  && (mEncryptionMode == other.encryptionMode());
78 }
79 
80 bool SieveImapAccountSettings::isValid() const
81 {
82  return !mServerName.isEmpty() && !mPassword.isEmpty() && (mPort != -1) && (!mUserName.isEmpty());
83 }
84 
85 SieveImapAccountSettings::EncryptionMode SieveImapAccountSettings::encryptionMode() const
86 {
87  return mEncryptionMode;
88 }
89 
90 void SieveImapAccountSettings::setEncryptionMode(SieveImapAccountSettings::EncryptionMode encryptionMode)
91 {
92  mEncryptionMode = encryptionMode;
93 }
94 
95 QDebug operator <<(QDebug d, const SieveImapAccountSettings &settings)
96 {
97  d << "serverName " << settings.serverName();
98  d << "userName " << settings.userName();
99  d << "password " << settings.password();
100  d << "authenticationType " << settings.authenticationType();
101  d << "port " << settings.port();
102  d << "encryptionMode : " << settings.encryptionMode();
103  return d;
104 }
bool isEmpty() const const
The SieveImapAccountSettings class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 23:10:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.