From: Claudio Cambra Date: Wed, 9 Nov 2022 11:50:33 +0000 (+0100) Subject: Replace drawer 'Done' button at bottom-right with close button at top-right X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~77^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a16fc9ffcc63e2df823826dd4a8ee1edfa569944;p=nextcloud-desktop.git Replace drawer 'Done' button at bottom-right with close button at top-right Signed-off-by: Claudio Cambra --- diff --git a/src/gui/filedetails/FileDetailsPage.qml b/src/gui/filedetails/FileDetailsPage.qml index 85eb57c3f..3147bbd64 100644 --- a/src/gui/filedetails/FileDetailsPage.qml +++ b/src/gui/filedetails/FileDetailsPage.qml @@ -23,6 +23,8 @@ import "../tray" Page { id: root + signal closeButtonClicked + property var accountState: ({}) property string localPath: "" @@ -34,6 +36,7 @@ Page { property int intendedPadding: Style.standardSpacing * 2 property int iconSize: 32 property StackView rootStackView: StackView {} + property bool showCloseButton: false property FileDetails fileDetails: FileDetails { id: fileDetails @@ -70,11 +73,12 @@ Page { id: headerGridLayout readonly property bool showFileLockedString: root.fileDetails.lockExpireString !== "" + readonly property int textRightMargin: root.showCloseButton ? root.intendedPadding : 0 Layout.fillWidth: parent Layout.topMargin: root.topPadding - columns: 2 + columns: root.showCloseButton ? 3 : 2 rows: showFileLockedString ? 3 : 2 rowSpacing: Style.standardSpacing / 2 @@ -100,7 +104,7 @@ Page { id: fileNameLabel Layout.fillWidth: true - Layout.rightMargin: root.intendedPadding + Layout.rightMargin: headerGridLayout.textRightMargin text: root.fileDetails.name color: Style.ncTextColor @@ -108,11 +112,29 @@ Page { wrapMode: Text.Wrap } + CustomButton { + id: closeButton + + Layout.rowSpan: headerGridLayout.rows + Layout.preferredWidth: Style.iconButtonWidth + Layout.preferredHeight: width + Layout.rightMargin: headerGridLayout.textRightMargin + + imageSource: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor + bgColor: Style.lightHover + bgNormalOpacity: 0 + toolTipText: qsTr("Dismiss") + + visible: root.showCloseButton + + onClicked: root.closeButtonClicked() + } + EnforcedPlainTextLabel { id: fileDetailsLabel Layout.fillWidth: true - Layout.rightMargin: root.intendedPadding + Layout.rightMargin: headerGridLayout.textRightMargin text: `${root.fileDetails.sizeString} · ${root.fileDetails.lastChangedString}` color: Style.ncSecondaryTextColor @@ -123,7 +145,7 @@ Page { id: fileLockedLabel Layout.fillWidth: true - Layout.rightMargin: root.intendedPadding + Layout.rightMargin: headerGridLayout.textRightMargin text: root.fileDetails.lockExpireString color: Style.ncSecondaryTextColor diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 331cb69c9..a084efa74 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -188,47 +188,17 @@ ApplicationWindow { fileDetailsDrawer.pageToShow); } } - sourceComponent: ColumnLayout { - anchors.fill: parent - - FileDetailsPage { - id: fileDetails - - Layout.fillWidth: true - Layout.fillHeight: true - - background: null - accountState: fileDetailsDrawer.folderAccountState - localPath: fileDetailsDrawer.fileLocalPath - } + sourceComponent:FileDetailsPage { + id: fileDetails - CustomButton { - FontMetrics { - id: doneButtonFm - font: parent.contentsFont - } + anchors.fill: parent - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.topMargin: fileDetails.intendedPadding - Layout.bottomMargin: fileDetails.intendedPadding - Layout.leftMargin: fileDetails.intendedPadding - Layout.rightMargin: fileDetails.intendedPadding - Layout.preferredWidth: doneButtonFm.boundingRect(text).width + - leftPadding + - rightPadding + - Style.standardSpacing * 2 - - text: qsTr("Done") - contentsFont.bold: true - bgColor: Style.currentUserHeaderColor - textColor: Style.adjustedCurrentUserHeaderColor - textColorHovered: Style.currentUserHeaderTextColor - onClicked: fileDetailsDrawer.close() + background: null + accountState: fileDetailsDrawer.folderAccountState + localPath: fileDetailsDrawer.fileLocalPath + showCloseButton: true - Accessible.role: Accessible.Button - Accessible.name: qsTr("Close the file details view") - Accessible.onPressAction: clicked() - } + onCloseButtonClicked: fileDetailsDrawer.close() } } }