File indexing completed on 2024-11-24 04:49:53
0001 /* 0002 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "sieveimapaccountsettings.h" 0008 0009 using namespace KSieveCore; 0010 0011 SieveImapAccountSettings::SieveImapAccountSettings() = default; 0012 0013 QString SieveImapAccountSettings::identifier() const 0014 { 0015 return mUserName + QLatin1Char('_') + mServerName; 0016 } 0017 0018 void SieveImapAccountSettings::setServerName(const QString &server) 0019 { 0020 mServerName = server; 0021 } 0022 0023 QString SieveImapAccountSettings::serverName() const 0024 { 0025 return mServerName; 0026 } 0027 0028 void SieveImapAccountSettings::setPort(int port) 0029 { 0030 mPort = port; 0031 } 0032 0033 int SieveImapAccountSettings::port() const 0034 { 0035 return mPort; 0036 } 0037 0038 void SieveImapAccountSettings::setUserName(const QString &userName) 0039 { 0040 mUserName = userName; 0041 } 0042 0043 QString SieveImapAccountSettings::userName() const 0044 { 0045 return mUserName; 0046 } 0047 0048 void SieveImapAccountSettings::setPassword(const QString &password) 0049 { 0050 mPassword = password; 0051 } 0052 0053 QString SieveImapAccountSettings::password() const 0054 { 0055 return mPassword; 0056 } 0057 0058 void SieveImapAccountSettings::setAuthenticationType(AuthenticationMode type) 0059 { 0060 mAuthenticationType = type; 0061 } 0062 0063 KSieveCore::SieveImapAccountSettings::AuthenticationMode SieveImapAccountSettings::authenticationType() const 0064 { 0065 return mAuthenticationType; 0066 } 0067 0068 bool SieveImapAccountSettings::operator==(const SieveImapAccountSettings &other) const 0069 { 0070 return (mServerName == other.serverName()) && (mPassword == other.password()) && (mPort == other.port()) && (mUserName == other.userName()) 0071 && (mAuthenticationType == other.authenticationType()) && (mEncryptionMode == other.encryptionMode()); 0072 } 0073 0074 bool SieveImapAccountSettings::isValid() const 0075 { 0076 return !mServerName.isEmpty() && !mPassword.isEmpty() && (mPort != -1) && (!mUserName.isEmpty()); 0077 } 0078 0079 SieveImapAccountSettings::EncryptionMode SieveImapAccountSettings::encryptionMode() const 0080 { 0081 return mEncryptionMode; 0082 } 0083 0084 void SieveImapAccountSettings::setEncryptionMode(SieveImapAccountSettings::EncryptionMode encryptionMode) 0085 { 0086 mEncryptionMode = encryptionMode; 0087 } 0088 0089 QDebug operator<<(QDebug d, const SieveImapAccountSettings &settings) 0090 { 0091 d << "serverName " << settings.serverName(); 0092 d << "userName " << settings.userName(); 0093 d << "password " << settings.password(); 0094 d << "authenticationType " << settings.authenticationType(); 0095 d << "port " << settings.port(); 0096 d << "encryptionMode : " << settings.encryptionMode(); 0097 return d; 0098 }