Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions qml/controls/EllipsisMenuToggleItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Button {
anchors.centerIn: parent
anchors.margins: 10
CoreText {
id: buttonText
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
horizontalAlignment: Text.AlignLeft
Expand Down
22 changes: 12 additions & 10 deletions qml/models/sendrecipientslistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,17 @@ void SendRecipientsListModel::remove()
return;
}
beginRemoveRows(QModelIndex(), m_current, m_current);
delete m_recipients.takeAt(m_current);
endRemoveRows();
Q_EMIT countChanged();

if (m_current > 0) {
int index_to_remove = m_current;
setCurrentIndex(m_current - 1);
delete m_recipients.takeAt(index_to_remove);
} else {
auto removed_recipient = m_recipients.takeAt(m_current);
Q_EMIT currentRecipientChanged();
delete removed_recipient;
}
endRemoveRows();
Q_EMIT countChanged();
}

SendRecipient* SendRecipientsListModel::currentRecipient() const
Expand Down Expand Up @@ -152,6 +154,12 @@ void SendRecipientsListModel::clear()

void SendRecipientsListModel::clearToFront()
{
if (m_current != 0) {
m_current = 0;
Q_EMIT currentRecipientChanged();
Q_EMIT currentIndexChanged();
}

bool count_changed = false;
while (m_recipients.size() > 1) {
delete m_recipients.at(1);
Expand All @@ -167,10 +175,4 @@ void SendRecipientsListModel::clearToFront()
m_totalAmount = m_recipients[0]->amount()->satoshi();
Q_EMIT totalAmountChanged();
}

if (m_current != 0) {
m_current = 0;
Q_EMIT currentRecipientChanged();
Q_EMIT currentIndexChanged();
}
}
6 changes: 5 additions & 1 deletion qml/walletqmlcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
WalletQmlController::WalletQmlController(interfaces::Node& node, QObject *parent)
: QObject(parent)
, m_node(node)
, m_selected_wallet(new WalletQmlModel(parent))
, m_empty_wallet(new WalletQmlModel(this))
, m_selected_wallet(m_empty_wallet)
, m_worker(new QObject)
, m_worker_thread(new QThread(this))
{
Expand All @@ -35,6 +36,7 @@ WalletQmlController::~WalletQmlController()
m_worker_thread->quit();
m_worker_thread->wait();
delete m_worker;
delete m_empty_wallet;
}

void WalletQmlController::setSelectedWallet(QString path)
Expand Down Expand Up @@ -63,6 +65,8 @@ WalletQmlModel* WalletQmlController::selectedWallet() const
void WalletQmlController::unloadWallets()
{
m_handler_load_wallet->disconnect();
m_selected_wallet = m_empty_wallet;
Q_EMIT selectedWalletChanged();
QMutexLocker locker(&m_wallets_mutex);
for (WalletQmlModel* wallet : m_wallets) {
delete wallet;
Expand Down
1 change: 1 addition & 0 deletions qml/walletqmlcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public Q_SLOTS:

bool m_initialized{false};
interfaces::Node& m_node;
WalletQmlModel* m_empty_wallet;
WalletQmlModel* m_selected_wallet;
QObject* m_worker;
QThread* m_worker_thread;
Expand Down
Loading