diff --git a/containments/panel/package/contents/ui/main.qml b/containments/panel/package/contents/ui/main.qml index f5986703..5b6561d5 100644 --- a/containments/panel/package/contents/ui/main.qml +++ b/containments/panel/package/contents/ui/main.qml @@ -43,6 +43,11 @@ Item { property: "inSwipe" value: drawer.dragging } + Binding { + target: MobileShell.TopPanelControls + property: "actionDrawerVisible" + value: drawer.visible + } Connections { target: MobileShell.TopPanelControls @@ -56,6 +61,12 @@ Item { function onRequestRelativeScroll(offsetY) { swipeArea.updateOffset(offsetY); } + function onCloseActionDrawer() { + drawer.close(); + } + function onOpenActionDrawer() { + drawer.open(); + } } //END API implementation diff --git a/libmobileshell/declarative/qml/TopPanelControls.qml b/libmobileshell/declarative/qml/TopPanelControls.qml index 70644e34..58598ff2 100644 --- a/libmobileshell/declarative/qml/TopPanelControls.qml +++ b/libmobileshell/declarative/qml/TopPanelControls.qml @@ -18,6 +18,9 @@ QtObject { signal startSwipe() signal endSwipe() signal requestRelativeScroll(real offsetY) + signal closeActionDrawer() + signal openActionDrawer() property bool inSwipe: false property real panelHeight: PlasmaCore.Units.gridUnit // set and updated in panel containment + property bool actionDrawerVisible: false } diff --git a/libmobileshell/declarative/qml/actiondrawer/quicksettings/QuickSettings.qml b/libmobileshell/declarative/qml/actiondrawer/quicksettings/QuickSettings.qml index bdf56c78..8913b1cf 100644 --- a/libmobileshell/declarative/qml/actiondrawer/quicksettings/QuickSettings.qml +++ b/libmobileshell/declarative/qml/actiondrawer/quicksettings/QuickSettings.qml @@ -11,6 +11,7 @@ import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.private.mobileshell 1.0 as MobileShell import "../../components" as Components import "../../components/util.js" as Util @@ -39,9 +40,7 @@ Item { property real minimizedViewProgress: 0 property real fullViewProgress: 1 - readonly property SettingsModel quickSettingsModel: SettingsModel { - actionDrawer: root.actionDrawer - } + readonly property var quickSettingsModel: MobileShell.QuickSettingsModel {} // view when fully open ColumnLayout { diff --git a/libmobileshell/declarative/qml/actiondrawer/quicksettings/SettingsModel.qml b/libmobileshell/declarative/qml/actiondrawer/quicksettings/SettingsModel.qml deleted file mode 100644 index 7849645b..00000000 --- a/libmobileshell/declarative/qml/actiondrawer/quicksettings/SettingsModel.qml +++ /dev/null @@ -1,154 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015 Marco Martin - * SPDX-FileCopyrightText: 2021 Devin Lin - * SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez - * - * SPDX-License-Identifier: LGPL-2.0-or-later - */ - -import QtQuick 2.14 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.2 - -import org.kde.bluezqt 1.0 as BluezQt - -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 3.0 as PC3 -import org.kde.plasma.networkmanagement 0.2 as PlasmaNM -import org.kde.plasma.mm 1.0 as PlasmaMM -import org.kde.plasma.private.mobileshell 1.0 as MobileShell - -MobileShell.QuickSettingsModel { - id: root - - required property var actionDrawer - - property bool screenshotRequested: false - - MobileShell.QuickSetting { - text: i18n("Settings") - status: i18n("Tap to open") - icon: "configure" - enabled: false - settingsCommand: "plasma-open-settings" - } - - MobileShell.QuickSetting { - PlasmaNM.Handler { - id: nmHandler - } - - PlasmaNM.EnabledConnections { - id: enabledConnections - } - - text: i18n("Wi-Fi") - icon: "network-wireless-signal" - settingsCommand: "plasma-open-settings kcm_mobile_wifi" - function toggle() { - nmHandler.enableWireless(!enabledConnections.wirelessEnabled) - } - enabled: enabledConnections.wirelessEnabled - } - - MobileShell.QuickSetting { - text: i18n("Bluetooth") - icon: "network-bluetooth" - settingsCommand: "plasma-open-settings kcm_bluetooth" - function toggle() { - var enable = !BluezQt.Manager.bluetoothOperational; - BluezQt.Manager.bluetoothBlocked = !enable; - - for (var i = 0; i < BluezQt.Manager.adapters.length; ++i) { - var adapter = BluezQt.Manager.adapters[i]; - adapter.powered = enable; - } - } - enabled: BluezQt.Manager.bluetoothOperational - } - - MobileShell.QuickSetting { - text: i18n("Mobile Data") - icon: "network-modem" - status: PlasmaMM.SignalIndicator.mobileDataSupported - ? (enabled ? i18n("On") : i18n("Off")) - : i18n("Not Available") - settingsCommand: "plasma-open-settings kcm_mobile_broadband" - enabled: PlasmaMM.SignalIndicator.mobileDataEnabled - function toggle() { - PlasmaMM.SignalIndicator.mobileDataEnabled = !PlasmaMM.SignalIndicator.mobileDataEnabled - } - } - - MobileShell.QuickSetting { - text: i18n("Flashlight") - icon: "flashlight-on" - enabled: MobileShell.ShellUtil.torchEnabled - function toggle() { - MobileShell.ShellUtil.toggleTorch() - } - } - - MobileShell.QuickSetting { - text: i18n("Location") - icon: "gps" - enabled: false - } - - MobileShell.QuickSetting { - text: i18n("Screenshot") - status: i18n("Tap to screenshot") - icon: "spectacle" - enabled: false - function toggle() { - root.screenshotRequested = true; - root.actionDrawer.close(); - } - - Connections { - target: root.actionDrawer - function onVisibleChanged(visible) { - if (!visible && screenshotRequested) { - timer.restart(); - root.screenshotRequested = false - } - } - } - - // HACK: KWin's fade effect may have the window ending up being in the screenshot if taken too fast - Timer { - id: timer - interval: 500 - onTriggered: MobileShell.ShellUtil.takeScreenshot() - } - } - - MobileShell.QuickSetting { - text: i18n("Auto-rotate") - icon: "rotation-allowed" - settingsCommand: "plasma-open-settings kcm_kscreen" - enabled: MobileShell.ShellUtil.autoRotateEnabled - function toggle() { - MobileShell.ShellUtil.autoRotateEnabled = !enabled - } - } - - MobileShell.QuickSetting { - text: i18n("Battery") - status: i18n("%1%", MobileShell.BatteryProvider.percent) - icon: "battery-full" + (MobileShell.BatteryProvider.pluggedIn ? "-charging" : "") - enabled: false - settingsCommand: "plasma-open-settings kcm_mobile_power" - } - - MobileShell.QuickSetting { - text: i18n("Sound") - icon: "audio-speakers-symbolic" - status: i18n("%1%", MobileShell.VolumeProvider.volumeValue) - enabled: false - settingsCommand: "plasma-open-settings kcm_pulseaudio" - function toggle() { - volumeProvider.showVolumeOverlay() - } - } -} diff --git a/libmobileshell/declarative/resources.qrc b/libmobileshell/declarative/resources.qrc index 47700b6a..358cf20f 100644 --- a/libmobileshell/declarative/resources.qrc +++ b/libmobileshell/declarative/resources.qrc @@ -13,7 +13,6 @@ qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml qml/actiondrawer/quicksettings/QuickSettingsPanel.qml - qml/actiondrawer/quicksettings/SettingsModel.qml qml/actiondrawer/ActionDrawer.qml qml/actiondrawer/ActionDrawerOpenSurface.qml diff --git a/libmobileshell/quicksetting.h b/libmobileshell/quicksetting.h index 223304e8..d7645f67 100644 --- a/libmobileshell/quicksetting.h +++ b/libmobileshell/quicksetting.h @@ -19,7 +19,7 @@ class MOBILESHELL_EXPORT QuickSetting : public QObject { Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged) - Q_PROPERTY(QString status READ status WRITE setStatus REQUIRED NOTIFY statusChanged) // if no status is explicitly set, On/Off is used by default + Q_PROPERTY(QString status READ status WRITE setStatus NOTIFY statusChanged) // if no status is explicitly set, On/Off is used by default Q_PROPERTY(QString icon READ iconName WRITE setIconName REQUIRED NOTIFY iconNameChanged) Q_PROPERTY(QString settingsCommand READ settingsCommand WRITE setSettingsCommand NOTIFY settingsCommandChanged) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) diff --git a/libmobileshell/quicksettingsmodel.cpp b/libmobileshell/quicksettingsmodel.cpp index f0d2e3d6..8f9fa1ef 100644 --- a/libmobileshell/quicksettingsmodel.cpp +++ b/libmobileshell/quicksettingsmodel.cpp @@ -58,22 +58,31 @@ void QuickSettingsModel::classBegin() const auto packages = KPackage::PackageLoader::self()->listPackages(QStringLiteral("KPackage/GenericQML"), "plasma/quicksettings"); auto c = new QQmlComponent(engine, this); + for (const auto &metaData : packages) { KPackage::Package package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", QFileInfo(metaData.fileName()).path()); if (!package.isValid()) { - qWarning() << "Could not load" << metaData.fileName(); + qWarning() << "Quick setting package invalid:" << metaData.fileName(); continue; } c->loadUrl(package.fileUrl("mainscript"), QQmlComponent::PreferSynchronous); + auto created = c->create(engine->rootContext()); auto createdSetting = qobject_cast(created); + if (!createdSetting) { qWarning() << "Could not load" << metaData.fileName() << created; + if (c->isError()) { + for (const auto &error : c->errors()) { + qDebug() << error; + } + } delete created; - continue; + } else { + qDebug() << "Loaded quicksetting" << metaData.fileName(); + m_external += createdSetting; } - m_external += createdSetting; } delete c; } diff --git a/quicksettings/CMakeLists.txt b/quicksettings/CMakeLists.txt index b06f04ae..3d32147f 100644 --- a/quicksettings/CMakeLists.txt +++ b/quicksettings/CMakeLists.txt @@ -2,7 +2,17 @@ # SPDX-License-Identifier: GPL-2.0-or-later plasma_install_package(airplanemode org.kde.plasma.airplanemode quicksettings) +plasma_install_package(audio org.kde.plasma.audio quicksettings) +plasma_install_package(battery org.kde.plasma.battery quicksettings) +plasma_install_package(bluetooth org.kde.plasma.bluetooth quicksettings) plasma_install_package(caffeine org.kde.plasma.caffeine quicksettings) +plasma_install_package(flashlight org.kde.plasma.flashlight quicksettings) plasma_install_package(keyboardtoggle org.kde.plasma.keyboardtoggle quicksettings) +plasma_install_package(location org.kde.plasma.location quicksettings) +plasma_install_package(mobiledata org.kde.plasma.mobiledata quicksettings) +plasma_install_package(screenrotation org.kde.plasma.screenrotation quicksettings) +plasma_install_package(screenshot org.kde.plasma.screenshot quicksettings) +plasma_install_package(settingsapp org.kde.plasma.settingsapp quicksettings) +plasma_install_package(wifi org.kde.plasma.wifi quicksettings) add_subdirectory(nightcolor) add_subdirectory(powermenu) diff --git a/quicksettings/airplanemode/metadata.desktop b/quicksettings/airplanemode/metadata.desktop index e45724dd..ee148edd 100644 --- a/quicksettings/airplanemode/metadata.desktop +++ b/quicksettings/airplanemode/metadata.desktop @@ -34,6 +34,7 @@ Name[uk]=Режим польоту Name[x-test]=xxAirplane Modexx Name[zh_CN]=飞行模式 Icon=network-flightmode-on +Description=Airplane mode quick setting Type=Service X-KDE-ServiceTypes=KPackage/GenericQML @@ -43,5 +44,5 @@ X-KDE-PluginInfo-Email=bshah@kde.org X-KDE-PluginInfo-Name=org.kde.plasma.airplanemode X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website=https://kde.org -X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-License=GPL-2.0+ diff --git a/quicksettings/audio/contents/ui/main.qml b/quicksettings/audio/contents/ui/main.qml new file mode 100644 index 00000000..e675ef6c --- /dev/null +++ b/quicksettings/audio/contents/ui/main.qml @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Sound") + icon: "audio-speakers-symbolic" + status: i18n("%1%", MobileShell.VolumeProvider.volumeValue) + enabled: false + settingsCommand: "plasma-open-settings kcm_pulseaudio" + function toggle() { + MobileShell.VolumeProvider.showVolumeOverlay() + } +} diff --git a/quicksettings/audio/metadata.desktop b/quicksettings/audio/metadata.desktop new file mode 100644 index 00000000..5ab57a1a --- /dev/null +++ b/quicksettings/audio/metadata.desktop @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Audio +Icon=audio-speakers-symbolic +Description=Audio quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.audio +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ diff --git a/quicksettings/battery/contents/ui/main.qml b/quicksettings/battery/contents/ui/main.qml new file mode 100644 index 00000000..02985f25 --- /dev/null +++ b/quicksettings/battery/contents/ui/main.qml @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Battery") + status: i18n("%1%", MobileShell.BatteryProvider.percent) + icon: "battery-full" + (MobileShell.BatteryProvider.pluggedIn ? "-charging" : "") + enabled: false + settingsCommand: "plasma-open-settings kcm_mobile_power" +} diff --git a/quicksettings/battery/metadata.desktop b/quicksettings/battery/metadata.desktop new file mode 100644 index 00000000..b25ffc40 --- /dev/null +++ b/quicksettings/battery/metadata.desktop @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Battery +Icon=battery-full +Description=Battery quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.battery +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ + diff --git a/quicksettings/bluetooth/contents/ui/main.qml b/quicksettings/bluetooth/contents/ui/main.qml new file mode 100644 index 00000000..cb3f85de --- /dev/null +++ b/quicksettings/bluetooth/contents/ui/main.qml @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.bluezqt 1.0 as BluezQt +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Bluetooth") + icon: "network-bluetooth" + settingsCommand: "plasma-open-settings kcm_bluetooth" + function toggle() { + var enable = !BluezQt.Manager.bluetoothOperational; + BluezQt.Manager.bluetoothBlocked = !enable; + + for (var i = 0; i < BluezQt.Manager.adapters.length; ++i) { + var adapter = BluezQt.Manager.adapters[i]; + adapter.powered = enable; + } + } + enabled: BluezQt.Manager.bluetoothOperational +} diff --git a/quicksettings/bluetooth/metadata.desktop b/quicksettings/bluetooth/metadata.desktop new file mode 100644 index 00000000..7cd01cfe --- /dev/null +++ b/quicksettings/bluetooth/metadata.desktop @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Bluetooth +Icon=network-bluetooth +Description=Bluetooth quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.bluetooth +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ diff --git a/quicksettings/flashlight/contents/ui/main.qml b/quicksettings/flashlight/contents/ui/main.qml new file mode 100644 index 00000000..df662800 --- /dev/null +++ b/quicksettings/flashlight/contents/ui/main.qml @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Flashlight") + icon: "flashlight-on" + enabled: MobileShell.ShellUtil.torchEnabled + function toggle() { + MobileShell.ShellUtil.toggleTorch() + } +} diff --git a/quicksettings/flashlight/metadata.desktop b/quicksettings/flashlight/metadata.desktop new file mode 100644 index 00000000..c8ac780f --- /dev/null +++ b/quicksettings/flashlight/metadata.desktop @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Flashlight +Icon=flashlight-on +Description=Flashlight quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.flashlight +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ + diff --git a/quicksettings/location/contents/ui/main.qml b/quicksettings/location/contents/ui/main.qml new file mode 100644 index 00000000..e7bbbc3e --- /dev/null +++ b/quicksettings/location/contents/ui/main.qml @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Location") + icon: "gps" + enabled: false +} diff --git a/quicksettings/location/metadata.desktop b/quicksettings/location/metadata.desktop new file mode 100644 index 00000000..e5822106 --- /dev/null +++ b/quicksettings/location/metadata.desktop @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Location +Icon=gps +Description=Location quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.location +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ diff --git a/quicksettings/mobiledata/contents/ui/main.qml b/quicksettings/mobiledata/contents/ui/main.qml new file mode 100644 index 00000000..e6406f0b --- /dev/null +++ b/quicksettings/mobiledata/contents/ui/main.qml @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.mm 1.0 as PlasmaMM +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Mobile Data") + icon: "network-modem" + status: PlasmaMM.SignalIndicator.mobileDataSupported + ? (enabled ? i18n("On") : i18n("Off")) + : i18n("Not Available") + settingsCommand: "plasma-open-settings kcm_mobile_broadband" + enabled: PlasmaMM.SignalIndicator.mobileDataEnabled + function toggle() { + PlasmaMM.SignalIndicator.mobileDataEnabled = !PlasmaMM.SignalIndicator.mobileDataEnabled + } +} diff --git a/quicksettings/mobiledata/metadata.desktop b/quicksettings/mobiledata/metadata.desktop new file mode 100644 index 00000000..02e95198 --- /dev/null +++ b/quicksettings/mobiledata/metadata.desktop @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Mobile Data +Icon=flashlight-on +Description=Location quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.mobiledata +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ + diff --git a/quicksettings/screenrotation/contents/ui/main.qml b/quicksettings/screenrotation/contents/ui/main.qml new file mode 100644 index 00000000..bab8ca21 --- /dev/null +++ b/quicksettings/screenrotation/contents/ui/main.qml @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Auto-rotate") + icon: "rotation-allowed" + settingsCommand: "plasma-open-settings kcm_kscreen" + enabled: MobileShell.ShellUtil.autoRotateEnabled + function toggle() { + MobileShell.ShellUtil.autoRotateEnabled = !enabled + } +} diff --git a/quicksettings/screenrotation/metadata.desktop b/quicksettings/screenrotation/metadata.desktop new file mode 100644 index 00000000..045800c0 --- /dev/null +++ b/quicksettings/screenrotation/metadata.desktop @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Screen rotation +Icon=rotation-allowed +Description=Screen rotation quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.screenrotation +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ + diff --git a/quicksettings/screenshot/contents/ui/main.qml b/quicksettings/screenshot/contents/ui/main.qml new file mode 100644 index 00000000..0ca730ef --- /dev/null +++ b/quicksettings/screenshot/contents/ui/main.qml @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Screenshot") + status: i18n("Tap to screenshot") + icon: "spectacle" + enabled: false + + property bool screenshotRequested: false + + function toggle() { + screenshotRequested = true; + MobileShell.TopPanelControls.closeActionDrawer(); + } + + Connections { + target: MobileShell.TopPanelControls + function onActionDrawerVisibleChanged(visible) { + if (!visible && screenshotRequested) { + screenshotRequested = false; + timer.restart(); + } + } + } + + // HACK: KWin's fade effect may have the window ending up being in the screenshot if taken too fast + Timer { + id: timer + interval: 500 + onTriggered: MobileShell.ShellUtil.takeScreenshot() + } +} diff --git a/quicksettings/screenshot/metadata.desktop b/quicksettings/screenshot/metadata.desktop new file mode 100644 index 00000000..cdaed230 --- /dev/null +++ b/quicksettings/screenshot/metadata.desktop @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Screenshot +Icon=spectacle +Description=Screenshot quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.screenshot +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ diff --git a/quicksettings/settingsapp/contents/ui/main.qml b/quicksettings/settingsapp/contents/ui/main.qml new file mode 100644 index 00000000..8ed607c8 --- /dev/null +++ b/quicksettings/settingsapp/contents/ui/main.qml @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + text: i18n("Settings") + status: i18n("Tap to open") + icon: "configure" + enabled: false + settingsCommand: "plasma-open-settings" +} diff --git a/quicksettings/settingsapp/metadata.desktop b/quicksettings/settingsapp/metadata.desktop new file mode 100644 index 00000000..64dde02a --- /dev/null +++ b/quicksettings/settingsapp/metadata.desktop @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Settings +Icon=spectacle +Description=Settings application quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.settingsapp +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+ diff --git a/quicksettings/wifi/contents/ui/main.qml b/quicksettings/wifi/contents/ui/main.qml new file mode 100644 index 00000000..589b00f0 --- /dev/null +++ b/quicksettings/wifi/contents/ui/main.qml @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: 2022 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later + +import QtQuick 2.15 + +import org.kde.plasma.networkmanagement 0.2 as PlasmaNM +import org.kde.plasma.private.mobileshell 1.0 as MobileShell + +MobileShell.QuickSetting { + PlasmaNM.Handler { + id: nmHandler + } + + PlasmaNM.EnabledConnections { + id: enabledConnections + } + + text: i18n("Wi-Fi") + icon: "network-wireless-signal" + settingsCommand: "plasma-open-settings kcm_mobile_wifi" + function toggle() { + nmHandler.enableWireless(!enabledConnections.wirelessEnabled) + } + enabled: enabledConnections.wirelessEnabled +} diff --git a/quicksettings/wifi/metadata.desktop b/quicksettings/wifi/metadata.desktop new file mode 100644 index 00000000..ba81116d --- /dev/null +++ b/quicksettings/wifi/metadata.desktop @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2022 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later + +[Desktop Entry] +Name=Wi-Fi +Icon=flashlight-on +Description=Wi-Fi quick setting + +Type=Service +X-KDE-ServiceTypes=KPackage/GenericQML + +X-KDE-PluginInfo-Author=Devin Lin +X-KDE-PluginInfo-Email=devin@kde.org +X-KDE-PluginInfo-Name=org.kde.plasma.wifi +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website=https://kde.org +X-KDE-PluginInfo-License=GPL-2.0+