Pimcommon

abstractgenericplugininterface.h
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8#include "pimcommon_export.h"
9#include <QObject>
10#include <memory>
11class QAction;
13namespace PimCommon
14{
15class AbstractGenericPlugin;
16class GenericPlugin;
17/**
18 * @brief The ActionType class
19 * @author Laurent Montel <montel@kde.org>
20 */
21class PIMCOMMON_EXPORT ActionType
22{
23public:
24 enum Type {
25 Tools = 0,
26 Edit = 1,
27 File = 2,
28 Action = 3,
29 PopupMenu = 4,
30 ToolBar = 5,
31 Message = 6,
32 Folder = 7,
33 };
34 ActionType() = default;
35
36 ActionType(QAction *action, Type type);
37 [[nodiscard]] QAction *action() const;
38 [[nodiscard]] Type type() const;
39
40 [[nodiscard]] bool operator==(ActionType other) const;
41
42private:
43 QAction *mAction = nullptr;
44 Type mType = Tools;
45};
46
47class AbstractGenericPluginInterfacePrivate;
48class PIMCOMMON_EXPORT AbstractGenericPluginInterface : public QObject
49{
50 Q_OBJECT
51public:
52 explicit AbstractGenericPluginInterface(QObject *parent = nullptr);
53 ~AbstractGenericPluginInterface() override;
54
55 void setParentWidget(QWidget *parent);
56 [[nodiscard]] QWidget *parentWidget() const;
57
58 void setPlugin(AbstractGenericPlugin *plugin);
59 [[nodiscard]] AbstractGenericPlugin *plugin() const;
60
61 virtual void createAction(KActionCollection *ac) = 0;
62 virtual void exec() = 0;
63
64 virtual void showConfigureDialog(QWidget *parentWidget = nullptr);
65
66Q_SIGNALS:
67 void emitPluginActivated(PimCommon::AbstractGenericPluginInterface *interface);
68 void message(const QString &str);
69
70private:
71 std::unique_ptr<AbstractGenericPluginInterfacePrivate> const d;
72};
73}
The AbstractGenericPlugin class.
folderdialogacltab.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:23 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.