Add message popups to ReminderForm and RepeatForm.(Resolve N_SE-25393)
authorSungWan Kim <sw0726.kim@samsung.com>
Tue, 26 Mar 2013 05:32:25 +0000 (14:32 +0900)
committerSungWan Kim <sw0726.kim@samsung.com>
Tue, 26 Mar 2013 05:32:25 +0000 (14:32 +0900)
Change-Id: I87320b47e09188acca933ed2a547de256715a9ed
Signed-off-by: SungWan Kim <sw0726.kim@samsung.com>
inc/ClReminderForm.h
inc/ClRepeatForm.h
inc/ClTypes.h
src/ClReminderForm.cpp
src/ClRepeatForm.cpp
src/ClTypes.cpp

index 01fe612..68955c8 100644 (file)
@@ -29,6 +29,7 @@ class ReminderForm
        : public Tizen::Ui::Controls::Form
        , public virtual Tizen::Ui::IActionEventListener
        , public virtual Tizen::Ui::IKeypadEventListener
+       , public virtual Tizen::Ui::Controls::IEditTextFilter
        , public virtual Tizen::Ui::Controls::IFormBackEventListener
        , public virtual Tizen::Ui::Controls::ISectionTableViewItemEventListener
        , public virtual Tizen::Ui::Controls::ISectionTableViewItemProvider
@@ -43,6 +44,8 @@ public:
        virtual result OnInitializing(void);
        virtual result OnTerminating(void);
 
+       virtual bool ValidatePastedText(const Tizen::Base::String& pastedText, Tizen::Base::String& replacedText);
+
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
 
        virtual int GetSectionCount(void);
index ceee1f9..d558bda 100644 (file)
@@ -31,6 +31,7 @@ class RepeatForm
        , public virtual Tizen::Ui::IActionEventListener
        , public virtual Tizen::Ui::IDateChangeEventListener
        , public virtual Tizen::Ui::IKeypadEventListener
+       , public virtual Tizen::Ui::Controls::IEditTextFilter
        , public virtual Tizen::Ui::Controls::IFormBackEventListener
        , public virtual Tizen::Ui::Controls::ISectionTableViewItemEventListener
        , public virtual Tizen::Ui::Controls::ISectionTableViewItemProvider
@@ -48,6 +49,8 @@ public:
        virtual void OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day);
        virtual void OnDateChangeCanceled(const Tizen::Ui::Control& source);
 
+       virtual bool ValidatePastedText(const Tizen::Base::String& pastedText, Tizen::Base::String& replacedText);
+
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
 
        virtual int GetSectionCount(void);
index 8fc35fb..55991c4 100644 (file)
@@ -99,6 +99,7 @@ extern const wchar_t* IDS_CLD_BODY_1_DAY_BEFORE;
 extern const wchar_t* IDS_CLD_BODY_2_DAYS_BEFORE;
 extern const wchar_t* IDS_CLD_BODY_1_WEEK_BEFORE;
 extern const wchar_t* IDS_CLD_BODY_BEFORE_LC;
+extern const wchar_t* IDS_CLD_POP_INVALID_TIME;
 extern const wchar_t* IDS_CLD_BODY_EVERY_DAY_ATNT;
 extern const wchar_t* IDS_CLD_BODY_EVERY_3_DAYS;
 extern const wchar_t* IDS_CLD_BODY_EVERY_WEEK;
index 716d6b9..b46aeed 100644 (file)
@@ -107,6 +107,23 @@ ReminderForm::OnTerminating(void)
        return E_SUCCESS;
 }
 
+bool
+ReminderForm::ValidatePastedText(const String& pastedText, String& replacedText)
+{
+       int value = 0;
+       TryCatch(Integer::Parse(pastedText, value) == E_SUCCESS, , "[E_FAILURE] Invalid text is pasted.");
+       TryCatch(value > 0 && value < 100, , "[E_FAILURE] Invalid text is pasted.");
+
+       replacedText = Integer::ToString(value);
+       return pastedText.Equals(replacedText, true) == false;
+CATCH:
+       replacedText = L"";
+       MessageBox msgBox;
+       msgBox.Construct(L"", ResourceManager::GetString(IDS_CLD_POP_INVALID_TIME), MSGBOX_STYLE_NONE);
+       msgBox.ShowAndWait(value);
+       return true;
+}
+
 void
 ReminderForm::OnFormBackRequested(Form& source)
 {
@@ -198,6 +215,7 @@ ReminderForm::CreateItem(int sectionIndex, int itemIndex, int itemWidth)
                                                                                        H_REMINDER_TYPE_CUSTOM_EDIT_FILED), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_OVERLAY, false, 2);
                __pEditFieldReminderTime->SetGuideText(L"00");
                __pEditFieldReminderTime->AddKeypadEventListener(*this);
+               __pEditFieldReminderTime->SetEditTextFilter(this);
                if (__customReminderTimeOffset > 0)
                {
                        __pEditFieldReminderTime->SetText(Integer::ToString(__customReminderTimeOffset));
index 54db962..ba80e04 100644 (file)
@@ -112,6 +112,23 @@ RepeatForm::OnDateChangeCanceled(const Control& source)
 {
 }
 
+bool
+RepeatForm::ValidatePastedText(const String& pastedText, String& replacedText)
+{
+       int value = 0;
+       TryCatch(Integer::Parse(pastedText, value) == E_SUCCESS, , "[E_FAILURE] Invalid text is pasted.");
+       TryCatch(value > 0 && value < 100, , "[E_FAILURE] Invalid text is pasted.");
+
+       replacedText = Integer::ToString(value);
+       return pastedText.Equals(replacedText, true) == false;
+CATCH:
+       replacedText = L"";
+       MessageBox msgBox;
+       msgBox.Construct(L"", ResourceManager::GetString(IDS_CLD_BODY_REPEAT_WARNING), MSGBOX_STYLE_NONE);
+       msgBox.ShowAndWait(value);
+       return true;
+}
+
 void
 RepeatForm::OnFormBackRequested(Form& source)
 {
@@ -303,6 +320,7 @@ RepeatForm::CreateItem(int sectionIndex, int itemIndex, int itemWidth)
                        __pEditFieldRepeatCount->Construct(Rectangle(itemBounds.x, Y_REPEAT_UNTIL_TYPE_EDIT_FIELD, W_REPEAT_UNTIL_TYPE_EDIT_FIELD, H_REPEAT_UNTIL_TYPE_EDIT_FIELD),
                                                                                                   EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_OVERLAY, false, 2);
                        __pEditFieldRepeatCount->AddKeypadEventListener(*this);
+                       __pEditFieldRepeatCount->SetEditTextFilter(this);
                        pItem->AddControl(*__pEditFieldRepeatCount);
 
                        __pEditFieldRepeatCount->SetText(Integer::ToString(__repeatCount));
index 3aacfc5..680da25 100644 (file)
@@ -98,6 +98,7 @@ const wchar_t* IDS_CLD_BODY_1_DAY_BEFORE = L"IDS_CLD_BODY_1_DAY_BEFORE";
 const wchar_t* IDS_CLD_BODY_2_DAYS_BEFORE = L"IDS_CLD_BODY_2_DAYS_BEFORE";
 const wchar_t* IDS_CLD_BODY_1_WEEK_BEFORE = L"IDS_CLD_BODY_1_WEEK_BEFORE";
 const wchar_t* IDS_CLD_BODY_BEFORE_LC = L"IDS_CLD_BODY_BEFORE_LC";
+const wchar_t* IDS_CLD_POP_INVALID_TIME = L"IDS_CLD_POP_INVALID_TIME";
 const wchar_t* IDS_CLD_BODY_EVERY_DAY_ATNT = L"IDS_CLD_BODY_EVERY_DAY_ATNT";
 const wchar_t* IDS_CLD_BODY_EVERY_3_DAYS = L"IDS_CLD_BODY_EVERY_3_DAYS";
 const wchar_t* IDS_CLD_BODY_EVERY_WEEK = L"IDS_CLD_BODY_EVERY_WEEK";