1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
|
// Copyright (c) 2014-2024, The Monzero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import FontAwesome 1.0
import "../components" as MonzeroComponents
import "../components/effects/" as MonzeroEffects
import moneroComponents.Clipboard 1.0
import moneroComponents.Wallet 1.0
import moneroComponents.WalletManager 1.0
import moneroComponents.TransactionHistory 1.0
import moneroComponents.TransactionHistoryModel 1.0
import moneroComponents.Subaddress 1.0
import moneroComponents.SubaddressModel 1.0
import "../js/TxUtils.js" as TxUtils
Rectangle {
id: pageReceive
color: "transparent"
property var model
property alias receiveHeight: mainLayout.height
property var state: "Address"
function renameSubaddressLabel(_index){
inputDialog.labelText = qsTr("Set the label of the selected address:") + translationManager.emptyString;
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, _index, inputDialog.inputText);
}
inputDialog.onRejectedCallback = null;
inputDialog.open(appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, _index))
}
function generateQRCodeString() {
if (pageReceive.state == "PaymentRequest") {
return walletManager.make_uri(appWindow.current_address,
walletManager.amountFromString(amountToReceiveXMZ.text),
txDescriptionInput.text, receiverNameInput.text);
} else {
return walletManager.make_uri(appWindow.current_address);
}
}
Clipboard { id: clipboard }
/* main layout */
ColumnLayout {
id: mainLayout
anchors.margins: 20
anchors.topMargin: 40
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
spacing: 15
ColumnLayout {
id: selectedAddressDetailsColumn
Layout.alignment: Qt.AlignHCenter
spacing: 0
property int qrSize: 220
MonzeroComponents.Navbar {
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: 10
MonzeroComponents.NavbarItem {
active: state == "Address"
text: qsTr("Address") + translationManager.emptyString
onSelected: state = "Address"
}
MonzeroComponents.NavbarItem {
active: state == "PaymentRequest"
text: qsTr("Payment request") + translationManager.emptyString
onSelected: {
state = "PaymentRequest";
qrCodeTextMouseArea.hoverEnabled = true;
}
}
}
Rectangle {
id: qrContainer
color: MonzeroComponents.Style.blackTheme ? "white" : "transparent"
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: parent.qrSize
Layout.preferredHeight: width
radius: 4
Image {
id: qrCode
anchors.fill: parent
anchors.margins: 1
smooth: false
fillMode: Image.PreserveAspectFit
source: "image://qrcode/" + generateQRCodeString();
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onEntered: qrCodeTooltip.tooltipPopup.open()
onExited: qrCodeTooltip.tooltipPopup.close()
onClicked: {
if (mouse.button == Qt.LeftButton){
walletManager.saveQrCodeToClipboard(generateQRCodeString());
appWindow.showStatusMessage(qsTr("QR code copied to clipboard") + translationManager.emptyString, 3);
} else if (mouse.button == Qt.RightButton){
qrMenu.x = this.mouseX;
qrMenu.y = this.mouseY;
qrMenu.open()
}
}
}
}
Menu {
id: qrMenu
title: "QrCode"
currentIndex: menuItem1.hovered ? 0 : menuItem2.hovered ? 1 : -1
MenuItem {
id: menuItem1
text: qsTr("Copy to clipboard") + translationManager.emptyString;
onTriggered: walletManager.saveQrCodeToClipboard(generateQRCodeString())
}
MenuItem {
id: menuItem2
text: qsTr("Save as Image") + translationManager.emptyString;
onTriggered: qrFileDialog.open()
}
}
MonzeroComponents.Tooltip {
id: qrCodeTooltip
text: qsTr("Left click: copy QR code to clipboard") + "<br>" + qsTr("Right click: save QR code as image file") + translationManager.emptyString
}
}
MonzeroComponents.TextPlain {
id: qrCodeText
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 6
Layout.maximumWidth: 285
Layout.minimumHeight: 75
verticalAlignment: Text.AlignVCenter
visible: paymentRequestGridLayout.visible
font.pixelSize: 12
color: qrCodeTextMouseArea.containsMouse ? MonzeroComponents.Style.orange : MonzeroComponents.Style.defaultFontColor
text: generateQRCodeString();
wrapMode: Text.WrapAnywhere
tooltip: qsTr("Copy payment request to clipboard") + translationManager.emptyString
themeTransition: false
MouseArea {
id: qrCodeTextMouseArea
hoverEnabled: false //true when Payment request navbar button is clicked (fix bug displaying tooltip when navbar button is clicked)
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: parent.tooltipPopup.open()
onExited: parent.tooltipPopup.close()
onClicked: {
clipboard.setText(qrCodeText.text);
appWindow.showStatusMessage(qsTr("Payment request copied to clipboard") + translationManager.emptyString, 3);
}
}
}
GridLayout {
id: paymentRequestGridLayout
columns: 3
rows: 4
visible: pageReceive.state == "PaymentRequest"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 6
Layout.preferredWidth: 285
Layout.maximumWidth: 285
MonzeroComponents.Label {
id: amountTitleFiat
Layout.bottomMargin: 3
Layout.preferredWidth: 90
visible: persistentSettings.fiatPriceEnabled
fontSize: 14
text: qsTr("Amount") + translationManager.emptyString
}
MonzeroComponents.Input {
id: amountToReceiveFiat
Layout.preferredWidth: 165
Layout.maximumWidth: 165
visible: persistentSettings.fiatPriceEnabled
topPadding: 5
leftPadding: 5
font.family: MonzeroComponents.Style.fontMonoRegular.name
font.pixelSize: 14
font.bold: false
horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
selectByMouse: true
color: MonzeroComponents.Style.defaultFontColor
placeholderText: "0.00"
background: Rectangle {
color: MonzeroComponents.Style.blackTheme ? "transparent" : "white"
radius: 3
border.color: parent.activeFocus ? MonzeroComponents.Style.inputBorderColorActive : MonzeroComponents.Style.inputBorderColorInActive
border.width: 1
}
onTextEdited: {
text = text.trim().replace(",", ".");
const match = text.match(/^0+(\d.*)/);
if (match) {
const cursorPosition = cursorPosition;
text = match[1];
cursorPosition = Math.max(cursorPosition, 1) - 1;
} else if(text.indexOf('.') === 0){
text = '0' + text;
if (text.length > 2) {
cursorPosition = 1;
}
}
if (amountToReceiveFiat.text == "") {
amountToReceiveXMZ.text = "";
} else {
amountToReceiveXMZ.text = fiatApiConvertToXMZ(amountToReceiveFiat.text);
}
}
validator: RegExpValidator {
regExp: /^\s*(\d{1,8})?([\.,]\d{1,2})?\s*$/
}
}
MonzeroComponents.Label {
Layout.bottomMargin: 3
visible: persistentSettings.fiatPriceEnabled
fontSize: 14
text: appWindow.fiatApiCurrencySymbol();
}
MonzeroComponents.Label {
id: amountTitleXMZ
Layout.bottomMargin: 3
Layout.preferredWidth: 90
fontSize: 14
text: persistentSettings.fiatPriceEnabled ? "" : qsTr("Amount") + translationManager.emptyString
}
MonzeroComponents.Input {
id: amountToReceiveXMZ
Layout.preferredWidth: 165
Layout.maximumWidth: 165
topPadding: 5
leftPadding: 5
font.family: MonzeroComponents.Style.fontMonoRegular.name
font.pixelSize: 14
font.bold: false
horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
selectByMouse: true
color: MonzeroComponents.Style.defaultFontColor
placeholderText: "0.000000000000"
background: Rectangle {
color: MonzeroComponents.Style.blackTheme ? "transparent" : "white"
radius: 3
border.color: parent.activeFocus ? MonzeroComponents.Style.inputBorderColorActive : MonzeroComponents.Style.inputBorderColorInActive
border.width: 1
}
onTextEdited: {
text = text.trim().replace(",", ".");
const match = text.match(/^0+(\d.*)/);
if (match) {
const cursorPosition = cursorPosition;
text = match[1];
cursorPosition = Math.max(cursorPosition, 1) - 1;
} else if(text.indexOf('.') === 0){
text = '0' + text;
if (text.length > 2) {
cursorPosition = 1;
}
}
if (amountToReceiveXMZ.text == "") {
amountToReceiveFiat.text = "";
} else {
amountToReceiveFiat.text = fiatApiConvertToFiat(amountToReceiveXMZ.text);
}
}
validator: RegExpValidator {
regExp: /^\s*(\d{1,8})?([\.,]\d{1,12})?\s*$/
}
}
MonzeroComponents.Label {
Layout.bottomMargin: 3
fontSize: 14
text: "XMZ"
}
MonzeroComponents.Label {
id: txDescription
Layout.bottomMargin: 3
Layout.preferredWidth: 90
fontSize: 14
text: qsTr("Description") + translationManager.emptyString
tooltip: qsTr("What is being payed for (a product, service, donation) (optional)") + translationManager.emptyString
tooltipIconVisible: true
}
MonzeroComponents.Input {
id: txDescriptionInput
Layout.preferredWidth: 165
Layout.maximumWidth: 165
maximumLength: 800
topPadding: 7
leftPadding: 7
font.pixelSize: 14
font.bold: false
horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
selectByMouse: true
color: MonzeroComponents.Style.defaultFontColor
placeholderText: qsTr("Visible to the sender") + translationManager.emptyString
background: Rectangle {
color: MonzeroComponents.Style.blackTheme ? "transparent" : "white"
radius: 3
border.color: parent.activeFocus ? MonzeroComponents.Style.inputBorderColorActive : MonzeroComponents.Style.inputBorderColorInActive
border.width: 1
}
}
MonzeroComponents.Label {
Layout.bottomMargin: 3
fontSize: 14
text: ""
}
MonzeroComponents.Label {
id: receiverNameLabel
Layout.bottomMargin: 3
Layout.preferredWidth: 90
fontSize: 14
text: qsTr("Your name") + translationManager.emptyString
tooltip: qsTr("Your name, company or website (optional)") + translationManager.emptyString
tooltipIconVisible: true
}
MonzeroComponents.Input {
id: receiverNameInput
Layout.preferredWidth: 165
Layout.maximumWidth: 165
topPadding: 7
leftPadding: 7
font.pixelSize: 14
font.bold: false
horizontalAlignment: TextInput.AlignLeft
verticalAlignment: TextInput.AlignVCenter
selectByMouse: true
color: MonzeroComponents.Style.defaultFontColor
placeholderText: qsTr("Visible to the sender") + translationManager.emptyString
maximumLength: 100
background: Rectangle {
color: MonzeroComponents.Style.blackTheme ? "transparent" : "white"
radius: 3
border.color: parent.activeFocus ? MonzeroComponents.Style.inputBorderColorActive : MonzeroComponents.Style.inputBorderColorInActive
border.width: 1
}
}
MonzeroComponents.Label {
Layout.bottomMargin: 3
fontSize: 14
text: ""
}
}
MonzeroComponents.TextPlain {
id: selectedaddressIndex
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 220
Layout.maximumWidth: 220
Layout.topMargin: 15
visible: pageReceive.state == "Address"
horizontalAlignment: Text.AlignHCenter
text: qsTr("Address #") + subaddressListView.currentIndex + translationManager.emptyString
wrapMode: Text.WordWrap
font.family: MonzeroComponents.Style.fontRegular.name
font.pixelSize: 17
textFormat: Text.RichText
color: MonzeroComponents.Style.defaultFontColor
themeTransition: false
}
MonzeroComponents.TextPlain {
id: selectedAddressDrescription
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 220
Layout.maximumWidth: 220
Layout.topMargin: 10
visible: pageReceive.state == "Address"
horizontalAlignment: Text.AlignHCenter
text: "(" + qsTr("no label") + ")" + translationManager.emptyString
wrapMode: Text.WordWrap
font.family: MonzeroComponents.Style.fontRegular.name
font.pixelSize: 17
textFormat: Text.RichText
color: selectedAddressDrescriptionMouseArea.containsMouse ? MonzeroComponents.Style.orange : MonzeroComponents.Style.dimmedFontColor
themeTransition: false
tooltip: subaddressListView.currentIndex > 0 ? qsTr("Edit address label") : "" + translationManager.emptyString
MouseArea {
id: selectedAddressDrescriptionMouseArea
visible: subaddressListView.currentIndex > 0
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: parent.tooltip ? parent.tooltipPopup.open() : ""
onExited: parent.tooltip ? parent.tooltipPopup.close() : ""
onClicked: {
renameSubaddressLabel(appWindow.current_subaddress_table_index);
}
}
}
MonzeroComponents.TextPlain {
id: selectedAddress
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 300
Layout.topMargin: 11
visible: pageReceive.state == "Address"
text: appWindow.current_address ? appWindow.current_address : ""
horizontalAlignment: TextInput.AlignHCenter
wrapMode: Text.Wrap
textFormat: Text.RichText
color: selectedAddressMouseArea.containsMouse ? MonzeroComponents.Style.orange : MonzeroComponents.Style.defaultFontColor
font.pixelSize: 15
font.family: MonzeroComponents.Style.fontRegular.name
themeTransition: false
tooltip: qsTr("Copy address to clipboard") + translationManager.emptyString
MouseArea {
id: selectedAddressMouseArea
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: parent.tooltip ? parent.tooltipPopup.open() : ""
onExited: parent.tooltip ? parent.tooltipPopup.close() : ""
onClicked: {
clipboard.setText(appWindow.current_address);
appWindow.showStatusMessage(qsTr("Address copied to clipboard") + translationManager.emptyString, 3);
}
}
}
MonzeroComponents.StandardButton {
Layout.preferredWidth: 220
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 18
small: true
text: qsTr("Show on device") + translationManager.emptyString
fontSize: 14
visible: appWindow.currentWallet ? appWindow.currentWallet.isHwBacked() : false
onClicked: {
appWindow.currentWallet.deviceShowAddressAsync(
appWindow.currentWallet.currentSubaddressAccount,
appWindow.current_subaddress_table_index,
'');
}
}
}
ColumnLayout {
id: addressRow
spacing: 0
RowLayout {
spacing: 0
MonzeroComponents.LabelSubheader {
Layout.fillWidth: true
fontSize: 24
textFormat: Text.RichText
text: qsTr("Addresses") + translationManager.emptyString
}
MonzeroComponents.StandardButton {
id: createAddressButton
small: true
text: qsTr("Create new address") + translationManager.emptyString
fontSize: 13
onClicked: {
inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
current_subaddress_table_index = appWindow.currentWallet.numSubaddresses(appWindow.currentWallet.currentSubaddressAccount) - 1
subaddressListView.currentIndex = current_subaddress_table_index
}
inputDialog.onRejectedCallback = null;
inputDialog.open()
}
Rectangle {
anchors.top: createAddressButton.bottom
anchors.topMargin: 8
anchors.left: createAddressButton.left
anchors.right: createAddressButton.right
height: 2
color: MonzeroComponents.Style.appWindowBorderColor
MonzeroEffects.ColorTransition {
targetObj: parent
blackColor: MonzeroComponents.Style._b_appWindowBorderColor
whiteColor: MonzeroComponents.Style._w_appWindowBorderColor
}
}
}
}
ColumnLayout {
id: subaddressListRow
property int subaddressListItemHeight: 50
Layout.topMargin: 6
Layout.fillWidth: true
Layout.minimumWidth: 240
Layout.preferredHeight: subaddressListItemHeight * subaddressListView.count
visible: subaddressListView.count >= 1
ListView {
id: subaddressListView
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
boundsBehavior: ListView.StopAtBounds
interactive: false
delegate: Rectangle {
id: tableItem2
height: subaddressListRow.subaddressListItemHeight
width: parent ? parent.width : undefined
Layout.fillWidth: true
color: itemMouseArea.containsMouse || index === appWindow.current_subaddress_table_index ? MonzeroComponents.Style.titleBarButtonHoverColor : "transparent"
Rectangle {
visible: index === appWindow.current_subaddress_table_index
Layout.fillHeight: true
anchors.top: parent.top
anchors.bottom: parent.bottom
property int currentAccountIndex: currentWallet ? currentWallet.currentSubaddressAccount : 0
color: MonzeroComponents.Style.accountColors[currentAccountIndex % MonzeroComponents.Style.accountColors.length]
width: 2
}
Rectangle{
anchors.right: parent.right
anchors.left: parent.left
anchors.top: parent.top
height: 1
color: MonzeroComponents.Style.appWindowBorderColor
visible: index !== 0
MonzeroEffects.ColorTransition {
targetObj: parent
blackColor: MonzeroComponents.Style._b_appWindowBorderColor
whiteColor: MonzeroComponents.Style._w_appWindowBorderColor
}
}
Rectangle {
anchors.fill: parent
anchors.topMargin: 5
anchors.rightMargin: 90
color: "transparent"
MonzeroComponents.Label {
id: idLabel
color: index === appWindow.current_subaddress_table_index ? MonzeroComponents.Style.defaultFontColor : "#757575"
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 6
fontSize: 16
text: "#" + index
themeTransition: false
}
MonzeroComponents.Label {
id: nameLabel
color: index === appWindow.current_subaddress_table_index ? MonzeroComponents.Style.defaultFontColor : MonzeroComponents.Style.dimmedFontColor
anchors.verticalCenter: parent.verticalCenter
anchors.left: idLabel.right
anchors.leftMargin: 6
fontSize: 16
text: label
elide: Text.ElideRight
textWidth: addressLabel.x - nameLabel.x - 1
themeTransition: false
}
MonzeroComponents.Label {
id: addressLabel
color: MonzeroComponents.Style.defaultFontColor
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.right
anchors.leftMargin: -addressLabel.width - 5
fontSize: 16
fontFamily: MonzeroComponents.Style.fontMonoRegular.name;
text: TxUtils.addressTruncatePretty(address, mainLayout.width < 520 ? 1 : (mainLayout.width < 650 ? 2 : 3))
themeTransition: false
}
MouseArea {
id: itemMouseArea
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
onClicked: subaddressListView.currentIndex = index;
}
}
RowLayout {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 6
height: 21
spacing: 10
MonzeroComponents.IconButton {
fontAwesomeFallbackIcon: FontAwesome.searchPlus
fontAwesomeFallbackSize: 22
color: MonzeroComponents.Style.defaultFontColor
fontAwesomeFallbackOpacity: 0.5
Layout.preferredWidth: 23
Layout.preferredHeight: 21
tooltip: qsTr("See transactions") + translationManager.emptyString
onClicked: doSearchInHistory(address)
}
MonzeroComponents.IconButton {
id: renameButton
image: "qrc:///images/edit.svg"
fontAwesomeFallbackIcon: FontAwesome.edit
fontAwesomeFallbackSize: 22
color: MonzeroComponents.Style.defaultFontColor
opacity: isOpenGL ? 0.5 : 1
fontAwesomeFallbackOpacity: 0.5
Layout.preferredWidth: 23
Layout.preferredHeight: 21
visible: index !== 0
tooltip: qsTr("Edit address label") + translationManager.emptyString
onClicked: {
renameSubaddressLabel(index);
}
}
MonzeroComponents.IconButton {
id: copyButton
image: "qrc:///images/copy.svg"
fontAwesomeFallbackIcon: FontAwesome.clipboard
fontAwesomeFallbackSize: 22
color: MonzeroComponents.Style.defaultFontColor
opacity: isOpenGL ? 0.5 : 1
fontAwesomeFallbackOpacity: 0.5
Layout.preferredWidth: 16
Layout.preferredHeight: 21
tooltip: qsTr("Copy address to clipboard") + translationManager.emptyString
onClicked: {
console.log("Address copied to clipboard");
clipboard.setText(address);
appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3);
}
}
}
}
onCurrentItemChanged: {
// reset global vars
appWindow.current_subaddress_table_index = subaddressListView.currentIndex;
appWindow.current_address = appWindow.currentWallet.address(
appWindow.currentWallet.currentSubaddressAccount,
subaddressListView.currentIndex
);
if (subaddressListView.currentIndex == 0) {
selectedAddressDrescription.text = qsTr("Primary address") + translationManager.emptyString;
} else {
var selectedAddressLabel = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, appWindow.current_subaddress_table_index);
if (selectedAddressLabel == "") {
selectedAddressDrescription.text = "(" + qsTr("no label") + ")" + translationManager.emptyString
} else {
selectedAddressDrescription.text = selectedAddressLabel
}
}
}
}
}
Rectangle {
color: MonzeroComponents.Style.appWindowBorderColor
Layout.fillWidth: true
height: 1
MonzeroEffects.ColorTransition {
targetObj: parent
blackColor: MonzeroComponents.Style._b_appWindowBorderColor
whiteColor: MonzeroComponents.Style._w_appWindowBorderColor
}
}
}
MessageDialog {
id: receivePageDialog
standardButtons: StandardButton.Ok
}
FileDialog {
id: qrFileDialog
title: qsTr("Please choose a name") + translationManager.emptyString
folder: shortcuts.pictures
selectExisting: false
nameFilters: ["Image (*.png)"]
onAccepted: {
if(!walletManager.saveQrCode(generateQRCodeString(), walletManager.urlToLocalPath(fileUrl))) {
console.log("Failed to save QrCode to file " + walletManager.urlToLocalPath(fileUrl) )
receivePageDialog.title = qsTr("Save QrCode") + translationManager.emptyString;
receivePageDialog.text = qsTr("Failed to save QrCode to ") + walletManager.urlToLocalPath(fileUrl) + translationManager.emptyString;
receivePageDialog.icon = StandardIcon.Error
receivePageDialog.open()
} else {
appWindow.showStatusMessage(qsTr("QR code saved to ") + walletManager.urlToLocalPath(fileUrl) + translationManager.emptyString, 3);
}
}
}
}
function onPageCompleted() {
console.log("Receive page loaded");
pageReceive.clearFields();
subaddressListView.model = appWindow.currentWallet.subaddressModel;
if (appWindow.currentWallet) {
appWindow.current_address = appWindow.currentWallet.address(appWindow.currentWallet.currentSubaddressAccount, 0)
appWindow.currentWallet.subaddress.refresh(appWindow.currentWallet.currentSubaddressAccount)
if (subaddressListView.currentIndex == -1) {
subaddressListView.currentIndex = 0;
}
}
}
function clearFields() {
amountToReceiveFiat.text = "";
amountToReceiveXMZ.text = "";
txDescriptionInput.text = "";
receiverNameInput.text = "";
}
function onPageClosed() {
}
}
|