00001
00002
00003
00004 #include "transportbase.h"
00005
00006 #include <klocale.h>
00007
00008 using namespace MailTransport;
00009
00010 TransportBase::TransportBase( const QString & transportId )
00011 : KConfigSkeleton( QLatin1String( "mailtransports" ) )
00012 , mParamtransportId(transportId)
00013 {
00014 setCurrentGroup( QString( QLatin1String( "Transport %1" ) ).arg( mParamtransportId ) );
00015
00016 mIdItem = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "id" ), mId, 0 );
00017 mIdItem->setLabel( i18n("Unique identifier") );
00018 addItem( mIdItem, QLatin1String( "id" ) );
00019 mNameItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "name" ), mName, i18n("Unnamed") );
00020 mNameItem->setLabel( i18n("User visible transport name") );
00021 mNameItem->setWhatsThis( i18n("The name that will be used when referring to this server.") );
00022 addItem( mNameItem, QLatin1String( "name" ) );
00023 QList<KConfigSkeleton::ItemEnum::Choice> valuestype;
00024 {
00025 KConfigSkeleton::ItemEnum::Choice choice;
00026 choice.name = QLatin1String( "SMTP" );
00027 choice.label = i18n("SMTP Server");
00028 i18n("");
00029 valuestype.append( choice );
00030 }
00031 {
00032 KConfigSkeleton::ItemEnum::Choice choice;
00033 choice.name = QLatin1String( "Sendmail" );
00034 choice.label = i18n("Local sendmail");
00035 i18n("");
00036 valuestype.append( choice );
00037 }
00038 mTypeItem = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "type" ), mType, valuestype, EnumType::SMTP );
00039 mTypeItem->setLabel( i18n("Transport type") );
00040 addItem( mTypeItem, QLatin1String( "type" ) );
00041 mHostItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "host" ), mHost );
00042 mHostItem->setLabel( i18n("Host name of the server") );
00043 mHostItem->setWhatsThis( i18n("The domain name or numerical address of the SMTP server.") );
00044 addItem( mHostItem, QLatin1String( "host" ) );
00045 mPortItem = new KConfigSkeleton::ItemUInt( currentGroup(), QLatin1String( "port" ), mPort, 25 );
00046 mPortItem->setLabel( i18n("Port number of the server") );
00047 mPortItem->setWhatsThis( i18n("The port number that the SMTP server is listening on. The default port is 25.") );
00048 addItem( mPortItem, QLatin1String( "port" ) );
00049 mUserNameItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "user" ), mUserName );
00050 mUserNameItem->setLabel( i18n("User name needed for login") );
00051 mUserNameItem->setWhatsThis( i18n("The user name to send to the server for authorization.") );
00052 addItem( mUserNameItem, QLatin1String( "userName" ) );
00053 mPrecommandItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "precommand" ), mPrecommand );
00054 mPrecommandItem->setLabel( i18n("Command to execute before sending a mail") );
00055 mPrecommandItem->setWhatsThis( i18n("\n"
00056 " A command to run locally, prior to sending email.\n"
00057 " This can be used to set up SSH tunnels, for example.\n"
00058 " Leave it empty if no command should be run.\n"
00059 " ") );
00060 addItem( mPrecommandItem, QLatin1String( "precommand" ) );
00061 mRequiresAuthenticationItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "auth" ), mRequiresAuthentication, false );
00062 mRequiresAuthenticationItem->setLabel( i18n("Server requires authentication") );
00063 mRequiresAuthenticationItem->setWhatsThis( i18n("\n"
00064 " Check this option if your SMTP server requires authentication before accepting mail.\n"
00065 " This is known as 'Authenticated SMTP' or simply ASMTP.\n"
00066 " ") );
00067 addItem( mRequiresAuthenticationItem, QLatin1String( "requiresAuthentication" ) );
00068 mStorePasswordItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "storepass" ), mStorePassword, false );
00069 mStorePasswordItem->setLabel( i18n("Store password") );
00070 mStorePasswordItem->setWhatsThis( i18n("\n"
00071 " Check this option to have your password stored.\n"
00072 " \\nIf KWallet is available the password will be stored there which is considered safe.\\n\n"
00073 " However, if KWallet is not available, the password will be stored in the configuration file.\n"
00074 " 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.\n"
00075 " ") );
00076 addItem( mStorePasswordItem, QLatin1String( "storePassword" ) );
00077 QList<KConfigSkeleton::ItemEnum::Choice> valuesencryption;
00078 {
00079 KConfigSkeleton::ItemEnum::Choice choice;
00080 choice.name = QLatin1String( "None" );
00081 choice.label = i18n("No encryption");
00082 i18n("");
00083 valuesencryption.append( choice );
00084 }
00085 {
00086 KConfigSkeleton::ItemEnum::Choice choice;
00087 choice.name = QLatin1String( "SSL" );
00088 choice.label = i18n("SSL encryption");
00089 i18n("");
00090 valuesencryption.append( choice );
00091 }
00092 {
00093 KConfigSkeleton::ItemEnum::Choice choice;
00094 choice.name = QLatin1String( "TLS" );
00095 choice.label = i18n("TLS encryption");
00096 i18n("");
00097 valuesencryption.append( choice );
00098 }
00099 mEncryptionItem = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "encryption" ), mEncryption, valuesencryption );
00100 mEncryptionItem->setLabel( i18n("Encryption method used for communication") );
00101 addItem( mEncryptionItem, QLatin1String( "encryption" ) );
00102 QList<KConfigSkeleton::ItemEnum::Choice> valuesauthenticationType;
00103 {
00104 KConfigSkeleton::ItemEnum::Choice choice;
00105 choice.name = QLatin1String( "LOGIN" );
00106 i18n("");
00107 valuesauthenticationType.append( choice );
00108 }
00109 {
00110 KConfigSkeleton::ItemEnum::Choice choice;
00111 choice.name = QLatin1String( "PLAIN" );
00112 i18n("");
00113 valuesauthenticationType.append( choice );
00114 }
00115 {
00116 KConfigSkeleton::ItemEnum::Choice choice;
00117 choice.name = QLatin1String( "CRAM_MD5" );
00118 i18n("");
00119 valuesauthenticationType.append( choice );
00120 }
00121 {
00122 KConfigSkeleton::ItemEnum::Choice choice;
00123 choice.name = QLatin1String( "DIGEST_MD5" );
00124 i18n("");
00125 valuesauthenticationType.append( choice );
00126 }
00127 {
00128 KConfigSkeleton::ItemEnum::Choice choice;
00129 choice.name = QLatin1String( "NTLM" );
00130 i18n("");
00131 valuesauthenticationType.append( choice );
00132 }
00133 {
00134 KConfigSkeleton::ItemEnum::Choice choice;
00135 choice.name = QLatin1String( "GSSAPI" );
00136 i18n("");
00137 valuesauthenticationType.append( choice );
00138 }
00139 {
00140 KConfigSkeleton::ItemEnum::Choice choice;
00141 choice.name = QLatin1String( "APOP" );
00142 i18n("");
00143 valuesauthenticationType.append( choice );
00144 }
00145 {
00146 KConfigSkeleton::ItemEnum::Choice choice;
00147 choice.name = QLatin1String( "CLEAR" );
00148 i18n("");
00149 valuesauthenticationType.append( choice );
00150 }
00151 {
00152 KConfigSkeleton::ItemEnum::Choice choice;
00153 choice.name = QLatin1String( "ANONYMOUS" );
00154 i18n("");
00155 valuesauthenticationType.append( choice );
00156 }
00157 mAuthenticationTypeItem = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "authtype" ), mAuthenticationType, valuesauthenticationType, EnumAuthenticationType::PLAIN );
00158 mAuthenticationTypeItem->setLabel( i18n("Authentication method") );
00159 addItem( mAuthenticationTypeItem, QLatin1String( "authenticationType" ) );
00160 mSpecifyHostnameItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "specifyHostname" ), mSpecifyHostname, false );
00161 mSpecifyHostnameItem->setLabel( i18n("specifyHostname") );
00162 mSpecifyHostnameItem->setWhatsThis( i18n("\n"
00163 " Check this option to use a custom hostname when identifying to the mail server.\n"
00164 " This is useful when your system's hostname may not be set correctly or to mask your system's true hostname.\n"
00165 " ") );
00166 addItem( mSpecifyHostnameItem, QLatin1String( "specifyHostname" ) );
00167 mLocalHostnameItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "localHostname" ), mLocalHostname );
00168 mLocalHostnameItem->setLabel( i18n("localHostname") );
00169 mLocalHostnameItem->setWhatsThis( i18n("Enter the hostname that should be used when identifying to the server.") );
00170 addItem( mLocalHostnameItem, QLatin1String( "localHostname" ) );
00171 }
00172
00173 TransportBase::~TransportBase()
00174 {
00175 }
00176