Skip to content

Commit f70ee34

Browse files
committed
qt, refactor: Declare WalletModel member functions with const
1 parent be7a5f2 commit f70ee34

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

src/qt/walletmodel.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
145145
Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
146146
}
147147

148-
bool WalletModel::validateAddress(const QString &address)
148+
bool WalletModel::validateAddress(const QString& address) const
149149
{
150150
return IsValidDestinationString(address.toStdString());
151151
}
@@ -284,22 +284,22 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
284284
return SendCoinsReturn(OK);
285285
}
286286

287-
OptionsModel *WalletModel::getOptionsModel()
287+
OptionsModel* WalletModel::getOptionsModel() const
288288
{
289289
return optionsModel;
290290
}
291291

292-
AddressTableModel *WalletModel::getAddressTableModel()
292+
AddressTableModel* WalletModel::getAddressTableModel() const
293293
{
294294
return addressTableModel;
295295
}
296296

297-
TransactionTableModel *WalletModel::getTransactionTableModel()
297+
TransactionTableModel* WalletModel::getTransactionTableModel() const
298298
{
299299
return transactionTableModel;
300300
}
301301

302-
RecentRequestsTableModel *WalletModel::getRecentRequestsTableModel()
302+
RecentRequestsTableModel* WalletModel::getRecentRequestsTableModel() const
303303
{
304304
return recentRequestsTableModel;
305305
}
@@ -557,7 +557,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
557557
return true;
558558
}
559559

560-
bool WalletModel::displayAddress(std::string sAddress)
560+
bool WalletModel::displayAddress(std::string sAddress) const
561561
{
562562
CTxDestination dest = DecodeDestination(sAddress);
563563
bool res = false;
@@ -585,7 +585,7 @@ QString WalletModel::getDisplayName() const
585585
return name.isEmpty() ? "["+tr("default wallet")+"]" : name;
586586
}
587587

588-
bool WalletModel::isMultiwallet()
588+
bool WalletModel::isMultiwallet() const
589589
{
590590
return m_node.walletLoader().getWallets().size() > 1;
591591
}

src/qt/walletmodel.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ class WalletModel : public QObject
7777
Unlocked // wallet->IsCrypted() && !wallet->IsLocked()
7878
};
7979

80-
OptionsModel *getOptionsModel();
81-
AddressTableModel *getAddressTableModel();
82-
TransactionTableModel *getTransactionTableModel();
83-
RecentRequestsTableModel *getRecentRequestsTableModel();
80+
OptionsModel* getOptionsModel() const;
81+
AddressTableModel* getAddressTableModel() const;
82+
TransactionTableModel* getTransactionTableModel() const;
83+
RecentRequestsTableModel* getRecentRequestsTableModel() const;
8484

8585
EncryptionStatus getEncryptionStatus() const;
8686

8787
// Check address for validity
88-
bool validateAddress(const QString &address);
88+
bool validateAddress(const QString& address) const;
8989

9090
// Return status record for SendCoins, contains error id + information
9191
struct SendCoinsReturn
@@ -137,7 +137,7 @@ class WalletModel : public QObject
137137
UnlockContext requestUnlock();
138138

139139
bool bumpFee(uint256 hash, uint256& new_hash);
140-
bool displayAddress(std::string sAddress);
140+
bool displayAddress(std::string sAddress) const;
141141

142142
static bool isWalletEnabled();
143143

@@ -149,9 +149,7 @@ class WalletModel : public QObject
149149
QString getWalletName() const;
150150
QString getDisplayName() const;
151151

152-
bool isMultiwallet();
153-
154-
AddressTableModel* getAddressTableModel() const { return addressTableModel; }
152+
bool isMultiwallet() const;
155153

156154
void refresh(bool pk_hash_only = false);
157155

0 commit comments

Comments
 (0)