qml: open invoices list after saving invoice, add invoice to model instead of reloading the whole list
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import QtQuick 2.6
|
import QtQuick 2.12
|
||||||
import QtQuick.Layouts 1.0
|
import QtQuick.Layouts 1.0
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.14
|
||||||
import QtQuick.Controls.Material 2.0
|
import QtQuick.Controls.Material 2.0
|
||||||
@@ -299,6 +299,7 @@ ElDialog {
|
|||||||
visible: invoice_key == ''
|
visible: invoice_key == ''
|
||||||
enabled: invoice.canSave
|
enabled: invoice.canSave
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
app.stack.push(Qt.resolvedUrl('Invoices.qml'))
|
||||||
invoice.save_invoice()
|
invoice.save_invoice()
|
||||||
dialog.close()
|
dialog.close()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,14 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add: Transition {
|
||||||
|
NumberAnimation { properties: 'scale'; from: 0.75; to: 1; duration: 500 }
|
||||||
|
NumberAnimation { properties: 'opacity'; from: 0; to: 1; duration: 500 }
|
||||||
|
}
|
||||||
|
addDisplaced: Transition {
|
||||||
|
SpringAnimation { properties: 'y'; duration: 200; spring: 5; damping: 0.5; mass: 2 }
|
||||||
|
}
|
||||||
|
|
||||||
remove: Transition {
|
remove: Transition {
|
||||||
NumberAnimation { properties: 'scale'; to: 0.75; duration: 300 }
|
NumberAnimation { properties: 'scale'; to: 0.75; duration: 300 }
|
||||||
NumberAnimation { properties: 'opacity'; to: 0; duration: 300 }
|
NumberAnimation { properties: 'opacity'; to: 0; duration: 300 }
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onInvoiceSaved: {
|
onInvoiceSaved: {
|
||||||
Daemon.currentWallet.invoiceModel.init_model()
|
Daemon.currentWallet.invoiceModel.addInvoice(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class QEInvoiceParser(QEInvoice):
|
|||||||
_userinfo = ''
|
_userinfo = ''
|
||||||
|
|
||||||
invoiceChanged = pyqtSignal()
|
invoiceChanged = pyqtSignal()
|
||||||
invoiceSaved = pyqtSignal()
|
invoiceSaved = pyqtSignal([str], arguments=['key'])
|
||||||
|
|
||||||
validationSuccess = pyqtSignal()
|
validationSuccess = pyqtSignal()
|
||||||
validationWarning = pyqtSignal([str,str], arguments=['code', 'message'])
|
validationWarning = pyqtSignal([str,str], arguments=['code', 'message'])
|
||||||
@@ -493,7 +493,7 @@ class QEInvoiceParser(QEInvoice):
|
|||||||
# TODO detect duplicate?
|
# TODO detect duplicate?
|
||||||
self.key = self._effectiveInvoice.get_id()
|
self.key = self._effectiveInvoice.get_id()
|
||||||
self._wallet.wallet.save_invoice(self._effectiveInvoice)
|
self._wallet.wallet.save_invoice(self._effectiveInvoice)
|
||||||
self.invoiceSaved.emit()
|
self.invoiceSaved.emit(self.key)
|
||||||
|
|
||||||
|
|
||||||
class QEUserEnteredPayment(QEInvoice):
|
class QEUserEnteredPayment(QEInvoice):
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ class QEAbstractInvoiceListModel(QAbstractListModel):
|
|||||||
self.invoices.insert(0, item)
|
self.invoices.insert(0, item)
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def addInvoice(self, key):
|
||||||
|
self.add_invoice(self.get_invoice_for_key(key))
|
||||||
|
|
||||||
def delete_invoice(self, key: str):
|
def delete_invoice(self, key: str):
|
||||||
i = 0
|
i = 0
|
||||||
for invoice in self.invoices:
|
for invoice in self.invoices:
|
||||||
|
|||||||
Reference in New Issue
Block a user