Akonadi Contacts

grantleecontactviewer.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "grantleecontactviewer.h"
8#include <Akonadi/GrantleeContactFormatter>
9#include <KSharedConfig>
10
11#include <GrantleeTheme/GrantleeThemeManager>
12
13using namespace KAddressBookGrantlee;
14
15GrantleeContactViewer::GrantleeContactViewer(QWidget *parent)
16 : Akonadi::ContactViewer(parent)
17 , mFormatter(new KAddressBookGrantlee::GrantleeContactFormatter)
18{
19 setContactFormatter(mFormatter);
20 mFormatter->setAbsoluteThemePath(kaddressBookAbsoluteThemePath());
21}
22
23GrantleeContactViewer::~GrantleeContactViewer()
24{
25 delete mFormatter;
26}
27
28QString GrantleeContactViewer::kaddressBookAbsoluteThemePath() const
29{
30 QString themeName = GrantleeTheme::ThemeManager::configuredThemeName(QStringLiteral("addressbook"));
31 if (themeName.isEmpty()) {
32 themeName = QStringLiteral("default");
33 }
34 const QString absolutePath =
35 GrantleeTheme::ThemeManager::pathFromThemes(QStringLiteral("kaddressbook/viewertemplates/"), themeName, QStringLiteral("theme.desktop"));
36 return absolutePath;
37}
38
39void GrantleeContactViewer::setForceDisableQRCode(bool b)
40{
41 if (b != mFormatter->forceDisableQRCode()) {
42 mFormatter->setForceDisableQRCode(b);
43 updateView();
44 }
45}
46
47#include "moc_grantleecontactviewer.cpp"
A class that formats a contact as HTML code.
A widget for editing the display name of a contact.
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.