diff --git a/components/HistoryTable.qml b/components/HistoryTable.qml index d7eb6046..5138cf28 100644 --- a/components/HistoryTable.qml +++ b/components/HistoryTable.qml @@ -374,14 +374,15 @@ ListView { // right column MoneroComponents.HistoryTableInnerColumn { - visible: currentWallet.getUserNote(hash) anchors.right: parent.right anchors.rightMargin: 80 * scaleRatio width: 220 * scaleRatio height: parent.height color: "transparent" + hashValue: hash + labelHeader: qsTr("Description") + translationManager.emptyString + labelHeaderIconImageSource: "../images/editIcon.png" - labelHeader: qsTr("Description") labelValue: { var note = currentWallet.getUserNote(hash); if(note){ @@ -391,9 +392,10 @@ ListView { return note; } } else { - return ""; + return qsTr("None") + translationManager.emptyString; } } + copyValue: { return currentWallet.getUserNote(hash); } diff --git a/components/HistoryTableInnerColumn.qml b/components/HistoryTableInnerColumn.qml index 566c2466..a6127ce7 100644 --- a/components/HistoryTableInnerColumn.qml +++ b/components/HistoryTableInnerColumn.qml @@ -33,7 +33,7 @@ import moneroComponents.Clipboard 1.0 import moneroComponents.PendingTransaction 1.0 import moneroComponents.Wallet 1.0 -import "../components" as MoneroComponents +import "." as MoneroComponents Rectangle{ @@ -44,48 +44,81 @@ Rectangle{ color: "transparent" property string copyValue: "" + property string hashValue: "" property alias labelHeader: label1.text property alias labelValue: label2.text + property alias labelHeaderIcon: icon + property alias labelHeaderIconImageSource: icon.imageSource - Text { - id: label1 - anchors.left: parent.left - font.family: MoneroComponents.Style.fontRegular.name - font.pixelSize: 14 * scaleRatio - text: labelHeader - color: MoneroComponents.Style.dimmedFontColor - } + ColumnLayout { + Layout.fillWidth: true + spacing: 2 * scaleRatio - Text { - id: label2 - anchors.left: parent.left - anchors.top: label1.bottom - font.family: MoneroComponents.Style.fontRegular.name - font.pixelSize: 14 * scaleRatio - text: labelValue - color: MoneroComponents.Style.dimmedFontColor - } + RowLayout { + Layout.fillWidth: true - // hover effect / copy value - MouseArea { - visible: copyValue !== "" - hoverEnabled: true - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onEntered: { - label1.color = MoneroComponents.Style.defaultFontColor; - label2.color = MoneroComponents.Style.defaultFontColor; + Text { + id: label1 + font.family: MoneroComponents.Style.fontRegular.name + font.pixelSize: 14 * scaleRatio + text: labelHeader + color: MoneroComponents.Style.dimmedFontColor + } + + MoneroComponents.IconButton { + id: icon + visible: imageSource !== "" + Layout.leftMargin: 8 * scaleRatio + width: image.width + height: image.height + + onClicked: { + editDescription(hashValue); + } + } } - onExited: { - label1.color = MoneroComponents.Style.dimmedFontColor - label2.color = MoneroComponents.Style.dimmedFontColor; - } - onClicked: { - if(copyValue){ - console.log("Copied to clipboard"); - clipboard.setText(copyValue); - appWindow.showStatusMessage(qsTr("Copied to clipboard"),3) + + Text { + id: label2 + font.family: MoneroComponents.Style.fontRegular.name + font.pixelSize: 14 * scaleRatio + text: labelValue + color: MoneroComponents.Style.dimmedFontColor + + MouseArea { + hoverEnabled: true + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + + onEntered: { + label1.color = MoneroComponents.Style.defaultFontColor; + label2.color = MoneroComponents.Style.defaultFontColor; + } + + onExited: { + label1.color = MoneroComponents.Style.dimmedFontColor; + label2.color = MoneroComponents.Style.dimmedFontColor; + } + + onClicked: { + if(copyValue){ + console.log("Copied to clipboard"); + clipboard.setText(copyValue); + appWindow.showStatusMessage(qsTr("Copied to clipboard"),3) + } + } } } } + + function editDescription(_hash){ + inputDialog.labelText = qsTr("Set description:") + translationManager.emptyString; + inputDialog.onAcceptedCallback = function() { + appWindow.currentWallet.setUserNote(_hash, inputDialog.inputText); + appWindow.showStatusMessage(qsTr("Updated description."),3); + middlePanel.historyView.update(); + } + inputDialog.onRejectedCallback = null; + inputDialog.open() + } } diff --git a/pages/History.qml b/pages/History.qml index 0f9d61a7..334a6b19 100644 --- a/pages/History.qml +++ b/pages/History.qml @@ -374,4 +374,8 @@ Rectangle { priorityDropdown.currentIndex = 0; priorityDropdown.update(); } + + function update() { + currentWallet.history.refresh(currentWallet.currentSubaddressAccount) + } }