mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-13 16:48:08 +00:00
Handled key-value related operations when wallet is locked.
This commit is contained in:
parent
a13b6aa276
commit
d1d91a96af
@ -289,7 +289,6 @@ void KevaDialog::kevaView_selectionChanged()
|
||||
bool enable = !ui->kevaView->selectionModel()->selectedRows().isEmpty();
|
||||
ui->showValueButton->setEnabled(enable);
|
||||
ui->removeButton->setEnabled(enable);
|
||||
ui->addKVButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
void KevaDialog::on_showValueButton_clicked()
|
||||
@ -335,6 +334,11 @@ void KevaDialog::on_removeButton_clicked()
|
||||
case WalletModel::KeyNotFound:
|
||||
msg = tr("Key not found: \"%1\".").arg(keyStr);
|
||||
break;
|
||||
case WalletModel::InsufficientFund:
|
||||
msg = tr("Insufficient funds");
|
||||
break;
|
||||
case WalletModel::WalletLocked:
|
||||
return;
|
||||
default:
|
||||
msg = tr("Unknown error.");
|
||||
}
|
||||
@ -460,6 +464,8 @@ int KevaDialog::createNamespace(std::string displayName, std::string& namespaceI
|
||||
case WalletModel::InsufficientFund:
|
||||
msg = tr("Insufficient funds");
|
||||
break;
|
||||
case WalletModel::WalletLocked:
|
||||
return 0;
|
||||
default:
|
||||
msg = tr("Unknown error.");
|
||||
}
|
||||
@ -488,6 +494,11 @@ int KevaDialog::addKeyValue(std::string& namespaceId, std::string& key, std::str
|
||||
case WalletModel::ValueTooLong:
|
||||
msg = tr("Value too long.");
|
||||
break;
|
||||
case WalletModel::InsufficientFund:
|
||||
msg = tr("Insufficient funds");
|
||||
break;
|
||||
case WalletModel::WalletLocked:
|
||||
return 0;
|
||||
default:
|
||||
msg = tr("Unknown error.");
|
||||
}
|
||||
|
@ -896,6 +896,11 @@ int WalletModel::createNamespace(std::string displayNameStr, std::string& namesp
|
||||
return NamespaceTooLong;
|
||||
}
|
||||
|
||||
WalletModel::UnlockContext ctx(requestUnlock());
|
||||
if(!ctx.isValid()) {
|
||||
return WalletLocked;
|
||||
}
|
||||
|
||||
CReserveKey keyName(wallet);
|
||||
CPubKey pubKey;
|
||||
const bool ok = keyName.GetReservedKey(pubKey, true);
|
||||
@ -929,7 +934,6 @@ int WalletModel::createNamespace(std::string displayNameStr, std::string& namesp
|
||||
}
|
||||
|
||||
keyName.KeepKey();
|
||||
|
||||
namespaceId = EncodeBase58Check(kevaNamespace);
|
||||
return 0;
|
||||
}
|
||||
@ -947,6 +951,11 @@ int WalletModel::deleteKevaEntry(std::string namespaceStr, std::string keyStr)
|
||||
return KeyTooLong;
|
||||
}
|
||||
|
||||
WalletModel::UnlockContext ctx(requestUnlock());
|
||||
if(!ctx.isValid()) {
|
||||
return WalletLocked;
|
||||
}
|
||||
|
||||
bool hasKey = false;
|
||||
CKevaData data;
|
||||
{
|
||||
@ -1013,6 +1022,11 @@ int WalletModel::addKeyValue(std::string& namespaceStr, std::string& keyStr, std
|
||||
return ValueTooLong;
|
||||
}
|
||||
|
||||
WalletModel::UnlockContext ctx(requestUnlock());
|
||||
if(!ctx.isValid()) {
|
||||
return WalletLocked;
|
||||
}
|
||||
|
||||
COutput output;
|
||||
if (!wallet->FindKevaCoin(output, namespaceStr)) {
|
||||
return CannotUpdate;
|
||||
|
@ -132,6 +132,7 @@ public:
|
||||
ValueTooLong,
|
||||
CannotUpdate,
|
||||
InsufficientFund,
|
||||
WalletLocked,
|
||||
};
|
||||
|
||||
enum EncryptionStatus
|
||||
|
Loading…
Reference in New Issue
Block a user