libkdepim
addresseelineedit.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ADDRESSEELINEEDIT_H
00027 #define ADDRESSEELINEEDIT_H
00028
00029 #include <tqobject.h>
00030 #include <tqptrlist.h>
00031 #include <tqtimer.h>
00032 #include <tqpair.h>
00033 #include <tqvaluelist.h>
00034
00035 #include <kabc/addressee.h>
00036
00037 #include "clicklineedit.h"
00038 #include "kmailcompletion.h"
00039 #include <dcopobject.h>
00040 #include <kdepimmacros.h>
00041
00042 class KConfig;
00043
00044 namespace KPIM {
00045 class LdapSearch;
00046 class LdapResult;
00047 typedef TQValueList<LdapResult> LdapResultList;
00048 typedef TQMap< TQString, TQPair<int,int> > CompletionItemsMap;
00049 }
00050
00051 namespace KPIM {
00052
00053 class KDE_EXPORT AddresseeLineEdit : public ClickLineEdit, public DCOPObject
00054 {
00055 K_DCOP
00056 Q_OBJECT
00057 TQ_OBJECT
00058
00059 public:
00060 AddresseeLineEdit( TQWidget* parent, bool useCompletion = true,
00061 const char *name = 0L);
00062 virtual ~AddresseeLineEdit();
00063
00064 virtual void setFont( const TQFont& );
00065 void allowSemiColonAsSeparator( bool );
00066
00071 void allowDistributionLists( bool allowDistLists );
00072
00073 public slots:
00074 void cursorAtEnd();
00075 void enableCompletion( bool enable );
00077 virtual void setText( const TQString& txt );
00078
00079 protected slots:
00080 virtual void loadContacts();
00081 protected:
00082 void addContact( const KABC::Addressee&, int weight, int source = -1 );
00083 virtual void keyPressEvent( TQKeyEvent* );
00092 virtual void insert( const TQString &text );
00094 virtual void paste();
00096 virtual void mouseReleaseEvent( TQMouseEvent *e );
00098 virtual void dropEvent( TQDropEvent *e );
00099 void doCompletion( bool ctrlT );
00100 virtual TQPopupMenu *createPopupMenu();
00101
00109 int addCompletionSource( const TQString&, int weight );
00110
00112 static KCompletion::CompOrder completionOrder();
00113
00114 k_dcop:
00115
00116 void slotIMAPCompletionOrderChanged();
00117
00118 private slots:
00119 void slotCompletion();
00120 void slotPopupCompletion( const TQString& );
00121 void slotReturnPressed( const TQString& );
00122 void slotStartLDAPLookup();
00123 void slotLDAPSearchData( const KPIM::LdapResultList& );
00124 void slotEditCompletionOrder();
00125 void slotUserCancelled( const TQString& );
00126
00127 private:
00128 virtual bool eventFilter(TQObject *o, TQEvent *e);
00129 void init();
00130 void startLoadingLDAPEntries();
00131 void stopLDAPLookup();
00132 void updateLDAPWeights();
00133
00134 void setCompletedItems( const TQStringList& items, bool autoSuggest );
00135 void addCompletionItem( const TQString& string, int weight, int source, const TQStringList * keyWords=0 );
00136 TQString completionSearchText( TQString& );
00137 const TQStringList getAdjustedCompletionItems( bool fullSearch );
00138 void updateSearchString();
00139
00140 TQString m_previousAddresses;
00141 TQString m_searchString;
00142 bool m_useCompletion;
00143 bool m_completionInitialized;
00144 bool m_smartPaste;
00145 bool m_addressBookConnected;
00146 bool m_lastSearchMode;
00147 bool m_searchExtended;
00148 bool m_useSemiColonAsSeparator;
00149 bool m_allowDistLists;
00150
00151
00152
00153 static bool s_addressesDirty;
00154 static KMailCompletion *s_completion;
00155 static CompletionItemsMap* s_completionItemMap;
00156 static TQTimer *s_LDAPTimer;
00157 static KPIM::LdapSearch *s_LDAPSearch;
00158 static TQString *s_LDAPText;
00159 static AddresseeLineEdit *s_LDAPLineEdit;
00160 static TQStringList *s_completionSources;
00161 static TQMap<int,int> *s_ldapClientToCompletionSourceMap;
00162
00163 class AddresseeLineEditPrivate;
00164 AddresseeLineEditPrivate *d;
00165
00166
00167
00168 enum MenuID
00169 {
00170 Default = 42,
00171 NoCompletion,
00172 AutoCompletion,
00173 ShellCompletion,
00174 PopupCompletion,
00175 ShortAutoCompletion,
00176 PopupAutoCompletion
00177 };
00178
00179 };
00180
00181 }
00182
00183 #endif
|