Fixed nabi issues
authorSeema <seema.nagraj@samsung.com>
Tue, 2 Jul 2013 11:39:47 +0000 (17:09 +0530)
committerSeema <seema.nagraj@samsung.com>
Tue, 2 Jul 2013 11:39:47 +0000 (17:09 +0530)
Change-Id: Ibf7d69b7297a89689ce00a0914885053ff06a753
Signed-off-by: Seema <seema.nagraj@samsung.com>
inc/MmDrawingDetailForm.h
inc/MmDrawingEditorForm.h
inc/MmTextEditorForm.h
src/MmCommonUtils.cpp
src/MmDrawingDetailForm.cpp
src/MmDrawingEditorForm.cpp
src/MmMemoApp.cpp
src/MmTextEditorForm.cpp

index 9a78a6b..8332804 100644 (file)
@@ -110,6 +110,8 @@ private:
        ///Launches the create drawing scene in edit mode with selected memo content
        void EditDrawingMemo(void);
 
+       void HandleSavePopUpCancelEvent(void);
+
 private:
        Tizen::Base::String                             __memoComment;
        Tizen::Graphics::Bitmap*            __pBitmap;
@@ -133,6 +135,8 @@ private:
        Tizen::Base::String*                    __pVntFilename;
        Tizen::Base::String*                    __pDrawingFileName;
        Tizen::Ui::Controls::OptionMenu*        __pOption;
+       Tizen::Ui::Controls::Popup*         __pSavePopup;
+       int                                                                     __previousActionId;
 };
 
 #endif /* _MM_DRAWING_DETAIL_FORM_H_ */
index 70a5f3b..b8a99e7 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _MM_DRAWING_EDITOR_FORM_H_
 #define _MM_DRAWING_EDITOR_FORM_H_
 
+#include <FSystem.h>
+
 class CurveLine;
 class DrawingObject;
 class Eraser;
@@ -37,6 +39,7 @@ class MemoDrawingEditorForm
        , public Tizen::Ui::Controls::ISliderEventListener
        , public Tizen::Ui::Scenes::ISceneEventListener
        , public Tizen::Ui::IPropagatedKeyEventListener
+       , public Tizen::System::ISettingEventListener
 {
 public:
        MemoDrawingEditorForm(void);
@@ -174,6 +177,8 @@ public:
        virtual bool OnPreviewKeyReleased (Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
 
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       virtual void OnSettingChanged(Tizen::Base::String& key);
 private:
        ///indicates the mode of canvas
        enum MemoDrawingMode
@@ -246,6 +251,8 @@ private:
        Tizen::Base::Collection::ArrayList*     __pUpdateDetails;
        Tizen::Ui::Controls::Popup*         __pSavePopup;
        int                                                             __previousActionId;
+       Tizen::Base::String                                     __dateTimeFormat;
+       Tizen::Base::String                                     __dateTime;
 };
 
 #endif /* _MM_DRAWING_EDITOR_FORM_H_ */
index e4a081e..d52ccf5 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _MM_TEXT_EDITOR_FORM_H_
 #define _MM_TEXT_EDITOR_FORM_H_
 
+#include <FSystem.h>
+
 enum RepositionLabel
 {
        ID_DEMO_POSITION,
@@ -41,6 +43,7 @@ class MemoTextEditorForm
        , public Tizen::Ui::Controls::IFormBackEventListener
        , public Tizen::Ui::Controls::ISliderEventListener
        , public Tizen::Ui::Scenes::ISceneEventListener
+       , public Tizen::System::ISettingEventListener
 {
 public:
        MemoTextEditorForm(void);
@@ -101,6 +104,8 @@ public:
 
        bool IsMemoEdited(void);
 
+       void SetDateTime(void);
+
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
 
        virtual void OnAdjustmentValueChanged(const Tizen::Ui::Control& source, int adjustment);
@@ -129,6 +134,7 @@ public:
        virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
        virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){};
 
+       virtual void OnSettingChanged(Tizen::Base::String& key);
 private:
        Tizen::Graphics::Color                    __buttonColor;
        ///the memo creation time
@@ -173,6 +179,8 @@ private:
        Tizen::Ui::Controls::Button*      __pButtonTextMode;
        Tizen::Ui::Controls::Popup*         __pSavePopup;
        int                                                                     __previousActionId;
+       Tizen::Base::String                                     __dateTimeFormat;
+       Tizen::Base::String                                     __dateTime;
 };
 
 #endif /* _MM_TEXT_EDITOR_FORM_H_ */
index ffd2b66..df8d3da 100644 (file)
@@ -93,7 +93,6 @@ ConstructSavePopup(Popup* pPopup, IActionEventListener* pActionEventListener)
                pButton2->AddActionEventListener(*pActionEventListener);
 
                pPopup->Invalidate(true);
-               AppLog("Seema 1");
        }
        return;
 }
index fae9495..3f73ccd 100644 (file)
@@ -63,6 +63,7 @@ MemoDrawingDetailForm::MemoDrawingDetailForm(void)
        , __pVntFilename(null)
        , __pDrawingFileName(null)
        , __pOption(null)
+       , __pSavePopup(null)
 {
        __pVMemoCreator = new (std::nothrow) VMemoCreator();
 }
@@ -254,6 +255,12 @@ MemoDrawingDetailForm::OnTerminating(void)
        {
                __pOption->Destroy();
        }
+       if (__pSavePopup != null)
+       {
+               __pSavePopup->RemoveAllControls();
+               delete __pSavePopup;
+               __pSavePopup = null;
+       }
        return E_SUCCESS;
 }
 
@@ -430,33 +437,49 @@ MemoDrawingDetailForm::OnActionPerformed(const Control& source, int actionId)
 
        case IDA_FOOTER_BUTTON_CREATE:     //New
                {
-                       SceneManager* pSceneManager = SceneManager::GetInstance();
+                       __previousActionId = IDA_FOOTER_BUTTON_CREATE;
                        UpdateComment();
-                       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_MEMO_DRAWING_EDITOR), null);
                }
                break;
 
        case IDA_FOOTER_BUTTON_SHARE:    //Share
                {
+                       __previousActionId = IDA_FOOTER_BUTTON_SHARE;
                        UpdateComment();
-                       // Shows List of AppControls to share Memo.
-                       if (__pPopup == null)
-                       {
-                               __pPopup = new (std::nothrow) Popup();
-                               __pPopupList = new (std::nothrow) ListView();
-                               __pPopupList->Construct(Tizen::Graphics::Rectangle(X_POPUP_LIST_RECTANGLE, Y_POPUP_LIST_RECTANGLE, W_POPUP_LIST_RECTANGLE, H_POPUP_LIST_RECTANGLE), true, SCROLL_STYLE_FAST_SCROLL);
-                               AppControlListProvider* pAppControlListProvider = new (std::nothrow) AppControlListProvider();
-                               ConstructAppControlPopup(__pPopup, __pPopupList, pAppControlListProvider, this, this);
-                       }
-                       __pPopup->SetShowState(true);
-                       __pPopup->Show();
                }
                break;
 
        case IDA_FOOTER_BUTTON_EDIT:    //Edit
                {
+                       __previousActionId = IDA_FOOTER_BUTTON_EDIT;
                        UpdateComment();
-                       EditDrawingMemo();
+               }
+               break;
+
+       case IDA_BUTTON_SAVE_POPUP:
+               {
+                       __pSavePopup->SetShowState(false);
+                       __pSavePopup->Invalidate(true);
+
+                       String newComment = __pCommentEditArea->GetText();
+                       newComment.Trim();
+                       if (newComment.IsEmpty() != true)
+                       {
+                               __pMemoData->SetMemoContents(newComment);
+                       }
+                       else
+                       {
+                               //If comment is null then save the filename as contents in memo data
+                               String fileName = File::GetFileName(__pMemoData->GetMemoDrawingPath());
+                               fileName.SetLength(fileName.GetLength() - FILE_EXTENSION_SIZE);
+                               __pMemoData->SetMemoContents(fileName);
+                       }
+                       DateTime modificationTime;
+                       SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
+                       __pMemoData->SetMemoModificationTime(modificationTime);
+                       MemoDataPresentationModel::GetInstance()->UpdateMemoAt(__pMemoData->GetMemoIndex(), __pMemoData);
+                       __memoComment = newComment;
+                       HandleSavePopUpCancelEvent();
                }
                break;
 
@@ -469,8 +492,17 @@ MemoDrawingDetailForm::OnActionPerformed(const Control& source, int actionId)
 
        case IDA_BUTTON_CANCEL_POPUP:
                {
-                       __pDeletePopup->SetShowState(false);
-                       __pDeletePopup->Invalidate(true);
+                       if(__pDeletePopup && __pDeletePopup->GetShowState() == true)
+                       {
+                               __pDeletePopup->SetShowState(false);
+                               __pDeletePopup->Invalidate(true);
+                       }
+                       if(__pSavePopup && __pSavePopup->GetShowState() == true)
+                       {
+                               __pSavePopup->SetShowState(false);
+                               __pSavePopup->Invalidate(true);
+                               HandleSavePopUpCancelEvent();
+                       }
                }
                break;
 
@@ -638,12 +670,8 @@ MemoDrawingDetailForm::OnFormBackRequested(Form& source)
        }
        else
        {
-               SceneManager* pSceneManager = SceneManager::GetInstance();
-               IList* pArgs = new (std::nothrow) ArrayList();
-
+               __previousActionId = 1;
                UpdateComment();
-               pArgs->Add(new Integer(ID_REFRESH_LIST_FROM_DATABASE));
-               pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
        }
        return;
 }
@@ -721,31 +749,18 @@ void MemoDrawingDetailForm::UpdateComment()
 {
        if (IsCommentEdited() == false)
        {
+               HandleSavePopUpCancelEvent();
                return;
        }
 
-       int modalResult = ShowMessagePopUp(GetResourceString(L"IDS_COM_POP_ERRORMSG_SAVE_Q"), L"", MSGBOX_STYLE_YESNO, 0);
-       if (modalResult == MSGBOX_RESULT_YES)
+       if (__pSavePopup == null)
        {
-               String newComment = __pCommentEditArea->GetText();
-               newComment.Trim();
-               if (newComment.IsEmpty() != true)
-               {
-                       __pMemoData->SetMemoContents(newComment);
-               }
-               else
-               {
-                       //If comment is null then save the filename as contents in memo data
-                       String fileName = File::GetFileName(__pMemoData->GetMemoDrawingPath());
-                       fileName.SetLength(fileName.GetLength() - FILE_EXTENSION_SIZE);
-                       __pMemoData->SetMemoContents(fileName);
-               }
-               DateTime modificationTime;
-               SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
-               __pMemoData->SetMemoModificationTime(modificationTime);
-               MemoDataPresentationModel::GetInstance()->UpdateMemoAt(__pMemoData->GetMemoIndex(), __pMemoData);
-               __memoComment = newComment;
+               __pSavePopup = new (std::nothrow) Popup();
+               ConstructSavePopup(__pSavePopup, this);
        }
+       __pSavePopup->SetShowState(true);
+       __pSavePopup->Show();
+
        return;
 }
 
@@ -853,3 +868,40 @@ MemoDrawingDetailForm::OnPreviewKeyReleased(Control &source, const Tizen::Ui::Ke
 {
        return false;
 }
+
+
+void
+MemoDrawingDetailForm::HandleSavePopUpCancelEvent(void)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       IList* pArgs = new (std::nothrow) ArrayList();
+
+       if(__previousActionId == IDA_FOOTER_BUTTON_CREATE)
+       {
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_MEMO_DRAWING_EDITOR), null);
+       }
+       else if(__previousActionId == IDA_FOOTER_BUTTON_SHARE)
+       {
+               // Shows List of AppControls to share Memo.
+               if (__pPopup == null)
+               {
+                       __pPopup = new (std::nothrow) Popup();
+                       __pPopupList = new (std::nothrow) ListView();
+                       __pPopupList->Construct(Tizen::Graphics::Rectangle(X_POPUP_LIST_RECTANGLE, Y_POPUP_LIST_RECTANGLE, W_POPUP_LIST_RECTANGLE, H_POPUP_LIST_RECTANGLE), true, SCROLL_STYLE_FAST_SCROLL);
+                       AppControlListProvider* pAppControlListProvider = new (std::nothrow) AppControlListProvider();
+                       ConstructAppControlPopup(__pPopup, __pPopupList, pAppControlListProvider, this, this);
+               }
+               __pPopup->SetShowState(true);
+               __pPopup->Show();
+       }
+       else if(__previousActionId == IDA_FOOTER_BUTTON_EDIT)
+       {
+               EditDrawingMemo();
+       }
+       else if(__previousActionId == 1)
+       {
+               pArgs->Add(new Integer(ID_REFRESH_LIST_FROM_DATABASE));
+               pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
+       }
+       return;
+}
index 7be2463..fe5748a 100644 (file)
@@ -20,7 +20,6 @@
  */
 
 #include <FMedia.h>
-#include <FSystem.h>
 #include "MmCommonUtils.h"
 #include "MmDataPresentationModel.h"
 #include "MmDrawingEditorForm.h"
@@ -1484,6 +1483,13 @@ MemoDrawingEditorForm::UpdateMemoInfo(void)
 void
 MemoDrawingEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
 {
+       SettingInfo::AddSettingEventListener(*this);
+       String dateTimeFormatKey = L"http://tizen.org/setting/locale.date_time.format";
+       String dateTimeKey = L"http://tizen.org/setting/locale.date_time";
+
+       SettingInfo::GetValue(dateTimeKey, __dateTime);
+       SettingInfo::GetValue(dateTimeFormatKey, __dateTimeFormat);
+
        if(previousSceneId == IDSCN_MEMO_ADD_EDIT_COMMENT)
        {
                if(pArgs != null)
@@ -1628,6 +1634,7 @@ MemoDrawingEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const S
                __pEditMemo = null;
                __isEditMode = false;
        }
+       SettingInfo::RemoveSettingEventListener(*this);
        return;
 }
 
@@ -1788,3 +1795,34 @@ MemoDrawingEditorForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
        }
 }
+
+void
+MemoDrawingEditorForm::OnSettingChanged(Tizen::Base::String& key)
+{
+       String dateTimeFormatString;
+       String dateTimeFormatKey = L"http://tizen.org/setting/locale.date_time.format";
+
+       String dateTimeString;
+       String dateTimeKey = L"http://tizen.org/setting/locale.date_time";
+
+       if ( key.CompareTo(dateTimeFormatKey) == 0 )
+       {
+               SettingInfo::GetValue(dateTimeFormatKey, dateTimeFormatString);
+               if ( __dateTimeFormat.CompareTo(dateTimeFormatString) !=0)
+               {
+                       __dateTimeFormat = dateTimeFormatString;
+                       SetDateTime();
+               }
+       }
+       else if ( key.CompareTo(dateTimeKey) == 0 )
+       {
+               SettingInfo::GetValue(dateTimeKey, dateTimeString);
+               if ( __dateTime.CompareTo(dateTimeString) !=0)
+               {
+                       __dateTime = dateTimeString;
+                       SetDateTime();
+               }
+       }
+       return;
+}
+
index 14a2a9a..f13c3f4 100644 (file)
@@ -119,6 +119,7 @@ MemoApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
                __pThumbnailProvider->Stop();
                __pThumbnailProvider->Join();
        }
+       SettingInfo::RemoveSettingEventListener(*this);
        return true;
 }
 
index e6c7f70..1f517a2 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include <FApp.h>
-#include <FSystem.h>
+
 #include "MmCommonUtils.h"
 #include "MmDataPresentationModel.h"
 #include "MmInfo.h"
@@ -83,6 +83,7 @@ result
 MemoTextEditorForm::OnInitializing(void)
 {
        result r = E_SUCCESS;
+
        __pMemoContentEditarea = static_cast<EditArea*>(GetControl("IDC_MEMOCONTENT"));
        __pMemoContentEditarea->AddActionEventListener(*this);
        __pMemoContentEditarea->AddTextEventListener(*this);
@@ -643,6 +644,13 @@ MemoTextEditorForm::OnDraw(void)
 void
 MemoTextEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
 {
+       String dateTimeFormatKey = L"http://tizen.org/setting/locale.date_time.format";
+       String dateTimeKey = L"http://tizen.org/setting/locale.date_time";
+
+       SettingInfo::GetValue(dateTimeKey, __dateTime);
+       SettingInfo::GetValue(dateTimeFormatKey, __dateTimeFormat);
+
+       SettingInfo::AddSettingEventListener(*this);
        RepositionControls(ID_DEFAULT_POSITION);
        SetSaveEnable(false);
        if (pArgs != null)
@@ -698,6 +706,7 @@ MemoTextEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const Scen
        __pMemoContentEditarea->Clear();
        RepositionControls(ID_DEFAULT_POSITION);
        __pEditMemo = null;
+       SettingInfo::RemoveSettingEventListener(*this);
        return;
 }
 
@@ -910,10 +919,7 @@ MemoTextEditorForm::RefreshCreateView(void)
        __pColorPickerPanel->Invalidate(true);
        __pSliderPanel->SetShowState(false);
        __pSliderPanel->Invalidate(true);
-       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
-       String createTimeString = GetMemoCreationDateTime(__createTime);
-       __pMemoCreateTime->SetText(createTimeString);
-       __pMemoCreateTime->Invalidate(true);
+       SetDateTime();
        __pMemoContentEditarea->Clear();
        __pMemoContentEditarea->ShowKeypad();
 
@@ -938,9 +944,7 @@ MemoTextEditorForm::SetMemoEditDetails(MemoInfo* pMemoData)
 
        __isEditMode = true;
        SetControlAlwaysAtBottom(*this, true);
-       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
-       String createTimeString = GetMemoCreationDateTime(__createTime);
-       __pMemoCreateTime->SetText(createTimeString);
+       SetDateTime();
 
        __pMemoContentEditarea->Clear();
        __pMemoContentEditarea->SetText(pMemoData->GetMemoContents());
@@ -1193,3 +1197,43 @@ MemoTextEditorForm::IsMemoEdited(void)
        }
        return false;
 }
+
+void
+MemoTextEditorForm::SetDateTime(void)
+{
+       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
+       String createTimeString = GetMemoCreationDateTime(__createTime);
+       __pMemoCreateTime->SetText(createTimeString);
+       __pMemoCreateTime->Invalidate(true);
+       return;
+}
+
+void
+MemoTextEditorForm::OnSettingChanged(Tizen::Base::String& key)
+{
+       String dateTimeFormatString;
+       String dateTimeFormatKey = L"http://tizen.org/setting/locale.date_time.format";
+
+       String dateTimeString;
+       String dateTimeKey = L"http://tizen.org/setting/locale.date_time";
+
+       if ( key.CompareTo(dateTimeFormatKey) == 0 )
+       {
+               SettingInfo::GetValue(dateTimeFormatKey, dateTimeFormatString);
+               if ( __dateTimeFormat.CompareTo(dateTimeFormatString) !=0)
+               {
+                       __dateTimeFormat = dateTimeFormatString;
+                       SetDateTime();
+               }
+       }
+       else if ( key.CompareTo(dateTimeKey) == 0 )
+       {
+               SettingInfo::GetValue(dateTimeKey, dateTimeString);
+               if ( __dateTime.CompareTo(dateTimeString) !=0)
+               {
+                       __dateTime = dateTimeString;
+                       SetDateTime();
+               }
+       }
+       return;
+}