File indexing completed on 2024-04-28 15:40:16

0001 // SPDX-FileCopyrightText: 2019-2022 The KPhotoAlbum Development Team
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #ifndef KPHOTOALBUM_PURPOSEMENU_H
0006 #define KPHOTOALBUM_PURPOSEMENU_H
0007 
0008 #include <kpabase/config-kpa-plugins.h>
0009 
0010 #include <PurposeWidgets/Menu>
0011 #include <QString>
0012 #include <QUrl>
0013 
0014 class QMenu;
0015 
0016 namespace Purpose
0017 {
0018 class Menu;
0019 }
0020 
0021 namespace Plugins
0022 {
0023 
0024 class PurposeMenu : public Purpose::Menu
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit PurposeMenu(QMenu *parent);
0029 
0030 public Q_SLOTS:
0031     void slotSelectionChanged();
0032 
0033 Q_SIGNALS:
0034     /**
0035      * @brief imageShared is emitted when an image was shared successfully.
0036      * The url contains the optional location of the shared data
0037      * (e.g. for plugins that upload to a remote location).
0038      */
0039     void imageShared(QUrl);
0040     void imageSharingFailed(QString message);
0041 
0042 private:
0043     QMenu *m_parentMenu;
0044     bool m_menuUpdateNeeded; ///< Keeps track of changed image selection
0045     /**
0046      * @brief Load the Purpose::Menu, add it to the parent menu, and set up connections.
0047      */
0048     void loadPurposeMenu();
0049     /**
0050      * @brief Load Purpose menu items into the Purpose::Menu.
0051      * This is dependent on the current set of images.
0052      */
0053     void loadPurposeItems();
0054 };
0055 
0056 }
0057 
0058 #endif /* PURPOSEMENU_H */
0059 
0060 // vi:expandtab:tabstop=4 shiftwidth=4: