Commit bf2be2c7 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Cleanup and tidying

- Remove do not disturb times feature
  Might come back at a later point, let's focus on the important bits first
- Turn timeout selection into SpinBox as per VDG's request
- Some naming and layout fixes as per VDG's request
- Add option to exclude application from history
parent 5c834677
/*
* Copyright 2019 Kai Uwe Broulik <kde@privat.broulik.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.3 as QtControls
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kcm 1.2 as KCM
KCM.SimpleKCM {
title: i18n("Do not Disturb Times")
Kirigami.FormLayout {
width: parent.width
Repeater {
model: 7
Rectangle {
property int dayNumber: (Qt.locale().firstDayOfWeek + index) % 7
Kirigami.FormData.label: Qt.locale().dayName(dayNumber)
Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
height: Kirigami.Units.gridUnit
border {
width: 1
color: Kirigami.Theme.textColor
}
}
}
// FIXME fix formatting (no seconds and timezone), make separate component
QtControls.SpinBox {
enabled: dndTimeCheck.checked
from: 0
to: 23 * 60 + 59
value: 22 * 60
stepSize: 15
textFromValue: function(value, locale) {
return new Date(1,1,2019,Math.floor(value / 60),value%60,0).toLocaleTimeString(locale);
}
}
QtControls.Label {
text: i18nc("Enable between hh:mm and hh:mm", "and")
}
QtControls.SpinBox {
enabled: dndTimeCheck.checked
from: 0
to: 23 * 60 + 59
value: 6 * 60
stepSize: 15
textFromValue: function(value, locale) {
return new Date(1,1,2019,Math.floor(value / 60),value%60,0).toLocaleTimeString(locale);
}
}
}
}
......@@ -93,7 +93,13 @@ ColumnLayout {
}
QtControls.CheckBox {
text: i18n("Notification badges")
text: i18n("Show in history")
checked: eventsColumn.behavior & NotificationManager.Settings.ShowInHistory
onClicked: eventsColumn.setBehavior(NotificationManager.Settings.ShowInHistory, checked)
}
QtControls.CheckBox {
text: i18n("Show notification badges")
enabled: !!eventsColumn.appData.desktopEntry
checked: eventsColumn.behavior & NotificationManager.Settings.ShowBadges
onClicked: eventsColumn.setBehavior(NotificationManager.Settings.ShowBadges, checked)
......
......@@ -26,13 +26,11 @@ import org.kde.kirigami 2.7 as Kirigami
Kirigami.Page {
id: positionPage
property QtObject settings
title: i18n("Popup Position")
ScreenPositionSelector {
anchors.horizontalCenter: parent.horizontalCenter
selectedPosition: settings.popupPosition
onSelectedPositionChanged: settings.popupPosition = selectedPosition
selectedPosition: kcm.settings.popupPosition
onSelectedPositionChanged: kcm.settings.popupPosition = selectedPosition
}
}
......@@ -39,26 +39,6 @@ KCM.SimpleKCM {
}
Kirigami.FormLayout {
RowLayout {
Kirigami.FormData.label: i18n("Do not disturb mode:")
QtControls.CheckBox {
id: dndTimeCheck
text: i18nc("Enable do not disturb during following times", "During following times:")
}
QtControls.Button {
text: i18nc("Choose times for do not disturb mode", "Choose...")
icon.name: "preferences-system-time"
onClicked: kcm.push("DndTimePage.qml")
enabled: dndTimeCheck.checked
}
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
}
QtControls.CheckBox {
Kirigami.FormData.label: i18n("Critical notifications:")
text: i18n("Show in do not disturb mode")
......@@ -67,7 +47,7 @@ KCM.SimpleKCM {
}
QtControls.CheckBox {
text: i18n("Keep always on top")
text: i18n("Always keep on top")
checked: kcm.settings.keepCriticalAlwaysOnTop
onClicked: kcm.settings.keepCriticalAlwaysOnTop = checked
}
......@@ -93,42 +73,47 @@ KCM.SimpleKCM {
}
RowLayout {
spacing: 0
QtControls.RadioButton {
id: positionCustomPosition
text: i18n("Custom Position")
checked: kcm.settings.popupPosition !== NotificationManager.Settings.NearWidget
activeFocusOnTab: false
MouseArea {
anchors.fill: parent
onClicked: positionCustomButton.clicked()
}
}
QtControls.Button {
text: i18n("Choose...")
id: positionCustomButton
text: i18n("Choose Custom Position...")
icon.name: "preferences-desktop-display"
onClicked: kcm.push("PopupPositionPage.qml")
enabled: positionCustomPosition.checked
}
}
QtControls.ComboBox {
Layout.fillWidth: false
TextMetrics {
id: timeoutSpinnerMetrics
font: timeoutSpinner.font
text: i18np("%1 second", "%1 seconds", 888)
}
QtControls.SpinBox {
id: timeoutSpinner
Kirigami.FormData.label: i18n("Hide popup after:")
textRole: "label"
currentIndex: {
var idx = model.findIndex(function (item) {
return item.value === kcm.settings.popupTimeout;
});
// would be neat if we could add a custom timeout if setting isn't listed
return idx !== -1 ? idx : 0;
Layout.preferredWidth: timeoutSpinnerMetrics.width + leftPadding + rightPadding
from: 1000 // 1 second
to: 120000 // 2 minutes
stepSize: 1000
value: kcm.settings.popupTimeout
editable: true
valueFromText: function(text, locale) {
return parseInt(text) * 1000;
}
model: [
{label: i18n("5 seconds"), value: 5 * 1000},
{label: i18n("7 seconds"), value: 7 * 1000},
{label: i18n("10 seconds"), value: 10 * 1000},
{label: i18n("15 seconds"), value: 15 * 1000},
{label: i18n("30 seconds"), value: 30 * 1000},
{label: i18n("1 minute"), value: 60 * 1000}
]
onActivated: kcm.settings.popupTimeout = model[index].value
// FIXME proper sizing, especially for the popup
Layout.maximumWidth: Kirigami.Units.gridUnit * 6
textFromValue: function(value, locale) {
return i18np("%1 second", "%1 seconds", Math.round(value / 1000));
}
onValueModified: kcm.settings.popupTimeout = value
}
Kirigami.Separator {
......@@ -171,8 +156,9 @@ KCM.SimpleKCM {
}
QtControls.Button {
text: i18n("Application Settings")
icon.name: "preferences-desktop-notification"
Kirigami.FormData.label: i18n("Applications:")
text: i18n("Configure...")
icon.name: "configure"
onClicked: kcm.push("SourcesPage.qml")
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment