Akonadi::ContactViewer Class

A viewer component for contacts in Akonadi. * * * * This widgets provides a way to show a contact from the * Akonadi storage or a raw contact object. * * Examples: * *. More...

Header: #include <Akonadi/ContactViewer>
CMake: find_package(KPim6AkonadiContactWidgets REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiContactWidgets)
Inherited By:

KAddressBookGrantlee::GrantleeContactViewer

Public Functions

ContactViewer(QWidget *parent = nullptr)
virtual ~ContactViewer() override
Akonadi::Item contact() const
KContacts::Addressee rawContact() const
void setContactFormatter(Akonadi::AbstractContactFormatter *formatter)
void setShowQRCode(bool b)
bool showQRCode() const
void updateView()

Public Slots

void setContact(const Akonadi::Item &contact)
void setRawContact(const KContacts::Addressee &contact)

Signals

void addressClicked(const KContacts::Address &address)
void urlClicked(const QUrl &url)

Detailed Description

* *

*
* using namespace Akonadi;
*
* const Item contact = ...
*
* ContactViewer *viewer = new ContactViewer( this );
* viewer->setContact( contact );
*
*

*

*
* using namespace Akonadi;
*
* const KContacts::Addressee contact = ...
*
* ContactViewer *viewer = new ContactViewer( this );
* viewer->setContact( contact );
*
*

* * Author: Tobias Koenig <tokoe@kde.org> *

Member Function Documentation

[explicit] ContactViewer::ContactViewer(QWidget *parent = nullptr)

Creates a new contact viewer.

parent The parent widget.

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

Destroys the contact viewer.

[signal] void ContactViewer::addressClicked(const KContacts::Address &address)

This signal is emitted whenever the user has clicked on an address in the viewer.

address The corresponding address.

Akonadi::Item ContactViewer::contact() const

Returns the contact that is currently displayed.

Note: The returned contact is only valid if it was set with setContact() before.

See also setContact().

KContacts::Addressee ContactViewer::rawContact() const

Returns the raw contact that is currently displayed.

See also setRawContact().

[slot] void ContactViewer::setContact(const Akonadi::Item &contact)

Sets the contact that shall be displayed in the viewer.

See also contact().

void ContactViewer::setContactFormatter(Akonadi::AbstractContactFormatter *formatter)

Sets the contact formatter that should be used for formatting the contact. If formatter is \ 0, the standard formatter will be used.

formatter the contact formatter to set.

Note: The contact viewer won't take ownership of the formatter.

[slot] void ContactViewer::setRawContact(const KContacts::Addressee &contact)

Sets the raw contact object that shall be displayed in the viewer. contact the contact object to set

See also rawContact().

void ContactViewer::setShowQRCode(bool b)

Sets whether the QR code should be shown for this contact.

b Whether to show the QR code.

See also showQRCode().

bool ContactViewer::showQRCode() const

Returns whether the QR code is shown for this contact.

\returnsTrue if the QR code is shown, false otherwise.

See also setShowQRCode().

void ContactViewer::updateView()

Updates the view to show the current contact.

[signal] void ContactViewer::urlClicked(const QUrl &url)

This signal is emitted whenever the user has clicked on a url (e.g. homepage or blog url) in the viewer.

url The url that has been clicked.