mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-12 17:17:50 +03:00
5e03174b7c
containment() is not accessible during the containment actions constructor. We now use the provided ::restore() function in order to load the actions BUG:441448
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2018 Michail Vourlakos <mvourlakos@gmail.com>
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef MENU_H
|
|
#define MENU_H
|
|
|
|
// Qt
|
|
#include <QObject>
|
|
|
|
// Plasma
|
|
#include <Plasma/ContainmentActions>
|
|
|
|
class QAction;
|
|
class QMenu;
|
|
|
|
struct LayoutInfo {
|
|
QString layoutName;
|
|
bool isBackgroundFileIcon;
|
|
QString iconName;
|
|
};
|
|
|
|
class Menu : public Plasma::ContainmentActions
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Menu(QObject *parent, const QVariantList &args);
|
|
~Menu() override;
|
|
|
|
QList<QAction *> contextualActions() override;
|
|
void restore(const KConfigGroup &) override;
|
|
|
|
QAction *action(const QString &name);
|
|
private Q_SLOTS:
|
|
void populateLayouts();
|
|
void populateMoveToLayouts();
|
|
void populateViewTemplates();
|
|
void quitApplication();
|
|
void requestConfiguration();
|
|
void requestWidgetExplorer();
|
|
void updateVisibleActions();
|
|
|
|
void addView(QAction *action);
|
|
void moveToLayout(QAction *action);
|
|
void switchToLayout(QAction *action);
|
|
|
|
private:
|
|
QStringList m_data;
|
|
QStringList m_viewTemplates;
|
|
|
|
QStringList m_actionsAlwaysShown;
|
|
QStringList m_activeLayoutNames;
|
|
|
|
QHash<QString, QAction *> m_actions;
|
|
|
|
QMenu *m_addViewMenu{nullptr};
|
|
QMenu *m_switchLayoutsMenu{nullptr};
|
|
QMenu *m_moveToLayoutMenu{nullptr};
|
|
};
|
|
|
|
#endif
|