70 // --------------------------------------------------------- |
70 // --------------------------------------------------------- |
71 // |
71 // |
72 CGlxProgressIndicator::~CGlxProgressIndicator() |
72 CGlxProgressIndicator::~CGlxProgressIndicator() |
73 { |
73 { |
74 TRACER("CGlxProgressIndicator::~CGlxProgressIndicator()"); |
74 TRACER("CGlxProgressIndicator::~CGlxProgressIndicator()"); |
75 if (iProgressbarTicker && iProgressbarTicker->IsActive()) |
75 if (iProgressbarTicker) |
76 { |
76 { |
77 iProgressbarTicker->Cancel(); |
77 iProgressbarTicker->Cancel(); |
78 delete iProgressbarTicker; |
78 delete iProgressbarTicker; |
79 } |
79 } |
80 if(iProgressDialog) |
80 if(iProgressDialog) |
81 { |
81 { |
82 iProgressDialog->ProcessFinishedL(); |
82 iProgressDialog->ProcessFinishedL(); |
83 } |
83 } |
84 |
84 |
85 // Stop force generation of thumbnails when progress dialog is dismissed |
85 // Stop force generation of thumbnails when progress dialog is dismissed |
86 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
86 if (iUiUtility) |
87 CleanupClosePushL(*uiUtility); |
87 { |
88 if ( uiUtility ) |
88 iUiUtility->StopTNMDaemon(); |
89 { |
89 iUiUtility->Close(); |
90 uiUtility->StopTNMDaemonL(); |
90 } |
91 } |
|
92 CleanupStack::PopAndDestroy(uiUtility); |
|
93 } |
91 } |
94 |
92 |
95 // --------------------------------------------------------- |
93 // --------------------------------------------------------- |
96 // CGlxProgressIndicator::ConstructL |
94 // CGlxProgressIndicator::ConstructL |
97 // --------------------------------------------------------- |
95 // --------------------------------------------------------- |
98 // |
96 // |
99 void CGlxProgressIndicator::ConstructL() |
97 void CGlxProgressIndicator::ConstructL() |
100 { |
98 { |
101 TRACER("CGlxProgressIndicator::ConstructL()"); |
99 TRACER("CGlxProgressIndicator::ConstructL()"); |
102 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
100 iUiUtility->StartTNMDaemon(); |
103 CleanupClosePushL(*uiUtility); |
101 |
104 TRAPD(err,uiUtility->StartTNMDaemonL()); |
|
105 |
|
106 if(err != KErrNone) |
|
107 { |
|
108 GLX_LOG_INFO1("CGlxProgressIndicator RProperty::Set errorcode %d",err); |
|
109 //need to check what to do in fail cases |
|
110 } |
|
111 if(!iProgressbarTicker) |
102 if(!iProgressbarTicker) |
112 { |
103 { |
113 iProgressbarTicker = CPeriodic::NewL(CActive::EPriorityStandard); |
104 iProgressbarTicker = CPeriodic::NewL(CActive::EPriorityStandard); |
114 } |
105 } |
115 |
106 |
116 iFinalCount = uiUtility->GetItemsLeftCountL(); |
107 iFinalCount = iUiUtility->GetItemsLeftCount(); |
117 GLX_LOG_INFO1("final count in viewactivate = %d",iFinalCount); |
108 GLX_LOG_INFO1("final count in viewactivate = %d",iFinalCount); |
118 |
109 |
119 |
|
120 if(iFinalCount) |
|
121 { |
|
122 StartProgressNoteL(iFinalCount,ETrue); |
|
123 if ( !iProgressbarTicker->IsActive()) |
|
124 { |
|
125 iProgressbarTicker->Start( KPeriodicStartDelay, KPeriodicStartDelay, TCallBack( |
|
126 &PeriodicCallbackL, static_cast<TAny*>( this ) ) ); |
|
127 } |
|
128 } |
|
129 else |
|
130 { |
|
131 GLX_LOG_INFO("Reset the RProperty flag to EFalse"); |
|
132 uiUtility->StopTNMDaemonL(); |
|
133 } |
|
134 CleanupStack::PopAndDestroy(uiUtility); |
|
135 } |
110 } |
136 |
111 |
137 |
112 |
138 // ----------------------------------------------------------------------------- |
113 // ----------------------------------------------------------------------------- |
139 // Callback from periodic timer |
114 // Callback from periodic timer |
151 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
152 // |
127 // |
153 inline void CGlxProgressIndicator::DisplayProgressBarL() |
128 inline void CGlxProgressIndicator::DisplayProgressBarL() |
154 { |
129 { |
155 TRACER("CGlxProgressIndicator::DisplayProgressBarL"); |
130 TRACER("CGlxProgressIndicator::DisplayProgressBarL"); |
156 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
131 TInt itemsLeft = iUiUtility->GetItemsLeftCount(); |
157 CleanupClosePushL(*uiUtility); |
|
158 TInt itemsLeft = uiUtility->GetItemsLeftCountL(); |
|
159 CleanupStack::PopAndDestroy(uiUtility); |
|
160 GLX_LOG_INFO1("itemsLeft in DisplayProgressBarL = %d",iFinalCount); |
132 GLX_LOG_INFO1("itemsLeft in DisplayProgressBarL = %d",iFinalCount); |
161 if(itemsLeft) |
133 UpdateProgressBar(); |
162 { |
134 if(!itemsLeft) |
163 UpdateProgressBar(); |
|
164 } |
|
165 else |
|
166 { |
135 { |
167 if(iProgressbarTicker->IsActive()) |
136 if(iProgressbarTicker->IsActive()) |
168 { |
137 { |
169 iProgressbarTicker->Cancel(); |
138 iProgressbarTicker->Cancel(); |
170 } |
139 } |
177 // ----------------------------------------------------------------------------- |
146 // ----------------------------------------------------------------------------- |
178 // |
147 // |
179 void CGlxProgressIndicator::StartProgressNoteL(TInt aFinalValue,TBool aShow) |
148 void CGlxProgressIndicator::StartProgressNoteL(TInt aFinalValue,TBool aShow) |
180 { |
149 { |
181 TRACER("CGlxProgressIndicator::StartProgressNoteL()"); |
150 TRACER("CGlxProgressIndicator::StartProgressNoteL()"); |
182 |
151 TInt itemsLeft = iUiUtility->GetItemsLeftCount(); |
183 if(aShow) |
152 if(aShow) |
184 { |
153 { |
185 if(!iProgressDialog) |
154 if(!iProgressDialog) |
186 { |
155 { |
187 iProgressDialog = new (ELeave)CAknProgressDialog((reinterpret_cast<CEikDialog**> (&iProgressDialog)),ETrue); |
156 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
157 (reinterpret_cast<CEikDialog**> (&iProgressDialog)), |
|
158 ETrue); |
188 } |
159 } |
189 iProgressDialog->PrepareLC(R_PROGRESS_NOTE); |
160 iProgressDialog->PrepareLC(R_PROGRESS_NOTE); |
190 |
161 |
191 iProgressInfo = iProgressDialog->GetProgressInfoL(); |
162 iProgressInfo = iProgressDialog->GetProgressInfoL(); |
192 |
163 |
227 * in rss it should have %d or %N format |
198 * in rss it should have %d or %N format |
228 * TBuf<256> text; |
199 * TBuf<256> text; |
229 * GlxGeneralUiUtilities::FormatString(text,*processingInfo,-1,count,ETrue); |
200 * GlxGeneralUiUtilities::FormatString(text,*processingInfo,-1,count,ETrue); |
230 * CleanupStack::PopAndDestroy(processingInfo); |
201 * CleanupStack::PopAndDestroy(processingInfo); |
231 */ |
202 */ |
232 iProgressInfo->SetAndDraw(CalculateDisplayBarIncrementL()); |
203 iProgressInfo->SetAndDraw(CalculateDisplayBarIncrement()); |
233 } |
204 } |
234 } |
205 } |
235 |
206 |
236 // ----------------------------------------------------------------------------- |
207 // ----------------------------------------------------------------------------- |
237 // DialogDismissedL |
208 // DialogDismissedL |
238 // ----------------------------------------------------------------------------- |
209 // ----------------------------------------------------------------------------- |
239 // |
210 // |
240 void CGlxProgressIndicator::DialogDismissedL(TInt aButtonId) |
211 void CGlxProgressIndicator::DialogDismissedL(TInt aButtonId) |
241 { |
212 { |
242 TRACER("CGlxProgressIndicator::DialogDismissedL()"); |
213 TRACER("CGlxProgressIndicator::DialogDismissedL()"); |
243 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
244 CleanupClosePushL(*uiUtility); |
|
245 uiUtility->StopTNMDaemonL(); |
|
246 CleanupStack::PopAndDestroy(uiUtility); |
|
247 if(iProgressbarTicker) |
214 if(iProgressbarTicker) |
248 { |
215 { |
249 iProgressbarTicker->Cancel(); |
216 iProgressbarTicker->Cancel(); |
250 iProgressbarTicker = NULL; |
217 iProgressbarTicker = NULL; |
251 } |
218 } |
252 |
219 |
253 if(iProgressDialog) |
220 if(iProgressDialog) |
254 { |
221 { |
255 iProgressDialog = NULL; |
222 iProgressDialog = NULL; |
256 iProgressInfo = NULL; |
223 iProgressInfo = NULL; |
257 } |
224 } |
258 } |
225 } |
259 |
226 |
260 // ----------------------------------------------------------------------------- |
227 // ----------------------------------------------------------------------------- |
261 // CalculateDisplayBarIncrementL |
228 // CalculateDisplayBarIncrement |
262 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
263 // |
230 // |
264 TInt CGlxProgressIndicator::CalculateDisplayBarIncrementL() |
231 TInt CGlxProgressIndicator::CalculateDisplayBarIncrement() |
265 { |
232 { |
266 TRACER("CGlxProgressIndicator::CalculateDisplayBarIncrement()"); |
233 TRACER("CGlxProgressIndicator::CalculateDisplayBarIncrement()"); |
267 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
234 |
268 CleanupClosePushL(*uiUtility); |
235 TInt itemsLeft = iUiUtility->GetItemsLeftCount(); |
269 TInt itemsLeft = uiUtility->GetItemsLeftCountL(); |
236 |
270 CleanupStack::PopAndDestroy(uiUtility); |
237 if (iFinalCount < itemsLeft) |
|
238 { |
|
239 iProgressInfo->SetFinalValue(itemsLeft); |
|
240 iFinalCount = itemsLeft; |
|
241 } |
|
242 |
271 GLX_LOG_INFO1("CalculateDisplayBarIncrement = %d ",(iFinalCount - itemsLeft)); |
243 GLX_LOG_INFO1("CalculateDisplayBarIncrement = %d ",(iFinalCount - itemsLeft)); |
272 |
244 return (iFinalCount - itemsLeft); |
273 if(iFinalCount < itemsLeft) |
245 } |
274 { |
246 |
275 iProgressInfo->SetFinalValue( itemsLeft ); |
247 // ----------------------------------------------------------------------------- |
|
248 // ShowProgressbar |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 void EXPORT_C CGlxProgressIndicator::ShowProgressbarL() |
|
252 { |
|
253 TRACER("CGlxProgressIndicator::ShowProgressbarL"); |
|
254 iUiUtility->StartTNMDaemon(); |
|
255 TInt itemsLeft = iUiUtility->GetItemsLeftCount(); |
|
256 |
|
257 GLX_LOG_INFO1("ShowProgressbar itemsLeft = %d ",itemsLeft); |
|
258 GLX_LOG_INFO1("ShowProgressbar iFinalCount = %d ",iFinalCount); |
|
259 if (iFinalCount < itemsLeft) |
|
260 { |
|
261 /* |
|
262 *if user is in List view and inserts the MMC,update the total count |
|
263 */ |
276 iFinalCount = itemsLeft; |
264 iFinalCount = itemsLeft; |
277 } |
265 } |
278 |
266 if (iFinalCount) |
279 return (iFinalCount - itemsLeft); |
267 { |
280 } |
268 StartProgressNoteL(iFinalCount, ETrue); |
|
269 if (!iProgressbarTicker) |
|
270 { |
|
271 iProgressbarTicker = CPeriodic::NewL(CActive::EPriorityStandard); |
|
272 } |
|
273 if (!iProgressbarTicker->IsActive()) |
|
274 { |
|
275 iProgressbarTicker->Start(KPeriodicStartDelay, |
|
276 KPeriodicStartDelay, TCallBack(&PeriodicCallbackL, |
|
277 static_cast<TAny*> (this))); |
|
278 } |
|
279 } |
|
280 else |
|
281 { |
|
282 GLX_LOG_INFO("Reset the RProperty flag to EFalse"); |
|
283 iUiUtility->StopTNMDaemon(); |
|
284 } |
|
285 } |