Added ability to see vcard if available to all types if contacts media.
This commit is contained in:
parent
5b45397383
commit
749b2e0e95
|
@ -249,8 +249,8 @@ std::unique_ptr<Data::Media> HistoryItem::CreateMedia(
|
||||||
} else if (type.startsWith("BDAY")) {
|
} else if (type.startsWith("BDAY")) {
|
||||||
items[Type::Birthday] = value;
|
items[Type::Birthday] = value;
|
||||||
} else if (type.startsWith("N")) {
|
} else if (type.startsWith("N")) {
|
||||||
items[Type::Birthday] = value;
|
items[Type::Name] = value;
|
||||||
items[Type::Birthday].replace(';', ' ');
|
items[Type::Name].replace(';', ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,15 @@ ClickHandlerPtr AddContactClickHandler(not_null<HistoryItem*> item) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
{
|
||||||
|
const auto inner = box->verticalLayout();
|
||||||
|
if (inner->count() > 2) {
|
||||||
|
delete inner->widgetAt(inner->count() - 1);
|
||||||
|
delete inner->widgetAt(inner->count() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +267,7 @@ QSize Contact::countOptimalSize() {
|
||||||
full);
|
full);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto vcardBoxFactory = _vcardBoxFactory;
|
||||||
_buttons.clear();
|
_buttons.clear();
|
||||||
if (_contact) {
|
if (_contact) {
|
||||||
const auto message = tr::lng_contact_send_message(tr::now).toUpper();
|
const auto message = tr::lng_contact_send_message(tr::now).toUpper();
|
||||||
|
@ -276,20 +285,20 @@ QSize Contact::countOptimalSize() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_mainButton.link = _buttons.front().link;
|
_mainButton.link = _buttons.front().link;
|
||||||
} else if (const auto vcardBoxFactory = _vcardBoxFactory) {
|
} else if (vcardBoxFactory) {
|
||||||
const auto view = tr::lng_contact_details_button(tr::now).toUpper();
|
const auto view = tr::lng_contact_details_button(tr::now).toUpper();
|
||||||
_buttons.push_back({
|
_buttons.push_back({
|
||||||
view,
|
view,
|
||||||
st::semiboldFont->width(view),
|
st::semiboldFont->width(view),
|
||||||
AddContactClickHandler(_parent->data()),
|
AddContactClickHandler(_parent->data()),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (vcardBoxFactory) {
|
||||||
_mainButton.link = std::make_shared<LambdaClickHandler>([=](
|
_mainButton.link = std::make_shared<LambdaClickHandler>([=](
|
||||||
const ClickContext &context) {
|
const ClickContext &context) {
|
||||||
const auto my = context.other.value<ClickHandlerContext>();
|
const auto my = context.other.value<ClickHandlerContext>();
|
||||||
if (const auto controller = my.sessionWindow.get()) {
|
if (const auto controller = my.sessionWindow.get()) {
|
||||||
controller->uiShow()->show(Box([=](not_null<Ui::GenericBox*> box) {
|
controller->uiShow()->show(Box(vcardBoxFactory));
|
||||||
vcardBoxFactory(box);
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue