Allow edit/delete contact info in passport.
This commit is contained in:
parent
e4ae5bfcad
commit
49578836be
|
@ -765,15 +765,19 @@ void PanelController::editScope(int index, int documentIndex) {
|
|||
case Scope::Type::Email: {
|
||||
const auto &parsed = _editValue->data.parsedInEdit;
|
||||
const auto valueIt = parsed.fields.find("value");
|
||||
const auto value = (valueIt == end(parsed.fields)
|
||||
? QString()
|
||||
: valueIt->second);
|
||||
const auto existing = getDefaultContactValue(_editScope->type);
|
||||
_panelHasUnsavedChanges = nullptr;
|
||||
return object_ptr<PanelEditContact>(
|
||||
_panel.get(),
|
||||
this,
|
||||
GetContactScheme(_editScope->type),
|
||||
(valueIt == end(parsed.fields)
|
||||
? QString()
|
||||
: valueIt->second),
|
||||
getDefaultContactValue(_editScope->type));
|
||||
value,
|
||||
(existing.toLower().trimmed() != value.toLower().trimmed()
|
||||
? existing
|
||||
: QString()));
|
||||
} break;
|
||||
}
|
||||
Unexpected("Type in PanelController::editScope().");
|
||||
|
|
|
@ -270,6 +270,18 @@ void PanelEditContact::setupControls(
|
|||
st::passportFormLabel),
|
||||
st::passportFormLabelPadding));
|
||||
|
||||
if (auto text = _controller->deleteValueLabel()) {
|
||||
_content->add(
|
||||
object_ptr<Info::Profile::Button>(
|
||||
_content,
|
||||
std::move(*text) | Info::Profile::ToUpperValue(),
|
||||
st::passportDeleteButton),
|
||||
st::passportUploadButtonPadding
|
||||
)->addClickHandler([=] {
|
||||
_controller->deleteValue();
|
||||
});
|
||||
}
|
||||
|
||||
const auto submit = [=] {
|
||||
crl::on_main(this, [=] {
|
||||
save();
|
||||
|
|
|
@ -329,13 +329,13 @@ not_null<Ui::RpWidget*> PanelEditDocument::setupContent(
|
|||
inner->add(
|
||||
object_ptr<Ui::FixedHeightWidget>(inner, st::passportDetailsSkip));
|
||||
if (auto text = _controller->deleteValueLabel()) {
|
||||
_delete = inner->add(
|
||||
inner->add(
|
||||
object_ptr<Info::Profile::Button>(
|
||||
inner,
|
||||
std::move(*text) | Info::Profile::ToUpperValue(),
|
||||
st::passportDeleteButton),
|
||||
st::passportUploadButtonPadding);
|
||||
_delete->addClickHandler([=] {
|
||||
st::passportUploadButtonPadding
|
||||
)->addClickHandler([=] {
|
||||
_controller->deleteValue();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue