qml: add config option WALLET_FREEZE_REUSED_ADDRESS_UTXOS
This commit is contained in:
@@ -271,6 +271,23 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: freezeReusedAddressUtxos
|
||||
onCheckedChanged: {
|
||||
if (activeFocus)
|
||||
Config.freezeReusedAddressUtxos = checked
|
||||
}
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: Config.shortDescFor('WALLET_FREEZE_REUSED_ADDRESS_UTXOS')
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
|
||||
PrefsHeading {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr('Lightning')
|
||||
@@ -441,6 +458,7 @@ Pane {
|
||||
rateSources.currentIndex = rateSources.indexOfValue(Daemon.fx.rateSource)
|
||||
fiatEnable.checked = Daemon.fx.enabled
|
||||
spendUnconfirmed.checked = Config.spendUnconfirmed
|
||||
freezeReusedAddressUtxos.checked = Config.freezeReusedAddressUtxos
|
||||
useTrampolineRouting.checked = !Config.useGossip
|
||||
enableDebugLogs.checked = Config.enableDebugLogs
|
||||
alwaysAllowScreenshots.checked = Config.alwaysAllowScreenshots
|
||||
|
||||
@@ -5,6 +5,7 @@ from PyQt6.QtCore import Qt, QAbstractListModel, QModelIndex
|
||||
|
||||
from electrum.logging import get_logger
|
||||
from electrum.util import Satoshis
|
||||
from .qeconfig import QEConfig
|
||||
|
||||
from .qetypes import QEAmount
|
||||
from .util import qt_event_listener, QtEventListener
|
||||
@@ -122,6 +123,8 @@ class QEAddressCoinListModel(QAbstractListModel, QtEventListener):
|
||||
self.register_callbacks()
|
||||
self.destroyed.connect(lambda: self.on_destroy())
|
||||
|
||||
QEConfig.instance.freezeReusedAddressUtxosChanged.connect(lambda: self.setDirty())
|
||||
|
||||
self._dirty = True
|
||||
self.initModel()
|
||||
|
||||
|
||||
@@ -18,10 +18,14 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class QEConfig(AuthMixin, QObject):
|
||||
instance = None # type: Optional[QEConfig]
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
def __init__(self, config: 'SimpleConfig', parent=None):
|
||||
super().__init__(parent)
|
||||
if QEConfig.instance:
|
||||
raise RuntimeError('There should only be one QEConfig instance')
|
||||
QEConfig.instance = self
|
||||
self.config = config
|
||||
|
||||
@pyqtSlot(str, result=str)
|
||||
@@ -120,6 +124,16 @@ class QEConfig(AuthMixin, QObject):
|
||||
self.config.WALLET_SPEND_CONFIRMED_ONLY = not checked
|
||||
self.spendUnconfirmedChanged.emit()
|
||||
|
||||
freezeReusedAddressUtxosChanged = pyqtSignal()
|
||||
@pyqtProperty(bool, notify=freezeReusedAddressUtxosChanged)
|
||||
def freezeReusedAddressUtxos(self):
|
||||
return self.config.WALLET_FREEZE_REUSED_ADDRESS_UTXOS
|
||||
|
||||
@freezeReusedAddressUtxos.setter
|
||||
def freezeReusedAddressUtxos(self, checked):
|
||||
self.config.WALLET_FREEZE_REUSED_ADDRESS_UTXOS = checked
|
||||
self.freezeReusedAddressUtxosChanged.emit()
|
||||
|
||||
requestExpiryChanged = pyqtSignal()
|
||||
@pyqtProperty(int, notify=requestExpiryChanged)
|
||||
def requestExpiry(self):
|
||||
|
||||
Reference in New Issue
Block a user