From e0916921b7a74c9a4ec7c46903feaa6d35792201 Mon Sep 17 00:00:00 2001 From: Eugene Kurzberg Date: Wed, 1 Jun 2016 14:04:48 +0300 Subject: [PATCH] Added limit reached notification in SelectView. Change-Id: I3f5408bbe8f500d7089a050bb00a56b6e137777a Signed-off-by: Eugene Kurzberg --- lib-apps-common/inc/Ux/SelectView.h | 2 ++ lib-apps-common/src/Ux/SelectView.cpp | 5 +++++ lib-common/src/Common/Strings.cpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib-apps-common/inc/Ux/SelectView.h b/lib-apps-common/inc/Ux/SelectView.h index d9495e5a..7831623c 100644 --- a/lib-apps-common/inc/Ux/SelectView.h +++ b/lib-apps-common/inc/Ux/SelectView.h @@ -55,6 +55,8 @@ namespace Ux Can contain one integer format specifier. */ const char *titleWithLimit; /**< Title for #SelectMulti mode with limit. Can contain two integer format specifiers. */ + const char *popupLimit; /**< Selection limit reached popup text. + Can contain one integer format specifiers. */ }; /** diff --git a/lib-apps-common/src/Ux/SelectView.cpp b/lib-apps-common/src/Ux/SelectView.cpp index fef94330..8641d7a0 100644 --- a/lib-apps-common/src/Ux/SelectView.cpp +++ b/lib-apps-common/src/Ux/SelectView.cpp @@ -23,8 +23,10 @@ #include #include +#include #define TITLE_BUFFER_SIZE 32 +#define POPUP_BUFFER_SIZE 256 using namespace Ux; using namespace std::placeholders; @@ -331,6 +333,9 @@ bool SelectView::onItemChecked(SelectItem *item, bool isChecked) } if (m_SelectLimit && m_SelectCount == m_SelectLimit && isChecked) { + char buffer[POPUP_BUFFER_SIZE]; + snprintf(buffer, sizeof(buffer), _(m_Strings.popupLimit), m_SelectLimit); + notification_status_message_post(buffer); return false; } diff --git a/lib-common/src/Common/Strings.cpp b/lib-common/src/Common/Strings.cpp index 7e3ba7d7..61f1d779 100644 --- a/lib-common/src/Common/Strings.cpp +++ b/lib-common/src/Common/Strings.cpp @@ -109,7 +109,8 @@ namespace "IDS_PB_HEADER_SELECT", "IDS_PB_HEADER_SELECT", "IDS_PB_HEADER_PD_SELECTED_ABB", - "%zu/%zu" + "%zu/%zu", + "IDS_PB_POP_THE_MAXIMUM_NUMBER_OF_ITEMS_THAT_CAN_BE_SELECTED_HPD_HAS_BEEN_EXCEEDED" }; } -- 2.34.1