4 #include "transportbase.h"
8 using namespace MailTransport;
10 TransportBase::TransportBase(
const QString & transportId )
11 : KConfigSkeleton( QLatin1String(
"mailtransports" ) )
12 , mParamtransportId(transportId)
14 setCurrentGroup( QString( QLatin1String(
"Transport %1" ) ).arg( mParamtransportId ) );
16 mIdItem =
new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String(
"id" ), mId, 0 );
17 mIdItem->setLabel( i18n(
"Unique identifier") );
18 addItem( mIdItem, QLatin1String(
"id" ) );
19 mNameItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"name" ), mName, i18n(
"Unnamed") );
20 mNameItem->setLabel( i18n(
"User-visible transport name") );
21 mNameItem->setWhatsThis( i18n(
"The name that will be used when referring to this server.") );
22 addItem( mNameItem, QLatin1String(
"name" ) );
23 QList<KConfigSkeleton::ItemEnum::Choice2> valuestype;
25 KConfigSkeleton::ItemEnum::Choice2 choice;
26 choice.name = QLatin1String(
"SMTP");
27 choice.label = i18n(
"SMTP Server");
28 valuestype.append( choice );
31 KConfigSkeleton::ItemEnum::Choice2 choice;
32 choice.name = QLatin1String(
"Sendmail");
33 choice.label = i18n(
"Local sendmail");
34 valuestype.append( choice );
37 KConfigSkeleton::ItemEnum::Choice2 choice;
38 choice.name = QLatin1String(
"Akonadi");
39 choice.label = i18n(
"Akonadi Resource");
40 valuestype.append( choice );
42 mTypeItem =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"type" ), mType, valuestype, EnumType::SMTP );
43 mTypeItem->setLabel( i18n(
"Transport type") );
44 addItem( mTypeItem, QLatin1String(
"type" ) );
45 mHostItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"host" ), mHost );
46 mHostItem->setLabel( i18n(
"Host name of the server") );
47 mHostItem->setWhatsThis( i18n(
"The domain name or numerical address of the SMTP server.") );
48 addItem( mHostItem, QLatin1String(
"host" ) );
49 mPortItem =
new KConfigSkeleton::ItemUInt( currentGroup(), QLatin1String(
"port" ), mPort, 25 );
50 mPortItem->setLabel( i18n(
"Port number of the server") );
51 mPortItem->setWhatsThis( i18n(
"The port number that the SMTP server is listening on. The default port is 25.") );
52 addItem( mPortItem, QLatin1String(
"port" ) );
53 mUserNameItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"user" ), mUserName );
54 mUserNameItem->setLabel( i18n(
"User name needed for login") );
55 mUserNameItem->setWhatsThis( i18n(
"The user name to send to the server for authorization.") );
56 addItem( mUserNameItem, QLatin1String(
"userName" ) );
57 mPrecommandItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"precommand" ), mPrecommand );
58 mPrecommandItem->setLabel( i18n(
"Command to execute before sending a mail") );
59 mPrecommandItem->setWhatsThis( i18n(
"A command to run locally, prior to sending email. This can be used to set up SSH tunnels, for example. Leave it empty if no command should be run.") );
60 addItem( mPrecommandItem, QLatin1String(
"precommand" ) );
61 mRequiresAuthenticationItem =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"auth" ), mRequiresAuthentication,
false );
62 mRequiresAuthenticationItem->setLabel( i18n(
"Server requires authentication") );
63 mRequiresAuthenticationItem->setWhatsThis( i18n(
"Check this option if your SMTP server requires authentication before accepting mail. This is known as 'Authenticated SMTP' or simply ASMTP.") );
64 addItem( mRequiresAuthenticationItem, QLatin1String(
"requiresAuthentication" ) );
65 mStorePasswordItem =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"storepass" ), mStorePassword,
false );
66 mStorePasswordItem->setLabel( i18n(
"Store password") );
67 mStorePasswordItem->setWhatsThis( i18n(
"Check this option to have your password stored.\n"
68 "If KWallet is available the password will be stored there, which is considered safe.\n"
69 "However, if KWallet is not available, the password will be stored in the configuration file. The password is stored in an obfuscated format, but should not be considered secure from decryption efforts if access to the configuration file is obtained.") );
70 addItem( mStorePasswordItem, QLatin1String(
"storePassword" ) );
71 QList<KConfigSkeleton::ItemEnum::Choice2> valuesencryption;
73 KConfigSkeleton::ItemEnum::Choice2 choice;
74 choice.name = QLatin1String(
"None");
75 choice.label = i18n(
"No encryption");
76 valuesencryption.append( choice );
79 KConfigSkeleton::ItemEnum::Choice2 choice;
80 choice.name = QLatin1String(
"SSL");
81 choice.label = i18n(
"SSL encryption");
82 valuesencryption.append( choice );
85 KConfigSkeleton::ItemEnum::Choice2 choice;
86 choice.name = QLatin1String(
"TLS");
87 choice.label = i18n(
"TLS encryption");
88 valuesencryption.append( choice );
90 mEncryptionItem =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"encryption" ), mEncryption, valuesencryption );
91 mEncryptionItem->setLabel( i18n(
"Encryption method used for communication") );
92 addItem( mEncryptionItem, QLatin1String(
"encryption" ) );
93 QList<KConfigSkeleton::ItemEnum::Choice2> valuesauthenticationType;
95 KConfigSkeleton::ItemEnum::Choice2 choice;
96 choice.name = QLatin1String(
"LOGIN");
97 valuesauthenticationType.append( choice );
100 KConfigSkeleton::ItemEnum::Choice2 choice;
101 choice.name = QLatin1String(
"PLAIN");
102 valuesauthenticationType.append( choice );
105 KConfigSkeleton::ItemEnum::Choice2 choice;
106 choice.name = QLatin1String(
"CRAM_MD5");
107 valuesauthenticationType.append( choice );
110 KConfigSkeleton::ItemEnum::Choice2 choice;
111 choice.name = QLatin1String(
"DIGEST_MD5");
112 valuesauthenticationType.append( choice );
115 KConfigSkeleton::ItemEnum::Choice2 choice;
116 choice.name = QLatin1String(
"GSSAPI");
117 valuesauthenticationType.append( choice );
120 KConfigSkeleton::ItemEnum::Choice2 choice;
121 choice.name = QLatin1String(
"NTLM");
122 valuesauthenticationType.append( choice );
125 KConfigSkeleton::ItemEnum::Choice2 choice;
126 choice.name = QLatin1String(
"APOP");
127 valuesauthenticationType.append( choice );
130 KConfigSkeleton::ItemEnum::Choice2 choice;
131 choice.name = QLatin1String(
"CLEAR");
132 valuesauthenticationType.append( choice );
135 KConfigSkeleton::ItemEnum::Choice2 choice;
136 choice.name = QLatin1String(
"ANONYMOUS");
137 valuesauthenticationType.append( choice );
139 mAuthenticationTypeItem =
new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String(
"authtype" ), mAuthenticationType, valuesauthenticationType, EnumAuthenticationType::PLAIN );
140 mAuthenticationTypeItem->setLabel( i18n(
"Authentication method") );
141 addItem( mAuthenticationTypeItem, QLatin1String(
"authenticationType" ) );
142 mSpecifyHostnameItem =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"specifyHostname" ), mSpecifyHostname,
false );
143 mSpecifyHostnameItem->setLabel( i18n(
"specifyHostname") );
144 mSpecifyHostnameItem->setWhatsThis( i18n(
"Check this option to use a custom hostname when identifying to the mail server. This is useful when your system's hostname may not be set correctly or to mask your system's true hostname.") );
145 addItem( mSpecifyHostnameItem, QLatin1String(
"specifyHostname" ) );
146 mLocalHostnameItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"localHostname" ), mLocalHostname );
147 mLocalHostnameItem->setLabel( i18n(
"localHostname") );
148 mLocalHostnameItem->setWhatsThis( i18n(
"Enter the hostname that should be used when identifying to the server.") );
149 addItem( mLocalHostnameItem, QLatin1String(
"localHostname" ) );
150 mSpecifySenderOverwriteAddressItem =
new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String(
"specifySenderOverwriteAddress" ), mSpecifySenderOverwriteAddress,
false );
151 mSpecifySenderOverwriteAddressItem->setLabel( i18n(
"specifySenderOverwriteAddress") );
152 mSpecifySenderOverwriteAddressItem->setWhatsThis( i18n(
"Check this option to use a custom sender address when identifying to the mail server. If not checked, the address from the identity is used.") );
153 addItem( mSpecifySenderOverwriteAddressItem, QLatin1String(
"specifySenderOverwriteAddress" ) );
154 mSenderOverwriteAddressItem =
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String(
"senderOverwriteAddress" ), mSenderOverwriteAddress );
155 mSenderOverwriteAddressItem->setLabel( i18n(
"senderOverwriteAddress") );
156 mSenderOverwriteAddressItem->setWhatsThis( i18n(
"Enter the address that should be used to overwrite the default sender address.") );
157 addItem( mSenderOverwriteAddressItem, QLatin1String(
"senderOverwriteAddress" ) );
160 TransportBase::~TransportBase()