60 } |
64 } |
61 |
65 |
62 void CBtMsgViewerUtils::GetMessagePathL(TPtr aMsgPath, const TInt aMessageId) |
66 void CBtMsgViewerUtils::GetMessagePathL(TPtr aMsgPath, const TInt aMessageId) |
63 { |
67 { |
64 CMsvEntry* messageEntry = iMsvSession->GetEntryL(aMessageId); |
68 CMsvEntry* messageEntry = iMsvSession->GetEntryL(aMessageId); |
65 CleanupStack::PushL(messageEntry); |
69 CleanupStack::PushL(messageEntry); //1st push |
66 |
70 |
67 CMsvEntry* attachmentEntry = iMsvSession->GetEntryL((*messageEntry)[0].Id()); |
71 TMsvEntry entry = messageEntry->Entry(); |
68 CleanupStack::PushL(attachmentEntry); |
72 if(entry.MtmData1() == KUidMsgTypeBtTInt32) |
69 |
73 { |
70 CMsvStore* store = attachmentEntry->EditStoreL(); |
74 CMsvStore* store = messageEntry->ReadStoreL(); |
71 CleanupStack::PushL(store); |
75 CleanupStack::PushL(store); //2nd push |
72 |
76 |
73 //get file handle for the attachment & the complete path of the file |
77 //get file handle for the attachment & the complete path of the file |
74 RFile attachmentFile; |
78 RFile attachmentFile; |
75 attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); |
79 attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); |
76 attachmentFile.FullName(aMsgPath); |
80 CleanupClosePushL(attachmentFile); //3rd push |
77 attachmentFile.Close(); |
81 User::LeaveIfError(attachmentFile.FullName(aMsgPath)); |
78 |
82 CleanupStack::PopAndDestroy(&attachmentFile); |
79 //mark attachment as Read |
83 StoreMessageMimeTypeL(aMsgPath); |
80 TMsvEntry attachEntry = attachmentEntry->Entry(); |
84 |
81 attachEntry.SetUnread(EFalse); |
85 //mark attachment as Read |
82 attachmentEntry->ChangeL(attachEntry); |
86 TMsvEntry attachEntry = messageEntry->Entry(); |
83 |
87 attachEntry.SetUnread(EFalse); |
84 CleanupStack::PopAndDestroy(store); |
88 messageEntry->ChangeL(attachEntry); |
85 CleanupStack::PopAndDestroy(attachmentEntry); |
89 |
86 CleanupStack::PopAndDestroy(messageEntry); |
90 CleanupStack::PopAndDestroy(store); |
|
91 CleanupStack::PopAndDestroy(messageEntry); |
|
92 } |
|
93 else |
|
94 { |
|
95 CMsvEntry* attachmentEntry = iMsvSession->GetEntryL((*messageEntry)[0].Id()); |
|
96 CleanupStack::PushL(attachmentEntry); //2nd push |
|
97 |
|
98 CMsvStore* store = attachmentEntry->ReadStoreL(); |
|
99 CleanupStack::PushL(store); //3rd push |
|
100 |
|
101 //get file handle for the attachment & the complete path of the file |
|
102 RFile attachmentFile; |
|
103 attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); |
|
104 CleanupClosePushL(attachmentFile); |
|
105 User::LeaveIfError(attachmentFile.FullName(aMsgPath)); |
|
106 CleanupStack::PopAndDestroy(&attachmentFile); |
|
107 StoreMessageMimeTypeL(aMsgPath); |
|
108 |
|
109 //mark attachment as Read |
|
110 TMsvEntry attachEntry = attachmentEntry->Entry(); |
|
111 attachEntry.SetUnread(EFalse); |
|
112 attachmentEntry->ChangeL(attachEntry); |
|
113 |
|
114 CleanupStack::PopAndDestroy(store); |
|
115 CleanupStack::PopAndDestroy(attachmentEntry); |
|
116 CleanupStack::PopAndDestroy(messageEntry); |
|
117 } |
87 } |
118 } |
88 |
119 |
89 void CBtMsgViewerUtils::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, |
120 void CBtMsgViewerUtils::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, |
90 TAny* aArg2, TAny* aArg3) |
121 TAny* aArg2, TAny* aArg3) |
91 { |
122 { |