kmail
accountdialog.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _ACCOUNT_DIALOG_H_
00024 #define _ACCOUNT_DIALOG_H_
00025
00026 #include <kdialogbase.h>
00027 #include <klistview.h>
00028 #include <klineedit.h>
00029 #include <qguardedptr.h>
00030 #include "imapaccountbase.h"
00031
00032 class QRegExpValidator;
00033 class QCheckBox;
00034 class QComboBox;
00035 class QPushButton;
00036 class QLabel;
00037 class QLineEdit;
00038 class QRadioButton;
00039 class QToolButton;
00040 class KIntNumInput;
00041 class KMAccount;
00042 class KMFolder;
00043 class KMServerTest;
00044 class QButtonGroup;
00045
00046 namespace KMail {
00047
00048 class SieveConfigEditor;
00049 class FolderRequester;
00050
00051 class AccountDialog : public KDialogBase
00052 {
00053 Q_OBJECT
00054
00055 public:
00056 AccountDialog( const QString & caption, KMAccount *account,
00057 QWidget *parent=0, const char *name=0, bool modal=true );
00058 virtual ~AccountDialog();
00059 private:
00060 struct LocalWidgets
00061 {
00062 QLabel *titleLabel;
00063 QLineEdit *nameEdit;
00064 QComboBox *locationEdit;
00065 QRadioButton *lockMutt;
00066 QRadioButton *lockMuttPriv;
00067 QRadioButton *lockProcmail;
00068 QComboBox *procmailLockFileName;
00069 QRadioButton *lockFcntl;
00070 QRadioButton *lockNone;
00071 QLineEdit *precommand;
00072 #if 0
00073 QCheckBox *resourceCheck;
00074 QPushButton *resourceClearButton;
00075 QPushButton *resourceClearPastButton;
00076 #endif
00077 QCheckBox *includeInCheck;
00078 QCheckBox *intervalCheck;
00079 QLabel *intervalLabel;
00080 KIntNumInput *intervalSpin;
00081 QComboBox *folderCombo;
00082 QComboBox *identityCombo;
00083 };
00084
00085 struct MaildirWidgets
00086 {
00087 QLabel *titleLabel;
00088 QLineEdit *nameEdit;
00089 QComboBox *locationEdit;
00090 QLineEdit *precommand;
00091 #if 0
00092 QCheckBox *resourceCheck;
00093 QPushButton *resourceClearButton;
00094 QPushButton *resourceClearPastButton;
00095 #endif
00096 QCheckBox *includeInCheck;
00097 QCheckBox *intervalCheck;
00098 QLabel *intervalLabel;
00099 KIntNumInput *intervalSpin;
00100 QComboBox *folderCombo;
00101 QComboBox *identityCombo;
00102 };
00103
00104 struct PopWidgets
00105 {
00106 QLabel *titleLabel;
00107 QLineEdit *nameEdit;
00108 QLineEdit *loginEdit;
00109 QLineEdit *passwordEdit;
00110 QLineEdit *hostEdit;
00111 QLineEdit *portEdit;
00112 QLineEdit *precommand;
00113 QButtonGroup *encryptionGroup;
00114 QRadioButton *encryptionNone;
00115 QRadioButton *encryptionSSL;
00116 QRadioButton *encryptionTLS;
00117 QButtonGroup *authGroup;
00118 QRadioButton *authUser;
00119 QRadioButton *authPlain;
00120 QRadioButton *authLogin;
00121 QRadioButton *authCRAM_MD5;
00122 QRadioButton *authDigestMd5;
00123 QRadioButton *authNTLM;
00124 QRadioButton *authGSSAPI;
00125 QRadioButton *authAPOP;
00126
00127 QPushButton *checkCapabilities;
00128 QCheckBox *usePipeliningCheck;
00129 QCheckBox *storePasswordCheck;
00130 QCheckBox *leaveOnServerCheck;
00131 QCheckBox *leaveOnServerDaysCheck;
00132 KIntNumInput *leaveOnServerDaysSpin;
00133 QCheckBox *leaveOnServerCountCheck;
00134 KIntNumInput *leaveOnServerCountSpin;
00135 QCheckBox *leaveOnServerSizeCheck;
00136 KIntNumInput *leaveOnServerSizeSpin;
00137 #if 0
00138 QCheckBox *resourceCheck;
00139 QPushButton *resourceClearButton;
00140 QPushButton *resourceClearPastButton;
00141 #endif
00142 QCheckBox *includeInCheck;
00143 QCheckBox *intervalCheck;
00144 QCheckBox *filterOnServerCheck;
00145 QLabel *intervalLabel;
00146 KIntNumInput *intervalSpin;
00147 KIntNumInput *filterOnServerSizeSpin;
00148 QComboBox *folderCombo;
00149 QComboBox *identityCombo;
00150 };
00151
00152 struct ImapWidgets
00153 {
00154 QLabel *titleLabel;
00155 QLineEdit *nameEdit;
00156 QLineEdit *loginEdit;
00157 QLineEdit *passwordEdit;
00158 QLineEdit *hostEdit;
00159 QLineEdit *portEdit;
00160 #if 0
00161 QCheckBox *resourceCheck;
00162 QPushButton *resourceClearButton;
00163 QPushButton *resourceClearPastButton;
00164 #endif
00165 QCheckBox *autoExpungeCheck;
00166 QCheckBox *hiddenFoldersCheck;
00167 QCheckBox *subscribedFoldersCheck;
00168 QCheckBox *locallySubscribedFoldersCheck;
00169 QCheckBox *loadOnDemandCheck;
00170 QCheckBox *storePasswordCheck;
00171 QCheckBox *progressDialogCheck;
00172 QCheckBox *includeInCheck;
00173 QCheckBox *intervalCheck;
00174 QCheckBox *listOnlyOpenCheck;
00175 QLabel *intervalLabel;
00176 KIntNumInput *intervalSpin;
00177 QButtonGroup *encryptionGroup;
00178 QRadioButton *encryptionNone;
00179 QRadioButton *encryptionSSL;
00180 QRadioButton *encryptionTLS;
00181 QButtonGroup *authGroup;
00182 QRadioButton *authUser;
00183 QRadioButton *authPlain;
00184 QRadioButton *authLogin;
00185 QRadioButton *authCramMd5;
00186 QRadioButton *authDigestMd5;
00187 QRadioButton *authGSSAPI;
00188 QRadioButton *authNTLM;
00189 QRadioButton *authAnonymous;
00190 QPushButton *checkCapabilities;
00191 FolderRequester *trashCombo;
00192 KLineEdit *personalNS;
00193 KLineEdit *otherUsersNS;
00194 KLineEdit *sharedNS;
00195 QToolButton *editPNS;
00196 QToolButton *editONS;
00197 QToolButton *editSNS;
00198 ImapAccountBase::nsDelimMap nsMap;
00199 };
00200
00201 private slots:
00202 virtual void slotOk();
00203 void slotLocationChooser();
00204 void slotMaildirChooser();
00205 void slotEnablePopInterval( bool state );
00206 void slotEnableImapInterval( bool state );
00207 void slotEnableLocalInterval( bool state );
00208 void slotEnableMaildirInterval( bool state );
00209 void slotFontChanged();
00210 void slotLeaveOnServerClicked();
00211 void slotEnableLeaveOnServerDays( bool state );
00212 void slotEnableLeaveOnServerCount( bool state );
00213 void slotEnableLeaveOnServerSize( bool state );
00214 void slotFilterOnServerClicked();
00215 void slotPipeliningClicked();
00216 void slotPopEncryptionChanged(int);
00217 void slotImapEncryptionChanged(int);
00218 void slotCheckPopCapabilities();
00219 void slotCheckImapCapabilities();
00220 void slotPopCapabilities( const QStringList &, const QStringList & );
00221 void slotImapCapabilities( const QStringList &, const QStringList & );
00222 void slotReloadNamespaces();
00223 void slotSetupNamespaces( const ImapAccountBase::nsDelimMap& map );
00224 void slotEditPersonalNamespace();
00225 void slotEditOtherUsersNamespace();
00226 void slotEditSharedNamespace();
00227 void slotConnectionResult( int errorCode, const QString& );
00228 void slotLeaveOnServerDaysChanged( int value );
00229 void slotLeaveOnServerCountChanged( int value );
00230 void slotFilterOnServerSizeChanged( int value );
00231 #if 0
00232
00233
00234
00235 #endif
00236
00237 private:
00238 void makeLocalAccountPage();
00239 void makeMaildirAccountPage();
00240 void makePopAccountPage();
00241 void makeImapAccountPage( bool disconnected = false );
00242 void setupSettings();
00243 void saveSettings();
00244 void checkHighest( QButtonGroup * );
00245 static unsigned int popCapabilitiesFromStringList( const QStringList & );
00246 static unsigned int imapCapabilitiesFromStringList( const QStringList & );
00247 void enablePopFeatures( unsigned int );
00248 void enableImapAuthMethods( unsigned int );
00249 void initAccountForConnect();
00250 const QString namespaceListToString( const QStringList& list );
00251
00252 private:
00253 LocalWidgets mLocal;
00254 MaildirWidgets mMaildir;
00255 PopWidgets mPop;
00256 ImapWidgets mImap;
00257 KMAccount *mAccount;
00258 QValueList<QGuardedPtr<KMFolder> > mFolderList;
00259 QStringList mFolderNames;
00260 KMServerTest *mServerTest;
00261 enum EncryptionMethods {
00262 NoEncryption = 0,
00263 SSL = 1,
00264 TLS = 2
00265 };
00266 enum Capabilities {
00267 Plain = 1,
00268 Login = 2,
00269 CRAM_MD5 = 4,
00270 Digest_MD5 = 8,
00271 Anonymous = 16,
00272 APOP = 32,
00273 Pipelining = 64,
00274 TOP = 128,
00275 UIDL = 256,
00276 STLS = 512,
00277 STARTTLS = 512,
00278 GSSAPI = 1024,
00279 NTLM = 2048,
00280 AllCapa = 0xffffffff
00281 };
00282 unsigned int mCurCapa;
00283 unsigned int mCapaNormal;
00284 unsigned int mCapaSSL;
00285 unsigned int mCapaTLS;
00286 KMail::SieveConfigEditor *mSieveConfigEditor;
00287 QRegExpValidator *mValidator;
00288 };
00289
00290 class NamespaceLineEdit: public KLineEdit
00291 {
00292 Q_OBJECT
00293
00294 public:
00295 NamespaceLineEdit( QWidget* parent );
00296
00297 const QString& lastText() { return mLastText; }
00298
00299 public slots:
00300 virtual void setText ( const QString & );
00301
00302 private:
00303 QString mLastText;
00304 };
00305
00306 class NamespaceEditDialog: public KDialogBase
00307 {
00308 Q_OBJECT
00309
00310 public:
00311 NamespaceEditDialog( QWidget* parent, ImapAccountBase::imapNamespace type,
00312 ImapAccountBase::nsDelimMap* map );
00313
00314 protected slots:
00315 void slotOk();
00316 void slotRemoveEntry( int );
00317
00318 private:
00319 ImapAccountBase::imapNamespace mType;
00320 ImapAccountBase::nsDelimMap* mNamespaceMap;
00321 ImapAccountBase::namespaceDelim mDelimMap;
00322 QMap<int, NamespaceLineEdit*> mLineEditMap;
00323 QButtonGroup* mBg;
00324 };
00325
00326 }
00327
00328 #endif
|