You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.2 KiB
124 lines
3.2 KiB
15 years ago
|
/*
|
||
|
This file is part of libkabc.
|
||
|
Copyright (c) 2002 Helge Deller <deller@gmx.de>
|
||
|
2002 Lubos Lunak <llunak@suse.cz>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#ifndef KABC_ADDRESSLINEEDIT_H
|
||
|
#define KABC_ADDRESSLINEEDIT_H
|
||
|
// $Id$
|
||
|
|
||
14 years ago
|
#include <tqobject.h>
|
||
|
#include <tqptrlist.h>
|
||
|
#include <tqtimer.h>
|
||
15 years ago
|
|
||
|
#include "klineedit.h"
|
||
|
#include "kcompletion.h"
|
||
|
|
||
12 years ago
|
class TDEConfig;
|
||
15 years ago
|
|
||
|
namespace KABC {
|
||
|
|
||
|
class LdapSearch;
|
||
|
|
||
|
/**
|
||
|
* A lineedit with LDAP and kabc completion
|
||
|
*
|
||
|
* This lineedit is supposed to be used wherever the user types email addresses
|
||
14 years ago
|
* and might want a completion. You can simply use it as a replacement for
|
||
14 years ago
|
* KLineEdit or TQLineEdit.
|
||
15 years ago
|
*
|
||
|
* You can enable or disable the lineedit at any time.
|
||
|
*
|
||
|
* @see AddressLineEdit::enableCompletion()
|
||
|
*/
|
||
|
class KABC_EXPORT AddressLineEdit : public KLineEdit
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
14 years ago
|
AddressLineEdit(TQWidget* parent, bool useCompletion = true,
|
||
15 years ago
|
const char *name = 0L);
|
||
|
virtual ~AddressLineEdit();
|
||
|
|
||
|
/**
|
||
|
* Reimplented for internal reasons.
|
||
|
* @ see KLineEdit::setFont()
|
||
|
*/
|
||
14 years ago
|
virtual void setFont( const TQFont& );
|
||
15 years ago
|
|
||
12 years ago
|
static TDEConfig *config();
|
||
15 years ago
|
|
||
|
public slots:
|
||
|
/**
|
||
|
* Set cursor to end of line.
|
||
|
*/
|
||
|
void cursorAtEnd();
|
||
|
/**
|
||
|
* Toggle completion.
|
||
|
*/
|
||
|
void enableCompletion( bool enable );
|
||
|
|
||
|
protected:
|
||
|
/**
|
||
|
* Always call AddressLineEdit::loadAddresses() as the first thing.
|
||
|
* Use addAddress() to add addresses.
|
||
|
*/
|
||
|
virtual void loadAddresses();
|
||
14 years ago
|
void addAddress( const TQString& );
|
||
|
virtual void keyPressEvent(TQKeyEvent*);
|
||
|
virtual void dropEvent(TQDropEvent *e);
|
||
15 years ago
|
virtual void paste();
|
||
14 years ago
|
virtual void insert(const TQString &t);
|
||
|
virtual void mouseReleaseEvent( TQMouseEvent * e );
|
||
15 years ago
|
void doCompletion(bool ctrlT);
|
||
|
|
||
|
private slots:
|
||
|
void slotCompletion() { doCompletion(false); }
|
||
14 years ago
|
void slotPopupCompletion( const TQString& );
|
||
15 years ago
|
void slotStartLDAPLookup();
|
||
14 years ago
|
void slotLDAPSearchData( const TQStringList& );
|
||
15 years ago
|
|
||
|
private:
|
||
|
void init();
|
||
|
void startLoadingLDAPEntries();
|
||
|
void stopLDAPLookup();
|
||
14 years ago
|
TQStringList addresses();
|
||
|
TQStringList removeMailDupes( const TQStringList& adrs );
|
||
15 years ago
|
|
||
14 years ago
|
TQString m_previousAddresses;
|
||
15 years ago
|
bool m_useCompletion;
|
||
|
bool m_completionInitialized;
|
||
|
bool m_smartPaste;
|
||
14 years ago
|
TQString m_typedText; // unused
|
||
15 years ago
|
|
||
|
static bool s_addressesDirty;
|
||
12 years ago
|
static TDECompletion *s_completion;
|
||
14 years ago
|
static TQTimer *s_LDAPTimer;
|
||
15 years ago
|
static LdapSearch *s_LDAPSearch;
|
||
14 years ago
|
static TQString *s_LDAPText;
|
||
15 years ago
|
static AddressLineEdit *s_LDAPLineEdit;
|
||
12 years ago
|
static TDEConfig *s_config;
|
||
15 years ago
|
|
||
|
private:
|
||
|
class AddressLineEditPrivate* d;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif /* KABC_ADDRESSLINEEDIT_H */
|