Commit 77314f32 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Let OsdAction delete itself after emitting the selected() signal

parent 071282f5
......@@ -183,10 +183,8 @@ void KScreenDaemon::applyKnownConfig()
doApplyConfig(config);
}
void KScreenDaemon::applyOsdAction(KScreen::OsdAction *self, KScreen::OsdAction::Action action)
void KScreenDaemon::applyOsdAction(KScreen::OsdAction::Action action)
{
self->deleteLater();
switch (action) {
case KScreen::OsdAction::NoAction:
qCDebug(KSCREEN_KDED) << "OSD: no action";
......
......@@ -62,7 +62,7 @@ class Q_DECL_EXPORT KScreenDaemon : public KDEDModule
void setMonitorForChanges(bool enabled);
void outputConnectedChanged();
void showOutputIdentifier();
void applyOsdAction(KScreen::OsdAction *self, KScreen::OsdAction::Action action);
void applyOsdAction(KScreen::OsdAction::Action action);
Q_SIGNALS:
void outputConnected(const QString &outputName);
......
......@@ -48,7 +48,8 @@ public:
void setOsd(Osd *osd) {
connect(osd, &Osd::osdActionSelected,
this, [this](Action action) {
Q_EMIT selected(this, action);
Q_EMIT selected(action);
deleteLater();
});
}
};
......
......@@ -47,7 +47,7 @@ public:
Q_ENUM(Action)
Q_SIGNALS:
void selected(OsdAction *self, Action action);
void selected(Action action);
protected:
explicit OsdAction(QObject *parent = nullptr);
......
......@@ -80,8 +80,7 @@ void OsdTest::showActionSelector()
if (!m_useDBus) {
auto action = KScreen::OsdManager::self()->showActionSelector();
connect(action, &KScreen::OsdAction::selected,
[](KScreen::OsdAction *self, KScreen::OsdAction::Action action) {
self->deleteLater();
[](KScreen::OsdAction::Action action) {
qCDebug(KSCREEN_KDED) << "Selected action:" << action;
qApp->quit();
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment