history: enable set_tx_note

This commit is contained in:
mmbyday 2018-12-24 16:12:14 -08:00
parent 002c800ee8
commit d5a69cb638
3 changed files with 78 additions and 39 deletions

View file

@ -374,14 +374,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){
@ -391,9 +392,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,48 +44,81 @@ 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
Text { ColumnLayout {
id: label1 Layout.fillWidth: true
anchors.left: parent.left spacing: 2 * scaleRatio
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: labelHeader
color: MoneroComponents.Style.dimmedFontColor
}
Text { RowLayout {
id: label2 Layout.fillWidth: true
anchors.left: parent.left
anchors.top: label1.bottom
font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: labelValue
color: MoneroComponents.Style.dimmedFontColor
}
// hover effect / copy value Text {
MouseArea { id: label1
visible: copyValue !== "" font.family: MoneroComponents.Style.fontRegular.name
hoverEnabled: true font.pixelSize: 14 * scaleRatio
anchors.fill: parent text: labelHeader
cursorShape: Qt.PointingHandCursor color: MoneroComponents.Style.dimmedFontColor
onEntered: { }
label1.color = MoneroComponents.Style.defaultFontColor;
label2.color = MoneroComponents.Style.defaultFontColor; 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 Text {
label2.color = MoneroComponents.Style.dimmedFontColor; id: label2
} font.family: MoneroComponents.Style.fontRegular.name
onClicked: { font.pixelSize: 14 * scaleRatio
if(copyValue){ text: labelValue
console.log("Copied to clipboard"); color: MoneroComponents.Style.dimmedFontColor
clipboard.setText(copyValue);
appWindow.showStatusMessage(qsTr("Copied to clipboard"),3) 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()
}
} }

View file

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