kmtransport.h
00001 /* 00002 * kmtransport.h 00003 * 00004 * Copyright (c) 2001-2002 Michael Haeckel <haeckel@kde.org> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License version 2 00008 * as published by the Free Software Foundation 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _KMTRANSPORT_H_ 00021 #define _KMTRANSPORT_H_ 00022 00023 #include <kdialogbase.h> 00024 00025 class TQCheckBox; 00026 class TQLabel; 00027 class TQLineEdit; 00028 class TQRadioButton; 00029 class KMServerTest; 00030 class TQButtonGroup; 00031 00032 class KMTransportInfo : public TQObject 00033 { 00034 public: 00035 KMTransportInfo(); 00036 virtual ~KMTransportInfo(); 00037 void readConfig(int id); 00038 void writeConfig(int id); 00039 static int findTransport(const TQString &name); 00040 static TQStringList availableTransports(); 00041 uint id() const { return mId; } 00042 00044 TQString passwd() const; 00045 void setPasswd( const TQString& passwd ); 00046 00048 bool storePasswd() const { return mStorePasswd; } 00049 void setStorePasswd( bool store ); 00050 00052 void readPassword() const; 00053 00054 TQString type, name, host, port, user, precommand, encryption, authType; 00055 TQString localHostname; 00056 bool auth, specifyHostname; 00057 00058 private: 00059 mutable TQString mPasswd; 00060 bool mPasswdDirty, mStorePasswd, mStorePasswdInConfig; 00061 uint mId; 00062 }; 00063 00064 class KMTransportSelDlg : public KDialogBase 00065 { 00066 Q_OBJECT 00067 00068 00069 public: 00070 KMTransportSelDlg( TQWidget *parent=0, const char *name=0, bool modal=TRUE ); 00071 int selected() const; 00072 00073 private slots: 00074 void buttonClicked( int id ); 00075 00076 private: 00077 int mSelectedButton; 00078 }; 00079 00080 class KMTransportDialog : public KDialogBase 00081 { 00082 Q_OBJECT 00083 00084 00085 public: 00086 KMTransportDialog( const TQString & caption, KMTransportInfo *transportInfo, 00087 TQWidget *parent=0, const char *name=0, bool modal=TRUE ); 00088 virtual ~KMTransportDialog(); 00089 00090 private slots: 00091 virtual void slotOk(); 00092 void slotSendmailChooser(); 00093 void slotRequiresAuthClicked(); 00094 void slotSmtpEncryptionChanged(int); 00095 void slotCheckSmtpCapabilities(); 00096 void slotSmtpCapabilities( const TQStringList &, const TQStringList &, 00097 const TQString &, const TQString &, 00098 const TQString & ); 00099 void slotSendmailEditPath(const TQString &); 00100 private: 00101 struct SendmailWidgets 00102 { 00103 TQLabel *titleLabel; 00104 TQLineEdit *nameEdit; 00105 TQLineEdit *locationEdit; 00106 TQPushButton *chooseButton; 00107 }; 00108 struct SmtpWidgets 00109 { 00110 TQLabel *titleLabel; 00111 TQLineEdit *nameEdit; 00112 TQLineEdit *hostEdit; 00113 TQLineEdit *portEdit; 00114 TQCheckBox *authCheck; 00115 TQLabel *loginLabel; 00116 TQLineEdit *loginEdit; 00117 TQLabel *passwordLabel; 00118 TQLineEdit *passwordEdit; 00119 TQLineEdit *precommand; 00120 TQButtonGroup *encryptionGroup; 00121 TQRadioButton *encryptionNone; 00122 TQRadioButton *encryptionSSL; 00123 TQRadioButton *encryptionTLS; 00124 TQButtonGroup *authGroup; 00125 TQRadioButton *authPlain; 00126 TQRadioButton *authLogin; 00127 TQRadioButton *authCramMd5; 00128 TQRadioButton *authDigestMd5; 00129 TQRadioButton *authNTLM; 00130 TQRadioButton *authGSSAPI; 00131 TQPushButton *checkCapabilities; 00132 TQCheckBox *storePasswordCheck; 00133 TQCheckBox *specifyHostnameCheck; 00134 TQLineEdit *localHostnameEdit; 00135 TQLabel *localHostnameLabel; 00136 }; 00137 00138 void makeSendmailPage(); 00139 void makeSmtpPage(); 00140 void setupSettings(); 00141 void saveSettings(); 00142 void checkHighest( TQButtonGroup * ); 00143 void enableAuthMethods( unsigned int which ); 00144 bool sanityCheckSmtpInput(); 00145 static unsigned int authMethodsFromString( const TQString & s ); 00146 static unsigned int authMethodsFromStringList( const TQStringList & sl ); 00147 00148 KMServerTest *mServerTest; 00149 SmtpWidgets mSmtp; 00150 SendmailWidgets mSendmail; 00151 KMTransportInfo *mTransportInfo; 00152 enum EncryptionMethods { 00153 NoEncryption = 0, 00154 SSL = 1, 00155 TLS = 2 00156 }; 00157 enum AuthMethods { 00158 NoAuth = 0, 00159 LOGIN = 1, 00160 PLAIN = 2, 00161 CRAM_MD5 = 4, 00162 DIGEST_MD5 = 8, 00163 NTLM = 16, 00164 GSSAPI = 32, 00165 AllAuth = 0xffffffff 00166 }; 00167 unsigned int mAuthNone, mAuthSSL, mAuthTLS; 00168 }; 00169 00170 00171 #endif