Fixed Nabi issues, Added Item sweep feature in Memo list
authorSeema <seema.nagraj@samsung.com>
Thu, 6 Jun 2013 05:41:47 +0000 (11:11 +0530)
committerSeema <seema.nagraj@samsung.com>
Thu, 6 Jun 2013 05:41:47 +0000 (11:11 +0530)
Change-Id: I5acc5d3158d2448a223150712eb7aa4967a1e3c9
Signed-off-by: Seema <seema.nagraj@samsung.com>
16 files changed:
inc/MmDrawingDetailForm.h
inc/MmItemProviders.h
inc/MmListEditorForm.h
inc/MmListForm.h
inc/MmTextDetailForm.h
inc/MmTypes.h
res/screen-size-normal/IDL_MEMO_LIST_EDITOR.xml
src/MmDrawingDetailForm.cpp
src/MmDrawingEditorForm.cpp
src/MmItemProviders.cpp
src/MmListEditorForm.cpp
src/MmListForm.cpp
src/MmMemoManager.cpp
src/MmTextDetailForm.cpp
src/MmTextEditorForm.cpp
src/MmTypes.cpp

index 3d94c95..5d9bcf1 100644 (file)
@@ -120,8 +120,11 @@ private:
        Tizen::Base::Collection::ArrayList*     __pUpdateDetails;
        Tizen::Ui::Controls::Popup*         __pDeletePopup;
        Tizen::Ui::TouchFlickGestureDetector* __pFlickGesture;
-       Tizen::Base::Integer* __pMemoIndex;
-       Tizen::Base::Integer* __pCount;
+       Tizen::Base::Integer*                           __pMemoIndex;
+       Tizen::Base::Integer*                           __pCount;
+       Tizen::Base::Collection::ArrayList* __pShareMemoList;
+       Tizen::Base::String*                    __pVntFilename;
+       Tizen::Base::String*                    __pDrawingFileName;
 };
 
 #endif /* _MM_DRAWING_DETAIL_FORM_H_ */
index 286d72c..dbed023 100644 (file)
@@ -86,6 +86,7 @@ private:
        ///previous list index
        int __previousIndex;
        MemoThumbnailProvider* __pThumbnailProvider;
+       Tizen::Ui::Controls::ListContextItem* __pItemContext;
 };
 
 ///item provider to use AppControl. List of Applications to be used.
index 3351f7f..3c6b6ab 100644 (file)
@@ -107,8 +107,9 @@ private:
        ///VMemoCreator object that helps in creating VNT file for each memo to be shared
        VMemoCreator*                       __pVMemoCreator;
        ///number of memo selected
-       int __selectedMemoCount;
+       int                                                             __selectedMemoCount;
        Tizen::Ui::Controls::Popup*         __pDeletePopup;
+       Tizen::Base::Collection::ArrayList* __pShareMemoList;
 };
 
 #endif /* _MM_LIST_EDITOR_FORM_H_ */
index 4c11a3c..7946dcd 100644 (file)
@@ -28,6 +28,7 @@ class SortByListProvider;
 class CustomDataProvider;
 class MemoListDataProvider;
 class MemoSearchDataProvider;
+class VMemoCreator;
 ///The form to List all memos.
 class MemoListForm
        : public IDataEventListener
@@ -67,6 +68,7 @@ public:
        int GetSortValueFromRegistry(void) const;
        void SetSortValueToRegistry(const int value);
 
+       void DeleteListItem(void);
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
 
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
@@ -80,7 +82,7 @@ public:
        virtual void OnKeypadOpened(Tizen::Ui::Control& source);
        virtual void OnKeypadWillOpen(Tizen::Ui::Control& source){};
 
-       virtual void OnListViewContextItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status){};
+       virtual void OnListViewContextItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status);
        virtual void OnListViewItemLongPressed (Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool &invokeListViewItemCallback){};
        virtual void OnListViewItemReordered (Tizen::Ui::Controls::ListView& listView, int indexFrom, int indexTo){};
        virtual void OnListViewItemStateChanged (Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
@@ -122,6 +124,15 @@ private:
        Tizen::App::AppRegistry*            __pAppRegistry;
        Tizen::Base::String                         __registryKey;
        bool                                                            __isKeypadOpened;
+       Tizen::Ui::Controls::Popup*         __pDeletePopup;
+       MemoInfo*                                                       __pMemoData;
+       int                                                                     __selectedItemIndex;
+       Tizen::Ui::Controls::Popup*         __pSharePopup;
+       Tizen::Ui::Controls::ListView*      __pSharePopupList;
+       VMemoCreator*                                       __pVMemoCreator;
+       AppControlListProvider*                 __pAppControlListProvider;
+       Tizen::Base::String*                    __pVntFilename;
+       Tizen::Base::Collection::ArrayList* __pShareMemoList;
 };
 
 #endif  /* _MM_LIST_FORM_H_ */
index e699148..f8442e2 100644 (file)
@@ -113,8 +113,9 @@ private:
        Tizen::Base::String*                    __pVntFilename;
        Tizen::Ui::Controls::Popup*         __pDeletePopup;
        Tizen::Ui::TouchFlickGestureDetector* __pFlickGesture;
-       Tizen::Base::Integer* __pMemoIndex;
-       Tizen::Base::Integer* __pCount;
+       Tizen::Base::Integer*                                   __pMemoIndex;
+       Tizen::Base::Integer*                                   __pCount;
+       Tizen::Base::Collection::ArrayList* __pShareMemoList;
 };
 
 #endif /* _MM_TEXT_DETAIL_FORM_H_ */
index d9b1fbb..83992ab 100644 (file)
@@ -122,6 +122,8 @@ extern const wchar_t* VNT_FILENAME_EXTENSION;
 extern const int ID_LISTITEM_CONTENT;
 extern const int ID_LISTITEM_DATETIME;
 extern const int ID_LISTITEM_IMAGE;
+extern const int ID_LISTCONTEXTITEM_DELETE;
+extern const int ID_LISTCONTEXTITEM_SHARE;
 
 //width and height of controls
 extern const int W_LIST_ITEM_IMAGE;
@@ -180,6 +182,7 @@ extern const unsigned int COLOR_BLUE;
 extern const unsigned int COLOR_SELECT_ALL;
 extern const unsigned int COLOR_TOOLBAR_BG;
 extern const unsigned int COLOR_COMMENT_BG;
+extern const unsigned int COLOR_RED;
 
 extern const wchar_t* IDB_COLOR_ICON;
 extern const wchar_t* IDB_COLOR_ICON_PRESS;
index b3276f9..5a492f1 100644 (file)
@@ -25,7 +25,7 @@
     </ListView>
     <Label id="IDC_LABEL_SELECTED" parent="IDL_MEMO_LIST_EDITOR">
         <property accessibilityHint="" backgroundBitmapPath="" backgroundColor="#444444" backgroundColorOpacity="100" horizontalAlign="ALIGN_CENTER" leftMargin="16" text="" textColor="#FFFFFF" textSize="33.0" textStyle="LABEL_TEXT_STYLE_BOLD" topMargin="0" verticalAlign="ALIGN_MIDDLE"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="48.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="720.0" x="0.0" y="966.0"/>
+        <layout bottomRelation="IDL_MEMO_LIST_EDITOR" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="52.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="IDC_LISTVIEW_EDITLIST" topRelationType="RECT_EDGE_RELATION_TOP_TO_BOTTOM" verticalFitPolicy="FIT_POLICY_FIXED" width="720.0" x="0.0" y="959.0"/>
         <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="31.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="1274.0" x="0.0" y="521.0"/>
     </Label>
 </Scene>
index 32a8b1d..b13c4b8 100644 (file)
@@ -59,8 +59,11 @@ MemoDrawingDetailForm::MemoDrawingDetailForm(void)
        , __pFlickGesture(null)
        , __pMemoIndex(null)
        , __pCount(null)
-
+       , __pShareMemoList(null)
+       , __pVntFilename(null)
+       , __pDrawingFileName(null)
 {
+       __pVMemoCreator = new (std::nothrow) VMemoCreator();
 }
 
 MemoDrawingDetailForm::~MemoDrawingDetailForm(void)
@@ -75,6 +78,7 @@ MemoDrawingDetailForm::~MemoDrawingDetailForm(void)
        }
        if (__pPopup != null)
        {
+               __pPopup->RemoveAllControls();
                delete __pPopup;
        }
        if(__pUpdateDetails != null)
@@ -86,16 +90,30 @@ MemoDrawingDetailForm::~MemoDrawingDetailForm(void)
        {
                delete __pDeletePopup;
        }
-       if(__pMemoIndex != null)
+       if (__pMemoIndex != null)
        {
                delete __pMemoIndex;
                __pMemoIndex = null;
        }
-       if(__pCount != null)
+       if (__pCount != null)
        {
                delete __pCount;
                __pCount = null;
        }
+       if (__pShareMemoList != null)
+       {
+               __pShareMemoList->RemoveAll();
+               delete __pShareMemoList;
+       }
+       if (__pVntFilename != null)
+       {
+               delete __pVntFilename;
+       }
+       if (__pDrawingFileName != null)
+       {
+               delete __pDrawingFileName;
+       }
+
 }
 
 result
@@ -104,8 +122,6 @@ MemoDrawingDetailForm::OnInitializing(void)
        result r = E_SUCCESS;
        int xPos= 0, yPos = 0;
 
-       __pVMemoCreator = new (std::nothrow) VMemoCreator();
-
        Header* pFormHeader = GetHeader();
        if (pFormHeader != null)
        {
@@ -484,23 +500,43 @@ MemoDrawingDetailForm::OnListViewItemStateChanged(ListView& listView, int index,
 {
        if (&listView == __pPopupList)
        {
-               String* pVmemoFilename = new (std::nothrow) String();
-               ArrayList* pShareMemoList = new (std::nothrow) ArrayList();
+               if(__pVntFilename == null)
+               {
+                       __pVntFilename = new (std::nothrow) String();
+               }
+               else
+               {
+                       __pVntFilename->Clear();
+               }
+
+               if(__pShareMemoList == null)
+               {
+                       __pShareMemoList = new (std::nothrow) ArrayList();
+                       __pShareMemoList->Construct();
+               }
+               else
+               {
+                       __pShareMemoList->RemoveAll();
+               }
 
                __pPopup->SetShowState(false);
                __pPopup->Invalidate(true);
 
-               pShareMemoList->Construct();
-               __pVMemoCreator = new (std::nothrow) VMemoCreator();
-               *pVmemoFilename = __pVMemoCreator->CreateVMemo(*__pMemoData);
-               pShareMemoList->Add(pVmemoFilename);
+               *__pVntFilename = __pVMemoCreator->CreateVMemo(*__pMemoData);
+               __pShareMemoList->Add(__pVntFilename);
 
-               String* pDrawingFileName = new (std::nothrow) String();
-               pDrawingFileName->Append(File::GetFileName(__pMemoData->GetMemoDrawingPath()));
-               pShareMemoList->Add(pDrawingFileName);
+               if(__pDrawingFileName == null)
+               {
+                       __pDrawingFileName = new (std::nothrow) String();
+               }
+               else
+               {
+                       __pDrawingFileName->Clear();
+               }
+               __pDrawingFileName->Append(File::GetFileName(__pMemoData->GetMemoDrawingPath()));
+               __pShareMemoList->Add(__pDrawingFileName);
 
-               LaunchAppToShare(index, pShareMemoList);
-               pShareMemoList = null;
+               LaunchAppToShare(index, __pShareMemoList);
        }
        return;
 }
@@ -703,7 +739,7 @@ void MemoDrawingDetailForm::UpdateComment()
                        __pMemoData->SetMemoContents(fileName);
                }
                DateTime modificationTime;
-               SystemTime::GetCurrentTime(STANDARD_TIME, modificationTime);
+               SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
                __pMemoData->SetMemoModificationTime(modificationTime);
                MemoDataPresentationModel::GetInstance()->UpdateMemoAt(__pMemoData->GetMemoIndex(), __pMemoData);
                __memoComment = newComment;
index 7d43962..6cd8303 100644 (file)
@@ -117,7 +117,7 @@ MemoDrawingEditorForm::OnInitializing(void)
        __pMemoCreateTimePanel->SetBackgroundColor(Color::GetColor(COLOR_ID_WHITE));
 
        __pMemoCreateTime = static_cast<Label*>(GetControl("IDC_LABEL_DATETIME"));
-       SystemTime::GetCurrentTime(STANDARD_TIME, __createTime);
+       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
        String createTimeString = GetMemoCreationDateTime(__createTime);
        __pMemoCreateTime->SetText(createTimeString);
        __pMemoCreateTime->SetBackgroundColor(Color::GetColor(COLOR_ID_WHITE));
@@ -305,7 +305,7 @@ MemoDrawingEditorForm::ResetColorPicker(void)
 void
 MemoDrawingEditorForm::SetDateTime(void)
 {
-       SystemTime::GetCurrentTime(STANDARD_TIME, __createTime);
+       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
        String createTimeString = GetMemoCreationDateTime(__createTime);
        __pMemoCreateTime->SetText(createTimeString);
        __pMemoCreateTime->Invalidate(true);
@@ -913,57 +913,98 @@ MemoDrawingEditorForm::SetSaveEnabled(bool isEnable)
 
        String comment = __pComment->GetText();
        comment.Trim();
+       bool enable = false;
+       int objectCount = __drawingObjects.GetCount();
+       if(objectCount == 0)
+       {
+               enable = false; //No line , no eraser so object count is zero
+       }
+       else
+       {
+               //Check the object count for all the objects
+               for(int i = 0; i < objectCount; i++)
+               {
+                       DrawingObject* object = null;
+                       object = (DrawingObject*)__drawingObjects.GetAt(i);
+                       //In create mode check only for Curve line objects
+                       if(__isEditMode == false)
+                       {
+                               if(object != null && object->GetDrawingObjectType() == CURVELINE_OBJECT )
+                               {
+                                       CurveLine* pCurveLine = (CurveLine*)object;
+                                       if(pCurveLine != null && pCurveLine->curvelinePointLists.GetCount() < 2)
+                                       {
+                                               enable = false;
+                                       }
+                                       else
+                                       {
+                                               enable = true;
+                                               break;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               //In create mode check both for Curveline and eraser objects
+                               //as user can edit the already drawn image using eraser before drawing any new line
+                               if(object != null && object->GetDrawingObjectType() == CURVELINE_OBJECT )
+                               {
+                                       CurveLine* pCurveLine = (CurveLine*)object;
+                                       if(pCurveLine != null && pCurveLine->curvelinePointLists.GetCount() < 2)
+                                       {
+                                               enable = false;
+                                       }
+                                       else
+                                       {
+                                               enable = true;
+                                               break;
+                                       }
+                               }
+                               else if(object != null && object->GetDrawingObjectType() == ERASER_OBJECT )
+                               {
+                                       Eraser* pEraser = (Eraser*)object;
+                                       if(pEraser != null && pEraser->eraserPointLists.GetCount() < 2)
+                                       {
+                                               enable = false;
+                                       }
+                                       else
+                                       {
+                                               enable = true;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+       }
 
        if (isEnable == true)
        {
                if(__isEditMode == false)
                {
-                       int pointCount = 0;
-                       if(__pCurveLine != null)
-                       {
-                               pointCount = __pCurveLine->GetObjectCount();
-                       }
-                       if (pointCount > 1 || comment.GetLength() != 0)
+                       if (enable == true || comment.GetLength() != 0)
                        {
                                __pFormHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
                        }
                        else
                        {
-                               __pComment->Clear();
+                               __pFormHeader->SetItemSelected(1);
                                __pFormHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
                                __pFormHeader->SetButtonTextColor(BUTTON_ITEM_STATUS_DISABLED, Color::GetColor(COLOR_ID_GREY));
                        }
                }
                else if(__isEditMode == true)
                {
-                       int pointCount = 0;
-                       if(__pCurveLine != null)
-                       {
-                               pointCount = __pCurveLine->GetObjectCount();
-                       }
-                       else if(__pEraser != null)
-                       {
-                               pointCount = __pEraser->eraserPointLists.GetCount();
-                       }
-                       if (pointCount > 1 || IsCommentEdited() == true)
+                       if (enable == true || IsCommentEdited() == true)
                        {
                                __pFormHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
                        }
                        else
                        {
-                               __pComment->Clear();
+                               __pFormHeader->SetItemSelected(1);
                                __pFormHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
                                __pFormHeader->SetButtonTextColor(BUTTON_ITEM_STATUS_DISABLED, Color::GetColor(COLOR_ID_GREY));
                        }
                }
-               else
-               {
-                       //When only whitespace is entered, Save has to be disabled and
-                       //the Comment EditArea's field has to be cleared
-                       __pComment->Clear();
-                       __pFormHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
-                       __pFormHeader->SetButtonTextColor(BUTTON_ITEM_STATUS_DISABLED, Color::GetColor(COLOR_ID_GREY));
-               }
        }
        else
        {
@@ -1231,6 +1272,7 @@ MemoDrawingEditorForm::OnActionPerformed(const Control& source, int actionId)
                                        else
                                        {
                                                UpdateMemoInfo();
+                                               (MemoThumbnailProvider::GetInstance())->RemoveObjectBitmap(__pEditMemo->GetMemoIndex());
                                        }
                                        pArgs->RemoveAt(0, true);
                                        pArgs->Add(new (std::nothrow) Integer(ID_REFRESH_LIST_FROM_DATABASE));
@@ -1315,7 +1357,7 @@ MemoDrawingEditorForm::SaveMemoInfo(void)
                pNewMemo->SetMemoTextColor(colorRGB);
                
                Tizen::Base::DateTime modificationTime;
-               SystemTime::GetCurrentTime(STANDARD_TIME, modificationTime);
+               SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
                pNewMemo->SetMemoModificationTime(modificationTime);
 
                pNewMemo->SetMemoDrawingPath(filePath);
@@ -1365,7 +1407,7 @@ MemoDrawingEditorForm::UpdateMemoInfo(void)
                pNewMemo->SetMemoDrawingPath(__pEditMemo->GetMemoDrawingPath());
 
                Tizen::Base::DateTime modificationTime;
-               SystemTime::GetCurrentTime(STANDARD_TIME, modificationTime);
+               SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
                pNewMemo->SetMemoModificationTime(modificationTime);
 
                r = MemoDataPresentationModel::GetInstance()->UpdateMemoAt(__pEditMemo->GetMemoIndex(), pNewMemo);
@@ -1412,42 +1454,7 @@ MemoDrawingEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const S
                        }
                        else
                        {
-                               if(__drawingObjects.GetCount() == 0)
-                               {
-                                       SetSaveEnabled(false);
-                               }
-                               else
-                               {
-                                       int objectCount = __drawingObjects.GetCount();
-                                       bool enable = false;
-                                       for (int i=0; i < objectCount; i++)
-                                       {
-                                               DrawingObject* object = null;
-                                               object = (DrawingObject*)__drawingObjects.GetAt(i);
-                                               if(object != null && object->GetDrawingObjectType() == CURVELINE_OBJECT )
-                                               {
-                                                       CurveLine* pCurveLine = (CurveLine*)object;
-                                                       if(pCurveLine != null && pCurveLine->curvelinePointLists.GetCount() < 2)
-                                                       {
-                                                               enable = false;
-                                                       }
-                                                       else
-                                                       {
-                                                               enable = true;
-                                                               break;
-                                                       }
-                                               }
-                                       }
-                                       if(enable == true)
-                                       {
-                                               SetSaveEnabled(true);
-                                       }
-                                       else
-                                       {
-                                               SetSaveEnabled(false);
-                                       }
-
-                               }
+                               SetSaveEnabled(true);
                        }
                }
                __pComment->SetCursorPosition(0);
index 87e6373..c1e4a99 100644 (file)
@@ -264,11 +264,23 @@ MemoListDataProvider::MemoListDataProvider(void)
        , __previousIndex(-1)
 {
        __pThumbnailProvider = MemoThumbnailProvider::GetInstance();
+       __pItemContext = new (std::nothrow) ListContextItem();
+       __pItemContext->Construct();
+       __pItemContext->AddElement(ID_LISTCONTEXTITEM_SHARE, GetResourceString(L"IDS_COM_BUTTON_SHARE"));
+       __pItemContext->AddElement(ID_LISTCONTEXTITEM_DELETE, GetResourceString(L"IDS_COM_BODY_DELETE"));
+       __pItemContext->SetElementBackgroundColor(ID_LISTCONTEXTITEM_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, Color(COLOR_RED, false));
+       __pItemContext->SetElementBackgroundColor(ID_LISTCONTEXTITEM_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED, Color(COLOR_RED, false));
+
        return;
 }
 
 MemoListDataProvider::~MemoListDataProvider(void)
 {
+       if(__pItemContext != null)
+       {
+               delete __pItemContext;
+               __pItemContext = null;
+       }
        return;
 }
 
@@ -384,6 +396,11 @@ MemoListDataProvider::CreateItem(int index, int itemWidth)
                                pItem->AddElement(Rectangle(X_RECTANGLE, Y_RECTANGLE_TEXT, W_EDIT_MAIN_TEXT_ITEM, H_RECTANGLE_TEXT), ID_LISTITEM_CONTENT, pMemoData->GetMemoContents().GetPointer(), FONT_SIZE_CONTENT, Color(COLOR_BLACK, false), Color(COLOR_BLACK,false), Color(COLOR_BLACK,false), false);
                        }
                }
+
+               if (currentSceneId == IDSCN_MEMO_LIST && __pItemContext != null)
+               {
+                       pItem->SetContextItem(__pItemContext);
+               }
                return pItem;
        }
        else
index 8749e61..5985452 100644 (file)
@@ -54,6 +54,7 @@ MemoListEditorForm::MemoListEditorForm(void)
        , __pVMemoCreator(null)
        , __selectedMemoCount(0)
        , __pDeletePopup(null)
+       , __pShareMemoList(null)
 {
 }
 
@@ -142,6 +143,7 @@ MemoListEditorForm::OnTerminating(void)
        }
        if (__pPopup != null)
        {
+               __pPopup->RemoveAllControls();
                delete __pPopup;
                __pPopup = null;
        }
@@ -150,6 +152,11 @@ MemoListEditorForm::OnTerminating(void)
                delete __pDeletePopup;
                __pDeletePopup = null;
        }
+       if (__pShareMemoList != null)
+       {
+               __pShareMemoList->RemoveAll(true);
+               delete __pShareMemoList;
+       }
        return E_SUCCESS;
 }
 
@@ -254,10 +261,18 @@ IList*
 MemoListEditorForm::CreateVntFilesList(void)
 {
        bool isItemChecked = false;
-       ArrayList* pShareMemoList = new (std::nothrow) ArrayList();
+
+       if(__pShareMemoList == null)
+       {
+               __pShareMemoList = new (std::nothrow) ArrayList();
+               __pShareMemoList->Construct();
+       }
+       else
+       {
+               __pShareMemoList->RemoveAll(true);
+       }
 
        MemoListPresentationModel::GetInstance()->ResetListIndex(ID_MEMO_LIST);
-       pShareMemoList->Construct();
 
        for (int itemIndex = 0; itemIndex <= __memoCount; itemIndex++)
        {
@@ -269,17 +284,17 @@ MemoListEditorForm::CreateVntFilesList(void)
                        {
                                String* pFilename = new (std::nothrow) String();
                                *pFilename = __pVMemoCreator->CreateVMemo(*pMemoData);
-                               pShareMemoList->Add(pFilename);
+                               __pShareMemoList->Add(pFilename);
                                if (!pMemoData->GetMemoDrawingPath().IsEmpty())
                                {
                                        String* pDrawingFileName = new (std::nothrow) String();
                                        pDrawingFileName->Append(File::GetFileName(pMemoData->GetMemoDrawingPath()));
-                                       pShareMemoList->Add(pDrawingFileName);
+                                       __pShareMemoList->Add(pDrawingFileName);
                                }
                        }
                }
        }
-       return pShareMemoList;
+       return __pShareMemoList;
 }
 
 void
index ab762e3..59c7538 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "MmCommonUtils.h"
+#include "MmDataPresentationModel.h"
 #include "MmMemoManager.h"
 #include "MmInfo.h"
 #include "MmItemProviders.h"
@@ -27,6 +28,7 @@
 #include "MmListPresentationModel.h"
 #include "MmThumbnailProvider.h"
 #include "MmTypes.h"
+#include "MmVMemoCreator.h"
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
@@ -50,7 +52,15 @@ MemoListForm::MemoListForm(void)
        , __pPopupList(null)
        , __pAppRegistry(null)
        , __isKeypadOpened(false)
+       , __pDeletePopup(null)
+       , __pMemoData(null)
+       , __selectedItemIndex(-1)
+       , __pSharePopup(null)
+       , __pVntFilename(null)
+       , __pShareMemoList(null)
 {
+       __pVMemoCreator = new (std::nothrow) VMemoCreator();
+       __pAppControlListProvider = new (std::nothrow) AppControlListProvider();
 }
 
 MemoListForm::~MemoListForm(void)
@@ -139,11 +149,40 @@ MemoListForm::OnTerminating(void)
                __pMemoDetails->RemoveAll(false);
                delete __pMemoDetails;
        }
-       if(__pSortByListProvider != null)
+       if (__pSortByListProvider != null)
        {
                delete __pSortByListProvider;
                __pSortByListProvider = null;
        }
+       if (__pVMemoCreator != null)
+       {
+               delete __pVMemoCreator;
+       }
+       if (__pAppControlListProvider != null)
+       {
+               delete __pAppControlListProvider;
+       }
+       if (__pPopup != null)
+       {
+               __pPopup->RemoveAllControls();
+               delete __pPopup;
+               __pPopup = null;
+       }
+       if (__pSharePopup != null)
+       {
+               __pSharePopup->RemoveAllControls();
+               delete __pSharePopup;
+               __pSharePopup = null;
+       }
+       if (__pVntFilename != null)
+       {
+               delete __pVntFilename;
+       }
+       if(__pShareMemoList != null)
+       {
+               __pShareMemoList->RemoveAll();
+               delete __pShareMemoList;
+       }
        return E_SUCCESS;
 }
 
@@ -329,10 +368,33 @@ MemoListForm::OnActionPerformed(const Control& source, int actionId)
                break;
        case IDA_BUTTON_CLOSE_POPUP:
        {
-               __pPopup->SetShowState(false);
-               __pPopup->Invalidate(true);
+               if(__pPopup != null && __pPopup->GetShowState() == true)
+               {
+                       __pPopup->SetShowState(false);
+                       __pPopup->Invalidate(true);
+               }
+               if(__pSharePopup != null && __pSharePopup->GetShowState() == true)
+               {
+                       __pSharePopup->SetShowState(false);
+                       __pSharePopup->Invalidate(true);
+               }
+       }
+       break;
+       case IDA_BUTTON_CANCEL_POPUP:
+       {
+               __pDeletePopup->SetShowState(false);
+               __pDeletePopup->Invalidate(true);
+       }
+       break;
+
+       case IDA_BUTTON_DELETE_POPUP:
+       {
+               __pDeletePopup->SetShowState(false);
+               __pDeletePopup->Invalidate(true);
+               DeleteListItem();
        }
        break;
+
        default:
                break;
        }
@@ -450,8 +512,97 @@ MemoListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
 }
 
 void
+MemoListForm::DeleteListItem(void)
+{
+       if(__pMemoData != null)
+       {
+               result r = E_SUCCESS;
+               int count = MemoListPresentationModel::GetInstance()->GetMemoCount(ID_MEMO_LIST);
+               bool isDrawingMemo = false;
+               if(__pMemoData->GetMemoDrawingPath().IsEmpty() == false)
+               {
+                       isDrawingMemo = true;
+               }
+               r = MemoDataPresentationModel::GetInstance()->RemoveMemoAt(__pMemoData->GetMemoIndex());
+               if (r == E_SUCCESS)
+               {
+                       if(isDrawingMemo == true)
+                       {
+                               //Delete the drawing file from /shared/data path
+                               RemoveMemoDrawingFile(__pMemoData->GetMemoDrawingPath());
+                               (MemoThumbnailProvider::GetInstance())->RemoveObjectBitmap(__pMemoData->GetMemoIndex());
+                       }
+                       MemoListPresentationModel::GetInstance()->RemoveMemoAtIndex(__selectedItemIndex);
+                       __pMemoListView->UpdateList();
+                       if(count == 1)
+                       {
+                               MemoListPresentationModel::GetInstance()->CreateMemoRegistry();
+                               MemoListPresentationModel::GetInstance()->SetValueToRegistry(0);
+                       }
+
+                       SetListFormTitle(ID_MEMO_LIST);
+                       //Enable or disable the edit option depending on the memo count
+                       int memoCount = MemoListPresentationModel::GetInstance()->GetMemoCount(ID_MEMO_LIST);
+                       if (memoCount == 0)
+                       {
+                               __pFormFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
+                       }
+                       else
+                       {
+                               __pFormFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
+                       }
+                       __pFormFooter->Draw();
+               }
+               __pMemoData = null;
+               __selectedItemIndex = -1;
+       }
+       return;
+}
+
+void
+MemoListForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus status)
+{
+       if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_NORMAL || __isSearchRegistered == false)
+       {
+               __pMemoData = MemoListPresentationModel::GetInstance()->GetMemoAt(index, ID_MEMO_LIST);
+       }
+       else
+       {
+               return;
+       }
+       __selectedItemIndex = index;
+
+       if(elementId == ID_LISTCONTEXTITEM_SHARE)
+       {
+               if (__pSharePopup == null)
+               {
+                       __pSharePopup = new (std::nothrow) Popup();
+                       __pSharePopupList = new (std::nothrow) ListView();
+                       __pSharePopupList->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);
+                       ConstructAppControlPopup(__pSharePopup, __pSharePopupList, __pAppControlListProvider, this, this);
+               }
+               __pSharePopup->SetShowState(true);
+               __pSharePopup->Show();
+       }
+       else if(elementId == ID_LISTCONTEXTITEM_DELETE)
+       {
+               if (__pDeletePopup == null)
+               {
+                       __pDeletePopup = new (std::nothrow) Popup();
+                       ConstructDeletePopup(__pDeletePopup, this);
+               }
+               __pDeletePopup->SetShowState(true);
+               __pDeletePopup->Show();
+       }
+       return;
+
+}
+
+void
 MemoListForm::OnListViewItemStateChanged (ListView& listView, int index, int elementId, ListItemStatus status)
 {
+       MemoInfo* pMemoData = null;
+
        if (&listView == __pPopupList)
        {
                __pPopupList->SetItemChecked(index, false);
@@ -462,10 +613,39 @@ MemoListForm::OnListViewItemStateChanged (ListView& listView, int index, int ele
                MemoListPresentationModel::GetInstance()->RegisterListTask();
                return;
        }
+       else if (&listView == __pSharePopupList)
+       {
+               if(__pVntFilename == null)
+               {
+                       __pVntFilename = new (std::nothrow) String();
+               }
+               else
+               {
+                       __pVntFilename->Clear();
+               }
+
+               if(__pShareMemoList == null)
+               {
+                       __pShareMemoList = new (std::nothrow) ArrayList();
+                       __pShareMemoList->Construct();
+               }
+               else
+               {
+                       __pShareMemoList->RemoveAll();
+               }
+
+               __pSharePopup->SetShowState(false);
+               __pSharePopup->Invalidate(true);
+
+               *__pVntFilename = __pVMemoCreator->CreateVMemo(*__pMemoData);
+               __pShareMemoList->Add(__pVntFilename);
+
+               LaunchAppToShare(index, __pShareMemoList);
+               return;
+       }
        __pSearchBar->HideKeypad();
        SceneManager* pSceneManager = SceneManager::GetInstance();
 
-       MemoInfo* pMemoData = null;
        if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_NORMAL || __isSearchRegistered == false)
        {
                pMemoData = MemoListPresentationModel::GetInstance()->GetMemoAt(index, ID_MEMO_LIST);
index b21f158..3f603dd 100644 (file)
@@ -529,7 +529,26 @@ MemoManager::SearchMemoN(String const keyword)
        DbStatement* pStmt = null;
        __pDatabase->BeginTransaction();
 
-       statement.Append(L"SELECT * FROM Memo WHERE Contents LIKE ? ESCAPE ']' ORDER BY ModificationTime DESC");
+       //statement.Append(L"SELECT * FROM Memo WHERE Contents LIKE ? ESCAPE ']' ORDER BY ModificationTime DESC");
+       int sortType = GetSortByType();
+
+       if(sortType == ID_SORT_BY_LATEST)
+       {
+               statement.Append(L"SELECT * FROM Memo WHERE Contents LIKE ? ESCAPE ']' ORDER BY ModificationTime DESC");
+       }
+       else if(sortType == ID_SORT_BY_OLDER)
+       {
+               statement.Append(L"SELECT * FROM Memo WHERE Contents LIKE ? ESCAPE ']' ORDER BY ModificationTime ASC");
+       }
+       else if(sortType == ID_SORT_BY_ATOZ)
+       {
+               statement.Append(L"SELECT * FROM Memo WHERE Contents LIKE ? ESCAPE ']' ORDER BY Contents");
+       }
+       else
+       {
+               statement.Append(L"SELECT * FROM Memo WHERE Contents LIKE ? ESCAPE ']' ORDER BY Contents DESC");
+       }
+
        pStmt = __pDatabase->CreateStatementN(statement);
        GetLastResult();
        keyword2.Append(keyword);
index fd3a905..56f1de4 100644 (file)
@@ -51,6 +51,7 @@ MemoTextDetailForm::MemoTextDetailForm(void)
        , __pFlickGesture(null)
        , __pMemoIndex(null)
        , __pCount(null)
+       , __pShareMemoList(null)
 {
        __pVMemoCreator = new (std::nothrow) VMemoCreator();
        __pAppControlListProvider = new (std::nothrow) AppControlListProvider();
@@ -74,6 +75,7 @@ MemoTextDetailForm::~MemoTextDetailForm(void)
        }
        if (__pPopup != null)
        {
+               __pPopup->RemoveAllControls();
                delete __pPopup;
                __pPopup = null;
        }
@@ -82,16 +84,25 @@ MemoTextDetailForm::~MemoTextDetailForm(void)
                delete __pDeletePopup;
                __pDeletePopup = null;
        }
-       if(__pMemoIndex != null)
+       if (__pMemoIndex != null)
        {
                delete __pMemoIndex;
                __pMemoIndex = null;
        }
-       if(__pCount != null)
+       if (__pCount != null)
        {
                delete __pCount;
                __pCount = null;
        }
+       if (__pVntFilename != null)
+       {
+               delete __pVntFilename;
+       }
+       if (__pShareMemoList != null)
+       {
+               __pShareMemoList->RemoveAll();
+               delete __pShareMemoList;
+       }
        return;
 }
 
@@ -397,18 +408,32 @@ MemoTextDetailForm::OnListViewItemStateChanged(ListView& listView, int index, in
 {
        if (&listView == __pPopupList)
        {
-               __pVntFilename = new (std::nothrow) String();
-               ArrayList* pShareMemoList = new (std::nothrow) ArrayList();
+               if(__pVntFilename == null)
+               {
+                       __pVntFilename = new (std::nothrow) String();
+               }
+               else
+               {
+                       __pVntFilename->Clear();
+               }
+
+               if(__pShareMemoList == null)
+               {
+                       __pShareMemoList = new (std::nothrow) ArrayList();
+                       __pShareMemoList->Construct();
+               }
+               else
+               {
+                       __pShareMemoList->RemoveAll();
+               }
 
                __pPopup->SetShowState(false);
                __pPopup->Invalidate(true);
 
-               pShareMemoList->Construct();
                *__pVntFilename = __pVMemoCreator->CreateVMemo(*__pMemoData);
-               pShareMemoList->Add(__pVntFilename);
+               __pShareMemoList->Add(__pVntFilename);
 
-               LaunchAppToShare(index, pShareMemoList);
-               pShareMemoList = null;
+               LaunchAppToShare(index, __pShareMemoList);
        }
        return;
 }
index 2a66fe2..279d9cb 100644 (file)
@@ -372,7 +372,7 @@ MemoTextEditorForm::SaveMemoInfo(void)
        else
        {
                Tizen::Base::DateTime modificationTime;
-               SystemTime::GetCurrentTime(STANDARD_TIME, modificationTime);
+               SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
                pNewMemo->SetMemoModificationTime(modificationTime);
 
                r = MemoDataPresentationModel::GetInstance()->AddMemo(*pNewMemo);
@@ -401,7 +401,7 @@ MemoTextEditorForm::UpdateMemoInfo(void)
                pNewMemo->SetMemoCreationTime(__pEditMemo->GetMemoCreationTime());
 
                Tizen::Base::DateTime modificationTime;
-               SystemTime::GetCurrentTime(STANDARD_TIME, modificationTime);
+               SystemTime::GetCurrentTime(TIME_MODE_UTC, modificationTime);
                pNewMemo->SetMemoModificationTime(modificationTime);
 
                r = MemoDataPresentationModel::GetInstance()->UpdateMemoAt(__pEditMemo->GetMemoIndex(), pNewMemo);
@@ -597,7 +597,7 @@ MemoTextEditorForm::RefreshCreateView(void)
        __pColorPickerPanel->Invalidate(true);
        __pSliderPanel->SetShowState(false);
        __pSliderPanel->Invalidate(true);
-       SystemTime::GetCurrentTime(STANDARD_TIME, __createTime);
+       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
        String createTimeString = GetMemoCreationDateTime(__createTime);
        __pMemoCreateTime->SetText(createTimeString);
        __pMemoCreateTime->Invalidate(true);
@@ -625,7 +625,7 @@ MemoTextEditorForm::SetMemoEditDetails(MemoInfo* pMemoData)
 
        __isEditMode = true;
        SetControlAlwaysAtBottom(*this, true);
-       SystemTime::GetCurrentTime(STANDARD_TIME, __createTime);
+       SystemTime::GetCurrentTime(TIME_MODE_UTC, __createTime);
        String createTimeString = GetMemoCreationDateTime(__createTime);
        __pMemoCreateTime->SetText(createTimeString);
 
index 14fa198..7ec3568 100644 (file)
@@ -49,6 +49,8 @@ const wchar_t* VNT_FILENAME_EXTENSION = L".vnt";
 const int ID_LISTITEM_CONTENT = 201;
 const int ID_LISTITEM_DATETIME = 202;
 const int ID_LISTITEM_IMAGE = 203;
+const int ID_LISTCONTEXTITEM_DELETE = 204;
+const int ID_LISTCONTEXTITEM_SHARE = 205;
 
 const int X_RECTANGLE = 16;
 const int Y_RECTANGLE_TEXT = 1;//1;
@@ -120,6 +122,7 @@ const unsigned int COLOR_BLUE = 0x2025EA;
 const unsigned int COLOR_SELECT_ALL = 0x3D7EA3;
 const unsigned int COLOR_TOOLBAR_BG = 0xEAE8E1;
 const unsigned int COLOR_COMMENT_BG = 0xF8F6EF;
+const unsigned int COLOR_RED = 0xD05252;
 
 const wchar_t* IDB_COLOR_ICON = L"P02_edit_toolbar_icon_color.png";
 const wchar_t* IDB_COLOR_ICON_PRESS = L"P02_edit_toolbar_icon_color_press.png";