From a3dae3abb7b07bca9638fbe80b328cf8e977fa45 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 15 Jan 2018 10:25:32 +0100 Subject: [PATCH] [Panel View] Check if it's the same applet we're configuring before just hiding current view This fixes opening panel controller while an applet config dialog was open. It would find that we want to show config for a panel but find a config is already open, so it would just close it, even though it was not the panel controller (which should be toggleable) but another applet config. While at it restructure if statements a bit. Differential Revision: https://phabricator.kde.org/D9799 --- shell/panelview.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/shell/panelview.cpp b/shell/panelview.cpp index 1d1b529e9..9049341e2 100644 --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -578,26 +578,30 @@ void PanelView::showConfigurationInterface(Plasma::Applet *applet) Plasma::Containment *cont = qobject_cast(applet); - if (m_panelConfigView && cont && cont == containment() && cont->isContainment()) { - if (m_panelConfigView.data()->isVisible()) { - m_panelConfigView.data()->hide(); - } else { - m_panelConfigView.data()->show(); - KWindowSystem::setState(m_panelConfigView.data()->winId(), NET::SkipTaskbar | NET::SkipPager); - } - return; - } else if (m_panelConfigView) { + const bool isPanelConfig = (cont && cont == containment() && cont->isContainment()); + + if (m_panelConfigView) { if (m_panelConfigView->applet() == applet) { + if (isPanelConfig) { // toggles panel controller, whereas applet config is always brought to front + if (m_panelConfigView->isVisible()) { + m_panelConfigView->hide(); + } else { + m_panelConfigView->show(); + KWindowSystem::setState(m_panelConfigView.data()->winId(), NET::SkipTaskbar | NET::SkipPager); + } + return; + } + m_panelConfigView->show(); m_panelConfigView->requestActivate(); return; - } else { - m_panelConfigView->hide(); - m_panelConfigView->deleteLater(); } + + m_panelConfigView->hide(); + m_panelConfigView->deleteLater(); } - if (cont && cont == containment() && cont->isContainment()) { + if (isPanelConfig) { m_panelConfigView = new PanelConfigView(cont, this); } else { m_panelConfigView = new PlasmaQuick::ConfigView(applet); @@ -606,7 +610,7 @@ void PanelView::showConfigurationInterface(Plasma::Applet *applet) m_panelConfigView.data()->init(); m_panelConfigView.data()->show(); - if (cont && cont == containment() && cont->isContainment()) { + if (isPanelConfig) { KWindowSystem::setState(m_panelConfigView.data()->winId(), NET::SkipTaskbar | NET::SkipPager); } }