From e1e4fa1f1fc764e8a42b485619352cbaff971ed6 Mon Sep 17 00:00:00 2001 From: patrycja-paczkowska Date: Tue, 20 Dec 2022 18:18:30 +0100 Subject: [PATCH] [MOS-201] Fix notes paste option Check clipboard content before showing paste option. --- .../windows/NotesOptions.cpp | 26 +++++++++++-------- pure_changelog.md | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/module-apps/application-notes/windows/NotesOptions.cpp b/module-apps/application-notes/windows/NotesOptions.cpp index fc67c5ccf8a49db5e9a031a350fb6fe01b1fc04d..af408fb16b1df2dec782942730b8733a9d78728b 100644 --- a/module-apps/application-notes/windows/NotesOptions.cpp +++ b/module-apps/application-notes/windows/NotesOptions.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "NotesOptions.hpp" @@ -101,16 +101,20 @@ namespace app::notes return true; }, options); - addOption( - {"common_text_paste"}, - [application, textWidget](gui::Item &item) { - if (textWidget != nullptr) { - textWidget->addText(Clipboard::getInstance().paste(), gui::AdditionType::perBlock); - } - application->returnToPreviousWindow(); - return true; - }, - options); + + if (Clipboard::getInstance().gotData()) { + addOption( + {"common_text_paste"}, + [application, textWidget](gui::Item &item) { + if (textWidget != nullptr) { + textWidget->addText(Clipboard::getInstance().paste(), gui::AdditionType::perBlock); + } + application->returnToPreviousWindow(); + return true; + }, + options); + } + return options; } } // namespace app::notes diff --git a/pure_changelog.md b/pure_changelog.md index 3f371b724be694f655a2d436d6eb7a97a04c2cb4..3a547877af9d35a1cc90541737c21ffcc31e0557 100644 --- a/pure_changelog.md +++ b/pure_changelog.md @@ -47,6 +47,7 @@ * Fixed selecting SIM during onboarding * Fixed broken text in French and German on SIM selection screen during onboarding * Fixed broken text in Spanish on the PIN input screen +* Fixed notes paste option showing for empty clipboard ### Added * Added a popup for changing the SIM card