diff --git a/components/mobileshell/CMakeLists.txt b/components/mobileshell/CMakeLists.txt index 7bbdfbef..729e4966 100644 --- a/components/mobileshell/CMakeLists.txt +++ b/components/mobileshell/CMakeLists.txt @@ -23,8 +23,7 @@ set_source_files_properties(qml/dataproviders/AudioInfo.qml PROPERTIES QT_QML_SI set_source_files_properties(qml/dataproviders/BatteryInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) set_source_files_properties(qml/dataproviders/BluetoothInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) set_source_files_properties(qml/dataproviders/SignalStrengthInfo.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) -set_source_files_properties(qml/notificationpopup/NotificationPopupProviderLoader.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) -set_source_files_properties(qml/volumeosd/VolumeOSDProviderLoader.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) +set_source_files_properties(qml/popups/PopupProviderLoader.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) # Include qml and js files within ./qml/ file(GLOB_RECURSE _qml_sources diff --git a/components/mobileshell/qml/notificationpopup/NotificationPopupProviderLoader.qml b/components/mobileshell/qml/notificationpopup/NotificationPopupProviderLoader.qml deleted file mode 100644 index ab95a0c6..00000000 --- a/components/mobileshell/qml/notificationpopup/NotificationPopupProviderLoader.qml +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Micah Stanley - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -import QtQuick -import org.kde.plasma.private.mobileshell as MobileShell - -pragma Singleton - -/** - * This wraps the NotificationPopupProvider component so that we can avoid loading side - * effects from imports (since this is a singleton and initialized immediately on import). - */ -Loader { - id: root - sourceComponent: Component { - MobileShell.NotificationPopupProvider {} - } - - function load() { - root.active = true; - } -} - diff --git a/components/mobileshell/qml/popups/PopupProviderLoader.qml b/components/mobileshell/qml/popups/PopupProviderLoader.qml new file mode 100644 index 00000000..a343ab3a --- /dev/null +++ b/components/mobileshell/qml/popups/PopupProviderLoader.qml @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2023 Devin Lin + * SPDX-FileCopyrightText: 2024-2025 Micah Stanley + * + * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + */ + +import QtQuick +import org.kde.plasma.private.mobileshell as MobileShell + +pragma Singleton + +/** + * This wraps the popup components so that we can avoid loading side + * effects from imports (since this is a singleton and initialized immediately on import). + */ +Item { + id: root + + // WARNING: only call this load from within the plasmashell process, because + // multiple bindings of the shortcut may break it entirely (hardware volume keys) + function load() { + volumeOSD.active = true; + notifications.active = true; + } + + Loader { + id: volumeOSD + sourceComponent: Component { + MobileShell.VolumeOSDProvider {} + } + } + + Loader { + id: notifications + sourceComponent: Component { + MobileShell.NotificationPopupProvider {} + } + } +} diff --git a/components/mobileshell/qml/notificationpopup/NotificationPopup.qml b/components/mobileshell/qml/popups/notifications/NotificationPopup.qml similarity index 100% rename from components/mobileshell/qml/notificationpopup/NotificationPopup.qml rename to components/mobileshell/qml/popups/notifications/NotificationPopup.qml diff --git a/components/mobileshell/qml/notificationpopup/NotificationPopupManager.qml b/components/mobileshell/qml/popups/notifications/NotificationPopupManager.qml similarity index 100% rename from components/mobileshell/qml/notificationpopup/NotificationPopupManager.qml rename to components/mobileshell/qml/popups/notifications/NotificationPopupManager.qml diff --git a/components/mobileshell/qml/notificationpopup/NotificationPopupProvider.qml b/components/mobileshell/qml/popups/notifications/NotificationPopupProvider.qml similarity index 100% rename from components/mobileshell/qml/notificationpopup/NotificationPopupProvider.qml rename to components/mobileshell/qml/popups/notifications/NotificationPopupProvider.qml diff --git a/components/mobileshell/qml/volumeosd/AudioApplet.qml b/components/mobileshell/qml/popups/volumeosd/AudioApplet.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/AudioApplet.qml rename to components/mobileshell/qml/popups/volumeosd/AudioApplet.qml diff --git a/components/mobileshell/qml/volumeosd/DeviceListItem.qml b/components/mobileshell/qml/popups/volumeosd/DeviceListItem.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/DeviceListItem.qml rename to components/mobileshell/qml/popups/volumeosd/DeviceListItem.qml diff --git a/components/mobileshell/qml/volumeosd/ListItemBase.qml b/components/mobileshell/qml/popups/volumeosd/ListItemBase.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/ListItemBase.qml rename to components/mobileshell/qml/popups/volumeosd/ListItemBase.qml diff --git a/components/mobileshell/qml/volumeosd/PopupCard.qml b/components/mobileshell/qml/popups/volumeosd/PopupCard.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/PopupCard.qml rename to components/mobileshell/qml/popups/volumeosd/PopupCard.qml diff --git a/components/mobileshell/qml/volumeosd/StreamListItem.qml b/components/mobileshell/qml/popups/volumeosd/StreamListItem.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/StreamListItem.qml rename to components/mobileshell/qml/popups/volumeosd/StreamListItem.qml diff --git a/components/mobileshell/qml/volumeosd/VolumeChangedPopup.qml b/components/mobileshell/qml/popups/volumeosd/VolumeChangedPopup.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/VolumeChangedPopup.qml rename to components/mobileshell/qml/popups/volumeosd/VolumeChangedPopup.qml diff --git a/components/mobileshell/qml/volumeosd/VolumeOSD.qml b/components/mobileshell/qml/popups/volumeosd/VolumeOSD.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/VolumeOSD.qml rename to components/mobileshell/qml/popups/volumeosd/VolumeOSD.qml diff --git a/components/mobileshell/qml/volumeosd/VolumeOSDProvider.qml b/components/mobileshell/qml/popups/volumeosd/VolumeOSDProvider.qml similarity index 100% rename from components/mobileshell/qml/volumeosd/VolumeOSDProvider.qml rename to components/mobileshell/qml/popups/volumeosd/VolumeOSDProvider.qml diff --git a/components/mobileshell/qml/volumeosd/icon.js b/components/mobileshell/qml/popups/volumeosd/icon.js similarity index 100% rename from components/mobileshell/qml/volumeosd/icon.js rename to components/mobileshell/qml/popups/volumeosd/icon.js diff --git a/components/mobileshell/qml/volumeosd/VolumeOSDProviderLoader.qml b/components/mobileshell/qml/volumeosd/VolumeOSDProviderLoader.qml deleted file mode 100644 index 8367db3c..00000000 --- a/components/mobileshell/qml/volumeosd/VolumeOSDProviderLoader.qml +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Devin Lin -// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL - -import QtQuick -import org.kde.plasma.private.mobileshell as MobileShell - -pragma Singleton - -/** - * This wraps the VolumeOSDProvider component so that we can avoid loading side - * effects from imports (since this is a singleton and initialized immediately on import). - */ -Loader { - id: root - sourceComponent: Component { - MobileShell.VolumeOSDProvider {} - } - - // WARNING: only call this load from within the plasmashell process, because - // multiple bindings of the shortcut may break it entirely (hardware volume keys) - function load() { - root.active = true; - } -} - diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index c4452a27..0be24b59 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -132,9 +132,8 @@ ContainmentItem { // HACK: we need to initialize the DBus server somewhere, it might as well be here... // initialize the volume osd, and volume keys - MobileShell.VolumeOSDProviderLoader.load(); // initialize notification popups - MobileShell.NotificationPopupProviderLoader.load(); + MobileShell.PopupProviderLoader.load(); } MobileShell.StartupFeedbackPanelFill {