~aleteoryx/muditaos

2a901acf0b4e8e40d69d3f22f2bc91dac405174c — Lefucjusz 2 years ago a870922
[MOS-962] Fix forwarded message automatic pasting

Fix of the issue that entering 'Options' menu
after forwarding message caused the content
of the message to be pasted into message
field in thread view.
Minor cleanup.
M module-apps/application-messages/models/SMSThreadModel.cpp => module-apps/application-messages/models/SMSThreadModel.cpp +1 -1
@@ 33,7 33,7 @@ unsigned int SMSThreadModel::getMinimalItemSpaceRequired() const

gui::ListItem *SMSThreadModel::getItem(gui::Order order)
{
    std::shared_ptr<SMSRecord> sms = getRecord(order);
    const auto sms = getRecord(order);

    if (sms == nullptr) {
        return nullptr;

M module-apps/application-messages/windows/NewMessage.cpp => module-apps/application-messages/windows/NewMessage.cpp +9 -7
@@ 30,18 30,20 @@ namespace gui
            state = std::make_unique<TextBackup>(_state->backupText());
        }

        void getState(gui::Text *_state)
        void restoreState(gui::Text *_state)
        {
            assert(_state);
            if (!state) {
            if (state == nullptr) {
                return;
            }
            auto currentText = _state->getText();

            const auto currentText = _state->getText();
            _state->restoreFrom(*state);
            if (!currentText.empty()) {
                _state->addText(currentText);
            }
            state = nullptr;

            state.reset();
        }

      private:


@@ 70,7 72,7 @@ namespace gui

    void NewMessageWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        memento->getState(message);
        memento->restoreState(message);
        if (data == nullptr) {
            return;
        }


@@ 139,7 141,7 @@ namespace gui
    auto NewMessageWindow::getPhoneNumber() const -> utils::PhoneNumber
    {
        if (phoneNumber.getEntered().empty()) {
            if (contact && !(contact->numbers.empty())) {
            if (contact && !contact->numbers.empty()) {
                return contact->numbers.at(selectedNumber).number;
            }
            return utils::PhoneNumber{recipient->getText()};


@@ 315,7 317,7 @@ namespace gui
            return;
        }

        if ((reason == CloseReason::PhoneLock) || (reason == CloseReason::Popup)) {
        if (reason != CloseReason::ApplicationClose) {
            memento->setState(message);
            message->clear();
            return;

M module-apps/application-messages/windows/SMSThreadViewWindow.cpp => module-apps/application-messages/windows/SMSThreadViewWindow.cpp +14 -19
@@ 8,12 8,9 @@
#include "service-appmgr/Controller.hpp"

#include <log/log.hpp>
#include <module-db/queries/notifications/QueryNotificationsDecrement.hpp>
#include <module-db/queries/phonebook/QueryContactGetByNumberID.hpp>
#include <module-db/queries/phonebook/QueryNumberGetByID.hpp>
#include <OptionsMessages.hpp>
#include <service-db/DBNotificationMessage.hpp>
#include <service-db/DBServiceAPI.hpp>
#include <Service/Message.hpp>
#include <Style.hpp>
#include <TextBubble.hpp>


@@ 85,11 82,14 @@ namespace gui
            requestContact(smsModel->numberID);
        }

        if (auto pdata = dynamic_cast<SMSTextData *>(data); pdata) {
            auto txt = pdata->text;
        if (const auto pdata = dynamic_cast<SMSTextData *>(data); pdata != nullptr) {
            LOG_INFO("received sms templates data");
            pdata->concatenate == SMSTextData::Concatenate::True ? smsModel->smsInput->inputText->addText(txt)
                                                                 : smsModel->smsInput->inputText->setText(txt);
            if (pdata->concatenate == SMSTextData::Concatenate::True) {
                smsModel->smsInput->inputText->addText(pdata->text);
            }
            else {
                smsModel->smsInput->inputText->setText(pdata->text);
            }
        }
    }



@@ 120,20 120,15 @@ namespace gui

    bool SMSThreadViewWindow::onDatabaseMessage(sys::Message *msgl)
    {
        auto msg = dynamic_cast<db::NotificationMessage *>(msgl);
        const auto msg = dynamic_cast<db::NotificationMessage *>(msgl);
        if (msg != nullptr) {
            if (msg->interface == db::Interface::Name::SMS) {
                if (msg->dataModified()) {
                    rebuild();
                    return true;
                }
            if ((msg->interface == db::Interface::Name::SMS) && msg->dataModified()) {
                rebuild();
                return true;
            }
            if (msg->interface == db::Interface::Name::SMSThread) {
                if (msg->type == db::Query::Type::Delete) {
                    if (this == application->getCurrentWindow()) {
                        application->switchWindow(gui::name::window::main_window);
                    }
                }
            if ((msg->interface == db::Interface::Name::SMSThread) && (msg->type == db::Query::Type::Delete) &&
                (this == application->getCurrentWindow())) {
                application->switchWindow(gui::name::window::main_window);
            }
        }
        return false;

M module-apps/apps-common/windows/OptionWindow.cpp => module-apps/apps-common/windows/OptionWindow.cpp +2 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "OptionWindow.hpp"


@@ 60,8 60,7 @@ namespace gui

    void OptionWindow::onBeforeShow(ShowMode mode, SwitchData *data)
    {
        if (auto message = dynamic_cast<gui::OptionsWindowOptions *>(data)) {
            LOG_DEBUG("Options load!");
        if (const auto message = dynamic_cast<gui::OptionsWindowOptions *>(data); message != nullptr) {
            options = message->takeOptions();
        }


M pure_changelog.md => pure_changelog.md +2 -1
@@ 75,7 75,8 @@
* Fixed going back to Messages instead of Contacts in case message thread was previously opened from Contacts
* Fixed autoconnecting other BT devices when another one is already connected
* Fixed going to Calls instead of Contacts after aborted or confirmed attempt to create contact from Calls
* Fix misleading "Nie" abbreviation for word "Niedziela" (Sunday) in new alarm window
* Fixed misleading "Nie" abbreviation for word "Niedziela" (Sunday) in new alarm window
* Fixed automatic message pasting into content field in thread view after message forwarding

## [1.6.0 2023-02-27]