Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.cpp
Show First 20 Lines • Show All 354 Lines • ▼ Show 20 Lines | bool WalletModel::changePassphrase(const SecureString &oldPass, | ||||
// Make sure wallet is locked before attempting pass change | // Make sure wallet is locked before attempting pass change | ||||
m_wallet->lock(); | m_wallet->lock(); | ||||
return m_wallet->changeWalletPassphrase(oldPass, newPass); | return m_wallet->changeWalletPassphrase(oldPass, newPass); | ||||
} | } | ||||
// Handlers for core signals | // Handlers for core signals | ||||
static void NotifyUnload(WalletModel *walletModel) { | static void NotifyUnload(WalletModel *walletModel) { | ||||
qDebug() << "NotifyUnload"; | qDebug() << "NotifyUnload"; | ||||
QMetaObject::invokeMethod(walletModel, "unload"); | bool invoked = QMetaObject::invokeMethod(walletModel, "unload"); | ||||
assert(invoked); | |||||
} | } | ||||
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel) { | static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel) { | ||||
qDebug() << "NotifyKeyStoreStatusChanged"; | qDebug() << "NotifyKeyStoreStatusChanged"; | ||||
QMetaObject::invokeMethod(walletmodel, "updateStatus", | bool invoked = QMetaObject::invokeMethod(walletmodel, "updateStatus", | ||||
Qt::QueuedConnection); | Qt::QueuedConnection); | ||||
assert(invoked); | |||||
} | } | ||||
static void NotifyAddressBookChanged(WalletModel *walletmodel, | static void NotifyAddressBookChanged(WalletModel *walletmodel, | ||||
const CTxDestination &address, | const CTxDestination &address, | ||||
const std::string &label, bool isMine, | const std::string &label, bool isMine, | ||||
const std::string &purpose, | const std::string &purpose, | ||||
ChangeType status) { | ChangeType status) { | ||||
QString strAddress = QString::fromStdString( | QString strAddress = QString::fromStdString( | ||||
EncodeCashAddr(address, walletmodel->getChainParams())); | EncodeCashAddr(address, walletmodel->getChainParams())); | ||||
QString strLabel = QString::fromStdString(label); | QString strLabel = QString::fromStdString(label); | ||||
QString strPurpose = QString::fromStdString(purpose); | QString strPurpose = QString::fromStdString(purpose); | ||||
qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel + | qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel + | ||||
" isMine=" + QString::number(isMine) + | " isMine=" + QString::number(isMine) + | ||||
" purpose=" + strPurpose + | " purpose=" + strPurpose + | ||||
" status=" + QString::number(status); | " status=" + QString::number(status); | ||||
QMetaObject::invokeMethod(walletmodel, "updateAddressBook", | bool invoked = QMetaObject::invokeMethod( | ||||
Qt::QueuedConnection, Q_ARG(QString, strAddress), | walletmodel, "updateAddressBook", Qt::QueuedConnection, | ||||
Q_ARG(QString, strLabel), Q_ARG(bool, isMine), | Q_ARG(QString, strAddress), Q_ARG(QString, strLabel), | ||||
Q_ARG(QString, strPurpose), Q_ARG(int, status)); | Q_ARG(bool, isMine), Q_ARG(QString, strPurpose), Q_ARG(int, status)); | ||||
assert(invoked); | |||||
} | } | ||||
static void NotifyTransactionChanged(WalletModel *walletmodel, const TxId &hash, | static void NotifyTransactionChanged(WalletModel *walletmodel, const TxId &hash, | ||||
ChangeType status) { | ChangeType status) { | ||||
Q_UNUSED(hash); | Q_UNUSED(hash); | ||||
Q_UNUSED(status); | Q_UNUSED(status); | ||||
QMetaObject::invokeMethod(walletmodel, "updateTransaction", | bool invoked = QMetaObject::invokeMethod(walletmodel, "updateTransaction", | ||||
Qt::QueuedConnection); | Qt::QueuedConnection); | ||||
assert(invoked); | |||||
} | } | ||||
static void ShowProgress(WalletModel *walletmodel, const std::string &title, | static void ShowProgress(WalletModel *walletmodel, const std::string &title, | ||||
int nProgress) { | int nProgress) { | ||||
// emits signal "showProgress" | // emits signal "showProgress" | ||||
QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection, | bool invoked = QMetaObject::invokeMethod( | ||||
Q_ARG(QString, QString::fromStdString(title)), | walletmodel, "showProgress", Qt::QueuedConnection, | ||||
Q_ARG(int, nProgress)); | Q_ARG(QString, QString::fromStdString(title)), Q_ARG(int, nProgress)); | ||||
assert(invoked); | |||||
} | } | ||||
static void NotifyWatchonlyChanged(WalletModel *walletmodel, | static void NotifyWatchonlyChanged(WalletModel *walletmodel, | ||||
bool fHaveWatchonly) { | bool fHaveWatchonly) { | ||||
QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", | bool invoked = QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", | ||||
Qt::QueuedConnection, | Qt::QueuedConnection, | ||||
Q_ARG(bool, fHaveWatchonly)); | Q_ARG(bool, fHaveWatchonly)); | ||||
assert(invoked); | |||||
} | } | ||||
static void NotifyCanGetAddressesChanged(WalletModel *walletmodel) { | static void NotifyCanGetAddressesChanged(WalletModel *walletmodel) { | ||||
bool invoked = | |||||
QMetaObject::invokeMethod(walletmodel, "canGetAddressesChanged"); | QMetaObject::invokeMethod(walletmodel, "canGetAddressesChanged"); | ||||
assert(invoked); | |||||
} | } | ||||
void WalletModel::subscribeToCoreSignals() { | void WalletModel::subscribeToCoreSignals() { | ||||
// Connect signals to wallet | // Connect signals to wallet | ||||
m_handler_unload = m_wallet->handleUnload(std::bind(&NotifyUnload, this)); | m_handler_unload = m_wallet->handleUnload(std::bind(&NotifyUnload, this)); | ||||
m_handler_status_changed = m_wallet->handleStatusChanged( | m_handler_status_changed = m_wallet->handleStatusChanged( | ||||
std::bind(&NotifyKeyStoreStatusChanged, this)); | std::bind(&NotifyKeyStoreStatusChanged, this)); | ||||
m_handler_address_book_changed = m_wallet->handleAddressBookChanged( | m_handler_address_book_changed = m_wallet->handleAddressBookChanged( | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |