Merge pull request #1861

d5a69cb history: enable set_tx_note (mmbyday)
This commit is contained in:
luigi1111 2019-02-01 00:02:07 -06:00
commit b78968b9d5
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
3 changed files with 78 additions and 39 deletions

View File

@ -376,14 +376,15 @@ ListView {
// right column // right column
MoneroComponents.HistoryTableInnerColumn { MoneroComponents.HistoryTableInnerColumn {
visible: currentWallet.getUserNote(hash)
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 80 * scaleRatio anchors.rightMargin: 80 * scaleRatio
width: 220 * scaleRatio width: 220 * scaleRatio
height: parent.height height: parent.height
color: "transparent" color: "transparent"
hashValue: hash
labelHeader: qsTr("Description") + translationManager.emptyString
labelHeaderIconImageSource: "../images/editIcon.png"
labelHeader: qsTr("Description")
labelValue: { labelValue: {
var note = currentWallet.getUserNote(hash); var note = currentWallet.getUserNote(hash);
if(note){ if(note){
@ -393,9 +394,10 @@ ListView {
return note; return note;
} }
} else { } else {
return ""; return qsTr("None") + translationManager.emptyString;
} }
} }
copyValue: { copyValue: {
return currentWallet.getUserNote(hash); return currentWallet.getUserNote(hash);
} }

View File

@ -33,7 +33,7 @@ import moneroComponents.Clipboard 1.0
import moneroComponents.PendingTransaction 1.0 import moneroComponents.PendingTransaction 1.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import "../components" as MoneroComponents import "." as MoneroComponents
Rectangle{ Rectangle{
@ -44,42 +44,62 @@ Rectangle{
color: "transparent" color: "transparent"
property string copyValue: "" property string copyValue: ""
property string hashValue: ""
property alias labelHeader: label1.text property alias labelHeader: label1.text
property alias labelValue: label2.text property alias labelValue: label2.text
property alias labelHeaderIcon: icon
property alias labelHeaderIconImageSource: icon.imageSource
ColumnLayout {
Layout.fillWidth: true
spacing: 2 * scaleRatio
RowLayout {
Layout.fillWidth: true
Text { Text {
id: label1 id: label1
anchors.left: parent.left
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio font.pixelSize: 14 * scaleRatio
text: labelHeader text: labelHeader
color: MoneroComponents.Style.dimmedFontColor color: MoneroComponents.Style.dimmedFontColor
} }
MoneroComponents.IconButton {
id: icon
visible: imageSource !== ""
Layout.leftMargin: 8 * scaleRatio
width: image.width
height: image.height
onClicked: {
editDescription(hashValue);
}
}
}
Text { Text {
id: label2 id: label2
anchors.left: parent.left
anchors.top: label1.bottom
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio font.pixelSize: 14 * scaleRatio
text: labelValue text: labelValue
color: MoneroComponents.Style.dimmedFontColor color: MoneroComponents.Style.dimmedFontColor
}
// hover effect / copy value
MouseArea { MouseArea {
visible: copyValue !== ""
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: { onEntered: {
label1.color = MoneroComponents.Style.defaultFontColor; label1.color = MoneroComponents.Style.defaultFontColor;
label2.color = MoneroComponents.Style.defaultFontColor; label2.color = MoneroComponents.Style.defaultFontColor;
} }
onExited: { onExited: {
label1.color = MoneroComponents.Style.dimmedFontColor label1.color = MoneroComponents.Style.dimmedFontColor;
label2.color = MoneroComponents.Style.dimmedFontColor; label2.color = MoneroComponents.Style.dimmedFontColor;
} }
onClicked: { onClicked: {
if(copyValue){ if(copyValue){
console.log("Copied to clipboard"); console.log("Copied to clipboard");
@ -89,3 +109,16 @@ Rectangle{
} }
} }
} }
}
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()
}
}

View File

@ -419,4 +419,8 @@ Rectangle {
priorityDropdown.currentIndex = 0; priorityDropdown.currentIndex = 0;
priorityDropdown.update(); priorityDropdown.update();
} }
function update() {
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
}
} }