mobileshellstate: Move to DBus API instead of trying to use shared QML context

This also allows us to trigger behaviour from other processes that import mobileshell
This commit is contained in:
Devin Lin 2023-03-19 18:32:19 -07:00
parent be7c36d0c2
commit f25840bfc2
29 changed files with 381 additions and 222 deletions

View file

@ -66,7 +66,7 @@ Components.BaseItem {
root.toggleFunction();
} else if (root.settingsCommand && !root.restrictedPermissions) {
closeRequested();
MobileShellState.Shell.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
root.icon,
root.text,
iconItem.Kirigami.ScenePosition.x + iconItem.width/2,
@ -79,7 +79,7 @@ Components.BaseItem {
function delegatePressAndHold() {
if (root.settingsCommand && !root.restrictedPermissions) {
closeRequested();
MobileShellState.Shell.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
root.icon,
root.text,
iconItem.Kirigami.ScenePosition.x + iconItem.width/2,

View file

@ -57,8 +57,8 @@ MouseArea { // use mousearea to ensure clicks don't go behind
// close when homescreen requested
Connections {
target: MobileShellState.HomeScreenControls
function onOpenHomeScreen() {
target: MobileShellState.ShellDBusClient
function onOpenHomeScreenRequested() {
root.close();
}
}
@ -129,7 +129,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind
ScriptAction {
script: {
// close the app drawer after it isn't visible
MobileShellState.HomeScreenControls.resetHomeScreenPosition();
MobileShellState.ShellDBusClient.resetHomeScreenPosition();
}
}
}
@ -161,7 +161,7 @@ MouseArea { // use mousearea to ensure clicks don't go behind
ScriptAction {
script: {
// close the app drawer after it isn't visible
MobileShellState.HomeScreenControls.resetHomeScreenPosition();
MobileShellState.ShellDBusClient.resetHomeScreenPosition();
}
}
}

View file

@ -77,14 +77,14 @@ Item {
//BEGIN API implementation
Connections {
target: MobileShellState.HomeScreenControls
target: MobileShellState.ShellDBusClient
function onOpenHomeScreen() {
function onOpenHomeScreenRequested() {
if (WindowPlugin.WindowMaximizedTracker.showingWindow) {
itemContainer.zoomIn();
}
MobileShellState.HomeScreenControls.resetHomeScreenPosition();
resetHomeScreenPosition();
WindowPlugin.WindowUtil.unsetAllMinimizedGeometries(root);
WindowPlugin.WindowUtil.minimizeAll();
@ -92,46 +92,24 @@ Item {
root.homeTriggered();
}
function onResetHomeScreenPosition() {
function onResetHomeScreenPositionRequested() {
root.resetHomeScreenPosition();
}
function onRequestRelativeScroll(pos) {
// TODO
//homescreen.appDrawer.offset -= pos.y;
//lastRequestedPosition = pos.y;
}
function onOpenAppLaunchAnimation(splashIcon, title, x, y, sourceIconSize) {
function onOpenAppLaunchAnimationRequested(splashIcon, title, x, y, sourceIconSize) {
startupFeedback.open(splashIcon, title, x, y, sourceIconSize);
}
function onCloseAppLaunchAnimation() {
function onCloseAppLaunchAnimationRequested() {
startupFeedback.close();
}
}
Plasmoid.onScreenChanged: {
if (plasmoid.screen == 0) {
MobileShellState.HomeScreenControls.homeScreenWindow = root.Window.window;
}
}
Window.onWindowChanged: {
if (plasmoid.screen == 0) {
MobileShellState.HomeScreenControls.homeScreenWindow = root.Window.window;
}
}
//END API implementation
Component.onCompleted: {
// determine the margins used
evaluateMargins();
// set API variables
if (plasmoid.screen == 0) {
MobileShellState.HomeScreenControls.homeScreenWindow = root.Window.window;
}
}
// homescreen visual component

View file

@ -179,7 +179,7 @@ Window {
onClicked: {
let coords = mapToItem(flickable, 0, 0);
MobileShellState.Shell.openAppLaunchAnimation("audio-volume-high", i18n("Audio Settings"), coords.x, coords.y, PlasmaCore.Units.iconSizes.medium);
MobileShellState.ShellDBusClient.openAppLaunchAnimation("audio-volume-high", i18n("Audio Settings"), coords.x, coords.y, PlasmaCore.Units.iconSizes.medium);
MobileShell.ShellUtil.executeCommand("plasma-open-settings kcm_pulseaudio");
}
}

View file

@ -75,7 +75,7 @@ Item {
onClicked: {
Components.AppLaunch.launchOrActivateApp(modelData.desktopEntry + ".desktop");
MobileShellState.Shell.closeActionDrawer();
MobileShellState.ShellDBusClient.closeActionDrawer();
}
Components.BaseItem {

View file

@ -6,7 +6,22 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set(mobileshellstateplugin_SRCS
mobileshellstateplugin.cpp
shelldbusobject.cpp
shelldbusclient.cpp
)
qt_generate_dbus_interface(
${CMAKE_CURRENT_SOURCE_DIR}/shelldbusobject.h
org.kde.plasmashell.Mobile.xml
OPTIONS -s -m -P
)
qt_add_dbus_adaptor(mobileshellstateplugin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasmashell.Mobile.xml
${CMAKE_CURRENT_SOURCE_DIR}/shelldbusobject.h ShellDBusObject)
qt_add_dbus_interface(mobileshellstateplugin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasmashell.Mobile.xml plasmashellmobileinterface)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasmashell.Mobile.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
qt_add_resources(RESOURCES resources.qrc)
add_library(mobileshellstateplugin SHARED ${mobileshellstateplugin_SRCS} ${RESOURCES})
@ -18,6 +33,7 @@ target_link_libraries(mobileshellstateplugin
Qt::Qml
Qt::Gui
Qt::Quick
Qt::DBus
KF6::Plasma
KF6::I18n
KF6::Notifications

View file

@ -2,6 +2,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "mobileshellstateplugin.h"
#include "shelldbusclient.h"
#include "shelldbusobject.h"
#include <QQmlContext>
#include <QQuickItem>
@ -15,9 +17,11 @@ void MobileShellStatePlugin::registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell.state"));
qmlRegisterType<ShellDBusObject>(uri, 1, 0, "ShellDBusObject");
qmlRegisterSingletonType<ShellDBusClient>(uri, 1, 0, "ShellDBusClient", [](QQmlEngine *, QJSEngine *) -> QObject * {
return ShellDBusClient::self();
});
// /
qmlRegisterSingletonType(resolvePath("AudioProvider.qml"), uri, 1, 0, "AudioProvider");
qmlRegisterSingletonType(resolvePath("HomeScreenControls.qml"), uri, 1, 0, "HomeScreenControls");
qmlRegisterSingletonType(resolvePath("Shell.qml"), uri, 1, 0, "Shell");
qmlRegisterSingletonType(resolvePath("TopPanelControls.qml"), uri, 1, 0, "TopPanelControls");
}

View file

@ -1,26 +0,0 @@
// SPDX-FileCopyrightText: 2020 Marco Martin <mart@kde.org>
// SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.12
import QtQuick.Window 2.2
pragma Singleton
/**
* Provides access to the homescreen plasmoid containment within the shell.
*/
QtObject {
id: root
signal openHomeScreen()
signal resetHomeScreenPosition()
signal requestRelativeScroll(point pos)
signal openAppLaunchAnimation(string splashIcon, string title, real x, real y, real sourceIconSize)
signal closeAppLaunchAnimation()
property var taskSwitcher
property QtObject homeScreenWindow
property bool taskSwitcherVisible: false
}

View file

@ -1,47 +0,0 @@
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Window 2.15
pragma Singleton
/**
* Provides access to common functions within the shell. Only available within the plasmashell process.
*/
QtObject {
id: delegate
/**
* Whether the action drawer is currently open.
*/
readonly property bool actionDrawerVisible: TopPanelControls.actionDrawerVisible
/**
* Open the app launch screen with animation parameters.
*/
function openAppLaunchAnimation(splashIcon: string, title: string, x: real, y: real, sourceIconSize: real) {
HomeScreenControls.openAppLaunchAnimation(splashIcon, title, x, y, sourceIconSize);
}
/**
* Close the app launch screen.
*/
function closeAppLaunchAnimation() {
HomeScreenControls.closeAppLaunchAnimation();
}
/**
* Open the action drawer.
*/
function openActionDrawer() {
TopPanelControls.openActionDrawer();
}
/**
* Close the action drawer, if it is open.
*/
function closeActionDrawer() {
TopPanelControls.closeActionDrawer();
}
}

View file

@ -1,26 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.12
import org.kde.plasma.core 2.0 as PlasmaCore
pragma Singleton
/**
* Provides access to the panel plasmoid containment within the shell.
*/
QtObject {
id: root
signal startSwipe()
signal endSwipe()
signal requestRelativeScroll(real offsetY)
signal closeActionDrawer()
signal openActionDrawer()
property bool inSwipe: false
property bool actionDrawerVisible: false
property var notificationsWidget: null // updated in panel containment
}

View file

@ -4,9 +4,6 @@
-->
<RCC>
<qresource prefix="/org/kde/plasma/private/mobileshell/state/">
<file>qml/HomeScreenControls.qml</file>
<file>qml/Shell.qml</file>
<file>qml/TopPanelControls.qml</file>
<file>qml/AudioProvider.qml</file>
</qresource>
</RCC>

View file

@ -0,0 +1,112 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "shelldbusclient.h"
#include <QDBusServiceWatcher>
ShellDBusClient::ShellDBusClient(QObject *parent)
: QObject{parent}
, m_interface{new OrgKdePlasmashellInterface{QStringLiteral("org.kde.plasmashell"), QStringLiteral("/Mobile"), QDBusConnection::sessionBus(), this}}
, m_connected{false}
{
m_watcher = new QDBusServiceWatcher(QStringLiteral("org.kde.plasmashell"), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
if (m_interface->isValid()) {
connectSignals();
}
connect(m_watcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() -> void {
m_connected = true;
if (m_interface->isValid()) {
connectSignals();
}
});
connect(m_watcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() -> void {
m_connected = false;
});
}
ShellDBusClient *ShellDBusClient::self()
{
static ShellDBusClient *instance = new ShellDBusClient;
return instance;
}
void ShellDBusClient::connectSignals()
{
connect(m_interface, &OrgKdePlasmashellInterface::isActionDrawerOpenChanged, this, &ShellDBusClient::updateIsActionDrawerOpen);
connect(m_interface, &OrgKdePlasmashellInterface::doNotDisturbChanged, this, &ShellDBusClient::updateDoNotDisturb);
connect(m_interface, &OrgKdePlasmashellInterface::openActionDrawerRequested, this, &ShellDBusClient::openActionDrawerRequested);
connect(m_interface, &OrgKdePlasmashellInterface::closeActionDrawerRequested, this, &ShellDBusClient::closeActionDrawerRequested);
connect(m_interface, &OrgKdePlasmashellInterface::openAppLaunchAnimationRequested, this, &ShellDBusClient::openAppLaunchAnimationRequested);
connect(m_interface, &OrgKdePlasmashellInterface::closeAppLaunchAnimationRequested, this, &ShellDBusClient::closeAppLaunchAnimationRequested);
connect(m_interface, &OrgKdePlasmashellInterface::openHomeScreenRequested, this, &ShellDBusClient::openHomeScreenRequested);
connect(m_interface, &OrgKdePlasmashellInterface::resetHomeScreenPositionRequested, this, &ShellDBusClient::resetHomeScreenPositionRequested);
updateIsActionDrawerOpen();
updateDoNotDisturb();
}
bool ShellDBusClient::doNotDisturb()
{
return m_doNotDisturb;
}
void ShellDBusClient::setDoNotDisturb(bool value)
{
m_interface->setDoNotDisturb(value);
}
bool ShellDBusClient::isActionDrawerOpen()
{
return m_isActionDrawerOpen;
}
void ShellDBusClient::setIsActionDrawerOpen(bool value)
{
m_interface->setIsActionDrawerOpen(value);
}
void ShellDBusClient::openActionDrawer()
{
m_interface->openActionDrawer();
}
void ShellDBusClient::closeActionDrawer()
{
m_interface->closeActionDrawer();
}
void ShellDBusClient::openAppLaunchAnimation(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize)
{
m_interface->openAppLaunchAnimation(splashIcon, title, x, y, sourceIconSize);
}
void ShellDBusClient::closeAppLaunchAnimation()
{
m_interface->closeAppLaunchAnimation();
}
void ShellDBusClient::openHomeScreen()
{
m_interface->openHomeScreen();
}
void ShellDBusClient::resetHomeScreenPosition()
{
m_interface->resetHomeScreenPosition();
}
void ShellDBusClient::updateDoNotDisturb()
{
m_doNotDisturb = m_interface->doNotDisturb();
Q_EMIT doNotDisturbChanged();
}
void ShellDBusClient::updateIsActionDrawerOpen()
{
m_isActionDrawerOpen = m_interface->isActionDrawerOpen();
Q_EMIT isActionDrawerOpenChanged();
}

View file

@ -0,0 +1,60 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "plasmashellmobileinterface.h"
#include <QDBusServiceWatcher>
#include <QObject>
#include <QString>
class ShellDBusClient : public QObject
{
Q_OBJECT
Q_PROPERTY(bool doNotDisturb READ doNotDisturb WRITE setDoNotDisturb NOTIFY doNotDisturbChanged);
Q_PROPERTY(bool isActionDrawerOpen READ isActionDrawerOpen WRITE setIsActionDrawerOpen NOTIFY isActionDrawerOpenChanged);
public:
explicit ShellDBusClient(QObject *parent = nullptr);
static ShellDBusClient *self();
bool doNotDisturb();
void setDoNotDisturb(bool value);
bool isActionDrawerOpen();
void setIsActionDrawerOpen(bool value);
Q_INVOKABLE void openActionDrawer();
Q_INVOKABLE void closeActionDrawer();
Q_INVOKABLE void openAppLaunchAnimation(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize);
Q_INVOKABLE void closeAppLaunchAnimation();
Q_INVOKABLE void openHomeScreen();
Q_INVOKABLE void resetHomeScreenPosition();
Q_SIGNALS:
void isActionDrawerOpenChanged();
void doNotDisturbChanged();
void openActionDrawerRequested();
void closeActionDrawerRequested();
void openAppLaunchAnimationRequested(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize);
void closeAppLaunchAnimationRequested();
void openHomeScreenRequested();
void resetHomeScreenPositionRequested();
private Q_SLOTS:
void updateDoNotDisturb();
void updateIsActionDrawerOpen();
private:
void connectSignals();
OrgKdePlasmashellInterface *m_interface;
QDBusServiceWatcher *m_watcher;
bool m_doNotDisturb;
bool m_isActionDrawerOpen;
bool m_connected;
};

View file

@ -0,0 +1,70 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "shelldbusobject.h"
#include "mobileadaptor.h"
#include <QDBusConnection>
ShellDBusObject::ShellDBusObject(QObject *parent)
: QObject{parent}
{
new PlasmashellAdaptor{this};
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Mobile"), this);
}
bool ShellDBusObject::doNotDisturb()
{
return m_doNotDisturb;
}
void ShellDBusObject::setDoNotDisturb(bool value)
{
if (value != m_doNotDisturb) {
m_doNotDisturb = value;
Q_EMIT doNotDisturbChanged();
}
}
bool ShellDBusObject::isActionDrawerOpen()
{
return m_isActionDrawerOpen;
}
void ShellDBusObject::setIsActionDrawerOpen(bool value)
{
if (value != m_isActionDrawerOpen) {
m_isActionDrawerOpen = value;
Q_EMIT isActionDrawerOpenChanged();
}
}
void ShellDBusObject::openActionDrawer()
{
Q_EMIT openActionDrawerRequested();
}
void ShellDBusObject::closeActionDrawer()
{
Q_EMIT closeActionDrawerRequested();
}
void ShellDBusObject::openAppLaunchAnimation(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize)
{
Q_EMIT openAppLaunchAnimationRequested(splashIcon, title, x, y, sourceIconSize);
}
void ShellDBusObject::closeAppLaunchAnimation()
{
Q_EMIT closeAppLaunchAnimationRequested();
}
void ShellDBusObject::openHomeScreen()
{
Q_EMIT openHomeScreenRequested();
}
void ShellDBusObject::resetHomeScreenPosition()
{
Q_EMIT resetHomeScreenPositionRequested();
}

View file

@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QObject>
#include <QString>
class ShellDBusObject : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.plasmashell")
public:
ShellDBusObject(QObject *parent = nullptr);
Q_SIGNALS:
Q_SCRIPTABLE void doNotDisturbChanged();
Q_SCRIPTABLE void isActionDrawerOpenChanged();
Q_SCRIPTABLE void openActionDrawerRequested();
Q_SCRIPTABLE void closeActionDrawerRequested();
Q_SCRIPTABLE void openAppLaunchAnimationRequested(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize);
Q_SCRIPTABLE void closeAppLaunchAnimationRequested();
Q_SCRIPTABLE void openHomeScreenRequested();
Q_SCRIPTABLE void resetHomeScreenPositionRequested();
public Q_SLOTS:
Q_SCRIPTABLE bool doNotDisturb();
Q_SCRIPTABLE void setDoNotDisturb(bool value);
Q_SCRIPTABLE bool isActionDrawerOpen();
Q_SCRIPTABLE void setIsActionDrawerOpen(bool value);
Q_SCRIPTABLE void openActionDrawer();
Q_SCRIPTABLE void closeActionDrawer();
Q_SCRIPTABLE void openAppLaunchAnimation(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize);
Q_SCRIPTABLE void closeAppLaunchAnimation();
Q_SCRIPTABLE void openHomeScreen();
Q_SCRIPTABLE void resetHomeScreenPosition();
private:
bool m_doNotDisturb = false;
bool m_isActionDrawerOpen = false;
};

View file

@ -86,12 +86,6 @@ ContainmentLayoutManager.ItemContainer {
syncDelegateGeometry()
}
}
Connections {
target: MobileShellState.Shell
function onTaskSwitcherVisibleChanged() {
syncDelegateGeometry();
}
}
Connections {
target: appletsLayout
function onAppletsLayoutInteracted() {

View file

@ -106,7 +106,7 @@ Repeater {
onLaunch: (x, y, icon, title) => {
if (icon !== "") {
MobileShellState.Shell.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
icon,
title,
delegate.iconItem.Kirigami.ScenePosition.x + delegate.iconItem.width/2,

View file

@ -69,7 +69,7 @@ AbstractAppDrawer {
}
onLaunch: (x, y, icon, title, storageId) => {
if (icon !== "") {
MobileShellState.Shell.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
icon,
title,
delegate.iconItem.Kirigami.ScenePosition.x + delegate.iconItem.width/2,

View file

@ -55,7 +55,7 @@ AbstractAppDrawer {
}
onLaunch: (x, y, icon, title, storageId) => {
if (icon !== "") {
MobileShell.HomeScreenControls.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
icon,
title,
delegate.iconItem.Kirigami.ScenePosition.x + delegate.iconItem.width/2,

View file

@ -44,14 +44,16 @@ MobileShell.HomeScreen {
// - minimize windows (only if we are in an app)
// - open app drawer
// - close app drawer and, if necessary, restore windows
// Always close action drawer
if (MobileShellState.ShellDBusClient.isActionDrawerOpen) {
MobileShellState.ShellDBusClient.closeActionDrawer();
}
if (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow
|| MobileShellState.Shell.actionDrawerVisible
|| MobileShellState.ShellDBusClient.isActionDrawerOpen
|| searchWidget.isOpen
) {
// Always close action drawer
if (MobileShellState.Shell.actionDrawerVisible) {
MobileShellState.Shell.closeActionDrawer();
}
// Always close the search widget as well
if (searchWidget.isOpen) {
@ -93,14 +95,6 @@ MobileShell.HomeScreen {
bottomMargin: root.bottomMargin
leftMargin: root.leftMargin
rightMargin: root.rightMargin
// close search component when task switcher is shown or hidden
Connections {
target: MobileShellState.HomeScreenControls.taskSwitcher
function onVisibleChanged() {
searchWidget.close();
}
}
}
}

View file

@ -80,7 +80,7 @@ Item {
function launchAppWithAnim(x: int, y: int, source, title: string, storageId: string) {
if (source !== "") {
MobileShellState.Shell.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
source,
title,
iconLoader.Kirigami.ScenePosition.x + iconLoader.width/2,

View file

@ -90,7 +90,7 @@ MobileShell.GridView {
onLaunch: (x, y, icon, title, storageId) => {
if (icon !== "") {
MobileShellState.Shell.openAppLaunchAnimation(
MobileShellState.ShellDBusClient.openAppLaunchAnimation(
icon,
title,
delegate.iconItem.Kirigami.ScenePosition.x + delegate.iconItem.width/2,

View file

@ -46,12 +46,13 @@ MobileShell.HomeScreen {
// - minimize windows (only if we are in an app)
// - open app drawer
// - close app drawer and, if necessary, restore windows
if (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow || search.isOpen) {
// Always close action drawer
if (MobileShellState.Shell.actionDrawerVisible) {
MobileShellState.Shell.closeActionDrawer();
}
// Always close action drawer
if (MobileShellState.ShellDBusClient.isActionDrawerOpen) {
MobileShellState.ShellDBusClient.closeActionDrawer();
}
if (!WindowPlugin.WindowUtil.isShowingDesktop && WindowPlugin.WindowMaximizedTracker.showingWindow || search.isOpen) {
// Always close the search widget as well
if (search.isOpen) {
search.close();

View file

@ -44,43 +44,31 @@ Item {
//BEGIN API implementation
Binding {
target: MobileShellState.TopPanelControls
property: "inSwipe"
value: drawer.actionDrawer.dragging
}
Binding {
target: MobileShellState.TopPanelControls
property: "actionDrawerVisible"
value: drawer.visible
}
Binding {
target: MobileShellState.TopPanelControls
property: "notificationsWidget"
value: drawer.actionDrawer.notificationsWidget
}
Connections {
target: MobileShellState.TopPanelControls
function onStartSwipe() {
swipeArea.startSwipe();
}
function onEndSwipe() {
swipeArea.endSwipe();
}
function onRequestRelativeScroll(offsetY) {
swipeArea.updateOffset(offsetY);
}
function onCloseActionDrawer() {
drawer.actionDrawer.close();
}
function onOpenActionDrawer() {
target: MobileShellState.ShellDBusClient
function onOpenActionDrawerRequested() {
drawer.actionDrawer.open();
}
function onCloseActionDrawerRequested() {
console.log('action drawer close');
drawer.actionDrawer.close();
}
function onDoNotDisturbChanged() {
if (drawer.actionDrawer.notificationsWidget.doNotDisturbModeEnabled !== MobileShellState.ShellDBusClient.doNotDisturb) {
drawer.actionDrawer.notificationsWidget.toggleDoNotDisturbMode();
}
}
}
Binding {
target: MobileShellState.ShellDBusClient
property: "isActionDrawerOpen"
value: drawer.visible
}
//END API implementation
Component.onCompleted: {

View file

@ -73,7 +73,7 @@ MobileShell.NavigationPanel {
iconSizeFactor: 1
onTriggered: {
MobileShellState.HomeScreenControls.openHomeScreen();
MobileShellState.ShellDBusClient.openHomeScreen();
}
}
@ -95,7 +95,7 @@ MobileShell.NavigationPanel {
if (tasksModel.activeTask !== 0) {
tasksModel.requestClose(tasksModel.activeTask);
}
MobileShellState.Shell.closeAppLaunchAnimation();
MobileShellState.ShellDBusClient.closeAppLaunchAnimation();
}
}
}

View file

@ -4,20 +4,17 @@
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
import QtQuick
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
QS.QuickSetting {
text: i18n("Do Not Disturb")
icon: enabled ? "notifications-disabled" : "notifications"
status: ""
enabled: MobileShellState.TopPanelControls.notificationsWidget && MobileShellState.TopPanelControls.notificationsWidget.doNotDisturbModeEnabled
available: MobileShellState.TopPanelControls.notificationsWidget
enabled: MobileShellState.ShellDBusClient.doNotDisturb
function toggle() {
if (MobileShellState.TopPanelControls.notificationsWidget) {
MobileShellState.TopPanelControls.notificationsWidget.toggleDoNotDisturbMode();
}
MobileShellState.ShellDBusClient.doNotDisturb = !MobileShellState.ShellDBusClient.doNotDisturb;
}
}

View file

@ -39,7 +39,7 @@ QS.QuickSetting {
}
enabled = !enabled
MobileShellState.Shell.closeActionDrawer();
MobileShellState.ShellDBusClient.closeActionDrawer();
}
PWRec.PipeWireRecord {

View file

@ -4,8 +4,8 @@
import QtQuick 2.15
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
import org.kde.plasma.quicksetting.screenshot 1.0
import org.kde.plasma.private.mobileshell.state as MobileShellState
import org.kde.plasma.quicksetting.screenshot
QS.QuickSetting {
text: i18n("Screenshot")
@ -17,12 +17,13 @@ QS.QuickSetting {
function toggle() {
screenshotRequested = true;
MobileShellState.Shell.closeActionDrawer();
MobileShellState.ShellDBusClient.closeActionDrawer();
}
Connections {
target: MobileShellState.Shell
function onActionDrawerVisibleChanged(visible) {
target: MobileShellState.ShellDBusClient
function onIsActionDrawerOpenChanged(visible) {
if (!visible && screenshotRequested) {
screenshotRequested = false;
timer.restart();

View file

@ -11,6 +11,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.shell 2.0 as Shell
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.20 as Kirigami
import org.kde.plasma.private.mobileshell.state as MobileShellState
Rectangle {
id: root
@ -61,10 +62,9 @@ Rectangle {
containment.anchors.fill = root;
}
Component.onCompleted: {
// desktop.windowType = Shell.Desktop.Desktop;
}
// Load shell dbus object
MobileShellState.ShellDBusObject {}
// This is taken from plasma-desktop's shell package, try to keep it in sync
Loader {
id: wallpaperColors