File indexing completed on 2024-11-17 04:40:40

0001 /*
0002     This file is part of Contact Editor.
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 <QWidget>
0012 
0013 namespace KContacts
0014 {
0015 class Addressee;
0016 }
0017 
0018 namespace Akonadi
0019 {
0020 class ContactMetaDataBase;
0021 
0022 class AbstractContactEditorWidget : public QWidget
0023 {
0024 public:
0025     /**
0026      * Creates a new abstract contact editor widget.
0027      *
0028      * @param parent The parent widget.
0029      */
0030     explicit AbstractContactEditorWidget(QWidget *parent = nullptr)
0031         : QWidget(parent)
0032     {
0033     }
0034 
0035     /**
0036      * Destroys the abstract contact editor widget.
0037      */
0038     ~AbstractContactEditorWidget() override = default;
0039 
0040     /**
0041      * @param contact loads the given contact into the editor widget
0042      */
0043     virtual void loadContact(const KContacts::Addressee &contact, const Akonadi::ContactMetaDataBase &metaData) = 0;
0044 
0045     /**
0046      * @param contact store the given contact into the editor widget
0047      */
0048     virtual void storeContact(KContacts::Addressee &contact, Akonadi::ContactMetaDataBase &metaData) const = 0;
0049 
0050     /**
0051      * @param readOnly set read-only mode
0052      */
0053     virtual void setReadOnly(bool readOnly) = 0;
0054 
0055     [[nodiscard]] virtual bool hasNoSavedData() const
0056     {
0057         return false;
0058     }
0059 };
0060 }