2020-12-31 05:48:25 -03:00
|
|
|
// Copyright (c) 2011-2020 The Bitcoin Core developers
|
2014-12-13 01:09:33 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-11-04 12:20:43 -03:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 12:16:40 -03:00
|
|
|
#ifndef BITCOIN_QT_ASKPASSPHRASEDIALOG_H
|
|
|
|
#define BITCOIN_QT_ASKPASSPHRASEDIALOG_H
|
2011-08-24 17:07:26 -03:00
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
2019-05-24 15:14:54 -04:00
|
|
|
#include <support/allocators/secure.h>
|
|
|
|
|
2013-04-13 02:13:08 -03:00
|
|
|
class WalletModel;
|
|
|
|
|
2011-08-24 17:07:26 -03:00
|
|
|
namespace Ui {
|
|
|
|
class AskPassphraseDialog;
|
|
|
|
}
|
|
|
|
|
2011-11-13 09:19:52 -03:00
|
|
|
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.
|
|
|
|
*/
|
2011-08-24 17:07:26 -03:00
|
|
|
class AskPassphraseDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Mode {
|
2011-11-13 09:19:52 -03:00
|
|
|
Encrypt, /**< Ask passphrase twice and encrypt */
|
|
|
|
Unlock, /**< Ask passphrase and unlock */
|
|
|
|
ChangePass, /**< Ask old passphrase + new passphrase twice */
|
2011-08-24 17:07:26 -03:00
|
|
|
};
|
|
|
|
|
2019-05-24 15:14:54 -04:00
|
|
|
explicit AskPassphraseDialog(Mode mode, QWidget *parent, SecureString* passphrase_out = nullptr);
|
2011-08-24 17:07:26 -03:00
|
|
|
~AskPassphraseDialog();
|
|
|
|
|
2020-03-14 03:49:59 -03:00
|
|
|
void accept() override;
|
2011-08-24 17:07:26 -03:00
|
|
|
|
|
|
|
void setModel(WalletModel *model);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::AskPassphraseDialog *ui;
|
|
|
|
Mode mode;
|
|
|
|
WalletModel *model;
|
2011-10-15 15:56:06 -03:00
|
|
|
bool fCapsLock;
|
2019-05-24 15:14:54 -04:00
|
|
|
SecureString* m_passphrase_out;
|
2011-08-24 17:07:26 -03:00
|
|
|
|
2015-07-14 08:59:05 -03:00
|
|
|
private Q_SLOTS:
|
2011-08-24 17:07:26 -03:00
|
|
|
void textChanged();
|
2015-08-02 21:03:14 -03:00
|
|
|
void secureClearPassFields();
|
2017-10-11 01:50:01 -03:00
|
|
|
void toggleShowPassword(bool);
|
2013-11-05 15:18:40 -03:00
|
|
|
|
|
|
|
protected:
|
2020-03-14 03:49:59 -03:00
|
|
|
bool event(QEvent *event) override;
|
|
|
|
bool eventFilter(QObject *object, QEvent *event) override;
|
2011-08-24 17:07:26 -03:00
|
|
|
};
|
|
|
|
|
2014-11-03 12:16:40 -03:00
|
|
|
#endif // BITCOIN_QT_ASKPASSPHRASEDIALOG_H
|