Add invokable public API for emitting contextualActionsAboutToShow
Summary: This signal is emitted just before showing the context menu to allow lazy-loading expensive actions like hasAlternatives. This emitted by our code whenever we show a context menu from an event filter, however we want to use this code from a tooltip in D17410 Test Plan: Hovered over some applets, they correctly enabled/disabled the alternatives button Reviewers: #plasma Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20417
This commit is contained in:
parent
417a82b1b9
commit
83d85dc228
@ -784,6 +784,11 @@ bool AppletInterface::event(QEvent *event)
|
|||||||
return AppletQuickItem::event(event);
|
return AppletQuickItem::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppletInterface::prepareContextualActions()
|
||||||
|
{
|
||||||
|
emit applet()->contextualActionsAboutToShow();
|
||||||
|
}
|
||||||
|
|
||||||
bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
|
bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
@ -825,7 +830,7 @@ bool AppletInterface::eventFilter(QObject *watched, QEvent *event)
|
|||||||
if (desktopMenu->winId()) {
|
if (desktopMenu->winId()) {
|
||||||
desktopMenu->windowHandle()->setTransientParent(window());
|
desktopMenu->windowHandle()->setTransientParent(window());
|
||||||
}
|
}
|
||||||
emit applet()->contextualActionsAboutToShow();
|
prepareContextualActions();
|
||||||
ci->addAppletActions(desktopMenu, applet(), event);
|
ci->addAppletActions(desktopMenu, applet(), event);
|
||||||
|
|
||||||
if (!desktopMenu->isEmpty()) {
|
if (!desktopMenu->isEmpty()) {
|
||||||
|
@ -277,6 +277,14 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE QAction *action(QString name) const;
|
Q_INVOKABLE QAction *action(QString name) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be called before retrieving any action
|
||||||
|
* to ensure contents are up to date
|
||||||
|
* @see contextualActionsAboutToShow
|
||||||
|
* @since 5.58
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void prepareContextualActions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: remove?
|
* FIXME: remove?
|
||||||
* Retrieve the path of a file from the Plasmoid package
|
* Retrieve the path of a file from the Plasmoid package
|
||||||
|
Loading…
Reference in New Issue
Block a user