From 3b140438c42ecc8b0cd7c2c37f9210f179143a3e Mon Sep 17 00:00:00 2001 From: alex-z Date: Mon, 24 Apr 2023 14:43:13 +0200 Subject: [PATCH] Fix review comments. Signed-off-by: alex-z --- src/gui/filedetails/NCRadioButton.qml | 14 ++++++++------ src/gui/filedetails/ShareDetailsPage.qml | 18 ++++++++---------- src/gui/filedetails/sharemodel.cpp | 4 ++-- src/gui/filedetails/sharemodel.h | 4 ++-- src/gui/sharemanager.cpp | 5 +++-- src/gui/sharemanager.h | 4 ++-- theme/Style/Style.qml | 5 +++++ 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/gui/filedetails/NCRadioButton.qml b/src/gui/filedetails/NCRadioButton.qml index aca59403102fc..890686158e388 100644 --- a/src/gui/filedetails/NCRadioButton.qml +++ b/src/gui/filedetails/NCRadioButton.qml @@ -14,19 +14,21 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 +import Style 1.0 RadioButton { id: root - property int indicatorItemWidth: 16 - property int indicatorItemHeight: 16 - property string color: "#000000" - readonly property int radius: 9 + property int indicatorItemWidth: Style.radioButtonIndicatorSize + property int indicatorItemHeight: Style.radioButtonIndicatorSize + property string color: Style.ncTextColor + readonly property int radius: Style.radioButtonCustomRadius + indicator: Rectangle { implicitWidth: root.indicatorItemWidth implicitHeight: root.indicatorItemHeight anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: 5 + anchors.leftMargin: Style.radioButtonCustomMarginLeftOuter radius: root.radius border.color: root.color border.width: 1 @@ -35,7 +37,7 @@ RadioButton { visible: root.checked color: root.color radius: root.radius - anchors.margins: 4 + anchors.margins: Style.radioButtonCustomMarginLeftInner } } } diff --git a/src/gui/filedetails/ShareDetailsPage.qml b/src/gui/filedetails/ShareDetailsPage.qml index 199c57a001d6e..f4ea6a24f4720 100644 --- a/src/gui/filedetails/ShareDetailsPage.qml +++ b/src/gui/filedetails/ShareDetailsPage.qml @@ -75,7 +75,7 @@ Page { readonly property bool passwordEnforced: shareModelData.passwordEnforced readonly property bool isSharePermissionChangeInProgress: shareModelData.isSharePermissionChangeInProgress readonly property bool isHideDownloadInProgress: shareModelData.isHideDownloadInProgress - readonly property int currentPermissionMode: shareModelData.currentPermissionMode + readonly property int currentPermissionMode: shareModelData.currentPermissionMode readonly property bool isLinkShare: shareModelData.shareType === ShareModel.ShareTypeLink @@ -326,9 +326,7 @@ Page { text: qsTr("Allow upload and editing") enabled: !root.isSharePermissionChangeInProgress - onClicked: { - root.toggleAllowEditing(checked); - } + onClicked: root.toggleAllowEditing(checked) NCBusyIndicator { anchors.fill: parent @@ -353,7 +351,7 @@ Page { } NCRadioButton { - property int permissionMode: ShareModel.ModeViewOnly + readonly property int permissionMode: ShareModel.ModeViewOnly Layout.fillWidth: true ButtonGroup.group: permissionModeRadioButtonsGroup enabled: !root.isSharePermissionChangeInProgress @@ -363,11 +361,11 @@ Page { indicatorItemHeight: moreMenu.indicatorItemWidth spacing: moreMenu.indicatorSpacing padding: moreMenu.itemPadding - onClicked: root.permissionModeChanged(permissionMode); + onClicked: root.permissionModeChanged(permissionMode) } NCRadioButton { - property int permissionMode: ShareModel.ModeUploadAndEditing + readonly property int permissionMode: ShareModel.ModeUploadAndEditing Layout.fillWidth: true ButtonGroup.group: permissionModeRadioButtonsGroup enabled: !root.isSharePermissionChangeInProgress @@ -377,7 +375,7 @@ Page { indicatorItemHeight: moreMenu.indicatorItemWidth spacing: moreMenu.indicatorSpacing padding: moreMenu.itemPadding - onClicked: root.permissionModeChanged(permissionMode); + onClicked: root.permissionModeChanged(permissionMode) NCBusyIndicator { anchors.fill: parent @@ -388,7 +386,7 @@ Page { } NCRadioButton { - property int permissionMode: ShareModel.ModeFileDropOnly + readonly property int permissionMode: ShareModel.ModeFileDropOnly Layout.fillWidth: true ButtonGroup.group: permissionModeRadioButtonsGroup enabled: !root.isSharePermissionChangeInProgress @@ -398,7 +396,7 @@ Page { indicatorItemHeight: moreMenu.indicatorItemWidth spacing: moreMenu.indicatorSpacing padding: moreMenu.itemPadding - onClicked: root.permissionModeChanged(permissionMode); + onClicked: root.permissionModeChanged(permissionMode) } } } diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index a50453984b1f3..5ef0644508f74 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -491,7 +491,7 @@ void ShareModel::setupInternalLinkShare() Q_EMIT internalLinkReady(); } -void ShareModel::setSharePermissionChangeInProgress(const QString &shareId, bool isInProgress) +void ShareModel::setSharePermissionChangeInProgress(const QString &shareId, const bool isInProgress) { if (isInProgress == _sharePermissionsChangeInProgress) { return; @@ -509,7 +509,7 @@ void ShareModel::setSharePermissionChangeInProgress(const QString &shareId, bool Q_EMIT dataChanged(shareModelIndex, shareModelIndex, {IsSharePermissionsChangeInProgress}); } -void ShareModel::setHideDownloadEnabledChangeInProgress(const QString &shareId, bool isInProgress) +void ShareModel::setHideDownloadEnabledChangeInProgress(const QString &shareId, const bool isInProgress) { if (isInProgress == _hideDownloadEnabledChangeInProgress) { return; diff --git a/src/gui/filedetails/sharemodel.h b/src/gui/filedetails/sharemodel.h index f73cdd06e15e4..97c2b74fb251b 100644 --- a/src/gui/filedetails/sharemodel.h +++ b/src/gui/filedetails/sharemodel.h @@ -187,8 +187,8 @@ private slots: void handleSecureFileDropLinkShare(); void handleLinkShare(); void setupInternalLinkShare(); - void setSharePermissionChangeInProgress(const QString &shareId, bool isInProgress); - void setHideDownloadEnabledChangeInProgress(const QString &shareId, bool isInProgress); + void setSharePermissionChangeInProgress(const QString &shareId, const bool isInProgress); + void setHideDownloadEnabledChangeInProgress(const QString &shareId, const bool isInProgress); void slotPropfindReceived(const QVariantMap &result); void slotServerError(const int code, const QString &message); diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp index 92f8c0632efac..3642f31c3036a 100644 --- a/src/gui/sharemanager.cpp +++ b/src/gui/sharemanager.cpp @@ -204,7 +204,7 @@ LinkShare::LinkShare(AccountPtr account, const QDate &expireDate, const QString ¬e, const QString &label, - bool hideDownload) + const bool hideDownload) : Share(account, id, uidowner, ownerDisplayName, path, Share::TypeLink, isPasswordSet, permissions) , _name(name) , _token(token) @@ -320,8 +320,9 @@ void LinkShare::slotLabelSet(const QJsonDocument &, const QVariant &label) } } -void LinkShare::slotHideDownloadSet(const QJsonDocument &jsonDoc, const QVariant hideDownload) +void LinkShare::slotHideDownloadSet(const QJsonDocument &jsonDoc, const QVariant &hideDownload) { + Q_UNUSED(jsonDoc); if (!hideDownload.isValid()) { return; } diff --git a/src/gui/sharemanager.h b/src/gui/sharemanager.h index 6317895ab2a4b..fa74ceaf3df46 100644 --- a/src/gui/sharemanager.h +++ b/src/gui/sharemanager.h @@ -216,7 +216,7 @@ class LinkShare : public Share const QDate &expireDate, const QString ¬e, const QString &label, - bool hideDownload); + const bool hideDownload); /* * Get the share link @@ -317,7 +317,7 @@ private slots: void slotExpireDateSet(const QJsonDocument &reply, const QVariant &value); void slotNameSet(const QJsonDocument &, const QVariant &value); void slotLabelSet(const QJsonDocument &, const QVariant &value); - void slotHideDownloadSet(const QJsonDocument &jsonDoc, const QVariant hideDownload); + void slotHideDownloadSet(const QJsonDocument &jsonDoc, const QVariant &hideDownload); private: QString _name; diff --git a/theme/Style/Style.qml b/theme/Style/Style.qml index 5c0453fe6f3c9..1d788c55d72a6 100644 --- a/theme/Style/Style.qml +++ b/theme/Style/Style.qml @@ -122,6 +122,11 @@ QtObject { readonly property int unifiedSearchResultSectionItemVerticalPadding: 8 readonly property int unifiedSearchResultNothingFoundHorizontalMargin: 10 + readonly property int radioButtonCustomMarginLeftInner: 4 + readonly property int radioButtonCustomMarginLeftOuter: 5 + readonly property int radioButtonCustomRadius: 9 + readonly property int radioButtonIndicatorSize: 16 + readonly property var fontMetrics: FontMetrics {} readonly property int activityContentSpace: 4