NABI issue 41387
[apps/osp/Gallery.git] / src / GlTimerBase.cpp
index d7a97c1..70d995e 100644 (file)
@@ -36,6 +36,7 @@ GlTimerBase::GlTimerBase(IFileOpInvalidateListener* invalidateListener, enum Fil
        , __moveToCount(0)
        , __pMoveProBar(null)
        , __pInvalidate(invalidateListener)
+       , __isStarted(false)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -45,11 +46,17 @@ GlTimerBase::~GlTimerBase(void)
 {
        AppLogDebug("ENTER");
        __pInvalidate = null;
-       if (__pContentIdList != null && __pContentIdList->GetCount() > 0)
+       if (__pContentIdList != null && __pContentIdList->GetCount() > 0 && __isStarted)
        {
                __moveTimer.Cancel();
+               __isStarted = false;
        }
        delete __pContentIdList;
+       if (__pMoveProBar)
+       {
+               __pMoveProBar->HideFileProgressingPopup();
+               delete __pMoveProBar;
+       }
        AppLogDebug("ENTER");
 }
 
@@ -66,6 +73,7 @@ GlTimerBase::StartTimer(void)
                __moveToCount = 0;
                __moveTimer.Construct(*this);
                __moveTimer.Start(1);
+               __isStarted = true;
                ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance();
                pContentListener->RemoveContentListener();
                AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -80,6 +88,7 @@ GlTimerBase::CancelTimer(void)
 {
        AppLogDebug("ENTER");
        __moveTimer.Cancel();
+       __isStarted = false;
        OnOpCancelled(CANCEL_USER);
        __moveToCount = 0;
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -112,10 +121,12 @@ GlTimerBase::OnTimerExpired(Timer& timer)
                                __pInvalidate->OnFileOpInvalidate(_actionId);
                        }
                        __moveTimer.Start(1);
+                       __isStarted = true;
                }
                else
                {
                        __moveTimer.Cancel();
+                       __isStarted = false;
                        OnOpComplete(COMPLETE_SUCCESS);
                        __moveToCount = 0;
                }
@@ -207,3 +218,22 @@ void GlTimerBase::SetActionMode(const enum FileActionMode actionId)
 {
        _actionId = actionId;
 }
+
+
+bool GlTimerBase::IsStarted(void)
+{
+       return __isStarted;
+}
+
+void GlTimerBase::Cancel(void)
+{
+       if ( __isStarted )
+       {
+               ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance();
+               pContentListener->AddContentListener();
+               __pMoveProBar->HideFileProgressingPopup();
+               __moveTimer.Cancel();
+               __isStarted = false;
+       }
+
+}