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 "abstractcontactgroupformatter.h"
0014 
0015 #include <memory>
0016 
0017 namespace Akonadi
0018 {
0019 class StandardContactGroupFormatterPrivate;
0020 
0021 /**
0022  * @short A class that formats a contact group as HTML code.
0023  *
0024  * Examples:
0025  *
0026  * @code
0027  *
0028  * using namespace Akonadi;
0029  *
0030  * const KContacts::ContactGroup group = ...
0031  *
0032  * StandardContactGroupFormatter formatter;
0033  * formatter.setContactGroup( group );
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.6
0042  */
0043 class AKONADI_CONTACT_CORE_EXPORT StandardContactGroupFormatter : public AbstractContactGroupFormatter
0044 {
0045 public:
0046     /**
0047      * Creates a new standard contact group formatter.
0048      */
0049     StandardContactGroupFormatter();
0050 
0051     /**
0052      * Destroys the standard contact group formatter.
0053      */
0054     ~StandardContactGroupFormatter() override;
0055 
0056     /**
0057      * Returns the contact group formatted as HTML.
0058      */
0059     [[nodiscard]] QString toHtml(HtmlForm form = SelfcontainedForm) const override;
0060 
0061 private:
0062     //@cond PRIVATE
0063     std::unique_ptr<StandardContactGroupFormatterPrivate> const d;
0064     //@endcond
0065 };
0066 }