00001
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 <qobject.h>
00030
#include <qptrlist.h>
00031
#include <qtimer.h>
00032
00033
#include <kabc/addressee.h>
00034
00035
#include "clicklineedit.h"
00036
#include "kcompletion.h"
00037
00038
class KConfig;
00039
template<
typename T>
class QValueList;
00040
00041
namespace KPIM {
00042
class LdapSearch;
00043
class LdapResult;
00044
typedef QValueList<LdapResult> LdapResultList;
00045 }
00046
00047
namespace KPIM {
00048
00049
class AddresseeLineEdit :
public ClickLineEdit
00050 {
00051 Q_OBJECT
00052
00053
public:
00054 AddresseeLineEdit(
QWidget* parent,
bool useCompletion =
true,
00055
const char *name = 0L);
00056
virtual ~AddresseeLineEdit();
00057
00058
virtual void setFont(
const QFont& );
00059
00060
static KConfig *config();
00061
00062
public slots:
00063
void cursorAtEnd();
00064
void enableCompletion(
bool enable );
00065
00066
protected slots:
00067
virtual void loadContacts();
00068
protected:
00069
void addContact(
const KABC::Addressee&,
int weight );
00070
virtual void keyPressEvent(
QKeyEvent* );
00079
virtual void insert(
const QString &text );
00081
virtual void paste();
00083
virtual void mouseReleaseEvent(
QMouseEvent *e );
00085
virtual void dropEvent(
QDropEvent *e );
00086
void doCompletion(
bool ctrlT );
00087
virtual QPopupMenu *createPopupMenu();
00088
00089
private slots:
00090
void slotCompletion() { doCompletion(
false); }
00091
void slotPopupCompletion(
const QString& );
00092
void slotStartLDAPLookup();
00093
void slotLDAPSearchData(
const KPIM::LdapResultList& );
00094
void slotEditCompletionOrder();
00095
00096
private:
00097
void init();
00098
void startLoadingLDAPEntries();
00099
void stopLDAPLookup();
00100
00101
void setCompletedItems(
const QStringList& items,
bool autoSuggest );
00102
00103
QString m_previousAddresses;
00104
bool m_useCompletion;
00105
bool m_completionInitialized;
00106
bool m_smartPaste;
00107
00108
00109
00110
static bool s_addressesDirty;
00111
static KCompletion *s_completion;
00112
static QTimer *s_LDAPTimer;
00113
static KPIM::LdapSearch *s_LDAPSearch;
00114
static QString *s_LDAPText;
00115
static AddresseeLineEdit *s_LDAPLineEdit;
00116
static KConfig *s_config;
00117
00118
class AddresseeLineEditPrivate;
00119 AddresseeLineEditPrivate *d;
00120 };
00121
00122 }
00123
00124
#endif