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 <qpair.h>
00033 #include <qvaluelist.h>
00034 
00035 #include <kabc/addressee.h>
00036 
00037 #include "clicklineedit.h"
00038 #include "kcompletion.h"
00039 #include <dcopobject.h>
00040 
00041 class KConfig;
00042 
00043 namespace KPIM {
00044 class LdapSearch;
00045 class LdapResult;
00046 typedef QValueList<LdapResult> LdapResultList;
00047 typedef QMap< QString, QPair<int,int> > CompletionItemsMap;
00048 }
00049 
00050 namespace KPIM {
00051 
00052 class AddresseeLineEdit : public ClickLineEdit, public DCOPObject
00053 {
00054   K_DCOP
00055   Q_OBJECT
00056 
00057   public:
00058     AddresseeLineEdit( QWidget* parent, bool useCompletion = true,
00059                      const char *name = 0L);
00060     virtual ~AddresseeLineEdit();
00061 
00062     virtual void setFont( const QFont& );
00063 
00064     void allowSemiColonAsSeparator( bool );
00065     //static KConfig *config();
00066 
00067   public slots:
00068     void cursorAtEnd();
00069     void enableCompletion( bool enable );
00071     virtual void setText( const QString& txt );
00072 
00073   protected slots:
00074     virtual void loadContacts();
00075   protected:
00076     void addContact( const KABC::Addressee&, int weight, int source = -1 );
00077     virtual void keyPressEvent( QKeyEvent* );
00086     virtual void insert( const QString &text );
00088     virtual void paste();
00090     virtual void mouseReleaseEvent( QMouseEvent *e );
00092     virtual void dropEvent( QDropEvent *e );
00093     void doCompletion( bool ctrlT );
00094     virtual QPopupMenu *createPopupMenu();
00095 
00101     int addCompletionSource( const QString& );
00102 
00104     static KCompletion::CompOrder completionOrder();
00105 
00106   k_dcop:
00107     // Connected to the DCOP signal
00108     void slotIMAPCompletionOrderChanged();
00109 
00110   private slots:
00111     void slotCompletion();
00112     void slotPopupCompletion( const QString& );
00113     void slotStartLDAPLookup();
00114     void slotLDAPSearchData( const KPIM::LdapResultList& );
00115     void slotEditCompletionOrder();
00116     void slotUserCancelled( const QString& );
00117 
00118   private:
00119     virtual bool eventFilter(QObject *o, QEvent *e);
00120     void init();
00121     void startLoadingLDAPEntries();
00122     void stopLDAPLookup();
00123 
00124     void setCompletedItems( const QStringList& items, bool autoSuggest );
00125     void addCompletionItem( const QString& string, int weight, int source );
00126     QString completionSearchText( QString& );
00127     const QStringList getAdjustedCompletionItems( bool fullSearch );
00128 
00129     QString m_previousAddresses;
00130     QString m_searchString;
00131     bool m_useCompletion;
00132     bool m_completionInitialized;
00133     bool m_smartPaste;
00134     bool m_addressBookConnected;
00135     bool m_useSemiColonAsSeparator;
00136 
00137     //QMap<QString, KABC::Addressee> m_contactMap;
00138 
00139     static bool s_addressesDirty;
00140     static KCompletion *s_completion;
00141     static CompletionItemsMap* s_completionItemMap;
00142     static QTimer *s_LDAPTimer;
00143     static KPIM::LdapSearch *s_LDAPSearch;
00144     static QString *s_LDAPText;
00145     static AddresseeLineEdit *s_LDAPLineEdit;
00146   //static KConfig *s_config;
00147     static QStringList *s_completionSources;
00148 
00149     class AddresseeLineEditPrivate;
00150     AddresseeLineEditPrivate *d;
00151 };
00152 
00153 }
00154 
00155 #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 Thu May 3 20:20:03 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003