|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ImumMtmBaseMtmUi.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 #include <ImumInMailboxServices.h> |
|
22 #include <ConeResLoader.h> |
|
23 |
|
24 #include "EmailFeatureUtils.h" |
|
25 #include "ImumMtmBaseMtmUi.h" |
|
26 #include "ImumMboxSettingsUtils.h" |
|
27 #include "ImumInSettingsKeys.h" |
|
28 #include "ImumPanic.h" |
|
29 #include "ImumMtmLogging.h" |
|
30 |
|
31 // EXTERNAL DATA STRUCTURES |
|
32 // EXTERNAL FUNCTION PROTOTYPES |
|
33 // CONSTANTS |
|
34 // MACROS |
|
35 // LOCAL CONSTANTS AND MACROS |
|
36 // MODULE DATA STRUCTURES |
|
37 // LOCAL FUNCTION PROTOTYPES |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // ============================ MEMBER FUNCTIONS =============================== |
|
41 |
|
42 // ================ CONSTRUCTING ================ |
|
43 |
|
44 // ---------------------------------------------------------------------------- |
|
45 // CImumMtmBaseMtmUi::CImumMtmBaseMtmUi() |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 CImumMtmBaseMtmUi::CImumMtmBaseMtmUi( |
|
49 CBaseMtm& aBaseMtm, |
|
50 CRegisteredMtmDll& aRegisteredMtmDll ) |
|
51 : |
|
52 CBaseMtmUi( aBaseMtm, aRegisteredMtmDll ), |
|
53 iMailboxApi( NULL ), |
|
54 iUtils( NULL ), |
|
55 iMsvSession( NULL ), |
|
56 iErrorResolver( NULL ), |
|
57 iFeatureFlags( NULL ) |
|
58 { |
|
59 IMUM_CONTEXT( CImumMtmBaseMtmUi::CImumMtmBaseMtmUi, 0, KImumMtmLog ); |
|
60 IMUM_IN(); |
|
61 |
|
62 IMUM_OUT(); |
|
63 } |
|
64 |
|
65 // ---------------------------------------------------------------------------- |
|
66 // CImumMtmBaseMtmUi::~CImumMtmBaseMtmUi() |
|
67 // ---------------------------------------------------------------------------- |
|
68 // |
|
69 CImumMtmBaseMtmUi::~CImumMtmBaseMtmUi() |
|
70 { |
|
71 IMUM_CONTEXT( CImumMtmBaseMtmUi::~CImumMtmBaseMtmUi, 0, KImumMtmLog ); |
|
72 IMUM_IN(); |
|
73 |
|
74 delete iMailboxApi; |
|
75 iMailboxApi = NULL; |
|
76 delete iErrorResolver; |
|
77 iErrorResolver = NULL; |
|
78 delete iFeatureFlags; |
|
79 iFeatureFlags = NULL; |
|
80 iMsvSession = NULL; |
|
81 |
|
82 IMUM_OUT(); |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CImumMtmBaseMtmUi::ConstructL() |
|
87 // ---------------------------------------------------------------------------- |
|
88 // |
|
89 void CImumMtmBaseMtmUi::ConstructL() |
|
90 { |
|
91 IMUM_CONTEXT( CImumMtmBaseMtmUi::ConstructL, 0, KImumMtmLog ); |
|
92 IMUM_IN(); |
|
93 |
|
94 // --- Make sure base class correctly constructed --- |
|
95 CBaseMtmUi::ConstructL(); |
|
96 |
|
97 // Construct own base MTM UI |
|
98 iMsvSession = &Session(); |
|
99 iMailboxApi = CreateEmailApiL( iMsvSession ); |
|
100 iErrorResolver = CErrorUI::NewL(*iCoeEnv); |
|
101 iFeatureFlags = MsvEmailMtmUiFeatureUtils::EmailFeaturesL( ETrue, ETrue ); |
|
102 iUtils = const_cast<MImumInMailboxUtilities*>( |
|
103 &iMailboxApi->MailboxUtilitiesL() ); |
|
104 |
|
105 IMUM_OUT(); |
|
106 } |
|
107 |
|
108 // ================ GENERAL MTM UI FUNCTIONALITY ================ |
|
109 |
|
110 // ---------------------------------------------------------------------------- |
|
111 // CImumMtmBaseMtmUi::AcknowledgeReceiptsL() |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 TBool CImumMtmBaseMtmUi::AcknowledgeReceiptsL( |
|
115 const TMsvId aMessageId, |
|
116 const MImumInMailboxUtilities::TImumInMboxRequest& aRequestType ) const |
|
117 { |
|
118 IMUM_CONTEXT( CImumMtmBaseMtmUi::AcknowledgeReceiptsL, 0, KImumMtmLog ); |
|
119 IMUM_IN(); |
|
120 |
|
121 // The Id provided into this function is the id of the email message. |
|
122 // To get the settings, the owner box of the email needs to be found, |
|
123 // using the service id. After the mailbox is found, the settings can |
|
124 // be retrieved to get the setting |
|
125 |
|
126 // First, get the entry of the email |
|
127 TMsvEntry email; |
|
128 TMsvId service; |
|
129 User::LeaveIfError( iMsvSession->GetEntry( aMessageId, service, email ) ); |
|
130 |
|
131 // Next, get the entry of the owner mailbox |
|
132 TMsvEntry mailbox = iUtils->GetMailboxEntryL( |
|
133 email.iServiceId, |
|
134 aRequestType ); |
|
135 |
|
136 // Then read the settings of the mailbox |
|
137 CImumInSettingsData* accountSettings = |
|
138 iMailboxApi->MailboxServicesL().LoadMailboxSettingsL( mailbox.Id() ); |
|
139 CleanupStack::PushL( accountSettings ); |
|
140 |
|
141 // Finally, retrieve the setting |
|
142 TInt ackReceipts = ImumMboxSettingsUtils::QuickGetL<TInt>( |
|
143 *accountSettings, |
|
144 TImumInSettings::EKeyAcknowledgeReceipts ); |
|
145 |
|
146 CleanupStack::PopAndDestroy( accountSettings ); |
|
147 accountSettings = NULL; |
|
148 IMUM_OUT(); |
|
149 |
|
150 return static_cast<TBool>( ackReceipts ); |
|
151 } |
|
152 |
|
153 |
|
154 // ---------------------------------------------------------------------------- |
|
155 // CImumMtmBaseMtmUi::GetMailDeletionModeL() |
|
156 // ---------------------------------------------------------------------------- |
|
157 // |
|
158 TInt CImumMtmBaseMtmUi::GetMailDeletionModeL() const |
|
159 { |
|
160 IMUM_CONTEXT( CImumMtmBaseMtmUi::GetMailDeletionModeL, 0, KImumMtmLog ); |
|
161 IMUM_IN(); |
|
162 |
|
163 // Settings are stored in the CenRep, read the data from the system |
|
164 TMsvId mboxId = BaseMtm().Entry().Entry().iServiceId; |
|
165 IMUM2(0, "Loading mailbox settings from iMailboxApi (0x%x) with Id 0x%x", iMailboxApi, mboxId ); |
|
166 |
|
167 CImumInSettingsData* settings = |
|
168 iMailboxApi->MailboxServicesL().LoadMailboxSettingsL( mboxId ); |
|
169 CleanupStack::PushL( settings ); |
|
170 |
|
171 IMUM1( 0, "Settings data object at 0x%x", settings ); |
|
172 |
|
173 // Mailbox settings contain the deletion mode, so read the data |
|
174 TInt mode = TImumDaSettings::EValueDeletionAlwaysAsk; |
|
175 settings->GetAttr( TImumDaSettings::EKeyMailDeletion, mode ); |
|
176 |
|
177 IMUM1(0, "TInt mode( %d )", mode ); |
|
178 |
|
179 CleanupStack::PopAndDestroy( settings ); |
|
180 settings = NULL; |
|
181 |
|
182 IMUM_OUT(); |
|
183 return mode; |
|
184 } |
|
185 |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // From class CBaseMtmUi. |
|
189 // CImumMtmBaseMtmUi::DeleteServiceL() |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 CMsvOperation* CImumMtmBaseMtmUi::DeleteServiceL( |
|
193 const TMsvEntry& aService, |
|
194 TRequestStatus& aStatus ) |
|
195 { |
|
196 IMUM_CONTEXT( CImumMtmBaseMtmUi::DeleteServiceL, 0, KImumMtmLog ); |
|
197 IMUM_IN(); |
|
198 |
|
199 __ASSERT_DEBUG( aService.iMtm == Type(), |
|
200 User::Panic( KImumMtmUiPanic, ESmtpMtmUiWrongMtm ) ); |
|
201 |
|
202 CImumInternalApi* emailApi = CreateEmailApiL( &Session() ); |
|
203 CleanupStack::PushL( emailApi ); |
|
204 CMsvOperation* op = emailApi->MailboxServicesL().RemoveMailboxL( aService.Id(), aStatus ); |
|
205 CleanupStack::PopAndDestroy( emailApi ); |
|
206 emailApi = NULL; |
|
207 |
|
208 IMUM_OUT(); |
|
209 |
|
210 return op; |
|
211 } |
|
212 |
|
213 // End of File |