1
0

qml: make request types clickable, some fixes

This commit is contained in:
Sander van Grieken
2022-09-30 09:27:55 +02:00
parent ae15c0527b
commit fd791f4fb1
5 changed files with 28 additions and 7 deletions

View File

@@ -227,7 +227,7 @@ ElDialog {
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true
text: invoice.lnprops.pubkey
text: invoice.lnprops ? invoice.lnprops.pubkey : ''
font.family: FixedFont
wrapMode: Text.Wrap
}
@@ -241,7 +241,7 @@ ElDialog {
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true
text: invoice.lnprops.t
text: invoice.lnprops ? invoice.lnprops.t : ''
font.family: FixedFont
wrapMode: Text.Wrap
}
@@ -255,7 +255,7 @@ ElDialog {
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true
text: invoice.lnprops.r
text: invoice.lnprops ? invoice.lnprops.r : ''
font.family: FixedFont
wrapMode: Text.Wrap
}

View File

@@ -15,8 +15,7 @@ ElDialog {
width: parent.width * 2/3
height: parent.height * 1/3
x: (parent.width - width) / 2
y: (parent.height - height) / 2
anchors.centerIn: parent
modal: true
parent: Overlay.overlay
@@ -121,7 +120,7 @@ ElDialog {
TextField {
id: pin
Layout.preferredWidth: root.width *2/3
Layout.preferredWidth: fontMetrics.advanceWidth(passwordCharacter) * 6
Layout.alignment: Qt.AlignHCenter
font.pixelSize: constants.fontSizeXXLarge
maximumLength: 6
@@ -146,4 +145,9 @@ ElDialog {
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
}
FontMetrics {
id: fontMetrics
font: pin.font
}
}

View File

@@ -25,6 +25,8 @@ ElDialog {
color: "#aa000000"
}
implicitWidth: parent.width
GridLayout {
id: form
width: parent.width

View File

@@ -120,6 +120,11 @@ ElDialog {
id: bolt11label
text: qsTr('Lightning')
color: _bolt11 ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _bolt11
onClicked: rootLayout.state = 'bolt11'
}
}
Rectangle {
Layout.preferredWidth: constants.paddingXXSmall
@@ -131,6 +136,11 @@ ElDialog {
id: bip21label
text: qsTr('URI')
color: _bip21uri ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _bip21uri
onClicked: rootLayout.state = 'bip21uri'
}
}
Rectangle {
Layout.preferredWidth: constants.paddingXXSmall
@@ -142,6 +152,11 @@ ElDialog {
id: addresslabel
text: qsTr('Address')
color: _address ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _address
onClicked: rootLayout.state = 'address'
}
}
}

View File

@@ -534,7 +534,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
def createDefaultRequest(self, ignore_gap: bool = False):
try:
default_expiry = self.wallet.config.get('request_expiry', PR_DEFAULT_EXPIRATION_WHEN_CREATING)
if self.wallet.lnworker.channels:
if self.wallet.lnworker and self.wallet.lnworker.channels:
addr = None
if self.wallet.config.get('bolt11_fallback', True):
addr = self.wallet.get_unused_address()