269 iFirstViewActivation = EFalse; |
272 iFirstViewActivation = EFalse; |
270 } |
273 } |
271 |
274 |
272 if ( iViewedMsg ) // Safety check |
275 if ( iViewedMsg ) // Safety check |
273 { |
276 { |
|
277 //<cmail> |
|
278 // The code below fetches the mail structure in order to have access to all detail needed. |
|
279 // IMAP - hasStructure should be always True |
|
280 // POP - it is False if the message has not been read yet so the code below |
|
281 // should fetch the message structure |
|
282 iAsyncProcessComplete = ETrue; |
|
283 TBool hasStructure = TFsEmailUiUtility::IsMessageStructureKnown( *iViewedMsg ); |
|
284 if (!hasStructure) |
|
285 { |
|
286 iWaitDialog = new (ELeave) CAknWaitDialog((REINTERPRET_CAST(CEikDialog**,&iWaitDialog)), EFalse); |
|
287 iWaitDialog->SetCallback(this); |
|
288 iWaitDialog->ExecuteLD(R_FSE_FETCHING_WAIT_DIALOG); |
|
289 |
|
290 iDialogNotDismissed = ETrue; |
|
291 iAsyncProcessComplete = EFalse; |
|
292 StartFetchingMessageStructureL(iViewedMsg); |
|
293 } |
|
294 //</cmail> |
274 // Set title bar text to "Message/Meeting details" |
295 // Set title bar text to "Message/Meeting details" |
275 ChangeTitleBarTextL( ETrue ); |
296 ChangeTitleBarTextL( ETrue ); |
276 |
297 |
277 iTreeList->HideListL(); |
298 iTreeList->HideListL(); |
278 |
299 |
293 } |
314 } |
294 |
315 |
295 iParentLayout->SetRect( iScreenRect ); |
316 iParentLayout->SetRect( iScreenRect ); |
296 ClearMsgDetailsModelL(); |
317 ClearMsgDetailsModelL(); |
297 |
318 |
|
319 //<cmail> |
|
320 // IMAP - hasStructure is True so the view can be updated. |
|
321 // POP - if hasStructure is False then the message strucure is being fetched. Wait for responce that will be received in |
|
322 // observer method RequestResponseL( ... ) |
|
323 if ( hasStructure ) |
|
324 { |
298 UpdateMsgDetailsModelL(); |
325 UpdateMsgDetailsModelL(); |
299 iTreeList->ShowListL(); |
326 iTreeList->ShowListL(); |
300 } |
327 } |
|
328 //</cmail> |
|
329 } |
301 } |
330 } |
302 // <cmail> Touch |
331 // <cmail> Touch |
303 iTreeList->SetFocusedL(ETrue); |
332 iTreeList->SetFocusedL(ETrue); |
304 // </cmail> |
333 // </cmail> |
305 } |
334 } |
306 |
335 |
307 void CFSEmailUiMsgDetailsVisualiser::ChildDoDeactivate() |
336 void CFSEmailUiMsgDetailsVisualiser::ChildDoDeactivate() |
308 { |
337 { |
309 FUNC_LOG; |
338 FUNC_LOG; |
|
339 //<cmail> |
|
340 CancelFetching(); |
|
341 //</cmail> |
310 if ( !iAppUi.AppUiExitOngoing() ) |
342 if ( !iAppUi.AppUiExitOngoing() ) |
311 { |
343 { |
312 if ( iTreeList->IsFocused() ) |
344 if ( iTreeList->IsFocused() ) |
313 { |
345 { |
314 TRAP_IGNORE( { |
346 TRAP_IGNORE( { |
1808 void CFSEmailUiMsgDetailsVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const |
1840 void CFSEmailUiMsgDetailsVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const |
1809 { |
1841 { |
1810 aLayoutArray.AppendL( iParentLayout ); |
1842 aLayoutArray.AppendL( iParentLayout ); |
1811 } |
1843 } |
1812 |
1844 |
|
1845 // <cmail> |
|
1846 // --------------------------------------------------------------------------- |
|
1847 // Fetching the Message Structure. It is necessary for POP protocol in order to read recipients |
|
1848 // --------------------------------------------------------------------------- |
|
1849 // |
|
1850 void CFSEmailUiMsgDetailsVisualiser::StartFetchingMessageStructureL( |
|
1851 CFSMailMessage* aMsg) |
|
1852 { |
|
1853 FUNC_LOG; |
|
1854 TFSMailMsgId currentMailboxId = aMsg->GetMailBoxId(); |
|
1855 TFSMailMsgId currentMessageFolderId = aMsg->GetFolderId(); |
|
1856 CFSMailFolder* currentFolder = iAppUi.GetMailClient()->GetFolderByUidL( |
|
1857 currentMailboxId, currentMessageFolderId); |
|
1858 CleanupStack::PushL(currentFolder); |
|
1859 RArray<TFSMailMsgId> messageIds; |
|
1860 CleanupClosePushL(messageIds); |
|
1861 messageIds.Append(aMsg->GetMessageId()); |
|
1862 // Fetch the message structure |
|
1863 iCurrentStructureFetchRequestId = currentFolder->FetchMessagesL(messageIds, |
|
1864 EFSMsgDataStructure, *this); |
|
1865 iFetchingMessageStructure = ETrue; |
|
1866 CleanupStack::PopAndDestroy(&messageIds); |
|
1867 CleanupStack::PopAndDestroy(currentFolder); |
|
1868 } |
|
1869 // </cmail> |
|
1870 |
|
1871 // <cmail> |
|
1872 // --------------------------------------------------------------------------- |
|
1873 // MFSMailRequestObserver interface implementation |
|
1874 // --------------------------------------------------------------------------- |
|
1875 // |
|
1876 void CFSEmailUiMsgDetailsVisualiser::RequestResponseL(TFSProgress aEvent, |
|
1877 TInt aRequestId) |
|
1878 { |
|
1879 FUNC_LOG; |
|
1880 if (aRequestId == iCurrentStructureFetchRequestId && iFetchingMessageStructure) |
|
1881 { |
|
1882 if (aEvent.iError != KErrNone || aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) |
|
1883 { |
|
1884 iAsyncProcessComplete = ETrue; |
|
1885 iFetchingMessageStructure = EFalse; |
|
1886 } |
|
1887 else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete) |
|
1888 { |
|
1889 iAsyncProcessComplete = ETrue; |
|
1890 iFetchingMessageStructure = EFalse; |
|
1891 |
|
1892 // get message again, there might be new information |
|
1893 if (iViewedMsg) |
|
1894 { |
|
1895 TFSMailMsgId mailboxId = iViewedMsg->GetMailBoxId(); |
|
1896 TFSMailMsgId folderId = iViewedMsg->GetFolderId(); |
|
1897 TFSMailMsgId messageId = iViewedMsg->GetMessageId(); |
|
1898 UpdateMessagePtrL(mailboxId, folderId, messageId); |
|
1899 } |
|
1900 } |
|
1901 } |
|
1902 //<cmail> |
|
1903 if (iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed) |
|
1904 { |
|
1905 iWaitDialog->ProcessFinishedL(); // deletes the dialog |
|
1906 } |
|
1907 //</cmail> |
|
1908 |
|
1909 if (iViewedMsg) //safety check |
|
1910 { |
|
1911 UpdateMsgDetailsModelL(); |
|
1912 iTreeList->ShowListL(); |
|
1913 iTreeList->SetFocusedL(ETrue); |
|
1914 } |
|
1915 } |
|
1916 // </cmail> |
|
1917 |
|
1918 // <cmail> |
|
1919 // --------------------------------------------------------------------------- |
|
1920 // Update our message pointer and saves its status |
|
1921 // --------------------------------------------------------------------------- |
|
1922 // |
|
1923 void CFSEmailUiMsgDetailsVisualiser::UpdateMessagePtrL( |
|
1924 TFSMailMsgId aNewMailboxId, TFSMailMsgId aNewFolderId, |
|
1925 TFSMailMsgId aNewMessageId) |
|
1926 { |
|
1927 FUNC_LOG; |
|
1928 if (iViewedMsg) |
|
1929 { |
|
1930 |
|
1931 delete iViewedMsg; |
|
1932 iViewedMsg = NULL; |
|
1933 } |
|
1934 |
|
1935 // it should contain all data now (including recipients) |
|
1936 iViewedMsg = iAppUi.GetMailClient()->GetMessageByUidL(aNewMailboxId, |
|
1937 aNewFolderId, aNewMessageId, EFSMsgDataEnvelope); |
|
1938 |
|
1939 if (iViewedMsg) |
|
1940 { |
|
1941 // Save read status |
|
1942 iViewedMsg->SaveMessageL(); |
|
1943 } |
|
1944 } |
|
1945 // </cmail> |
|
1946 |
|
1947 // <cmail> |
|
1948 // --------------------------------------------------------------------------- |
|
1949 // Cancel fetching of the message structure |
|
1950 // --------------------------------------------------------------------------- |
|
1951 // |
|
1952 void CFSEmailUiMsgDetailsVisualiser::CancelFetching() |
|
1953 { |
|
1954 FUNC_LOG; |
|
1955 |
|
1956 if (iFetchingMessageStructure) |
|
1957 { |
|
1958 TRAP_IGNORE( iAppUi.GetMailClient()->CancelL( iCurrentStructureFetchRequestId ) ); |
|
1959 iFetchingMessageStructure = EFalse; |
|
1960 } |
|
1961 iAsyncProcessComplete = ETrue; |
|
1962 if (iWaitDialog && iDialogNotDismissed) |
|
1963 { |
|
1964 TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); // deletes the dialog |
|
1965 iWaitDialog = NULL; |
|
1966 } |
|
1967 //</cmail> |
|
1968 } |
|
1969 // </cmail> |
|
1970 |
|
1971 // <cmail> |
|
1972 // --------------------------------------------------------------------------- |
|
1973 // MProgressDialogCallback interface implementation |
|
1974 // --------------------------------------------------------------------------- |
|
1975 // |
|
1976 void CFSEmailUiMsgDetailsVisualiser::DialogDismissedL( TInt aButtonId) |
|
1977 { |
|
1978 FUNC_LOG; |
|
1979 iDialogNotDismissed = EFalse; |
|
1980 if( aButtonId == EAknSoftkeyCancel ) |
|
1981 { |
|
1982 CancelFetching(); |
|
1983 } |
|
1984 |
|
1985 } |
|
1986 // </cmail> |