Akonadi Contacts

grantleecontactviewer.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2021 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)
18 {
19  setContactFormatter(mFormatter);
20  mFormatter->setAbsoluteThemePath(kaddressBookAbsoluteThemePath());
21 }
22 
23 GrantleeContactViewer::~GrantleeContactViewer()
24 {
25  delete mFormatter;
26 }
27 
28 QString GrantleeContactViewer::kaddressBookAbsoluteThemePath()
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-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.