File indexing completed on 2024-04-28 04:00:33

0001 /*
0002     SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef PURPOSEMENU_H
0008 #define PURPOSEMENU_H
0009 
0010 #include "purposewidgets_export.h"
0011 
0012 #include <QMenu>
0013 
0014 namespace Purpose
0015 {
0016 class MenuPrivate;
0017 
0018 class AlternativesModel;
0019 
0020 class PURPOSEWIDGETS_EXPORT Menu : public QMenu
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit Menu(QWidget *parent = nullptr);
0025 
0026     /**
0027      * Exposes the used AlternativesModel so that it can be configured to suit
0028      * the application needs
0029      */
0030     AlternativesModel *model() const;
0031 
0032     /**
0033      * Forces a reload of the menu in case something changed in the model
0034      */
0035     void reload();
0036 
0037 Q_SIGNALS:
0038     /**
0039      * Emitted when a triggered job finishes
0040      *
0041      * @p output contains the information offered by the plugin. The information offered will depend on the plugin type.
0042      * @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
0043      * @p errorMessage the error message
0044      *
0045      * @see Purpose::Job
0046      */
0047     void finished(const QJsonObject &output, int error, const QString &errorMessage);
0048 
0049 private:
0050     Q_DECLARE_PRIVATE(Menu)
0051     MenuPrivate *const d_ptr;
0052 };
0053 
0054 }
0055 
0056 #endif