void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Dashboard"), this); overviewAction->setToolTip(tr("Show general overview of wallet")); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(receiveCoinsAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setToolTip(tr("Send coins to a Sentaro address")); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(sendCoinsAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setToolTip(tr("Browse transaction history")); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this); addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setCheckable(true); addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); tabGroup->addAction(addressBookAction); masternodeManagerAction = new QAction(QIcon(":/icons/sentaro"), tr("&Sentaro Net"), this); masternodeManagerAction->setToolTip(tr("Show Panaces network nodes status and configure your nodes.")); masternodeManagerAction->setCheckable(true); masternodeManagerAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6)); tabGroup->addAction(masternodeManagerAction); connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); connect(masternodeManagerAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(masternodeManagerAction, SIGNAL(triggered()), this, SLOT(gotoMasternodeManagerPage())); quitAction = new QAction(tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(tr("&About Sentaro"), this); aboutAction->setToolTip(tr("Show information about Sentaro")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setToolTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(tr("&Options..."), this); optionsAction->setToolTip(tr("Modify configuration options for Sentaro")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/sentaro"), tr("&Show / Hide"), this); encryptWalletAction = new QAction(tr("&Encrypt Wallet..."), this); encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet")); backupWalletAction = new QAction(tr("&Backup Wallet..."), this); backupWalletAction->setToolTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(tr("&Change Passphrase..."), this); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); unlockWalletAction = new QAction(tr("&Unlock Wallet..."), this); unlockWalletAction->setToolTip(tr("Unlock wallet")); lockWalletAction = new QAction(tr("&Lock Wallet"), this); lockWalletAction->setToolTip(tr("Lock wallet")); signMessageAction = new QAction(tr("Sign &message..."), this); verifyMessageAction = new QAction(tr("&Verify message..."), this); exportAction = new QAction(tr("&Export..."), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); openRPCConsoleAction = new QAction(tr("&Debug window"), this); openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(encryptWalletAction, SIGNAL(triggered()), this, SLOT(encryptWallet())); connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet())); connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); }
AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) : QDialog(parent), ui(new Ui::AskPassphraseDialog), mode(mode), model(0), fCapsLock(false) { ui->setupUi(this); ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE); ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE); ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE); // Setup Caps Lock detection. ui->passEdit1->installEventFilter(this); ui->passEdit2->installEventFilter(this); ui->passEdit3->installEventFilter(this); bool addUnlockButton = false; bool addUnlockStakingOnlyButton = false; bool addCancelButton = true; bool addOkButton = false; buttonOk = NULL; buttonCancel = NULL; buttonUnlock = NULL; buttonUnlockStakingOnly = NULL; switch(mode) { case Encrypt: // Ask passphrase x2 addOkButton = true; ui->passLabel1->hide(); ui->passEdit1->hide(); ui->warningLabel->setText(tr("Enter the new passphrase to the vault.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.")); setWindowTitle(tr("Encrypt Vault")); break; case UnlockFullOnly: addUnlockButton = true; addUnlockStakingOnlyButton = false; ui->warningLabel->setText(tr("This operation needs your vault passphrase to unlock the vault.")); ui->passLabel2->hide(); ui->passEdit2->hide(); ui->passLabel3->hide(); ui->passEdit3->hide(); setWindowTitle(tr("Unlock vault")); break; case Unlock: // Ask passphrase addUnlockButton = true; addUnlockStakingOnlyButton = true; ui->warningLabel->setText(tr("This operation needs your vault passphrase to unlock the vault.")); ui->passLabel2->hide(); ui->passEdit2->hide(); ui->passLabel3->hide(); ui->passEdit3->hide(); setWindowTitle(tr("Unlock vault")); break; case Decrypt: // Ask passphrase ui->warningLabel->setText(tr("This operation needs your vault passphrase to decrypt the vault.")); ui->passLabel2->hide(); ui->passEdit2->hide(); ui->passLabel3->hide(); ui->passEdit3->hide(); setWindowTitle(tr("Decrypt Vault")); break; case ChangePass: // Ask old passphrase + new passphrase x2 addOkButton = true; setWindowTitle(tr("Change passphrase")); ui->warningLabel->setText(tr("Enter the old and new passphrase to the vault.")); break; } if (addUnlockButton){ buttonUnlock = new QPushButton(tr("&Unlock")); buttonUnlock->setDefault(true); ui->buttonBox->addButton(buttonUnlock, QDialogButtonBox::ActionRole); connect(buttonUnlock, SIGNAL(clicked()), this, SLOT(unlockWallet())); GUIUtil::SetupPushButton(buttonUnlock); } if (addUnlockStakingOnlyButton && !fWalletUnlockMintOnly){ buttonUnlockStakingOnly = new QPushButton(tr("U&nlock for Staking only")); buttonUnlockStakingOnly->setDefault(true); ui->buttonBox->addButton(buttonUnlockStakingOnly, QDialogButtonBox::ActionRole); connect(buttonUnlockStakingOnly, SIGNAL(clicked()), this, SLOT(unlockWalletForStakingOnly())); GUIUtil::SetupPushButton(buttonUnlockStakingOnly); } if (addOkButton){ buttonOk = new QPushButton(tr("&Ok")); buttonOk->setDefault(false); ui->buttonBox->addButton(buttonOk, QDialogButtonBox::ActionRole); connect(buttonOk, SIGNAL(clicked()), this, SLOT(encryptWallet())); GUIUtil::SetupPushButton(buttonOk); } if (addCancelButton){ buttonCancel = new QPushButton(tr("&Cancel")); buttonCancel->setDefault(true); ui->buttonBox->addButton(buttonCancel, QDialogButtonBox::ActionRole); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(closeForm())); GUIUtil::SetupPushButton(buttonCancel); } textChanged(); connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); }