Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletframe.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | bool WalletFrame::addWallet(WalletModel *walletModel) { | ||||
connect(walletView, SIGNAL(outOfSyncWarningClicked()), this, | connect(walletView, SIGNAL(outOfSyncWarningClicked()), this, | ||||
SLOT(outOfSyncWarningClicked())); | SLOT(outOfSyncWarningClicked())); | ||||
return true; | return true; | ||||
} | } | ||||
bool WalletFrame::setCurrentWallet(const QString &name) { | bool WalletFrame::setCurrentWallet(const QString &name) { | ||||
if (mapWalletViews.count(name) == 0) return false; | if (mapWalletViews.count(name) == 0) { | ||||
return false; | |||||
} | |||||
WalletView *walletView = mapWalletViews.value(name); | WalletView *walletView = mapWalletViews.value(name); | ||||
walletStack->setCurrentWidget(walletView); | walletStack->setCurrentWidget(walletView); | ||||
assert(walletView); | assert(walletView); | ||||
walletView->updateEncryptionStatus(); | walletView->updateEncryptionStatus(); | ||||
return true; | return true; | ||||
} | } | ||||
bool WalletFrame::removeWallet(const QString &name) { | bool WalletFrame::removeWallet(const QString &name) { | ||||
if (mapWalletViews.count(name) == 0) return false; | if (mapWalletViews.count(name) == 0) { | ||||
return false; | |||||
} | |||||
WalletView *walletView = mapWalletViews.take(name); | WalletView *walletView = mapWalletViews.take(name); | ||||
walletStack->removeWidget(walletView); | walletStack->removeWidget(walletView); | ||||
return true; | return true; | ||||
} | } | ||||
void WalletFrame::removeAllWallets() { | void WalletFrame::removeAllWallets() { | ||||
QMap<QString, WalletView *>::const_iterator i; | QMap<QString, WalletView *>::const_iterator i; | ||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) | for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { | ||||
walletStack->removeWidget(i.value()); | walletStack->removeWidget(i.value()); | ||||
} | |||||
mapWalletViews.clear(); | mapWalletViews.clear(); | ||||
} | } | ||||
bool WalletFrame::handlePaymentRequest(const SendCoinsRecipient &recipient) { | bool WalletFrame::handlePaymentRequest(const SendCoinsRecipient &recipient) { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (!walletView) return false; | if (!walletView) { | ||||
return false; | |||||
} | |||||
return walletView->handlePaymentRequest(recipient); | return walletView->handlePaymentRequest(recipient); | ||||
} | } | ||||
void WalletFrame::showOutOfSyncWarning(bool fShow) { | void WalletFrame::showOutOfSyncWarning(bool fShow) { | ||||
bOutOfSync = fShow; | bOutOfSync = fShow; | ||||
QMap<QString, WalletView *>::const_iterator i; | QMap<QString, WalletView *>::const_iterator i; | ||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) | for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { | ||||
i.value()->showOutOfSyncWarning(fShow); | i.value()->showOutOfSyncWarning(fShow); | ||||
} | } | ||||
} | |||||
void WalletFrame::gotoOverviewPage() { | void WalletFrame::gotoOverviewPage() { | ||||
QMap<QString, WalletView *>::const_iterator i; | QMap<QString, WalletView *>::const_iterator i; | ||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) | for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { | ||||
i.value()->gotoOverviewPage(); | i.value()->gotoOverviewPage(); | ||||
} | } | ||||
} | |||||
void WalletFrame::gotoHistoryPage() { | void WalletFrame::gotoHistoryPage() { | ||||
QMap<QString, WalletView *>::const_iterator i; | QMap<QString, WalletView *>::const_iterator i; | ||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) | for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { | ||||
i.value()->gotoHistoryPage(); | i.value()->gotoHistoryPage(); | ||||
} | } | ||||
} | |||||
void WalletFrame::gotoReceiveCoinsPage() { | void WalletFrame::gotoReceiveCoinsPage() { | ||||
QMap<QString, WalletView *>::const_iterator i; | QMap<QString, WalletView *>::const_iterator i; | ||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) | for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { | ||||
i.value()->gotoReceiveCoinsPage(); | i.value()->gotoReceiveCoinsPage(); | ||||
} | } | ||||
} | |||||
void WalletFrame::gotoSendCoinsPage(QString addr) { | void WalletFrame::gotoSendCoinsPage(QString addr) { | ||||
QMap<QString, WalletView *>::const_iterator i; | QMap<QString, WalletView *>::const_iterator i; | ||||
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) | for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) { | ||||
i.value()->gotoSendCoinsPage(addr); | i.value()->gotoSendCoinsPage(addr); | ||||
} | } | ||||
} | |||||
void WalletFrame::gotoSignMessageTab(QString addr) { | void WalletFrame::gotoSignMessageTab(QString addr) { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->gotoSignMessageTab(addr); | if (walletView) { | ||||
walletView->gotoSignMessageTab(addr); | |||||
} | |||||
} | } | ||||
void WalletFrame::gotoVerifyMessageTab(QString addr) { | void WalletFrame::gotoVerifyMessageTab(QString addr) { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->gotoVerifyMessageTab(addr); | if (walletView) { | ||||
walletView->gotoVerifyMessageTab(addr); | |||||
} | |||||
} | } | ||||
void WalletFrame::encryptWallet(bool status) { | void WalletFrame::encryptWallet(bool status) { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->encryptWallet(status); | if (walletView) { | ||||
walletView->encryptWallet(status); | |||||
} | |||||
} | } | ||||
void WalletFrame::backupWallet() { | void WalletFrame::backupWallet() { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->backupWallet(); | if (walletView) { | ||||
walletView->backupWallet(); | |||||
} | |||||
} | } | ||||
void WalletFrame::changePassphrase() { | void WalletFrame::changePassphrase() { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->changePassphrase(); | if (walletView) { | ||||
walletView->changePassphrase(); | |||||
} | |||||
} | } | ||||
void WalletFrame::unlockWallet() { | void WalletFrame::unlockWallet() { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->unlockWallet(); | if (walletView) { | ||||
walletView->unlockWallet(); | |||||
} | |||||
} | } | ||||
void WalletFrame::usedSendingAddresses() { | void WalletFrame::usedSendingAddresses() { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->usedSendingAddresses(); | if (walletView) { | ||||
walletView->usedSendingAddresses(); | |||||
} | |||||
} | } | ||||
void WalletFrame::usedReceivingAddresses() { | void WalletFrame::usedReceivingAddresses() { | ||||
WalletView *walletView = currentWalletView(); | WalletView *walletView = currentWalletView(); | ||||
if (walletView) walletView->usedReceivingAddresses(); | if (walletView) { | ||||
walletView->usedReceivingAddresses(); | |||||
} | |||||
} | } | ||||
WalletView *WalletFrame::currentWalletView() { | WalletView *WalletFrame::currentWalletView() { | ||||
return qobject_cast<WalletView *>(walletStack->currentWidget()); | return qobject_cast<WalletView *>(walletStack->currentWidget()); | ||||
} | } | ||||
void WalletFrame::outOfSyncWarningClicked() { | void WalletFrame::outOfSyncWarningClicked() { | ||||
Q_EMIT requestedSyncWarningInfo(); | Q_EMIT requestedSyncWarningInfo(); | ||||
} | } |