~aleteoryx/muditaos

51184eb7501438871e8c31f7e1929f8ad501dfd2 — Marcin Zieliński 2 years ago 0e7ae16
[MOS-931] Correctly abbreviate multiline strings in dialog titles

Problem originally spotted at SMS deletion, corrected for all
dialog windows.
2 files changed, 7 insertions(+), 1 deletions(-)

M module-apps/apps-common/windows/Dialog.cpp
M pure_changelog.md
M module-apps/apps-common/windows/Dialog.cpp => module-apps/apps-common/windows/Dialog.cpp +6 -1
@@ 30,7 30,12 @@ Dialog::Dialog(app::ApplicationCommon *app, const std::string &name) : gui::AppW
void Dialog::onBeforeShow(ShowMode mode, SwitchData *data)
{
    if (auto metadata = dynamic_cast<DialogMetadataMessage *>(data); metadata != nullptr) {
        setTitle(metadata->get().title);
        auto title = metadata->get().title;
        if (size_t crLfPos = title.find_first_of("\r\n"); crLfPos != title.npos) {
            auto lengthToReplace = title.size() - crLfPos;
            title.replace(crLfPos, lengthToReplace, "...");
        }
        setTitle(title);
        icon->text->setRichText(metadata->get().text);
        icon->image->set(metadata->get().icon);
        icon->resizeItems();

M pure_changelog.md => pure_changelog.md +1 -0
@@ 66,6 66,7 @@
* Fixed displaying wrong information on screen after rejecting call with SMS template
* Fixed lack of contact search list update when returning to list after contact edition
* Fixed wrong USSD flow when user closed USSD popup with back button
* Fixed broken abbreviating of multiline text messages content in deletion window

## [1.6.0 2023-02-27]