~aleteoryx/muditaos

452135b30414899b65010069deee3d8b2dbb39ff — Piotr Tanski 5 years ago dbde066
[EGD-4373] Fix for changing the content of option window. (#1054)

M changelog.md => changelog.md +1 -0
@@ 10,6 10,7 @@
### Fixed

* `[desktop]` Fixed ScreenlockCheckEvent handler 
* `[messages]` Fix for changing the content of option windows when forwarding a message.

### Changed


M module-apps/application-messages/ApplicationMessages.cpp => module-apps/application-messages/ApplicationMessages.cpp +1 -1
@@ 385,7 385,7 @@ namespace app

    bool ApplicationMessages::newMessageOptions(const std::string &requestingWindow, gui::Text *text)
    {
        LOG_INFO("New message options");
        LOG_INFO("New message options for %s", requestingWindow.c_str());
        auto opts = std::make_unique<gui::OptionsWindowOptions>(newMessageWindowOptions(this, requestingWindow, text));
        switchWindow(utils::localize.get("app_phonebook_options_title"), std::move(opts));
        return true;

M module-apps/windows/OptionWindow.cpp => module-apps/windows/OptionWindow.cpp +13 -7
@@ 36,18 36,24 @@ namespace gui
        body->addWidget(Option(text, activatedCallback, arrow).build());
    }

    void OptionWindow::addOptions(std::list<Option> &options)
    void OptionWindow::addOptions(std::list<Option> &optionList)
    {
        for (auto &option : options) {
        for (auto &option : optionList) {
            body->addWidget(option.build());
        }
        body->switchPage(0);
    }

    void OptionWindow::addOptions(std::list<Option> &&options)
    void OptionWindow::addOptions(std::list<Option> &&optionList)
    {
        this->options = std::move(options);
        addOptions(this->options);
        options = std::move(optionList);
        addOptions(options);
    }

    void OptionWindow::resetOptions(std::list<Option> &&optionList)
    {
        clearOptions();
        addOptions(std::move(optionList));
    }

    void OptionWindow::clearOptions()


@@ 84,6 90,7 @@ namespace gui
    void OptionWindow::destroyInterface()
    {
        erase();
        body = nullptr;
    }

    OptionWindow::~OptionWindow()


@@ 95,8 102,7 @@ namespace gui
    {
        if (auto message = dynamic_cast<gui::OptionsWindowOptions *>(data)) {
            LOG_DEBUG("Options load!");
            options = message->takeOptions();
            addOptions(options);
            resetOptions(message->takeOptions());
        }
    }
} /* namespace gui */

M module-apps/windows/OptionWindow.hpp => module-apps/windows/OptionWindow.hpp +3 -2
@@ 17,8 17,9 @@ namespace gui
      protected:
        PageLayout *body = nullptr;
        std::list<Option> options;
        void addOptions(std::list<Option> &options);
        void addOptions(std::list<Option> &&options);
        void addOptions(std::list<Option> &optionList);
        void addOptions(std::list<Option> &&optionList);
        void resetOptions(std::list<Option> &&optionList);

      public:
        OptionWindow(app::Application *app, const std::string &name);

M module-apps/windows/OptionsWindowOption.hpp => module-apps/windows/OptionsWindowOption.hpp +5 -1
@@ 28,7 28,7 @@ namespace gui
            [[nodiscard]] virtual auto str() const -> std::string
            {
                return "";
            };
            }
        };

        class Simple : public Base


@@ 44,6 44,10 @@ namespace gui
            {}

            [[nodiscard]] auto build() const -> Item * override;
            [[nodiscard]] auto str() const -> std::string override
            {
                return text;
            }
        };
    }; // namespace option