Libksieve

sieveimapaccountsettings.cpp
1 /*
2  SPDX-FileCopyrightText: 2016-2021 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()) && (mPassword == other.password()) && (mPort == other.port()) && (mUserName == other.userName())
73  && (mAuthenticationType == other.authenticationType()) && (mEncryptionMode == other.encryptionMode());
74 }
75 
76 bool SieveImapAccountSettings::isValid() const
77 {
78  return !mServerName.isEmpty() && !mPassword.isEmpty() && (mPort != -1) && (!mUserName.isEmpty());
79 }
80 
81 SieveImapAccountSettings::EncryptionMode SieveImapAccountSettings::encryptionMode() const
82 {
83  return mEncryptionMode;
84 }
85 
86 void SieveImapAccountSettings::setEncryptionMode(SieveImapAccountSettings::EncryptionMode encryptionMode)
87 {
88  mEncryptionMode = encryptionMode;
89 }
90 
92 {
93  d << "serverName " << settings.serverName();
94  d << "userName " << settings.userName();
95  d << "password " << settings.password();
96  d << "authenticationType " << settings.authenticationType();
97  d << "port " << settings.port();
98  d << "encryptionMode : " << settings.encryptionMode();
99  return d;
100 }
bool isEmpty() const const
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
The SieveImapAccountSettings class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 9 2021 23:09:29 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.