1 /*
2   SPDX-FileCopyrightText: 2015-2021 Laurent Montel <montel@kde.org>
3 
4   SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "pimcommon_export.h"
10 #include <QObject>
11 #include <memory>
12 class KActionCollection;
13 namespace PimCommon
14 {
15 class CustomToolsWidgetNg;
16 class CustomToolsViewInterface;
17 class CustomToolsPluginPrivate;
18 /**
19  * @brief The CustomToolsPlugin class
20  * @author Laurent Montel <montel@kde.org>
21  */
22 class PIMCOMMON_EXPORT CustomToolsPlugin : public QObject
23 {
24     Q_OBJECT
25 public:
26     explicit CustomToolsPlugin(QObject *parent = nullptr);
27     ~CustomToolsPlugin() override;
28 
29     virtual PimCommon::CustomToolsViewInterface *createView(KActionCollection *ac, CustomToolsWidgetNg *parent = nullptr) = 0;
30     Q_REQUIRED_RESULT virtual QString customToolName() const = 0;
31 
32     Q_REQUIRED_RESULT virtual bool hasConfigureDialog() const;
33     virtual void showConfigureDialog(QWidget *parent);
34 
35     void emitConfigChanged();
36 
37     Q_REQUIRED_RESULT virtual QString description() const;
38 
39     void setIsEnabled(bool enabled);
40     Q_REQUIRED_RESULT bool isEnabled() const;
41 
42 private:
43     std::unique_ptr<CustomToolsPluginPrivate> const d;
44 };
45 }
46