From 54d4d8dba922fde96de8c84ec03dbef720ac6947 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 30 Aug 2017 20:39:43 +0200 Subject: [PATCH 1/9] make the top panel use quick settings --- .../package/contents/ui/main.qml | 70 ++++++++++++---- containments/panel/contents/ui/main.qml | 83 +++++++------------ 2 files changed, 83 insertions(+), 70 deletions(-) diff --git a/applets/quicksettings/package/contents/ui/main.qml b/applets/quicksettings/package/contents/ui/main.qml index d7cd163a..1f2e5315 100644 --- a/applets/quicksettings/package/contents/ui/main.qml +++ b/applets/quicksettings/package/contents/ui/main.qml @@ -35,6 +35,32 @@ Item { Layout.minimumHeight: flow.implicitHeight + units.largeSpacing*2 + property int screenBrightness + readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0 + onScreenBrightnessChanged: { + var service = pmSource.serviceForSource("PowerDevil"); + var operation = service.operationDescription("setBrightness"); + operation.brightness = screenBrightness; + operation.silent = true + service.startOperationCall(operation); + } + + PlasmaCore.DataSource { + id: pmSource + engine: "powermanagement" + connectedSources: ["PowerDevil"] + onSourceAdded: { + if (source === "PowerDevil") { + disconnectSource(source); + connectSource(source); + } + } + + onDataChanged: { + root.screenBrightness = pmSource.data["PowerDevil"]["Screen Brightness"]; + } + } + ListModel { id: settingsModel @@ -69,26 +95,13 @@ Item { text: "Wireless" icon: "network-wireless-on" enabled: true - settingsCommand: "active-settings -m org.kde.plasma.phone.settings.wifi" + settingsCommand: "plasmawindowed org.kde.plasma.networkmanagement" } ListElement { text: "Alarms" icon: "korgac" enabled: false - settingsCommand: "" - } - ListElement { - text: "Notifications" - icon: "preferences-desktop-notification" - enabled: true - settingsCommand: "" - } - ListElement { - text: "Brightness" - icon: "video-display-brightness" - enabled: false - settingsCommand: "active-settings -m org.kde.active.settings.powermanagement" - delegate: "BrightnessDelegate" + settingsCommand: "ktimer" } ListElement { text: "Flashlight" @@ -126,5 +139,32 @@ Item { properties: "x,y" } } + RowLayout { + width: flow.width + PlasmaCore.IconItem { + Layout.preferredWidth: units.iconSizes.small + Layout.preferredHeight: Layout.preferredWidth + //TODO: needs brightness + source: "contrast" + } + PlasmaComponents.Slider { + id: brightnessSlider + Layout.fillWidth: true + value: root.screenBrightness + onValueChanged: { + if (pressed) { + root.screenBrightness = value + } + } + minimumValue: maximumValue > 100 ? 1 : 0 + maximumValue: root.maximumScreenBrightness + } + PlasmaCore.IconItem { + Layout.preferredWidth: units.iconSizes.small + Layout.preferredHeight: Layout.preferredWidth + //TODO: needs brightness + source: "contrast" + } + } } } diff --git a/containments/panel/contents/ui/main.qml b/containments/panel/contents/ui/main.qml index a0f57a94..e58d5f6e 100644 --- a/containments/panel/contents/ui/main.qml +++ b/containments/panel/contents/ui/main.qml @@ -36,7 +36,6 @@ PlasmaCore.ColorScope { property Item toolBox property int buttonHeight: width/4 property bool reorderingApps: false - property QtObject expandedApplet property var layoutManager: LayoutManager Containment.onAppletAdded: { @@ -44,17 +43,14 @@ PlasmaCore.ColorScope { LayoutManager.save(); } - Connections { - target: expandedApplet - onExpandedChanged: { - if (!expanded) { - slidingPanel.close(); - } - } - } - function addApplet(applet, x, y) { - + if (applet.pluginName == "org.kde.phone.quicksettings") { + applet.parent = quickSettingsParent; + quickSettingsParent.applet = applet; + applet.anchors.fill = quickSettingsParent; + applet.visible = true; + return; + } var container = appletContainerComponent.createObject(appletIconsRow) print("Applet added: " + applet + " " + applet.title) container.width = units.iconSizes.medium @@ -65,7 +61,12 @@ PlasmaCore.ColorScope { applet.anchors.fill = container; applet.visible = true; container.visible = true; - + if (applet.pluginName == "org.kde.plasma.notifications") { + applet.expanded = true; + applet.fullRepresentationItem.parent = notificationsParent; + notificationsParent.applet = applet.fullRepresentationItem; + applet.fullRepresentationItem.anchors.fill = notificationsParent; + } } Component.onCompleted: { @@ -101,23 +102,6 @@ PlasmaCore.ColorScope { Layout.fillHeight: true Layout.minimumWidth: applet && applet.compactRepresentationItem ? Math.max(applet.compactRepresentationItem.Layout.minimumWidth, appletIconsRow.height) : appletIconsRow.height Layout.maximumWidth: Layout.minimumWidth - - MouseArea { - anchors.fill: parent - z: 999 - onClicked: { - if (root.expandedApplet != applet) { - //temp var needed for oldExpandedApplet not to catch one expandedChanged too much by our Connections - var oldExpandedApplet = root.expandedApplet; - root.expandedApplet = applet; - applet.expanded = true; - appletsStack.replace(applet.fullRepresentationItem); - if (oldExpandedApplet) { - oldExpandedApplet.expanded = false; - } - } - } - } } } @@ -140,9 +124,9 @@ PlasmaCore.ColorScope { color: PlasmaCore.ColorScope.backgroundColor //used as is needed somebody to filter events - MouseArea { + /*MouseArea { anchors.fill: parent - } + }*/ Loader { id: strengthLoader height: parent.height @@ -185,15 +169,8 @@ PlasmaCore.ColorScope { anchors { bottom: parent.bottom right: parent.right - bottomMargin: slidingPanel.visible ? parent.height : 0 - } - height: slidingPanel.visible ? units.iconSizes.large : parent.height - Behavior on height { - PropertyAnimation { - duration: units.longDuration - easing.type: Easing.InOutQuad - } } + height: parent.height } Rectangle { @@ -220,7 +197,6 @@ PlasmaCore.ColorScope { var factor = 1; slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY) * factor; oldMouseY = mouse.y; - root.expandedApplet.expanded = true; } onReleased: slidingPanel.updateState(); } @@ -229,24 +205,21 @@ PlasmaCore.ColorScope { id: slidingPanel width: plasmoid.availableScreenRect.width height: plasmoid.availableScreenRect.height - contents: Item { + contents: ColumnLayout { id: panelContents anchors.fill: parent - - PlasmaComponents.PageStack { - id: appletsStack - anchors { - fill: parent - bottomMargin: units.iconSizes.large - } + Item { + id: quickSettingsParent + property var applet + Layout.fillWidth: true + Layout.minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 } - } - onVisibleChanged: { - if (visible && !root.expandedApplet) { - var applet = appletIconsRow.children[0].applet; - applet.expanded = true; - appletsStack.replace(applet.fullRepresentationItem); - root.expandedApplet = applet; + Item { + id: notificationsParent + property var applet + clip: true + Layout.minimumHeight: applet ? applet.Layout.minimumHeight : 0 + Layout.fillWidth: true } } } From f35d9909af02e199c88e6fbb5166c5b146bbab37 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 31 Aug 2017 11:52:47 +0200 Subject: [PATCH 2/9] better layout for quicksettings and notifications --- .../panel/contents/ui/SlidingPanel.qml | 3 ++- containments/panel/contents/ui/main.qml | 23 ++++++++++++++----- shell/contents/layout.js | 5 +++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/containments/panel/contents/ui/SlidingPanel.qml b/containments/panel/contents/ui/SlidingPanel.qml index 46623427..dc7cebde 100644 --- a/containments/panel/contents/ui/SlidingPanel.qml +++ b/containments/panel/contents/ui/SlidingPanel.qml @@ -90,7 +90,8 @@ FullScreenPanel { } onPositionChanged: { if (startMouseY < contentArea.height - units.iconSizes.large) { - return; + //TODO: test if we can do without this return + // return; } var factor = (mouse.y - oldMouseY > 0) ? (1 - Math.max(0, (slidingArea.y + overShoot) / overShoot)) : 1 diff --git a/containments/panel/contents/ui/main.qml b/containments/panel/contents/ui/main.qml index e58d5f6e..1797685d 100644 --- a/containments/panel/contents/ui/main.qml +++ b/containments/panel/contents/ui/main.qml @@ -205,21 +205,32 @@ PlasmaCore.ColorScope { id: slidingPanel width: plasmoid.availableScreenRect.width height: plasmoid.availableScreenRect.height - contents: ColumnLayout { + contents: Item { id: panelContents anchors.fill: parent - Item { + Rectangle { id: quickSettingsParent + color: PlasmaCore.ColorScope.backgroundColor + z: 2 + anchors { + left: parent.left + top: parent.top + right: parent.right + } property var applet - Layout.fillWidth: true - Layout.minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 + height: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 } Item { id: notificationsParent + anchors { + left: parent.left + bottom: parent.bottom + right: parent.right + bottomMargin: root.height + } property var applet clip: true - Layout.minimumHeight: applet ? applet.Layout.minimumHeight : 0 - Layout.fillWidth: true + height: panelContents.height - quickSettingsParent.height-root.height//applet ? applet.Layout.minimumHeight : 0 } } } diff --git a/shell/contents/layout.js b/shell/contents/layout.js index e7c3c21c..fff9186e 100644 --- a/shell/contents/layout.js +++ b/shell/contents/layout.js @@ -13,6 +13,7 @@ desktopsArray[0].addWidget("org.kde.plasma.analogclock"); var panel = new Panel("org.kde.phone.panel"); panel.addWidget("org.kde.plasma.notifications"); +panel.addWidget("org.kde.phone.quicksettings"); panel.addWidget("org.kde.plasma.networkmanagement"); panel.addWidget("org.kde.plasma.battery"); panel.addWidget("org.kde.plasma.volume"); @@ -27,4 +28,6 @@ if (screenGeometry(bottomPanel.screen).height > screenGeometry(bottomPanel.scree else bottomPanel.height = 60; -createActivity("Activity 2"); +if (activities().length < 2) { + createActivity("Activity 2"); +} From 15526517ef21ebf518b33c43b5fdccbfbe0b75dd Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Sep 2017 18:35:41 +0200 Subject: [PATCH 3/9] rewrite slidingpanel as a flickable use again custom notifications applet --- .../contents/ui/NotificationStripe.qml | 109 +++------ applets/notifications/contents/ui/main.qml | 41 +++- .../package/contents/ui/main.qml | 2 +- .../panel/contents/ui/SlidingPanel.qml | 220 +++++++----------- containments/panel/contents/ui/main.qml | 30 ++- shell/contents/layout.js | 2 +- 6 files changed, 176 insertions(+), 228 deletions(-) diff --git a/applets/notifications/contents/ui/NotificationStripe.qml b/applets/notifications/contents/ui/NotificationStripe.qml index c4ce39fb..bd0e65a0 100644 --- a/applets/notifications/contents/ui/NotificationStripe.qml +++ b/applets/notifications/contents/ui/NotificationStripe.qml @@ -29,7 +29,7 @@ MouseArea { //actionsLayout.height*2 because the text is centered //TODO: center the whole block not only the text - height: Math.max(messageLayout.height, icon.height) + background.margins.top + background.margins.bottom + (expanded ? actionsLayout.height*2 : 0) + height: Math.max(units.gridUnit * 3, Math.max(messageLayout.height, icon.height)) + (expanded ? actionsLayout.height*2 : 0) width: parent.width anchors.bottomMargin: 10 drag.axis: Drag.XAxis @@ -39,12 +39,19 @@ MouseArea { property string source: model.source property var actions: model.actions + opacity: 1 - Math.abs(x) / (width/2) Behavior on x { NumberAnimation { easing.type: Easing.InOutQuad duration: units.longDuration } } + Behavior on height { + NumberAnimation { + easing.type: Easing.InOutQuad + duration: units.longDuration + } + } onReleased: { if (drag.active) { @@ -66,22 +73,18 @@ MouseArea { } - PlasmaCore.FrameSvgItem { + Rectangle { id: background - imagePath: "widgets/background" - anchors { - fill: parent - rightMargin: -notificationItem.width - leftMargin: units.gridUnit - } - colorGroup: PlasmaCore.ColorScope.colorGroup + anchors.fill: parent + color: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, notificationItem.pressed ? 0.5 : 0.2) } PlasmaComponents.ToolButton { + id: closeButton anchors { - left: parent.left + right: parent.right verticalCenter: parent.verticalCenter - leftMargin: units.gridUnit / 2 + rightMargin: units.gridUnit } iconSource: "window-close" flat: false @@ -90,52 +93,32 @@ MouseArea { } } - PlasmaComponents.Label { - id: appLabel - anchors.leftMargin: units.gridUnit * 3 - - color: PlasmaCore.ColorScope.textColor - text: model.appName - } - - Column { + ColumnLayout { id: messageLayout anchors { verticalCenter: parent.verticalCenter - left: parent.left - right: icon.left - leftMargin: units.gridUnit * 3 + left: icon.right + right: notificationItem.expanded ? actionsLayout.left : closeButton.left + leftMargin: units.gridUnit + rightMargin: units.gridUnit } PlasmaComponents.Label { id: summaryLabel - anchors.right: parent.right - width: messageLayout.width - appLabel.width - horizontalAlignment: Qt.AlignRight + Layout.fillWidth: true verticalAlignment: Qt.AlignVCenter - text: summary + (!notificationItem.expanded && body ? "..." : "") - wrapMode: Text.WordWrap + text: model.appName + " " + summary + elide: Text.ElideRight } PlasmaComponents.Label { id: bodyLabel - anchors { - right: parent.right - left: parent.left - } - visible: height > 0 - height: notificationItem.expanded && body != undefined && body ? implicitHeight : 0 - clip: true - horizontalAlignment: Qt.AlignRight + Layout.fillWidth: true + visible: text.length > 0 + opacity: 0.8 verticalAlignment: Qt.AlignVCenter text: body wrapMode: Text.WordWrap - Behavior on height { - NumberAnimation { - duration: units.longDuration - easing.type: Easing.InOutQuad - } - } } } @@ -143,21 +126,21 @@ MouseArea { PlasmaCore.IconItem { id: icon anchors { - right: notificationItem.right verticalCenter: parent.verticalCenter } + x: units.gridUnit width: units.iconSizes.medium height: width source: appIcon && appIcon.length > 0 ? appIcon : "preferences-desktop-notification" + colorGroup: PlasmaCore.ColorScope.colorGroup } - Flow { + Column { id: actionsLayout anchors { - left: messageLayout.left - right: messageLayout.right - top: messageLayout.bottom - topMargin: units.smallSpacing + right: closeButton.left + rightMargin: units.gridUnit + verticalCenter: parent.verticalCenter } opacity: notificationItem.expanded && notificationItem.actions && notificationItem.actions.count > 0 ? 1 : 0 Behavior on opacity { @@ -177,34 +160,4 @@ MouseArea { } } } - - states: [ - State { - name: "large" - when: appLabel.width + bodyLabel.paintedWidth < messageLayout.width - AnchorChanges { - target: appLabel - anchors { - verticalCenter: parent.verticalCenter - top: undefined - left: parent.left - } - } - PropertyChanges { - - } - }, - State { - name: "compact" - when: notificationItem.state != "large" - AnchorChanges { - target: appLabel - anchors { - verticalCenter: undefined - top: messageLayout.top - left: parent.left - } - } - } - ] } diff --git a/applets/notifications/contents/ui/main.qml b/applets/notifications/contents/ui/main.qml index 2f0fb942..c61cb2e4 100644 --- a/applets/notifications/contents/ui/main.qml +++ b/applets/notifications/contents/ui/main.qml @@ -28,9 +28,12 @@ Item { id: root property int notificationId: 0 - Layout.minimumHeight: notificationView.contentHeight + Layout.maximumHeight: notificationView.contentHeight + units.gridUnit + //todo: size of first item + Layout.minimumHeight: units.gridUnit * 4 - Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground + Plasmoid.switchWidth: 500 + Plasmoid.switchHeight: 500 function addNotification(source, data, actions) { // Do not show duplicated notifications @@ -133,14 +136,40 @@ Item { ListModel { id: notificationsModel + ListElement { + source: "call1Source" + appIcon: "call-start" + summary: "Missed call from Joe" + appName: "Phone" + body: "Called at 8:42 from +41 56 373 37 31" + actions: [] + } + ListElement { + source: "im1Source" + appIcon: "im-google" + appName: "Message" + summary: "July: Hey! Are you around?" + actions: [] + } + ListElement { + source: "im2Source" + appIcon: "im-google" + appName: "Message" + summary: "July: Hello?" + actions: [] + } } - ListView { + ListView { id: notificationView - spacing: units.smallSpacing - anchors.fill: parent + spacing: units.largeSpacing + anchors { + fill: parent + leftMargin: units.largeSpacing + rightMargin: units.largeSpacing + } interactive: false - cacheBuffer: 2000 + cacheBuffer: 200000 z: 1 verticalLayoutDirection: ListView.BottomToTop diff --git a/applets/quicksettings/package/contents/ui/main.qml b/applets/quicksettings/package/contents/ui/main.qml index 1f2e5315..5ee9d82a 100644 --- a/applets/quicksettings/package/contents/ui/main.qml +++ b/applets/quicksettings/package/contents/ui/main.qml @@ -68,7 +68,7 @@ Item { text: "Settings" icon: "configure" enabled: false - settingsCommand: "active-settings" + settingsCommand: "plasma-mobile-settings" toggleFunction: "" delegate: "" } diff --git a/containments/panel/contents/ui/SlidingPanel.qml b/containments/panel/contents/ui/SlidingPanel.qml index dc7cebde..8e833c7a 100644 --- a/containments/panel/contents/ui/SlidingPanel.qml +++ b/containments/panel/contents/ui/SlidingPanel.qml @@ -28,7 +28,7 @@ FullScreenPanel { id: window property int offset: 0 - property int overShoot: units.gridUnit * 2 + property int peekHeight color: "transparent" property alias contents: contentArea.data @@ -36,108 +36,108 @@ FullScreenPanel { width: Screen.width height: Screen.height + property alias fixedArea: fixedArea function open() { - mouseArea.state = "open"; + window.visible = true; + openAnim.running = true; } function close() { - mouseArea.state = "closed"; + closeAnim.running = true; } function updateState() { - var delta = offset - mouseArea.startOffset; - if (delta > units.gridUnit * 8) { - mouseArea.state = "open"; - } else if (delta < -units.gridUnit * 8) { - mouseArea.state = "closed"; - } else { - mouseArea.state = mouseArea.startState; + if (offset < peekHeight / 2) { + close(); + } else if (offset < peekHeight) { + open(); } - mouseArea.startState = mouseArea.state; } onVisibleChanged: { if (visible) { - mouseArea.state = "draggingFromClosed"; - mouseArea.startOffset = units.gridUnit * 4; window.width = Screen.width; window.height = Screen.height; } } - - MouseArea { - id: mouseArea - y: 0 - width: Screen.width - height: Screen.height - //clip: true - state: "closed" - drag.filterChildren: true - - property int oldMouseY: 0 - property int startOffset: units.iconSizes.large; - property int startMouseY: 0 - property string startState: "closed" - - onPressed: { - startMouseY = mouse.y; - if (startMouseY < contentArea.height - units.iconSizes.large) { - return; - } - startState = state; - startOffset = window.offset; - oldMouseY = mouse.y; - state = "draggingFromOpen"; - window.offset = startOffset; + SequentialAnimation { + id: closeAnim + PropertyAnimation { + target: window + duration: units.longDuration + easing.type: Easing.InOutQuad + properties: "offset" + from: window.offset + to: 0 } - onPositionChanged: { - if (startMouseY < contentArea.height - units.iconSizes.large) { - //TODO: test if we can do without this return - // return; - } - var factor = (mouse.y - oldMouseY > 0) ? (1 - Math.max(0, (slidingArea.y + overShoot) / overShoot)) : 1 - - window.offset = window.offset + (mouse.y - oldMouseY) * factor; - oldMouseY = mouse.y; - } - onReleased: { - if (startMouseY < contentArea.height - units.iconSizes.large) { - return; - } - if (Math.abs(window.offset - mouseArea.startOffset) < units.gridUnit && - slidingArea.y + slidingArea.height < mouse.y) { - mouseArea.state = "closed"; - } else { - window.updateState(); + ScriptAction { + script: { + window.visible = false; } } + } + PropertyAnimation { + id: openAnim + target: window + duration: units.longDuration + easing.type: Easing.InOutQuad + properties: "offset" + from: window.offset + to: window.peekHeight + } + + Rectangle { + anchors.fill: parent + color: Qt.rgba(0, 0, 0, 0.6 * Math.min(1, offset/contentArea.height)) + } + + PlasmaCore.ColorScope { + id: slidingArea + anchors.fill: parent + y: Math.min(0, -height + window.offset) + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup Rectangle { - anchors.fill: parent - color: Qt.rgba(0, 0, 0, 0.6-Math.abs(slidingArea.y/slidingArea.height)) + anchors { + top: parent.top + left: parent.left + right: parent.right + } + height: contentArea.height - mainFlickable.contentY + color: PlasmaCore.ColorScope.backgroundColor } - PlasmaCore.ColorScope { - id: slidingArea - width: parent.width - height: parent.height/1.5 - y: Math.min(0, -height + window.offset) - colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - Rectangle { - anchors.fill: parent + Flickable { + id: mainFlickable + anchors.fill: parent + Binding { + target: mainFlickable + property: "contentY" + value: -window.offset + contentArea.height + when: !mainFlickable.moving && !mainFlickable.dragging && !mainFlickable.flicking + } + //no loop as those 2 values compute to exactly the same + onContentYChanged: window.offset = -contentY + contentArea.height + contentWidth: window.width + contentHeight: window.height*2 + bottomMargin: window.height + onMovementEnded: window.updateState(); + onFlickEnded: window.updateState(); + Item { + width: window.width + height: window.height*2 Item { id: contentArea anchors { - fill: parent - topMargin: overShoot + left: parent.left + right: parent.right } + height: children[0].implicitHeight } - color: PlasmaCore.ColorScope.backgroundColor - Rectangle { height: units.gridUnit anchors { left: parent.left right: parent.right - top: parent.bottom + top: contentArea.bottom } gradient: Gradient { GradientStop { @@ -154,69 +154,25 @@ FullScreenPanel { } } } + MouseArea { + anchors { + left: parent.left + right: parent.right + top: contentArea.bottom + } + height: window.height + onClicked: window.close(); + } } } - //FIXME: this empty mousearea is a workaround on https://bugreports.qt.io/browse/QTBUG-46545 - MouseArea { - z: -1 - anchors.fill: parent - onClicked: { - if (mouseArea.startMouseY < contentArea.height - units.iconSizes.large) { - return; - } - mouseArea.state = "closed"; - //window.visible = false; + Item { + id: fixedArea + anchors { + left: parent.left + right: parent.right + top: parent.top } + height: childrenRect.height } - - states: [ - State { - name: "closed" - PropertyChanges { - target: window - offset: 0 - } - }, - State { - name: "open" - PropertyChanges { - target: window - offset: slidingArea.height - overShoot - } - }, - State { - name: "draggingFromOpen" - }, - State { - name: "draggingFromClosed" - PropertyChanges { - target: window - offset: units.gridUnit * 4 - } - } - ] - - transitions: [ - Transition { - to: "draggingFromOpen" - }, - Transition { - SequentialAnimation { - PropertyAnimation { - target: window - duration: units.longDuration - easing.type: Easing.InOutQuad - properties: "offset" - } - ScriptAction { - script: { - if (mouseArea.state == "closed") { - window.visible = false; - } - } - } - } - } - ] } } diff --git a/containments/panel/contents/ui/main.qml b/containments/panel/contents/ui/main.qml index 1797685d..81f1f354 100644 --- a/containments/panel/contents/ui/main.qml +++ b/containments/panel/contents/ui/main.qml @@ -61,10 +61,10 @@ PlasmaCore.ColorScope { applet.anchors.fill = container; applet.visible = true; container.visible = true; - if (applet.pluginName == "org.kde.plasma.notifications") { - applet.expanded = true; + if (applet.pluginName == "org.kde.phone.notifications") { + // applet.expanded = true; applet.fullRepresentationItem.parent = notificationsParent; - notificationsParent.applet = applet.fullRepresentationItem; + notificationsParent.applet = applet; applet.fullRepresentationItem.anchors.fill = notificationsParent; } } @@ -123,10 +123,6 @@ PlasmaCore.ColorScope { height: root.height color: PlasmaCore.ColorScope.backgroundColor - //used as is needed somebody to filter events - /*MouseArea { - anchors.fill: parent - }*/ Loader { id: strengthLoader height: parent.height @@ -205,20 +201,34 @@ PlasmaCore.ColorScope { id: slidingPanel width: plasmoid.availableScreenRect.width height: plasmoid.availableScreenRect.height + peekHeight: quickSettingsParent.height + notificationsParent.minimumHeight + root.height contents: Item { id: panelContents anchors.fill: parent + implicitHeight: quickSettingsParent.height + notificationsParent.height + root.height Rectangle { id: quickSettingsParent + parent: slidingPanel.fixedArea color: PlasmaCore.ColorScope.backgroundColor z: 2 anchors { left: parent.left - top: parent.top right: parent.right } + y: Math.min(0, slidingPanel.offset - height - root.height) property var applet height: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom:parent.bottom + } + height: units.devicePixelRatio + color: PlasmaCore.ColorScope.textColor + opacity: 0.2 + visible: slidingPanel.offset < panelContents.height + } } Item { id: notificationsParent @@ -229,8 +239,8 @@ PlasmaCore.ColorScope { bottomMargin: root.height } property var applet - clip: true - height: panelContents.height - quickSettingsParent.height-root.height//applet ? applet.Layout.minimumHeight : 0 + height: applet ? applet.fullRepresentationItem.Layout.maximumHeight : 0 + property int minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 } } } diff --git a/shell/contents/layout.js b/shell/contents/layout.js index fff9186e..1fdf22dd 100644 --- a/shell/contents/layout.js +++ b/shell/contents/layout.js @@ -12,7 +12,7 @@ for (var j = 0; j < desktopsArray.length; j++) { desktopsArray[0].addWidget("org.kde.plasma.analogclock"); var panel = new Panel("org.kde.phone.panel"); -panel.addWidget("org.kde.plasma.notifications"); +panel.addWidget("org.kde.phone.notifications"); panel.addWidget("org.kde.phone.quicksettings"); panel.addWidget("org.kde.plasma.networkmanagement"); panel.addWidget("org.kde.plasma.battery"); From 0b03a9d234bb3f51f9afd59f8103810cfd850761 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Sep 2017 18:36:10 +0200 Subject: [PATCH 4/9] don't inject fake notifications --- applets/notifications/contents/ui/main.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applets/notifications/contents/ui/main.qml b/applets/notifications/contents/ui/main.qml index c61cb2e4..93d58601 100644 --- a/applets/notifications/contents/ui/main.qml +++ b/applets/notifications/contents/ui/main.qml @@ -136,7 +136,7 @@ Item { ListModel { id: notificationsModel - ListElement { + /* ListElement { source: "call1Source" appIcon: "call-start" summary: "Missed call from Joe" @@ -157,7 +157,7 @@ Item { appName: "Message" summary: "July: Hello?" actions: [] - } + }*/ } ListView { From 09ce25dfdc141dfed27db033c5b434d8e96e42be Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Sep 2017 18:39:39 +0200 Subject: [PATCH 5/9] no notific message --- applets/notifications/contents/ui/main.qml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/applets/notifications/contents/ui/main.qml b/applets/notifications/contents/ui/main.qml index 93d58601..713810e6 100644 --- a/applets/notifications/contents/ui/main.qml +++ b/applets/notifications/contents/ui/main.qml @@ -122,18 +122,14 @@ Item { } - PlasmaCore.FrameSvgItem { + PlasmaComponents.Label { anchors.centerIn: parent + opacity: 0.4 visible: notificationsModel.count == 0 - imagePath: "widgets/background" - width: childrenRect.width + margins.left + margins.right - height: childrenRect.height + margins.top + margins.bottom - PlasmaComponents.Label { - anchors.centerIn: parent - text: i18n("No recent notifications") - } + text: i18n("No recent notifications") } + ListModel { id: notificationsModel /* ListElement { From c82c24a9743928231b9b0da17931ff0247846076 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Sep 2017 18:40:35 +0200 Subject: [PATCH 6/9] not necessary to expand notifications --- containments/panel/contents/ui/main.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/containments/panel/contents/ui/main.qml b/containments/panel/contents/ui/main.qml index 81f1f354..e7a3eed5 100644 --- a/containments/panel/contents/ui/main.qml +++ b/containments/panel/contents/ui/main.qml @@ -62,7 +62,6 @@ PlasmaCore.ColorScope { applet.visible = true; container.visible = true; if (applet.pluginName == "org.kde.phone.notifications") { - // applet.expanded = true; applet.fullRepresentationItem.parent = notificationsParent; notificationsParent.applet = applet; applet.fullRepresentationItem.anchors.fill = notificationsParent; From 48c8071bdbad8ff12c579f3525b1e565f6bd290a Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Sep 2017 18:49:07 +0200 Subject: [PATCH 7/9] better open behavior --- containments/panel/contents/ui/SlidingPanel.qml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/containments/panel/contents/ui/SlidingPanel.qml b/containments/panel/contents/ui/SlidingPanel.qml index 8e833c7a..7127589b 100644 --- a/containments/panel/contents/ui/SlidingPanel.qml +++ b/containments/panel/contents/ui/SlidingPanel.qml @@ -39,7 +39,7 @@ FullScreenPanel { property alias fixedArea: fixedArea function open() { window.visible = true; - openAnim.running = true; + peekAnim.running = true; } function close() { closeAnim.running = true; @@ -49,6 +49,8 @@ FullScreenPanel { close(); } else if (offset < peekHeight) { open(); + } else if (mainFlickable.contentY < 0) { + openAnim.running = true; } } @@ -75,7 +77,7 @@ FullScreenPanel { } } PropertyAnimation { - id: openAnim + id: peekAnim target: window duration: units.longDuration easing.type: Easing.InOutQuad @@ -83,6 +85,15 @@ FullScreenPanel { from: window.offset to: window.peekHeight } + PropertyAnimation { + id: openAnim + target: window + duration: units.longDuration + easing.type: Easing.InOutQuad + properties: "offset" + from: window.offset + to: contentArea.height + } Rectangle { anchors.fill: parent @@ -90,7 +101,6 @@ FullScreenPanel { } PlasmaCore.ColorScope { - id: slidingArea anchors.fill: parent y: Math.min(0, -height + window.offset) colorGroup: PlasmaCore.Theme.ComplementaryColorGroup From 89f1f1a8af0552784cee7d51655a3f5a54fa29f8 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 4 Sep 2017 14:16:51 +0200 Subject: [PATCH 8/9] notifications count in the compact representation --- applets/notifications/contents/ui/main.qml | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/applets/notifications/contents/ui/main.qml b/applets/notifications/contents/ui/main.qml index 713810e6..8b501e48 100644 --- a/applets/notifications/contents/ui/main.qml +++ b/applets/notifications/contents/ui/main.qml @@ -129,10 +129,35 @@ Item { text: i18n("No recent notifications") } + Plasmoid.compactRepresentation: PlasmaCore.SvgItem { + id: notificationSvgItem + anchors.centerIn: parent + width: units.roundToIconSize(Math.min(parent.width, parent.height)) + height: width + + svg: PlasmaCore.Svg { + imagePath: "icons/notification" + colorGroup: PlasmaCore.ColorScope.colorGroup + } + + elementId: { + if (notificationsModel.count > 0) { + return "notification-empty" + } + return "notification-disabled" + } + PlasmaComponents.Label { + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + visible: notificationsModel.count > 0 + text: notificationsModel.count + } + } ListModel { id: notificationsModel - /* ListElement { + /* ListElement { source: "call1Source" appIcon: "call-start" summary: "Missed call from Joe" From d93ec0996466a56f7f53ab4a800f58a6cafbacd3 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 4 Sep 2017 18:15:49 +0200 Subject: [PATCH 9/9] open settings app close panel when app launches --- applets/notifications/contents/ui/main.qml | 4 ++-- applets/quicksettings/package/contents/ui/main.qml | 2 +- containments/panel/contents/ui/SlidingPanel.qml | 6 ++++++ containments/panel/contents/ui/main.qml | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/applets/notifications/contents/ui/main.qml b/applets/notifications/contents/ui/main.qml index 8b501e48..104022fd 100644 --- a/applets/notifications/contents/ui/main.qml +++ b/applets/notifications/contents/ui/main.qml @@ -157,7 +157,7 @@ Item { ListModel { id: notificationsModel - /* ListElement { + ListElement { source: "call1Source" appIcon: "call-start" summary: "Missed call from Joe" @@ -178,7 +178,7 @@ Item { appName: "Message" summary: "July: Hello?" actions: [] - }*/ + } } ListView { diff --git a/applets/quicksettings/package/contents/ui/main.qml b/applets/quicksettings/package/contents/ui/main.qml index 5ee9d82a..dbff9760 100644 --- a/applets/quicksettings/package/contents/ui/main.qml +++ b/applets/quicksettings/package/contents/ui/main.qml @@ -68,7 +68,7 @@ Item { text: "Settings" icon: "configure" enabled: false - settingsCommand: "plasma-mobile-settings" + settingsCommand: "plasma-settings" toggleFunction: "" delegate: "" } diff --git a/containments/panel/contents/ui/SlidingPanel.qml b/containments/panel/contents/ui/SlidingPanel.qml index 7127589b..97a5406e 100644 --- a/containments/panel/contents/ui/SlidingPanel.qml +++ b/containments/panel/contents/ui/SlidingPanel.qml @@ -54,10 +54,16 @@ FullScreenPanel { } } + onActiveChanged: { + if (!active) { + close(); + } + } onVisibleChanged: { if (visible) { window.width = Screen.width; window.height = Screen.height; + window.requestActivate(); } } SequentialAnimation { diff --git a/containments/panel/contents/ui/main.qml b/containments/panel/contents/ui/main.qml index e7a3eed5..fede9930 100644 --- a/containments/panel/contents/ui/main.qml +++ b/containments/panel/contents/ui/main.qml @@ -240,6 +240,7 @@ PlasmaCore.ColorScope { property var applet height: applet ? applet.fullRepresentationItem.Layout.maximumHeight : 0 property int minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0 + onHeightChanged: slidingPanel.updateState(); } } }