mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
quicksettings/donotdisturb: Move do not disturb button to quick setting
This commit is contained in:
parent
23185d9edf
commit
1830b9dd2a
10 changed files with 64 additions and 17 deletions
|
|
@ -22,5 +22,6 @@ QtObject {
|
|||
signal openActionDrawer()
|
||||
property bool inSwipe: false
|
||||
property real panelHeight: PlasmaCore.Units.gridUnit // set and updated in panel containment
|
||||
property bool actionDrawerVisible: false
|
||||
property bool actionDrawerVisible: false
|
||||
property var notificationsWidget // updated in panel containment
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,11 @@ Item {
|
|||
*/
|
||||
property int direction: MobileShell.Direction.None
|
||||
|
||||
/**
|
||||
* The notifications widget being shown. May be null.
|
||||
*/
|
||||
property var notificationsWidget: contentContainerLoader.item.notificationsWidget
|
||||
|
||||
/**
|
||||
* The mode of the action drawer (portrait or landscape).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ PlasmaCore.ColorScope {
|
|||
|
||||
required property var actionDrawer
|
||||
|
||||
property alias notificationsWidget: notificationWidget
|
||||
|
||||
readonly property real minimizedQuickSettingsOffset: height
|
||||
readonly property real maximizedQuickSettingsOffset: height
|
||||
readonly property bool isOnLargeScreen: width > quickSettings.width * 2.5
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ PlasmaCore.ColorScope {
|
|||
|
||||
required property var actionDrawer
|
||||
|
||||
property alias notificationsWidget: notificationWidget
|
||||
|
||||
// pinned position (disabled when openToPinnedMode is false)
|
||||
readonly property real minimizedQuickSettingsOffset: quickSettings.minimizedHeight
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Item {
|
|||
required property InternetIndicator internetIndicator
|
||||
|
||||
// check if the internet indicator icon is a mobile data related one
|
||||
readonly property bool isInternetIndicatorMobileData: internetIndicator.icon.startsWith('network-mobile-')
|
||||
readonly property bool isInternetIndicatorMobileData: internetIndicator && internetIndicator.icon && internetIndicator.icon.startsWith('network-mobile-')
|
||||
|
||||
property bool showLabel: true
|
||||
property real textPixelSize: PlasmaCore.Units.gridUnit * 0.6
|
||||
|
|
|
|||
|
|
@ -368,23 +368,10 @@ Item {
|
|||
bottomMargin: list.spacing
|
||||
}
|
||||
|
||||
PlasmaComponents3.ToolButton {
|
||||
id: doNotDisturbButton
|
||||
|
||||
Layout.alignment: hasNotifications ? Qt.AlignLeft : Qt.AlignHCenter
|
||||
|
||||
font.bold: true
|
||||
font.pointSize: Kirigami.Theme.smallFont.pointSize
|
||||
|
||||
icon.name: doNotDisturbModeEnabled ? "notifications" : "notifications-disabled"
|
||||
text: doNotDisturbModeEnabled ? "Enable Notifications" : "Do Not Disturb"
|
||||
onClicked: toggleDoNotDisturbMode()
|
||||
}
|
||||
|
||||
PlasmaComponents3.ToolButton {
|
||||
id: clearButton
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
visible: hasNotifications
|
||||
|
||||
|
|
@ -392,7 +379,7 @@ Item {
|
|||
font.pointSize: Kirigami.Theme.smallFont.pointSize
|
||||
|
||||
icon.name: "edit-clear-history"
|
||||
text: "Clear All Notifications"
|
||||
text: i18n("Clear All Notifications")
|
||||
onClicked: clearHistory()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@ Item {
|
|||
value: drawer.visible
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: MobileShell.TopPanelControls
|
||||
property: "notificationsWidget"
|
||||
value: drawer.actionDrawer.notificationsWidget
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: MobileShell.TopPanelControls
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ plasma_install_package(audio org.kde.plasma.quicksetting.audio quicksettings)
|
|||
plasma_install_package(battery org.kde.plasma.quicksetting.battery quicksettings)
|
||||
plasma_install_package(bluetooth org.kde.plasma.quicksetting.bluetooth quicksettings)
|
||||
plasma_install_package(caffeine org.kde.plasma.quicksetting.caffeine quicksettings)
|
||||
plasma_install_package(donotdisturb org.kde.plasma.quicksetting.donotdisturb quicksettings)
|
||||
plasma_install_package(keyboardtoggle org.kde.plasma.quicksetting.keyboardtoggle quicksettings)
|
||||
plasma_install_package(location org.kde.plasma.quicksetting.location quicksettings)
|
||||
plasma_install_package(mobiledata org.kde.plasma.quicksetting.mobiledata quicksettings)
|
||||
|
|
|
|||
22
quicksettings/donotdisturb/contents/main.qml
Normal file
22
quicksettings/donotdisturb/contents/main.qml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
MobileShell.QuickSetting {
|
||||
text: i18n("Do Not Disturb")
|
||||
icon: enabled ? "notifications" : "notifications-disabled"
|
||||
status: ""
|
||||
enabled: MobileShell.TopPanelControls.notificationsWidget && MobileShell.TopPanelControls.notificationsWidget.doNotDisturbModeEnabled
|
||||
available: MobileShell.TopPanelControls.notificationsWidget
|
||||
|
||||
function toggle() {
|
||||
if (MobileShell.TopPanelControls.notificationsWidget) {
|
||||
MobileShell.TopPanelControls.notificationsWidget.toggleDoNotDisturbMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
quicksettings/donotdisturb/metadata.json
Normal file
21
quicksettings/donotdisturb/metadata.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"KPlugin": {
|
||||
"Authors": [
|
||||
{
|
||||
"Email": "devin@kde.org",
|
||||
"Name": "Devin Lin"
|
||||
}
|
||||
],
|
||||
"Description": "Quick setting to toggle do not disturb mode",
|
||||
"Icon": "notifications",
|
||||
"Id": "org.kde.plasma.quicksetting.donotdisturb",
|
||||
"License": "GPL",
|
||||
"Name": "Do Not Disturb",
|
||||
"ServiceTypes": [
|
||||
"KPackage/GenericQML"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "https://kde.org"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue