Akonadi Contacts

grantleecontactviewer.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "grantleecontactviewer.h"
8 #include "grantleecontactformatter.h"
9 #include <KSharedConfig>
10 
11 #include <GrantleeTheme/GrantleeThemeManager>
12 
13 using namespace KAddressBookGrantlee;
14 
15 GrantleeContactViewer::GrantleeContactViewer(QWidget *parent)
16  : Akonadi::ContactViewer(parent)
17  , mFormatter(new KAddressBookGrantlee::GrantleeContactFormatter)
18 {
19  setContactFormatter(mFormatter);
20  mFormatter->setAbsoluteThemePath(kaddressBookAbsoluteThemePath());
21 }
22 
23 GrantleeContactViewer::~GrantleeContactViewer()
24 {
25  delete mFormatter;
26 }
27 
28 QString 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 
39 void GrantleeContactViewer::setForceDisableQRCode(bool b)
40 {
41  if (b != mFormatter->forceDisableQRCode()) {
42  mFormatter->setForceDisableQRCode(b);
43  updateView();
44  }
45 }
bool isEmpty() const const
A class that formats a contact as HTML code.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:09:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.