File indexing completed on 2024-11-24 04:39:35
0001 /* 0002 This file is part of Akonadi Contact. 0003 0004 SPDX-FileCopyrightText: 2009 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-widgets_export.h" 0012 0013 #include <QDialog> 0014 0015 #include <memory> 0016 0017 namespace Akonadi 0018 { 0019 class Item; 0020 class ContactViewer; 0021 class ContactViewerDialogPrivate; 0022 0023 /** 0024 * @short A dialog for displaying a contact in Akonadi. 0025 * 0026 * This dialog provides a way to show a contact from the 0027 * Akonadi storage. 0028 * 0029 * Example: 0030 * 0031 * @code 0032 * 0033 * using namespace Akonadi; 0034 * 0035 * const Item contact = ... 0036 * 0037 * ContactViewerDialog *dlg = new ContactViewerDialog( this ); 0038 * dlg->setContact( contact ); 0039 * dlg->show(); 0040 * 0041 * @endcode 0042 * 0043 * @author Tobias Koenig <tokoe@kde.org> 0044 * @since 4.4 0045 */ 0046 class AKONADI_CONTACT_WIDGETS_EXPORT ContactViewerDialog : public QDialog 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 /** 0052 * Creates a new contact viewer dialog. 0053 * 0054 * @param parent The parent widget of the dialog. 0055 */ 0056 explicit ContactViewerDialog(QWidget *parent = nullptr); 0057 0058 /** 0059 * Destroys the contact viewer dialog. 0060 */ 0061 ~ContactViewerDialog() override; 0062 0063 /** 0064 * Returns the contact that is currently displayed. 0065 */ 0066 [[nodiscard]] Akonadi::Item contact() const; 0067 0068 /** 0069 * Returns the ContactViewer that is used by this dialog. 0070 */ 0071 ContactViewer *viewer() const; 0072 0073 public Q_SLOTS: 0074 /** 0075 * Sets the @p contact that shall be displayed in the dialog. 0076 */ 0077 void setContact(const Akonadi::Item &contact); 0078 0079 private: 0080 //@cond PRIVATE 0081 std::unique_ptr<ContactViewerDialogPrivate> const d; 0082 //@endcond 0083 }; 0084 }