PRCYCoin  2.0.0.7rc1
P2P Digital Currency
optionspage.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include "optionspage.h"
6 #include "ui_optionspage.h"
7 
8 #include "addressbookpage.h"
9 #include "addresstablemodel.h"
10 #include "bitcoinunits.h"
11 #include "guiutil.h"
12 #include "guiconstants.h"
13 #include "bitcoingui.h"
14 #include "masternode-sync.h"
15 #include "optionsmodel.h"
16 #include "receiverequestdialog.h"
17 #include "walletmodel.h"
18 #include "2faqrdialog.h"
19 #include "2fadialog.h"
20 #include "2faconfirmdialog.h"
21 #include "zxcvbn.h"
22 #include "utilmoneystr.h"
23 #include "timedata.h"
24 
25 #include <QAction>
26 #include <QCursor>
27 #include <QItemSelection>
28 #include <QMessageBox>
29 #include <QScrollBar>
30 #include <QTextDocument>
31 #include <QDataWidgetMapper>
32 #include <QDoubleValidator>
33 #include <QFile>
34 #include <QTextStream>
35 
36 
37 OptionsPage::OptionsPage(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
38  ui(new Ui::OptionsPage),
39  model(0),
40  // m_SizeGrip(this),
41  mapper(0)
42 {
43  ui->setupUi(this);
44 
45  mapper = new QDataWidgetMapper(this);
46  mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
47 
48  ui->toggleTheme->setState(settings.value("theme")!="webwallet");
49  connect(ui->toggleTheme, SIGNAL(stateChanged(ToggleButton*)), this, SLOT(changeTheme(ToggleButton*)));
50 
51  connect(ui->lineEditNewPass, SIGNAL(textChanged(const QString &)), this, SLOT(validateNewPass()));
52  connect(ui->lineEditNewPassRepeat, SIGNAL(textChanged(const QString &)), this, SLOT(validateNewPassRepeat()));
53  connect(ui->lineEditOldPass, SIGNAL(textChanged(const QString &)), this, SLOT(onOldPassChanged()));
54 
55  QLocale lo(QLocale::C);
56  lo.setNumberOptions(QLocale::RejectGroupSeparator);
57  QDoubleValidator *dblVal = new QDoubleValidator(0, 250000000, 0, ui->lineEditWithhold);
58  dblVal->setNotation(QDoubleValidator::StandardNotation);
59  dblVal->setLocale(lo);
60  ui->lineEditWithhold->setValidator(dblVal);
61  ui->lineEditWithhold->setPlaceholderText("PRCY Amount");
62  if (nReserveBalance > 0)
63  ui->lineEditWithhold->setText(BitcoinUnits::format(0, nReserveBalance).toUtf8());
64 
65  bool stkStatus = pwalletMain->ReadStakingStatus();
66  fLiteMode = GetBoolArg("-litemode", false);
67  if (stkStatus && !fLiteMode){
68  if (chainActive.Height() < Params().LAST_POW_BLOCK()) {
69  stkStatus = false;
71  //Q_EMIT model->stakingStatusChanged(false);
72  } else {
73  QString error;
75  if (error.length()) {
76  stkStatus = false;
78  //Q_EMIT model->stakingStatusChanged(false);
79  }
80  }
81  }
82 
83  if (!fLiteMode) {
84  //Staking related items and functions
85  ui->toggleStaking->setState(nLastCoinStakeSearchInterval | stkStatus);
86  connect(ui->toggleStaking, SIGNAL(stateChanged(ToggleButton*)), this, SLOT(on_EnableStaking(ToggleButton*)));
87  timerStakingToggleSync = new QTimer();
88  connect(timerStakingToggleSync, SIGNAL(timeout()), this, SLOT(setStakingToggle()));
89  timerStakingToggleSync->start(10000);
90  ui->labelStaking->show();
91  ui->toggleStaking->show();
92  ui->reservegroupBox->show();
93  ui->lineEditWithhold->show();
94  ui->addNewFunds->show();
95  ui->pushButtonSave->show();
96  ui->pushButtonDisable->show();
97  } else {
98  //Staking related items and functions hidden/removed in litemode
99  ui->labelStaking->hide();
100  ui->toggleStaking->hide();
101  ui->reservegroupBox->hide();
102  ui->lineEditWithhold->hide();
103  ui->addNewFunds->hide();
104  ui->pushButtonSave->hide();
105  ui->pushButtonDisable->hide();
106  }
107 
108 
109  connect(ui->pushButtonRecovery, SIGNAL(clicked()), this, SLOT(onShowMnemonic()));
110 
111  bool twoFAStatus = pwalletMain->Read2FA();
112  if (twoFAStatus)
113  enable2FA();
114  else
115  disable2FA();
116 
117  ui->toggle2FA->setState(twoFAStatus);
118  connect(ui->toggle2FA, SIGNAL(stateChanged(ToggleButton*)), this, SLOT(on_Enable2FA(ToggleButton*)));
119  QSettings settings;
120  int digits = settings.value("2fadigits").toInt();
121  if (digits == 8) {
122  ui->comboBox->setCurrentIndex(1);
123  } else if (digits == 6) {
124  ui->comboBox->setCurrentIndex(0);
125  }
126  connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeDigits(int)));
127  connect(ui->btn_day, SIGNAL(clicked()), this, SLOT(on_day()));
128  connect(ui->btn_week, SIGNAL(clicked()), this, SLOT(on_week()));
129  connect(ui->btn_month, SIGNAL(clicked()), this, SLOT(on_month()));
130 
131  ui->lblAuthCode->setVisible(false);
132  ui->code_1->setVisible(false);
133  ui->code_2->setVisible(false);
134  ui->code_3->setVisible(false);
135  ui->code_4->setVisible(false);
136  ui->code_5->setVisible(false);
137  ui->code_6->setVisible(false);
138 
140  if (pwalletMain) {
141  bool isConsolidatedOn = pwalletMain->IsAutoConsolidateOn();
142  ui->addNewFunds->setChecked(isConsolidatedOn);
143  }
144  } else {
145  ui->addNewFunds->setChecked(false);
146  ui->addNewFunds->setEnabled(false);
147  QFont font = ui->addNewFunds->font();
148  font.setStrikeOut(true);
149  ui->addNewFunds->setFont(font);
150  ui->addNewFunds->setToolTip("Disabled by default due to controlling Masternode(s) from this wallet.\nEnabling this will incur a maximum 0.1 PRCY fee each time you receive a new deposit that needs to be consolidated for staking.");
151  }
152  ui->mapPortUpnp->setChecked(settings.value("fUseUPnP", false).toBool());
153  ui->minimizeToTray->setChecked(settings.value("fMinimizeToTray", false).toBool());
154  ui->minimizeOnClose->setChecked(settings.value("fMinimizeOnClose", false).toBool());
155  ui->alwaysRequest2FA->setChecked(settings.value("fAlwaysRequest2FA", false).toBool());
156  ui->alwaysRequestPassphrase->setChecked(settings.value("fAlwaysRequestPassphrase", false).toBool());
157  ui->hideBalanceStaking->setChecked(settings.value("fHideBalance", false).toBool());
158  ui->lockSendStaking->setChecked(settings.value("fLockSendStaking", false).toBool());
159  ui->displayCurrencyValue->setChecked(settings.value("fDisplayCurrencyValue", false).toBool());
160  ui->defaultCurrency->setCurrentText(settings.value("strDefaultCurrency").toString());
161  connect(ui->addNewFunds, SIGNAL(stateChanged(int)), this, SLOT(setAutoConsolidate(int)));
162  connect(ui->mapPortUpnp, SIGNAL(stateChanged(int)), this, SLOT(mapPortUpnp_clicked(int)));
163  connect(ui->minimizeToTray, SIGNAL(stateChanged(int)), this, SLOT(minimizeToTray_clicked(int)));
164  connect(ui->minimizeOnClose, SIGNAL(stateChanged(int)), this, SLOT(minimizeOnClose_clicked(int)));
165  connect(ui->alwaysRequest2FA, SIGNAL(stateChanged(int)), this, SLOT(alwaysRequest2FA_clicked(int)));
166  connect(ui->hideBalanceStaking, SIGNAL(stateChanged(int)), this, SLOT(hideBalanceStaking_clicked(int)));
167  connect(ui->lockSendStaking, SIGNAL(stateChanged(int)), this, SLOT(lockSendStaking_clicked(int)));
168  connect(ui->displayCurrencyValue, SIGNAL(stateChanged(int)), this, SLOT(displayCurrencyValue_clicked(int)));
169  connect(ui->defaultCurrency, SIGNAL(currentIndexChanged(int)), this, SLOT(setDefaultCurrency(int)));
170  connect(ui->showPassphraseCheckBox, SIGNAL(clicked()), this, SLOT(on_showPassphraseCheckBox_clicked()));
171 }
172 
174 {
175  ui->toggleStaking->setState(fGeneratePrcycoins);
176 }
177 
179 {
180  this->model = model;
181  this->options = model->getOptionsModel();
182 
183  mapper->setModel(options);
184  setMapper();
185  mapper->toFirst();
186 }
187 
188 static inline int64_t roundint64(double d)
189 {
190  return (int64_t)(d > 0 ? d + 0.5 : d - 0.5);
191 }
192 
194  double dAmount = ui->lineEditWithhold->text().toDouble();
195  CAmount nAmount = roundint64(dAmount * COIN);
196  return nAmount;
197 }
198 
200 {
201  delete timerStakingToggleSync;
202  delete ui;
203 }
204 
205 void OptionsPage::resizeEvent(QResizeEvent* event)
206 {
207  QWidget::resizeEvent(event);
208 }
209 
211  double dAmount = ui->lineEditWithhold->text().toDouble();
212  if (ui->lineEditWithhold->text().trimmed().isEmpty()) {
213  ui->lineEditWithhold->setStyleSheet("border: 2px solid red");
214  QMessageBox msgBox;
215  msgBox.setWindowTitle("Reserve Balance Empty");
216  msgBox.setText("PRCY reserve amount is empty and must be a minimum of 1.\nPlease click Disable if you would like to turn it off.");
217  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
218  msgBox.setIcon(QMessageBox::Information);
219  msgBox.exec();
220  return;
221  }
222  if (dAmount < 0.0 || dAmount > 250000000) {
223  QMessageBox msgBox;
224  msgBox.setWindowTitle("Invalid Reserve Amount");
225  msgBox.setText("The amount you have attempted to keep as spendable is greater than the 250,000,000 (250M) limit. Please try a smaller amount.");
226  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
227  msgBox.setIcon(QMessageBox::Warning);
228  msgBox.exec();
229  return;
230  }
232 
234  walletdb.WriteReserveAmount(nReserveBalance / COIN);
235 
237  ui->lineEditWithhold->setStyleSheet(GUIUtil::loadStyleSheet());
238 
239  QString reserveBalance = ui->lineEditWithhold->text().trimmed();
240  QMessageBox msgBox;
241  msgBox.setWindowTitle("Reserve Balance Set");
242  msgBox.setText("Reserve balance of " + reserveBalance + " PRCY is successfully set.");
243  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
244  msgBox.setIcon(QMessageBox::Information);
245  msgBox.exec();
246 }
247 
249  ui->lineEditWithhold->setText("0");
250 
252  walletdb.WriteReserveAmount(0);
253 
255  QMessageBox msgBox;
256  msgBox.setWindowTitle("Reserve Balance Disabled");
257  msgBox.setText("Reserve balance disabled.");
258  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
259  msgBox.setIcon(QMessageBox::Information);
260  msgBox.exec();
261 }
262 
263 void OptionsPage::keyPressEvent(QKeyEvent* event)
264 {
265 
266  this->QDialog::keyPressEvent(event);
267 }
268 
270 {
271 }
272 
274 {
275  if ( (!ui->lineEditNewPass->text().length()) || (!ui->lineEditNewPassRepeat->text().length()) ) {
276  QMessageBox msgBox;
277  msgBox.setWindowTitle("Wallet Encryption Failed");
278  msgBox.setText("The passphrase entered for wallet encryption was empty or contained spaces. Please try again.");
279  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
280  msgBox.setIcon(QMessageBox::Critical);
281  msgBox.exec();
282  return;
283  }
284  //disable password submit button
285  SecureString oldPass = SecureString();
286  oldPass.reserve(MAX_PASSPHRASE_SIZE);
287  oldPass.assign( ui->lineEditOldPass->text().toStdString().c_str() );
288  SecureString newPass = SecureString();
289  newPass.reserve(MAX_PASSPHRASE_SIZE);
290  newPass.assign( ui->lineEditNewPass->text().toStdString().c_str() );
291 
292  SecureString newPass2 = SecureString();
293  newPass2.reserve(MAX_PASSPHRASE_SIZE);
294  newPass2.assign(ui->lineEditNewPassRepeat->text().toStdString().c_str() );
295 
296  bool success = false;
297 
298  if (newPass == newPass2) {
299  double guesses;
300 
301  if (oldPass == newPass) {
302  QMessageBox msgBox;
303  msgBox.setWindowTitle("Wallet Encryption Failed");
304  msgBox.setText("The passphrase you have entered is the same as your old passphrase. Please use a different passphrase if you would like to change it.");
305  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
306  msgBox.setIcon(QMessageBox::Critical);
307  msgBox.exec();
308  }
309  else if (newPass.length() < 10) {
310  QMessageBox msgBox;
311  msgBox.setWindowTitle("Wallet Encryption Failed");
312  msgBox.setText("The passphrase's length has to be more than 10. Please try again.");
313  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
314  msgBox.setIcon(QMessageBox::Critical);
315  msgBox.exec();
316  }
317  else if (!pwalletMain->checkPassPhraseRule(newPass.c_str())) {
318  QMessageBox msgBox;
319  msgBox.setWindowTitle("Wallet Encryption Failed");
320  msgBox.setText("The passphrase must contain lower, upper, digit, symbol. Please try again.");
321  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
322  msgBox.setIcon(QMessageBox::Critical);
323  msgBox.exec();
324  }
325  else if (zxcvbn_password_strength(newPass.c_str(), NULL, &guesses, NULL) < 0 || guesses < 10000) {
326  QMessageBox msgBox;
327  msgBox.setWindowTitle("Wallet Encryption Failed");
328  msgBox.setText("The passphrase is too weak. You must use a minimum passphrase length of 10 characters and use uppercase letters, lowercase letters, numbers, and symbols. Please try again.");
329  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
330  msgBox.setIcon(QMessageBox::Critical);
331  msgBox.exec();
332  }
333  else if (model->changePassphrase(oldPass, newPass)) {
334  QMessageBox msgBox;
335  msgBox.setWindowTitle("Passphrase Change Successful");
336  msgBox.setText("Wallet passphrase was successfully changed.\nPlease remember your passphrase as there is no way to recover it.");
337  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
338  msgBox.setIcon(QMessageBox::Information);
339  msgBox.exec();
340  success = true;
341  }
342  } else {
343  QMessageBox msgBox;
344  msgBox.setWindowTitle("Wallet Encryption Failed");
345  msgBox.setText("The passphrases entered for wallet encryption do not match. Please try again.");
346  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
347  msgBox.setIcon(QMessageBox::Critical);
348  msgBox.exec();
349  }
350 
351  if (success)
352  ui->pushButtonPassword->setStyleSheet("border: 2px solid green");
353  else ui->pushButtonPassword->setStyleSheet("border: 2px solid red");
354  ui->pushButtonPassword->repaint();
355 }
356 
358 {
359  ui->lineEditOldPass->clear();
360  ui->lineEditNewPass->clear();
361  ui->lineEditNewPassRepeat->clear();
362  ui->lineEditOldPass->setStyleSheet(GUIUtil::loadStyleSheet());
363  ui->lineEditNewPass->setStyleSheet(GUIUtil::loadStyleSheet());
364  ui->lineEditNewPassRepeat->setStyleSheet(GUIUtil::loadStyleSheet());
365 }
366 
368  QString filename = GUIUtil::getSaveFileName(this,
369  tr("Backup Wallet"), QString(),
370  tr("Wallet Data (*.dat)"), NULL);
371 
372  if (filename.isEmpty())
373  return;
374 
375  if (model->backupWallet(QString(filename))) {
376  ui->pushButtonBackup->setStyleSheet("border: 2px solid green");
377  QMessageBox msgBox;
378  msgBox.setWindowTitle("Wallet Backup Successful");
379  msgBox.setText("Wallet has been successfully backed up to " + filename);
380  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
381  msgBox.setIcon(QMessageBox::Information);
382  msgBox.exec();
383  } else {
384  ui->pushButtonBackup->setStyleSheet("border: 2px solid red");
385  QMessageBox msgBox;
386  msgBox.setWindowTitle("Wallet Backup Failed");
387  msgBox.setText("Wallet backup failed. Please try again.");
388  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
389  msgBox.setIcon(QMessageBox::Critical);
390  msgBox.exec();
391 }
392  ui->pushButtonBackup->repaint();
393 }
394 
396 {
397  if (!ui->lineEditNewPass->text().length())
398  ui->lineEditNewPass->setStyleSheet("border-color: red");
399  else ui->lineEditNewPass->setStyleSheet(GUIUtil::loadStyleSheet());
401  ui->lineEditNewPass->repaint();
402 }
403 
405 {
407 }
408 
410 {
411  QString stylesheet = GUIUtil::loadStyleSheet();
412  ui->lineEditOldPass->setStyleSheet(stylesheet);
413  ui->lineEditOldPass->repaint();
414  ui->pushButtonPassword->setStyleSheet(stylesheet);
415  ui->pushButtonPassword->repaint();
416  if (!ui->lineEditNewPass->text().length())
417  ui->lineEditNewPass->setStyleSheet("border-color: red");
418  ui->lineEditNewPass->repaint();
419 }
420 
422 {
423  if (ui->lineEditNewPass->text()==ui->lineEditNewPassRepeat->text())
424  {
425  ui->lineEditNewPassRepeat->setStyleSheet(GUIUtil::loadStyleSheet());
426  ui->lineEditNewPassRepeat->repaint();
427  return true;
428  } else
429  {
430  ui->lineEditNewPassRepeat->setStyleSheet("border-color: red");
431  ui->lineEditNewPassRepeat->repaint();
432  return false;
433  }
434 }
435 
437 {
438  if (!masternodeSync.IsSynced()) {
439  QMessageBox msgBox;
440  msgBox.setWindowTitle("Staking Disabled - Syncing Masternode list");
441  msgBox.setText("Enable Staking is disabled when you are still syncing the Masternode list as this is required. Please allow the wallet to fully sync this list before attempting to Enable Staking.");
442  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
443  msgBox.setIcon(QMessageBox::Warning);
444  msgBox.exec();
445  return;
446  }
447  int status = model->getEncryptionStatus();
448  if (status == WalletModel::Locked || status == WalletModel::UnlockedForStakingOnly) {
449  QMessageBox msgBox;
450  msgBox.setWindowTitle("Staking Setting");
451  msgBox.setIcon(QMessageBox::Information);
452  msgBox.setText("Please unlock the wallet with your passphrase before changing this setting.");
453  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
454  msgBox.exec();
455  widget->setState(!widget->getState());
456  return;
457  }
458 
459  if (chainActive.Height() < Params().LAST_POW_BLOCK()) {
460  if (widget->getState()) {
461  QString msg;
462  msg.sprintf("PoW blocks are still being mined.\nPlease wait until Block %d.", Params().LAST_POW_BLOCK());
463  QMessageBox msgBox;
464  msgBox.setWindowTitle("Information");
465  msgBox.setIcon(QMessageBox::Information);
466  msgBox.setText(msg);
467  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
468  msgBox.exec();
469  }
470  widget->setState(false);
472  return;
473  }
474  if (widget->getState()){
475  QString error;
476  CAmount minFee, maxFee;
477  StakingStatusError stt = pwalletMain->StakingCoinStatus(minFee, maxFee);
478  std::string errorMessage;
483  QMessageBox msgBox;
485  errorMessage = "Your stakeable balance is under the threshold of 2500 PRCY. Please deposit more PRCY into your account in order to enable staking.";
487  errorMessage = "Your balance requires a consolidation transaction which incurs a fee of between " + FormatMoney(minFee) + " to " + FormatMoney(maxFee) + " PRCY. However after that transaction fee, your balance will be below the staking threshold of 2500 PRCY. Please deposit more PRCY into your account or reduce your reserved amount in order to enable staking.";
488  } else if (stt == UNSTAKABLE_BALANCE_RESERVE_TOO_HIGH) {
489  errorMessage = "Your stakeable balance is under the threshold of 2500 PRCY. This is due to your reserve balance being too high. Please deposit more PRCY into your account or reduce your reserved amount in order to enable staking.";
490  } else {
491  SetRingSize(0);
492  CAmount totalFee = maxFee + pwalletMain->ComputeFee(1, 2, MAX_RING_SIZE);
493  errorMessage = "Your stakeable balance is under the threshold of 2500 PRCY. This is due to your reserve balance of " + FormatMoney(nReserveBalance) + " PRCY being too high. The wallet software has tried to consolidate your funds with the reserve balance but without success because of a consolidation fee of " + FormatMoney(totalFee) + " PRCY. Please wait around 10 minutes for the wallet to resolve the reserve to enable staking.";
494  }
495  QString msg = QString::fromStdString(errorMessage);
496  msgBox.setWindowTitle("Warning: Staking Issue");
497  msgBox.setIcon(QMessageBox::Warning);
498  msgBox.setText(msg);
499  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
500  msgBox.exec();
501  widget->setState(false);
503  Q_EMIT model->stakingStatusChanged(false);
505  return;
506  }
507  if (stt == StakingStatusError::STAKING_OK) {
509  Q_EMIT model->stakingStatusChanged(true);
510  model->generateCoins(true, 1);
511  pwalletMain->fCombineDust = true;
513  saveConsolidationSettingTime(ui->addNewFunds->isChecked());
514  return;
515  }
516 
517  QMessageBox::StandardButton reply;
519  errorMessage = "In order to enable staking with 100% of your current balance, your previous PRCY deposits must be consolidated and reorganized. This will incur a fee of between " + FormatMoney(minFee) + " to " + FormatMoney(maxFee) + " PRCY.\n\nWould you like to do this?";
520  } else {
521  errorMessage = "In order to enable staking with 100% of your current balance except the reserve balance, your previous PRCY deposits must be consolidated and reorganized. This will incur a fee of between " + FormatMoney(minFee) + " to " + FormatMoney(maxFee) + " PRCY.\n\nWould you like to do this?";
522  }
523  reply = QMessageBox::question(this, "Staking Needs Consolidation", QString::fromStdString(errorMessage), QMessageBox::Yes|QMessageBox::No|QMessageBox::Ignore);
524  if (reply == QMessageBox::Yes) {
526  Q_EMIT model->stakingStatusChanged(true);
527  model->generateCoins(true, 1);
528  pwalletMain->fCombineDust = true;
530  saveConsolidationSettingTime(ui->addNewFunds->isChecked());
531  bool success = false;
532  const CAmount minStakingAmount = model->getMinStakingAmount();;
533  try {
534  uint32_t nTime = pwalletMain->ReadAutoConsolidateSettingTime();
535  nTime = (nTime == 0)? GetAdjustedTime() : nTime;
537  minStakingAmount,
538  minStakingAmount, nTime);
539  if (success) {
540  //nConsolidationTime = 1800;
541  QString msg = "Consolidation transaction created!";
542  QMessageBox msgBox;
543  msgBox.setWindowTitle("Information");
544  msgBox.setIcon(QMessageBox::Information);
545  msgBox.setText(msg);
546  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
547  msgBox.exec();
548  }
549  } catch (const std::exception& err) {
550  LogPrintf("Sweeping failed, will be done automatically when coins become mature");
551  }
552  return;
553  } else if (reply == QMessageBox::No) {
555  model->generateCoins(false, 0);
556  Q_EMIT model->stakingStatusChanged(false);
558  return;
559  } else {
561  Q_EMIT model->stakingStatusChanged(true);
562  model->generateCoins(true, 1);
563  return;
564  }
565  /* if (!error.length()) {
566  pwalletMain->WriteStakingStatus(true);
567  Q_EMIT model->stakingStatusChanged(true);
568  model->generateCoins(true, 1);
569  } else {
570  if (stt != StakingStatusError::UTXO_UNDER_THRESHOLD) {
571  QMessageBox msgBox;
572  QString msg(error);
573  msgBox.setWindowTitle("Warning: Staking Issue");
574  msgBox.setIcon(QMessageBox::Warning);
575  msgBox.setText(msg);
576  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
577  msgBox.exec();
578  widget->setState(false);
579  nLastCoinStakeSearchInterval = 0;
580  Q_EMIT model->stakingStatusChanged(false);
581  pwalletMain->WriteStakingStatus(false);
582  } else {
583  QMessageBox::StandardButton reply;
584  reply = QMessageBox::question(this, "Create Stakable Transaction?", error, QMessageBox::Yes|QMessageBox::No);
585  if (reply == QMessageBox::Yes) {
586  //ask yes or no
587  //send to this self wallet MIN staking amount
588  std::string masterAddr;
589  model->getCWallet()->ComputeStealthPublicAddress("masteraccount", masterAddr);
590  CWalletTx resultTx;
591  bool success = false;
592  try {
593  success = model->getCWallet()->SendToStealthAddress(
594  masterAddr,
595  minStakingAmount,
596  resultTx,
597  false
598  );
599  } catch (const std::exception& err)
600  {
601  QMessageBox msgBox;
602  msgBox.setWindowTitle("Could Not Send");
603  msgBox.setIcon(QMessageBox::Warning);
604  msgBox.setText(QString(err.what()));
605  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
606  msgBox.exec();
607  return;
608  }
609 
610  if (success){
611  WalletUtil::getTx(pwalletMain, resultTx.GetHash());
612  QString txhash = resultTx.GetHash().GetHex().c_str();
613  QMessageBox msgBox;
614  QPushButton *copyButton = msgBox.addButton(tr("Copy"), QMessageBox::ActionRole);
615  copyButton->setStyleSheet("background:transparent;");
616  copyButton->setIcon(QIcon(":/icons/editcopy"));
617  msgBox.setWindowTitle("Transaction Initialized");
618  msgBox.setText("Transaction initialized.\n\n" + txhash);
619  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
620  msgBox.setIcon(QMessageBox::Information);
621  msgBox.exec();
622 
623  if (msgBox.clickedButton() == copyButton) {
624  //Copy txhash to clipboard
625  GUIUtil::setClipboard(txhash);
626  }
627  }
628  } else {
629  widget->setState(false);
630  nLastCoinStakeSearchInterval = 0;
631  Q_EMIT model->stakingStatusChanged(false);
632  pwalletMain->WriteStakingStatus(false);
633  }
634  }
635  }*/
636  } else {
638  model->generateCoins(false, 0);
639  Q_EMIT model->stakingStatusChanged(false);
641  }
642 }
643 
645 {
646  int status = model->getEncryptionStatus();
647  if (status == WalletModel::Locked || status == WalletModel::UnlockedForStakingOnly) {
648  QMessageBox msgBox;
649  msgBox.setWindowTitle("2FA Setting");
650  msgBox.setIcon(QMessageBox::Information);
651  msgBox.setText("Please unlock the wallet with your passphrase before changing this setting.");
652  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
653  msgBox.exec();
654 
655  ui->toggle2FA->setState(!ui->toggle2FA->getState());
656  return;
657  }
658 
659  if (widget->getState()) {
660  TwoFAQRDialog qrdlg;
661  qrdlg.setWindowTitle("2FA QR Code & Recovery Key");
662  qrdlg.setModel(this->model);
663  qrdlg.setStyleSheet(GUIUtil::loadStyleSheet());
664  connect(&qrdlg, SIGNAL(finished (int)), this, SLOT(qrDialogIsFinished(int)));
665  qrdlg.exec();
666  } else {
667  typeOf2FA = DISABLE;
668 
669  TwoFADialog codedlg;
670  codedlg.setWindowTitle("2FA Code Verification");
671  codedlg.setStyleSheet(GUIUtil::loadStyleSheet());
672  connect(&codedlg, SIGNAL(finished (int)), this, SLOT(confirmDialogIsFinished(int)));
673  codedlg.exec();
674  }
675 }
676 
678  if(result == QDialog::Accepted){
679  TwoFADialog codedlg;
680  codedlg.setWindowTitle("2FA Code Verification");
681  codedlg.setStyleSheet(GUIUtil::loadStyleSheet());
682  connect(&codedlg, SIGNAL(finished (int)), this, SLOT(dialogIsFinished(int)));
683  codedlg.exec();
684  }
685 
686  if (result == QDialog::Rejected)
687  ui->toggle2FA->setState(false);
688 
689 }
690 
692  if(result == QDialog::Accepted){
693  pwalletMain->Write2FA(true);
694  QDateTime current = QDateTime::currentDateTime();
695  pwalletMain->Write2FALastTime(current.toTime_t());
696  enable2FA();
697 
698  QMessageBox msgBox;
699  msgBox.setWindowTitle("SUCCESS!");
700  msgBox.setIcon(QMessageBox::Information);
701  msgBox.setText("Two-factor authentication has been successfully enabled.");
702  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
703  msgBox.exec();
704  }
705 
706  if (result == QDialog::Rejected)
707  ui->toggle2FA->setState(false);
708 }
709 
711 {
712  if (widget->getState())
713  settings.setValue("theme", "dark");
714  else settings.setValue("theme", "webwallet");
716 }
717 
719  ui->code_1->setText("");
720  ui->code_2->setText("");
721  ui->code_3->setText("");
722  ui->code_4->setText("");
723  ui->code_5->setText("");
724  ui->code_6->setText("");
725 
726  ui->label_3->setEnabled(false);
727  ui->lblAuthCode->setEnabled(false);
728  ui->btn_day->setEnabled(false);
729  ui->btn_week->setEnabled(false);
730  ui->btn_month->setEnabled(false);
731 
732  ui->btn_day->setStyleSheet("border-color: none;");
733  ui->btn_week->setStyleSheet("border-color: none;");
734  ui->btn_month->setStyleSheet("border-color: none;");
735  typeOf2FA = NONE2FA;
736 }
737 
739  ui->label_3->setEnabled(true);
740  ui->lblAuthCode->setEnabled(true);
741  ui->btn_day->setEnabled(true);
742  ui->btn_week->setEnabled(true);
743  ui->btn_month->setEnabled(true);
744 
745  QString code = QString::fromStdString(pwalletMain->Read2FASecret());
746  if (code != "") {
747  char chrlist[6];
748  memcpy(chrlist, code.toUtf8().data(), 6);
749  QString value;
750  value.sprintf("%c", chrlist[0]);
751  ui->code_1->setText(value);
752  value.sprintf("%c", chrlist[1]);
753  ui->code_2->setText(value);
754  value.sprintf("%c", chrlist[2]);
755  ui->code_3->setText(value);
756  value.sprintf("%c", chrlist[3]);
757  ui->code_4->setText(value);
758  value.sprintf("%c", chrlist[4]);
759  ui->code_5->setText(value);
760  value.sprintf("%c", chrlist[5]);
761  ui->code_6->setText(value);
762  }
763 
764  int period = pwalletMain->Read2FAPeriod();
765  typeOf2FA = NONE2FA;
766  if (period == 1) {
767  ui->btn_day->setStyleSheet("border-color: green;");
768  typeOf2FA = DAY;
769  }
770  else if (period == 7) {
771  ui->btn_week->setStyleSheet("border-color: green;");
772  typeOf2FA = WEEK;
773  }
774  else if (period == 30) {
775  ui->btn_month->setStyleSheet("border-color: green;");
776  typeOf2FA = MONTH;
777  }
778 }
779 
781  if(result == QDialog::Accepted){
782  if (typeOf2FA == DAY) {
784  ui->btn_day->setStyleSheet("border-color: green;");
785  ui->btn_week->setStyleSheet("border-color: white;");
786  ui->btn_month->setStyleSheet("border-color: white;");
787  } else if (typeOf2FA == WEEK) {
789  ui->btn_day->setStyleSheet("border-color: white;");
790  ui->btn_week->setStyleSheet("border-color: green;");
791  ui->btn_month->setStyleSheet("border-color: white;");
792  } else if (typeOf2FA == MONTH) {
794  ui->btn_day->setStyleSheet("border-color: white;");
795  ui->btn_week->setStyleSheet("border-color: white;");
796  ui->btn_month->setStyleSheet("border-color: green;");
797  } else if (typeOf2FA == DISABLE) {
798  pwalletMain->Write2FA(false);
802  disable2FA();
803  }
804  }
805 
806  if (result == QDialog::Rejected)
807  ui->toggle2FA->setState(true);
808 }
809 
811  typeOf2FA = DAY;
812 
813  TwoFADialog codedlg;
814  codedlg.setWindowTitle("2FA Code Verification");
815  codedlg.setStyleSheet(GUIUtil::loadStyleSheet());
816  connect(&codedlg, SIGNAL(finished (int)), this, SLOT(confirmDialogIsFinished(int)));
817  codedlg.exec();
818 }
819 
821  typeOf2FA = WEEK;
822 
823  TwoFADialog codedlg;
824  codedlg.setWindowTitle("2FA Code Verification");
825  codedlg.setStyleSheet(GUIUtil::loadStyleSheet());
826  connect(&codedlg, SIGNAL(finished (int)), this, SLOT(confirmDialogIsFinished(int)));
827  codedlg.exec();
828 }
829 
831  typeOf2FA = MONTH;
832 
833  TwoFADialog codedlg;
834  codedlg.setWindowTitle("2FA Code Verification");
835  codedlg.setStyleSheet(GUIUtil::loadStyleSheet());
836  connect(&codedlg, SIGNAL(finished (int)), this, SLOT(confirmDialogIsFinished(int)));
837  codedlg.exec();
838 }
839 
841  if(!model)
842  return;
843 
844  int status = model->getEncryptionStatus();
845  if (status == WalletModel::Locked || status == WalletModel::UnlockedForStakingOnly) {
847  if (!ctx.isValid()) {
848  QMessageBox msgBox;
849  msgBox.setWindowTitle("Mnemonic Recovery Phrase");
850  msgBox.setIcon(QMessageBox::Information);
851  msgBox.setText("Attempt to view Mnemonic Phrase failed or canceled. Wallet locked for security.");
852  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
853  msgBox.exec();
854  LogPrintf("Attempt to view Mnemonic Phrase failed or canceled. Wallet locked for security.\n");
855  return;
856  } else {
857  SecureString pass;
858  model->setWalletLocked(false, pass);
859  LogPrintf("Attempt to view Mnemonic Phrase successful.\n");
860  }
861  } else {
862  QMessageBox::StandardButton reply;
863  reply = QMessageBox::question(this, "Are You Sure?", "Are you sure you would like to view your Mnemonic Phrase?\nYou will be required to enter your passphrase. Failed or canceled attempts will be logged.", QMessageBox::Yes|QMessageBox::No);
864  if (reply == QMessageBox::Yes) {
865  model->setWalletLocked(true);
867  if (!ctx.isValid()) {
868  QMessageBox msgBox;
869  msgBox.setWindowTitle("Mnemonic Recovery Phrase");
870  msgBox.setIcon(QMessageBox::Information);
871  msgBox.setText("Attempt to view Mnemonic Phrase failed or canceled. Wallet locked for security.");
872  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
873  msgBox.exec();
874  LogPrintf("Attempt to view Mnemonic Phrase failed or canceled. Wallet locked for security.\n");
875  return;
876  } else {
877  SecureString pass;
878  model->setWalletLocked(false, pass);
879  LogPrintf("Attempt to view Mnemonic Phrase successful.\n");
880  }
881  } else {
882  LogPrintf("Attempt to view Mnemonic Phrase canceled.\n");
883  return;
884  }
885  }
886  QString phrase = "";
887  std::string recoverySeedPhrase = "";
888  if (model->getSeedPhrase(recoverySeedPhrase)) {
889  phrase = QString::fromStdString(recoverySeedPhrase);
890  }
891 
892  QMessageBox msgBox;
893  QPushButton *copyButton = msgBox.addButton(tr("Copy"), QMessageBox::ActionRole);
894  QPushButton *okButton = msgBox.addButton(tr("OK"), QMessageBox::ActionRole);
895  copyButton->setStyleSheet("background:transparent;");
896  copyButton->setIcon(QIcon(":/icons/editcopy"));
897  msgBox.setWindowTitle("Mnemonic Recovery Phrase");
898  msgBox.setText("Below is your Mnemonic Recovery Phrase, consisting of 24 seed words. Please copy/write these words down in order. We strongly recommend keeping multiple copies in different locations.");
899  msgBox.setInformativeText("\n<b>" + phrase + "</b>");
900  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
901  msgBox.exec();
902 
903  if (msgBox.clickedButton() == copyButton) {
904  //Copy Mnemonic Recovery Phrase to clipboard
905  GUIUtil::setClipboard(phrase);
906  }
907 }
908 
910  checkForUnlock();
912  saveConsolidationSettingTime(ui->addNewFunds->isChecked());
913 }
914 
916 {
917  if (!pwalletMain->IsMasternodeController() && autoConsolidate) {
919  } else {
921  }
922 }
923 
925 {
926  if (ui->mapPortUpnp->isChecked()) {
927  settings.setValue("fUseUPnP", true);
928  } else {
929  settings.setValue("fUseUPnP", false);
930  }
931  QMessageBox msgBox;
932  msgBox.setWindowTitle("UPNP Settings");
933  msgBox.setIcon(QMessageBox::Information);
934  msgBox.setText("UPNP Settings successfully changed. Please restart the wallet for changes to take effect.");
935  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
936  msgBox.exec();
937 }
938 
940 {
941  if (ui->minimizeToTray->isChecked()) {
942  settings.setValue("fMinimizeToTray", true);
943  } else {
944  settings.setValue("fMinimizeToTray", false);
945  }
946 }
947 
949 {
950  if (ui->minimizeOnClose->isChecked()) {
951  settings.setValue("fMinimizeOnClose", true);
952  } else {
953  settings.setValue("fMinimizeOnClose", false);
954  }
955 }
956 
958 {
959  checkForUnlock();
960  bool twofastatus = pwalletMain->Read2FA();
961  if (twofastatus) {
962  QMessageBox::StandardButton reply;
963  reply = QMessageBox::question(this, "Are You Sure?", "2FA is currently activated. Are you sure you would like to change the number of digits anyway?\nThis is not recommended unless you know what you are doing.", QMessageBox::Yes|QMessageBox::No);
964  if (reply == QMessageBox::Yes) {
965  digit = ui->comboBox->currentText().toInt();
966  settings.setValue("2fadigits", digit);
967  QMessageBox msgBox;
968  msgBox.setWindowTitle("2FA Digit Settings");
969  msgBox.setIcon(QMessageBox::Information);
970  msgBox.setText("2FA Digit Settings have been changed successfully.");
971  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
972  msgBox.exec();
973  return;
974  } else {
975  QMessageBox msgBox;
976  msgBox.setWindowTitle("2FA Digit Settings");
977  msgBox.setIcon(QMessageBox::Information);
978  msgBox.setText("2FA Digit Settings have not been changed.");
979  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
980  msgBox.exec();
981  return;
982  }
983  }
984  digit = ui->comboBox->currentText().toInt();
985  settings.setValue("2fadigits", digit);
986 }
987 
988 
990 {
991  checkForUnlock();
992  bool twofastatus = pwalletMain->Read2FA();
993  if (twofastatus && ui->alwaysRequest2FA->isChecked()) {
994  settings.setValue("fAlwaysRequest2FA", true);
995  } else {
996  settings.setValue("fAlwaysRequest2FA", false);
997  }
998 }
999 
1001 {
1002  checkForUnlock();
1003  if (ui->alwaysRequestPassphrase->isChecked()) {
1004  settings.setValue("fAlwaysRequestPassphrase", true);
1005  } else {
1006  settings.setValue("fAlwaysRequestPassphrase", false);
1007  }
1008 }
1009 
1011  checkForUnlock();
1012  if (ui->hideBalanceStaking->isChecked()) {
1013  settings.setValue("fHideBalance", true);
1014  } else {
1015  QMessageBox::StandardButton reply;
1016  reply = QMessageBox::question(this, "Are You Sure?", "Are you sure you would like to disable your 'Hide Balance when unlocked'?\nYou will be required to enter your passphrase. Failed or canceled attempts will be logged.", QMessageBox::Yes|QMessageBox::No);
1017  if (reply == QMessageBox::Yes) {
1018  model->setWalletLocked(true);
1020  if (!ctx.isValid()) {
1021  QMessageBox msgBox;
1022  msgBox.setWindowTitle("Hide Balance When Unlocked");
1023  msgBox.setIcon(QMessageBox::Information);
1024  msgBox.setText("Attempt to Disable 'Hide Balance when unlocked' failed or canceled. Wallet Locked for security.");
1025  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
1026  msgBox.exec();
1027  LogPrintf("Attempt to Disable 'Hide Balance when unlocked' failed or canceled. Wallet Locked for security.\n");
1028  settings.setValue("fHideBalance", true);
1029  ui->hideBalanceStaking->setChecked(true);
1030  return;
1031  } else {
1032  SecureString pass;
1033  model->setWalletLocked(false, pass);
1034  settings.setValue("fHideBalance", false);
1035  LogPrintf("Disable 'Hide Balance when unlocked' successful.\n");
1036  }
1037  } else {
1038  LogPrintf("Attempt to Disable 'Hide Balance when unlocked' canceled.\n");
1039  settings.setValue("fHideBalance", true);
1040  ui->hideBalanceStaking->setChecked(true);
1041  return;
1042  }
1043  }
1044 }
1045 
1047  checkForUnlock();
1048  if (ui->lockSendStaking->isChecked()) {
1049  settings.setValue("fLockSendStaking", true);
1050  } else {
1051  QMessageBox::StandardButton reply;
1052  reply = QMessageBox::question(this, "Are You Sure?", "Are you sure you would like to disable your Lock Send Tab when unlocked?\nYou will be required to enter your passphrase. Failed or canceled attempts will be logged.", QMessageBox::Yes|QMessageBox::No);
1053  if (reply == QMessageBox::Yes) {
1054  model->setWalletLocked(true);
1056  if (!ctx.isValid()) {
1057  QMessageBox msgBox;
1058  msgBox.setWindowTitle("Lock Send Tab When Unlocked");
1059  msgBox.setIcon(QMessageBox::Information);
1060  msgBox.setText("Attempt to Disable 'Lock Send Tab when unlocked' failed or canceled. Wallet Locked for security.");
1061  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
1062  msgBox.exec();
1063  LogPrintf("Attempt to Disable 'Lock Send Tab when unlocked' failed or canceled. Wallet Locked for security.\n");
1064  settings.setValue("fLockSendStaking", true);
1065  ui->lockSendStaking->setChecked(true);
1066  return;
1067  } else {
1068  SecureString pass;
1069  model->setWalletLocked(false, pass);
1070  settings.setValue("fLockSendStaking", false);
1071  LogPrintf("Disable 'Lock Send Tab when unlocked' successful.\n");
1072  }
1073  } else {
1074  LogPrintf("Attempt to Disable 'Lock Send Tab when unlocked' canceled.\n");
1075  settings.setValue("fLockSendStaking", true);
1076  ui->lockSendStaking->setChecked(true);
1077  return;
1078  }
1079  }
1080 }
1081 
1082 
1084 {
1085  checkForUnlock();
1086  if (ui->displayCurrencyValue->isChecked()) {
1087  settings.setValue("fDisplayCurrencyValue", true);
1088  // Only set default USD if one doesn't already exist
1089  if (!settings.contains("strDefaultCurrency"))
1090  settings.setValue("strDefaultCurrency", "USD");
1091  } else {
1092  settings.setValue("fDisplayCurrencyValue", false);
1093  }
1094 }
1095 
1097 {
1098  checkForUnlock();
1099  settings.setValue("strDefaultCurrency", ui->defaultCurrency->currentText());
1100 }
1101 
1103 {
1104  int status = model->getEncryptionStatus();
1105  if (status == WalletModel::Locked || status == WalletModel::UnlockedForStakingOnly) {
1106  QMessageBox msgBox;
1107  msgBox.setWindowTitle("Password Locked Setting");
1108  msgBox.setIcon(QMessageBox::Information);
1109  msgBox.setText("Please unlock the wallet with your passphrase before changing this setting.");
1110  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
1111  msgBox.exec();
1112  return;
1113  }
1114 }
1115 
1117 {
1118  ui->lineEditOldPass->setEchoMode(ui->showPassphraseCheckBox->checkState() == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
1119  ui->lineEditNewPass->setEchoMode(ui->showPassphraseCheckBox->checkState() == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
1120  ui->lineEditNewPassRepeat->setEchoMode(ui->showPassphraseCheckBox->checkState() == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
1121 }
WalletModel::changePassphrase
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
Definition: walletmodel.cpp:425
CWallet::checkPassPhraseRule
bool checkPassPhraseRule(const char *pass)
Definition: wallet.cpp:187
2fadialog.h
WalletModel::getOptionsModel
OptionsModel * getOptionsModel()
Definition: walletmodel.cpp:358
UNSTAKABLE_BALANCE_TOO_LOW
@ UNSTAKABLE_BALANCE_TOO_LOW
Definition: wallet.h:226
WalletModel::stakingStatusChanged
void stakingStatusChanged(bool isStaking)
OptionsPage::getValidatedAmount
CAmount getValidatedAmount()
Definition: optionspage.cpp:193
OptionsPage::on_EnableStaking
void on_EnableStaking(ToggleButton *)
Definition: optionspage.cpp:436
TwoFAQRDialog::setModel
void setModel(WalletModel *model)
Definition: 2faqrdialog.cpp:51
OptionsPage::setDefaultCurrency
void setDefaultCurrency(int)
Definition: optionspage.cpp:1096
WalletModel::UnlockContext::isValid
bool isValid() const
Definition: walletmodel.h:195
OptionsPage::on_pushButtonBackup_clicked
void on_pushButtonBackup_clicked()
Definition: optionspage.cpp:367
CWallet::ReadStakingStatus
bool ReadStakingStatus()
Definition: wallet.cpp:370
OptionsPage::on_week
void on_week()
Definition: optionspage.cpp:820
OptionsPage::~OptionsPage
~OptionsPage()
Definition: optionspage.cpp:199
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:102
OptionsPage::dialogIsFinished
void dialogIsFinished(int result)
Definition: optionspage.cpp:691
OptionsPage::model
WalletModel * model
Definition: optionspage.h:67
OptionsPage::lockSendStaking_clicked
void lockSendStaking_clicked(int)
Definition: optionspage.cpp:1046
OptionsPage::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
Definition: optionspage.cpp:205
addressbookpage.h
chainActive
CChain chainActive
The currently-connected chain of blocks.
Definition: main.cpp:70
timedata.h
walletmodel.h
zxcvbn_password_strength
int zxcvbn_password_strength(const char *password, const char *const *user_inputs, zxcvbn_guesses_t *guesses, zxcvbn_match_sequence_t *pmseq)
Definition: zxcvbn.cpp:13
WalletModel::getStakingStatusError
StakingStatusError getStakingStatusError(QString &)
Definition: walletmodel.cpp:703
CWallet::Write2FALastTime
bool Write2FALastTime(uint64_t lastTime)
Definition: wallet.cpp:402
WalletModel::backupWallet
bool backupWallet(const QString &filename)
Definition: walletmodel.cpp:436
OptionsPage::on_pushButtonDisable_clicked
void on_pushButtonDisable_clicked()
Definition: optionspage.cpp:248
OptionsPage::setMapper
void setMapper()
Definition: optionspage.cpp:269
OptionsPage::changeTheme
void changeTheme(ToggleButton *widget)
Definition: optionspage.cpp:710
masternode-sync.h
CWallet::StakingCoinStatus
StakingStatusError StakingCoinStatus(CAmount &minFee, CAmount &maxFee)
Definition: wallet.cpp:2712
CWallet::ComputeFee
int ComputeFee(size_t numIn, size_t numOut, size_t ringSize)
Definition: wallet.cpp:3139
optionspage.h
OptionsPage::ui
Ui::OptionsPage * ui
Definition: optionspage.h:65
UNSTAKABLE_BALANCE_RESERVE_TOO_HIGH
@ UNSTAKABLE_BALANCE_RESERVE_TOO_HIGH
Definition: wallet.h:228
memcpy
void * memcpy(void *a, const void *b, size_t c)
Definition: glibc_compat.cpp:15
UNSTAKABLE_BALANCE_RESERVE_TOO_HIGH_CONSOLIDATION_FAILED
@ UNSTAKABLE_BALANCE_RESERVE_TOO_HIGH_CONSOLIDATION_FAILED
Definition: wallet.h:229
CWallet::WriteAutoConsolidateSettingTime
bool WriteAutoConsolidateSettingTime(uint32_t settingTime)
Definition: wallet.cpp:3156
OptionsPage::on_pushButtonSave_clicked
void on_pushButtonSave_clicked()
Definition: optionspage.cpp:210
zxcvbn.h
FormatMoney
std::string FormatMoney(const CAmount &n, bool fPlus)
Money parsing/formatting utilities.
Definition: utilmoneystr.cpp:13
OptionsPage::minimizeOnClose_clicked
void minimizeOnClose_clicked(int)
Definition: optionspage.cpp:948
OptionsPage::minimizeToTray_clicked
void minimizeToTray_clicked(int)
Definition: optionspage.cpp:939
2faqrdialog.h
OptionsPage::on_Enable2FA
void on_Enable2FA(ToggleButton *widget)
Definition: optionspage.cpp:644
OptionsPage::setModel
void setModel(WalletModel *model)
Definition: optionspage.cpp:178
UNSTAKABLE_BALANCE_TOO_LOW_CONSOLIDATION_FAILED
@ UNSTAKABLE_BALANCE_TOO_LOW_CONSOLIDATION_FAILED
Definition: wallet.h:227
GUIUtil::setClipboard
void setClipboard(const QString &str)
Definition: guiutil.cpp:785
CWallet::Write2FASecret
bool Write2FASecret(std::string secret)
Definition: wallet.cpp:384
masternodeSync
CMasternodeSync masternodeSync
Definition: masternode-sync.cpp:19
TwoFADialog
Definition: 2fadialog.h:11
OptionsPage::saveConsolidationSettingTime
void saveConsolidationSettingTime(bool)
Definition: optionspage.cpp:915
StakingStatusError
StakingStatusError
Definition: wallet.h:223
MAX_RING_SIZE
int MAX_RING_SIZE
Definition: main.cpp:92
OptionsPage::onOldPassChanged
void onOldPassChanged()
Definition: optionspage.cpp:409
MONTH
@ MONTH
Definition: optionspage.h:30
OptionsPage::enable2FA
void enable2FA()
Definition: optionspage.cpp:738
TwoFAQRDialog
Definition: 2faqrdialog.h:13
STAKABLE_NEED_CONSOLIDATION
@ STAKABLE_NEED_CONSOLIDATION
Definition: wallet.h:230
nReserveBalance
int64_t nReserveBalance
Definition: wallet.cpp:59
ToggleButton::setState
void setState(bool value)
Definition: togglebutton.cpp:47
WEEK
@ WEEK
Definition: optionspage.h:29
WalletModel::getCWallet
CWallet * getCWallet()
Definition: walletmodel.cpp:574
fLiteMode
bool fLiteMode
Definition: util.cpp:100
OptionsPage::options
OptionsModel * options
Definition: optionspage.h:68
CWallet::IsMasternodeController
bool IsMasternodeController()
Definition: wallet.cpp:3058
STAKING_OK
@ STAKING_OK
Definition: wallet.h:225
OptionsPage::on_pushButtonPassword_clicked
void on_pushButtonPassword_clicked()
Definition: optionspage.cpp:273
SecureString
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: allocators.h:262
AskPassphraseDialog::Context::Unlock_Full
@ Unlock_Full
Unlock wallet from menu
WalletModel::generateCoins
void generateCoins(bool fGenerate, int nGenProcLimit)
Definition: walletmodel.cpp:732
OptionsPage::on_month
void on_month()
Definition: optionspage.cpp:830
WalletModel::getEncryptionStatus
EncryptionStatus getEncryptionStatus() const
Definition: walletmodel.cpp:373
GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
Definition: util.cpp:255
OptionsPage::matchNewPasswords
bool matchNewPasswords()
Definition: optionspage.cpp:421
CWalletDB
Access to the wallet database (wallet.dat)
Definition: walletdb.h:80
OptionsPage::alwaysRequest2FA_clicked
void alwaysRequest2FA_clicked(int)
Definition: optionspage.cpp:989
LogPrintf
#define LogPrintf(...)
Definition: logging.h:147
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
ToggleButton
Definition: togglebutton.h:16
guiutil.h
CWallet::Read2FAPeriod
int Read2FAPeriod()
Definition: wallet.cpp:397
OptionsPage::validateNewPass
void validateNewPass()
Definition: optionspage.cpp:395
OptionsPage::typeOf2FA
Type2FA typeOf2FA
Definition: optionspage.h:74
WalletModel::getSeedPhrase
bool getSeedPhrase(std::string &phrase) const
Definition: walletmodel.cpp:591
WalletModel::Locked
@ Locked
Definition: walletmodel.h:126
CWallet::IsAutoConsolidateOn
bool IsAutoConsolidateOn()
Definition: wallet.cpp:3166
fGeneratePrcycoins
bool fGeneratePrcycoins
2faconfirmdialog.h
CMasternodeSync::IsSynced
bool IsSynced()
Definition: masternode-sync.cpp:27
CChain::Height
int Height() const
Return the maximal height in the chain.
Definition: chain.h:641
SetRingSize
void SetRingSize(int nHeight)
Definition: main.cpp:2466
OptionsPage::on_day
void on_day()
Definition: optionspage.cpp:810
BitcoinUnits::format
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string.
Definition: bitcoinunits.cpp:140
OptionsPage::onShowMnemonic
void onShowMnemonic()
Definition: optionspage.cpp:840
OptionsPage::mapper
QDataWidgetMapper * mapper
Definition: optionspage.h:69
OptionsPage::setStakingToggle
void setStakingToggle()
Definition: optionspage.cpp:173
GUIUtil::getSaveFileName
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
Definition: guiutil.cpp:239
nLastCoinStakeSearchInterval
int64_t nLastCoinStakeSearchInterval
Definition: miner.cpp:67
OptionsPage::qrDialogIsFinished
void qrDialogIsFinished(int result)
Definition: optionspage.cpp:677
NONE2FA
@ NONE2FA
Definition: optionspage.h:27
CWallet::fCombineDust
bool fCombineDust
Definition: wallet.h:331
OptionsPage::timerStakingToggleSync
QTimer * timerStakingToggleSync
Definition: optionspage.h:77
OptionsPage::OptionsPage
OptionsPage(QWidget *parent=0)
Definition: optionspage.cpp:37
GetAdjustedTime
int64_t GetAdjustedTime()
Definition: timedata.cpp:30
Ui
Definition: 2faconfirmdialog.h:7
CWallet::CreateSweepingTransaction
bool CreateSweepingTransaction(CAmount target, CAmount threshold, uint32_t nTimeBefore)
Definition: wallet.cpp:5472
guiconstants.h
WalletModel::UnlockContext
Definition: walletmodel.h:189
WalletModel::getMinStakingAmount
CAmount getMinStakingAmount() const
Definition: walletmodel.cpp:72
ON
@ ON
Definition: wallet.h:236
utilmoneystr.h
OptionsPage::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Definition: optionspage.cpp:263
LOCK
#define LOCK(cs)
Definition: sync.h:182
OptionsPage::mapPortUpnp_clicked
void mapPortUpnp_clicked(int)
Definition: optionspage.cpp:924
OptionsPage::disable2FA
void disable2FA()
Definition: optionspage.cpp:718
OptionsPage::confirmDialogIsFinished
void confirmDialogIsFinished(int result)
Definition: optionspage.cpp:780
DISABLE
@ DISABLE
Definition: optionspage.h:31
OptionsPage::on_showPassphraseCheckBox_clicked
void on_showPassphraseCheckBox_clicked()
Definition: optionspage.cpp:1116
OptionsPage
Dialog for options page.
Definition: optionspage.h:45
OptionsPage::alwaysRequestPassphrase_clicked
void alwaysRequestPassphrase_clicked(int)
Definition: optionspage.cpp:1000
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:463
bitcoinunits.h
WalletModel::setWalletLocked
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString(), bool stakingOnly=false)
Definition: walletmodel.cpp:397
bitcoingui.h
CWallet::cs_wallet
RecursiveMutex cs_wallet
Definition: wallet.h:301
CWallet::Read2FASecret
std::string Read2FASecret()
Definition: wallet.cpp:388
CWallet::combineMode
CombineMode combineMode
Definition: wallet.h:365
WalletModel::UnlockedForStakingOnly
@ UnlockedForStakingOnly
Definition: walletmodel.h:128
OptionsPage::checkForUnlock
void checkForUnlock()
Definition: optionspage.cpp:1102
OptionsPage::settings
QSettings settings
Definition: optionspage.h:70
optionsmodel.h
CWallet::WriteStakingStatus
bool WriteStakingStatus(bool status)
Definition: wallet.cpp:366
OptionsPage::hideBalanceStaking_clicked
void hideBalanceStaking_clicked(int)
Definition: optionspage.cpp:1010
CWalletDB::WriteReserveAmount
bool WriteReserveAmount(const double &amount)
Definition: walletdb.cpp:161
GUIUtil::loadStyleSheet
QString loadStyleSheet()
Load global CSS theme.
Definition: guiutil.cpp:721
ToggleButton::getState
bool getState()
Definition: togglebutton.cpp:44
CWallet::Read2FA
bool Read2FA()
Definition: wallet.cpp:379
CWallet::strWalletFile
std::string strWalletFile
Definition: wallet.h:305
GUIUtil::refreshStyleSheet
void refreshStyleSheet()
Refresh App theme.
Definition: guiutil.cpp:742
pwalletMain
CWallet * pwalletMain
Definition: wallet.cpp:49
receiverequestdialog.h
OptionsPage::on_pushButtonPasswordClear_clicked
void on_pushButtonPasswordClear_clicked()
Definition: optionspage.cpp:357
WalletModel::requestUnlock
UnlockContext requestUnlock(AskPassphraseDialog::Context context, bool relock=false)
Definition: walletmodel.cpp:546
addresstablemodel.h
CWallet::Write2FAPeriod
bool Write2FAPeriod(int period)
Definition: wallet.cpp:393
DAY
@ DAY
Definition: optionspage.h:28
OptionsPage::setAutoConsolidate
void setAutoConsolidate(int)
Definition: optionspage.cpp:909
OptionsPage::changeDigits
void changeDigits(int)
Definition: optionspage.cpp:957
OptionsPage::validateNewPassRepeat
void validateNewPassRepeat()
Definition: optionspage.cpp:404
error
bool error(const char *fmt, const Args &... args)
Definition: util.h:61
CWallet::Write2FA
bool Write2FA(bool status)
Definition: wallet.cpp:375
OptionsPage::displayCurrencyValue_clicked
void displayCurrencyValue_clicked(int)
Definition: optionspage.cpp:1083
CWallet::ReadAutoConsolidateSettingTime
uint32_t ReadAutoConsolidateSettingTime()
Definition: wallet.cpp:3161