Messagelib

viewerplugininterface.h
1 /*
2  SPDX-FileCopyrightText: 2015-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messageviewer_export.h"
10 #include <Akonadi/Item>
11 #include <KMime/Message>
12 #include <QObject>
13 
14 class QAction;
15 class KActionCollection;
16 namespace MessageViewer
17 {
18 class ViewerPluginInterfacePrivate;
19 /**
20  * @brief The ViewerPluginInterface class
21  * @author Laurent Montel <[email protected]>
22  */
23 class MESSAGEVIEWER_EXPORT ViewerPluginInterface : public QObject
24 {
25  Q_OBJECT
26 public:
27  explicit ViewerPluginInterface(QObject *parent = nullptr);
28  ~ViewerPluginInterface() override;
29  enum SpecificFeatureType { None = 0, NeedSelection = 2, NeedMessage = 4, NeedUrl = 8, All = 16 };
30  Q_FLAGS(SpecificFeatureTypes)
31  Q_DECLARE_FLAGS(SpecificFeatureTypes, SpecificFeatureType)
32 
33  virtual void execute();
34 
35  virtual void setText(const QString &text);
36  virtual QList<QAction *> actions() const;
37  virtual void setUrl(const QUrl &url);
38  virtual void setMessage(const KMime::Message::Ptr &value);
39  virtual void setMessageItem(const Akonadi::Item &item);
40  virtual void setCurrentCollection(const Akonadi::Collection &col);
41  virtual void closePlugin();
42  virtual ViewerPluginInterface::SpecificFeatureTypes featureTypes() const = 0;
43  virtual void updateAction(const Akonadi::Item &item);
44  virtual void refreshActionList(KActionCollection *ac);
45 
46 protected:
47  virtual void showWidget();
48  void addHelpTextAction(QAction *act, const QString &text);
49 
50 protected Q_SLOTS:
51  void slotActivatePlugin();
52 
53 Q_SIGNALS:
54  void activatePlugin(MessageViewer::ViewerPluginInterface *);
55 
56 private:
57  std::unique_ptr<ViewerPluginInterfacePrivate> const d;
58 };
59 }
The ViewerPluginInterface class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Mar 22 2023 04:07:16 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.