Prefer setObjectName to setId.

Wt discourages the use of setId().

See Wt commit 9eed80087aab34831932fa5a28751c137971b427.
This commit is contained in:
SET
2021-02-28 19:02:44 +01:00
parent d6f6be678c
commit 87d543c8f8
2 changed files with 5 additions and 5 deletions

View File

@@ -277,7 +277,7 @@ void K7Main::DisplayKeys(const vector<GpgME::Key>& kList, const WString& grpLabe
WLink ln; WLink ln;
ln.setUrl(WString(L"javascript:void(0)").toUTF8()); ln.setUrl(WString(L"javascript:void(0)").toUTF8());
WAnchor * anc = new WAnchor(ln, k.shortKeyID()); WAnchor * anc = new WAnchor(ln, k.shortKeyID());
anc->setId(k.primaryFingerprint()); anc->setObjectName(k.primaryFingerprint());
// We use widget attribute values to buffer properties. // We use widget attribute values to buffer properties.
anc->setAttributeValue("hasSecret", k.hasSecret() ? "1" : "0"); anc->setAttributeValue("hasSecret", k.hasSecret() ? "1" : "0");
anc->clicked().connect(std::bind(&K7Main::OnKeyAnchorClicked, this, anc)); anc->clicked().connect(std::bind(&K7Main::OnKeyAnchorClicked, this, anc));
@@ -316,7 +316,7 @@ void K7Main::OnKeyAnchorClicked(WAnchor * source)
bool secret = true; bool secret = true;
if (hasSecret == WString("0")) if (hasSecret == WString("0"))
secret = false; secret = false;
const string id = source->id(); const string id = source->objectName();
// With secret = false, key signatures can be retrieved. // With secret = false, key signatures can be retrieved.
DisplayUids(id); DisplayUids(id);
DisplaySubKeys(id, secret); DisplaySubKeys(id, secret);

View File

@@ -196,7 +196,7 @@ void PopupCertifyUserId::PresentEmail()
{ {
WCheckBox * cbEmail = new WCheckBox(it->email()); WCheckBox * cbEmail = new WCheckBox(it->email());
m_vblEmail->addWidget(unique_ptr<WCheckBox> (cbEmail)); m_vblEmail->addWidget(unique_ptr<WCheckBox> (cbEmail));
cbEmail->setId(std::to_string(id)); cbEmail->setObjectName(std::to_string(id));
cbEmail->checked().connect(std::bind(&PopupCertifyUserId::OnEmailChecked, this, cbEmail, (*it))); cbEmail->checked().connect(std::bind(&PopupCertifyUserId::OnEmailChecked, this, cbEmail, (*it)));
cbEmail->unChecked().connect(std::bind(&PopupCertifyUserId::OnEmailUnChecked, this, cbEmail, (*it))); cbEmail->unChecked().connect(std::bind(&PopupCertifyUserId::OnEmailUnChecked, this, cbEmail, (*it)));
id++; id++;
@@ -244,14 +244,14 @@ void PopupCertifyUserId::ShowPassphrase(bool show)
void PopupCertifyUserId::OnEmailChecked(WCheckBox* cb, GpgME::UserID& uid) void PopupCertifyUserId::OnEmailChecked(WCheckBox* cb, GpgME::UserID& uid)
{ {
int id = Tools::ToInt(cb->id()); int id = Tools::ToInt(cb->objectName());
m_uidsToSign.push_back(id); m_uidsToSign.push_back(id);
m_uidsToRevokeCertification.push_back(uid); m_uidsToRevokeCertification.push_back(uid);
} }
void PopupCertifyUserId::OnEmailUnChecked(WCheckBox* cb, GpgME::UserID& uid) void PopupCertifyUserId::OnEmailUnChecked(WCheckBox* cb, GpgME::UserID& uid)
{ {
const uint id = Tools::ToInt(cb->id()); const uint id = Tools::ToInt(cb->objectName());
vector<uint>::iterator it = vector<uint>::iterator it =
std::find(m_uidsToSign.begin(), m_uidsToSign.end(), id); std::find(m_uidsToSign.begin(), m_uidsToSign.end(), id);
if (it != m_uidsToSign.end()) if (it != m_uidsToSign.end())