Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a1b7ef5d authored by Marco Martin's avatar Marco Martin

minimize to launcher when the switcher is not visible

parent 69d9c255
......@@ -31,4 +31,5 @@ QtObject {
property Item homeScreen
property QtObject homeScreenWindow
property bool homeScreenVisible: true
property bool taskSwitcherVisible: false
}
......@@ -25,6 +25,8 @@
#include <QModelIndex>
#include <QProcess>
#include <QDebug>
#include <QQuickItem>
#include <QQuickWindow>
// KDE
#include <KIO/ApplicationLauncherJob>
......@@ -38,6 +40,7 @@
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
constexpr int MAX_FAVOURITES = 5;
......@@ -444,5 +447,38 @@ void ApplicationListModel::setMaxFavoriteCount(int count)
emit maxFavoriteCountChanged();
}
void ApplicationListModel::setMinimizedDelegate(int row, QQuickItem *delegate)
{
if (row < 0 || row >= m_applicationList.count()) {
return;
}
if (!delegate || !delegate->parentItem() || !delegate->window()) {
return;
}
QWindow *delegateWindow = delegate->window();
if (!delegateWindow) {
return;
}
using namespace KWayland::Client;
KWayland::Client::PlasmaWindow *window = m_applicationList[row].window;
if (!window) {
return;
}
Surface *surface = Surface::fromWindow(delegateWindow);
if (!surface) {
return;
}
QRect rect = delegate->mapRectToScene(QRectF(0,0, delegate->width(), delegate->height())).toRect();
window->setMinimizedGeometry(surface, rect);
}
#include "moc_applicationlistmodel.cpp"
......@@ -106,6 +106,8 @@ public:
Q_INVOKABLE void loadApplications();
Q_INVOKABLE void setMinimizedDelegate(int row, QQuickItem *delegate);
public Q_SLOTS:
void sycocaDbChanged(const QStringList &change);
......
......@@ -27,7 +27,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import org.kde.phone.homescreen 1.0
ContainmentLayoutManager.ItemContainer {
......@@ -51,9 +51,30 @@ ContainmentLayoutManager.ItemContainer {
signal launch(int x, int y, var source, string title)
readonly property bool applicationRunning: model.applicationRunning
onApplicationRunningChanged: {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
}
}
Connections {
target: mainFlickable
onCancelEditModeForItemsRequested: cancelEdit()
function onCancelEditModeForItemsRequested() {
cancelEdit()
}
function onContentYChanged() {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
}
}
}
Connections {
target: MobileShell.HomeScreenControls
function taskSwitcherVisibleChanged() {
if (applicationRunning && !MobileShell.HomeScreenControls.taskSwitcherVisible) {
plasmoid.nativeInterface.applicationListModel.setMinimizedDelegate(index, delegate);
}
}
}
onDragActiveChanged: {
launcherDragManager.active = dragActive
......
......@@ -43,7 +43,7 @@ Item {
if (window.visible) {
tasksModel.requestPublishDelegateGeometry(tasksModel.index(model.index, 0), Qt.rect(pos.x, pos.y, delegate.width, delegate.height), delegate);
} else {
tasksModel.requestPublishDelegateGeometry(tasksModel.index(model.index, 0), Qt.rect(pos.x, pos.y, delegate.width, delegate.height), dummyWindowTask);
// tasksModel.requestPublishDelegateGeometry(tasksModel.index(model.index, 0), Qt.rect(pos.x, pos.y, delegate.width, delegate.height), dummyWindowTask);
}
}
Connections {
......@@ -58,6 +58,7 @@ Item {
syncDelegateGeometry();
}
}
Component.onCompleted: syncDelegateGeometry();
Item {
......
......@@ -24,6 +24,7 @@ import org.kde.taskmanager 0.1 as TaskManager
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
NanoShell.FullScreenOverlay {
id: window
......@@ -96,6 +97,7 @@ NanoShell.FullScreenOverlay {
if (!visible) {
tasksView.contentY = 0;
}
MobileShell.HomeScreenControls.taskSwitcherVisible = visible;
}
SequentialAnimation {
......
Markdown is supported
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