libkdepim Library API Documentation

addresseelineedit.h

00001 /*
00002     This file is part of libkdepim.
00003     Copyright (c) 2002 Helge Deller <deller@gmx.de>
00004                   2002 Lubos Lunak <llunak@suse.cz>
00005                   2001,2003 Carsten Pfeiffer <pfeiffer@kde.org>
00006                   2001 Waldo Bastian <bastian@kde.org>
00007                   2004 Daniel Molkentin <danimo@klaralvdalens-datakonsult.se>
00008                   2004 Karl-Heinz Zimmer <khz@klaralvdalens-datakonsult.se>
00009 
00010     This library is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Library General Public
00012     License as published by the Free Software Foundation; either
00013     version 2 of the License, or (at your option) any later version.
00014 
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Library General Public License for more details.
00019 
00020     You should have received a copy of the GNU Library General Public License
00021     along with this library; see the file COPYING.LIB.  If not, write to
00022     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023     Boston, MA 02111-1307, USA.
00024 */
00025 
00026 #ifndef ADDRESSEELINEEDIT_H
00027 #define ADDRESSEELINEEDIT_H
00028 
00029 #include <qobject.h>
00030 #include <qptrlist.h>
00031 #include <qtimer.h>
00032 #include <qvaluelist.h>
00033 
00034 #include <kabc/addressee.h>
00035 
00036 #include "clicklineedit.h"
00037 #include "kcompletion.h"
00038 #include <dcopobject.h>
00039 
00040 class KConfig;
00041 
00042 namespace KPIM {
00043 class LdapSearch;
00044 class LdapResult;
00045 typedef QValueList<LdapResult> LdapResultList;
00046 typedef QMap<QString, int> CompletionItemsMap;
00047 }
00048 
00049 namespace KPIM {
00050 
00051 class AddresseeLineEdit : public ClickLineEdit, public DCOPObject
00052 {
00053   K_DCOP
00054   Q_OBJECT
00055 
00056   public:
00057     AddresseeLineEdit( QWidget* parent, bool useCompletion = true,
00058                      const char *name = 0L);
00059     virtual ~AddresseeLineEdit();
00060 
00061     virtual void setFont( const QFont& );
00062 
00063     static KConfig *config();
00064 
00065   public slots:
00066     void cursorAtEnd();
00067     void enableCompletion( bool enable );
00068 
00069   protected slots:
00070     virtual void loadContacts();
00071   protected:
00072     void addContact( const KABC::Addressee&, int weight );
00073     virtual void keyPressEvent( QKeyEvent* );
00082     virtual void insert( const QString &text );
00084     virtual void paste();
00086     virtual void mouseReleaseEvent( QMouseEvent *e );
00088     virtual void dropEvent( QDropEvent *e );
00089     void doCompletion( bool ctrlT );
00090     virtual QPopupMenu *createPopupMenu();
00091 
00092   k_dcop:
00093     // Connected to the DCOP signal
00094     void slotIMAPCompletionOrderChanged();
00095 
00096   private slots:
00097     void slotCompletion();
00098     void slotPopupCompletion( const QString& );
00099     void slotStartLDAPLookup();
00100     void slotLDAPSearchData( const KPIM::LdapResultList& );
00101     void slotEditCompletionOrder();
00102     void slotUserCancelled( const QString& );
00103 
00104   private:
00105     void init();
00106     void startLoadingLDAPEntries();
00107     void stopLDAPLookup();
00108 
00109     void setCompletedItems( const QStringList& items, bool autoSuggest );
00110     void addCompletionItem( const QString& string, int weight );
00111     QString completionSearchText( QString& );
00112 
00113     QString m_previousAddresses;
00114     QString m_searchString;
00115     bool m_useCompletion;
00116     bool m_completionInitialized;
00117     bool m_smartPaste;
00118     bool m_addressBookConnected;
00119 
00120     //QMap<QString, KABC::Addressee> m_contactMap;
00121 
00122     static bool s_addressesDirty;
00123     static KCompletion *s_completion;
00124     static CompletionItemsMap* s_completionItemMap;
00125     static QTimer *s_LDAPTimer;
00126     static KPIM::LdapSearch *s_LDAPSearch;
00127     static QString *s_LDAPText;
00128     static AddresseeLineEdit *s_LDAPLineEdit;
00129     static KConfig *s_config;
00130 
00131     class AddresseeLineEditPrivate;
00132     AddresseeLineEditPrivate *d;
00133 };
00134 
00135 }
00136 
00137 #endif
KDE Logo
This file is part of the documentation for libkdepim Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Apr 4 04:46:32 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003