return !potentialWalletFileCorruption;
}
+void Subaddress::updateUsed(quint32 accountIndex)
+{
+ for (quint32 i = 0; i < m_rows.count(); i++) {
+ SubaddressRow& row = m_rows[i];
+
+ if (m_wallet2->get_subaddress_used({accountIndex, i}) != row.used) {
+ row.used = !row.used;
+ emit rowUpdated(i);
+ }
+ }
+}
+
qsizetype Subaddress::count() const
{
return m_rows.length();
public:
bool refresh(quint32 accountIndex);
+ void updateUsed(quint32 accountIndex);
[[nodiscard]] qsizetype count() const;
const SubaddressRow& row(int index) const;
signals:
void refreshStarted() const;
void refreshFinished() const;
+ void rowUpdated(qsizetype index) const;
void corrupted() const;
private:
this->syncStatusUpdated(walletHeight, daemonHeight);
if (this->isSynchronized()) {
- this->refreshModels();
+ m_history->refresh();
+ m_coins->refresh();
+ this->subaddress()->updateUsed(this->currentSubaddressAccount());
}
}
void Wallet::onUpdated() {
this->updateBalance();
if (this->isSynchronized()) {
- this->refreshModels();
+ m_history->refresh();
+ m_coins->refresh();
+ this->subaddress()->updateUsed(this->currentSubaddressAccount());
}
}
{
connect(m_subaddress, &Subaddress::refreshStarted, this, &SubaddressModel::beginResetModel);
connect(m_subaddress, &Subaddress::refreshFinished, this, &SubaddressModel::endResetModel);
+ connect(m_subaddress, &Subaddress::rowUpdated, this, &SubaddressModel::rowUpdated);
}
int SubaddressModel::rowCount(const QModelIndex &parent) const
Q_ASSERT(index.isValid() && index.row() < m_subaddress->count());
return m_subaddress->row(index.row());
}
+
+void SubaddressModel::rowUpdated(qsizetype index)
+{
+ emit dataChanged(this->index(index, 0), this->index(index, SubaddressModel::COUNT - 1), {Qt::DisplayRole, Qt::EditRole});
+}
void setCurrentSubaddressAccount(quint32 accountIndex);
+ void rowUpdated(qsizetype index);
+
private:
Subaddress *m_subaddress;
QVariant parseSubaddressRow(const SubaddressRow &subaddress, const QModelIndex &index, int role) const;