use standard and existing property to set icon url in buttons
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 21 Feb 2023 08:16:50 +0000 (09:16 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 17 May 2023 16:16:09 +0000 (18:16 +0200)
replace custom property imageSource by the use of the standard
icon.source

will make our code closer to Qt Quick Controls v2 and less our own
controls toolkit

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/filedetails/FileDetailsPage.qml
src/gui/filedetails/ShareDelegate.qml
src/gui/filedetails/ShareDetailsPage.qml
src/gui/tray/ActivityActionButton.qml
src/gui/tray/ActivityItemActions.qml
src/gui/tray/ActivityItemContent.qml
src/gui/tray/CallNotificationDialog.qml
src/gui/tray/CustomButton.qml

index 6967508711dcf0594cd17d03663ad6fe255aa7b4..b85b5808c0e76307d0e51ed61a87c6aa4e7a5092 100644 (file)
@@ -134,7 +134,7 @@ Page {
                 Layout.preferredHeight: width
                 Layout.rightMargin: headerGridLayout.textRightMargin
 
-                imageSource: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor
+                icon.source: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor
                 bgColor: Style.lightHover
                 bgNormalOpacity: 0
                 toolTipText: qsTr("Dismiss")
index 5efa922653103aaff1b38ed950fd0138216ffa0e..c1b96102642d3cf54f7f1381c222bd53a6e52d99 100644 (file)
@@ -164,7 +164,7 @@ GridLayout {
             bgColor: Style.lightHover
             bgNormalOpacity: 0
 
-            imageSource: "image://svgimage-custom-color/add.svg/" + Style.ncTextColor
+            icon.source: "image://svgimage-custom-color/add.svg/" + Style.ncTextColor
 
             visible: (root.isPlaceholderLinkShare || root.isSecureFileDropPlaceholderLinkShare) && root.canCreateLinkShares
             enabled: visible
@@ -199,7 +199,7 @@ GridLayout {
             bgColor: shareLinkCopied ? Style.positiveColor : Style.lightHover
             bgNormalOpacity: shareLinkCopied ? 1 : 0
 
-            imageSource: shareLinkCopied ? "image://svgimage-custom-color/copy.svg/" + Style.ncHeaderTextColor :
+            icon.source: shareLinkCopied ? "image://svgimage-custom-color/copy.svg/" + Style.ncHeaderTextColor :
                                            "image://svgimage-custom-color/copy.svg/" + Style.ncTextColor
             icon.width: 16
             icon.height: 16
@@ -245,7 +245,7 @@ GridLayout {
             bgColor: Style.lightHover
             bgNormalOpacity: 0
 
-            imageSource: "image://svgimage-custom-color/more.svg/" + Style.ncTextColor
+            icon.source: "image://svgimage-custom-color/more.svg/" + Style.ncTextColor
 
             visible: !root.isPlaceholderLinkShare && !root.isSecureFileDropPlaceholderLinkShare && !root.isInternalLinkShare
             enabled: visible
index 17bd184bccf7e78476f072ed34d547ee53c57aa9..9b1d49ad0fbdd9470b499f73b18c3a37bec62fbd 100644 (file)
@@ -230,7 +230,7 @@ Page {
                 Layout.preferredHeight: width
                 Layout.rightMargin: root.padding
 
-                imageSource: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor
+                icon.source: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor
                 bgColor: Style.lightHover
                 bgNormalOpacity: 0
                 toolTipText: qsTr("Dismiss")
@@ -806,7 +806,7 @@ Page {
             CustomButton {
                 height: Style.standardPrimaryButtonHeight
 
-                imageSource: "image://svgimage-custom-color/close.svg/" + Style.errorBoxBackgroundColor
+                icon.source: "image://svgimage-custom-color/close.svg/" + Style.errorBoxBackgroundColor
                 imageSourceHover: "image://svgimage-custom-color/close.svg/" + Style.ncHeaderTextColor
                 text: qsTr("Unshare")
                 textColor: Style.errorBoxBackgroundColor
@@ -823,7 +823,7 @@ Page {
             CustomButton {
                 height: Style.standardPrimaryButtonHeight
 
-                imageSource: "image://svgimage-custom-color/add.svg/" + Style.ncBlue
+                icon.source: "image://svgimage-custom-color/add.svg/" + Style.ncBlue
                 imageSourceHover: "image://svgimage-custom-color/add.svg/" + Style.ncHeaderTextColor
                 text: qsTr("Add another link")
                 textColor: Style.ncBlue
@@ -867,7 +867,7 @@ Page {
 
             height: Style.standardPrimaryButtonHeight
 
-            imageSource: "image://svgimage-custom-color/copy.svg/" + Style.ncHeaderTextColor
+            icon.source: "image://svgimage-custom-color/copy.svg/" + Style.ncHeaderTextColor
             text: shareLinkCopied ? qsTr("Share link copied!") : qsTr("Copy share link")
             textColor: Style.ncHeaderTextColor
             contentsFont.bold: true
index 250da5ab99107df1ae4a1297fb102f2bdbbf2da9..65f5f87d4363af4a681188db82083145eda4c4ae 100644 (file)
@@ -10,7 +10,6 @@ AbstractButton {
 
     property bool primaryButton: false
 
-    property string imageSource: ""
     property string imageSourceHover: ""
 
     property color adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor
@@ -69,7 +68,7 @@ AbstractButton {
             anchors.fill: parent
             hovered: root.hovered
             imageSourceHover: root.imageSourceHover
-            imageSource: root.imageSource
+            imageSource: root.icon.source
             text: root.text
             textColor: root.textColor
             textColorHovered: root.textColorHovered
index fe97817021cf3f91316950bfa1209de7e7e75481..dba45e46831af6189a2ca40af95da26db7ab4b26 100644 (file)
@@ -44,7 +44,7 @@ RowLayout {
 
             adjustedHeaderColor: Style.adjustedCurrentUserHeaderColor
 
-            imageSource: model.modelData.imageSource ? model.modelData.imageSource + Style.adjustedCurrentUserHeaderColor : ""
+            icon.source: model.modelData.imageSource ? model.modelData.imageSource + Style.adjustedCurrentUserHeaderColor : ""
             imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + Style.currentUserHeaderTextColor : ""
 
             onClicked: isTalkReplyButton ? root.showReplyField() : root.triggerAction(model.index)
index ecd4ac64d5991f5ca8794c72584e7f5facbb5fd3..643cd05f0c91cc8137455804242e0058d831f342 100644 (file)
@@ -185,7 +185,7 @@ RowLayout {
 
         visible: root.showDismissButton && !fileDetailsButton.visible
 
-        imageSource: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor
+        icon.source: "image://svgimage-custom-color/clear.svg" + "/" + Style.ncTextColor
         imageSourceHover: "image://svgimage-custom-color/clear.svg" + "/" + UserModel.currentUser.headerTextColor
 
         toolTipText: qsTr("Dismiss")
@@ -201,7 +201,7 @@ RowLayout {
         Layout.preferredWidth: Style.trayListItemIconSize
         Layout.preferredHeight: Style.trayListItemIconSize
 
-        imageSource: "image://svgimage-custom-color/more.svg" + "/" + Style.adjustedCurrentUserHeaderColor
+        icon.source: "image://svgimage-custom-color/more.svg" + "/" + Style.adjustedCurrentUserHeaderColor
         imageSourceHover: "image://svgimage-custom-color/more.svg" + "/" + Style.currentUserHeaderTextColor
         toolTipText: qsTr("Open file details")
         bgColor: Style.currentUserHeaderColor
index e9402c11cd680c050b3b546f5ba3adb7846234f0..7e57ee7e64cecd23c19e41bb1aeaaf18029e78c5 100644 (file)
@@ -225,7 +225,7 @@ Window {
 
                         textColor: Style.ncHeaderTextColor
 
-                        imageSource: root.talkIcon + Style.ncHeaderTextColor
+                        icon.source: root.talkIcon + Style.ncHeaderTextColor
                         imageSourceHover: root.talkIcon + Style.ncHeaderTextColor
 
                         Layout.fillWidth: true
@@ -252,7 +252,7 @@ Window {
 
                     textColor: Style.ncHeaderTextColor
 
-                    imageSource: root.deleteIcon + "white"
+                    icon.source: root.deleteIcon + "white"
                     imageSourceHover: root.deleteIcon + "white"
 
                     Layout.fillWidth: true
index 69050b541bc71c8a647d6092ff2dc9c904da417a..89ba8802f286651abff5a2cd9acb7e8f0226e7f3 100644 (file)
@@ -20,8 +20,7 @@ import Style 1.0
 Button {
     id: root
 
-    property string imageSource: ""
-    property string imageSourceHover: imageSource
+    property string imageSourceHover: root.icon.source
     property var iconItem: icon
 
     property string toolTipText: ""
@@ -55,7 +54,7 @@ Button {
         id: contents
         hovered: root.hovered
         imageSourceHover: root.imageSourceHover
-        imageSource: root.imageSource
+        imageSource: root.icon.source
         text: root.text
         textColor: root.textColor
         textColorHovered: root.textColorHovered