46
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2006 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: Can be used to show "Send" list query and to create and send
|
|
15 |
* messages via available sending services. Created messages are
|
|
16 |
* sent directly or message editor is opened for editing,
|
|
17 |
* depending on the type of the selected service.
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
#include <coemain.h>
|
|
23 |
#include <Sendnorm.rsg>
|
|
24 |
#include <aknlistquerydialog.h>
|
|
25 |
#include <eikmenup.h>
|
|
26 |
#include <data_caging_path_literals.hrh>
|
|
27 |
#include <DRMHelper.h>
|
|
28 |
#include <centralrepository.h>
|
|
29 |
#include <e32cmn.h> // Uid
|
|
30 |
#include <e32property.h>
|
|
31 |
#include <barsread.h>
|
|
32 |
#include <akninputblock.h>
|
|
33 |
#include <centralrepository.h>
|
|
34 |
#include <miutset.h>
|
|
35 |
#include <MessagingDomainCRKeys.h>
|
|
36 |
#include <mtclreg.h>
|
|
37 |
#include <mtudreg.h>
|
|
38 |
|
|
39 |
// Features
|
|
40 |
#include <featmgr.h>
|
|
41 |
#include <bldvariant.hrh>
|
|
42 |
#include <MsgMimeTypes.h>
|
|
43 |
#include <CSendingServiceInfo.h>
|
|
44 |
#include <CSendingService.h>
|
|
45 |
#include <CMessageData.h>
|
|
46 |
#include <SendUiConsts.h>
|
|
47 |
#include <senduisingleton.h>
|
|
48 |
|
|
49 |
#include "SendUiImpl.h"
|
|
50 |
#include "senduiserviceclient.h"
|
|
51 |
#include "SendUiCapabilityCheck.h"
|
|
52 |
#include "SendUiUtils.h"
|
|
53 |
#include "senduiserviceslog.h" // Logging
|
|
54 |
#include "SendUiPrivateCRKeys.h"
|
|
55 |
#include "senduiproperty.h"
|
|
56 |
#include "propertyobserver.h"
|
|
57 |
#include "senduilauncher.h"
|
|
58 |
#include "SendUiInternalConsts.h"
|
|
59 |
|
|
60 |
|
|
61 |
const TInt KArrayGranularity = 2;
|
|
62 |
const TInt KSendUiServiceOrderArrayGranularity = 6;
|
|
63 |
const TInt KTitleBufLength = 64;
|
|
64 |
//Mail Tech Uid
|
|
65 |
const TUid KMailTechnologyTypeUid = { 0x10001671 };
|
|
66 |
//CMail Tech Uid
|
|
67 |
#define KUidMsgTypeFsMtmVal 0x2001F406
|
|
68 |
|
|
69 |
|
|
70 |
_LIT( KSendUiResourceFileName,"sendnorm.rsc" );
|
|
71 |
|
|
72 |
// ======== MEMBER FUNCTIONS ========
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// CSendUiImpl::NewL
|
|
75 |
// Two-phased constructor.
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CSendUiImpl* CSendUiImpl::NewL()
|
|
79 |
{
|
|
80 |
CSendUiImpl* self = new( ELeave ) CSendUiImpl;
|
|
81 |
|
|
82 |
CleanupStack::PushL( self );
|
|
83 |
self->ConstructL();
|
|
84 |
CleanupStack::Pop( self );
|
|
85 |
|
|
86 |
return self;
|
|
87 |
}
|
|
88 |
|
|
89 |
// -----------------------------------------------------------------------------
|
|
90 |
// Destructor
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
CSendUiImpl::~CSendUiImpl()
|
|
94 |
{
|
|
95 |
iResourceLoader.Close();
|
|
96 |
TInt count = iSendingServices.Count();
|
|
97 |
while ( count )
|
|
98 |
{
|
|
99 |
delete iSendingServices[--count];
|
|
100 |
}
|
|
101 |
iSendingServices.Close();
|
|
102 |
delete iSendUiServicesOrderArray;
|
|
103 |
delete iServicesToDim;
|
|
104 |
delete iPropertyObserver;
|
|
105 |
delete iSingleton;
|
|
106 |
}
|
|
107 |
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
// AddTypedMenuItemL
|
|
110 |
//
|
|
111 |
// No menu item is added, if services are not found. This can happen if asyncronous
|
|
112 |
// sending service update is not yet finished.
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CSendUiImpl::AddTypedMenuItemL(
|
|
116 |
CSendUi::TSendUiMenuType aMenuType,
|
|
117 |
CEikMenuPane& aMenuPane,
|
|
118 |
TInt aIndex,
|
|
119 |
TInt aCommandId,
|
|
120 |
TSendingCapabilities aRequiredCapabilities )
|
|
121 |
{
|
|
122 |
TInt i(0);
|
|
123 |
TBool menuItemAdded = EFalse;
|
|
124 |
TBuf<KTitleBufLength> menuItemName;
|
|
125 |
|
|
126 |
// Read the resources
|
|
127 |
aMenuType == CSendUi::ESendMenu ?
|
|
128 |
i = R_SENDUI_MENUITEM_SEND :
|
|
129 |
i = R_SENDUI_MENUITEM_WRITE; // CSendUi::EWriteMenu
|
|
130 |
|
|
131 |
iCoeEnv->ReadResourceL( menuItemName, i );
|
|
132 |
|
|
133 |
for ( i = 0; i < iSendingServices.Count(); i++ )
|
|
134 |
{
|
|
135 |
TUid serviceUid = iSendingServices[i]->ServiceId();
|
|
136 |
if ( QueryCapabilities( i, aRequiredCapabilities ) )
|
|
137 |
{
|
|
138 |
CEikMenuPaneItem::SData data;
|
|
139 |
data.iCascadeId = NULL;
|
|
140 |
data.iText = menuItemName;
|
|
141 |
data.iCommandId = aCommandId;
|
|
142 |
data.iFlags = 0;
|
|
143 |
|
|
144 |
if ( aIndex == aMenuPane.NumberOfItemsInPane() )
|
|
145 |
{
|
|
146 |
aMenuPane.AddMenuItemL( data );
|
|
147 |
}
|
|
148 |
else
|
|
149 |
{
|
|
150 |
aMenuPane.InsertMenuItemL( data, aIndex );
|
|
151 |
}
|
|
152 |
|
|
153 |
menuItemAdded = ETrue;
|
|
154 |
break;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
|
|
158 |
// Hide menu item if sending is already in progress.
|
|
159 |
if ( menuItemAdded )
|
|
160 |
{
|
|
161 |
aMenuPane.SetItemDimmed( aCommandId, iIsSending);
|
|
162 |
}
|
|
163 |
}
|
|
164 |
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
// ShowTypedQueryAndSendL
|
|
167 |
// First shows list query and then creates the message.
|
|
168 |
// Editor is launched for editing the message or the message is sent
|
|
169 |
// directly without opening the editor. Functionality depends on the
|
|
170 |
// type of selected sending service.
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
void CSendUiImpl::ShowTypedQueryAndSendL(
|
|
174 |
CSendUi::TSendUiMenuType aMenuType,
|
|
175 |
const CMessageData* aMessageData,
|
|
176 |
TSendingCapabilities aRequiredCapabilities,
|
|
177 |
CArrayFix<TUid>* aServicesToDim,
|
|
178 |
TBool aLaunchEditorEmbedded,
|
|
179 |
const TDesC& aTitleText )
|
|
180 |
{
|
|
181 |
TUid serviceId = ShowTypedQueryL(
|
|
182 |
aMenuType,
|
|
183 |
aMessageData,
|
|
184 |
aRequiredCapabilities,
|
|
185 |
aServicesToDim,
|
|
186 |
aTitleText );
|
|
187 |
|
|
188 |
if ( serviceId != KNullUid )
|
|
189 |
{
|
|
190 |
// Process user selection.
|
|
191 |
CreateAndSendMessageL(
|
|
192 |
serviceId,
|
|
193 |
aMessageData,
|
|
194 |
aLaunchEditorEmbedded);
|
|
195 |
}
|
|
196 |
}
|
|
197 |
|
|
198 |
// -----------------------------------------------------------------------------
|
|
199 |
// ShowTypedQueryL
|
|
200 |
// Shows list query and returns the user selection.
|
|
201 |
// -----------------------------------------------------------------------------
|
|
202 |
//
|
|
203 |
TUid CSendUiImpl::ShowTypedQueryL(
|
|
204 |
CSendUi::TSendUiMenuType aMenuType,
|
|
205 |
const CMessageData* aMessageData,
|
|
206 |
TSendingCapabilities aRequiredCapabilities,
|
|
207 |
CArrayFix<TUid>* aServicesToDim,
|
|
208 |
const TDesC& aTitleText )
|
|
209 |
{
|
|
210 |
//validation of attachments is costly operation and hence better be done after showing services popup.
|
|
211 |
// Implemented for CR # 401-1806 >>
|
|
212 |
// This section to enable/disable features (supported by feature manager) at run time, is to be revised,
|
|
213 |
// once an observer class is available from feature manager side to intimate about feature state
|
|
214 |
|
|
215 |
CRepository* repository = CRepository::NewLC( KCRUidSendUi );
|
|
216 |
TInt oldFeatures(0);
|
|
217 |
TInt newFeatures(0);
|
|
218 |
TBool updateNeeded( EFalse );
|
|
219 |
|
|
220 |
if ( repository->Get( KKeySendUiFeatureManagerServices, oldFeatures ) != KErrNone )
|
|
221 |
{
|
|
222 |
updateNeeded = ETrue;
|
|
223 |
}
|
|
224 |
FeatureManager::InitializeLibL();
|
|
225 |
FeatureStatus( KFeatureIdMmsPostcard, newFeatures, KSendUiPostcard );
|
|
226 |
FeatureStatus( KFeatureIdAudioMessaging, newFeatures, KSendUiAudioMessage );
|
|
227 |
FeatureStatus( KFeatureIdSenduiMmsUpload, newFeatures, KSendUiMmsUpload );
|
|
228 |
FeatureManager::UnInitializeLib();
|
|
229 |
if ( newFeatures != oldFeatures )
|
|
230 |
{
|
|
231 |
repository->Set( KKeySendUiFeatureManagerServices, newFeatures );
|
|
232 |
updateNeeded = ETrue;
|
|
233 |
}
|
|
234 |
|
|
235 |
CleanupStack::PopAndDestroy( repository );
|
|
236 |
|
|
237 |
RProperty propertyUpdateOperation;
|
|
238 |
TRequestStatus status;
|
|
239 |
if ( updateNeeded )
|
|
240 |
{
|
|
241 |
RProperty::Set(
|
|
242 |
KPSUidSendUiProperty,
|
|
243 |
KSendUiUpdateRequest,
|
|
244 |
KSendUiUpdateRequested );
|
|
245 |
User::LeaveIfError( propertyUpdateOperation.Attach( KPSUidSendUiProperty, KSendUiUpdateRequest ));
|
|
246 |
propertyUpdateOperation.Subscribe( status );
|
|
247 |
User::WaitForRequest(status);
|
|
248 |
TInt value = KErrNone;
|
|
249 |
if(propertyUpdateOperation.Get( value ) !=KErrNotFound && value == KSendUiUpdated )
|
|
250 |
{
|
|
251 |
TRAPD( err, GetServicesL() );
|
|
252 |
if ( err )
|
|
253 |
{
|
|
254 |
#ifdef _DEBUG
|
|
255 |
TBuf<256> buf;
|
|
256 |
buf.Format(_L("SendUi err"));
|
|
257 |
User::InfoPrint(buf);
|
|
258 |
#endif
|
|
259 |
TUid serviceId( KNullUid );
|
|
260 |
return serviceId;
|
|
261 |
}
|
|
262 |
}
|
|
263 |
propertyUpdateOperation.Close();
|
|
264 |
}
|
|
265 |
// Implemented for CR # 401-1806 <<
|
|
266 |
// List items for list query.
|
|
267 |
CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat( KArrayGranularity );
|
|
268 |
CleanupStack::PushL( listItems);
|
|
269 |
|
|
270 |
// This array is used to map user selection to correct service.
|
|
271 |
CArrayFix<TUid>* listItemUids =
|
|
272 |
new ( ELeave ) CArrayFixFlat<TUid>( KArrayGranularity );
|
|
273 |
CleanupStack::PushL( listItemUids );
|
|
274 |
|
|
275 |
iServicesToDim->Reset();
|
|
276 |
|
|
277 |
TInt i = 0;
|
|
278 |
if ( aServicesToDim )
|
|
279 |
{
|
|
280 |
for ( i = 0; i < aServicesToDim->Count(); i++ )
|
|
281 |
{
|
|
282 |
iServicesToDim->AppendL( (*aServicesToDim)[i] );
|
|
283 |
}
|
|
284 |
}
|
|
285 |
|
|
286 |
// Get and filter ECom based services.
|
|
287 |
FilterServicesL(
|
|
288 |
*listItems,
|
|
289 |
*listItemUids,
|
|
290 |
aRequiredCapabilities,
|
|
291 |
aMessageData,
|
|
292 |
aMenuType );
|
|
293 |
|
|
294 |
TUid serviceId( KNullUid );
|
|
295 |
if ( listItems->Count() > 0 )
|
|
296 |
{
|
|
297 |
// Show list query.
|
|
298 |
SortListL( *listItems, *listItemUids );
|
|
299 |
|
|
300 |
serviceId = ShowListQueryL(
|
|
301 |
listItems,
|
|
302 |
*listItemUids,
|
|
303 |
aTitleText,
|
|
304 |
aMenuType );
|
|
305 |
}
|
|
306 |
|
|
307 |
CleanupStack::PopAndDestroy( 2, listItems ); // listItemUids, listItems
|
|
308 |
|
|
309 |
return serviceId;
|
|
310 |
}
|
|
311 |
|
|
312 |
// -----------------------------------------------------------------------------
|
|
313 |
// SendMessageL
|
|
314 |
// -----------------------------------------------------------------------------
|
|
315 |
TInt CSendUiImpl::SendMessageL(
|
|
316 |
TUid aServiceUid,
|
|
317 |
const CMessageData* aMessageData,
|
|
318 |
TBool aLaunchEditorEmbedded)
|
|
319 |
{
|
|
320 |
if ( iIsSending || aServiceUid == KNullUid )
|
|
321 |
{
|
|
322 |
return KErrNone;
|
|
323 |
}
|
|
324 |
|
|
325 |
CAknInputBlock* absorber = CAknInputBlock::NewLC( );
|
|
326 |
// Ensures proper sending state if leave happens.
|
|
327 |
iIsSending = ETrue;
|
|
328 |
TInt success( KErrNone );
|
|
329 |
CleanupStack::PushL( TCleanupItem( ResetIsSending, (TAny*)&iIsSending ) );
|
|
330 |
|
|
331 |
// Create the requested ECom service.
|
|
332 |
TInt i( ResolveServiceIndex( aServiceUid ));
|
|
333 |
if ( i != KErrNotFound )
|
|
334 |
{
|
|
335 |
TRAP( success,
|
|
336 |
CSendingService* sendingService = CSendingService::NewL(
|
|
337 |
iSendingServices[i]->ServiceProviderId(), *iCoeEnv, *iSingleton );
|
|
338 |
CleanupStack::PushL( sendingService );
|
|
339 |
|
|
340 |
sendingService->CreateAndSendMessageL( aServiceUid, aMessageData, aLaunchEditorEmbedded );
|
|
341 |
CleanupStack::PopAndDestroy( sendingService );
|
|
342 |
);
|
|
343 |
|
|
344 |
}
|
|
345 |
else
|
|
346 |
{
|
|
347 |
iIsSending = EFalse;
|
|
348 |
}
|
|
349 |
CleanupStack::PopAndDestroy( 2, absorber); // TCleanupItem, absorber
|
|
350 |
return success;
|
|
351 |
}
|
|
352 |
|
|
353 |
// -----------------------------------------------------------------------------
|
|
354 |
// SendMessageViaServer
|
|
355 |
// -----------------------------------------------------------------------------
|
|
356 |
//
|
|
357 |
void CSendUiImpl::SendMessageViaServerL(
|
|
358 |
TUid aServiceUid,
|
|
359 |
const CMessageData* aMessageData,
|
|
360 |
TBool aLaunchEditorEmbedded )
|
|
361 |
{
|
|
362 |
TInt index( ResolveServiceIndex( aServiceUid ));
|
|
363 |
TBool capabilitiesOk = ETrue;
|
|
364 |
if ( index == KErrNotFound )
|
|
365 |
{
|
|
366 |
return;
|
|
367 |
}
|
|
368 |
if ( iSendingServices[index]->ServiceFeatures() & CSendingServiceInfo::EServiceCanSendDirectly )
|
|
369 |
{
|
|
370 |
// Check sending rights
|
|
371 |
RProcess process;
|
|
372 |
TSecurityInfo securityInfo( process );
|
|
373 |
CSendUiCapabilityCheck* capabilityCheck = CSendUiCapabilityCheck::NewLC();
|
|
374 |
|
|
375 |
capabilitiesOk = capabilityCheck->CheckCapabilitiesL(
|
|
376 |
securityInfo,
|
|
377 |
iSingleton->MsvSessionL(),
|
|
378 |
KSenduiMtmMmsUid,
|
|
379 |
iSendingServices[index]->ServiceName() );
|
|
380 |
|
|
381 |
CleanupStack::PopAndDestroy( capabilityCheck );
|
|
382 |
}
|
|
383 |
|
|
384 |
if ( capabilitiesOk )
|
|
385 |
{
|
|
386 |
TUid providerUid = iSendingServices[index]->ServiceProviderId();
|
|
387 |
RSendUiServiceClient sendUiClient;
|
|
388 |
CleanupClosePushL( sendUiClient );
|
|
389 |
sendUiClient.ConnectChainedAppL( KSendUiLauncherAppUid );
|
|
390 |
// LaunchSendUiL is syncronous operation
|
|
391 |
sendUiClient.LaunchSendUiL(
|
|
392 |
aServiceUid,
|
|
393 |
providerUid,
|
|
394 |
aLaunchEditorEmbedded,
|
|
395 |
aMessageData );
|
|
396 |
CleanupStack::PopAndDestroy( &sendUiClient);
|
|
397 |
}
|
|
398 |
|
|
399 |
}
|
|
400 |
|
|
401 |
// -----------------------------------------------------------------------------
|
|
402 |
// CreateAndSendMessageL
|
|
403 |
// Creates the message and launches the editor for editing the message
|
|
404 |
// or sends the message directly without opening the editor.
|
|
405 |
// Functionality depends on the type of selected sending service.
|
|
406 |
// -----------------------------------------------------------------------------
|
|
407 |
//
|
|
408 |
void CSendUiImpl::CreateAndSendMessageL(
|
|
409 |
TUid aServiceUid,
|
|
410 |
const CMessageData* aMessageData,
|
|
411 |
TBool aLaunchEditorEmbedded )
|
|
412 |
{
|
|
413 |
LOGTEXT(_L("CSendUiImpl::CreateAndSendMessageL >>"));
|
|
414 |
TInt err(0); // initializing this to 0 helps debugging SendMessageViaServerL
|
|
415 |
err = SendMessageL( aServiceUid, aMessageData, aLaunchEditorEmbedded );
|
|
416 |
if ( !iServerAppLaunch && ( err == KErrPermissionDenied || err == KErrAccessDenied ) )
|
|
417 |
{
|
|
418 |
SendMessageViaServerL( aServiceUid, aMessageData, aLaunchEditorEmbedded );
|
|
419 |
}
|
|
420 |
else
|
|
421 |
{
|
|
422 |
User::LeaveIfError( err );
|
|
423 |
}
|
|
424 |
LOGTEXT(_L("CSendUiImpl::CreateAndSendMessageL <<"));
|
|
425 |
}
|
|
426 |
|
|
427 |
// -----------------------------------------------------------------------------
|
|
428 |
// ServiceCapabilitiesL
|
|
429 |
// Returns sending capabilities of the sending service.
|
|
430 |
// -----------------------------------------------------------------------------
|
|
431 |
//
|
|
432 |
TInt CSendUiImpl::ServiceCapabilities(
|
|
433 |
TUid aServiceUid,
|
|
434 |
TSendingCapabilities& aServiceCapabilities )
|
|
435 |
{
|
|
436 |
TInt i( ResolveServiceIndex( aServiceUid ));
|
|
437 |
|
|
438 |
if ( i != KErrNotFound )
|
|
439 |
{
|
|
440 |
aServiceCapabilities =
|
|
441 |
iSendingServices[i]->ServiceCapabilities();
|
|
442 |
i = KErrNone;
|
|
443 |
}
|
|
444 |
return i;
|
|
445 |
}
|
|
446 |
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
// AvailableServicesL
|
|
449 |
// Populates given list with the information about services
|
|
450 |
// provided by specified ECom service provider.
|
|
451 |
// (other items were commented in a header).
|
|
452 |
// -----------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
|
|
455 |
void CSendUiImpl::AvailableServicesL(
|
|
456 |
RPointerArray<CSendingServiceInfo>& aServiceList,
|
|
457 |
TUid aServiceProvider)
|
|
458 |
{
|
|
459 |
for ( TInt i(0); i < iSendingServices.Count(); i++ )
|
|
460 |
{
|
|
461 |
if ( iSendingServices[i]->ServiceProviderId() == aServiceProvider
|
|
462 |
|| aServiceProvider == KNullUid )
|
|
463 |
{
|
|
464 |
CSendingServiceInfo* serviceInfo = iSendingServices[i]->CopyLC();
|
|
465 |
aServiceList.AppendL( serviceInfo );
|
|
466 |
CleanupStack::Pop( serviceInfo ); // serviceInfo
|
|
467 |
}
|
|
468 |
}
|
|
469 |
}
|
|
470 |
// -----------------------------------------------------------------------------
|
|
471 |
// TechnologyType
|
|
472 |
// -----------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
TUid CSendUiImpl::TechnologyType( TUid aServiceUid )
|
|
475 |
{
|
|
476 |
TInt i = ResolveServiceIndex( aServiceUid );
|
|
477 |
if ( i != KErrNotFound )
|
|
478 |
{
|
|
479 |
return iSendingServices[i]->TechnologyTypeId();
|
|
480 |
}
|
|
481 |
else
|
|
482 |
{
|
|
483 |
return TUid::Null();
|
|
484 |
}
|
|
485 |
}
|
|
486 |
|
|
487 |
// -----------------------------------------------------------------------------
|
|
488 |
//
|
|
489 |
// -----------------------------------------------------------------------------
|
|
490 |
//
|
|
491 |
TInt CSendUiImpl::ResolveServiceIndex( TUid aServiceUid )
|
|
492 |
{
|
|
493 |
TInt index( iSendingServices.Count() );
|
|
494 |
|
|
495 |
while( --index >= 0)
|
|
496 |
{
|
|
497 |
if ( iSendingServices[index]->ServiceId() == aServiceUid )
|
|
498 |
{
|
|
499 |
return index;
|
|
500 |
}
|
|
501 |
}
|
|
502 |
return KErrNotFound;
|
|
503 |
}
|
|
504 |
|
|
505 |
// -----------------------------------------------------------------------------
|
|
506 |
// QueryCapabilities
|
|
507 |
// -----------------------------------------------------------------------------
|
|
508 |
//
|
|
509 |
TBool CSendUiImpl::QueryCapabilities(
|
|
510 |
TInt index,
|
|
511 |
TSendingCapabilities aRequiredCapabilities )
|
|
512 |
{
|
|
513 |
if ( index == KErrNotFound )
|
|
514 |
{
|
|
515 |
return EFalse;
|
|
516 |
}
|
|
517 |
|
|
518 |
if ( aRequiredCapabilities.iFlags == TSendingCapabilities::EAllServices )
|
|
519 |
{
|
|
520 |
// No capabilities required from service
|
|
521 |
return ETrue;
|
|
522 |
}
|
|
523 |
TSendingCapabilities serviceCap = iSendingServices[ index ]->ServiceCapabilities();
|
|
524 |
|
|
525 |
if ( !(serviceCap.iMessageSize == 0 // no size limit set for the service
|
|
526 |
|| aRequiredCapabilities.iMessageSize == 0 ) // no size limit asked from the client
|
|
527 |
&& aRequiredCapabilities.iMessageSize > serviceCap.iMessageSize )
|
|
528 |
{
|
|
529 |
return EFalse;
|
|
530 |
}
|
|
531 |
|
|
532 |
// Check if support for attachments are required.
|
|
533 |
if ( aRequiredCapabilities.iFlags & TSendingCapabilities::ESupportsAttachments
|
|
534 |
&& serviceCap.iFlags & TSendingCapabilities::ESupportsAttachments )
|
|
535 |
{
|
|
536 |
return ETrue;
|
|
537 |
}
|
|
538 |
|
|
539 |
// Check if support for body text is required.
|
|
540 |
if ( aRequiredCapabilities.iFlags & TSendingCapabilities::ESupportsBodyText )
|
|
541 |
{
|
|
542 |
if ( serviceCap.iFlags & TSendingCapabilities::ESupportsBodyText )
|
|
543 |
{
|
|
544 |
if ( serviceCap.iBodySize > 0 && aRequiredCapabilities.iBodySize > serviceCap.iBodySize )
|
|
545 |
{
|
|
546 |
return EFalse; // size limit defined and it is enough
|
|
547 |
}
|
|
548 |
// no size limit in service for bodytext or required size below max size.
|
|
549 |
return ETrue;
|
|
550 |
}
|
|
551 |
}
|
|
552 |
|
|
553 |
|
|
554 |
// Check if support for BIO sending is required.
|
|
555 |
if ( aRequiredCapabilities.iFlags & TSendingCapabilities::ESupportsBioSending
|
|
556 |
&& serviceCap.iFlags & TSendingCapabilities::ESupportsBioSending )
|
|
557 |
{
|
|
558 |
return ETrue;
|
|
559 |
}
|
|
560 |
|
|
561 |
// Check if support for editor is required.
|
|
562 |
if ( aRequiredCapabilities.iFlags & TSendingCapabilities::ESupportsEditor
|
|
563 |
&& serviceCap.iFlags & TSendingCapabilities::ESupportsEditor )
|
|
564 |
{
|
|
565 |
return ETrue;
|
|
566 |
}
|
|
567 |
return EFalse;
|
|
568 |
}
|
|
569 |
|
|
570 |
// -----------------------------------------------------------------------------
|
|
571 |
// CSendUiImpl::GetServicesL
|
|
572 |
//
|
|
573 |
// (other items were commented in a header).
|
|
574 |
// -----------------------------------------------------------------------------
|
|
575 |
//
|
|
576 |
|
|
577 |
void CSendUiImpl::GetServicesL( )
|
|
578 |
{
|
|
579 |
TInt value(0);
|
|
580 |
TInt serviceCount;
|
|
581 |
TInt cleanupItems(0);
|
|
582 |
|
|
583 |
CRepository* rep = CRepository::NewLC( KCRUidSendUi );
|
|
584 |
cleanupItems++;
|
|
585 |
TInt err = rep->Get( KKeySendUiServiceCount, serviceCount );
|
|
586 |
|
|
587 |
if ( err )
|
|
588 |
{
|
|
589 |
LOGTEXT(_L("SendUiImpl->GetServicesL: Cenrep init file missing"));
|
|
590 |
CleanupStack::PopAndDestroy( rep );
|
|
591 |
return;
|
|
592 |
}
|
|
593 |
else
|
|
594 |
{
|
|
595 |
if ( serviceCount == KSendUiNotInitialized )
|
|
596 |
{
|
|
597 |
// Services has not been initialized, launch service resolver in the bacground.
|
|
598 |
CleanupStack::PopAndDestroy( rep);
|
|
599 |
// iSendingServices are updated, when update is done.
|
|
600 |
RProperty::Set(
|
|
601 |
KPSUidSendUiProperty,
|
|
602 |
KSendUiUpdateRequest,
|
|
603 |
KSendUiUpdateRequested);
|
|
604 |
|
|
605 |
return;
|
|
606 |
}
|
|
607 |
}
|
|
608 |
|
|
609 |
while ( iSendingServices.Count() )
|
|
610 |
{
|
|
611 |
delete iSendingServices[0];
|
|
612 |
iSendingServices.Remove(0);
|
|
613 |
}
|
|
614 |
|
|
615 |
HBufC* text = HBufC::NewLC( KSendUiServiceMaxNameLength );
|
|
616 |
cleanupItems++;
|
|
617 |
TPtr ptr = text->Des();
|
|
618 |
TInt key;
|
|
619 |
for( TInt i(0); i < serviceCount; i++ )
|
|
620 |
{
|
|
621 |
key = KSendUiServiceIndex * i;
|
|
622 |
CSendingServiceInfo* info = CSendingServiceInfo::NewLC();
|
|
623 |
|
|
624 |
err = rep->Get( key | KSendUiServiceId, value );
|
|
625 |
if (!err )
|
|
626 |
{
|
|
627 |
info->SetServiceId( TUid::Uid( value ));
|
|
628 |
}
|
|
629 |
|
|
630 |
err = rep->Get( key | KSendUiServiceProviderId, value );
|
|
631 |
if (!err )
|
|
632 |
{
|
|
633 |
info->SetServiceProviderId( TUid::Uid( value ));
|
|
634 |
}
|
|
635 |
|
|
636 |
err = rep->Get( key | KSendUiServiceName, ptr );
|
|
637 |
if (!err)
|
|
638 |
{
|
|
639 |
__ASSERT_DEBUG( ptr.Length() <= KSendUiServiceMaxNameLength, User::Invariant() );
|
|
640 |
info->SetServiceNameL( ptr );
|
|
641 |
}
|
|
642 |
|
|
643 |
err = rep->Get( key | KSendUiServiceMenuName, ptr );
|
|
644 |
if (!err)
|
|
645 |
{
|
|
646 |
__ASSERT_DEBUG( ptr.Length() <= KSendUiServiceMaxNameLength, User::Invariant() );
|
|
647 |
info->SetServiceMenuNameL( ptr );
|
|
648 |
}
|
|
649 |
|
|
650 |
err = rep->Get( key | KSendUiServiceAddress, ptr );
|
|
651 |
if (!err)
|
|
652 |
{
|
|
653 |
__ASSERT_DEBUG( ptr.Length() <= KSendUiServiceMaxNameLength, User::Invariant() );
|
|
654 |
info->SetServiceAddressL( ptr );
|
|
655 |
}
|
|
656 |
|
|
657 |
TSendingCapabilities cap;
|
|
658 |
|
|
659 |
err = rep->Get( key | KSendUiServiceFlags, value );
|
|
660 |
if (!err)
|
|
661 |
{
|
|
662 |
cap.iFlags = value;
|
|
663 |
}
|
|
664 |
|
|
665 |
err = rep->Get( key | KSendUiServiceBodySize, value );
|
|
666 |
if (!err)
|
|
667 |
{
|
|
668 |
cap.iBodySize = value;
|
|
669 |
}
|
|
670 |
|
|
671 |
err = rep->Get( key | KSendUiServiceMessageSize, value );
|
|
672 |
if (!err)
|
|
673 |
{
|
|
674 |
cap.iMessageSize = value;
|
|
675 |
}
|
|
676 |
|
|
677 |
|
|
678 |
err = rep->Get( key | KSendUiServiceTechnologyType, value );
|
|
679 |
if (!err )
|
|
680 |
{
|
|
681 |
info->SetTechnologyTypeId( TUid::Uid( value ));
|
|
682 |
}
|
|
683 |
|
|
684 |
err = rep->Get( key | KSendUiServiceFeatures, value );
|
|
685 |
if (!err)
|
|
686 |
{
|
|
687 |
info->SetServiceFeatures( value );
|
|
688 |
}
|
|
689 |
|
|
690 |
if (!err)
|
|
691 |
{
|
|
692 |
info->SetServiceCapabilities( cap );
|
|
693 |
iSendingServices.Append( info );
|
|
694 |
CleanupStack::Pop( info);
|
|
695 |
}
|
|
696 |
|
|
697 |
}
|
|
698 |
|
|
699 |
CleanupStack::PopAndDestroy( cleanupItems, rep); // text, rep
|
|
700 |
|
|
701 |
}
|
|
702 |
|
|
703 |
// ---------------------------------------------------------
|
|
704 |
// ShowListQueryL(
|
|
705 |
// Displays list query.
|
|
706 |
// (other items were commented in a header).
|
|
707 |
// ---------------------------------------------------------
|
|
708 |
//
|
|
709 |
TUid CSendUiImpl::ShowListQueryL(
|
|
710 |
MDesCArray* aListItems,
|
|
711 |
const CArrayFix<TUid>& aListItemUids,
|
|
712 |
const TDesC& aTitleText,
|
|
713 |
CSendUi::TSendUiMenuType aMenuType )
|
|
714 |
{
|
|
715 |
// Show list query.
|
|
716 |
TInt choice = KErrNotFound;
|
|
717 |
CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &choice );
|
|
718 |
TInt ret = 0;
|
|
719 |
TRAPD( err,
|
|
720 |
dlg->PrepareLC( R_SENDUI_LIST_QUERY );
|
|
721 |
dlg->SetItemTextArray( aListItems );
|
|
722 |
dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
723 |
|
|
724 |
// Set title
|
|
725 |
CAknPopupHeadingPane* heading = dlg->Heading();
|
|
726 |
|
|
727 |
if ( aTitleText != KNullDesC )
|
|
728 |
{
|
|
729 |
heading->SetTextL( aTitleText );
|
|
730 |
}
|
|
731 |
else
|
|
732 |
{
|
|
733 |
HBufC* title;
|
|
734 |
TInt titleId(0);
|
|
735 |
if (aMenuType == CSendUi::ESendMenu )
|
|
736 |
{
|
|
737 |
titleId = R_SENDUI_LIST_QUERY_TITLE ;
|
|
738 |
}
|
|
739 |
else if ( aMenuType == CSendUi::EWriteMenu )
|
|
740 |
{
|
|
741 |
titleId = R_SENDUI_LIST_QUERY_TITLE_WRITE;
|
|
742 |
}
|
|
743 |
|
|
744 |
if ( titleId )
|
|
745 |
{
|
|
746 |
title = iCoeEnv->AllocReadResourceLC( titleId );
|
|
747 |
heading->SetTextL( *title );
|
|
748 |
CleanupStack::PopAndDestroy( title );
|
|
749 |
}
|
|
750 |
}
|
|
751 |
|
|
752 |
ret = dlg->RunLD();
|
|
753 |
); //end of TRAPD
|
|
754 |
|
|
755 |
if( err == KLeaveExit )
|
|
756 |
{
|
|
757 |
delete dlg;
|
|
758 |
dlg = NULL;
|
|
759 |
}
|
|
760 |
|
|
761 |
if ( !ret )
|
|
762 |
{
|
|
763 |
return KNullUid;
|
|
764 |
}
|
|
765 |
return aListItemUids.At( choice );
|
|
766 |
}
|
|
767 |
|
|
768 |
|
|
769 |
// -----------------------------------------------------------------------------
|
|
770 |
// CanSendContentL
|
|
771 |
// -----------------------------------------------------------------------------
|
|
772 |
//
|
|
773 |
TBool CSendUiImpl::CanSendContentL(
|
|
774 |
TUid aServiceUid,
|
|
775 |
TUid aServiceProviderId,
|
|
776 |
const CMessageData* aMessageData,
|
|
777 |
TDataType* aMimeType )
|
|
778 |
{
|
|
779 |
// Other ecoms are filtered by their base provider, but versitile MTMs under
|
|
780 |
// GenericMtmPlugin have filtering by their serviceUid
|
|
781 |
if ( aServiceProviderId != KGenericMtmPlugin )
|
|
782 |
{
|
|
783 |
aServiceUid = aServiceProviderId;
|
|
784 |
}
|
|
785 |
// Content based filtering is done only for some selected services.
|
|
786 |
// Cannot filter with no data, certain services and audio message (if no audiomessage support)
|
|
787 |
if ( !aMessageData ||
|
|
788 |
!( aServiceUid == KDrmLinkSender ||
|
|
789 |
aServiceUid == KSenduiMtmPostcardUid ||
|
|
790 |
aServiceUid == KMmsDirectUpload ||
|
|
791 |
aServiceUid == KMmsIndirectUpload ||
|
|
792 |
aServiceUid == KSenduiMtmAudioMessageUid ||
|
|
793 |
aServiceUid == KSenduiMtmSmsUid ) )
|
|
794 |
{
|
|
795 |
return ETrue;
|
|
796 |
}
|
|
797 |
|
|
798 |
|
|
799 |
const CDesCArray& attachmentPaths = aMessageData->AttachmentArray();
|
|
800 |
const RArray<RFile>& attachments = aMessageData->AttachmentHandleArray();
|
|
801 |
|
|
802 |
TInt attachmentCount = attachmentPaths.Count() + attachments.Count();
|
|
803 |
|
|
804 |
if ( attachmentCount == 0 )
|
|
805 |
{ // No content to send
|
|
806 |
|
|
807 |
if ( aServiceUid == KDrmLinkSender )
|
|
808 |
{
|
|
809 |
return EFalse;
|
|
810 |
}
|
|
811 |
TInt bodyTextLength = aMessageData->BodyText()->DocumentLength();
|
|
812 |
// Dim MMS Upload services, if there is no bodytext
|
|
813 |
if ( ( aServiceUid == KMmsDirectUpload
|
|
814 |
|| aServiceUid == KMmsIndirectUpload )
|
|
815 |
&& bodyTextLength == 0 )
|
|
816 |
{
|
|
817 |
return EFalse; // bodytext will be converted into attachment
|
|
818 |
}
|
|
819 |
// Dim Audio message, if there is bodytext
|
|
820 |
if ( aServiceUid == KSenduiMtmAudioMessageUid
|
|
821 |
&& bodyTextLength > 0 )
|
|
822 |
{
|
|
823 |
return EFalse;
|
|
824 |
}
|
|
825 |
return ETrue;
|
|
826 |
}
|
|
827 |
else if ( attachmentCount == 1 )
|
|
828 |
{
|
|
829 |
TBool result = ETrue;
|
|
830 |
|
|
831 |
switch ( aServiceUid.iUid )
|
|
832 |
{
|
|
833 |
case KSenduiMtmSmsUidValue:
|
|
834 |
{
|
|
835 |
if ( aMimeType->Des8().CompareF( KMsgMimeVCard ) != 0 &&
|
|
836 |
aMimeType->Des8().CompareF( KMsgMimeVCal ) != 0 )
|
|
837 |
{
|
|
838 |
result = EFalse;
|
|
839 |
}
|
|
840 |
break;
|
|
841 |
}
|
|
842 |
case KSenduiMtmPostcardUidValue:
|
|
843 |
{
|
|
844 |
if( aMimeType->Des8().CompareF( KMsgMimeImageJpeg ) != 0 &&
|
|
845 |
aMimeType->Des8().CompareF( KMsgMimeImageGif ) != 0 &&
|
|
846 |
aMimeType->Des8().CompareF( KMsgMimeImagePng ) != 0 &&
|
|
847 |
aMimeType->Des8().CompareF( KMsgMimeTextPlain ) != 0 )
|
|
848 |
{
|
|
849 |
// Supported types: jpeg, png, gif, plain text
|
|
850 |
result = EFalse;
|
|
851 |
}
|
|
852 |
}
|
|
853 |
break;
|
|
854 |
case KSenduiMtmAudioMessageUidValue:
|
|
855 |
{
|
|
856 |
if( aMimeType->Des8().CompareF( KMsgMimeAudioAmr ) != 0 ||
|
|
857 |
aMessageData->BodyText()->DocumentLength() > 0 )
|
|
858 |
{
|
|
859 |
// Does not allow other than amr attachment and empty bodytext
|
|
860 |
result = EFalse;
|
|
861 |
}
|
|
862 |
}
|
|
863 |
break;
|
|
864 |
case KDrmLinkSenderValue:
|
|
865 |
{
|
|
866 |
// Check OMA DRM level
|
|
867 |
|
|
868 |
TInt drmMethod = 0;
|
|
869 |
CDRMHelper::TDRMHelperOMALevel omaDRMLevel;
|
|
870 |
CDRMHelper* drmHelper = NULL;
|
|
871 |
TRAPD( error, drmHelper = CDRMHelper::NewL( iFs ) );
|
|
872 |
if ( error != KErrNone )
|
|
873 |
{
|
|
874 |
return error;
|
|
875 |
}
|
|
876 |
error = drmHelper->SupportedDRMMethods2( drmMethod, omaDRMLevel );
|
|
877 |
if ( !(omaDRMLevel & CDRMHelper::EOMA_2_0 ))
|
|
878 |
{
|
|
879 |
result = EFalse;
|
|
880 |
break;
|
|
881 |
}
|
|
882 |
delete drmHelper;
|
|
883 |
|
|
884 |
|
|
885 |
if ( attachmentPaths.Count() )
|
|
886 |
{
|
|
887 |
RFile handle = SendUiUtils::OpenFileHandleL( attachmentPaths.MdcaPoint(0), iFs );
|
|
888 |
CleanupClosePushL( handle );
|
|
889 |
result = SendUiUtils::HasContentUrlL( handle );
|
|
890 |
CleanupStack::PopAndDestroy( &handle );
|
|
891 |
}
|
|
892 |
else
|
|
893 |
{
|
|
894 |
result = SendUiUtils::HasContentUrlL( const_cast<RFile&>( attachments[0] ) );
|
|
895 |
}
|
|
896 |
}
|
|
897 |
break;
|
|
898 |
default:
|
|
899 |
// Should never end up here
|
|
900 |
break;
|
|
901 |
}
|
|
902 |
|
|
903 |
return result;
|
|
904 |
}
|
|
905 |
else if ( attachmentCount > 1 )
|
|
906 |
{
|
|
907 |
if ( aServiceUid == KDrmLinkSender ||
|
|
908 |
aServiceUid == KSenduiMtmPostcardUid ||
|
|
909 |
aServiceUid == KSenduiMtmAudioMessageUid ||
|
|
910 |
aServiceUid == KSenduiMtmSmsUid )
|
|
911 |
{
|
|
912 |
// Currently supports sending of one file only
|
|
913 |
// or no files (SMS)
|
|
914 |
return EFalse;
|
|
915 |
}
|
|
916 |
return ETrue;
|
|
917 |
}
|
|
918 |
|
|
919 |
// Should never end up here
|
|
920 |
return ETrue;
|
|
921 |
}
|
|
922 |
|
|
923 |
// -----------------------------------------------------------------------------
|
|
924 |
// CSendUiImpl::FilterServicesL
|
|
925 |
//
|
|
926 |
// (other items were commented in a header).
|
|
927 |
// -----------------------------------------------------------------------------
|
|
928 |
//
|
|
929 |
void CSendUiImpl::FilterServicesL(
|
|
930 |
CDesCArrayFlat& aListItems,
|
|
931 |
CArrayFix<TUid>& aListItemUids,
|
|
932 |
TSendingCapabilities aRequiredCapabilities,
|
|
933 |
const CMessageData* aMessageData,
|
|
934 |
CSendUi::TSendUiMenuType aMenuType )
|
|
935 |
{
|
|
936 |
TInt i = 0;
|
|
937 |
TInt cc = 0;
|
|
938 |
TBool dimService = EFalse;
|
|
939 |
TDataType* mimeType = NULL;
|
|
940 |
TInt cleanupItems(0);
|
|
941 |
|
|
942 |
if(iEmailFramework)
|
|
943 |
{
|
|
944 |
if(!IsMailboxAvailableL())
|
|
945 |
iServicesToDim->AppendL(KSenduiMtmSmtpUid);
|
|
946 |
}
|
|
947 |
|
|
948 |
// Filter some services away if there is no content to be send.
|
|
949 |
if ( !aMessageData )
|
|
950 |
{
|
|
951 |
iServicesToDim->AppendL( KDrmLinkSender );
|
|
952 |
iServicesToDim->AppendL( KMmsDirectUpload );
|
|
953 |
iServicesToDim->AppendL( KMmsIndirectUpload );
|
|
954 |
iServicesToDim->AppendL( KShareOnline );
|
|
955 |
}
|
|
956 |
else if ( aMessageData->AttachmentArray().Count() == 1
|
|
957 |
|| aMessageData->AttachmentHandleArray().Count() == 1 )
|
|
958 |
{
|
|
959 |
// CanSendContent can recycle these in mime type resolving
|
|
960 |
// for all services that have attachments
|
|
961 |
mimeType = new (ELeave) TDataType();
|
|
962 |
CleanupStack::PushL( mimeType );
|
|
963 |
cleanupItems++;
|
|
964 |
|
|
965 |
if ( aMessageData->AttachmentArray().Count() )
|
|
966 |
{
|
|
967 |
RFile handle = SendUiUtils::OpenFileHandleL(
|
|
968 |
aMessageData->AttachmentArray().MdcaPoint( 0 ), iFs );
|
|
969 |
CleanupClosePushL( handle );
|
|
970 |
SendUiUtils::ResolveMimeTypeL( handle, *mimeType );
|
|
971 |
CleanupStack::PopAndDestroy( &handle );
|
|
972 |
}
|
|
973 |
else
|
|
974 |
{
|
|
975 |
SendUiUtils::ResolveMimeTypeL( aMessageData->AttachmentHandleArray()[0], *mimeType );
|
|
976 |
}
|
|
977 |
}
|
|
978 |
TBool addMailService = EFalse;
|
|
979 |
TUid integratedEmailClientMtmUid;
|
|
980 |
|
|
981 |
if ( iEmailClientIntegration )
|
|
982 |
{
|
|
983 |
CRepository* repository = NULL;
|
|
984 |
TInt mtmPluginID = 0;
|
|
985 |
TRAPD( ret, repository = CRepository::NewL( KCRUidSelectableDefaultEmailSettings ) );
|
|
986 |
|
|
987 |
if(ret == KErrNone)
|
|
988 |
{
|
|
989 |
//Get Email application mtm plugin ID
|
|
990 |
repository->Get( KIntegratedEmailAppMtmPluginId, mtmPluginID );
|
|
991 |
}
|
|
992 |
|
|
993 |
delete repository;
|
|
994 |
integratedEmailClientMtmUid = TUid::Uid(mtmPluginID);
|
|
995 |
for( i = 0 ; i < iSendingServices.Count(); i++ )
|
|
996 |
{
|
|
997 |
TUid serviceUid = iSendingServices[i]->ServiceId();
|
|
998 |
// Check if it is found in sendingServices and it's valid, then hide
|
|
999 |
if ( integratedEmailClientMtmUid == iSendingServices[i]->ServiceId() &&
|
|
1000 |
CheckServiceCapabilities( serviceUid, aRequiredCapabilities ) &&
|
|
1001 |
CanSendContentL( serviceUid,
|
|
1002 |
iSendingServices[i]->ServiceProviderId(),
|
|
1003 |
aMessageData, mimeType ) )
|
|
1004 |
{
|
|
1005 |
addMailService = ETrue;
|
|
1006 |
}
|
|
1007 |
}
|
|
1008 |
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
// Filter available ECom services and add to list item array.
|
|
1012 |
// Capability based filtering: CheckServiceCapabilities
|
|
1013 |
// Content based filtering: CanSendContentL
|
|
1014 |
// "dimmable array" filtering: done here
|
|
1015 |
TInt serviceFeatures;
|
|
1016 |
for( i = 0 ; i < iSendingServices.Count(); i++ )
|
|
1017 |
{
|
|
1018 |
dimService = EFalse;
|
|
1019 |
TUid serviceUid = iSendingServices[i]->ServiceId();
|
|
1020 |
TUid serviceProviderUid = iSendingServices[i]->ServiceProviderId();
|
|
1021 |
|
|
1022 |
if ( iSendingServices[i]->ServiceMenuName() == KNullDesC )
|
|
1023 |
{
|
|
1024 |
dimService = ETrue;
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
TUid serviceTechnologyType = iSendingServices[i]->TechnologyTypeId();
|
|
1028 |
TUid dimServiceUid;
|
|
1029 |
for ( cc = 0; cc < iServicesToDim->Count(); cc++ )
|
|
1030 |
{
|
|
1031 |
dimServiceUid = (*iServicesToDim)[cc];
|
|
1032 |
if ( dimServiceUid == serviceUid
|
|
1033 |
|| dimServiceUid == serviceProviderUid
|
|
1034 |
|| dimServiceUid == serviceTechnologyType
|
|
1035 |
)
|
|
1036 |
{
|
|
1037 |
dimService = ETrue;
|
|
1038 |
break;
|
|
1039 |
}
|
|
1040 |
}
|
|
1041 |
if ( iEmailClientIntegration )
|
|
1042 |
{
|
|
1043 |
//Hide Email application (not the platform email) from "send" menu
|
|
1044 |
if( integratedEmailClientMtmUid == iSendingServices[i]->ServiceId() )
|
|
1045 |
{
|
|
1046 |
dimService = ETrue;
|
|
1047 |
}
|
|
1048 |
}
|
|
1049 |
serviceFeatures = iSendingServices[i]->ServiceFeatures();
|
|
1050 |
if ( iEmailClientIntegration )
|
|
1051 |
{
|
|
1052 |
//If there is a mailbox created by integrated mail client then
|
|
1053 |
//put SMTP MTM ("Email") in the "send" menu, by changing the
|
|
1054 |
//serviceFeature
|
|
1055 |
if ( addMailService &&
|
|
1056 |
( iSendingServices[i]->ServiceId() == KUidMsgTypeSMTP ) )
|
|
1057 |
{
|
|
1058 |
serviceFeatures = 0;
|
|
1059 |
addMailService = EFalse; //MailService must be added only once
|
|
1060 |
}
|
|
1061 |
}
|
|
1062 |
|
|
1063 |
//Check if the sending service is some third party email provider than hide from the Send menu.
|
|
1064 |
if( iEmailFramework && (iSendingServices[i]->TechnologyTypeId() == KMailTechnologyTypeUid))
|
|
1065 |
{
|
|
1066 |
if(IsThirdPartyMailService(iSendingServices[i]->ServiceId()))
|
|
1067 |
dimService = ETrue;
|
|
1068 |
}
|
|
1069 |
|
|
1070 |
if ( !dimService &&
|
|
1071 |
!( serviceFeatures & CSendingServiceInfo::EServiceInValid ) &&
|
|
1072 |
!( serviceFeatures & CSendingServiceInfo::EServiceHidden )
|
|
1073 |
&& CheckServiceCapabilities( serviceUid, aRequiredCapabilities ) &&
|
|
1074 |
CanSendContentL( serviceUid, serviceProviderUid, aMessageData, mimeType ) )
|
|
1075 |
{
|
|
1076 |
if ( aMenuType == CSendUi::ESendMenu )
|
|
1077 |
{
|
|
1078 |
aListItems.AppendL(iSendingServices[i]->ServiceMenuName() );
|
|
1079 |
}
|
|
1080 |
else if ( aMenuType == CSendUi::EWriteMenu )
|
|
1081 |
{
|
|
1082 |
aListItems.AppendL(iSendingServices[i]->ServiceName() );
|
|
1083 |
}
|
|
1084 |
|
|
1085 |
aListItemUids.AppendL( serviceUid );
|
|
1086 |
}
|
|
1087 |
}
|
|
1088 |
CleanupStack::PopAndDestroy( cleanupItems );
|
|
1089 |
}
|
|
1090 |
|
|
1091 |
// -----------------------------------------------------------------------------
|
|
1092 |
// SortListL
|
|
1093 |
// Sets ECom services to correct positions in "Send"-list query.
|
|
1094 |
// -----------------------------------------------------------------------------
|
|
1095 |
//
|
|
1096 |
void CSendUiImpl::SortListL(
|
|
1097 |
CDesCArrayFlat& aListItems,
|
|
1098 |
CArrayFix<TUid>& aListItemUids )
|
|
1099 |
{
|
|
1100 |
TInt insertIndex(0);
|
|
1101 |
TUid positionUid;
|
|
1102 |
TInt j;
|
|
1103 |
// set the services into correct order. The order is predefined in the resources.
|
|
1104 |
for ( TInt i = 0; i < iSendUiServicesOrderArray->Count() ; i++ )
|
|
1105 |
{
|
|
1106 |
positionUid = TUid::Uid( (*iSendUiServicesOrderArray)[i] );
|
|
1107 |
for (j = insertIndex; j < aListItems.Count(); j++ )
|
|
1108 |
{
|
|
1109 |
TUid tmp = aListItemUids[j];
|
|
1110 |
if ( positionUid == aListItemUids[j] )
|
|
1111 |
{
|
|
1112 |
if ( j >= insertIndex )
|
|
1113 |
{
|
|
1114 |
HBufC* serviceName = aListItems[j].AllocL();
|
|
1115 |
CleanupStack::PushL( serviceName );
|
|
1116 |
|
|
1117 |
aListItemUids.Delete( j );
|
|
1118 |
aListItems.Delete( j );
|
|
1119 |
|
|
1120 |
aListItemUids.InsertL( insertIndex, positionUid );
|
|
1121 |
aListItems.InsertL( insertIndex, *serviceName );
|
|
1122 |
CleanupStack::PopAndDestroy( serviceName );
|
|
1123 |
insertIndex++;
|
|
1124 |
}
|
|
1125 |
else
|
|
1126 |
{
|
|
1127 |
// service already on the right place. Next.
|
|
1128 |
insertIndex++;
|
|
1129 |
}
|
|
1130 |
|
|
1131 |
}
|
|
1132 |
}
|
|
1133 |
}
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
|
|
1137 |
// ---------------------------------------------------------
|
|
1138 |
// ResetIsSending
|
|
1139 |
// Resets sending state flag.
|
|
1140 |
// ---------------------------------------------------------
|
|
1141 |
//
|
|
1142 |
void CSendUiImpl::ResetIsSending( TAny* aAny )
|
|
1143 |
{
|
|
1144 |
*( (TBool*)aAny ) = EFalse;
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
// -----------------------------------------------------------------------------
|
|
1148 |
// CheckServiceCapabilities
|
|
1149 |
// Compares ECom service sending capabilities to required capabilities.
|
|
1150 |
// (other items were commented in a header).
|
|
1151 |
// -----------------------------------------------------------------------------
|
|
1152 |
//
|
|
1153 |
TBool CSendUiImpl::CheckServiceCapabilities(
|
|
1154 |
TUid aServiceUid,
|
|
1155 |
TSendingCapabilities aRequiredCapabilities )
|
|
1156 |
{
|
|
1157 |
TInt i = 0;
|
|
1158 |
TSendingCapabilities serviceCapabilities;
|
|
1159 |
|
|
1160 |
// No capabilities defined, uses content-based filtering
|
|
1161 |
// or no capabilities required from service
|
|
1162 |
if ( aServiceUid == KDrmLinkSender
|
|
1163 |
|| aRequiredCapabilities.iFlags == TSendingCapabilities::EAllServices )
|
|
1164 |
{
|
|
1165 |
return ETrue;
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
i = ResolveServiceIndex( aServiceUid );
|
|
1169 |
|
|
1170 |
if ( i != KErrNotFound )
|
|
1171 |
{
|
|
1172 |
return QueryCapabilities( i, aRequiredCapabilities );
|
|
1173 |
}
|
|
1174 |
else
|
|
1175 |
{
|
|
1176 |
return EFalse;
|
|
1177 |
}
|
|
1178 |
}
|
|
1179 |
|
|
1180 |
// -----------------------------------------------------------------------------
|
|
1181 |
// CSendUiImpl
|
|
1182 |
// C++ default constructor can NOT contain any code, that
|
|
1183 |
// might leave.
|
|
1184 |
// -----------------------------------------------------------------------------
|
|
1185 |
//
|
|
1186 |
CSendUiImpl::CSendUiImpl()
|
|
1187 |
: iCoeEnv( CCoeEnv::Static() ),
|
|
1188 |
iFs( iCoeEnv->FsSession() ),
|
|
1189 |
iResourceLoader( *iCoeEnv ),
|
|
1190 |
iEmailFramework(EFalse)
|
|
1191 |
|
|
1192 |
{
|
|
1193 |
}
|
|
1194 |
|
|
1195 |
// -----------------------------------------------------------------------------
|
|
1196 |
// CSendUiImpl::FeatureStatus
|
|
1197 |
// -----------------------------------------------------------------------------
|
|
1198 |
//
|
|
1199 |
void CSendUiImpl::FeatureStatus( TInt aFeature, TInt &aNewFeatures, TInt aFeatureFlag )
|
|
1200 |
{
|
|
1201 |
if ( FeatureManager::FeatureSupported( aFeature ) )
|
|
1202 |
{
|
|
1203 |
// If Postcard only is supported, aFeatureFlag is 0x00000001 ==> aNewFeatures == 0x00000001
|
|
1204 |
// If Audio message is also supported aFeatureFlag is 0x00000002 ==> aNewFeatures == 0x00000003
|
|
1205 |
// If MMSUpload is also supported, aFeatureFlag is 0x00000004 ==> aNewFeatures == 0x00000007
|
|
1206 |
aNewFeatures |= aFeatureFlag;
|
|
1207 |
}
|
|
1208 |
}
|
|
1209 |
// ConstructL
|
|
1210 |
// Symbian 2nd phase constructor can leave.
|
|
1211 |
// -----------------------------------------------------------------------------
|
|
1212 |
//
|
|
1213 |
void CSendUiImpl::ConstructL()
|
|
1214 |
{
|
|
1215 |
iSingleton = CSendUiSingleton::NewL();
|
|
1216 |
//User::LeaveIfError( iFs.Connect() );
|
|
1217 |
iFs.ShareProtected();
|
|
1218 |
|
|
1219 |
TParse* fp = new(ELeave) TParse();
|
|
1220 |
fp->Set( KSendUiResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
|
|
1221 |
iResourceFileName = fp->FullName();
|
|
1222 |
delete fp;
|
|
1223 |
fp = NULL;
|
|
1224 |
|
|
1225 |
iResourceLoader.OpenL( iResourceFileName );
|
|
1226 |
|
|
1227 |
// Check for server launch
|
|
1228 |
RProcess process;
|
|
1229 |
TUid hostId = process.SecureId();
|
|
1230 |
if ( hostId == KSendUiLauncherAppUid )
|
|
1231 |
{
|
|
1232 |
iServerAppLaunch = ETrue;
|
|
1233 |
}
|
|
1234 |
else
|
|
1235 |
{
|
|
1236 |
iServerAppLaunch = EFalse;
|
|
1237 |
iSendUiServicesOrderArray =
|
|
1238 |
new ( ELeave ) CArrayFixFlat<TInt32>( KSendUiServiceOrderArrayGranularity );
|
|
1239 |
|
|
1240 |
TResourceReader reader;
|
|
1241 |
iCoeEnv->CreateResourceReaderLC( reader, R_SENDUISERVICEORDER_ARRAY );
|
|
1242 |
const TInt count = reader.ReadInt16();
|
|
1243 |
for ( TInt loop = 0; loop < count; loop++ )
|
|
1244 |
{
|
|
1245 |
iSendUiServicesOrderArray->AppendL( reader.ReadInt32() );
|
|
1246 |
}
|
|
1247 |
CleanupStack::PopAndDestroy( ); // reader
|
|
1248 |
}
|
|
1249 |
|
|
1250 |
iPropertyObserver = CPropertyObserver::NewL( this );
|
|
1251 |
TRAPD( err, GetServicesL() );
|
|
1252 |
|
|
1253 |
if ( err )
|
|
1254 |
{
|
|
1255 |
#ifdef _DEBUG
|
|
1256 |
TBuf<256> buf;
|
|
1257 |
buf.Format(_L("SendUi err"));
|
|
1258 |
User::InfoPrint(buf);
|
|
1259 |
LOGTEXT2(_L("Error %d while loading CenRep"), err );
|
|
1260 |
#endif
|
|
1261 |
return;
|
|
1262 |
}
|
|
1263 |
iServicesToDim = new (ELeave) CArrayFixFlat<TUid>( KArrayGranularity );
|
|
1264 |
FeatureManager::InitializeLibL();
|
|
1265 |
|
|
1266 |
if ( FeatureManager::FeatureSupported( KFeatureIdEmailMceIntegration ) )
|
|
1267 |
{
|
|
1268 |
|
|
1269 |
iEmailClientIntegration = ETrue;
|
|
1270 |
}
|
|
1271 |
else
|
|
1272 |
{
|
|
1273 |
|
|
1274 |
iEmailClientIntegration = EFalse;
|
|
1275 |
}
|
|
1276 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) )
|
|
1277 |
{
|
|
1278 |
iEmailFramework = ETrue;
|
|
1279 |
}
|
|
1280 |
FeatureManager::UnInitializeLib();
|
|
1281 |
}
|
|
1282 |
// -----------------------------------------------------------------------------
|
|
1283 |
// CSendUiImpl::IsMailboxAvailableL
|
|
1284 |
// -----------------------------------------------------------------------------
|
|
1285 |
//
|
|
1286 |
TBool CSendUiImpl::IsMailboxAvailableL(void)
|
|
1287 |
{
|
|
1288 |
TBool mailbox = EFalse;
|
|
1289 |
|
|
1290 |
CMsvSession& msv = iSingleton->MsvSessionL();
|
|
1291 |
CMsvEntry* entry = msv.GetEntryL( KMsvRootIndexEntryId );
|
|
1292 |
CleanupStack::PushL( entry );
|
|
1293 |
|
|
1294 |
entry->SetSortTypeL( TMsvSelectionOrdering(
|
|
1295 |
KMsvGroupByType | KMsvGroupByStandardFolders,
|
|
1296 |
EMsvSortByDetailsReverse, ETrue ) );
|
|
1297 |
|
|
1298 |
// Add others
|
|
1299 |
for ( TInt cc = entry->Count(); --cc >= 0; )
|
|
1300 |
{
|
|
1301 |
TMsvEntry tentry2 = (*entry)[cc];
|
|
1302 |
|
|
1303 |
if ( tentry2.iType.iUid == KUidMsvServiceEntryValue &&
|
|
1304 |
tentry2.Id() != KMsvLocalServiceIndexEntryIdValue )
|
|
1305 |
{
|
|
1306 |
if ( IsEmailAppendableL(tentry2) )
|
|
1307 |
{
|
|
1308 |
mailbox = ETrue;
|
|
1309 |
break;
|
|
1310 |
}
|
|
1311 |
}
|
|
1312 |
}
|
|
1313 |
|
|
1314 |
CleanupStack::PopAndDestroy( entry );
|
|
1315 |
|
|
1316 |
return mailbox;
|
|
1317 |
}
|
|
1318 |
|
|
1319 |
// -----------------------------------------------------------------------------
|
|
1320 |
// IsThirdPartyMailService
|
|
1321 |
// Check if any Third Party Email Serivce is present or not
|
|
1322 |
// -----------------------------------------------------------------------------
|
|
1323 |
//
|
|
1324 |
|
|
1325 |
TBool CSendUiImpl::IsThirdPartyMailService( TUid aUid )
|
|
1326 |
{
|
|
1327 |
//If the Uid is other than SMTP and Cmail
|
|
1328 |
//than is a Third Party service
|
|
1329 |
if((aUid != KUidMsgTypeSMTP)&&
|
|
1330 |
( aUid.iUid != KUidMsgTypeFsMtmVal ) )
|
|
1331 |
{
|
|
1332 |
return ETrue;
|
|
1333 |
}
|
|
1334 |
else
|
|
1335 |
return EFalse;
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
// -----------------------------------------------------------------------------
|
|
1339 |
// IsEmailAppendableL
|
|
1340 |
// Check if Email entry is valid to be counted
|
|
1341 |
// -----------------------------------------------------------------------------
|
|
1342 |
//
|
|
1343 |
|
|
1344 |
TBool CSendUiImpl::IsEmailAppendableL(TMsvEntry atentry)
|
|
1345 |
{
|
|
1346 |
TBool appendEmail = EFalse;
|
|
1347 |
|
|
1348 |
if ( atentry.Visible() )
|
|
1349 |
{
|
|
1350 |
appendEmail = ETrue;
|
|
1351 |
}
|
|
1352 |
else
|
|
1353 |
{
|
|
1354 |
if ( iSingleton->MtmUiDataRegistryL().IsPresent( atentry.iMtm ) &&
|
|
1355 |
iSingleton->MtmUiDataRegistryL().IsPresent( KUidMsgTypePOP3 ) )
|
|
1356 |
{
|
|
1357 |
TUid mailMTMTechType =
|
|
1358 |
iSingleton->MtmUiDataRegistryL().TechnologyTypeUid( KUidMsgTypePOP3 );
|
|
1359 |
if( iSingleton->MtmUiDataRegistryL().TechnologyTypeUid( atentry.iMtm ) ==
|
|
1360 |
mailMTMTechType )
|
|
1361 |
{
|
|
1362 |
appendEmail = ETrue;
|
|
1363 |
}
|
|
1364 |
}
|
|
1365 |
}
|
|
1366 |
return appendEmail;
|
|
1367 |
}
|
|
1368 |
// end of file
|
|
1369 |
|