~aleteoryx/muditaos

1d66d0d21a00bcf8f65f0fdf6bb2367c849a6493 — Pawel Olejniczak 4 years ago aebc8e7
[EGD-6533] Fix switching window after editing contact

After saving edited contact, app was switched to
contact lists window instead of contact details.
1 files changed, 6 insertions(+), 4 deletions(-)

M module-apps/application-phonebook/windows/PhonebookNewContact.cpp
M module-apps/application-phonebook/windows/PhonebookNewContact.cpp => module-apps/application-phonebook/windows/PhonebookNewContact.cpp +6 -4
@@ 162,8 162,8 @@ namespace gui
            case DBServiceAPI::ContactVerificationResult::temporaryContactExists:
                std::unique_ptr<ContactRecord> tempContact;
                assert(!contact->numbers.empty());
                for (auto number : contact->numbers) {
                    if (number.number.getEntered().size() > 0) {
                for (const auto &number : contact->numbers) {
                    if (!number.number.getEntered().empty()) {
                        tempContact = DBServiceAPI::MatchContactByPhoneNumber(application, number.number);
                        if (tempContact != nullptr) {
                            contact->ID   = tempContact->ID;


@@ 181,7 181,7 @@ namespace gui

        // perform actual add/update operation
        if (contactAction == ContactAction::Add) {
            if (DBServiceAPI::ContactAdd(application, *contact) == false) {
            if (!DBServiceAPI::ContactAdd(application, *contact)) {
                LOG_ERROR("verifyAndSave failed to ADD contact");
                return false;
            }


@@ 192,10 192,12 @@ namespace gui

            contact->groups.erase(ContactsDB::temporaryGroupId());

            if (DBServiceAPI::ContactUpdate(application, *contact) == false) {
            if (!DBServiceAPI::ContactUpdate(application, *contact)) {
                LOG_ERROR("verifyAndSave failed to UPDATE contact");
                return false;
            }
            application->switchWindow(gui::window::name::contact, std::move(data));
            return true;
        }

        application->switchWindow(gui::name::window::main_window);