[MOS-201] Fix notes paste option

Check clipboard content before showing
paste option.
This commit is contained in:
patrycja-paczkowska
2022-12-20 18:18:30 +01:00
committed by patrycja-paczkowska
parent 70fe3a401e
commit e1e4fa1f1f
2 changed files with 16 additions and 11 deletions

View File

@@ -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