1/*
2 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef PURPOSEMENU_H
8#define PURPOSEMENU_H
9
10#include "purposewidgets_export.h"
11
12#include <QMenu>
13
14namespace Purpose
15{
16class MenuPrivate;
17
18class AlternativesModel;
19
20/*!
21 * \class Purpose::Menu
22 * \inheaderfile Purpose/Menu
23 * \inmodule PurposeWidgets
24 *
25 * \brief A menu showing different alternatives.
26 */
27class PURPOSEWIDGETS_EXPORT Menu : public QMenu
28{
29 Q_OBJECT
30public:
31 /*!
32 *
33 */
34 explicit Menu(QWidget *parent = nullptr);
35
36 /*!
37 * Exposes the used AlternativesModel so that it can be configured to suit
38 * the application needs
39 */
40 AlternativesModel *model() const;
41
42 /*!
43 * Forces a reload of the menu in case something changed in the model
44 */
45 void reload();
46
47Q_SIGNALS:
48
49 /*!
50 * Emitted just before triggered, just before starting the share operation.
51 *
52 * Can be used to do adjustments to the configuration, such as setting a new Url.
53 * \since 6.2
54 */
55 void aboutToShare();
56
57 /*!
58 * Emitted when a triggered job finishes
59 *
60 * \a output contains the information offered by the plugin. The information offered will depend on the plugin type.
61 *
62 * \a error will be 0 if the execution was successful, KIO::ERR_USER_CANCELED if cancelled by the user, otherwise it will provide an error message
63 *
64 * \a errorMessage the error message
65 *
66 * \sa Purpose::Job
67 */
68 void finished(const QJsonObject &output, int error, const QString &errorMessage);
69
70private:
71 Q_DECLARE_PRIVATE(Menu)
72 MenuPrivate *const d_ptr;
73};
74
75}
76
77#endif
78

source code of purpose/src/widgets/menu.h