Resolved issue N_SE-38574
authorChangyong Jeon <fin10.jeon@samsung.com>
Wed, 15 May 2013 08:48:05 +0000 (17:48 +0900)
committerChangyong Jeon <fin10.jeon@samsung.com>
Wed, 15 May 2013 08:48:05 +0000 (17:48 +0900)
Change-Id: I344476d0f34dbc7c9291d01884a121ff605e9386

src/ClImportForm.cpp

index bc85d06..045c5eb 100644 (file)
@@ -92,13 +92,16 @@ ImportForm::OnInitializing(void)
        __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup();
        __pCalendarSelectorPopup->Initialize();
 
+       __pProgressPopup = new (std::nothrow) ProgressPopup();
+       __pProgressPopup->Construct(false, false);
+
        return E_SUCCESS;
 }
 
 result
 ImportForm::OnTerminating(void)
 {
-       if (__pThread != null)
+       if (__pThread)
        {
                __pThread->Join();
                delete __pThread;
@@ -109,11 +112,11 @@ ImportForm::OnTerminating(void)
        delete __pDateFormatter;
        delete __pTimeFormatter;
        delete __pCalendarbook;
-       if (__pCalendarSelectorPopup != null)
+       if (__pCalendarSelectorPopup)
        {
                __pCalendarSelectorPopup->Destroy();
        }
-       if (__pProgressPopup != null)
+       if (__pProgressPopup)
        {
                __pProgressPopup->Destroy();
        }
@@ -126,21 +129,17 @@ ImportForm::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
        switch (requestId)
        {
        case IDA_CALENDAR_SELECTOR_POPUP_DONE:
-               if (pArgs != null)
+               if (pArgs)
                {
                        __calendarId = static_cast<Integer*>(pArgs->GetAt(0))->value;
 
-                       if (__pThread != null)
+                       if (__pThread)
                        {
                                __pThread->Join();
                                delete __pThread;
+                               __pThread = null;
                        }
 
-                       if (__pProgressPopup == null)
-                       {
-                               __pProgressPopup = new (std::nothrow) ProgressPopup();
-                               __pProgressPopup->Construct(false, false);
-                       }
                        __pProgressPopup->SetShowState(true);
                        __pProgressPopup->Show();
 
@@ -155,20 +154,20 @@ ImportForm::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
                __pThread = null;
                __pProgressPopup->SetShowState(false);
 
-               if (IsTodoItemChecked() == true)
+               if (IsTodoItemChecked())
                {
                        __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_TODO, this);
                }
 
                __pListViewContents->UpdateList();
 
-               if (IsNoItemChecked() == true)
+               if (IsNoItemChecked())
                {
                        GetFooter()->SetItemEnabled(0, false);
                        GetFooter()->Invalidate(true);
                }
 
-               if (IsAllItemAdded() == true)
+               if (IsAllItemAdded())
                {
                        GetHeader()->RemoveAllButtons();
                        GetHeader()->Invalidate(true);
@@ -178,7 +177,7 @@ ImportForm::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
                break;
        }
 
-       if (pArgs != null)
+       if (pArgs)
        {
                pArgs->RemoveAll(true);
                delete pArgs;
@@ -188,6 +187,9 @@ ImportForm::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
 Object*
 ImportForm::Run(void)
 {
+       // Todo: temporary solution for lock-up.
+       Thread::Sleep(300);
+
        Calendar* pCalendar = __pCalendarbook->GetCalendarN(__calendarId);
        if (pCalendar != null)
        {
@@ -250,7 +252,7 @@ ImportForm::OnActionPerformed(const Control& source, int actionId)
        {
        case IDA_IMPORT_FORM_SELECT_ALL:
        {
-               bool checkFlag = IsAllItemChecked() == false;
+               bool checkFlag = (IsAllItemChecked() == false);
                int count = __pList->GetCount();
                for (int i = 0; i < count; ++i)
                {
@@ -263,11 +265,11 @@ ImportForm::OnActionPerformed(const Control& source, int actionId)
                break;
        }
        case IDA_IMPORT_FORM_ADD_TO_CALENDAR:
-               if (IsEventItemChecked() == true)
+               if (IsEventItemChecked())
                {
                        __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_EVENT, this);
                }
-               else if (IsTodoItemChecked() == true)
+               else if (IsTodoItemChecked())
                {
                        __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_TODO, this);
                }
@@ -285,18 +287,17 @@ ImportForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
        IEnumerator* pEnum = __pList->GetEnumeratorN();
        while (pEnum->MoveNext() == E_SUCCESS)
        {
-               if (dynamic_cast<CalEvent*>(pEnum->GetCurrent()) != null)
+               if (dynamic_cast<CalEvent*>(pEnum->GetCurrent()))
                {
                        pArgs->Add(new (std::nothrow) CalEvent(static_cast<CalEvent&>(*pEnum->GetCurrent())));
                }
-               else if (dynamic_cast<CalTodo*>(pEnum->GetCurrent()) != null)
+               else if (dynamic_cast<CalTodo*>(pEnum->GetCurrent()))
                {
                        pArgs->Add(new (std::nothrow) CalTodo(static_cast<CalTodo&>(*pEnum->GetCurrent())));
                }
        }
        delete pEnum;
        SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArgs);
-       AppLogDebug("Exit.");
 }
 
 void
@@ -333,7 +334,7 @@ ImportForm::OnListViewContextItemStateChanged(ListView& listView, int index, int
 int
 ImportForm::GetItemCount(void)
 {
-       if (__pList == null)
+       if (!__pList)
        {
                return 0;
        }
@@ -357,7 +358,6 @@ ImportForm::CreateItem(int index, int itemWidth)
                pItem->SetReminder(pEvent->GetAllReminders().GetCount() > 0);
                pItem->SetRepeat(pEvent->IsRecurring());
                pItem->SetPriority(pEvent->GetPriority());
-       //      pItem->SetFacebookEvent(false);
                pItem->UpdateElements();
                return pItem;
        }
@@ -372,7 +372,6 @@ ImportForm::CreateItem(int index, int itemWidth)
                pItem->SetLocation(pTodo->GetLocation());
                pItem->SetDueDate(ResourceManager::ConvertUtcTimeToWallTime(pTodo->GetDueDate()), __pDateTimeFormatter);
                pItem->SetReminder(pTodo->GetAllReminders().GetCount() > 0);
-       //      pItem->SetFacebookEvent(false);
 
                switch (pTodo->GetPriority())
                {
@@ -428,7 +427,7 @@ ImportForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cur
        }
 
        __pListViewContents->UpdateList();
-       if (IsAllItemAdded() == true)
+       if (IsAllItemAdded())
        {
                GetHeader()->RemoveAllButtons();
                GetFooter()->RemoveAllItems();
@@ -444,7 +443,6 @@ void
 ImportForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
 {
        AppLogDebug("Enter.");
-       AppLogDebug("Exit.");
 }
 
 Color