From 88655439a017ea74041d022a9f23a919d27f51e2 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 17 Aug 2014 13:49:46 +0200 Subject: Copy to clipboard hax --- ethereal/assets/qml/views/chain.qml | 7 +++++++ ethereal/assets/qml/views/info.qml | 41 +++++++++++++++++++++++++++++++++++++ ethereal/assets/qml/wallet.qml | 11 ++++++++++ 3 files changed, 59 insertions(+) (limited to 'ethereal/assets/qml') diff --git a/ethereal/assets/qml/views/chain.qml b/ethereal/assets/qml/views/chain.qml index 270018eb2..9fbc02954 100644 --- a/ethereal/assets/qml/views/chain.qml +++ b/ethereal/assets/qml/views/chain.qml @@ -73,6 +73,13 @@ Rectangle { MenuSeparator{} + MenuItem { + text: "Copy" + onTriggered: { + copyToClipboard(blockModel.get(this.row).hash) + } + } + MenuItem { text: "Dump State" onTriggered: { diff --git a/ethereal/assets/qml/views/info.qml b/ethereal/assets/qml/views/info.qml index 3335a306a..60b6a62ec 100644 --- a/ethereal/assets/qml/views/info.qml +++ b/ethereal/assets/qml/views/info.qml @@ -57,6 +57,47 @@ Rectangle { TableViewColumn{ role: "address"; title: "address"; width: 300} model: addressModel + itemDelegate: Item { + Text { + anchors { + left: parent.left + right: parent.right + leftMargin: 10 + verticalCenter: parent.verticalCenter + } + color: styleData.textColor + elide: styleData.elideMode + text: styleData.value + font.pixelSize: 11 + MouseArea { + acceptedButtons: Qt.LeftButton | Qt.RightButton + propagateComposedEvents: true + anchors.fill: parent + onClicked: { + addressView.selection.clear() + addressView.selection.select(styleData.row) + + if(mouse.button == Qt.RightButton) { + contextMenu.row = styleData.row; + contextMenu.popup() + } + } + } + } + + } + + Menu { + id: contextMenu + property var row; + + MenuItem { + text: "Copy" + onTriggered: { + copyToClipboard(addressModel.get(this.row).address) + } + } + } } property var logModel: ListModel { diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 30e1071f7..45514f7c1 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -17,6 +17,17 @@ ApplicationWindow { title: "Ethereal" + TextField { + id: copyElementHax + visible: false + } + + function copyToClipboard(text) { + copyElementHax.text = text + copyElementHax.selectAll() + copyElementHax.copy() + } + // Takes care of loading all default plugins Component.onCompleted: { var historyView = addPlugin("./views/history.qml", {title: "History"}) -- cgit