26 #ifndef ADDRESSEELINEEDIT_H
27 #define ADDRESSEELINEEDIT_H
30 #include <tqptrlist.h>
33 #include <tqvaluelist.h>
35 #include <tdeabc/addressee.h>
37 #include "clicklineedit.h"
38 #include "kmailcompletion.h"
39 #include <dcopobject.h>
40 #include <tdemacros.h>
47 typedef TQValueList<LdapResult> LdapResultList;
48 typedef TQMap< TQString, TQPair<int,int> > CompletionItemsMap;
53 class TDE_EXPORT AddresseeLineEdit :
public ClickLineEdit,
public DCOPObject
60 AddresseeLineEdit( TQWidget* parent,
bool useCompletion =
true,
61 const char *name = 0L);
62 virtual ~AddresseeLineEdit();
64 virtual void setFont(
const TQFont& );
65 void allowSemiColonAsSeparator(
bool );
71 void allowDistributionLists(
bool allowDistLists );
75 void enableCompletion(
bool enable );
77 virtual void setText(
const TQString& txt );
80 virtual void loadContacts();
82 void addContact(
const TDEABC::Addressee&,
int weight,
int source = -1 );
83 virtual void keyPressEvent( TQKeyEvent* );
92 virtual void insert(
const TQString &text );
96 virtual void mouseReleaseEvent( TQMouseEvent *e );
98 virtual void dropEvent( TQDropEvent *e );
99 void doCompletion(
bool ctrlT );
100 virtual TQPopupMenu *createPopupMenu();
109 int addCompletionSource(
const TQString&,
int weight );
112 static TDECompletion::CompOrder completionOrder();
116 void slotIMAPCompletionOrderChanged();
119 void slotCompletion();
120 void slotPopupCompletion(
const TQString& );
121 void slotReturnPressed(
const TQString& );
122 void slotStartLDAPLookup();
123 void slotLDAPSearchData(
const KPIM::LdapResultList& );
124 void slotEditCompletionOrder();
125 void slotUserCancelled(
const TQString& );
128 virtual bool eventFilter(TQObject *o, TQEvent *e);
130 void startLoadingLDAPEntries();
131 void stopLDAPLookup();
132 void updateLDAPWeights();
134 void setCompletedItems(
const TQStringList& items,
bool autoSuggest );
135 void addCompletionItem(
const TQString&
string,
int weight,
int source,
const TQStringList * keyWords=0 );
136 TQString completionSearchText( TQString& );
137 const TQStringList getAdjustedCompletionItems(
bool fullSearch );
138 void updateSearchString();
140 TQString m_previousAddresses;
141 TQString m_searchString;
142 bool m_useCompletion;
143 bool m_completionInitialized;
145 bool m_addressBookConnected;
146 bool m_lastSearchMode;
147 bool m_searchExtended;
148 bool m_useSemiColonAsSeparator;
149 bool m_allowDistLists;
153 static bool s_addressesDirty;
154 static KMailCompletion *s_completion;
155 static CompletionItemsMap* s_completionItemMap;
156 static TQTimer *s_LDAPTimer;
158 static TQString *s_LDAPText;
159 static AddresseeLineEdit *s_LDAPLineEdit;
160 static TQStringList *s_completionSources;
161 static TQMap<int,int> *s_ldapClientToCompletionSourceMap;
163 class AddresseeLineEditPrivate;
164 AddresseeLineEditPrivate *d;
TDEPIM classes for drag and drop of mails.