27
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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 |
* Provides Notification MTM UI methods.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
|
|
23 |
//Features
|
|
24 |
#include <featmgr.h>
|
|
25 |
#include <bldvariant.hrh>
|
|
26 |
#include <MuiuMsvProgressReporterOperation.h> // CMsvProgressReporterOperation
|
|
27 |
#include <mtudreg.h> // MTM UI data registry
|
|
28 |
#include <mtudcbas.h> // MTM UI data base
|
|
29 |
|
|
30 |
#include "NotMtmUi.h"
|
|
31 |
|
|
32 |
#include <apgcli.h>
|
|
33 |
#include <msvuids.h>
|
|
34 |
#include <mtmuidef.hrh>
|
|
35 |
|
|
36 |
#include <e32keys.h>
|
|
37 |
#include <coemain.h>
|
|
38 |
#include <eikenv.h>
|
|
39 |
#include <eikdef.h>
|
|
40 |
#include <eikmfne.h>
|
|
41 |
#include <eikedwin.h>
|
|
42 |
#include <eikcapc.h>
|
|
43 |
#include <gulicon.h>
|
|
44 |
#include <ErrorUI.h> //CErrorUI
|
|
45 |
|
|
46 |
#include <aknnotewrappers.h> // CAknInformationNote
|
|
47 |
#include <aknPopup.h>
|
|
48 |
#include <aknlists.h>
|
|
49 |
#include <aknconsts.h>
|
|
50 |
#include <akncontext.h>
|
|
51 |
#include <akntabgrp.h>
|
|
52 |
#include <AknQueryDialog.h>
|
|
53 |
#include <StringLoader.h> // link against CommonEngine.lib
|
|
54 |
#include <Muiumsginfo.h>
|
|
55 |
#include <MuiuMsvUiServiceUtilities.h>
|
|
56 |
#include <muiumsvuiserviceutilitiesinternal.h>
|
|
57 |
|
|
58 |
#include <akninputblock.h> // CAknInputBlock
|
|
59 |
#include <MtmExtendedCapabilities.hrh>
|
|
60 |
#include <messagingvariant.hrh>
|
|
61 |
|
|
62 |
#include <centralrepository.h> // link against centralrepository.lib
|
|
63 |
#include <messaginginternalcrkeys.h> // for Central Repository keys
|
|
64 |
#include <CoreApplicationUIsSDKCRKeys.h>
|
|
65 |
|
|
66 |
#include <ApUtils.h> //CApUtils, CCommsDatabase, EDatabaseTypeIAP
|
|
67 |
|
|
68 |
#include <NotUi.rsg>
|
|
69 |
#include <mmserrors.h>
|
|
70 |
|
|
71 |
#include "NotMtmUiPanic.h"
|
|
72 |
#include <mmsconst.h>
|
|
73 |
#include <mmscmds.h> // EMmsDeleteSchedule
|
|
74 |
|
|
75 |
#include <mmsmsventry.h>
|
|
76 |
#include <mmsnotificationclient.h>
|
|
77 |
#include <mmsgenutils.h>
|
|
78 |
#include <mmssettings.h> // MMS Engine settings
|
|
79 |
|
|
80 |
#include "MmsMtmConst.h"
|
|
81 |
#include "MMBoxDialog.h"
|
|
82 |
#include "NotMtmUiData.h"
|
|
83 |
|
|
84 |
// CONSTANTS
|
|
85 |
|
|
86 |
_LIT( KAddressSeparator,", " );
|
|
87 |
_LIT( KCharLeftAddressIterator, "<" );
|
|
88 |
_LIT( KCharRightAddressIterator, ">" );
|
|
89 |
_LIT( KMmsCharCommaAndSpace, ", " );
|
|
90 |
_LIT( KMmsCharSpace, " " );
|
|
91 |
|
|
92 |
const TInt KMessageSize = 20;
|
|
93 |
const TInt KZero = 0; //constant for memory check
|
|
94 |
const TInt KMmsAdditionalCharsStringLength = 7;
|
|
95 |
const TUint KMmsLRMarker = 0x200E;
|
|
96 |
const TUid KUidUniEditor = {0x102072D8};
|
|
97 |
|
|
98 |
#define IS_PHONE_OFF_LINEL() MsvUiServiceUtilitiesInternal::IsPhoneOfflineL()
|
|
99 |
|
|
100 |
// MACROS
|
|
101 |
#define iMmsClient ( static_cast<CMmsNotificationClientMtm&>( iBaseMtm ) )
|
|
102 |
|
|
103 |
// LOCAL CONSTANTS AND MACROS
|
|
104 |
|
|
105 |
// MODULE DATA STRUCTURES
|
|
106 |
|
|
107 |
// LOCAL FUNCTION PROTOTYPES
|
|
108 |
|
|
109 |
// ==================== LOCAL FUNCTIONS ====================
|
|
110 |
|
|
111 |
// ---------------------------------------------------------
|
|
112 |
// NewNotMtmUiL
|
|
113 |
// Factory function
|
|
114 |
// ---------------------------------------------------------
|
|
115 |
//
|
|
116 |
EXPORT_C CBaseMtmUi* NewNotMtmUiL( CBaseMtm& aMtm, CRegisteredMtmDll& aRegisteredDll )
|
|
117 |
{
|
|
118 |
return CNotMtmUi::NewL( aMtm, aRegisteredDll );
|
|
119 |
}
|
|
120 |
|
|
121 |
|
|
122 |
// ================= MEMBER FUNCTIONS =======================
|
|
123 |
|
|
124 |
// ---------------------------------------------------------
|
|
125 |
// CNotMtmUi::CNotMtmUi
|
|
126 |
// C++ default constructor can NOT contain any code, that
|
|
127 |
// might leave.
|
|
128 |
// ---------------------------------------------------------
|
|
129 |
//
|
|
130 |
CNotMtmUi::CNotMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll )
|
|
131 |
: CBaseMtmUi( aBaseMtm, aRegisteredMtmDll )
|
|
132 |
{
|
|
133 |
}
|
|
134 |
|
|
135 |
// ---------------------------------------------------------
|
|
136 |
// CNotMtmUi::ConstructL
|
|
137 |
// Symbian OS default constructor can leave.
|
|
138 |
// ---------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CNotMtmUi::ConstructL()
|
|
141 |
{
|
|
142 |
LOGTEXT(_L8("NotMtmUi: Construct start"));
|
|
143 |
CBaseMtmUi::ConstructL();
|
|
144 |
iSettingsHandler = CMmsSettingsHandler::NewL( iMmsClient );
|
|
145 |
|
|
146 |
TInt featureBitmask = 0;
|
|
147 |
|
|
148 |
CRepository* repository = CRepository::NewL( KCRUidMuiuVariation );
|
|
149 |
repository->Get( KMuiuMmsFeatures, featureBitmask );
|
|
150 |
delete repository;
|
|
151 |
repository = NULL;
|
|
152 |
|
|
153 |
if ( featureBitmask & KMmsFeatureIdDeleteOptions )
|
|
154 |
{
|
|
155 |
iNotUiFlags |= EDeleteOptionsSupported;
|
|
156 |
}
|
|
157 |
featureBitmask = 0;
|
|
158 |
|
|
159 |
FeatureManager::InitializeLibL();
|
|
160 |
if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
|
|
161 |
{
|
|
162 |
iNotUiFlags |= EOffline;
|
|
163 |
}
|
|
164 |
FeatureManager::UnInitializeLib();
|
|
165 |
LOGTEXT(_L8("NotMtmUi: Construct end"));
|
|
166 |
}
|
|
167 |
|
|
168 |
// ---------------------------------------------------------
|
|
169 |
// CNotMtmUi::NewL
|
|
170 |
// Two-phased constructor.
|
|
171 |
// ---------------------------------------------------------
|
|
172 |
//
|
|
173 |
CNotMtmUi* CNotMtmUi::NewL( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll )
|
|
174 |
{
|
|
175 |
LOGTEXT( _L8( "NotMtmUi::NewL" ) );
|
|
176 |
CNotMtmUi* self = new ( ELeave ) CNotMtmUi( aBaseMtm, aRegisteredMtmDll );
|
|
177 |
|
|
178 |
CleanupStack::PushL( self );
|
|
179 |
self->ConstructL();
|
|
180 |
CleanupStack::Pop();
|
|
181 |
|
|
182 |
return self;
|
|
183 |
}
|
|
184 |
|
|
185 |
|
|
186 |
// ---------------------------------------------------------
|
|
187 |
// CNotMtmUi::~CNotMtmUi
|
|
188 |
// Destructor
|
|
189 |
// ---------------------------------------------------------
|
|
190 |
//
|
|
191 |
CNotMtmUi::~CNotMtmUi()
|
|
192 |
{
|
|
193 |
delete iSettingsHandler;
|
|
194 |
delete iWaitDialog;
|
|
195 |
}
|
|
196 |
|
|
197 |
|
|
198 |
// ---------------------------------------------------------
|
|
199 |
// CNotMtmUi::QueryCapability
|
|
200 |
// Capability check for UI mtm specific functionality. These should
|
|
201 |
// be minimal, as the default capability checking places are UI data MTM
|
|
202 |
// (UI) and client MTM (engine).
|
|
203 |
// ---------------------------------------------------------
|
|
204 |
TInt CNotMtmUi::QueryCapability( TUid aCapability, TInt& aResponse )
|
|
205 |
{
|
|
206 |
switch ( aCapability.iUid )
|
|
207 |
{
|
|
208 |
case KUidMsvMtmUiQueryMessagingInitialisation: // flow through
|
|
209 |
case KUidMsvMtmQueryFactorySettings:
|
|
210 |
case KUidMsvMtmQuerySupportValidateService:
|
|
211 |
|
|
212 |
aResponse = ETrue;
|
|
213 |
return KErrNone;
|
|
214 |
default:
|
|
215 |
// Actually this routes to client MTM capability check.
|
|
216 |
return CBaseMtmUi::QueryCapability( aCapability, aResponse );
|
|
217 |
}
|
|
218 |
}
|
|
219 |
|
|
220 |
// ---------------------------------------------------------
|
|
221 |
// CNotMtmUi::CreateL
|
|
222 |
// Not supported.
|
|
223 |
// ---------------------------------------------------------
|
|
224 |
//
|
|
225 |
CMsvOperation* CNotMtmUi::CreateL( const TMsvEntry& /*aEntry*/,
|
|
226 |
CMsvEntry& /*aParent*/,
|
|
227 |
TRequestStatus& /*aStatus*/ )
|
|
228 |
{
|
|
229 |
User::Leave( KErrNotSupported );
|
|
230 |
return NULL;
|
|
231 |
}
|
|
232 |
|
|
233 |
// ---------------------------------------------------------
|
|
234 |
// CNotMtmUi::CheckSettingsL() const
|
|
235 |
// Check MMS service settings
|
|
236 |
// ---------------------------------------------------------
|
|
237 |
//
|
|
238 |
EXPORT_C TBool CNotMtmUi::CheckSettingsL( CMmsSettingsDialog::TMmsExitCode& aExitCode ) const
|
|
239 |
{
|
|
240 |
// First reload the settings
|
|
241 |
iSettingsHandler->RefreshSettingsL( );
|
|
242 |
return iSettingsHandler->CheckSettingsL( aExitCode );
|
|
243 |
}
|
|
244 |
|
|
245 |
// ---------------------------------------------------------
|
|
246 |
// CNotMtmUi::DeleteServiceL
|
|
247 |
// ---------------------------------------------------------
|
|
248 |
//
|
|
249 |
CMsvOperation* CNotMtmUi::DeleteServiceL( const TMsvEntry& /*aService*/,
|
|
250 |
TRequestStatus& /*aStatus*/ )
|
|
251 |
{
|
|
252 |
User::Leave( KErrNotSupported );
|
|
253 |
return NULL;
|
|
254 |
}
|
|
255 |
|
|
256 |
// ---------------------------------------------------------
|
|
257 |
// CNotMtmUi::DeleteFromL
|
|
258 |
// ---------------------------------------------------------
|
|
259 |
//
|
|
260 |
CMsvOperation* CNotMtmUi::DeleteFromL( const CMsvEntrySelection& /*aSelection*/,
|
|
261 |
TRequestStatus& /*aStatus*/ )
|
|
262 |
{
|
|
263 |
User::Leave( KErrNotSupported );
|
|
264 |
return NULL;
|
|
265 |
}
|
|
266 |
|
|
267 |
// ---------------------------------------------------------
|
|
268 |
// CMmsMtmUi::CopyToL
|
|
269 |
// Copy local outbox entry to remote server = called when sending the entry from MCE outbox
|
|
270 |
// ---------------------------------------------------------
|
|
271 |
//
|
|
272 |
CMsvOperation* CNotMtmUi::CopyToL( const CMsvEntrySelection& aSelection,
|
|
273 |
TRequestStatus& aStatus )
|
|
274 |
{
|
|
275 |
return CopyMoveToL( aSelection, aStatus, ETrue );
|
|
276 |
}
|
|
277 |
|
|
278 |
// ---------------------------------------------------------
|
|
279 |
// CNotMtmUi::MoveToL
|
|
280 |
// Move local outbox entry to remote server.
|
|
281 |
// ---------------------------------------------------------
|
|
282 |
//
|
|
283 |
CMsvOperation* CNotMtmUi::MoveToL( const CMsvEntrySelection& aSelection,
|
|
284 |
TRequestStatus& aStatus )
|
|
285 |
{
|
|
286 |
return CopyMoveToL( aSelection, aStatus, EFalse );
|
|
287 |
}
|
|
288 |
|
|
289 |
// ---------------------------------------------------------
|
|
290 |
// CNotMtmUi::CopyMoveToL
|
|
291 |
// Performs either CopyToL or MoveToL operation.
|
|
292 |
// ---------------------------------------------------------
|
|
293 |
//
|
|
294 |
CMsvOperation* CNotMtmUi::CopyMoveToL( const CMsvEntrySelection& aSelection,
|
|
295 |
TRequestStatus& aStatus, TBool aCopyOnly )
|
|
296 |
{
|
|
297 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) );
|
|
298 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iType==KUidMsvServiceEntry, Panic( EMmsNotAService ) );
|
|
299 |
|
|
300 |
// --- Carry out the operation ---
|
|
301 |
TMsvEntry mmsService ( BaseMtm().Entry().Entry() );
|
|
302 |
// Get CMsvEntry of parent of messages to be sent
|
|
303 |
CMsvEntry* parentEntry = Session().GetEntryL( aSelection[0] );
|
|
304 |
|
|
305 |
CleanupStack::PushL( parentEntry );
|
|
306 |
parentEntry->SetEntryL( parentEntry->Entry().Parent() );
|
|
307 |
|
|
308 |
// Do the copy/move
|
|
309 |
CMsvOperation* op = aCopyOnly ?
|
|
310 |
parentEntry->CopyL( aSelection, mmsService.Id(), aStatus ) :
|
|
311 |
parentEntry->MoveL( aSelection, mmsService.Id(), aStatus );
|
|
312 |
|
|
313 |
CleanupStack::PopAndDestroy(); //parentEntry
|
|
314 |
return op;
|
|
315 |
}
|
|
316 |
|
|
317 |
// ---------------------------------------------------------
|
|
318 |
// CNotMtmUi::CopyFromL
|
|
319 |
// Could be used in fetching messages manually, but client MTM API has simple FetchL()
|
|
320 |
// ---------------------------------------------------------
|
|
321 |
//
|
|
322 |
CMsvOperation* CNotMtmUi::CopyFromL(const CMsvEntrySelection& /*aSelection*/,
|
|
323 |
TMsvId /*aTargetId*/,
|
|
324 |
TRequestStatus& /*aStatus*/)
|
|
325 |
{
|
|
326 |
User::Leave( KErrNotSupported );
|
|
327 |
return NULL;
|
|
328 |
}
|
|
329 |
|
|
330 |
// ---------------------------------------------------------
|
|
331 |
// CNotMtmUi::MoveFromL
|
|
332 |
// Could be used in fetching messages manually, but client MTM API has simple FetchL()
|
|
333 |
// ---------------------------------------------------------
|
|
334 |
//
|
|
335 |
CMsvOperation* CNotMtmUi::MoveFromL(const CMsvEntrySelection& /*aSelection*/,
|
|
336 |
TMsvId /*aTargetId*/,
|
|
337 |
TRequestStatus& /*aStatus*/)
|
|
338 |
{
|
|
339 |
User::Leave( KErrNotSupported );
|
|
340 |
return NULL;
|
|
341 |
}
|
|
342 |
|
|
343 |
// ---------------------------------------------------------
|
|
344 |
// CNotMtmUi::OpenL
|
|
345 |
// Handles request to open existing message server entry (message/service)
|
|
346 |
// ---------------------------------------------------------
|
|
347 |
//
|
|
348 |
CMsvOperation* CNotMtmUi::OpenL( TRequestStatus& aStatus )
|
|
349 |
{
|
|
350 |
LOGTEXT(_L8("NotMtmUi: OpenL start"));
|
|
351 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) );
|
|
352 |
|
|
353 |
const TMsvEntry& entry = BaseMtm().Entry().Entry();
|
|
354 |
if ( entry.ReadOnly() )
|
|
355 |
{
|
|
356 |
return ViewL( aStatus );
|
|
357 |
}
|
|
358 |
else
|
|
359 |
{
|
|
360 |
return EditL( aStatus );
|
|
361 |
}
|
|
362 |
}
|
|
363 |
|
|
364 |
// ---------------------------------------------------------
|
|
365 |
// CNotMtmUi::OpenL
|
|
366 |
// Opens the first entry in a selection
|
|
367 |
// ---------------------------------------------------------
|
|
368 |
//
|
|
369 |
CMsvOperation* CNotMtmUi::OpenL( TRequestStatus& aStatus,
|
|
370 |
const CMsvEntrySelection& aSelection )
|
|
371 |
{
|
|
372 |
LOGTEXT(_L8("NotMtmUi: OpenL start"));
|
|
373 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) );
|
|
374 |
|
|
375 |
BaseMtm().SwitchCurrentEntryL( aSelection[0] );
|
|
376 |
return OpenL( aStatus );
|
|
377 |
}
|
|
378 |
|
|
379 |
// ---------------------------------------------------------
|
|
380 |
// CNotMtmUi::CloseL
|
|
381 |
// ---------------------------------------------------------
|
|
382 |
//
|
|
383 |
CMsvOperation* CNotMtmUi::CloseL( TRequestStatus& /*aStatus*/ )
|
|
384 |
{
|
|
385 |
User::Leave( KErrNotSupported );
|
|
386 |
return NULL;
|
|
387 |
}
|
|
388 |
|
|
389 |
// ---------------------------------------------------------
|
|
390 |
// CNotMtmUi::CloseL
|
|
391 |
// ---------------------------------------------------------
|
|
392 |
//
|
|
393 |
CMsvOperation* CNotMtmUi::CloseL( TRequestStatus& /*aStatus*/,
|
|
394 |
const CMsvEntrySelection& /*aSelection*/ )
|
|
395 |
{
|
|
396 |
User::Leave( KErrNotSupported );
|
|
397 |
return NULL;
|
|
398 |
}
|
|
399 |
|
|
400 |
// ---------------------------------------------------------
|
|
401 |
// CNotMtmUi::EditL
|
|
402 |
// Opens a message (editor) or service (settings dialog) for editing.
|
|
403 |
// ---------------------------------------------------------
|
|
404 |
//
|
|
405 |
CMsvOperation* CNotMtmUi::EditL( TRequestStatus& aStatus )
|
|
406 |
{
|
|
407 |
LOGTEXT(_L8("NotMtmUi::EditL start"));
|
|
408 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) );
|
|
409 |
|
|
410 |
CMsvOperation* msvoperation = NULL;
|
|
411 |
|
|
412 |
switch ( iBaseMtm.Entry().Entry().iType.iUid )
|
|
413 |
{
|
|
414 |
case KUidMsvMessageEntryValue:
|
|
415 |
{
|
|
416 |
CMmsSettingsDialog::TMmsExitCode exitCode =
|
|
417 |
CMmsSettingsDialog::EMmsExternalInterrupt;
|
|
418 |
|
|
419 |
if( MsvUiServiceUtilities::DiskSpaceBelowCriticalLevelL(
|
|
420 |
Session(),
|
|
421 |
KZero ) )
|
|
422 |
{
|
|
423 |
User::Leave( KErrDiskFull );
|
|
424 |
}
|
|
425 |
|
|
426 |
if ( !CheckSettingsL( exitCode ) )
|
|
427 |
{
|
|
428 |
TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 );
|
|
429 |
//settings saved with valid access point
|
|
430 |
if( !( exitCode==CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) ) )
|
|
431 |
{
|
|
432 |
return CompleteSettingsOperationL( aStatus, exitCode );
|
|
433 |
}
|
|
434 |
}
|
|
435 |
|
|
436 |
if ( iBaseMtm.Entry().Entry().Connected() )
|
|
437 |
{
|
|
438 |
User::Leave( KErrLocked );
|
|
439 |
}
|
|
440 |
LOGTEXT( _L8( "NotMtmUi::EditL launching editor" ) );
|
|
441 |
msvoperation = LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() );
|
|
442 |
}
|
|
443 |
break;
|
|
444 |
|
|
445 |
case KUidMsvServiceEntryValue:
|
|
446 |
LOGTEXT( _L8( "NotMtmUi::EditL - launching settings" ) );
|
|
447 |
msvoperation = OpenServiceSettingsDialogL( aStatus );
|
|
448 |
break;
|
|
449 |
|
|
450 |
case KUidMsvAttachmentEntryValue: // flow through
|
|
451 |
case KUidMsvFolderEntryValue: // flow through
|
|
452 |
default:
|
|
453 |
User::Leave( KErrNotSupported );
|
|
454 |
break;
|
|
455 |
}
|
|
456 |
|
|
457 |
return msvoperation;
|
|
458 |
}
|
|
459 |
|
|
460 |
// ---------------------------------------------------------
|
|
461 |
// CNotMtmUi::EditL
|
|
462 |
// ---------------------------------------------------------
|
|
463 |
//
|
|
464 |
CMsvOperation* CNotMtmUi::EditL( TRequestStatus& aStatus,
|
|
465 |
const CMsvEntrySelection& aSelection )
|
|
466 |
{
|
|
467 |
BaseMtm().SwitchCurrentEntryL( aSelection[0] );
|
|
468 |
return EditL( aStatus );
|
|
469 |
}
|
|
470 |
|
|
471 |
// ---------------------------------------------------------
|
|
472 |
// CNotMtmUi::ViewL
|
|
473 |
// Opens the message for reading in Viewer.
|
|
474 |
// ---------------------------------------------------------
|
|
475 |
//
|
|
476 |
CMsvOperation* CNotMtmUi::ViewL( TRequestStatus& aStatus )
|
|
477 |
{
|
|
478 |
LOGTEXT( _L8( "NotMtmUi::ViewL" ) );
|
|
479 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm == Type(), Panic( EMmsWrongMtm ) );
|
|
480 |
|
|
481 |
CMsvOperation* msvoperation = NULL;
|
|
482 |
|
|
483 |
switch ( iBaseMtm.Entry().Entry().iType.iUid )
|
|
484 |
{
|
|
485 |
case KUidMsvMessageEntryValue:
|
|
486 |
// It's a multimedia message
|
|
487 |
if ( iBaseMtm.Entry().Entry().Connected() )
|
|
488 |
{
|
|
489 |
User::Leave( KErrLocked );
|
|
490 |
}
|
|
491 |
// Open Viewer
|
|
492 |
LOGTEXT( _L8( "NotMtmUi::ViewL - launching Viewer" ) );
|
|
493 |
msvoperation = LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session(), EReadOnly );
|
|
494 |
break;
|
|
495 |
case KUidMsvServiceEntryValue:
|
|
496 |
case KUidMsvAttachmentEntryValue:
|
|
497 |
case KUidMsvFolderEntryValue:
|
|
498 |
default:
|
|
499 |
User::Leave( KErrNotSupported );
|
|
500 |
break;
|
|
501 |
}
|
|
502 |
return msvoperation;
|
|
503 |
}
|
|
504 |
|
|
505 |
// ---------------------------------------------------------
|
|
506 |
// CNotMtmUi::ViewL
|
|
507 |
// ---------------------------------------------------------
|
|
508 |
//
|
|
509 |
CMsvOperation* CNotMtmUi::ViewL( TRequestStatus& aStatus,
|
|
510 |
const CMsvEntrySelection& aSelection )
|
|
511 |
{
|
|
512 |
__ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm == Type(), Panic( EMmsWrongMtm ) );
|
|
513 |
BaseMtm().SwitchCurrentEntryL( aSelection[0] );
|
|
514 |
return ViewL( aStatus );
|
|
515 |
}
|
|
516 |
|
|
517 |
// -----------------------------------------------------------------------------
|
|
518 |
// CNotMtmUi::LaunchEditorApplicationL()
|
|
519 |
// Does the actual opening.
|
|
520 |
// -----------------------------------------------------------------------------
|
|
521 |
//
|
|
522 |
CMsvOperation* CNotMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus,
|
|
523 |
CMsvSession& aSession,
|
|
524 |
TEditorType aEditorType )
|
|
525 |
{
|
|
526 |
LOGTEXT(_L8("NotMtmUi: LaunchEditorApplicationL start"));
|
|
527 |
TEditorParameters temp;
|
|
528 |
|
|
529 |
if ( iBaseMtm.HasContext() )
|
|
530 |
{
|
|
531 |
temp.iId=iBaseMtm.Entry().EntryId();
|
|
532 |
}
|
|
533 |
|
|
534 |
TMsvEntry tempEntry = iBaseMtm.Entry( ).Entry();
|
|
535 |
|
|
536 |
CMtmUiDataRegistry* mtmUiDataReg = CMtmUiDataRegistry::NewL( Session( ) );
|
|
537 |
CleanupStack::PushL( mtmUiDataReg );
|
|
538 |
|
|
539 |
CBaseMtmUiData* uiData=mtmUiDataReg->NewMtmUiDataLayerL( this->Type( ) ) ;
|
|
540 |
CleanupStack::PushL( uiData );
|
|
541 |
|
|
542 |
TBool supported = ETrue;
|
|
543 |
|
|
544 |
if( uiData->OperationSupportedL( KMtmUiFunctionOpenMessage, tempEntry ) )
|
|
545 |
{ // Returns value other than zero if operation is not supported
|
|
546 |
supported = EFalse;
|
|
547 |
}
|
|
548 |
|
|
549 |
CleanupStack::PopAndDestroy( 2, mtmUiDataReg );
|
|
550 |
|
|
551 |
if( !supported )
|
|
552 |
{
|
|
553 |
User::Leave( KErrNotSupported );
|
|
554 |
}
|
|
555 |
|
|
556 |
switch( aEditorType )
|
|
557 |
{
|
|
558 |
case EReadOnly:
|
|
559 |
temp.iFlags|=EMsgReadOnly;
|
|
560 |
break;
|
|
561 |
case ECreateNewMessage:
|
|
562 |
temp.iFlags|=EMsgCreateNewMessage ;
|
|
563 |
temp.iId=KMsvDraftEntryIdValue;
|
|
564 |
break;
|
|
565 |
case EEditExisting: //flow through
|
|
566 |
default:
|
|
567 |
break;
|
|
568 |
};
|
|
569 |
|
|
570 |
temp.iFlags &= ~( EMtmUiFlagEditorPreferEmbedded|EMtmUiFlagEditorNoWaitForExit );
|
|
571 |
|
|
572 |
temp.iFlags |= ( Preferences() & EMtmUiFlagEditorPreferEmbedded?EMsgLaunchEditorEmbedded:0 );
|
|
573 |
|
|
574 |
TPckgC<TEditorParameters> paramPack( temp );
|
|
575 |
|
|
576 |
LOGTEXT( _L8( "Just before calling MsgEditorLauncher" ) );
|
|
577 |
return MsgEditorLauncher::LaunchEditorApplicationL( aSession, Type(), aStatus, temp, KNullDesC(), paramPack );
|
|
578 |
}
|
|
579 |
|
|
580 |
// ---------------------------------------------------------
|
|
581 |
// CNotMtmUi::ForwardL
|
|
582 |
// ---------------------------------------------------------
|
|
583 |
//
|
|
584 |
CMsvOperation* CNotMtmUi::ForwardL( TMsvId aDestination,
|
|
585 |
TMsvPartList aPartList,
|
|
586 |
TRequestStatus& aCompletionStatus )
|
|
587 |
{
|
|
588 |
LOGTEXT(_L8("NotMtmUi: ForwardL start"));
|
|
589 |
TEditorParameters editorParams;
|
|
590 |
editorParams.iFlags &= ~( EMtmUiFlagEditorPreferEmbedded | EMtmUiFlagEditorNoWaitForExit );
|
|
591 |
|
|
592 |
editorParams.iFlags |= ( ( Preferences() & EMtmUiFlagEditorPreferEmbedded ) ? EMsgLaunchEditorEmbedded : 0 );
|
|
593 |
editorParams.iDestinationFolderId = aDestination;
|
|
594 |
editorParams.iPartList = aPartList;
|
|
595 |
|
|
596 |
editorParams.iFlags |= EMsgForwardMessage;
|
|
597 |
editorParams.iId=BaseMtm().Entry().EntryId();
|
|
598 |
|
|
599 |
//we need to check access points here
|
|
600 |
CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt;
|
|
601 |
if ( !CheckSettingsL( exitCode ) )
|
|
602 |
{
|
|
603 |
TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 );
|
|
604 |
if( exitCode == CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) )
|
|
605 |
{
|
|
606 |
LOGTEXT( _L8( "NotMtmUi::ForwardL launching editor" ) );
|
|
607 |
return MsgEditorLauncher::LaunchEditorApplicationL( Session(),
|
|
608 |
Type(),
|
|
609 |
aCompletionStatus,
|
|
610 |
editorParams,
|
|
611 |
KNullDesC() );
|
|
612 |
}
|
|
613 |
else//user selects exit and settings not saved
|
|
614 |
{
|
|
615 |
return CompleteSettingsOperationL( aCompletionStatus, exitCode );
|
|
616 |
}
|
|
617 |
}//if
|
|
618 |
|
|
619 |
LOGTEXT( _L8( "NotMtmUi::ForwardL launching editor" ) );
|
|
620 |
return MsgEditorLauncher::LaunchEditorApplicationL( Session(),
|
|
621 |
Type(),
|
|
622 |
aCompletionStatus,
|
|
623 |
editorParams,
|
|
624 |
KNullDesC() );
|
|
625 |
}
|
|
626 |
|
|
627 |
// ---------------------------------------------------------
|
|
628 |
// CNotMtmUi::ReplyL
|
|
629 |
// ---------------------------------------------------------
|
|
630 |
//
|
|
631 |
CMsvOperation* CNotMtmUi::ReplyL( TMsvId aDestination,
|
|
632 |
TMsvPartList aPartList,
|
|
633 |
TRequestStatus& aCompletionStatus )
|
|
634 |
{
|
|
635 |
LOGTEXT(_L8("NotMtmUi: Reply start"));
|
|
636 |
TEditorParameters editorParams;
|
|
637 |
editorParams.iFlags |= EMsgReplyToMessageSender;
|
|
638 |
editorParams.iId = BaseMtm().Entry().EntryId();
|
|
639 |
editorParams.iDestinationFolderId = aDestination;
|
|
640 |
editorParams.iPartList = aPartList;
|
|
641 |
editorParams.iSpecialAppId = KUidUniEditor;
|
|
642 |
editorParams.iFlags &= ~( EMtmUiFlagEditorPreferEmbedded | EMtmUiFlagEditorNoWaitForExit );
|
|
643 |
|
|
644 |
editorParams.iFlags |= ( ( Preferences() & EMtmUiFlagEditorPreferEmbedded ) ? EMsgLaunchEditorEmbedded : 0 );
|
|
645 |
|
|
646 |
//we need to check access points here
|
|
647 |
CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt;
|
|
648 |
if ( !CheckSettingsL( exitCode ) )
|
|
649 |
{
|
|
650 |
TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 );
|
|
651 |
if( exitCode == CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) )
|
|
652 |
{
|
|
653 |
LOGTEXT( _L8( "NotMtmUi::ReplyL launching editor" ) );
|
|
654 |
return MsgEditorLauncher::LaunchEditorApplicationL( Session(),
|
|
655 |
Type(),
|
|
656 |
aCompletionStatus,
|
|
657 |
editorParams,
|
|
658 |
KNullDesC() );
|
|
659 |
}
|
|
660 |
else//user selects exit and settings not saved
|
|
661 |
{
|
|
662 |
return CompleteSettingsOperationL( aCompletionStatus, exitCode );
|
|
663 |
}
|
|
664 |
}
|
|
665 |
|
|
666 |
//Setting the entry always to read as done for sms
|
|
667 |
if ( BaseMtm().Entry().Entry().Unread() )
|
|
668 |
{
|
|
669 |
CMsvEntry* cEntry;
|
|
670 |
cEntry = &(BaseMtm().Entry());
|
|
671 |
TMsvEntry entry = cEntry->Entry();
|
|
672 |
entry.SetUnread( EFalse );
|
|
673 |
cEntry->ChangeL( entry );
|
|
674 |
}
|
|
675 |
|
|
676 |
LOGTEXT( _L8( "NotMtmUi::ReplyL launching editor" ) );
|
|
677 |
return MsgEditorLauncher::LaunchEditorApplicationL( Session(),
|
|
678 |
Type(),
|
|
679 |
aCompletionStatus,
|
|
680 |
editorParams,
|
|
681 |
KNullDesC() );
|
|
682 |
}
|
|
683 |
|
|
684 |
// ---------------------------------------------------------
|
|
685 |
// CNotMtmUi::CancelL
|
|
686 |
// Suspends sending of the selected messages (if possible)
|
|
687 |
// ---------------------------------------------------------
|
|
688 |
//
|
|
689 |
CMsvOperation* CNotMtmUi::CancelL( TRequestStatus& aStatus,
|
|
690 |
const CMsvEntrySelection& aSelection )
|
|
691 |
{
|
|
692 |
TInt count = aSelection.Count();
|
|
693 |
__ASSERT_DEBUG( count, Panic( EMmsWrongParameters ) );
|
|
694 |
|
|
695 |
CMsvEntry* entry = Session().GetEntryL( aSelection[0] );
|
|
696 |
CleanupStack::PushL( entry );
|
|
697 |
|
|
698 |
while ( count-- )
|
|
699 |
{
|
|
700 |
entry->SetEntryL( aSelection[count] );
|
|
701 |
TMsvEntry tempEntry = entry->Entry();
|
|
702 |
tempEntry.SetSendingState( KMsvSendStateSuspended );
|
|
703 |
|
|
704 |
tempEntry.iDate.UniversalTime();
|
|
705 |
|
|
706 |
entry->ChangeL( tempEntry );
|
|
707 |
}
|
|
708 |
|
|
709 |
CleanupStack::PopAndDestroy(); // entry
|
|
710 |
|
|
711 |
TBuf8<1> dummyParams;
|
|
712 |
dummyParams.Zero();
|
|
713 |
return CBaseMtmUi::InvokeAsyncFunctionL( EMmsDeleteSchedule, aSelection, aStatus, dummyParams );
|
|
714 |
}
|
|
715 |
|
|
716 |
// ---------------------------------------------------------
|
|
717 |
// CNotMtmUi::InvokeSyncFunctionL
|
|
718 |
// ---------------------------------------------------------
|
|
719 |
//
|
|
720 |
void CNotMtmUi::InvokeSyncFunctionL( TInt aFunctionId,
|
|
721 |
const CMsvEntrySelection& aSelection,
|
|
722 |
TDes8& aParameter )
|
|
723 |
{
|
|
724 |
LOGTEXT(_L8("NotMtmUi: InvokeSyncFuntionL start"));
|
|
725 |
switch ( aFunctionId )
|
|
726 |
{
|
|
727 |
case KMtmUiMessagingInitialisation:
|
|
728 |
LOGTEXT(_L8("NotMtmUi: InvokeSyncFuntionL MsgIni"));
|
|
729 |
CreateDefaultSettingsL();
|
|
730 |
break;
|
|
731 |
case KMtmUiFunctionRestoreFactorySettings:
|
|
732 |
LOGTEXT(_L8("NotMtmUi: InvokeSyncFuntionL FactorySetts"));
|
|
733 |
HandleFactorySettingsL( aParameter );
|
|
734 |
break;
|
|
735 |
case KMtmUiFunctionValidateService:
|
|
736 |
{
|
|
737 |
LOGTEXT(_L8("NotMtmUi: InvokeSyncFuntionL ValidateService"));
|
|
738 |
iSettingsHandler->RefreshSettingsL( );
|
|
739 |
TInt error = iSettingsHandler->MmsSettings()->ValidateSettings();
|
|
740 |
// return the result via aParameter as a TInt packaged into a TDes8
|
|
741 |
TPckgBuf<TInt> resultPackage( error );
|
|
742 |
aParameter.Copy( resultPackage );
|
|
743 |
}
|
|
744 |
break;
|
|
745 |
default:
|
|
746 |
CBaseMtmUi::InvokeSyncFunctionL( aFunctionId, aSelection, aParameter );
|
|
747 |
break;
|
|
748 |
}
|
|
749 |
LOGTEXT(_L8("NotMtmUi: InvokeSyncFunctionL end"));
|
|
750 |
}
|
|
751 |
|
|
752 |
// ---------------------------------------------------------
|
|
753 |
// CNotMtmUi::InvokeAsyncFunctionL
|
|
754 |
// ---------------------------------------------------------
|
|
755 |
//
|
|
756 |
CMsvOperation* CNotMtmUi::InvokeAsyncFunctionL( TInt aFunctionId,
|
|
757 |
const CMsvEntrySelection& aSelection,
|
|
758 |
TRequestStatus& aCompletionStatus,
|
|
759 |
TDes8& aParameter )
|
|
760 |
{
|
|
761 |
LOGTEXT(_L8("NotMtmUi: InvokeAsyncFuntionL start"));
|
|
762 |
CMsvOperation* msvoperation = NULL;
|
|
763 |
switch ( aFunctionId )
|
|
764 |
{
|
|
765 |
case KMtmUiFunctionMessageInfo:
|
|
766 |
LOGTEXT(_L8("NotMtmUi: InvokeAsyncFuntionL MsgInfo"));
|
|
767 |
msvoperation = OpenMessageInfoL( aCompletionStatus, aParameter );
|
|
768 |
break;
|
|
769 |
case KMtmUiFunctionMMBox:
|
|
770 |
LOGTEXT(_L8("NotMtmUi: InvokeAsyncFuntionL MMBox"));
|
|
771 |
msvoperation = OpenMMBoxDialogL( aCompletionStatus );
|
|
772 |
break;
|
|
773 |
case KMtmUiFunctionFetchMMS:
|
|
774 |
LOGTEXT(_L8("NotMtmUi: InvokeAsyncFuntionL Fetch"));
|
|
775 |
if( iNotUiFlags & EOffline
|
|
776 |
&& IS_PHONE_OFF_LINEL() )
|
|
777 |
{ // We are in offline at the moment -> Infonote
|
|
778 |
ShowInformationNoteL( R_NOTMTM_OFFLINE_NOT_POSSIBLE, EFalse );
|
|
779 |
break;
|
|
780 |
}
|
|
781 |
msvoperation = StartFetchingL( aSelection, aCompletionStatus );
|
|
782 |
break;
|
|
783 |
case KMtmUiFunctionDeleteMessage:
|
|
784 |
LOGTEXT(_L8("NotMtmUi: InvokeAsyncFuntionL Delete"));
|
|
785 |
msvoperation = StartDeletingL( aSelection, aCompletionStatus );
|
|
786 |
break;
|
|
787 |
default:
|
|
788 |
break;
|
|
789 |
}
|
|
790 |
LOGTEXT(_L8("NotMtmUi: InvokeAsyncFuntionL end"));
|
|
791 |
return msvoperation;
|
|
792 |
}
|
|
793 |
|
|
794 |
// ---------------------------------------------------------
|
|
795 |
// CNotMtmUi::DisplayProgressSummary
|
|
796 |
// ---------------------------------------------------------
|
|
797 |
//
|
|
798 |
TInt CNotMtmUi::DisplayProgressSummary( const TDesC8& /* aProgress */ ) const
|
|
799 |
{
|
|
800 |
// This does nothing, because MsgErrorWatcher shows all MMS error messages.
|
|
801 |
// Furthermore currently MMS engine does not return any sensible progress to report.
|
|
802 |
return KErrNone;
|
|
803 |
}
|
|
804 |
|
|
805 |
// ---------------------------------------------------------
|
|
806 |
// CNotMtmUi::GetResourceFileName
|
|
807 |
// ---------------------------------------------------------
|
|
808 |
//
|
|
809 |
void CNotMtmUi::GetResourceFileName( TFileName& aFileName ) const
|
|
810 |
{
|
|
811 |
aFileName = KNotMtmResourceFile;
|
|
812 |
}
|
|
813 |
|
|
814 |
// ---------------------------------------------------------
|
|
815 |
// CNotMtmUi::CreateDefaultSettingsL
|
|
816 |
// ---------------------------------------------------------
|
|
817 |
//
|
|
818 |
void CNotMtmUi::CreateDefaultSettingsL()
|
|
819 |
{
|
|
820 |
// done in engine by FactorySettings
|
|
821 |
}
|
|
822 |
|
|
823 |
// ---------------------------------------------------------
|
|
824 |
// CNotMtmUi::HandleFactorySettingsL
|
|
825 |
// Reset Factory Settings support
|
|
826 |
// ---------------------------------------------------------
|
|
827 |
EXPORT_C void CNotMtmUi::HandleFactorySettingsL( TDes8& aLevel )
|
|
828 |
{
|
|
829 |
iSettingsHandler->HandleFactorySettingsL( aLevel );
|
|
830 |
}
|
|
831 |
|
|
832 |
// ---------------------------------------------------------
|
|
833 |
// CNotMtmUi::DeleteFromQuery()
|
|
834 |
// Queries from the user where the notifications
|
|
835 |
// or messages are being deleted from
|
|
836 |
// ---------------------------------------------------------
|
|
837 |
TInt CNotMtmUi::DeleteFromQueryL( TInt& result )
|
|
838 |
{
|
|
839 |
LOGTEXT(_L8("NotMtmUi: DeleteFromQuery start"));
|
|
840 |
TInt index = 0;
|
|
841 |
CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &index );
|
|
842 |
dlg->PrepareLC( R_NOTUI_DELETE_FROM_QUERY );
|
|
843 |
|
|
844 |
// Populate list query array
|
|
845 |
CDesCArrayFlat *array = new(ELeave) CDesCArrayFlat(3);
|
|
846 |
CleanupStack::PushL(array);
|
|
847 |
HBufC* buf = StringLoader::LoadLC( R_NOTMTM_DELETE_QUERY_BOTHLOCALANDREMOTE );
|
|
848 |
array->AppendL( *buf );
|
|
849 |
CleanupStack::PopAndDestroy(); //buf
|
|
850 |
buf = StringLoader::LoadLC( R_NOTMTM_DELETE_QUERY_LOCALONLY );
|
|
851 |
array->AppendL( *buf );
|
|
852 |
CleanupStack::PopAndDestroy(); //buf
|
|
853 |
buf = StringLoader::LoadLC( R_NOTMTM_DELETE_QUERY_REMOTEONLY );
|
|
854 |
array->AppendL( *buf );
|
|
855 |
CleanupStack::PopAndDestroy(); //buf
|
|
856 |
dlg->SetItemTextArray( array );
|
|
857 |
CleanupStack::Pop(); //array
|
|
858 |
|
|
859 |
TInt queryOk = dlg->RunLD();
|
|
860 |
if( queryOk )
|
|
861 |
{
|
|
862 |
/* list query approved, index is usable to see what list item was selected */
|
|
863 |
switch( index )
|
|
864 |
{
|
|
865 |
case 0:
|
|
866 |
result = EMmsDeleteBoth;
|
|
867 |
break;
|
|
868 |
case 1:
|
|
869 |
result = EMmsDeleteNotificationOnly;
|
|
870 |
break;
|
|
871 |
case 2:
|
|
872 |
default:
|
|
873 |
result = EMmsDeleteMMBoxOnly;
|
|
874 |
break;
|
|
875 |
};
|
|
876 |
}
|
|
877 |
else
|
|
878 |
{
|
|
879 |
/* list query cancelled, index is unusable */
|
|
880 |
}
|
|
881 |
LOGTEXT(_L8("NotMtmUi: DeleteFromQueryL end"));
|
|
882 |
return queryOk;
|
|
883 |
}
|
|
884 |
|
|
885 |
// ---------------------------------------------------------
|
|
886 |
// CMsvOperation* CNotMtmUi::OpenServiceSettingsDialogL(TRequestStatus& aCompletionStatus)
|
|
887 |
// Handles MMS service settings
|
|
888 |
// ---------------------------------------------------------
|
|
889 |
//
|
|
890 |
EXPORT_C CMsvOperation* CNotMtmUi::OpenServiceSettingsDialogL( TRequestStatus& aCompletionStatus )
|
|
891 |
{
|
|
892 |
return iSettingsHandler->OpenServiceSettingsDialogL( aCompletionStatus );
|
|
893 |
}
|
|
894 |
|
|
895 |
// ---------------------------------------------------------
|
|
896 |
// CheckSettingsL
|
|
897 |
// ---------------------------------------------------------
|
|
898 |
//
|
|
899 |
TBool CNotMtmUi::CheckSettingsL( )
|
|
900 |
{
|
|
901 |
CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt;
|
|
902 |
if ( !CheckSettingsL( exitCode ) )
|
|
903 |
{
|
|
904 |
TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 );
|
|
905 |
if( !( exitCode==CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) ) )
|
|
906 |
{
|
|
907 |
return EFalse;
|
|
908 |
}
|
|
909 |
}
|
|
910 |
return ETrue;
|
|
911 |
}
|
|
912 |
|
|
913 |
// ---------------------------------------------------------
|
|
914 |
// CMsvOperation* CNotMtmUi::CompleteSettingsOperationL(
|
|
915 |
// TRequestStatus& aCompletionStatus, const CMmsSettingsDialog::TMmsExitCode& aExitCode)
|
|
916 |
// Creates completed operation after settings dialog closing with appropriate parameters.
|
|
917 |
// ---------------------------------------------------------
|
|
918 |
//
|
|
919 |
EXPORT_C CMsvOperation* CNotMtmUi::CompleteSettingsOperationL(
|
|
920 |
TRequestStatus& aCompletionStatus,
|
|
921 |
const CMmsSettingsDialog::TMmsExitCode& aExitCode /* = CMmsSettingsDialog::EMmsExternalInterrupt */ )
|
|
922 |
{
|
|
923 |
return iSettingsHandler->CompleteSettingsOperationL(
|
|
924 |
aCompletionStatus,
|
|
925 |
aExitCode );
|
|
926 |
}
|
|
927 |
|
|
928 |
// ---------------------------------------------------------
|
|
929 |
// TInt CNotMtmUi::LaunchSettingsDialogL(
|
|
930 |
// CMmsSettingsDialog::TMmsExitCode& aExitCode )
|
|
931 |
// Opens either MMS Service Settings or MMS Sending Settings dialog.
|
|
932 |
// ---------------------------------------------------------
|
|
933 |
//
|
|
934 |
EXPORT_C void CNotMtmUi::LaunchSettingsDialogL(
|
|
935 |
CMmsSettingsDialog::TMmsExitCode& aExitCode ) const
|
|
936 |
{
|
|
937 |
iSettingsHandler->LaunchSettingsDialogL( aExitCode );
|
|
938 |
}
|
|
939 |
|
|
940 |
|
|
941 |
// ---------------------------------------------------------
|
|
942 |
// CNotMtmUi::OpenMessageInfoL(TRequestStatus& aCompletionStatus, TDes8& aParameter)
|
|
943 |
// Opens the Message Info popup.
|
|
944 |
// ---------------------------------------------------------
|
|
945 |
//
|
|
946 |
CMsvOperation* CNotMtmUi::OpenMessageInfoL( TRequestStatus& aCompletionStatus,
|
|
947 |
TDes8& /*aParameter*/ )
|
|
948 |
{
|
|
949 |
LOGTEXT( _L8( "NotMtmUi OpenMessageInfo start" ) );
|
|
950 |
TInt popCount( 0 );
|
|
951 |
|
|
952 |
// The items for Info are read from the message entry.
|
|
953 |
// Note: Most of the stuff is in TMsvEntry, but not all -> MMS entry used all the way.
|
|
954 |
TMmsMsvEntry entry = static_cast<TMmsMsvEntry>( BaseMtm().Entry().Entry() );
|
|
955 |
__ASSERT_DEBUG( entry.iType==KUidMsvMessageEntry, Panic( EMmsNotAMessage ) );
|
|
956 |
__ASSERT_DEBUG( entry.iMtm==Type(), Panic( EMmsWrongMtm ) );
|
|
957 |
|
|
958 |
iMmsClient.LoadMessageL();
|
|
959 |
|
|
960 |
TMsgInfoMessageInfoData infoData;
|
|
961 |
|
|
962 |
// From - show only for received messages
|
|
963 |
if ( entry.IsMobileTerminated() )
|
|
964 |
{
|
|
965 |
HBufC* senderNumber = iMmsClient.Sender().AllocLC();
|
|
966 |
popCount++;
|
|
967 |
// Additional space for chars: '<' '>' ',' + 2 x KMmsLRMarker
|
|
968 |
HBufC* fromText = HBufC::NewLC( entry.iDetails.Length() + senderNumber->Length() + KMmsAdditionalCharsStringLength );
|
|
969 |
popCount++;
|
|
970 |
|
|
971 |
// Do we have alias?
|
|
972 |
if ( senderNumber->Compare( entry.iDetails ) )
|
|
973 |
{ // yes
|
|
974 |
TPtr fromTextPtr = fromText->Des();
|
|
975 |
fromTextPtr.Append( entry.iDetails );
|
|
976 |
fromTextPtr.Append( KMmsCharSpace );
|
|
977 |
fromTextPtr.Append( KMmsLRMarker );
|
|
978 |
fromTextPtr.Append( KCharLeftAddressIterator );
|
|
979 |
fromTextPtr.Append( TMmsGenUtils::PureAddress( senderNumber->Des( ) ) );
|
|
980 |
fromTextPtr.Append( KCharRightAddressIterator );
|
|
981 |
fromTextPtr.Append( KMmsLRMarker );
|
|
982 |
infoData.iFrom.Set( *fromText );
|
|
983 |
}
|
|
984 |
else
|
|
985 |
{ // no
|
|
986 |
infoData.iFrom.Set( *senderNumber );
|
|
987 |
}
|
|
988 |
}
|
|
989 |
|
|
990 |
// Subject
|
|
991 |
infoData.iSubject.Set( iMmsClient.SubjectL() );
|
|
992 |
|
|
993 |
// Supply UTC date-time to message info
|
|
994 |
infoData.iDateTime = entry.iDate;
|
|
995 |
|
|
996 |
// Type of message -taken directly from resources as this must be a multimedia message
|
|
997 |
HBufC* msgType = StringLoader::LoadLC( R_NOT_TYPE_TEXT, iCoeEnv );
|
|
998 |
popCount++;
|
|
999 |
infoData.iType.Set( msgType->Des() );
|
|
1000 |
|
|
1001 |
// Priority of message
|
|
1002 |
HBufC* priority = NULL;
|
|
1003 |
switch ( iMmsClient.MessagePriority() )
|
|
1004 |
{
|
|
1005 |
case EMmsPriorityHigh:
|
|
1006 |
{
|
|
1007 |
priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_HIGH, iCoeEnv );
|
|
1008 |
popCount++;
|
|
1009 |
infoData.iPriority.Set( *priority);
|
|
1010 |
break;
|
|
1011 |
}
|
|
1012 |
case EMmsPriorityLow:
|
|
1013 |
{
|
|
1014 |
priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_LOW, iCoeEnv );
|
|
1015 |
popCount++;
|
|
1016 |
infoData.iPriority.Set( *priority);
|
|
1017 |
break;
|
|
1018 |
}
|
|
1019 |
case EMmsPriorityNormal:
|
|
1020 |
{
|
|
1021 |
priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_NORMAL, iCoeEnv );
|
|
1022 |
popCount++;
|
|
1023 |
infoData.iPriority.Set( *priority);
|
|
1024 |
break;
|
|
1025 |
}
|
|
1026 |
default: // Do not show the priority if it's not set
|
|
1027 |
break;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
// Size of message.
|
|
1031 |
TInt size = iMmsClient.MessageTransferSize( );
|
|
1032 |
TInt maxSize = static_cast<TInt>(
|
|
1033 |
iSettingsHandler->MmsSettings()->MaximumReceiveSize() );
|
|
1034 |
|
|
1035 |
if( maxSize > 0 )
|
|
1036 |
{
|
|
1037 |
if( size > maxSize )
|
|
1038 |
{
|
|
1039 |
size = maxSize;
|
|
1040 |
}
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
// Finally make the UI string
|
|
1044 |
TBuf<KMessageSize> sizeString;
|
|
1045 |
MessageSizeToStringL( sizeString, size );
|
|
1046 |
infoData.iSize.Set( sizeString );
|
|
1047 |
|
|
1048 |
// To
|
|
1049 |
const CMsvRecipientList& recipients = iMmsClient.AddresseeList();
|
|
1050 |
TInt count = recipients.Count();
|
|
1051 |
TPtrC separatorPtr( KAddressSeparator );
|
|
1052 |
|
|
1053 |
// Calculate size needed
|
|
1054 |
TInt index;
|
|
1055 |
TInt toSize = 0;
|
|
1056 |
|
|
1057 |
for ( index = 0; index < count; index++ )
|
|
1058 |
{
|
|
1059 |
toSize += recipients[index].Length();
|
|
1060 |
if ( index < ( count - 1 ) )
|
|
1061 |
{ // not the last address, add separator space
|
|
1062 |
toSize += separatorPtr.Length();
|
|
1063 |
}
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
if ( toSize )
|
|
1067 |
{
|
|
1068 |
// Form the to-string
|
|
1069 |
HBufC* toList = TurnRecipientsArrayIntoStringLC( recipients );
|
|
1070 |
popCount++;
|
|
1071 |
infoData.iTo.Set( *toList );
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
CMsgInfoMessageInfoDialog* infoDialog = CMsgInfoMessageInfoDialog::NewL();
|
|
1075 |
|
|
1076 |
if ( entry.IsMobileTerminated() )
|
|
1077 |
{
|
|
1078 |
infoDialog->ExecuteLD( infoData, CMsgInfoMessageInfoDialog::EMmsViewer );
|
|
1079 |
}
|
|
1080 |
else
|
|
1081 |
{
|
|
1082 |
infoDialog->ExecuteLD( infoData, CMsgInfoMessageInfoDialog::EMmsEditor );
|
|
1083 |
}
|
|
1084 |
|
|
1085 |
CleanupStack::PopAndDestroy( popCount );
|
|
1086 |
return CMsvCompletedOperation::NewL( Session(),
|
|
1087 |
KUidMsvLocalServiceMtm,
|
|
1088 |
KNullDesC8,
|
|
1089 |
KMsvLocalServiceIndexEntryId,
|
|
1090 |
aCompletionStatus );
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
|
|
1094 |
// ---------------------------------------------------------
|
|
1095 |
// CNotMtmUi::OpenMMBoxDialogL
|
|
1096 |
// Opens the MMBox Dialog
|
|
1097 |
// ---------------------------------------------------------
|
|
1098 |
//
|
|
1099 |
CMsvOperation* CNotMtmUi::OpenMMBoxDialogL( TRequestStatus& aCompletionStatus )
|
|
1100 |
{
|
|
1101 |
LOGTEXT( _L8( "NotMtmUi OpenMMBoxDialog start" ) );
|
|
1102 |
|
|
1103 |
TInt exitCode;
|
|
1104 |
|
|
1105 |
CMtmUiDataRegistry* mtmUiDataReg = CMtmUiDataRegistry::NewL( Session( ) );
|
|
1106 |
CleanupStack::PushL( mtmUiDataReg );
|
|
1107 |
|
|
1108 |
CBaseMtmUiData* mtmUiData = mtmUiDataReg->NewMtmUiDataLayerL( this->Type( ) );
|
|
1109 |
CleanupStack::PushL( mtmUiData );
|
|
1110 |
CNotMtmUiData* uiData = static_cast<CNotMtmUiData*> ( mtmUiData );
|
|
1111 |
|
|
1112 |
CMMBoxDialog* dialog = CMMBoxDialog::NewL( *this, *uiData, Session(), exitCode );
|
|
1113 |
|
|
1114 |
dialog->ExecuteLD( R_NOT_MMBOX_DIALOG );
|
|
1115 |
|
|
1116 |
CleanupStack::PopAndDestroy( mtmUiData );
|
|
1117 |
CleanupStack::PopAndDestroy( mtmUiDataReg );
|
|
1118 |
|
|
1119 |
return CMsvCompletedOperation::NewL( Session(),
|
|
1120 |
KUidMsvLocalServiceMtm,
|
|
1121 |
KNullDesC8,
|
|
1122 |
KMsvLocalServiceIndexEntryId,
|
|
1123 |
aCompletionStatus );
|
|
1124 |
}
|
|
1125 |
|
|
1126 |
|
|
1127 |
|
|
1128 |
// ---------------------------------------------------------
|
|
1129 |
// CNotMtmUi::StartFetchingL
|
|
1130 |
// ---------------------------------------------------------
|
|
1131 |
//
|
|
1132 |
CMsvOperation* CNotMtmUi::StartFetchingL(
|
|
1133 |
const CMsvEntrySelection& aSelection,
|
|
1134 |
TRequestStatus& aCompletionStatus )
|
|
1135 |
{
|
|
1136 |
LOGTEXT( _L8( "NotMtmUi StartFetchingL start" ) );
|
|
1137 |
// Lets check the expiration if only one notification
|
|
1138 |
if( aSelection.Count( ) == 1 )
|
|
1139 |
{
|
|
1140 |
TMsvEntry entry;
|
|
1141 |
TMsvId service=-1;
|
|
1142 |
Session().GetEntry( aSelection.At( 0 ), service, entry );
|
|
1143 |
if( entry.Parent( ) == KMsvGlobalInBoxIndexEntryId )
|
|
1144 |
{ // We are in Inbox
|
|
1145 |
TMsvId origId = iMmsClient.Entry().Entry().Id();
|
|
1146 |
iMmsClient.SwitchCurrentEntryL( aSelection.At( 0 ) );
|
|
1147 |
iMmsClient.LoadMessageL( );
|
|
1148 |
TTime currentTime;
|
|
1149 |
currentTime.HomeTime( );
|
|
1150 |
TTime expiryTime = iMmsClient.ExpiryDate( );
|
|
1151 |
iMmsClient.SwitchCurrentEntryL( origId );
|
|
1152 |
iMmsClient.LoadMessageL( );
|
|
1153 |
TLocale locale;
|
|
1154 |
expiryTime += locale.UniversalTimeOffset();
|
|
1155 |
if (locale.QueryHomeHasDaylightSavingOn())
|
|
1156 |
{
|
|
1157 |
TTimeIntervalHours daylightSaving(1);
|
|
1158 |
expiryTime += daylightSaving;
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
if( currentTime > expiryTime )
|
|
1162 |
{ // Message is expired
|
|
1163 |
TBool res = EFalse;
|
|
1164 |
TRAPD( err, res=ShowConfirmationQueryL( R_NOT_MMBOX_QUEST_MSG_EXPIRED ) );
|
|
1165 |
if ( err || !res )
|
|
1166 |
{ // User did not want to fetch expired message or the function leaved
|
|
1167 |
CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsBack;
|
|
1168 |
return CompleteSettingsOperationL( aCompletionStatus, exitCode );
|
|
1169 |
} // else we continue
|
|
1170 |
}
|
|
1171 |
}
|
|
1172 |
}
|
|
1173 |
|
|
1174 |
//we need to check access points here
|
|
1175 |
CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt;
|
|
1176 |
if ( !CheckSettingsL( exitCode ) )
|
|
1177 |
{
|
|
1178 |
TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 );
|
|
1179 |
//settings saved
|
|
1180 |
if( exitCode==CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) )
|
|
1181 |
{
|
|
1182 |
CMsvOperation* op = NULL;
|
|
1183 |
CAknInputBlock* abs = CAknInputBlock::NewLC( );
|
|
1184 |
TRAP_IGNORE( op = iMmsClient.FetchMessagesL( aSelection, aCompletionStatus) );
|
|
1185 |
CleanupStack::PopAndDestroy( abs );
|
|
1186 |
return op;
|
|
1187 |
}
|
|
1188 |
else//user selects exit and settings not saved
|
|
1189 |
{
|
|
1190 |
return CompleteSettingsOperationL( aCompletionStatus, exitCode );
|
|
1191 |
}
|
|
1192 |
}
|
|
1193 |
else
|
|
1194 |
{
|
|
1195 |
// OK - settings ok and fetch could be done
|
|
1196 |
CAknInputBlock* abs = CAknInputBlock::NewLC( );
|
|
1197 |
CMsvOperation* op = NULL;
|
|
1198 |
TRAP_IGNORE( op = iMmsClient.FetchMessagesL( aSelection, aCompletionStatus) );
|
|
1199 |
CleanupStack::PopAndDestroy( abs );
|
|
1200 |
return op;
|
|
1201 |
}
|
|
1202 |
}
|
|
1203 |
|
|
1204 |
// ---------------------------------------------------------
|
|
1205 |
// CNotMtmUi::StartDeletingL
|
|
1206 |
// ---------------------------------------------------------
|
|
1207 |
//
|
|
1208 |
CMsvOperation* CNotMtmUi::StartDeletingL(
|
|
1209 |
const CMsvEntrySelection& aSelection,
|
|
1210 |
TRequestStatus& aCompletionStatus )
|
|
1211 |
{
|
|
1212 |
LOGTEXT( _L8( "NotMtmUi StartDeletingL start" ) );
|
|
1213 |
|
|
1214 |
CMsvOperation* msvoperation = NULL;
|
|
1215 |
|
|
1216 |
if( aSelection.Count( ) == 0 )
|
|
1217 |
{ // Nothing to delete
|
|
1218 |
return msvoperation;
|
|
1219 |
}
|
|
1220 |
|
|
1221 |
if( aSelection.Count( ) > 1 )
|
|
1222 |
{
|
|
1223 |
iFlags |= EDeletingMany;
|
|
1224 |
}
|
|
1225 |
else
|
|
1226 |
{
|
|
1227 |
iFlags &= ~EDeletingMany;
|
|
1228 |
}
|
|
1229 |
|
|
1230 |
iFlags &= ~EDeletingFromMMBox;
|
|
1231 |
|
|
1232 |
TInt deleteMode(-1);
|
|
1233 |
|
|
1234 |
CMsvEntry* cEntry = Session().GetEntryL( aSelection[0] );
|
|
1235 |
CleanupStack::PushL( cEntry );
|
|
1236 |
|
|
1237 |
TMsvEntry entry = cEntry->Entry( );
|
|
1238 |
|
|
1239 |
CleanupStack::PopAndDestroy(); //cEntry
|
|
1240 |
|
|
1241 |
if( entry.Parent( ) == KMsvGlobalInBoxIndexEntryId
|
|
1242 |
|| entry.Parent( ) == iMmsClient.GetMmboxFolderL( ) )
|
|
1243 |
{
|
|
1244 |
if( iNotUiFlags & EOffline
|
|
1245 |
&& IS_PHONE_OFF_LINEL() )
|
|
1246 |
{ // We are in offline at the moment -> Infonote
|
|
1247 |
ShowInformationNoteL( R_NOTMTM_OFFLINE_NOT_POSSIBLE, EFalse );
|
|
1248 |
return msvoperation;
|
|
1249 |
}
|
|
1250 |
}
|
|
1251 |
|
|
1252 |
if( ( entry.Parent( ) == KMsvGlobalInBoxIndexEntryId )
|
|
1253 |
&& ( iNotUiFlags & EDeleteOptionsSupported )
|
|
1254 |
&& DeleteQueryReallyNeededL( aSelection ) )
|
|
1255 |
{ // Query is really needed (we r in Inbox, DeleteOptions supported
|
|
1256 |
// and the msg has not been deleted from server yet
|
|
1257 |
if( !( DeleteFromQueryL( deleteMode ) ) )
|
|
1258 |
{ // Answered Cancel
|
|
1259 |
return msvoperation; // Return NULL operation
|
|
1260 |
}
|
|
1261 |
if( deleteMode != EMmsDeleteNotificationOnly )
|
|
1262 |
{
|
|
1263 |
iFlags |= EDeletingFromMMBox;
|
|
1264 |
}
|
|
1265 |
}
|
|
1266 |
else // Either we have no options or we are deleting FR(s)
|
|
1267 |
{
|
|
1268 |
if( entry.Parent( ) == iMmsClient.GetMmboxFolderL( ) )
|
|
1269 |
{
|
|
1270 |
iFlags |= EDeletingFromMMBox;
|
|
1271 |
deleteMode = EMmsDeleteBoth;
|
|
1272 |
}
|
|
1273 |
else
|
|
1274 |
{
|
|
1275 |
deleteMode = EMmsDeleteNotificationOnly;
|
|
1276 |
}
|
|
1277 |
}
|
|
1278 |
|
|
1279 |
if( deleteMode == -1 )
|
|
1280 |
{ // For some reason deleteMode was not set
|
|
1281 |
return msvoperation; // Return NULL operation
|
|
1282 |
}
|
|
1283 |
if( iFlags & EDeletingFromMMBox )
|
|
1284 |
{
|
|
1285 |
CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt;
|
|
1286 |
if ( !CheckSettingsL( exitCode ) )
|
|
1287 |
{
|
|
1288 |
TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 );
|
|
1289 |
// just return NULL if the settings are not all right
|
|
1290 |
if( !ApExistsL( ap ) )
|
|
1291 |
{
|
|
1292 |
return msvoperation;
|
|
1293 |
}
|
|
1294 |
}
|
|
1295 |
}
|
|
1296 |
// Now we can start the deleting process
|
|
1297 |
if( entry.Parent( ) == KMsvGlobalInBoxIndexEntryId
|
|
1298 |
|| entry.Parent( ) == iMmsClient.GetMmboxFolderL( ) )
|
|
1299 |
{ // We are now in Inbox
|
|
1300 |
|
|
1301 |
CMsvProgressReporterOperation* reporter =
|
|
1302 |
CMsvProgressReporterOperation::NewL(
|
|
1303 |
Session(),
|
|
1304 |
aCompletionStatus,
|
|
1305 |
EMbmAvkonQgn_note_erased );
|
|
1306 |
|
|
1307 |
CleanupStack::PushL(reporter);
|
|
1308 |
|
|
1309 |
CMsvOperation* deleteop = iMmsClient.UnscheduledDeleteNotificationL(
|
|
1310 |
aSelection,
|
|
1311 |
(TMmsDeleteOperationType)deleteMode,
|
|
1312 |
reporter->RequestStatus() );
|
|
1313 |
reporter->SetProgressDecoder( *this );
|
|
1314 |
reporter->SetOperationL( deleteop ); // Takes immediate ownership
|
|
1315 |
CleanupStack::Pop(); //reporter
|
|
1316 |
msvoperation = reporter;
|
|
1317 |
}
|
|
1318 |
else
|
|
1319 |
{ // We are in Outbox/Sent folder -> Synchronously Delete FR
|
|
1320 |
TInt waitNoteId = 0;
|
|
1321 |
waitNoteId = aSelection.Count( ) == 1?
|
|
1322 |
R_NOTMTM_WAIT_DELETING:R_NOTMTM_WAIT_DELETING_MANY;
|
|
1323 |
ShowWaitNoteLC( waitNoteId, ETrue); // Show deleting note
|
|
1324 |
|
|
1325 |
iMmsClient.DeleteForwardEntryL( aSelection );
|
|
1326 |
|
|
1327 |
if( iWaitDialog )
|
|
1328 |
{
|
|
1329 |
CleanupStack::PopAndDestroy( ); // iWaitDialog
|
|
1330 |
iWaitDialog=NULL;
|
|
1331 |
}
|
|
1332 |
|
|
1333 |
return msvoperation; // Return NULL operation as DeleteForwardEntryL is actually synchronous
|
|
1334 |
}
|
|
1335 |
|
|
1336 |
return msvoperation;
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
|
|
1340 |
// ---------------------------------------------------------
|
|
1341 |
// CNotMtmUi::TurnRecipientsArrayIntoStringLC
|
|
1342 |
//
|
|
1343 |
// ---------------------------------------------------------
|
|
1344 |
HBufC* CNotMtmUi::TurnRecipientsArrayIntoStringLC( const CMsvRecipientList& aRecip ) const
|
|
1345 |
{
|
|
1346 |
//calc length of string needed
|
|
1347 |
TInt stringLength = 0;
|
|
1348 |
TInt index;
|
|
1349 |
TInt count = aRecip.Count();
|
|
1350 |
for( index = 0; index < count; index++ )
|
|
1351 |
{
|
|
1352 |
stringLength += TMmsGenUtils::Alias( aRecip[index] ).Length();
|
|
1353 |
stringLength += TMmsGenUtils::PureAddress( aRecip[index] ).Length();
|
|
1354 |
// Additional space for chars: '<' '>' ',' + 2 x KMmsLRMarker
|
|
1355 |
stringLength += KMmsAdditionalCharsStringLength;
|
|
1356 |
}
|
|
1357 |
//construct string
|
|
1358 |
HBufC* toList = HBufC::NewLC( stringLength );
|
|
1359 |
for( index=0; index < count; index++ )
|
|
1360 |
{
|
|
1361 |
TPtrC name = TMmsGenUtils::Alias( aRecip[index] );
|
|
1362 |
TPtrC number = TMmsGenUtils::PureAddress( aRecip[index] );
|
|
1363 |
TPtr toListPtr = toList->Des();
|
|
1364 |
if( name.Length())
|
|
1365 |
{
|
|
1366 |
toListPtr.Append( name );
|
|
1367 |
toListPtr.Append( KMmsCharSpace );
|
|
1368 |
toListPtr.Append( KMmsLRMarker );
|
|
1369 |
toListPtr.Append( KCharLeftAddressIterator );
|
|
1370 |
toListPtr.Append( number );
|
|
1371 |
toListPtr.Append( KCharRightAddressIterator );
|
|
1372 |
toListPtr.Append( KMmsLRMarker );
|
|
1373 |
}
|
|
1374 |
else
|
|
1375 |
{
|
|
1376 |
toListPtr.Append( number );
|
|
1377 |
}
|
|
1378 |
|
|
1379 |
if ( index < ( count - 1 ) )
|
|
1380 |
{
|
|
1381 |
toListPtr.Append( KMmsCharCommaAndSpace );
|
|
1382 |
}
|
|
1383 |
}
|
|
1384 |
|
|
1385 |
return toList;
|
|
1386 |
}
|
|
1387 |
|
|
1388 |
|
|
1389 |
|
|
1390 |
// ---------------------------------------------------------
|
|
1391 |
// CNotMtmUi::MessageSizeToStringL(TDes& aTarget, TInt aFileSize)
|
|
1392 |
// Converts message size in bytes to a kilobyte string. Rounds the bytes up to the
|
|
1393 |
// next full kilo. I.e:
|
|
1394 |
// 0 -> 0KB
|
|
1395 |
// 1 -> 1KB
|
|
1396 |
// 1024 -> 1KB
|
|
1397 |
// 1025 -> 2KB
|
|
1398 |
// ---------------------------------------------------------
|
|
1399 |
//
|
|
1400 |
void CNotMtmUi::MessageSizeToStringL( TDes& aTarget, TInt aFileSize ) const
|
|
1401 |
{
|
|
1402 |
TInt fileSize = aFileSize / KKiloByte;
|
|
1403 |
if ( aFileSize % KKiloByte )
|
|
1404 |
{
|
|
1405 |
fileSize++;
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
HBufC* buf = StringLoader::LoadLC( R_NOT_MESSAGE_SIZE_KB, fileSize, iEikonEnv );
|
|
1409 |
TPtr ptr = buf->Des();
|
|
1410 |
ptr.Trim(); // remove possible white space from beginning
|
|
1411 |
aTarget.Append( ptr );
|
|
1412 |
|
|
1413 |
CleanupStack::PopAndDestroy(); // buf
|
|
1414 |
}
|
|
1415 |
|
|
1416 |
// ---------------------------------------------------------
|
|
1417 |
// CNotMtmUi::ShowConfirmationQueryL
|
|
1418 |
// ---------------------------------------------------------
|
|
1419 |
//
|
|
1420 |
TInt CNotMtmUi::ShowConfirmationQueryL( TInt aResourceId ) const
|
|
1421 |
{
|
|
1422 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
1423 |
HBufC* prompt = StringLoader::LoadLC( aResourceId, iCoeEnv );
|
|
1424 |
TInt retVal = dlg->ExecuteLD( R_NOTUI_CONFIRMATION_QUERY, *prompt );
|
|
1425 |
CleanupStack::PopAndDestroy( prompt );
|
|
1426 |
return retVal;
|
|
1427 |
}
|
|
1428 |
|
|
1429 |
// ---------------------------------------------------------
|
|
1430 |
// CNotMtmUi::ApExistsL
|
|
1431 |
// Checks the existence of given access point
|
|
1432 |
// according to id.
|
|
1433 |
// ---------------------------------------------------------
|
|
1434 |
//
|
|
1435 |
EXPORT_C TBool CNotMtmUi::ApExistsL( TInt32 aAp )
|
|
1436 |
{
|
|
1437 |
return iSettingsHandler->ApExistsL( aAp );
|
|
1438 |
}
|
|
1439 |
|
|
1440 |
// ---------------------------------------------------------
|
|
1441 |
// ConstructWaitNoteLC
|
|
1442 |
// ---------------------------------------------------------
|
|
1443 |
|
|
1444 |
void CNotMtmUi::ConstructWaitNoteLC(
|
|
1445 |
TBool aVisibilityDelayOff )
|
|
1446 |
{
|
|
1447 |
delete iWaitDialog;
|
|
1448 |
iWaitDialog = NULL;
|
|
1449 |
iWaitDialog = new (ELeave) CAknWaitDialog(
|
|
1450 |
reinterpret_cast<CEikDialog**>( &iWaitDialog ),
|
|
1451 |
aVisibilityDelayOff );
|
|
1452 |
CleanupStack::PushL( TCleanupItem( CleanupWaitDialog, (TAny**)&iWaitDialog ) );
|
|
1453 |
iWaitDialog->PrepareLC( DELETING_WAIT_NOTE );
|
|
1454 |
}
|
|
1455 |
|
|
1456 |
// ---------------------------------------------------------
|
|
1457 |
// ShowWaitNoteLC
|
|
1458 |
// ---------------------------------------------------------
|
|
1459 |
|
|
1460 |
void CNotMtmUi::ShowWaitNoteLC(
|
|
1461 |
TInt aNoteTxtResourceId,
|
|
1462 |
TBool aVisibilityDelayOff )
|
|
1463 |
{
|
|
1464 |
ConstructWaitNoteLC( aVisibilityDelayOff );
|
|
1465 |
HBufC* text = StringLoader::LoadLC( aNoteTxtResourceId, iCoeEnv );
|
|
1466 |
iWaitDialog->SetTextL( *text );
|
|
1467 |
CleanupStack::PopAndDestroy( ); // text
|
|
1468 |
iWaitDialog->RunLD( );
|
|
1469 |
}
|
|
1470 |
|
|
1471 |
// ---------------------------------------------------------
|
|
1472 |
// CleanupWaitDialog
|
|
1473 |
// ---------------------------------------------------------
|
|
1474 |
//
|
|
1475 |
void CNotMtmUi::CleanupWaitDialog( TAny* aAny )
|
|
1476 |
{
|
|
1477 |
CAknWaitDialog** dialog = (CAknWaitDialog**) aAny;
|
|
1478 |
if ( dialog && *dialog )
|
|
1479 |
{
|
|
1480 |
delete *dialog;
|
|
1481 |
// Coverty fix, Forward NULL http://ousrv057/cov.cgi?cid=36247
|
|
1482 |
*dialog = NULL;
|
|
1483 |
dialog = NULL;
|
|
1484 |
}
|
|
1485 |
}
|
|
1486 |
|
|
1487 |
//--------------------------------
|
|
1488 |
// DecodeProgress
|
|
1489 |
//--------------------------------
|
|
1490 |
TInt CNotMtmUi::DecodeProgress(
|
|
1491 |
const TDesC8& /*aProgress*/,
|
|
1492 |
TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
|
|
1493 |
TInt& aTotalEntryCount,
|
|
1494 |
TInt& aEntriesDone,
|
|
1495 |
TInt& aCurrentEntrySize,
|
|
1496 |
TInt& aCurrentBytesTrans,
|
|
1497 |
TBool /*aInternal*/ )
|
|
1498 |
{
|
|
1499 |
aCurrentEntrySize = 0;
|
|
1500 |
aCurrentBytesTrans = 0;
|
|
1501 |
aEntriesDone = 0;
|
|
1502 |
aTotalEntryCount = 0;
|
|
1503 |
|
|
1504 |
if( iFlags & EDeletingFromMMBox )
|
|
1505 |
{
|
|
1506 |
StringLoader::Load( aReturnString,
|
|
1507 |
R_NOTMTM_WAIT_DELETING_REMOTE,
|
|
1508 |
iCoeEnv );
|
|
1509 |
}
|
|
1510 |
else if( iFlags & EDeletingMany )
|
|
1511 |
{
|
|
1512 |
StringLoader::Load( aReturnString,
|
|
1513 |
R_NOTMTM_WAIT_DELETING_MANY,
|
|
1514 |
iCoeEnv );
|
|
1515 |
}
|
|
1516 |
else
|
|
1517 |
{
|
|
1518 |
StringLoader::Load( aReturnString,
|
|
1519 |
R_NOTMTM_WAIT_DELETING,
|
|
1520 |
iCoeEnv );
|
|
1521 |
}
|
|
1522 |
return KErrNone;
|
|
1523 |
}
|
|
1524 |
|
|
1525 |
//--------------------------------
|
|
1526 |
// DeleteQueryRequiredByMtm
|
|
1527 |
//--------------------------------
|
|
1528 |
EXPORT_C TBool CNotMtmUi::DeleteQueryRequiredByMtm()
|
|
1529 |
{
|
|
1530 |
TBool result(EFalse);
|
|
1531 |
if( iNotUiFlags & EDeleteOptionsSupported )
|
|
1532 |
{
|
|
1533 |
return ETrue;
|
|
1534 |
}
|
|
1535 |
return result;
|
|
1536 |
}
|
|
1537 |
|
|
1538 |
//--------------------------------
|
|
1539 |
// DeleteQueryReallyNeeded
|
|
1540 |
//--------------------------------
|
|
1541 |
TBool CNotMtmUi::DeleteQueryReallyNeededL( const CMsvEntrySelection& aSelection )
|
|
1542 |
{
|
|
1543 |
TBool result( ETrue );
|
|
1544 |
if( aSelection.Count( ) == 1 )
|
|
1545 |
{
|
|
1546 |
CMsvEntry* cEntry = Session().GetEntryL( aSelection[0] );
|
|
1547 |
CleanupStack::PushL( cEntry );
|
|
1548 |
|
|
1549 |
TMsvEntry entry = cEntry->Entry( );
|
|
1550 |
|
|
1551 |
CleanupStack::PopAndDestroy(); //cEntry
|
|
1552 |
|
|
1553 |
// Delete from server is not needed if it's been deleted
|
|
1554 |
if( ( entry.iMtmData2 & KMmsOperationFetch ) // Fetch+Forward=DELETE!
|
|
1555 |
&& ( entry.iMtmData2 & KMmsOperationForward ) //
|
|
1556 |
&& ( entry.iMtmData2 & KMmsOperationFinished ) // Finished
|
|
1557 |
&& !( entry.iMtmData2 & KMmsOperationResult ) ) // Succesfully
|
|
1558 |
{ // Returns false if only one entry available
|
|
1559 |
// and it has been deleted from server already
|
|
1560 |
result = EFalse;
|
|
1561 |
}
|
|
1562 |
}
|
|
1563 |
return result;
|
|
1564 |
}
|
|
1565 |
|
|
1566 |
// ---------------------------------------------------------
|
|
1567 |
// CNotMtmUi::ShowInformationNoteL
|
|
1568 |
// ---------------------------------------------------------
|
|
1569 |
//
|
|
1570 |
void CNotMtmUi::ShowInformationNoteL( TInt aResourceID, TBool aWaiting )
|
|
1571 |
{
|
|
1572 |
HBufC* string = NULL;
|
|
1573 |
string = StringLoader::LoadLC( aResourceID, iCoeEnv );
|
|
1574 |
|
|
1575 |
CAknInformationNote* note = new ( ELeave )
|
|
1576 |
CAknInformationNote( aWaiting );
|
|
1577 |
note->ExecuteLD( *string );
|
|
1578 |
|
|
1579 |
CleanupStack::PopAndDestroy(); //string
|
|
1580 |
}
|
|
1581 |
|
|
1582 |
// End of File
|