1382 // ----------------------------------------------------------------------------- |
1360 // ----------------------------------------------------------------------------- |
1383 // CIAUpdateUiController::DownloadProgress |
1361 // CIAUpdateUiController::DownloadProgress |
1384 // |
1362 // |
1385 // ----------------------------------------------------------------------------- |
1363 // ----------------------------------------------------------------------------- |
1386 // |
1364 // |
1387 void CIAUpdateUiController::DownloadProgress( MIAUpdateNode& /*aNode*/, |
1365 void CIAUpdateUiController::DownloadProgress( MIAUpdateNode& aNode, |
1388 TUint /*aProgress*/, |
1366 TUint aProgress, |
1389 TUint /*aMaxProgress*/ ) |
1367 TUint aMaxProgress ) |
1390 { |
1368 { |
1391 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadProgress() begin"); |
1369 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadProgress() begin"); |
1392 |
1370 |
1393 if ( iProgressDialog ) |
1371 if (aNode.UiState() == MIAUpdateNode::EDownloading) |
1394 { |
1372 { |
1395 //TRAP_IGNORE ( iProgressDialog->SetProgressDialogFinalValueL( aMaxProgress ) ); |
1373 aNode.SetProgress( aProgress ); |
1396 //TRAP_IGNORE ( iProgressDialog->UpdateProgressDialogValueL( aProgress ) ); |
1374 aNode.SetTotal( aMaxProgress ); |
1397 } |
1375 iObserver.RefreshUIProgress(); |
1398 |
1376 } |
|
1377 |
1399 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadProgress() end"); |
1378 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadProgress() end"); |
1400 } |
1379 } |
1401 |
1380 |
1402 |
1381 |
1403 // ----------------------------------------------------------------------------- |
1382 // ----------------------------------------------------------------------------- |
1409 TInt aError ) |
1388 TInt aError ) |
1410 { |
1389 { |
1411 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadComplete() begin"); |
1390 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadComplete() begin"); |
1412 |
1391 |
1413 iState = EIdle; |
1392 iState = EIdle; |
|
1393 aNode.SetProgress( 0 ); |
|
1394 aNode.SetTotal( 0 ); |
1414 TRAPD ( completionError, DownloadCompleteL( aNode, aError ) ); |
1395 TRAPD ( completionError, DownloadCompleteL( aNode, aError ) ); |
1415 if ( completionError != KErrNone ) |
1396 if ( completionError != KErrNone ) |
1416 { |
1397 { |
1417 // If we came here, DownloadCompleteL function may have left |
1398 // If we came here, DownloadCompleteL function may have left |
1418 // before dialog was removed. So, try one more time to remove it here |
1399 // before dialog was removed. So, try one more time to remove it here |
1419 // before informing the observer. |
1400 // before informing the observer. |
1420 TRAP_IGNORE( RemoveUpdatingDialogsL() ); |
|
1421 iObserver.HandleLeaveErrorWithoutLeave( completionError ); |
1401 iObserver.HandleLeaveErrorWithoutLeave( completionError ); |
1422 } |
1402 } |
1423 |
1403 |
1424 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadComplete() end"); |
1404 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::DownloadComplete() end"); |
1425 } |
1405 } |
1529 void CIAUpdateUiController::StartExecutableCompletedL( TInt /*aError*/ ) |
1505 void CIAUpdateUiController::StartExecutableCompletedL( TInt /*aError*/ ) |
1530 { |
1506 { |
1531 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartExecutableCompletedL() begin"); |
1507 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::StartExecutableCompletedL() begin"); |
1532 |
1508 |
1533 // Before informing the observer, close the possible existing dialog. |
1509 // Before informing the observer, close the possible existing dialog. |
1534 RemoveUpdatingDialogsL(); |
|
1535 |
|
1536 // Possible error is not passed to a client. Typically client is already closed. |
1510 // Possible error is not passed to a client. Typically client is already closed. |
1537 // Even in the case when client's request is still ongoing, it's disinformation to return |
1511 // Even in the case when client's request is still ongoing, it's disinformation to return |
1538 // error from failed executable start. |
1512 // error from failed executable start. |
1539 TRAPD ( err, iObserver.UpdateCompleteL( KErrNone ) ); |
1513 TRAPD ( err, iObserver.UpdateCompleteL( KErrNone ) ); |
1540 if ( err != KErrNone ) |
1514 if ( err != KErrNone ) |
1560 iObserver.HandleLeaveErrorWithoutLeave( err ); |
1534 iObserver.HandleLeaveErrorWithoutLeave( err ); |
1561 } |
1535 } |
1562 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RoamingHandlerPrepared() end"); |
1536 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RoamingHandlerPrepared() end"); |
1563 } |
1537 } |
1564 |
1538 |
1565 |
|
1566 // ----------------------------------------------------------------------------- |
|
1567 // CIAUpdateUiController::HandleWaitDialogCancel |
|
1568 // Called when wait dialog is cancelled. |
|
1569 // (other items were commented in a header). |
|
1570 // ----------------------------------------------------------------------------- |
|
1571 // |
|
1572 void CIAUpdateUiController::HandleWaitDialogCancel() |
|
1573 { |
|
1574 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::HandleWaitDialogCancel() begin"); |
|
1575 |
|
1576 TRAPD ( err, HandleUserCancelL() ); |
|
1577 if ( err != KErrNone ) |
|
1578 { |
|
1579 iObserver.HandleLeaveErrorL( err ); |
|
1580 } |
|
1581 |
|
1582 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::HandleWaitDialogCancel() end"); |
|
1583 |
|
1584 } |
|
1585 |
1539 |
1586 // ----------------------------------------------------------------------------- |
1540 // ----------------------------------------------------------------------------- |
1587 // CIAUpdateUiController::dialogFinished |
1541 // CIAUpdateUiController::dialogFinished |
1588 // Called when dialog is finished. |
1542 // Called when dialog is finished. |
1589 // ----------------------------------------------------------------------------- |
1543 // ----------------------------------------------------------------------------- |
2141 |
2095 |
2142 return KErrNone; |
2096 return KErrNone; |
2143 } |
2097 } |
2144 |
2098 |
2145 |
2099 |
2146 // --------------------------------------------------------------------------- |
2100 |
2147 // CIAUpdateUiController::ShowUpdatingDialogL |
|
2148 // |
|
2149 // --------------------------------------------------------------------------- |
|
2150 // |
|
2151 /* |
|
2152 void CIAUpdateUiController::ShowUpdatingDialogL( TInt aTextResourceId, |
|
2153 const TDesC& aName, |
|
2154 TInt aNumber, |
|
2155 TInt aTotalCount ) |
|
2156 |
|
2157 { |
|
2158 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowUpdatingDialogL() begin"); |
|
2159 |
|
2160 // Before trying ot create a new dialog, |
|
2161 // remove possible existing dialog. |
|
2162 RemoveUpdatingDialogsL(); |
|
2163 |
|
2164 CDesCArray* stringArray = new( ELeave ) CDesCArrayFlat( 1 ); |
|
2165 CleanupStack::PushL( stringArray ); |
|
2166 stringArray->AppendL( aName ); |
|
2167 CArrayFix<TInt>* numberArray = new( ELeave ) CArrayFixFlat<TInt>( 2 ); |
|
2168 CleanupStack::PushL( numberArray ); |
|
2169 numberArray->AppendL( aNumber ); |
|
2170 numberArray->AppendL( aTotalCount ); |
|
2171 HBufC* noteText = NULL; |
|
2172 //noteText = StringLoader::LoadLC( aTextResourceId, |
|
2173 // *stringArray, |
|
2174 // *numberArray ); |
|
2175 TPtr ptr = noteText->Des(); |
|
2176 //AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); |
|
2177 if ( iState == EDownloading ) |
|
2178 { |
|
2179 ShowProgressDialogL( *noteText, ETrue ); |
|
2180 } |
|
2181 else |
|
2182 { |
|
2183 //ShowWaitDialogL( *noteText, ETrue ); |
|
2184 } |
|
2185 |
|
2186 CleanupStack::PopAndDestroy( noteText ); |
|
2187 CleanupStack::PopAndDestroy( numberArray ); |
|
2188 CleanupStack::PopAndDestroy( stringArray ); |
|
2189 |
|
2190 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowUpdatingDialogL() end"); |
|
2191 }*/ |
|
2192 |
2101 |
2193 |
|
2194 // --------------------------------------------------------------------------- |
|
2195 // CIAUpdateUiController::ShowWaitDialogL |
|
2196 // |
|
2197 // --------------------------------------------------------------------------- |
|
2198 // |
|
2199 void CIAUpdateUiController::ShowWaitDialogL( const QString& aDisplayString, |
|
2200 TBool /*aVisibilityDelayOff*/ ) |
|
2201 { |
|
2202 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowWaitDialogL() begin"); |
|
2203 if ( !mWaitDialog ) |
|
2204 { |
|
2205 mWaitDialog = new IAUpdateWaitDialog(); |
|
2206 mWaitDialog->SetCallback( this ); |
|
2207 mWaitDialog->showDialog( aDisplayString ); |
|
2208 } |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 /*if ( iWaitDialog ) |
|
2214 { |
|
2215 IAUPDATE_TRACE("[IAUPDATE] Wait dialog already existed. Remove it first"); |
|
2216 // in some rare cases previous dialog still exists |
|
2217 // it's now just deleted (not recommended way) to avoid forwarding problem(s). |
|
2218 //delete iWaitDialog; |
|
2219 iWaitDialog = NULL; |
|
2220 }*/ |
|
2221 /* iWaitDialog = |
|
2222 new( ELeave ) CIAUpdateWaitDialog( |
|
2223 reinterpret_cast< CEikDialog** >( &iWaitDialog ), |
|
2224 aVisibilityDelayOff ); |
|
2225 |
|
2226 iWaitDialog->SetTextL( aDisplayString ); |
|
2227 iWaitDialog->SetCallback( this ); |
|
2228 iWaitDialog->ExecuteLD( R_IAUPDATE_WAIT_DIALOG ); */ |
|
2229 |
|
2230 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowWaitDialogL() end"); |
|
2231 } |
|
2232 |
|
2233 |
|
2234 // -------------------------------------------------------------------------- |
|
2235 // CIAUpdateUiController::ShowProgressDialogL |
|
2236 // |
|
2237 // --------------------------------------------------------------------------- |
|
2238 // |
|
2239 void CIAUpdateUiController::ShowProgressDialogL( const TDesC& /*aDisplayString*/, |
|
2240 TBool /*aVisibilityDelayOff*/ ) |
|
2241 { |
|
2242 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowProgressDialogL() begin"); |
|
2243 |
|
2244 if ( iProgressDialog ) |
|
2245 { |
|
2246 IAUPDATE_TRACE("[IAUPDATE] Progress dialog already existed. Remove it first"); |
|
2247 // in some rare cases previous dialog still exists |
|
2248 // it's now just deleted (not recommended way) to avoid forwarding problem(s). |
|
2249 //delete iProgressDialog; |
|
2250 iProgressDialog = NULL; |
|
2251 } |
|
2252 /* iProgressDialog = |
|
2253 new( ELeave ) CIAUpdateProgressDialog( |
|
2254 reinterpret_cast< CEikDialog** >( &iProgressDialog ), |
|
2255 aVisibilityDelayOff ); |
|
2256 |
|
2257 iProgressDialog->SetTextL( aDisplayString ); |
|
2258 iProgressDialog->SetCallback( this ); |
|
2259 iProgressDialog->ExecuteLD( R_IAUPDATE_PROGRESS_DIALOG ); */ |
|
2260 |
|
2261 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowProgressDialogL() end"); |
|
2262 } |
|
2263 |
|
2264 |
|
2265 // --------------------------------------------------------------------------- |
|
2266 // CIAUpdateUiController::RemoveUpdatingDialogsL |
|
2267 // |
|
2268 // --------------------------------------------------------------------------- |
|
2269 // |
|
2270 void CIAUpdateUiController::RemoveUpdatingDialogsL() |
|
2271 { |
|
2272 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RemoveUpdatingDialogsL() begin"); |
|
2273 |
|
2274 RemoveWaitDialogL(); |
|
2275 RemoveProgressDialogL(); |
|
2276 |
|
2277 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RemoveUpdatingDialogsL() end"); |
|
2278 } |
|
2279 |
|
2280 |
|
2281 // --------------------------------------------------------------------------- |
|
2282 // CIAUpdateUiController::RemoveWaitDialogL |
|
2283 // |
|
2284 // --------------------------------------------------------------------------- |
|
2285 // |
|
2286 void CIAUpdateUiController::RemoveWaitDialogL() |
|
2287 { |
|
2288 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RemoveWaitDialogL() begin"); |
|
2289 if ( mWaitDialog ) |
|
2290 { |
|
2291 mWaitDialog->close(); |
|
2292 } |
|
2293 /*if ( !iCancelling ) //that's needed because AVKON in 3.2.3 wk12, returning |
|
2294 //EFalse in TryToExitL() causes a crash |
|
2295 { |
|
2296 if ( iWaitDialog ) |
|
2297 { |
|
2298 iWaitDialog->ProcessFinishedL(); |
|
2299 } |
|
2300 }*/ |
|
2301 |
|
2302 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RemoveWaitDialogL() end"); |
|
2303 } |
|
2304 |
|
2305 |
|
2306 // --------------------------------------------------------------------------- |
|
2307 // CIAUpdateUiController::RemoveProgressDialogL |
|
2308 // |
|
2309 // --------------------------------------------------------------------------- |
|
2310 // |
|
2311 void CIAUpdateUiController::RemoveProgressDialogL() |
|
2312 { |
|
2313 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RemoveProgressDialogL() begin"); |
|
2314 |
|
2315 if ( !iCancelling ) //that's needed because AVKON in 3.2.3 wk12, returning |
|
2316 //EFalse in TryToExitL() causes a crash |
|
2317 { |
|
2318 if ( iProgressDialog ) |
|
2319 { |
|
2320 //iProgressDialog->ProcessFinishedL(); |
|
2321 } |
|
2322 } |
|
2323 |
|
2324 IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::RemoveProgressDialogL() end"); |
|
2325 } |
|
2326 |
2102 |
2327 |
2103 |
2328 // --------------------------------------------------------------------------- |
2104 // --------------------------------------------------------------------------- |
2329 // CIAUpdateUiController::AllowNetworkRefreshL |
2105 // CIAUpdateUiController::AllowNetworkRefreshL |
2330 // |
2106 // |