diff --git a/applets/batterymonitor/package/contents/ui/PopupDialog.qml b/applets/batterymonitor/package/contents/ui/PopupDialog.qml --- a/applets/batterymonitor/package/contents/ui/PopupDialog.qml +++ b/applets/batterymonitor/package/contents/ui/PopupDialog.qml @@ -53,8 +53,8 @@ Column { id: settingsColumn anchors.horizontalCenter: parent.horizontalCenter - width: parent.width - units.gridUnit - spacing: Math.round(units.gridUnit / 2) + width: parent.width - units.smallSpacing * 2 + spacing: units.gridUnit Components.Label { // this is just for metrics, TODO use TextMetrics in 5.4 instead @@ -114,16 +114,17 @@ anchors { horizontalCenter: parent.horizontalCenter top: settingsColumn.bottom - topMargin: units.gridUnit // not divided by 2 for unified looks + topMargin: units.gridUnit + leftMargin: units.smallSpacing bottom: dialog.bottom } - width: parent.width - units.gridUnit + width: parent.width - units.smallSpacing * 2 ListView { id: batteryList boundsBehavior: Flickable.StopAtBounds - spacing: Math.round(units.gridUnit / 2) + spacing: Math.round(units.smallSpacing / 2) KeyNavigation.tab: brightnessSlider KeyNavigation.backtab: pmSwitch diff --git a/applets/notifications/package/contents/ui/FullRepresentation.qml b/applets/notifications/package/contents/ui/FullRepresentation.qml --- a/applets/notifications/package/contents/ui/FullRepresentation.qml +++ b/applets/notifications/package/contents/ui/FullRepresentation.qml @@ -18,15 +18,14 @@ * along with this program. If not, see */ -import QtQuick 2.10 +import QtQuick 2.8 import QtQuick.Layouts 1.1 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.extras 2.0 as PlasmaExtras -import org.kde.kirigami 2.11 as Kirigami import org.kde.kcoreaddons 1.0 as KCoreAddons @@ -67,9 +66,8 @@ // header ColumnLayout { - id: header - visible: !Kirigami.Settings.isMobile Layout.fillWidth: true + Layout.leftMargin: units.smallSpacing spacing: 0 RowLayout { @@ -173,7 +171,7 @@ if (dndMenu.date.getDay() >= 5) { d = dndMenu.date; d.setHours(dndMorningHour); - // wraps around if necessary + // wraps around if neccessary d.setDate(d.getDate() + (7 - d.getDay() + 1)); d.setMinutes(0); d.setSeconds(0); @@ -265,7 +263,6 @@ } PlasmaCore.SvgItem { - visible: header.visible elementId: "horizontal-line" Layout.fillWidth: true // why is this needed here but not in the delegate? @@ -282,6 +279,7 @@ Layout.fillHeight: true Layout.preferredWidth: units.gridUnit * 18 Layout.preferredHeight: units.gridUnit * 24 + Layout.leftMargin: units.smallSpacing ListView { id: list @@ -375,14 +373,9 @@ } remove: Transition { - id: removeTransition ParallelAnimation { NumberAnimation { property: "opacity"; to: 0; duration: units.longDuration } - NumberAnimation { - property: "x" - to: removeTransition.ViewTransition.item.x >= 0 ? list.width : -list.width - duration: units.longDuration - } + NumberAnimation { property: "x"; to: list.width; duration: units.longDuration } } } removeDisplaced: Transition { @@ -398,190 +391,177 @@ criteria: ViewSection.FullString } - delegate: DraggableDelegate { + delegate: Loader { + id: delegateLoader width: list.width - contentItem: delegateLoader - - draggable: !model.isGroup && model.type != NotificationManager.Notifications.JobType - - onDismissRequested: historyModel.close(historyModel.index(index, 0)); - - Loader { - id: delegateLoader - width: list.width - sourceComponent: model.isGroup ? groupDelegate : notificationDelegate + sourceComponent: model.isGroup ? groupDelegate : notificationDelegate - Component { - id: groupDelegate - NotificationHeader { - applicationName: model.applicationName - applicationIconSource: model.applicationIconName - originName: model.originName || "" + Component { + id: groupDelegate + NotificationHeader { + applicationName: model.applicationName + applicationIconSource: model.applicationIconName + originName: model.originName || "" - // don't show timestamp for group + // don't show timestamp for group - configurable: model.configurable - closable: model.closable - closeButtonTooltip: i18n("Close Group") + configurable: model.configurable + closable: model.closable + closeButtonTooltip: i18n("Close Group") - onCloseClicked: { - historyModel.close(historyModel.index(index, 0)) - if (list.count === 0) { - plasmoid.expanded = false; - } + onCloseClicked: { + historyModel.close(historyModel.index(index, 0)) + if (list.count === 0) { + plasmoid.expanded = false; } - - onConfigureClicked: historyModel.configure(historyModel.index(index, 0)) } - } - Component { - id: notificationDelegate - ColumnLayout { - spacing: units.smallSpacing + onConfigureClicked: historyModel.configure(historyModel.index(index, 0)) + } + } - RowLayout { - Item { - id: groupLineContainer - Layout.fillHeight: true - Layout.topMargin: units.smallSpacing + Component { + id: notificationDelegate + ColumnLayout { + spacing: units.smallSpacing + + RowLayout { + Item { + id: groupLineContainer + Layout.fillHeight: true + Layout.topMargin: units.smallSpacing + width: units.iconSizes.small + visible: model.isInGroup + + PlasmaCore.SvgItem { + elementId: "vertical-line" + svg: lineSvg + anchors.horizontalCenter: parent.horizontalCenter width: units.iconSizes.small - visible: model.isInGroup - - PlasmaCore.SvgItem { - elementId: "vertical-line" - svg: lineSvg - anchors.horizontalCenter: parent.horizontalCenter - width: units.iconSizes.small - height: parent.height - } + height: parent.height } + } - NotificationItem { - Layout.fillWidth: true - - notificationType: model.type - - inGroup: model.isInGroup - - applicationName: model.applicationName - applicationIconSource: model.applicationIconName - originName: model.originName || "" - - time: model.updated || model.created - - // configure button on every single notifications is bit overwhelming - configurable: !inGroup && model.configurable - - dismissable: model.type === NotificationManager.Notifications.JobType - && model.jobState !== NotificationManager.Notifications.JobStateStopped - && model.dismissed - // TODO would be nice to be able to undismiss jobs even when they autohide - && notificationSettings.permanentJobPopups - dismissed: model.dismissed || false - closable: model.closable - - summary: model.summary - body: model.body || "" - icon: model.image || model.iconName - - urls: model.urls || [] - - jobState: model.jobState || 0 - percentage: model.percentage || 0 - jobError: model.jobError || 0 - suspendable: !!model.suspendable - killable: !!model.killable - jobDetails: model.jobDetails || null - - configureActionLabel: model.configureActionLabel || "" - // In the popup the default action is triggered by clicking on the popup - // however in the list this is undesirable, so instead show a clickable button - // in case you have a non-expired notification in history (do not disturb mode) - // unless it has the same label as an action - readonly property bool addDefaultAction: (model.hasDefaultAction - && model.defaultActionLabel - && (model.actionLabels || []).indexOf(model.defaultActionLabel) === -1) ? true : false - actionNames: { - var actions = (model.actionNames || []); - if (addDefaultAction) { - actions.unshift("default"); // prepend - } - return actions; + NotificationItem { + Layout.fillWidth: true + + notificationType: model.type + + inGroup: model.isInGroup + + applicationName: model.applicationName + applicationIconSource: model.applicationIconName + originName: model.originName || "" + + time: model.updated || model.created + + // configure button on every single notifications is bit overwhelming + configurable: !inGroup && model.configurable + + dismissable: model.type === NotificationManager.Notifications.JobType + && model.jobState !== NotificationManager.Notifications.JobStateStopped + && model.dismissed + // TODO would be nice to be able to undismiss jobs even when they autohide + && notificationSettings.permanentJobPopups + dismissed: model.dismissed || false + closable: model.closable + + summary: model.summary + body: model.body || "" + icon: model.image || model.iconName + + urls: model.urls || [] + + jobState: model.jobState || 0 + percentage: model.percentage || 0 + jobError: model.jobError || 0 + suspendable: !!model.suspendable + killable: !!model.killable + jobDetails: model.jobDetails || null + + configureActionLabel: model.configureActionLabel || "" + // In the popup the default action is triggered by clicking on the popup + // however in the list this is undesirable, so instead show a clickable button + // in case you have a non-expired notification in history (do not disturb mode) + // unless it has the same label as an action + readonly property bool addDefaultAction: (model.hasDefaultAction + && model.defaultActionLabel + && (model.actionLabels || []).indexOf(model.defaultActionLabel) === -1) ? true : false + actionNames: { + var actions = (model.actionNames || []); + if (addDefaultAction) { + actions.unshift("default"); // prepend } - actionLabels: { - var labels = (model.actionLabels || []); - if (addDefaultAction) { - labels.unshift(model.defaultActionLabel); - } - return labels; + return actions; + } + actionLabels: { + var labels = (model.actionLabels || []); + if (addDefaultAction) { + labels.unshift(model.defaultActionLabel); } + return labels; + } - onCloseClicked: { - historyModel.close(historyModel.index(index, 0)); - if (list.count === 0) { - plasmoid.expanded = false; - } - } - onDismissClicked: { - model.dismissed = false; + onCloseClicked: { + historyModel.close(historyModel.index(index, 0)); + if (list.count === 0) { plasmoid.expanded = false; } - onConfigureClicked: historyModel.configure(historyModel.index(index, 0)) - - onActionInvoked: { - if (actionName === "default") { - historyModel.invokeDefaultAction(historyModel.index(index, 0)); - } else { - historyModel.invokeAction(historyModel.index(index, 0), actionName); - } - // Keep it in the history - historyModel.expire(historyModel.index(index, 0)); - } - onOpenUrl: { - Qt.openUrlExternally(url); - historyModel.expire(historyModel.index(index, 0)); - } - onFileActionInvoked: historyModel.expire(historyModel.index(index, 0)) + } + onDismissClicked: { + model.dismissed = false; + plasmoid.expanded = false; + } + onConfigureClicked: historyModel.configure(historyModel.index(index, 0)) - onSuspendJobClicked: historyModel.suspendJob(historyModel.index(index, 0)) - onResumeJobClicked: historyModel.resumeJob(historyModel.index(index, 0)) - onKillJobClicked: historyModel.killJob(historyModel.index(index, 0)) + onActionInvoked: { + if (actionName === "default") { + historyModel.invokeDefaultAction(historyModel.index(index, 0)); + } else { + historyModel.invokeAction(historyModel.index(index, 0), actionName); + } + // Keep it in the history + historyModel.expire(historyModel.index(index, 0)); } - } + onOpenUrl: { + Qt.openUrlExternally(url); + historyModel.expire(historyModel.index(index, 0)); + } + onFileActionInvoked: historyModel.expire(historyModel.index(index, 0)) - PlasmaComponents.ToolButton { - Layout.preferredWidth: minimumWidth - iconName: model.isGroupExpanded ? "arrow-up" : "arrow-down" - text: model.isGroupExpanded ? i18n("Show Fewer") - : i18nc("Expand to show n more notifications", - "Show %1 More", (model.groupChildrenCount - model.expandedGroupChildrenCount)) - visible: (model.groupChildrenCount > model.expandedGroupChildrenCount || model.isGroupExpanded) - && delegateLoader.ListView.nextSection !== delegateLoader.ListView.section - onClicked: list.setGroupExpanded(model.index, !model.isGroupExpanded) + onSuspendJobClicked: historyModel.suspendJob(historyModel.index(index, 0)) + onResumeJobClicked: historyModel.resumeJob(historyModel.index(index, 0)) + onKillJobClicked: historyModel.killJob(historyModel.index(index, 0)) } + } - PlasmaCore.SvgItem { - Layout.fillWidth: true - Layout.bottomMargin: units.smallSpacing - elementId: "horizontal-line" - svg: lineSvg + PlasmaComponents.ToolButton { + Layout.preferredWidth: minimumWidth + iconName: model.isGroupExpanded ? "arrow-up" : "arrow-down" + text: model.isGroupExpanded ? i18n("Show Fewer") + : i18nc("Expand to show n more notifications", + "Show %1 More", (model.groupChildrenCount - model.expandedGroupChildrenCount)) + visible: (model.groupChildrenCount > model.expandedGroupChildrenCount || model.isGroupExpanded) + && delegateLoader.ListView.nextSection !== delegateLoader.ListView.section + onClicked: list.setGroupExpanded(model.index, !model.isGroupExpanded) + } - // property is only atached to the delegate itself (the Loader in our case) - visible: (!model.isInGroup || delegateLoader.ListView.nextSection !== delegateLoader.ListView.section) - && delegateLoader.ListView.nextSection !== "" // don't show after last item - } + PlasmaCore.SvgItem { + Layout.fillWidth: true + Layout.bottomMargin: units.smallSpacing + elementId: "horizontal-line" + svg: lineSvg + + // property is only atached to the delegate itself (the Loader in our case) + visible: (!model.isInGroup || delegateLoader.ListView.nextSection !== delegateLoader.ListView.section) + && delegateLoader.ListView.nextSection !== "" // don't show after last item } } } } PlasmaExtras.Heading { width: list.width - height: list.height - horizontalAlignment: Kirigami.Settings.isMobile ? Text.AlignHCenter : Text.AlignLeft - verticalAlignment: Kirigami.Settings.isMobile ? Text.AlignVCenter : Text.AlignTop - wrapMode: Text.WordWrap level: 3 opacity: 0.6 text: i18n("No unread notifications.") diff --git a/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml b/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml --- a/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml +++ b/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml @@ -55,7 +55,7 @@ //applet open, no sidebar } else { - return 0; + return units.smallSpacing; } } Layout.rightMargin: {