]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
AccountSwitcher: fix sort
authortobtoht <tob@featherwallet.org>
Tue, 17 Jan 2023 20:25:01 +0000 (21:25 +0100)
committertobtoht <tob@featherwallet.org>
Tue, 17 Jan 2023 20:25:01 +0000 (21:25 +0100)
src/dialog/AccountSwitcherDialog.cpp

index 76a48aacfbdc3d1ad541ccbbd0bdc8ded8b3cd59..ad24c2499e0d4c8ba5be102ce9c5639ccc89f9a1 100644 (file)
@@ -54,22 +54,28 @@ AccountSwitcherDialog::AccountSwitcherDialog(QSharedPointer<AppContext> ctx, QWi
 }
 
 void AccountSwitcherDialog::switchAccount() {
-    QModelIndex index = ui->accounts->currentIndex();
-    m_ctx->wallet->switchSubaddressAccount(index.row());
+    auto row = this->currentEntry();
+    if (!row) {
+        return;
+    }
+
+    m_ctx->wallet->switchSubaddressAccount(row->getRowId());
 }
 
 void AccountSwitcherDialog::copyLabel() {
     auto row = this->currentEntry();
-    if (!row)
+    if (!row) {
         return;
+    }
 
     Utils::copyToClipboard(QString::fromStdString(row->getLabel()));
 }
 
 void AccountSwitcherDialog::copyBalance() {
     auto row = this->currentEntry();
-    if (!row)
+    if (!row) {
         return;
+    }
 
     Utils::copyToClipboard(QString::fromStdString(row->getBalance()));
 }
@@ -101,7 +107,7 @@ void AccountSwitcherDialog::showContextMenu(const QPoint &point) {
 }
 
 Monero::SubaddressAccountRow* AccountSwitcherDialog::currentEntry() {
-    QModelIndex index = ui->accounts->currentIndex();
+    QModelIndex index = m_proxyModel->mapToSource(ui->accounts->currentIndex());
     return m_ctx->wallet->subaddressAccountModel()->entryFromIndex(index);
 }