mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
quicksettings: Move all quick settings to kpackage
This commit is contained in:
parent
140ca990bf
commit
9941c23752
29 changed files with 408 additions and 163 deletions
|
|
@ -43,6 +43,11 @@ Item {
|
||||||
property: "inSwipe"
|
property: "inSwipe"
|
||||||
value: drawer.dragging
|
value: drawer.dragging
|
||||||
}
|
}
|
||||||
|
Binding {
|
||||||
|
target: MobileShell.TopPanelControls
|
||||||
|
property: "actionDrawerVisible"
|
||||||
|
value: drawer.visible
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: MobileShell.TopPanelControls
|
target: MobileShell.TopPanelControls
|
||||||
|
|
@ -56,6 +61,12 @@ Item {
|
||||||
function onRequestRelativeScroll(offsetY) {
|
function onRequestRelativeScroll(offsetY) {
|
||||||
swipeArea.updateOffset(offsetY);
|
swipeArea.updateOffset(offsetY);
|
||||||
}
|
}
|
||||||
|
function onCloseActionDrawer() {
|
||||||
|
drawer.close();
|
||||||
|
}
|
||||||
|
function onOpenActionDrawer() {
|
||||||
|
drawer.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//END API implementation
|
//END API implementation
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ QtObject {
|
||||||
signal startSwipe()
|
signal startSwipe()
|
||||||
signal endSwipe()
|
signal endSwipe()
|
||||||
signal requestRelativeScroll(real offsetY)
|
signal requestRelativeScroll(real offsetY)
|
||||||
|
signal closeActionDrawer()
|
||||||
|
signal openActionDrawer()
|
||||||
property bool inSwipe: false
|
property bool inSwipe: false
|
||||||
property real panelHeight: PlasmaCore.Units.gridUnit // set and updated in panel containment
|
property real panelHeight: PlasmaCore.Units.gridUnit // set and updated in panel containment
|
||||||
|
property bool actionDrawerVisible: false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
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" as Components
|
||||||
import "../../components/util.js" as Util
|
import "../../components/util.js" as Util
|
||||||
|
|
@ -39,9 +40,7 @@ Item {
|
||||||
property real minimizedViewProgress: 0
|
property real minimizedViewProgress: 0
|
||||||
property real fullViewProgress: 1
|
property real fullViewProgress: 1
|
||||||
|
|
||||||
readonly property SettingsModel quickSettingsModel: SettingsModel {
|
readonly property var quickSettingsModel: MobileShell.QuickSettingsModel {}
|
||||||
actionDrawer: root.actionDrawer
|
|
||||||
}
|
|
||||||
|
|
||||||
// view when fully open
|
// view when fully open
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com>
|
|
||||||
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
|
||||||
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
||||||
*
|
|
||||||
* 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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
<file>qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml</file>
|
<file>qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml</file>
|
||||||
<file>qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml</file>
|
<file>qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml</file>
|
||||||
<file>qml/actiondrawer/quicksettings/QuickSettingsPanel.qml</file>
|
<file>qml/actiondrawer/quicksettings/QuickSettingsPanel.qml</file>
|
||||||
<file>qml/actiondrawer/quicksettings/SettingsModel.qml</file>
|
|
||||||
|
|
||||||
<file>qml/actiondrawer/ActionDrawer.qml</file>
|
<file>qml/actiondrawer/ActionDrawer.qml</file>
|
||||||
<file>qml/actiondrawer/ActionDrawerOpenSurface.qml</file>
|
<file>qml/actiondrawer/ActionDrawerOpenSurface.qml</file>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class MOBILESHELL_EXPORT QuickSetting : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged)
|
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 icon READ iconName WRITE setIconName REQUIRED NOTIFY iconNameChanged)
|
||||||
Q_PROPERTY(QString settingsCommand READ settingsCommand WRITE setSettingsCommand NOTIFY settingsCommandChanged)
|
Q_PROPERTY(QString settingsCommand READ settingsCommand WRITE setSettingsCommand NOTIFY settingsCommandChanged)
|
||||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
|
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
|
||||||
|
|
|
||||||
|
|
@ -58,23 +58,32 @@ void QuickSettingsModel::classBegin()
|
||||||
|
|
||||||
const auto packages = KPackage::PackageLoader::self()->listPackages(QStringLiteral("KPackage/GenericQML"), "plasma/quicksettings");
|
const auto packages = KPackage::PackageLoader::self()->listPackages(QStringLiteral("KPackage/GenericQML"), "plasma/quicksettings");
|
||||||
auto c = new QQmlComponent(engine, this);
|
auto c = new QQmlComponent(engine, this);
|
||||||
|
|
||||||
for (const auto &metaData : packages) {
|
for (const auto &metaData : packages) {
|
||||||
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", QFileInfo(metaData.fileName()).path());
|
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", QFileInfo(metaData.fileName()).path());
|
||||||
if (!package.isValid()) {
|
if (!package.isValid()) {
|
||||||
qWarning() << "Could not load" << metaData.fileName();
|
qWarning() << "Quick setting package invalid:" << metaData.fileName();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->loadUrl(package.fileUrl("mainscript"), QQmlComponent::PreferSynchronous);
|
c->loadUrl(package.fileUrl("mainscript"), QQmlComponent::PreferSynchronous);
|
||||||
|
|
||||||
auto created = c->create(engine->rootContext());
|
auto created = c->create(engine->rootContext());
|
||||||
auto createdSetting = qobject_cast<QuickSetting *>(created);
|
auto createdSetting = qobject_cast<QuickSetting *>(created);
|
||||||
|
|
||||||
if (!createdSetting) {
|
if (!createdSetting) {
|
||||||
qWarning() << "Could not load" << metaData.fileName() << created;
|
qWarning() << "Could not load" << metaData.fileName() << created;
|
||||||
delete created;
|
if (c->isError()) {
|
||||||
continue;
|
for (const auto &error : c->errors()) {
|
||||||
|
qDebug() << error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
delete created;
|
||||||
|
} else {
|
||||||
|
qDebug() << "Loaded quicksetting" << metaData.fileName();
|
||||||
m_external += createdSetting;
|
m_external += createdSetting;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,17 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
plasma_install_package(airplanemode org.kde.plasma.airplanemode quicksettings)
|
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(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(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(nightcolor)
|
||||||
add_subdirectory(powermenu)
|
add_subdirectory(powermenu)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ Name[uk]=Режим польоту
|
||||||
Name[x-test]=xxAirplane Modexx
|
Name[x-test]=xxAirplane Modexx
|
||||||
Name[zh_CN]=飞行模式
|
Name[zh_CN]=飞行模式
|
||||||
Icon=network-flightmode-on
|
Icon=network-flightmode-on
|
||||||
|
Description=Airplane mode quick setting
|
||||||
|
|
||||||
Type=Service
|
Type=Service
|
||||||
X-KDE-ServiceTypes=KPackage/GenericQML
|
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-Name=org.kde.plasma.airplanemode
|
||||||
X-KDE-PluginInfo-Version=0.1
|
X-KDE-PluginInfo-Version=0.1
|
||||||
X-KDE-PluginInfo-Website=https://kde.org
|
X-KDE-PluginInfo-Website=https://kde.org
|
||||||
X-KDE-PluginInfo-License=GPL
|
X-KDE-PluginInfo-License=GPL-2.0+
|
||||||
|
|
||||||
|
|
|
||||||
17
quicksettings/audio/contents/ui/main.qml
Normal file
17
quicksettings/audio/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
17
quicksettings/audio/metadata.desktop
Normal file
17
quicksettings/audio/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
14
quicksettings/battery/contents/ui/main.qml
Normal file
14
quicksettings/battery/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
18
quicksettings/battery/metadata.desktop
Normal file
18
quicksettings/battery/metadata.desktop
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
|
|
||||||
23
quicksettings/bluetooth/contents/ui/main.qml
Normal file
23
quicksettings/bluetooth/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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
|
||||||
|
}
|
||||||
17
quicksettings/bluetooth/metadata.desktop
Normal file
17
quicksettings/bluetooth/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
15
quicksettings/flashlight/contents/ui/main.qml
Normal file
15
quicksettings/flashlight/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
18
quicksettings/flashlight/metadata.desktop
Normal file
18
quicksettings/flashlight/metadata.desktop
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
|
|
||||||
12
quicksettings/location/contents/ui/main.qml
Normal file
12
quicksettings/location/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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
|
||||||
|
}
|
||||||
17
quicksettings/location/metadata.desktop
Normal file
17
quicksettings/location/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
20
quicksettings/mobiledata/contents/ui/main.qml
Normal file
20
quicksettings/mobiledata/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
18
quicksettings/mobiledata/metadata.desktop
Normal file
18
quicksettings/mobiledata/metadata.desktop
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
|
|
||||||
16
quicksettings/screenrotation/contents/ui/main.qml
Normal file
16
quicksettings/screenrotation/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
18
quicksettings/screenrotation/metadata.desktop
Normal file
18
quicksettings/screenrotation/metadata.desktop
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
|
|
||||||
37
quicksettings/screenshot/contents/ui/main.qml
Normal file
37
quicksettings/screenshot/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
17
quicksettings/screenshot/metadata.desktop
Normal file
17
quicksettings/screenshot/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
14
quicksettings/settingsapp/contents/ui/main.qml
Normal file
14
quicksettings/settingsapp/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
17
quicksettings/settingsapp/metadata.desktop
Normal file
17
quicksettings/settingsapp/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
25
quicksettings/wifi/contents/ui/main.qml
Normal file
25
quicksettings/wifi/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
// 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
|
||||||
|
}
|
||||||
17
quicksettings/wifi/metadata.desktop
Normal file
17
quicksettings/wifi/metadata.desktop
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||||
|
# 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+
|
||||||
Loading…
Reference in a new issue