From 127cf45626ddfa7d16a35570cadb97b570d3c3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 26 Jul 2013 19:58:42 +0200 Subject: [PATCH] protect kwin against broken tabbox installation This happens because some distros ship broken installations of KWin and KWinActive, but could also appear to QML hacking users BUG: 322830 FIXED-IN: 4.11 REVIEW: 111732 --- tabbox/declarative.cpp | 2 ++ tabbox/tabboxhandler.cpp | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index 18e0a21d5a..97a89c38fe 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -328,6 +328,8 @@ void DeclarativeView::currentIndexChanged(int row) void DeclarativeView::updateQmlSource(bool force) { + if (status() != Ready) + return; if (tabBox->config().tabBoxMode() != m_mode) { return; } diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index 169c7bac37..f0e0ffe8cb 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -33,6 +33,7 @@ along with this program. If not, see . #include // KDE #include +#include #include namespace KWin @@ -216,19 +217,29 @@ void TabBoxHandler::show() d->lastRaisedClient = 0; d->lastRaisedClientSucc = 0; if (d->config.isShowTabBox()) { + DeclarativeView *dv(NULL); if (d->config.tabBoxMode() == TabBoxConfig::ClientTabBox) { // use declarative view if (!d->m_declarativeView) { d->m_declarativeView = new DeclarativeView(d->clientModel(), TabBoxConfig::ClientTabBox); } - d->m_declarativeView->show(); - d->m_declarativeView->setCurrentIndex(d->index, true); + dv = d->m_declarativeView; } else { if (!d->m_declarativeDesktopView) { d->m_declarativeDesktopView = new DeclarativeView(d->desktopModel(), TabBoxConfig::DesktopTabBox); } - d->m_declarativeDesktopView->show(); - d->m_declarativeDesktopView->setCurrentIndex(d->index); + dv = d->m_declarativeDesktopView; + } + if (dv->status() == QDeclarativeView::Ready && dv->rootObject()) { + dv->show(); + dv->setCurrentIndex(d->index, d->config.tabBoxMode() == TabBoxConfig::ClientTabBox); + } else { + QStringList args; + args << "--passivepopup" << /*i18n*/("The Window Switcher installation is broken, resources are missing.\n" + "Contact your distribution about this.") << "20"; + KProcess::startDetached("kdialog", args); + hide(); + return; } } if (d->config.isHighlightWindows()) {