Reorganize code.

Move KeyEdit::IsOurKey to Tools::IsOurKey.
This commit is contained in:
SET
2020-11-14 11:25:00 +01:00
parent bb4df1423a
commit 6ac7ea7c0f
5 changed files with 32 additions and 22 deletions

View File

@@ -39,7 +39,9 @@ void KeyEdit::OnOwnerTrustDoubleClicked(WTreeTableNode * keyNode, bool keyHasSec
* not be editable by anyone.
*/
WText * lblFpr = static_cast<WText*> (keyNode->columnWidget(3));
if (!IsOurKey(lblFpr->text()) && Tools::KeyHasSecret(lblFpr->text())) {
vector<WString> ourKeys = m_owner->m_config->PrivateKeyIds();
if (!Tools::IsOurKey(lblFpr->text(), ourKeys)
&& Tools::KeyHasSecret(lblFpr->text())) {
m_owner->m_tmwMessage->SetText(TR("OwnerTrustReadOnly"));
return;
}
@@ -118,18 +120,6 @@ void KeyEdit::FillOwnerTrustCombo(WComboBox * cmb, bool keyHasSecret)
cmb->setModelColumn(1);
}
bool KeyEdit::IsOurKey(const WString& fpr)
{
vector<WString> ourKeys = m_owner->m_config->PrivateKeyIds();
vector<WString> ::iterator it;
for (it = ourKeys.begin(); it != ourKeys.end(); it++)
{
if (*it == fpr)
return true;
}
return false;
}
void KeyEdit::OnUidValidityClicked(WTreeTableNode* uidNode, vector<WString>& privateKeys, const WString& targetKeyFpr)
{
if (targetKeyFpr != m_targetUidValidityKeyFpr) {