kabc Library API Documentation

addresslineedit.h

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2002 Helge Deller <deller@gmx.de>
00004                   2002 Lubos Lunak <llunak@suse.cz>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #ifndef KABC_ADDRESSLINEEDIT_H
00023 #define KABC_ADDRESSLINEEDIT_H
00024 // $Id: addresslineedit.h,v 1.3.2.1 2002/11/28 11:02:37 lunakl Exp $
00025 
00026 #include <qobject.h>
00027 #include <qptrlist.h>
00028 #include <qtimer.h>
00029 
00030 #include "klineedit.h"
00031 #include "kcompletion.h"
00032 
00033 namespace KABC {
00034 
00035 class LdapSearch;
00036 
00048 class AddressLineEdit : public KLineEdit
00049 {
00050   Q_OBJECT
00051 public:
00052   AddressLineEdit(QWidget* parent, bool useCompletion = true,
00053         const char *name = 0L);
00054   virtual ~AddressLineEdit();
00055 
00060   virtual void setFont( const QFont& );
00061 
00062 public slots:
00066   void cursorAtEnd();
00070   void enableCompletion( bool enable );
00071 
00072 protected:
00077   virtual void loadAddresses();
00078   void addAddress( const QString& );
00079   virtual void keyPressEvent(QKeyEvent*);
00080   virtual void dropEvent(QDropEvent *e);
00081   virtual void paste();
00082   virtual void insert(const QString &t);
00083   virtual void mouseReleaseEvent( QMouseEvent * e );
00084   void doCompletion(bool ctrlT);
00085 
00086 private slots:
00087   void slotCompletion() { doCompletion(false); }
00088   void slotPopupCompletion( const QString& );
00089   void slotStartLDAPLookup();
00090   void slotLDAPSearchData( const QStringList& );
00091   void slotSetTextAsEdited( const QString &text );
00092 
00093 private:
00094   void init();
00095   void startLoadingLDAPEntries();
00096   void stopLDAPLookup();
00097   QStringList addresses();
00098   QStringList removeMailDupes( const QStringList& adrs );
00099 
00100   QString m_previousAddresses;
00101   bool m_useCompletion;
00102   bool m_completionInitialized;
00103   bool m_smartPaste;
00104   QString m_typedText; // unused
00105 
00106   static bool s_addressesDirty;
00107   static KCompletion *s_completion;
00108   static QTimer *s_LDAPTimer;
00109   static LdapSearch *s_LDAPSearch;
00110   static QString *s_LDAPText;
00111   static AddressLineEdit *s_LDAPLineEdit;
00112 private:
00113   class AddressLineEditPrivate* d;
00114 };
00115 
00116 }
00117 
00118 #endif      /* KABC_ADDRESSLINEEDIT_H */
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:07 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001