Staking options menu

Lock and unlock menu options
This commit is contained in:
cygnusxi 2017-07-12 14:57:47 -04:00 committed by GitHub
commit 4118d9928a
2 changed files with 27 additions and 0 deletions

View File

@ -64,6 +64,8 @@ curecoinGUI::curecoinGUI(QWidget *parent):
walletModel(0), walletModel(0),
encryptWalletAction(0), encryptWalletAction(0),
changePassphraseAction(0), changePassphraseAction(0),
unlockWalletAction(0),
lockWalletAction(0),
aboutQtAction(0), aboutQtAction(0),
trayIcon(0), trayIcon(0),
notificator(0), notificator(0),
@ -255,6 +257,10 @@ void curecoinGUI::createActions()
backupWalletAction->setToolTip(tr("Backup wallet to another location")); backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
unlockWalletAction = new QAction(QIcon(":/icons/lock_open"), tr("&Unlock Wallet..."), this);
unlockWalletAction->setToolTip(tr("Unlock wallet"));
lockWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Lock Wallet"), this);
lockWalletAction->setToolTip(tr("Lock wallet"));
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
@ -271,6 +277,8 @@ void curecoinGUI::createActions()
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); 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(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
} }
@ -297,6 +305,8 @@ void curecoinGUI::createMenuBar()
QMenu *settings = appMenuBar->addMenu(tr("&Settings")); QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
settings->addAction(encryptWalletAction); settings->addAction(encryptWalletAction);
settings->addAction(changePassphraseAction); settings->addAction(changePassphraseAction);
settings->addAction(unlockWalletAction);
settings->addAction(lockWalletAction);
settings->addSeparator(); settings->addSeparator();
settings->addAction(optionsAction); settings->addAction(optionsAction);
@ -786,6 +796,8 @@ void curecoinGUI::setEncryptionStatus(int status)
labelEncryptionIcon->hide(); labelEncryptionIcon->hide();
encryptWalletAction->setChecked(false); encryptWalletAction->setChecked(false);
changePassphraseAction->setEnabled(false); changePassphraseAction->setEnabled(false);
unlockWalletAction->setVisible(false);
lockWalletAction->setVisible(false);
encryptWalletAction->setEnabled(true); encryptWalletAction->setEnabled(true);
break; break;
case WalletModel::Unlocked: case WalletModel::Unlocked:
@ -794,6 +806,8 @@ void curecoinGUI::setEncryptionStatus(int status)
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>")); labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
encryptWalletAction->setChecked(true); encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true); changePassphraseAction->setEnabled(true);
unlockWalletAction->setVisible(false);
lockWalletAction->setVisible(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break; break;
case WalletModel::Locked: case WalletModel::Locked:
@ -801,6 +815,8 @@ void curecoinGUI::setEncryptionStatus(int status)
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>")); labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
encryptWalletAction->setChecked(true); encryptWalletAction->setChecked(true);
unlockWalletAction->setVisible(true);
lockWalletAction->setVisible(false);
changePassphraseAction->setEnabled(true); changePassphraseAction->setEnabled(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break; break;
@ -837,6 +853,14 @@ void curecoinGUI::changePassphrase()
dlg.exec(); dlg.exec();
} }
void curecoinGUI::lockWallet()
{
if(!walletModel)
return;
walletModel->setWalletLocked(true);
}
void curecoinGUI::unlockWallet() void curecoinGUI::unlockWallet()
{ {
if(!walletModel) if(!walletModel)

View File

@ -88,6 +88,8 @@ private:
QAction *encryptWalletAction; QAction *encryptWalletAction;
QAction *backupWalletAction; QAction *backupWalletAction;
QAction *changePassphraseAction; QAction *changePassphraseAction;
QAction *unlockWalletAction;
QAction *lockWalletAction;
QAction *aboutQtAction; QAction *aboutQtAction;
QAction *openRPCConsoleAction; QAction *openRPCConsoleAction;
@ -169,6 +171,7 @@ private slots:
void changePassphrase(); void changePassphrase();
/** Ask for passphrase to unlock wallet temporarily */ /** Ask for passphrase to unlock wallet temporarily */
void unlockWallet(); void unlockWallet();
void lockWallet();
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized(bool fToggleHidden = false); void showNormalIfMinimized(bool fToggleHidden = false);