|
|
|
@ -474,6 +474,8 @@ void MainWindow::initMenu() {
|
|
|
|
|
Utils::showMessageBox("Address book exported", QString("Address book exported to %1").arg(fn), false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(ui->actionImportContactsCSV, &QAction::triggered, this, &MainWindow::importContacts);
|
|
|
|
|
|
|
|
|
|
// Tools
|
|
|
|
|
connect(ui->actionSignVerify, &QAction::triggered, this, &MainWindow::menuSignVerifyClicked);
|
|
|
|
|
connect(ui->actionVerifyTxProof, &QAction::triggered, this, &MainWindow::menuVerifyTxProof);
|
|
|
|
@ -545,12 +547,13 @@ void MainWindow::onWalletCreatedError(const QString &err) {
|
|
|
|
|
this->showWizard(WalletWizard::Page_CreateWallet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::onWalletOpenPasswordRequired(bool invalidPassword) {
|
|
|
|
|
void MainWindow::onWalletOpenPasswordRequired(bool invalidPassword, const QString &path) {
|
|
|
|
|
QFileInfo fileInfo(path);
|
|
|
|
|
QInputDialog passwordDialog(this);
|
|
|
|
|
passwordDialog.setInputMode(QInputDialog::TextInput);
|
|
|
|
|
passwordDialog.setTextEchoMode(QLineEdit::Password);
|
|
|
|
|
passwordDialog.setWindowTitle("Password required");
|
|
|
|
|
passwordDialog.setLabelText("Please enter wallet password.");
|
|
|
|
|
passwordDialog.setLabelText(QString("Please enter %1 wallet password.").arg(fileInfo.fileName()));
|
|
|
|
|
passwordDialog.resize(300, 100);
|
|
|
|
|
if(!(bool)passwordDialog.exec())
|
|
|
|
|
return this->showWizard(WalletWizard::Page_OpenWallet);
|
|
|
|
@ -1045,6 +1048,29 @@ void MainWindow::onAddContact(const QString &address, const QString &name) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::importContacts() {
|
|
|
|
|
const QString targetFile = QFileDialog::getOpenFileName(this, "Import CSV file", QDir::homePath(), "CSV Files (*.csv)");
|
|
|
|
|
if(targetFile.isEmpty()) return;
|
|
|
|
|
|
|
|
|
|
auto *model = m_ctx->currentWallet->addressBookModel();
|
|
|
|
|
QMapIterator<QString, QString> i(model->readCSV(targetFile));
|
|
|
|
|
int inserts = 0;
|
|
|
|
|
while (i.hasNext()) {
|
|
|
|
|
i.next();
|
|
|
|
|
bool addressValid = WalletManager::addressValid(i.value(), m_ctx->currentWallet->nettype());
|
|
|
|
|
if(addressValid) {
|
|
|
|
|
m_ctx->currentWallet->addressBook()->addRow(i.value(), "", i.key());
|
|
|
|
|
inserts++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(inserts > 0) {
|
|
|
|
|
m_ctx->storeWallet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QMessageBox::information(this, "Contacts imported", QString("Total contacts imported: %1").arg(inserts));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow *MainWindow::getInstance() {
|
|
|
|
|
return pMainWindow;
|
|
|
|
|
}
|
|
|
|
|