ldapconfigwidget.h
00001 /* 00002 This file is part of libkabc. 00003 Copyright (c) 2004 Szombathelyi György <gyurco@freemail.hu> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef LDAPCONFIGWIDGET_H 00022 #define LDAPCONFIGWIDGET_H 00023 00024 #include <tqwidget.h> 00025 #include <tqmap.h> 00026 #include <tqstring.h> 00027 00028 #include <kabc/ldapurl.h> 00029 #include <kabc/ldif.h> 00030 #include <kio/job.h> 00031 00032 class TQGridLayout; 00033 class TQSpinBox; 00034 class TQPushButton; 00035 class TQCheckBox; 00036 class TQRadioButton; 00037 class KComboBox; 00038 class KLineEdit; 00039 class KProgressDialog; 00040 00041 namespace KABC { 00042 00050 class KABC_EXPORT LdapConfigWidget : public TQWidget 00051 { 00052 Q_OBJECT 00053 TQ_OBJECT 00054 TQ_PROPERTY( LCW_Flags flags READ flagsProp WRITE setFlagsProp ) 00055 TQ_PROPERTY( TQString user READ user WRITE setUser ) 00056 TQ_PROPERTY( TQString password READ password WRITE setPassword ) 00057 TQ_PROPERTY( TQString bindDN READ bindDN WRITE setBindDN ) 00058 TQ_PROPERTY( TQString realm READ realm WRITE setRealm ) 00059 TQ_PROPERTY( TQString host READ host WRITE setHost ) 00060 TQ_PROPERTY( int port READ port WRITE setPort ) 00061 TQ_PROPERTY( int ver READ ver WRITE setVer ) 00062 TQ_PROPERTY( TQString dn READ dn WRITE setDn ) 00063 TQ_PROPERTY( TQString filter READ filter WRITE setFilter ) 00064 TQ_PROPERTY( TQString mech READ mech WRITE setMech ) 00065 TQ_PROPERTY( bool secNO READ isSecNO WRITE setSecNO ) 00066 TQ_PROPERTY( bool secSSL READ isSecSSL WRITE setSecSSL ) 00067 TQ_PROPERTY( bool secTLS READ isSecSSL WRITE setSecTLS ) 00068 TQ_PROPERTY( bool authAnon READ isAuthAnon WRITE setAuthAnon ) 00069 TQ_PROPERTY( bool authSimple READ isAuthSimple WRITE setAuthSimple ) 00070 TQ_PROPERTY( bool authSASL READ isAuthSASL WRITE setAuthSASL ) 00071 TQ_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit ) 00072 TQ_PROPERTY( int timeLimit READ timeLimit WRITE setTimeLimit ) 00073 TQ_SETS ( LCW_Flags ) 00074 00075 public: 00076 00077 enum LCW_Flags { 00078 W_USER = 0x1, 00079 W_PASS = 0x2, 00080 W_BINDDN = 0x4, 00081 W_REALM = 0x8, 00082 W_HOST = 0x10, 00083 W_PORT = 0x20, 00084 W_VER = 0x40, 00085 W_DN = 0x80, 00086 W_FILTER = 0x100, 00087 W_SECBOX = 0x400, 00088 W_AUTHBOX = 0x800, 00089 W_TIMELIMIT = 0x1000, 00090 W_SIZELIMIT = 0x2000, 00091 W_ALL = 0xFFFFFFF 00092 }; 00093 00097 LdapConfigWidget( TQWidget* parent = 0, 00098 const char* name = 0, WFlags fl = 0 ); 00100 LdapConfigWidget( int flags, TQWidget* parent = 0, 00101 const char* name = 0, WFlags fl = 0 ); 00103 virtual ~LdapConfigWidget(); 00104 00106 void setUser( const TQString &user ); 00108 TQString user() const; 00109 00111 void setPassword( const TQString &password ); 00113 TQString password() const; 00114 00119 void setBindDN( const TQString &binddn ); 00121 TQString bindDN() const; 00122 00124 void setRealm( const TQString &realm ); 00126 TQString realm() const; 00127 00129 void setHost( const TQString &host ); 00131 TQString host() const; 00132 00134 void setPort( int port ); 00136 int port() const; 00137 00139 void setVer( int ver ); 00141 int ver() const; 00142 00144 void setDn( const TQString &dn ); 00146 TQString dn() const; 00147 00149 void setFilter( const TQString &filter ); 00151 TQString filter() const; 00152 00154 void setMech( const TQString &mech ); 00156 TQString mech() const; 00157 00162 void setSecNO( bool b = true ); 00167 bool isSecNO() const; 00168 00173 void setSecTLS( bool b = true ); 00178 bool isSecTLS() const; 00179 00184 void setSecSSL( bool b = true ); 00189 bool isSecSSL() const; 00190 00195 void setAuthAnon( bool b = true ); 00200 bool isAuthAnon() const; 00201 00206 void setAuthSimple( bool b = true ); 00211 bool isAuthSimple() const; 00212 00217 void setAuthSASL( bool b = true ); 00222 bool isAuthSASL() const; 00223 00228 void setSizeLimit( int sizelimit ); 00233 int sizeLimit() const; 00234 00239 void setTimeLimit( int timelimit ); 00244 int timeLimit() const; 00245 00246 int flags() const; 00247 void setFlags( int flags ); 00248 inline LCW_Flags flagsProp() const { return (LCW_Flags)flags(); } 00249 inline void setFlagsProp( LCW_Flags flags ) { setFlags((int)flags); } 00250 00255 KABC::LDAPUrl url() const; 00256 00257 private slots: 00258 void setLDAPPort(); 00259 void setLDAPSPort(); 00260 void setAnonymous( int state ); 00261 void setSimple( int state ); 00262 void setSASL( int state ); 00263 void mQueryDNClicked(); 00264 void mQueryMechClicked(); 00265 void loadData( KIO::Job*, const TQByteArray& ); 00266 void loadResult( KIO::Job* ); 00267 private: 00268 00269 int mFlags; 00270 LDIF mLdif; 00271 TQStringList mQResult; 00272 TQString mAttr; 00273 00274 KLineEdit *mUser; 00275 KLineEdit *mPassword; 00276 KLineEdit *mHost; 00277 TQSpinBox *mPort, *mVer, *mSizeLimit, *mTimeLimit; 00278 KLineEdit *mDn, *mBindDN, *mRealm; 00279 KLineEdit *mFilter; 00280 TQRadioButton *mAnonymous,*mSimple,*mSASL; 00281 TQCheckBox *mSubTree; 00282 TQPushButton *mEditButton; 00283 TQPushButton *mQueryMech; 00284 TQRadioButton *mSecNO,*mSecTLS,*mSecSSL; 00285 KComboBox *mMech; 00286 00287 TQString mErrorMsg; 00288 bool mCancelled; 00289 KProgressDialog *mProg; 00290 00291 TQGridLayout *mainLayout; 00292 class LDAPConfigWidgetPrivate; 00293 LDAPConfigWidgetPrivate *d; 00294 00295 void sendQuery(); 00296 void initWidget(); 00297 }; 00298 } 00299 00300 #endif