2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file GlTimerBase.cpp
19 * @brief This is the source file for GlTimerBase class.
24 #include "GlProgressBar.h"
25 #include "GlTimerBase.h"
28 using namespace Tizen::Ui;
30 GlTimerBase::GlTimerBase(IFileOpInvalidateListener* invalidateListener, enum FileActionMode actionId)
31 : __pInvalidate(invalidateListener)
32 , __actionId(actionId)
36 GlTimerBase::~GlTimerBase(void)
41 delete __pContentIdList;
45 bool GlTimerBase::StartTimer(void)
48 __pContentIdList = TimerStart();
49 if (__pContentIdList != null && __pContentIdList->GetCount() > 0 )
51 AppLogDebug("Starting timer");
52 __pMoveProBar = new GlProgressBar(static_cast<IActionEventListener*>(this));
53 __pMoveProBar->ShowFileProgressingPopup( __pContentIdList->GetCount(), __actionId );
55 __moveTimer.Construct(*this);
57 AppLogDebug("Returned true");
60 AppLogDebug("Returned false");
64 void GlTimerBase::CancelTimer(void)
73 void GlTimerBase::OnTimerExpired(Timer& timer)
76 if (&timer == &__moveTimer)
78 AppLogDebug("__pContentIdList count is %d", __pContentIdList->GetCount());
79 if (__moveToCount < __pContentIdList->GetCount())
81 AppLogDebug("__pContentIdList count is %d", __pContentIdList->GetCount());
82 ContentId* pContentId = static_cast<ContentId*>(__pContentIdList->GetAt(__moveToCount));
83 if (pContentId != null)
85 TimerExpired(*pContentId);
88 __pMoveProBar->IncProgress( __moveToCount );
91 __pInvalidate->OnFileOpInvalidate(__actionId);
106 GlTimerBase::OnActionPerformed(const Control& source, int actionId)
110 case ACTION_ID_PROGRESSBAR_CANCEL:
120 void GlTimerBase::OnOpCancelled(void)
122 AppLogDebug("ENTER");
123 if (__moveToCount > 0)
129 __pMoveProBar->HideFileProgressingPopup();
132 __pInvalidate->OnFileOpInvalidate(__actionId);
133 __pInvalidate->OnFileOpComplete(__actionId, true);
139 void GlTimerBase::OnOpComplete(void)
141 AppLogDebug("ENTER");
142 __pMoveProBar->HideFileProgressingPopup();
145 __pInvalidate->OnFileOpInvalidate(__actionId);
146 __pInvalidate->OnFileOpComplete(__actionId, true);
148 TimerComplete(__moveToCount);