World Clock: User location limit popup added. 39/92639/3
authorRadoslaw Czerski <r.czerski@samsung.com>
Thu, 20 Oct 2016 08:52:05 +0000 (10:52 +0200)
committerRadoslaw Czerski <r.czerski@samsung.com>
Thu, 20 Oct 2016 08:52:05 +0000 (10:52 +0200)
Change-Id: Iaf39f05a30fa1af53e71cf3964292df036e751a9
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
clock/inc/Model/WorldClock.h
clock/inc/Presenter/WorldClockPresenter.h
clock/res/po/en_US.po
clock/src/Presenter/WorldClockPresenter.cpp
clock/src/View/WorldClockView.cpp

index 25c0e92..d951c21 100644 (file)
@@ -40,7 +40,7 @@ namespace model {
                        /**
                         * @brief Enumeration for direction of time zone shift.
                         */
-                       enum Direction{
+                       enum Direction {
                                LEFT,//!< LEFT
                                RIGHT//!< RIGHT
                        };
index 5c60afe..3253efe 100644 (file)
@@ -24,6 +24,14 @@ namespace presenter {
 
        class WorldClockPresenter {
                public:
+
+               /**
+                * @brief Limits
+                */
+               enum  Limits {
+                       USER_LOCATIONS_LIMIT = 20
+               };
+
                        WorldClockPresenter(view::WorldClockView *view, model::WorldClock *model);
                        ~WorldClockPresenter();
 
index ea30f26..8c0aff2 100644 (file)
@@ -1,6 +1,9 @@
 # This PO file is automatically generated by PO File Editor of Tizen Studio
 # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES CAN BE OVERWRITTEN
 
+msgid "IDS_CLOCK_TPOP_CANT_ADD_MORE_THAN_PD_CITIES"
+msgstr "Can't add more than %d cities."
+
 msgid "IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB"
 msgstr "%d h %d m ahead"
 
@@ -15,3 +18,4 @@ msgstr "%d h behind"
 
 msgid "IDS_CLOCK_MAX_RECORDS_REACHED_POPUP_ABB"
 msgstr "Maximum number of stopwatch records (%d) reached."
+
index e5fd81f..2c42390 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "Presenter/WorldClockPresenter.h"
 #include "Utils/Log.h"
+#include "Utils/PopupManager.h"
 
 namespace presenter {
 
@@ -79,6 +80,14 @@ void WorldClockPresenter::OnMapViewUpdateRequest()
 
 void WorldClockPresenter::OnItemAdded()
 {
+       if (model_->user_locations_.size() >= USER_LOCATIONS_LIMIT) {
+
+               char message[128] = {0,};
+               snprintf(message, sizeof(message),
+                               _("IDS_CLOCK_TPOP_CANT_ADD_MORE_THAN_PD_CITIES"), USER_LOCATIONS_LIMIT);
+               utils::PopupManager::CreatePopup(*view_, std::string(message), 3);
+               return;
+       }
        const model::Location *l = view_->GetLocationToAdd();
        if (!l) {
                ERR("Invalid Location object");
index 953a67f..6dd242b 100644 (file)
@@ -28,6 +28,7 @@
 #include "Internal/WorldClockDefs.h"
 #include "Utils/Log.h"
 #include "Utils/Time.h"
+#include "Utils/PopupManager.h"
 
 using namespace view;
 using namespace utils;
@@ -694,5 +695,5 @@ void WorldClockView::HideEmptyListLabel()
 void WorldClockView::PostItemExistMessage()
 {
        // TODO This text is temporary. Waiting for UX Designer response
-       notification_status_message_post("Location already exists in the list");
+       utils::PopupManager::CreatePopup(*this, "Location already exists in the list", 3);
 }