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
20class PURPOSEWIDGETS_EXPORT Menu : public QMenu
21{
22 Q_OBJECT
23public:
24 explicit Menu(QWidget *parent = nullptr);
25
26 /**
27 * Exposes the used AlternativesModel so that it can be configured to suit
28 * the application needs
29 */
30 AlternativesModel *model() const;
31
32 /**
33 * Forces a reload of the menu in case something changed in the model
34 */
35 void reload();
36
37Q_SIGNALS:
38
39 /**
40 * Emitted just before triggered, just before starting the share operation
41 * Can be used to do adjustments to the configuration, such as setting a new Url
42 * @since 6.2
43 */
44 void aboutToShare();
45
46 /**
47 * Emitted when a triggered job finishes
48 *
49 * @p output contains the information offered by the plugin. The information offered will depend on the plugin type.
50 * @p 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
51 * @p errorMessage the error message
52 *
53 * @see Purpose::Job
54 */
55 void finished(const QJsonObject &output, int error, const QString &errorMessage);
56
57private:
58 Q_DECLARE_PRIVATE(Menu)
59 MenuPrivate *const d_ptr;
60};
61
62}
63
64#endif
65

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