|
@@ -258,6 +258,10 @@ void BitcoinGUI::createActions() |
|
|
encryptWalletAction->setCheckable(true); |
|
|
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); |
|
|
backupWalletAction->setStatusTip(tr("Backup wallet to another location")); |
|
|
dumpWalletAction = new QAction(QIcon(":/icons/export2"), tr("&Export Wallet..."), this); |
|
|
dumpWalletAction->setStatusTip(tr("Export wallet's keys to a text file")); |
|
|
importWalletAction = new QAction(QIcon(":/icons/import"), tr("&Import Wallet..."), this); |
|
|
importWalletAction->setStatusTip(tr("Import a file's keys into a wallet")); |
|
|
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); |
|
|
changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); |
|
|
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); |
|
@@ -282,6 +286,8 @@ void BitcoinGUI::createActions() |
|
|
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); |
|
|
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); |
|
|
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); |
|
|
connect(dumpWalletAction, SIGNAL(triggered()), this, SLOT(dumpWallet())); |
|
|
connect(importWalletAction, SIGNAL(triggered()), this, SLOT(importWallet())); |
|
|
} |
|
|
|
|
|
void BitcoinGUI::createMenuBar() |
|
@@ -297,6 +303,10 @@ void BitcoinGUI::createMenuBar() |
|
|
// Configure the menus |
|
|
QMenu *file = appMenuBar->addMenu(tr("&File")); |
|
|
file->addAction(backupWalletAction); |
|
|
file->addSeparator(); |
|
|
file->addAction(dumpWalletAction); |
|
|
file->addAction(importWalletAction); |
|
|
file->addSeparator(); |
|
|
file->addAction(exportAction); |
|
|
file->addAction(signMessageAction); |
|
|
file->addAction(verifyMessageAction); |
|
@@ -886,6 +896,73 @@ void BitcoinGUI::backupWallet() |
|
|
} |
|
|
} |
|
|
|
|
|
void BitcoinGUI::dumpWallet() |
|
|
{ |
|
|
if(!walletModel) |
|
|
return; |
|
|
|
|
|
WalletModel::UnlockContext ctx(walletModel->requestUnlock()); |
|
|
if(!ctx.isValid()) |
|
|
{ |
|
|
// Unlock wallet failed or was cancelled |
|
|
return; |
|
|
} |
|
|
|
|
|
#if QT_VERSION < 0x050000 |
|
|
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); |
|
|
#else |
|
|
QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); |
|
|
#endif |
|
|
QString filename = QFileDialog::getSaveFileName(this, tr("Export Wallet"), saveDir, tr("Wallet Text (*.txt)")); |
|
|
if(!filename.isEmpty()) { |
|
|
if(!walletModel->dumpWallet(filename)) { |
|
|
message(tr("Export Failed"), |
|
|
tr("There was an error trying to save the wallet's keys to your location.\n" |
|
|
"Keys were not saved") |
|
|
,CClientUIInterface::MSG_ERROR); |
|
|
} |
|
|
else |
|
|
message(tr("Export Successful"), |
|
|
tr("Keys were saved to:\n %1") |
|
|
.arg(filename) |
|
|
,CClientUIInterface::MSG_INFORMATION); |
|
|
} |
|
|
} |
|
|
|
|
|
void BitcoinGUI::importWallet() |
|
|
{ |
|
|
if(!walletModel) |
|
|
return; |
|
|
|
|
|
WalletModel::UnlockContext ctx(walletModel->requestUnlock()); |
|
|
if(!ctx.isValid()) |
|
|
{ |
|
|
// Unlock wallet failed or was cancelled |
|
|
return; |
|
|
} |
|
|
|
|
|
#if QT_VERSION < 0x050000 |
|
|
QString openDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); |
|
|
#else |
|
|
QString openDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); |
|
|
#endif |
|
|
QString filename = QFileDialog::getOpenFileName(this, tr("Import Wallet"), openDir, tr("Wallet Text (*.txt)")); |
|
|
if(!filename.isEmpty()) { |
|
|
if(!walletModel->importWallet(filename)) { |
|
|
message(tr("Import Failed"), |
|
|
tr("There was an error trying to import the file's keys into your wallet.\n" |
|
|
"Some or all keys were not imported from walletfile: %1") |
|
|
.arg(filename) |
|
|
,CClientUIInterface::MSG_ERROR); |
|
|
} |
|
|
else |
|
|
message(tr("Import Successful"), |
|
|
tr("Keys %1, were imported into wallet.") |
|
|
.arg(filename) |
|
|
,CClientUIInterface::MSG_INFORMATION); |
|
|
} |
|
|
} |
|
|
|
|
|
void BitcoinGUI::changePassphrase() |
|
|
{ |
|
|
AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this); |
|
|
0 comments on commit
377b1d8