62 #include "FreestyleEmailUiMailViewerConstants.h" |
62 #include "FreestyleEmailUiMailViewerConstants.h" |
63 #include "FSDelayedLoader.h" |
63 #include "FSDelayedLoader.h" |
64 #include "FreestyleMessageHeaderURL.h" |
64 #include "FreestyleMessageHeaderURL.h" |
65 #include "FreestyleEmailUiAknStatusIndicator.h" |
65 #include "FreestyleEmailUiAknStatusIndicator.h" |
66 #include <akntoolbar.h> |
66 #include <akntoolbar.h> |
67 // CONSTANTS |
|
68 // Zoom levels available on the UI |
|
69 const TInt KZoomLevels[] = { 75, 100, 125, 150 }; |
|
70 const TInt KZoomLevelCount = sizeof( KZoomLevels ) / sizeof( TInt ); |
|
71 |
67 |
72 CFsEmailUiHtmlViewerView* CFsEmailUiHtmlViewerView::NewL( |
68 CFsEmailUiHtmlViewerView* CFsEmailUiHtmlViewerView::NewL( |
73 CAlfEnv& aEnv, |
69 CAlfEnv& aEnv, |
74 CFreestyleEmailUiAppUi& aAppUi, |
70 CFreestyleEmailUiAppUi& aAppUi, |
75 CAlfControlGroup& aControlGroup ) |
71 CAlfControlGroup& aControlGroup ) |
290 DeleteMailL(); |
286 DeleteMailL(); |
291 } |
287 } |
292 break; |
288 break; |
293 case EFsEmailUiCmdZoomIn: |
289 case EFsEmailUiCmdZoomIn: |
294 { |
290 { |
295 TUint zoomLevelIdx = ZoomLevelIndexL(); |
291 iContainer->ZoomInL(); |
296 SetZoomLevelIndexL( zoomLevelIdx + 1 ); |
|
297 } |
292 } |
298 break; |
293 break; |
299 case EFsEmailUiCmdZoomOut: |
294 case EFsEmailUiCmdZoomOut: |
300 { |
295 { |
301 TUint zoomLevelIdx = ZoomLevelIndexL(); |
296 iContainer->ZoomOutL(); |
302 SetZoomLevelIndexL( zoomLevelIdx - 1 ); |
|
303 } |
297 } |
304 break; |
298 break; |
305 case EFsEmailUiCmdHelp: |
299 case EFsEmailUiCmdHelp: |
306 { |
300 { |
307 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
301 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
1214 iContainer->ResetContent(); |
1217 iContainer->ResetContent(); |
1215 } |
1218 } |
1216 |
1219 |
1217 RArray<TFSMailMsgId> msgIds; |
1220 RArray<TFSMailMsgId> msgIds; |
1218 CleanupClosePushL( msgIds ); |
1221 CleanupClosePushL( msgIds ); |
1219 TFSMailMsgId currentMsgId = iMessage->GetMessageId(); |
1222 |
1220 msgIds.Append( currentMsgId ); |
1223 msgIds.Append( currentMsgId ); |
1221 TFSMailMsgId mailBox = iMessage->GetMailBoxId(); |
1224 TFSMailMsgId mailBox = iMessage->GetMailBoxId(); |
1222 TFSMailMsgId folderId = iMessage->GetFolderId(); |
1225 TFSMailMsgId folderId = iMessage->GetFolderId(); |
1223 |
1226 |
1224 //Get the id and check if there is a previous message available |
1227 //Get the id and check if there is a previous message available |
1229 TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId, |
1232 TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId, |
1230 prevMsgId, |
1233 prevMsgId, |
1231 prevMsgFolderId ); |
1234 prevMsgFolderId ); |
1232 |
1235 |
1233 //Delete the message |
1236 //Delete the message |
|
1237 iLastDeletedMessageID = iMessage->GetMessageId(); |
1234 iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds ); |
1238 iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds ); |
1235 CleanupStack::PopAndDestroy( &msgIds ); |
1239 CleanupStack::PopAndDestroy( &msgIds ); |
1236 |
1240 |
1237 // Notify appui of deleted mail item |
1241 // Notify appui of deleted mail item |
1238 SendEventToAppUiL( TFSEventMailDeletedFromViewer ); |
1242 SendEventToAppUiL( TFSEventMailDeletedFromViewer ); |
1239 |
1243 |
1240 |
1244 |
1241 |
|
1242 if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId ) |
1245 if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId ) |
1243 { |
1246 { |
1244 //Open the previous message or navigate back to list viewer |
1247 //Open the previous message or navigate back to list viewer |
1245 if ( available ) |
1248 if ( available ) |
1246 { |
1249 { |
1320 } |
1323 } |
1321 } |
1324 } |
1322 |
1325 |
1323 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane ) |
1326 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane ) |
1324 { |
1327 { |
1325 FUNC_LOG; |
1328 FUNC_LOG; |
1326 TInt zoomLevelIdx = ZoomLevelIndexL(); |
1329 /* -- Pinch zoom only -- |
|
1330 TInt zoomLevelIdx = iContainer->ZoomLevelL(); |
1327 |
1331 |
1328 // Set the radio button state to match current zoom level |
1332 // Set the radio button state to match current zoom level |
1329 if ( zoomLevelIdx >= 0 && zoomLevelIdx < KZoomLevelCount ) |
1333 if ( zoomLevelIdx >= 0 && zoomLevelIdx < iContainer->MaxZoomLevel() ) |
1330 { |
1334 { |
1331 TInt curZoomLevel = zoomLevelIdx + EFsEmailUiCmdZoomSmall; |
1335 TInt curZoomLevel = zoomLevelIdx + EFsEmailUiCmdZoomSmall; |
1332 aMenuPane->SetItemButtonState( curZoomLevel, EEikMenuItemSymbolOn ); |
1336 aMenuPane->SetItemButtonState( curZoomLevel, EEikMenuItemSymbolOn ); |
1333 } |
1337 } |
1334 } |
1338 */ |
1335 |
1339 aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomSmall, ETrue ); |
1336 TInt CFsEmailUiHtmlViewerView::ZoomLevelIndexL() |
1340 aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomNormal, ETrue ); |
1337 { |
1341 aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomLarge, ETrue ); |
1338 FUNC_LOG; |
1342 aMenuPane->SetItemDimmed( EFsEmailUiCmdZoom150Percent, ETrue ); |
1339 TInt zoomLevelIdx = iContainer->BrowserControlIf()->BrowserSettingL( |
|
1340 TBrCtlDefs::ESettingsCurrentZoomLevelIndex ); |
|
1341 |
|
1342 // Behaviour of zooming in Browser Control Interface is different in version 7.1 |
|
1343 // than in previous versions and we need to support both. In older versions there |
|
1344 // are 4 preset zoom levels while version 7.1 can zoom to any percent. |
|
1345 RArray<TUint>* zoomLevels = iContainer->BrowserControlIf()->ZoomLevels(); |
|
1346 |
|
1347 if ( !zoomLevels || !zoomLevels->Count() || ( *zoomLevels )[0] != KZoomLevels[0] ) |
|
1348 { |
|
1349 // new browser: |
|
1350 // BrowserControlIf gives zoom level percentage insted of index to array |
|
1351 TBool found = EFalse; |
|
1352 |
|
1353 for ( TInt i = 0 ; i < KZoomLevelCount && !found ; ++i ) |
|
1354 { |
|
1355 if ( zoomLevelIdx == KZoomLevels[i] ) |
|
1356 { |
|
1357 zoomLevelIdx = i; |
|
1358 found = ETrue; |
|
1359 } |
|
1360 } |
|
1361 |
|
1362 if ( !found ) |
|
1363 { |
|
1364 zoomLevelIdx = KErrNotFound; |
|
1365 } |
|
1366 } |
|
1367 |
|
1368 return zoomLevelIdx; |
|
1369 } |
|
1370 |
|
1371 void CFsEmailUiHtmlViewerView::SetZoomLevelIndexL( TInt aIndex ) |
|
1372 { |
|
1373 FUNC_LOG; |
|
1374 TInt newValue = KMinTInt; |
|
1375 |
|
1376 // Behaviour of zooming in Browser Control Interface is different in version 7.1 |
|
1377 // than in previous versions and we need to support both. In older versions there |
|
1378 // are 4 preset zoom levels while version 7.1 can zoom to any percent. |
|
1379 RArray<TUint>* zoomLevels = iContainer->BrowserControlIf()->ZoomLevels(); |
|
1380 |
|
1381 if ( !zoomLevels || !zoomLevels->Count() || ( *zoomLevels )[0] != KZoomLevels[0] ) |
|
1382 { |
|
1383 // new browser: |
|
1384 // BrowserControlIf takes zoom level percentage insted of index to array |
|
1385 if ( aIndex >= 0 && aIndex < KZoomLevelCount ) |
|
1386 { |
|
1387 newValue = KZoomLevels[aIndex]; |
|
1388 } |
|
1389 } |
|
1390 else |
|
1391 { |
|
1392 // old browser |
|
1393 newValue = aIndex; |
|
1394 } |
|
1395 |
|
1396 if ( newValue > KMinTInt ) |
|
1397 { |
|
1398 iContainer->BrowserControlIf()->SetBrowserSettingL( |
|
1399 TBrCtlDefs::ESettingsCurrentZoomLevelIndex, newValue ); |
|
1400 } |
|
1401 } |
|
1402 |
|
1403 // ----------------------------------------------------------------------------- |
|
1404 // CFsEmailUiHtmlViewerView::RestoreZoomLevelL() |
|
1405 // ----------------------------------------------------------------------------- |
|
1406 // |
|
1407 void CFsEmailUiHtmlViewerView::RestoreZoomLevelL() |
|
1408 { |
|
1409 FUNC_LOG; |
|
1410 SetZoomLevelIndexL( ZoomLevelIndexL() ); |
|
1411 } |
1343 } |
1412 |
1344 |
1413 // ----------------------------------------------------------------------------- |
1345 // ----------------------------------------------------------------------------- |
1414 // CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL() |
1346 // CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL() |
1415 // ----------------------------------------------------------------------------- |
1347 // ----------------------------------------------------------------------------- |
1979 // Change empty msk when moving to next |
1904 // Change empty msk when moving to next |
1980 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
1905 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
1981 |
1906 |
1982 iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId ); |
1907 iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId ); |
1983 // Next message is displayed in this view through doactivate, because view is re-activate by mail list |
1908 // Next message is displayed in this view through doactivate, because view is re-activate by mail list |
1984 |
|
1985 if ( iContainer ) |
|
1986 { |
|
1987 RestoreZoomLevelL(); |
|
1988 } |
|
1989 } |
1909 } |
1990 } |
1910 } |
1991 } |
1911 } |
1992 // ----------------------------------------------------------------------------- |
1912 // ----------------------------------------------------------------------------- |
1993 // CFsEmailUiHtmlViewerView::ShowPreviousMessageMenuInOptions |
1913 // CFsEmailUiHtmlViewerView::ShowPreviousMessageMenuInOptions |