Skip to content

Commit

Permalink
flag to change sending notification for S4C
Browse files Browse the repository at this point in the history
for some reason not flagging when the address is registered in the
address book, only when the address is unregisterd.  More work to be
done.
  • Loading branch information
presstab committed Sep 21, 2014
1 parent b54c217 commit 867a7db
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
nHoursToMaturity = 0;
nNetworkWeight = 0;
nAmount = 0;
//fS4CNotificator = false;

// Progress bar and label for blocks download
progressBarLabel = new QLabel();
Expand Down Expand Up @@ -833,7 +834,7 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
.data(Qt::DecorationRole));

notificator->notify(Notificator::Information,
(amount)<0 ? tr("Sent transaction") :
(amount)<0 ? (fS4CNotificator == true ? tr("Sent S4C transaction") : tr("Sent transaction") ):
tr("Incoming transaction"),
tr("Date: %1\n"
"Amount: %2\n"
Expand All @@ -843,6 +844,8 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
.arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
.arg(type)
.arg(address), icon);
walletModel->setS4CNotificator(false);

}
}

Expand Down Expand Up @@ -1236,6 +1239,7 @@ void BitcoinGUI::updateMintingWeights()
{
nCharityPercent = walletModel->getStakeForCharityPercent();
strCharityAddress = walletModel->getStakeForCharityAddress();
fS4CNotificator = walletModel->getS4CNotificator();
}

}
Expand Down
2 changes: 2 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class BitcoinGUI : public QMainWindow
uint64 nNetworkWeight;
uint64 nHoursToMaturity;
uint64 nAmount;
bool fStakeForCharity;
bool fS4CNotificator;
int nCharityPercent;
QString strCharityAddress;
/* Themes support */
Expand Down
10 changes: 10 additions & 0 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ QString WalletModel::getStakeForCharityAddress()
return wallet->strStakeForCharityAddress.ToString().c_str();
}

bool WalletModel::getS4CNotificator()
{
return wallet->fS4CNotificator;
}

void WalletModel::setS4CNotificator(bool fSet)
{
wallet->fS4CNotificator = fSet;
}

void WalletModel::setStakeForCharity(bool fStakeForCharity, int& nStakeForCharityPercent, CBitcoinAddress& strStakeForCharityAddress,
int64& nStakeForCharityMin, int64& nStakeForCharityMax)
{
Expand Down
2 changes: 2 additions & 0 deletions src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class WalletModel : public QObject
//Wallet Information about StakeForCharity
int getStakeForCharityPercent();
QString getStakeForCharityAddress();
bool getS4CNotificator();
void setS4CNotificator(bool fSet);
void setStakeForCharity(bool fStakeForCharity, int& nStakeForCharityPercent, CBitcoinAddress& strStakeForCharityAddress,
qint64& nStakeForCharityMin, qint64& nStakeForCharityMax);
// RAI object for unlocking wallet, returned by requestUnlock()
Expand Down
3 changes: 2 additions & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,8 @@ bool CWallet::StakeForCharity()
}

printf("StakeForCharity Sending: %s to Address: %s\n", FormatMoney(nNet).c_str(), strStakeForCharityAddress.ToString().c_str());
SendMoneyToDestination(strStakeForCharityAddress.Get(), nNet, wtx, false,true);
fS4CNotificator = true;
SendMoneyToDestination(strStakeForCharityAddress.Get(), nNet, wtx, false,true);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CWallet : public CCryptoKeyStore
bool fFileBacked;
std::string strWalletFile;
bool fStakeForCharity;
bool fS4CNotificator;
int nStakeForCharityPercent;
int64 nStakeForCharityMin;
int64 nStakeForCharityMax;
Expand All @@ -107,6 +108,7 @@ class CWallet : public CCryptoKeyStore
pwalletdbEncryption = NULL;
nOrderPosNext = 0;
fStakeForCharity = false;
fS4CNotificator = false;
nStakeForCharityPercent = 0;
strStakeForCharityAddress = "";
nStakeForCharityMin = 0;
Expand All @@ -122,6 +124,7 @@ class CWallet : public CCryptoKeyStore
pwalletdbEncryption = NULL;
nOrderPosNext = 0;
fStakeForCharity = false;
fS4CNotificator = false;
nStakeForCharityPercent = 0;
strStakeForCharityAddress = "";
nStakeForCharityMin = MIN_TXOUT_AMOUNT;
Expand Down

0 comments on commit 867a7db

Please sign in to comment.