M module-apps/application-messages/windows/NewMessage.cpp => module-apps/application-messages/windows/NewMessage.cpp +18 -69
@@ 46,40 46,14 @@ namespace gui
state.reset();
}
- protected:
- std::unique_ptr<gui::TextBackup> state;
- };
-
- class NewMessageWindow::RecipientMemento : public NewMessageWindow::MessageMemento
- {
- public:
- void setState(const gui::Text *currentState, const std::shared_ptr<ContactRecord> chosenContact)
- {
- if (chosenContact != nullptr && !chosenContact->numbers.empty()) {
- phoneNumberView = std::make_unique<utils::PhoneNumber::View>(chosenContact->numbers.at(0).number);
- }
-
- MessageMemento::setState(currentState);
- }
-
- void restoreState(gui::Text *currentState, utils::PhoneNumber::View *currentPhoneNumberView)
- {
- if (currentPhoneNumberView != nullptr && phoneNumberView != nullptr) {
- *currentPhoneNumberView = *phoneNumberView;
- phoneNumberView.reset();
- }
-
- MessageMemento::restoreState(currentState);
- }
-
private:
- std::unique_ptr<utils::PhoneNumber::View> phoneNumberView;
+ std::unique_ptr<gui::TextBackup> state;
};
std::unique_ptr<NewMessageWindow::MessageMemento> NewMessageWindow::mementoMessage =
std::make_unique<NewMessageWindow::MessageMemento>();
- std::unique_ptr<NewMessageWindow::RecipientMemento> NewMessageWindow::mementoRecipient =
- std::make_unique<NewMessageWindow::RecipientMemento>();
+ std::unique_ptr<NewMessageWindow::MessageMemento> NewMessageWindow::mementoRecipient =
+ std::make_unique<NewMessageWindow::MessageMemento>();
NewMessageWindow::NewMessageWindow(app::ApplicationCommon *app)
: AppWindow(app, name::window::new_sms), app::AsyncCallbackReceiver{app}
@@ 100,10 74,8 @@ namespace gui
void NewMessageWindow::onBeforeShow(ShowMode mode, SwitchData *data)
{
- restoreMessageAndRecipientFromMemo();
- if (!recipient->isEmpty()) {
- body->setFocusItem(message);
- }
+ mementoMessage->restoreState(message);
+ mementoRecipient->restoreState(recipient);
if (data == nullptr) {
return;
}
@@ 214,14 186,10 @@ namespace gui
navBar->setActive(nav_bar::Side::Left, false);
if (recipient->getText().empty()) {
navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::contacts));
- navBar->setText(nav_bar::Side::Right, utils::translate(style::strings::common::back));
return;
}
navBar->setActive(nav_bar::Side::Center, false);
- navBar->setText(nav_bar::Side::Right, utils::translate("app_call_clear"));
- return;
}
- navBar->setText(nav_bar::Side::Right, utils::translate(style::strings::common::back));
}
void NewMessageWindow::buildInterface()
@@ 263,15 231,15 @@ namespace gui
};
recipient->inputCallback = [this]([[maybe_unused]] Item &, const InputEvent &inputEvent) -> bool {
if (contact != nullptr) {
- if (inputEvent.isShortRelease(KeyCode::KEY_RF)) {
+ if (inputEvent.isShortRelease(KeyCode::KEY_PND)) {
recipient->clear();
return true;
}
- if (inputEvent.isDigit() || inputEvent.is(KeyCode::KEY_AST) || inputEvent.is(KeyCode::KEY_PND)) {
+ if (inputEvent.isDigit()) {
return true;
}
}
- if (inputEvent.isShortRelease(KeyCode::KEY_RF) && recipient->isEmpty()) {
+ if (inputEvent.isShortRelease(KeyCode::KEY_RF)) {
onClose(CloseReason::WindowSwitch);
}
return false;
@@ 320,7 288,6 @@ namespace gui
return true;
};
message->focusChangedCallback = [=](Item &) -> bool {
- navBar->setText(nav_bar::Side::Right, utils::translate(style::strings::common::back));
if (recipient->getText().empty()) {
navBar->setActive(nav_bar::Side::Center, false);
}
@@ 334,7 301,8 @@ namespace gui
if (event.isShortRelease(KeyCode::KEY_LF)) {
auto app = dynamic_cast<app::ApplicationMessages *>(application);
assert(app != nullptr);
- storeMessageAndRecipientInMemo();
+ mementoMessage->setState(message);
+ mementoRecipient->setState(recipient);
return app->newMessageOptions(getName(), message);
}
if (event.isShortRelease(KeyCode::KEY_RF)) {
@@ 344,8 312,7 @@ namespace gui
};
body->addWidget(message);
body->addWidget(new Span(Axis::Y, body->getHeight()));
- recipient->setText(""); // to clean up before load from memo
- message->setText(""); // to clean up before load from memo
+ message->setText(""); // to set actual size of Text
body->setEdges(gui::RectangleEdge::None);
body->setVisible(true);
@@ 355,8 322,14 @@ namespace gui
void NewMessageWindow::onClose(CloseReason reason)
{
+ if (message->getText().empty()) {
+ // Nothing to do if text is empty.
+ return;
+ }
+
if (reason != CloseReason::ApplicationClose) {
- storeMessageAndRecipientInMemo();
+ mementoMessage->setState(message);
+ mementoRecipient->setState(recipient);
message->clear();
return;
}
@@ 437,28 410,4 @@ namespace gui
message->clear();
}
- void NewMessageWindow::storeMessageAndRecipientInMemo()
- {
- mementoMessage->setState(message);
- mementoRecipient->setState(recipient, contact);
- }
-
- void NewMessageWindow::restoreMessageAndRecipientFromMemo()
- {
- mementoMessage->restoreState(message);
- mementoRecipient->restoreState(recipient, &phoneNumber);
-
- if (phoneNumber.getNonEmpty() == "") {
- return;
- }
-
- contact = DBServiceAPI::MatchContactByPhoneNumber(application, phoneNumber);
- if (!contact || contact->isTemporary()) {
- recipient->setText(phoneNumber.getFormatted());
- }
- else {
- recipient->setText(contact->getFormattedName());
- }
- }
-
} // namespace gui
M module-apps/application-messages/windows/NewMessage.hpp => module-apps/application-messages/windows/NewMessage.hpp +1 -4
@@ 50,10 50,7 @@ namespace gui
/// MessageMemento shall be used whenever there is a need for temporary window switch in normal (uninterrupted)
/// flow of new message preparation, such as using options or recipient selection.
class MessageMemento;
- class RecipientMemento;
static std::unique_ptr<MessageMemento> mementoMessage;
- static std::unique_ptr<RecipientMemento> mementoRecipient;
- void storeMessageAndRecipientInMemo();
- void restoreMessageAndRecipientFromMemo();
+ static std::unique_ptr<MessageMemento> mementoRecipient;
};
} /* namespace gui */
M module-apps/application-phonebook/models/NewContactModel.cpp => module-apps/application-phonebook/models/NewContactModel.cpp +5 -39
@@ 4,6 4,9 @@
#include "NewContactModel.hpp"
#include "apps-common/windows/AppWindow.hpp"
+#include "application-phonebook/widgets/ContactListItem.hpp"
+#include "application-phonebook/widgets/InputBoxWithLabelAndIconWidget.hpp"
+#include "application-phonebook/widgets/InputLinesWithLabelWidget.hpp"
#include "application-phonebook/ApplicationPhonebook.hpp"
#include <messages/DialogMetadataMessage.hpp>
@@ 34,18 37,13 @@ auto NewContactModel::getItem(gui::Order order) -> gui::ListItem *
void NewContactModel::createData()
{
- constexpr auto navBarOptionsLabelSide = gui::nav_bar::Side::Left;
- constexpr auto navBarClearOrBackLabelSide = gui::nav_bar::Side::Right;
- auto app = application;
+ constexpr auto navBarOptionsLabelSide = gui::nav_bar::Side::Left;
+ auto app = application;
internalData.push_back(new gui::InputLinesWithLabelWidget(
phonebookInternals::ListItemName::FirstName,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 60,10 58,6 @@ void NewContactModel::createData()
phonebookInternals::ListItemName::SecondName,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 78,10 72,6 @@ void NewContactModel::createData()
phonebookInternals::ListItemName::Number,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 96,10 86,6 @@ void NewContactModel::createData()
phonebookInternals::ListItemName::SecondNumber,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 114,10 100,6 @@ void NewContactModel::createData()
phonebookInternals::ListItemName::Email,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 147,10 129,6 @@ void NewContactModel::createData()
phonebookInternals::ListItemName::Address,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 166,10 144,6 @@ void NewContactModel::createData()
phonebookInternals::ListItemName::Note,
[app](const UTF8 &text, bool emptyOthers) { app->getCurrentWindow()->navBarTemporaryMode(text, emptyOthers); },
[app]() { app->getCurrentWindow()->navBarRestoreFromTemporaryMode(); },
- [app, this](const UTF8 &text, bool isRFKeyFunctionAsClear) {
- app->getCurrentWindow()->setNavBarText(text, navBarClearOrBackLabelSide);
- isRFKeyForClearFunction = isRFKeyFunctionAsClear;
- },
[app](const UTF8 &text, bool active) {
app->getCurrentWindow()->setNavBarText(text, navBarOptionsLabelSide);
app->getCurrentWindow()->setNavBarActive(navBarOptionsLabelSide, active);
@@ 264,10 238,6 @@ void NewContactModel::openTextOptions(gui::Text *text)
bool NewContactModel::isAnyUnsavedChange(std::shared_ptr<ContactRecord> contactRecord)
{
for (const auto &item : internalData) {
- if (auto itemInputWiget = dynamic_cast<gui::InputLinesWithLabelWidget *>(item)) {
-
- itemInputWiget->inputText->isInputMode(InputMode::phone);
- }
if (item->onCheckUnsavedChangeCallback) {
if (item->onCheckUnsavedChangeCallback(contactRecord)) {
return true;
@@ 276,7 246,3 @@ bool NewContactModel::isAnyUnsavedChange(std::shared_ptr<ContactRecord> contactR
}
return false; // there is no change between already provided data and saved ones
}
-bool NewContactModel::isRightFunctionKeyForClearFunction()
-{
- return isRFKeyForClearFunction;
-}
M module-apps/application-phonebook/models/NewContactModel.hpp => module-apps/application-phonebook/models/NewContactModel.hpp +0 -4
@@ 5,8 5,6 @@
#include "application-phonebook/data/PhonebookItemData.hpp"
#include "application-phonebook/widgets/ContactListItem.hpp"
-#include "application-phonebook/widgets/InputBoxWithLabelAndIconWidget.hpp"
-#include "application-phonebook/widgets/InputLinesWithLabelWidget.hpp"
#include "InternalModel.hpp"
#include "Application.hpp"
@@ 18,7 16,6 @@ class NewContactModel : public app::InternalModel<gui::ContactListItem *>, publi
private:
app::ApplicationCommon *application = nullptr;
PhonebookItemData::RequestType requestType = PhonebookItemData::RequestType::Internal;
- bool isRFKeyForClearFunction = false; // By default, is for BACK function
void openTextOptions(gui::Text *text);
@@ 32,7 29,6 @@ class NewContactModel : public app::InternalModel<gui::ContactListItem *>, publi
bool verifyData();
bool emptyData();
bool isAnyUnsavedChange(std::shared_ptr<ContactRecord> contactRecord);
- bool isRightFunctionKeyForClearFunction();
[[nodiscard]] auto getRequestType() -> PhonebookItemData::RequestType;
[[nodiscard]] auto requestRecordsCount() -> unsigned int override;
M module-apps/application-phonebook/widgets/InputBoxWithLabelAndIconWidget.cpp => module-apps/application-phonebook/widgets/InputBoxWithLabelAndIconWidget.cpp +2 -4
@@ 15,11 15,9 @@ namespace gui
InputBoxWithLabelAndIconWidget::InputBoxWithLabelAndIconWidget(
phonebookInternals::ListItemName listItemName,
std::function<void(const UTF8 &)> navBarTemporaryMode,
- std::function<void()> navBarRestoreFromTemporaryMode,
- std::function<void(const UTF8 &text)> navBarSetRFKeyLabel)
+ std::function<void()> navBarRestoreFromTemporaryMode)
: listItemName(listItemName), navBarTemporaryMode(std::move(navBarTemporaryMode)),
- navBarRestoreFromTemporaryMode(std::move(navBarRestoreFromTemporaryMode)),
- navBarSetRFKeyLabel(std::move(navBarSetRFKeyLabel))
+ navBarRestoreFromTemporaryMode(std::move(navBarRestoreFromTemporaryMode))
{
setMinimumSize(phonebookStyle::inputBoxWithLabelAndIconIWidget::w,
phonebookStyle::inputBoxWithLabelAndIconIWidget::h);
M module-apps/application-phonebook/widgets/InputBoxWithLabelAndIconWidget.hpp => module-apps/application-phonebook/widgets/InputBoxWithLabelAndIconWidget.hpp +1 -3
@@ 22,8 22,7 @@ namespace gui
public:
InputBoxWithLabelAndIconWidget(phonebookInternals::ListItemName listItemName,
std::function<void(const UTF8 &text)> navBarTemporaryMode = nullptr,
- std::function<void()> navBarRestoreFromTemporaryMode = nullptr,
- std::function<void(const UTF8 &text)> navBarSetRFKeyLabel = nullptr);
+ std::function<void()> navBarRestoreFromTemporaryMode = nullptr);
~InputBoxWithLabelAndIconWidget() override = default;
gui::HBox *hBox = nullptr;
gui::Label *inputBoxLabel = nullptr;
@@ 34,7 33,6 @@ namespace gui
private:
std::function<void(const UTF8 &text)> navBarTemporaryMode = nullptr;
std::function<void()> navBarRestoreFromTemporaryMode = nullptr;
- std::function<void(const UTF8 &text)> navBarSetRFKeyLabel = nullptr;
void applyItemNameSpecificSettings();
M module-apps/application-phonebook/widgets/InputLinesWithLabelWidget.cpp => module-apps/application-phonebook/widgets/InputLinesWithLabelWidget.cpp +3 -19
@@ 14,15 14,14 @@ namespace gui
phonebookInternals::ListItemName listItemName,
const std::function<void(const UTF8 &text, bool emptyOthers)> &navBarTemporaryMode,
const std::function<void()> &navBarRestoreFromTemporaryMode,
- const std::function<void(const UTF8 &text, bool isRFKeyFunctionAsClear)> &navBarSetRFKeyLabel,
const std::function<void(const UTF8 &text, bool active)> &navBarSetOptionsLabel,
const std::function<void()> &selectSpecialCharacter,
const std::function<void(std::function<void()> restoreFunction)> &restoreInputMode,
const std::function<void(Text *text)> &inputOptions,
- std::uint32_t lines)
+ unsigned int lines)
: listItemName(listItemName), navBarTemporaryMode(navBarTemporaryMode),
- navBarRestoreFromTemporaryMode(navBarRestoreFromTemporaryMode), navBarSetRFKeyLabel(navBarSetRFKeyLabel),
- navBarSetOptionsLabel(navBarSetOptionsLabel), inputOptions(inputOptions)
+ navBarRestoreFromTemporaryMode(navBarRestoreFromTemporaryMode), navBarSetOptionsLabel(navBarSetOptionsLabel),
+ inputOptions(inputOptions)
{
setMinimumSize(phonebookStyle::inputLinesWithLabelWidget::w,
phonebookStyle::inputLinesWithLabelWidget::title_label_h +
@@ 79,8 78,6 @@ namespace gui
const auto optionsLabelState = !inputText->isEmpty() || Clipboard::getInstance().hasData();
this->navBarSetOptionsLabel(utils::translate(style::strings::common::options), optionsLabelState);
}
-
- setRightFunctionKayLabel();
}
else {
inputText->setCursorStartPosition(CursorStartPosition::DocumentBegin);
@@ 109,8 106,6 @@ namespace gui
}
}
- setRightFunctionKayLabel();
-
return result;
};
@@ 119,7 114,6 @@ namespace gui
return true;
};
- applyItemNameSpecificSettings();
setEdges(RectangleEdge::None);
}
@@ 309,15 303,5 @@ namespace gui
return contact->note != inputText->getText();
};
}
- void InputLinesWithLabelWidget::setRightFunctionKayLabel()
- {
- if (inputText != nullptr && inputText->isInputMode(InputMode::phone) && this->navBarSetRFKeyLabel &&
- !inputText->isEmpty()) {
- navBarSetRFKeyLabel(utils::translate(utils::translate("app_call_clear")), true);
- }
- else {
- navBarSetRFKeyLabel(utils::translate(style::strings::common::back), false);
- }
- }
} /* namespace gui */
M module-apps/application-phonebook/widgets/InputLinesWithLabelWidget.hpp => module-apps/application-phonebook/widgets/InputLinesWithLabelWidget.hpp +11 -14
@@ 18,14 18,13 @@ namespace gui
public:
explicit InputLinesWithLabelWidget(
phonebookInternals::ListItemName listItemName,
- const std::function<void(const UTF8 &text, bool emptyOthers)> &navBarTemporaryMode = nullptr,
- const std::function<void()> &navBarRestoreFromTemporaryMode = nullptr,
- const std::function<void(const UTF8 &text, bool isRFKeyFunctionAsClear)> &navBarSetRFKeyLabel = nullptr,
- const std::function<void(const UTF8 &text, bool active)> &navBarSetOptionsLabel = nullptr,
- const std::function<void()> &selectSpecialCharacter = nullptr,
- const std::function<void(std::function<void()> restoreFunction)> &restoreInputMode = nullptr,
- const std::function<void(Text *text)> &inputOptions = nullptr,
- std::uint32_t lines = 1);
+ const std::function<void(const UTF8 &text, bool emptyOthers)> &navBarTemporaryMode = nullptr,
+ const std::function<void()> &navBarRestoreFromTemporaryMode = nullptr,
+ const std::function<void(const UTF8 &text, bool active)> &navBarSetOptionsLabel = nullptr,
+ const std::function<void()> &selectSpecialCharacter = nullptr,
+ const std::function<void(std::function<void()> restoreFunction)> &restoreInputMode = nullptr,
+ const std::function<void(Text *text)> &inputOptions = nullptr,
+ unsigned int lines = 1);
VBox *vBox = nullptr;
Label *titleLabel = nullptr;
@@ 34,13 33,11 @@ namespace gui
private:
phonebookInternals::ListItemName listItemName;
void applyItemNameSpecificSettings();
- void setRightFunctionKayLabel();
- std::function<void(const UTF8 &text, bool emptyOthers)> navBarTemporaryMode = nullptr;
- std::function<void()> navBarRestoreFromTemporaryMode = nullptr;
- std::function<void(const UTF8 &text, bool isRFKeyFunctionAsClear)> navBarSetRFKeyLabel = nullptr;
- std::function<void(const UTF8 &text, bool active)> navBarSetOptionsLabel = nullptr;
- std::function<void(Text *text)> inputOptions = nullptr;
+ std::function<void(const UTF8 &text, bool emptyOthers)> navBarTemporaryMode = nullptr;
+ std::function<void()> navBarRestoreFromTemporaryMode = nullptr;
+ std::function<void(const UTF8 &text, bool active)> navBarSetOptionsLabel = nullptr;
+ std::function<void(Text *text)> inputOptions = nullptr;
void firstNameHandler();
void secondNameHandler();
M module-apps/application-phonebook/windows/PhonebookNewContact.cpp => module-apps/application-phonebook/windows/PhonebookNewContact.cpp +1 -1
@@ 151,7 151,7 @@ namespace gui
return true;
}
else if (!inputEvent.isShortRelease(KeyCode::KEY_RF) || !shouldCurrentAppBeIgnoredOnSwitchBack()) {
- if (!newContactModel->isRightFunctionKeyForClearFunction() && isAnyUnsavedUserDataInWindow()) {
+ if (isAnyUnsavedUserDataInWindow()) {
if (inputEvent.isShortRelease(gui::KeyCode::KEY_RF) || inputEvent.isLongRelease(gui::KeyCode::KEY_RF)) {
showDialogUnsavedChanges([this]() {
application->returnToPreviousWindow();
M module-gui/gui/widgets/text/Text.cpp => module-gui/gui/widgets/text/Text.cpp +3 -38
@@ 360,19 360,6 @@ namespace gui
this->inputMode = mode;
}
- bool Text::isInputMode(InputMode::Mode mode)
- {
- if (inputMode == nullptr) {
- LOG_WARN("Pointer to inputMode is set as nullptr");
- return false;
- }
-
- if (inputMode->is(mode)) {
- return true;
- }
- return false;
- }
-
std::string Text::getInputModeKeyMap()
{
if (inputMode == nullptr) {
@@ 559,8 546,7 @@ namespace gui
auto Text::handleRotateInputMode(const InputEvent &inputEvent) -> bool
{
- if (inputMode != nullptr && !inputMode->is(InputMode::phone) &&
- inputEvent.isShortRelease(gui::KeyCode::KEY_AST)) {
+ if (inputMode != nullptr && inputEvent.isShortRelease(gui::KeyCode::KEY_AST)) {
inputMode->next();
return true;
}
@@ 586,9 572,6 @@ namespace gui
auto Text::handleActivation(const InputEvent &inputEvent) -> bool
{
- if (inputMode && inputMode->is(InputMode::phone)) {
- return false;
- }
return inputEvent.isShortRelease(KeyCode::KEY_AST) && Rect::onActivated(nullptr);
}
@@ 654,13 637,7 @@ namespace gui
if (!isMode(EditMode::Edit)) {
return false;
}
-
- if (document->isEmpty() && inputMode->is(InputMode::phone)) {
- return false;
- }
-
- auto removeKeyCode = inputMode->is(InputMode::phone) ? removeKeyForPhone : removeKey;
- if (inputEvent.isShortRelease(removeKeyCode)) {
+ if (inputEvent.isShortRelease(removeKey)) {
setCursorStartPosition(CursorStartPosition::Offset);
@@ 678,9 655,7 @@ namespace gui
if (!isMode(EditMode::Edit)) {
return false;
}
-
- auto removeKeyCode = inputMode->is(InputMode::phone) ? removeKeyForPhone : removeKey;
- if (inputEvent.isLongRelease(removeKeyCode)) {
+ if (inputEvent.isLongRelease(removeKey)) {
if (!document->isEmpty()) {
removeFromCursor();
return true;
@@ 1059,16 1034,6 @@ namespace gui
return false;
}
- bool Text::removeWholeText()
- {
- bool returnValue = false;
- while (!document->isEmpty()) {
- cursor->removeChar();
- returnValue = true;
- }
- return returnValue;
- }
-
void Text::onTextChanged()
{
if (textChangedCallback) {
M module-gui/gui/widgets/text/Text.hpp => module-gui/gui/widgets/text/Text.hpp +1 -4
@@ 29,8 29,7 @@ namespace gui
unsigned int cursorPos;
};
- constexpr KeyCode removeKey = KeyCode::KEY_PND;
- constexpr KeyCode removeKeyForPhone = KeyCode::KEY_RF;
+ constexpr KeyCode removeKey = KeyCode::KEY_PND;
/// @brief Widget that holds multiple lines of text.
///
@@ 172,7 171,6 @@ namespace gui
/// move ownership of mode ptr to Text
void setInputMode(InputMode *&&mode);
- bool isInputMode(InputMode::Mode mode);
std::string getInputModeKeyMap();
InputMode::Mode detectInputMode();
@@ 211,7 209,6 @@ namespace gui
bool addChar(std::uint32_t utf8);
bool removeChar();
- bool removeWholeText();
void onTextChanged();
void setTextChangedCallback(TextChangedCallback &&callback);
};
M pure_changelog.md => pure_changelog.md +0 -1
@@ 22,7 22,6 @@
* Fixed losing unsaved user data when tethering is switching on
* Fixed invalid elapsed time in music player after playing and pausing track from songs list view
* Fixed disappearing "Call" label in Phonebook app
-* Fixed phone number input style unification
* Fixed disappearing selections when setting custom alarm after popup is shown
* Fixed alarm preview playback behavior
* Fixed frequency lock during user activity