60
|
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:
|
|
15 |
* Active object to load mtm's background after mce start.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <featmgr.h> // CR : 401-1806
|
|
23 |
#include <MTMStore.h>
|
|
24 |
#include <mtmuids.h> // KUidMtmQueryCanSendMsg
|
|
25 |
#include <mtud.hrh> // EMtudCommandSendAs
|
|
26 |
#include <mtudreg.h>
|
|
27 |
#include <MtmExtendedCapabilities.hrh> //KUidMsvMtmUiQueryExtendedGetMailProgress
|
|
28 |
|
|
29 |
#include <SenduiMtmUids.h>
|
|
30 |
#include "MceIdleMtmLoader.h"
|
|
31 |
#include "MceLogText.h"
|
|
32 |
#include "MsgFunctionInfo.h"
|
|
33 |
//cmail update
|
|
34 |
#define KUidMsgTypeFsMtmVal 0x2001F406
|
|
35 |
//cmail update
|
|
36 |
|
|
37 |
// LOCAL FUNCTION PROTOTYPES
|
|
38 |
|
|
39 |
// ================= MEMBER FUNCTIONS =======================
|
|
40 |
|
|
41 |
// C++ default constructor can NOT contain any code that
|
|
42 |
// might leave.
|
|
43 |
//
|
|
44 |
CMceIdleMtmLoader::CMceIdleMtmLoader(
|
|
45 |
CMtmStore& aMtmStore,
|
|
46 |
CUidNameArray& aMsgTypesWritePopup,
|
|
47 |
CUidNameArray& aMsgTypesWriteSubmenu,
|
|
48 |
CUidNameArray& aMsgTypesSettings,
|
|
49 |
CMsgFuncArray& aMTMFunctionsArray,
|
|
50 |
CMtmUiDataRegistry& aUiRegistry )
|
|
51 |
: CActive( CActive::EPriorityIdle ),
|
|
52 |
iUiRegistry( aUiRegistry ),
|
|
53 |
iMtmStore(aMtmStore),
|
|
54 |
iMsgTypesWritePopup( aMsgTypesWritePopup ),
|
|
55 |
iMsgTypesWriteSubmenu( aMsgTypesWriteSubmenu ),
|
|
56 |
iMsgTypesSettings( aMsgTypesSettings ),
|
|
57 |
iMTMFunctionsArray( aMTMFunctionsArray ),
|
|
58 |
iAudioMsgEnabled (EFalse),
|
|
59 |
iPostcardEnabled (EFalse)
|
|
60 |
{
|
|
61 |
CActiveScheduler::Add(this);
|
|
62 |
}
|
|
63 |
|
|
64 |
// destructor
|
|
65 |
CMceIdleMtmLoader::~CMceIdleMtmLoader()
|
|
66 |
{
|
|
67 |
}
|
|
68 |
|
|
69 |
// ---------------------------------------------------------
|
|
70 |
// CMceIdleMtmLoader::StartL
|
|
71 |
// ---------------------------------------------------------
|
|
72 |
//
|
|
73 |
void CMceIdleMtmLoader::StartL(CMsvSession& /*aSession*/, TBool aAudioMsgEnabled, TBool aPostcardEnabled)
|
|
74 |
{
|
|
75 |
MCELOGGER_ENTERFN("CMceIdleMtmLoader::StartL()");
|
|
76 |
iMsgTypesWriteSubmenu.Reset();
|
|
77 |
iMsgTypesWritePopup.Reset();
|
|
78 |
iMsgTypesSettings.Reset();
|
|
79 |
iMTMFunctionsArray.Reset();
|
|
80 |
iRegMtmIndex = 0;
|
|
81 |
iAudioMsgEnabled = aAudioMsgEnabled ; // CR : 401-1806
|
|
82 |
iPostcardEnabled = aPostcardEnabled ; // CR : 401-1806
|
|
83 |
QueueLoad();
|
|
84 |
MCELOGGER_LEAVEFN("CMceIdleMtmLoader::StartL()");
|
|
85 |
}
|
|
86 |
|
|
87 |
|
|
88 |
// ---------------------------------------------------------
|
|
89 |
// CMceIdleMtmLoader::FinishL
|
|
90 |
// ---------------------------------------------------------
|
|
91 |
//
|
|
92 |
void CMceIdleMtmLoader::FinishL(TBool aAudioMsgEnabled, TBool aPostcardEnabled)
|
|
93 |
{
|
|
94 |
MCELOGGER_ENTERFN("CMceIdleMtmLoader::FinishL()");
|
|
95 |
iAudioMsgEnabled = aAudioMsgEnabled ; // CR : 401-1806
|
|
96 |
iPostcardEnabled = aPostcardEnabled ; // CR : 401-1806
|
|
97 |
|
|
98 |
if(IsActive())
|
|
99 |
{
|
|
100 |
// First consume the outstanding completion.
|
|
101 |
Cancel();
|
|
102 |
// Now load the remaining MTMs synchronously.
|
|
103 |
while(iRegMtmIndex < iUiRegistry.NumRegisteredMtmDlls())
|
|
104 |
{
|
|
105 |
LoadMtmL( iUiRegistry.MtmTypeUid(iRegMtmIndex) );
|
|
106 |
iRegMtmIndex++;
|
|
107 |
}
|
|
108 |
|
|
109 |
MCELOGGER_WRITE_TIMESTAMP("Time: ");
|
|
110 |
|
|
111 |
// And finally sort the array.
|
|
112 |
SortAndChangeSmsMmsEmailFirstL();
|
|
113 |
}
|
|
114 |
MCELOGGER_LEAVEFN("CMceIdleMtmLoader::FinishL()");
|
|
115 |
}
|
|
116 |
|
|
117 |
|
|
118 |
// ---------------------------------------------------------
|
|
119 |
// CMceIdleMtmLoader::DoCancel
|
|
120 |
// ---------------------------------------------------------
|
|
121 |
//
|
|
122 |
void CMceIdleMtmLoader::DoCancel()
|
|
123 |
{
|
|
124 |
}
|
|
125 |
|
|
126 |
|
|
127 |
// ---------------------------------------------------------
|
|
128 |
// CMceIdleMtmLoader::RunL
|
|
129 |
// ---------------------------------------------------------
|
|
130 |
//
|
|
131 |
void CMceIdleMtmLoader::RunL()
|
|
132 |
{
|
|
133 |
MCELOGGER_ENTERFN("CMceIdleMtmLoader::RunL()");
|
|
134 |
LoadMtmL(iUiRegistry.MtmTypeUid(iRegMtmIndex) );
|
|
135 |
iRegMtmIndex++;
|
|
136 |
QueueLoad();
|
|
137 |
if(!IsActive())
|
|
138 |
{
|
|
139 |
// Sort the array after all MTMs loaded.
|
|
140 |
SortAndChangeSmsMmsEmailFirstL();
|
|
141 |
|
|
142 |
MCELOGGER_WRITE("CMceIdleMtmLoader: Mtm loading finished");
|
|
143 |
MCELOGGER_WRITE_TIMESTAMP("Time: ");
|
|
144 |
|
|
145 |
|
|
146 |
}
|
|
147 |
MCELOGGER_LEAVEFN("CMceIdleMtmLoader::RunL()");
|
|
148 |
}
|
|
149 |
|
|
150 |
|
|
151 |
// ---------------------------------------------------------
|
|
152 |
// CMceIdleMtmLoader::QueueLoad
|
|
153 |
// ---------------------------------------------------------
|
|
154 |
//
|
|
155 |
void CMceIdleMtmLoader::QueueLoad()
|
|
156 |
{
|
|
157 |
MCELOGGER_ENTERFN("CMceIdleMtmLoader::QueueLoad()");
|
|
158 |
const TInt mtmCount = iUiRegistry.NumRegisteredMtmDlls();
|
|
159 |
if( iRegMtmIndex < mtmCount )
|
|
160 |
{
|
|
161 |
TRequestStatus *s = &iStatus;
|
|
162 |
User::RequestComplete(s, KErrNone);
|
|
163 |
SetActive();
|
|
164 |
}
|
|
165 |
MCELOGGER_LEAVEFN("CMceIdleMtmLoader::QueueLoad()");
|
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
// ---------------------------------------------------------
|
|
170 |
// CMceIdleMtmLoader::LoadMtmL
|
|
171 |
// ---------------------------------------------------------
|
|
172 |
//
|
|
173 |
void CMceIdleMtmLoader::LoadMtmL( TUid aMtmType )
|
|
174 |
{
|
|
175 |
MCELOGGER_ENTERFN("CMceIdleMtmLoader::LoadMtmL()");
|
|
176 |
MCELOGGER_WRITE_FORMAT("Loading %x", aMtmType.iUid );
|
|
177 |
// CR : 401-1806
|
|
178 |
FeatureManager::InitializeLibL();
|
|
179 |
TBool newPostcardVal = EFalse;
|
|
180 |
TBool newAudioMsgVal = EFalse;
|
|
181 |
TBool cMailVal = EFalse;
|
|
182 |
newAudioMsgVal = FeatureManager::FeatureSupported( KFeatureIdAudioMessaging );
|
|
183 |
newPostcardVal = FeatureManager::FeatureSupported( KFeatureIdMmsPostcard );
|
|
184 |
cMailVal = FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework );
|
|
185 |
FeatureManager::UnInitializeLib();
|
|
186 |
if ( aMtmType == KSenduiMtmAudioMessageUid && newAudioMsgVal != iAudioMsgEnabled )
|
|
187 |
{
|
|
188 |
iMtmStore.ReleaseMtmUiData(aMtmType);
|
|
189 |
}
|
|
190 |
if ( aMtmType == KSenduiMtmPostcardUid && newPostcardVal != iPostcardEnabled)
|
|
191 |
{
|
|
192 |
iMtmStore.ReleaseMtmUiData(aMtmType);
|
|
193 |
}
|
|
194 |
CBaseMtmUiData* uiData = NULL;
|
|
195 |
TRAPD(err, ( uiData = &(iMtmStore.MtmUiDataL(aMtmType)) ) );
|
|
196 |
if(err != KErrNone)
|
|
197 |
{
|
|
198 |
return;
|
|
199 |
}
|
|
200 |
|
|
201 |
TInt response;
|
|
202 |
TUid canSend;
|
|
203 |
canSend.iUid = KUidMsvMtmQuerySupportEditor ;
|
|
204 |
|
|
205 |
TInt canSendResponse=uiData->QueryCapability(canSend, response);
|
|
206 |
if ( canSendResponse != KErrNone )
|
|
207 |
{
|
|
208 |
canSend.iUid = KUidMtmQueryCanCreateNewMsgValue;
|
|
209 |
canSendResponse = uiData->QueryCapability( canSend, response );
|
|
210 |
}
|
|
211 |
|
|
212 |
if(cMailVal && aMtmType == KSenduiMtmSmtpUid)
|
|
213 |
{
|
|
214 |
canSendResponse = KErrNotSupported;
|
|
215 |
}
|
|
216 |
|
|
217 |
TBool foundPopup = EFalse;
|
|
218 |
TBool foundSubmenu = EFalse;
|
|
219 |
const CArrayFix<CBaseMtmUiData::TMtmUiFunction>& funcs =
|
|
220 |
uiData->MtmSpecificFunctions();
|
|
221 |
const TInt numFuncs = funcs.Count();
|
|
222 |
|
|
223 |
for (TInt funcIndex = 0; funcIndex < numFuncs; funcIndex++ )
|
|
224 |
{
|
|
225 |
CBaseMtmUiData::TMtmUiFunction func = funcs.At(funcIndex);
|
|
226 |
|
|
227 |
if ( (func.iFlags&EMtudCommandTransferSend) ||
|
|
228 |
(func.iFlags&EMtudCommandTransferReceive) )
|
|
229 |
{
|
|
230 |
if ( canSendResponse == KErrNone &&
|
|
231 |
func.iFunctionId == KMtmUiMceWriteMessageSubmenu )
|
|
232 |
{
|
|
233 |
iMsgTypesWriteSubmenu.AppendL( TUidNameInfo(
|
|
234 |
aMtmType,
|
|
235 |
func.iCaption ) );
|
|
236 |
foundSubmenu = ETrue;
|
|
237 |
}
|
|
238 |
else if ( canSendResponse == KErrNone &&
|
|
239 |
func.iFunctionId == KMtmUiMceWriteMessagePopup )
|
|
240 |
{
|
|
241 |
iMsgTypesWritePopup.AppendL( TUidNameInfo(
|
|
242 |
aMtmType,
|
|
243 |
func.iCaption ) );
|
|
244 |
foundPopup = ETrue;
|
|
245 |
}
|
|
246 |
else if ( func.iFunctionId == KMtmUiMceSettings )
|
|
247 |
{
|
|
248 |
iMsgTypesSettings.AppendL( TUidNameInfo(
|
|
249 |
aMtmType,
|
|
250 |
func.iCaption ) );
|
|
251 |
}
|
|
252 |
else
|
|
253 |
{
|
|
254 |
iMTMFunctionsArray.AppendL(
|
|
255 |
TMsgFunctionInfo(
|
|
256 |
func.iCaption,
|
|
257 |
func.iPreferredHotKeyKeyCode,
|
|
258 |
func.iPreferredHotKeyModifiers,
|
|
259 |
func.iFunctionId,
|
|
260 |
func.iFlags,
|
|
261 |
aMtmType) );
|
|
262 |
}
|
|
263 |
}
|
|
264 |
} // end for
|
|
265 |
|
|
266 |
|
|
267 |
if ( canSendResponse == KErrNone )
|
|
268 |
{
|
|
269 |
if ( !foundPopup )
|
|
270 |
{
|
|
271 |
iMsgTypesWritePopup.AppendL( TUidNameInfo(
|
|
272 |
aMtmType,
|
|
273 |
iUiRegistry.RegisteredMtmDllInfo(aMtmType).HumanReadableName()
|
|
274 |
));
|
|
275 |
}
|
|
276 |
|
|
277 |
if ( !foundSubmenu )
|
|
278 |
{
|
|
279 |
//cmail update
|
|
280 |
if(!(cMailVal && (aMtmType.iUid == KUidMsgTypeFsMtmVal)))
|
|
281 |
{
|
|
282 |
iMsgTypesWriteSubmenu.AppendL( TUidNameInfo(
|
|
283 |
aMtmType,
|
|
284 |
iUiRegistry.RegisteredMtmDllInfo(aMtmType).HumanReadableName()
|
|
285 |
));
|
|
286 |
}
|
|
287 |
//cmail update
|
|
288 |
}
|
|
289 |
}
|
|
290 |
|
|
291 |
MCELOGGER_LEAVEFN("CMceIdleMtmLoader::LoadMtmL()");
|
|
292 |
}
|
|
293 |
|
|
294 |
// ---------------------------------------------------------
|
|
295 |
// CMceIdleMtmLoader::SortAndChangeSmsMmsEmailFirstL
|
|
296 |
// ---------------------------------------------------------
|
|
297 |
//
|
|
298 |
void CMceIdleMtmLoader::SortAndChangeSmsMmsEmailFirstL()
|
|
299 |
{
|
|
300 |
iMsgTypesSettings.Sort(ECmpFolded);
|
|
301 |
iMsgTypesWritePopup.Sort(ECmpFolded);
|
|
302 |
iMsgTypesWriteSubmenu.Sort(ECmpFolded);
|
|
303 |
|
|
304 |
ChangeMsgTypeTopL( iMsgTypesSettings, KSenduiMtmPostcardUid );
|
|
305 |
ChangeMsgTypeTopL( iMsgTypesWritePopup, KSenduiMtmPostcardUid );
|
|
306 |
ChangeMsgTypeTopL( iMsgTypesWriteSubmenu, KSenduiMtmPostcardUid );
|
|
307 |
|
|
308 |
ChangeMsgTypeTopL( iMsgTypesSettings, KSenduiMtmSyncMLEmailUid );
|
|
309 |
ChangeMsgTypeTopL( iMsgTypesWritePopup, KSenduiMtmSyncMLEmailUid );
|
|
310 |
ChangeMsgTypeTopL( iMsgTypesWriteSubmenu, KSenduiMtmSyncMLEmailUid );
|
|
311 |
|
|
312 |
ChangeMsgTypeTopL( iMsgTypesSettings, KSenduiMtmSmtpUid );
|
|
313 |
ChangeMsgTypeTopL( iMsgTypesWritePopup, KSenduiMtmSmtpUid );
|
|
314 |
ChangeMsgTypeTopL( iMsgTypesWriteSubmenu, KSenduiMtmSmtpUid );
|
|
315 |
|
|
316 |
ChangeMsgTypeTopL( iMsgTypesSettings, KSenduiMtmAudioMessageUid );
|
|
317 |
ChangeMsgTypeTopL( iMsgTypesWritePopup, KSenduiMtmAudioMessageUid );
|
|
318 |
ChangeMsgTypeTopL( iMsgTypesWriteSubmenu, KSenduiMtmAudioMessageUid );
|
|
319 |
|
|
320 |
// SMS & MMS still have own settings although the editor is common.
|
|
321 |
ChangeMsgTypeTopL( iMsgTypesSettings, KSenduiMtmMmsUid );
|
|
322 |
ChangeMsgTypeTopL( iMsgTypesSettings, KSenduiMtmSmsUid );
|
|
323 |
ChangeMsgTypeTopL( iMsgTypesWritePopup, KSenduiMtmUniMessageUid );
|
|
324 |
ChangeMsgTypeTopL( iMsgTypesWriteSubmenu, KSenduiMtmUniMessageUid );
|
|
325 |
}
|
|
326 |
// ---------------------------------------------------------
|
|
327 |
// CMceIdleMtmLoader::ChangeMsgTypeTopL
|
|
328 |
// ---------------------------------------------------------
|
|
329 |
//
|
|
330 |
void CMceIdleMtmLoader::ChangeMsgTypeTopL( CUidNameArray& aArray, TUid aMsgType ) const
|
|
331 |
{
|
|
332 |
TInt loop = 0;
|
|
333 |
// first change email to the top
|
|
334 |
for (loop=1; loop < aArray.Count(); loop++)
|
|
335 |
{
|
|
336 |
if (aArray[loop].iUid == aMsgType)
|
|
337 |
{
|
|
338 |
TUidNameInfo info = aArray[loop];
|
|
339 |
aArray.InsertL( 0, info );
|
|
340 |
aArray.Delete( loop+1 );
|
|
341 |
break;
|
|
342 |
}
|
|
343 |
}
|
|
344 |
}
|
|
345 |
|
|
346 |
// End of File
|