diff --git a/src/qt/curecoingui.cpp b/src/qt/curecoingui.cpp
index 7fc20da..4dcd126 100644
--- a/src/qt/curecoingui.cpp
+++ b/src/qt/curecoingui.cpp
@@ -64,6 +64,8 @@ curecoinGUI::curecoinGUI(QWidget *parent):
walletModel(0),
encryptWalletAction(0),
changePassphraseAction(0),
+ unlockWalletAction(0),
+ lockWalletAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
@@ -255,6 +257,10 @@ void curecoinGUI::createActions()
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
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);
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(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()));
}
@@ -297,6 +305,8 @@ void curecoinGUI::createMenuBar()
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
settings->addAction(encryptWalletAction);
settings->addAction(changePassphraseAction);
+ settings->addAction(unlockWalletAction);
+ settings->addAction(lockWalletAction);
settings->addSeparator();
settings->addAction(optionsAction);
@@ -786,6 +796,8 @@ void curecoinGUI::setEncryptionStatus(int status)
labelEncryptionIcon->hide();
encryptWalletAction->setChecked(false);
changePassphraseAction->setEnabled(false);
+ unlockWalletAction->setVisible(false);
+ lockWalletAction->setVisible(false);
encryptWalletAction->setEnabled(true);
break;
case WalletModel::Unlocked:
@@ -794,6 +806,8 @@ void curecoinGUI::setEncryptionStatus(int status)
labelEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently unlocked"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
+ unlockWalletAction->setVisible(false);
+ lockWalletAction->setVisible(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
case WalletModel::Locked:
@@ -801,6 +815,8 @@ void curecoinGUI::setEncryptionStatus(int status)
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently locked"));
encryptWalletAction->setChecked(true);
+ unlockWalletAction->setVisible(true);
+ lockWalletAction->setVisible(false);
changePassphraseAction->setEnabled(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
@@ -837,6 +853,14 @@ void curecoinGUI::changePassphrase()
dlg.exec();
}
+void curecoinGUI::lockWallet()
+{
+ if(!walletModel)
+ return;
+
+ walletModel->setWalletLocked(true);
+}
+
void curecoinGUI::unlockWallet()
{
if(!walletModel)
diff --git a/src/qt/curecoingui.h b/src/qt/curecoingui.h
index 6369cfd..a8d7892 100644
--- a/src/qt/curecoingui.h
+++ b/src/qt/curecoingui.h
@@ -88,6 +88,8 @@ private:
QAction *encryptWalletAction;
QAction *backupWalletAction;
QAction *changePassphraseAction;
+ QAction *unlockWalletAction;
+ QAction *lockWalletAction;
QAction *aboutQtAction;
QAction *openRPCConsoleAction;
@@ -169,6 +171,7 @@ private slots:
void changePassphrase();
/** Ask for passphrase to unlock wallet temporarily */
void unlockWallet();
+ void lockWallet();
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
void showNormalIfMinimized(bool fToggleHidden = false);