PimCommon::AddresseeLineEdit Class

class PimCommon::AddresseeLineEdit

The AddresseeLineEdit class provides a line editor for entering email addresses with completion support Author: Helge Deller <deller@gmx.de>. More...

Header: #include <PimCommonAkonadi/AddresseeLineEdit>
CMake: find_package(KPim6PimCommonAkonadi REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::PimCommonAkonadi)

Public Functions

AddresseeLineEdit(QWidget *parent = nullptr, bool enableCompletion = true)
virtual ~AddresseeLineEdit() override
int addCompletionSource(const QString &name, int weight)
void addContact(const KContacts::Addressee &contact, int weight, int source = -1, const QString &append = QString())
void addContactGroup(const KContacts::ContactGroup &group, int weight, int source = -1)
void addItem(const Akonadi::Item &item, int weight, int source = -1)
void allowSemicolonAsSeparator(bool allow)
void callSetCompletedText(const QString &text)
void callSetCompletedText(const QString &, bool)
void callSetUserSelection(bool)
void callUserCancelled(const QString &str)
bool canDeleteLineEdit() const
void configureCompletion()
void emitTextCompleted()
KLDAPCore::LdapClientSearch *ldapSearch() const
KConfig *recentAddressConfig() const
void removeCompletionSource(const QString &source)
void setFont(const QFont &font)
void setIcon(const QIcon &icon, const QString &tooltip = QString())
void setLdapActivitiesAbstract(KLDAPCore::LdapActivitiesAbstract *ldapActivities)
void setRecentAddressConfig(KConfig *config)
void setShowRecentAddresses(bool b)
bool showRecentAddresses() const
void updateBalooBlackList()
void updateCompletionOrder()

Public Slots

void cursorAtEnd()
void enableCompletion(bool enable)
void expandGroups()
virtual void setText(const QString &text) override
void slotEditingFinished()
void slotGroupSearchResult(KJob *job)

Signals

void addAddress(const QString &address)
void iconClicked()
void textCompleted()

Protected Functions

virtual QMenu *createStandardContextMenu()
virtual void insert(const QString &)
void insertEmails(const QStringList &emails)
void loadContacts()
virtual void paste()

Reimplemented Protected Functions

virtual void contextMenuEvent(QContextMenuEvent *) override
virtual void dropEvent(QDropEvent *) override
virtual void keyPressEvent(QKeyEvent *) override
virtual void mouseReleaseEvent(QMouseEvent *) override

Detailed Description

Member Function Documentation

[explicit] AddresseeLineEdit::AddresseeLineEdit(QWidget *parent = nullptr, bool enableCompletion = true)

Creates a new addressee line edit.

parent The parent object. enableCompletion Whether autocompletion shall be enabled.

[override virtual noexcept] AddresseeLineEdit::~AddresseeLineEdit()

Destroys the addressee line edit.

[signal] void AddresseeLineEdit::addAddress(const QString &address)

Emitted when an address should be added. @param address The address to add

int AddresseeLineEdit::addCompletionSource(const QString &name, int weight)

Adds the name of a completion source and its weight to the internal list of completion sources and returns its index, which can be used for insertion of items associated with that source.

If the source already exists, the weight will be updated.

void AddresseeLineEdit::addContact(const KContacts::Addressee &contact, int weight, int source = -1, const QString &append = QString())

Adds a new contact to the completion with a given weight source index append is added to completion string, but removed, when mail is selected.

void AddresseeLineEdit::addContactGroup(const KContacts::ContactGroup &group, int weight, int source = -1)

Same as the above, but this time with contact groups.

void AddresseeLineEdit::addItem(const Akonadi::Item &item, int weight, int source = -1)

Adds an Akonadi item to the completion list. @param item The Akonadi item to add @param weight The weight for completion priority @param source The source index for this item

void AddresseeLineEdit::allowSemicolonAsSeparator(bool allow)

Sets whether semicolons are allowed as separators.

void AddresseeLineEdit::callSetCompletedText(const QString &text)

Sets the completed text. @param text The completed text

void AddresseeLineEdit::callSetCompletedText(const QString &, bool)

Sets the completed text. @param text The completed text @param marked Whether the completion should be marked

void AddresseeLineEdit::callSetUserSelection(bool)

Sets user selection state. @param selected Whether user made a selection

void AddresseeLineEdit::callUserCancelled(const QString &str)

Calls user cancelled callback with the given string. @param str The cancelled input string

bool AddresseeLineEdit::canDeleteLineEdit() const

Checks if this line edit can be deleted. @return true if it can be deleted, false otherwise

void AddresseeLineEdit::configureCompletion()

Opens the configuration dialog for address completion.

[override virtual protected] void AddresseeLineEdit::contextMenuEvent(QContextMenuEvent *)

Reimplemented for internal reasons. API not affected. @param event The context menu event

[virtual protected] QMenu *AddresseeLineEdit::createStandardContextMenu()

Reimplemented for subclass access to menu. @return The standard context menu

[slot] void AddresseeLineEdit::cursorAtEnd()

Moves the cursor at the end of the line edit.

[override virtual protected] void AddresseeLineEdit::dropEvent(QDropEvent *)

Reimplemented for smart insertion of dragged email addresses. @param event The drop event

void AddresseeLineEdit::emitTextCompleted()

Emits the textCompleted signal.

[slot] void AddresseeLineEdit::enableCompletion(bool enable)

Sets whether autocompletion shall be enabled. @param enable true to enable completion, false to disable

[slot] void AddresseeLineEdit::expandGroups()

Expands contact groups to individual addresses.

[signal] void AddresseeLineEdit::iconClicked()

Emitted when the icon is clicked.

[virtual protected] void AddresseeLineEdit::insert(const QString &)

Reimplemented for smart insertion of email addresses. Features: - Automatically adds ',' if necessary to separate email addresses - Correctly decodes mailto URLs - Recognizes email addresses which are protected against address harvesters, i.e. "name at kde dot org" and "name(at)kde.org" @param text The text to insert

[protected] void AddresseeLineEdit::insertEmails(const QStringList &emails)

Inserts multiple email addresses. @param emails The list of email addresses to insert

[override virtual protected] void AddresseeLineEdit::keyPressEvent(QKeyEvent *)

Reimplemented for internal reasons. @param event The key event

KLDAPCore::LdapClientSearch *AddresseeLineEdit::ldapSearch() const

Returns the LDAP search client. @return The LdapClientSearch instance

[protected] void AddresseeLineEdit::loadContacts()

Loads contacts into the completion list.

[override virtual protected] void AddresseeLineEdit::mouseReleaseEvent(QMouseEvent *)

Reimplemented for smart insertion with middle mouse button. @param event The mouse event

[virtual protected] void AddresseeLineEdit::paste()

Reimplemented for smart insertion of pasted email addresses.

KConfig *AddresseeLineEdit::recentAddressConfig() const

Returns the KConfig object for recent addresses. @return The KConfig object

See also setRecentAddressConfig().

void AddresseeLineEdit::removeCompletionSource(const QString &source)

Removes a completion source. @param source The name of the source to remove

void AddresseeLineEdit::setFont(const QFont &font)

Reimplemented for setting the font for line edit and completion box.

void AddresseeLineEdit::setIcon(const QIcon &icon, const QString &tooltip = QString())

Sets an icon with tooltip for this line edit. @param icon The icon to display @param tooltip The tooltip text

void AddresseeLineEdit::setLdapActivitiesAbstract(KLDAPCore::LdapActivitiesAbstract *ldapActivities)

Sets the LDAP activities abstract object. @param ldapActivities The LdapActivitiesAbstract instance

void AddresseeLineEdit::setRecentAddressConfig(KConfig *config)

Sets the KConfig object for recent addresses. @param config The KConfig object

See also recentAddressConfig().

void AddresseeLineEdit::setShowRecentAddresses(bool b)

Sets whether to show recent addresses. @param b true to show recent addresses, false otherwise

See also showRecentAddresses().

[override virtual slot] void AddresseeLineEdit::setText(const QString &text)

Reimplemented for stripping whitespace after completion Danger: This is _not_ virtual in the base class! @param text The text to set

bool AddresseeLineEdit::showRecentAddresses() const

Returns whether recent addresses are shown. @return true if recent addresses are shown

See also setShowRecentAddresses().

[slot] void AddresseeLineEdit::slotEditingFinished()

Called when editing is finished.

[slot] void AddresseeLineEdit::slotGroupSearchResult(KJob *job)

Handles group search results. @param job The KJob with search results

[signal] void AddresseeLineEdit::textCompleted()

Emitted when text completion is requested.

void AddresseeLineEdit::updateBalooBlackList()

Updates the Baloo blacklist.

void AddresseeLineEdit::updateCompletionOrder()

Updates the completion order.