File indexing completed on 2024-11-24 04:39:28

0001 /*
0002     This file is part of Akonadi Contact.
0003 
0004     SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "akonadi-contact-core_export.h"
0012 
0013 #include "abstractcontactformatter.h"
0014 
0015 #include <memory>
0016 
0017 namespace Akonadi
0018 {
0019 class StandardContactFormatterPrivate;
0020 
0021 /**
0022  * @short A class that formats a contact as HTML code.
0023  *
0024  * Examples:
0025  *
0026  * @code
0027  *
0028  * using namespace Akonadi;
0029  *
0030  * const KContacts::Addressee contact = ...
0031  *
0032  * StandardContactFormatter formatter;
0033  * formatter.setContact( contact );
0034  *
0035  * QTextBrowser *view = new QTextBrowser;
0036  * view->setHtml( formatter.toHtml() );
0037  *
0038  * @endcode
0039  *
0040  * @author Tobias Koenig <tokoe@kde.org>
0041  * @since 4.5
0042  */
0043 class AKONADI_CONTACT_CORE_EXPORT StandardContactFormatter : public AbstractContactFormatter
0044 {
0045 public:
0046     /**
0047      * Creates a new standard contact formatter.
0048      */
0049     StandardContactFormatter();
0050 
0051     /**
0052      * Destroys the standard contact formatter.
0053      */
0054     ~StandardContactFormatter() override;
0055 
0056     /**
0057      * Returns the contact formatted as HTML.
0058      */
0059     [[nodiscard]] QString toHtml(HtmlForm form = SelfcontainedForm) const override;
0060 
0061     /*
0062      * @since 4.9.1
0063      */
0064     void setDisplayQRCode(bool show);
0065     /*
0066      * @since 4.9.1
0067      */
0068     [[nodiscard]] bool displayQRCode() const;
0069 
0070 private:
0071     //@cond PRIVATE
0072     std::unique_ptr<StandardContactFormatterPrivate> const d;
0073     //@endcond
0074 };
0075 }