diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 7e6cf2cf73717ba674850d423d38ba53268168d4..3778e2385f31265efb639786c3987e2d5148228e 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -233,6 +233,13 @@ void ShellCorona::init() connect(action, &QAction::triggered, this, [this, i] { activateTaskManagerEntry(i); }); + + QAction *actionNewWindow = taskbarActions->addAction(QStringLiteral("activate task manager entry %1 new window").arg(QString::number(entryNumber))); + actionNewWindow->setText(i18n("Open new window for Task Manager Task #%1", entryNumber)); + KGlobalAccel::setGlobalShortcut(actionNewWindow, QKeySequence(Qt::META + Qt::SHIFT + key)); + connect(actionNewWindow, &QAction::triggered, this, [this, i] { + activateTaskManagerEntry(i, true); + }); } new Osd(m_config, this); @@ -2272,9 +2279,9 @@ void ShellCorona::activateLauncherMenu() } } -void ShellCorona::activateTaskManagerEntry(int index) +void ShellCorona::activateTaskManagerEntry(int index, bool requestNewWindow) { - auto activateTaskManagerEntryOnContainment = [](const Plasma::Containment *c, int index) { + auto activateTaskManagerEntryOnContainment = [](const Plasma::Containment *c, int index, bool requestNewWindow) { const auto &applets = c->applets(); for (auto *applet : applets) { const auto &provides = applet->pluginMetaData().value(QStringLiteral("X-Plasma-Provides"), QStringList()); @@ -2292,7 +2299,12 @@ void ShellCorona::activateTaskManagerEntry(int index) // is pretty much trial and error. // Also, "var" arguments are treated as QVariant in QMetaObject - int methodIndex = metaObject->indexOfMethod("activateTaskAtIndex(QVariant)"); + int methodIndex; + if(requestNewWindow) { + methodIndex = metaObject->indexOfMethod("activateTaskAtIndexNewWindow(QVariant)"); + } else { + methodIndex = metaObject->indexOfMethod("activateTaskAtIndex(QVariant)"); + } if (methodIndex == -1) { continue; } @@ -2316,14 +2328,14 @@ void ShellCorona::activateTaskManagerEntry(int index) if (it.value()->screen() != m_screenPool->primaryScreen()) { continue; } - if (activateTaskManagerEntryOnContainment(it.key(), index)) { + if (activateTaskManagerEntryOnContainment(it.key(), index, requestNewWindow)) { return; } } // we didn't find anything on primary, try all the panels for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) { - if (activateTaskManagerEntryOnContainment(it.key(), index)) { + if (activateTaskManagerEntryOnContainment(it.key(), index, requestNewWindow)) { return; } } diff --git a/shell/shellcorona.h b/shell/shellcorona.h index 0e1caefc49ce12277b2a1fedb0c62293f5f86caf..308f32da6932a65ef1c19788003e853ce79370ed 100644 --- a/shell/shellcorona.h +++ b/shell/shellcorona.h @@ -235,7 +235,7 @@ private Q_SLOTS: void panelContainmentDestroyed(QObject *cont); void handleScreenRemoved(QScreen *screen); - void activateTaskManagerEntry(int index); + void activateTaskManagerEntry(int index, bool requestNewWindow = false); private: void updateStruts();