void ContactListEdit::SetCollectedContacts(const IMailProcessor::TRecipientPublicKeys& storage) { auto profile = bts::get_profile(); auto aBook = profile->get_addressbook(); for(const auto& recipient : storage) { assert(recipient.valid()); auto contact = aBook->get_contact_by_public_key(recipient); if(contact) { /** Use kID as completion here - it is slight violation against source list but we don't know here how it was originally entered (by kID or alias: fName lName) */ QString entryText(toString(*contact)); addContactEntry(entryText, *contact); } else { bool known = false; /// If no contact found try one of registered identities. std::vector<bts::addressbook::wallet_identity> identities = profile->identities(); for(const auto& identity : identities) { assert(identity.public_key.valid()); if(identity.public_key == recipient) { QString entryText(toString(identity)); addContactEntry(entryText, identity); known = true; break; } } if(known == false) { /// Some unknown contact. Lets show its public key in the list. public_key_address pkAddress(recipient); std::string textPK(pkAddress); bts::addressbook::wallet_contact wc; wc.public_key = recipient; addContactEntry(QString(textPK.c_str()), wc); } } } }
void ContactListEdit::SetCollectedContacts(const IMailProcessor::TRecipientPublicKeys& storage) { for(const auto& recipient : storage) { assert(recipient.valid()); bts::addressbook::contact matchingContact; QString entryText(Utils::toString(recipient, Utils::TContactTextFormatting::FULL_CONTACT_DETAILS, &matchingContact)); addContactEntry(entryText, matchingContact); } }
void ContactListEdit::SetCollectedContacts(const IMailProcessor::TRecipientPublicKeys& storage) { TAutoSkipCompletion asc(this); for(const auto& recipient : storage) { assert(recipient.valid()); bool isKnownContact = false; bts::addressbook::contact matchingContact; QString entryText(Utils::toString(recipient, Utils::TContactTextFormatting::FULL_CONTACT_DETAILS, &matchingContact, &isKnownContact)); addContactEntry(entryText, matchingContact, isKnownContact == false); } }