author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 1 |
/* |
2 |
* Copyright (c) 2005-2007 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: Phonebook 2 MMC UI extension copy from MMC command. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include "CPmuCopyFromMmcCmd.h" |
|
20 |
||
21 |
// Phonebook2 |
|
22 |
#include <MPbk2ContactUiControl.h> |
|
23 |
#include <MPbk2CommandObserver.h> |
|
24 |
#include <Pbk2ProcessDecoratorFactory.h> |
|
25 |
#include <MPbk2ProcessDecorator.h> |
|
26 |
#include <CPbk2StoreConfiguration.h> |
|
27 |
#include <TPbk2CopyContactsResults.h> |
|
28 |
#include <MPbk2ContactNameFormatter.h> |
|
29 |
#include <CPbk2StoreProperty.h> |
|
30 |
#include <CPbk2StorePropertyArray.h> |
|
31 |
#include <CPbk2ApplicationServices.h> |
|
32 |
#include <MPbk2StoreValidityInformer.h> |
|
33 |
#include <MPbk2AppUi.h> |
|
34 |
#include <MPbk2ApplicationServices.h> |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
35 |
#include <pbk2mmcuires.rsg> |
20 | 36 |
|
37 |
// Virtual Phonebook |
|
38 |
#include <MVPbkContactOperationBase.h> |
|
39 |
#include <MVPbkStoreContact.h> |
|
40 |
#include <MVPbkContactStoreList.h> |
|
41 |
#include <CVPbkVCardEng.h> |
|
42 |
#include <CVPbkContactManager.h> |
|
43 |
#include <TVPbkContactStoreUriPtr.h> |
|
44 |
#include <MVPbkContactStore.h> |
|
45 |
#include <MVPbkContactLinkArray.h> |
|
46 |
#include <VPbkContactStoreUris.h> |
|
47 |
#include <MVPbkContactStoreProperties.h> |
|
48 |
#include <CVPbkContactStoreUriArray.h> |
|
49 |
#include <MVPbkContactStoreInfo.h> |
|
50 |
||
51 |
// System includes |
|
52 |
#include <pathinfo.h> |
|
53 |
#include <StringLoader.h> |
|
54 |
#include <aknnotewrappers.h> |
|
55 |
||
56 |
#include <AknCommonDialogsDynMem.h> |
|
57 |
#include <CAknMemorySelectionDialogMultiDrive.h> |
|
58 |
#include <driveinfo.h> |
|
59 |
||
60 |
/// Unnamed namespace for local definitions |
|
61 |
namespace { |
|
62 |
||
63 |
const TInt KZero = 0; |
|
64 |
const TInt KOneContact = 1; |
|
65 |
||
66 |
enum TPmuCopyToMmcCmdState |
|
67 |
{ |
|
68 |
EPmuCopyFromMmcCmdPrepare, |
|
69 |
EPmuCopyFromMmcCmdRun, |
|
70 |
EPmuCopyFromMmcCmdComplete |
|
71 |
}; |
|
72 |
||
73 |
#ifdef _DEBUG |
|
74 |
||
75 |
enum TPanicCode |
|
76 |
{ |
|
77 |
EExecuteLD_PreCond = 1, |
|
78 |
EPanic_CopyNextL_OOB, |
|
79 |
EPanic_Wrong_State |
|
80 |
}; |
|
81 |
||
82 |
void Panic(TInt aReason) |
|
83 |
{ |
|
84 |
_LIT(KPanicText, "CPmuCopyFromMmcCmd"); |
|
85 |
User::Panic(KPanicText, aReason); |
|
86 |
} |
|
87 |
#endif // _DEBUG |
|
88 |
||
89 |
||
90 |
/** |
|
91 |
* Shows store not available note. |
|
92 |
* |
|
93 |
* @param aStoreProperties Store properties. |
|
94 |
*/ |
|
95 |
void ShowStoreNotAvailableNoteL( CPbk2StorePropertyArray& aStoreProperties ) |
|
96 |
{ |
|
97 |
CPbk2StoreConfiguration* storeConfig = CPbk2StoreConfiguration::NewL(); |
|
98 |
CleanupStack::PushL( storeConfig ); |
|
99 |
const TDesC& uri = storeConfig->DefaultSavingStoreL().UriDes(); |
|
100 |
||
101 |
// Get the property of the default saving store |
|
102 |
const CPbk2StoreProperty* prop = |
|
103 |
aStoreProperties.FindProperty( uri ); |
|
104 |
if ( prop && prop->StoreName().Length() > 0 ) |
|
105 |
{ |
|
106 |
HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_STORE_NOT_AVAILABLE, |
|
107 |
prop->StoreName() ); |
|
108 |
CAknInformationNote* note = new(ELeave) CAknInformationNote; |
|
109 |
// Show "not available" note |
|
110 |
note->ExecuteLD( *text ); |
|
111 |
CleanupStack::PopAndDestroy( text ); |
|
112 |
} |
|
113 |
||
114 |
CleanupStack::PopAndDestroy( storeConfig ); |
|
115 |
} |
|
116 |
||
117 |
/** |
|
118 |
* Inspects is the store valid. |
|
119 |
* |
|
120 |
* @param aInformer Store validity informer. |
|
121 |
* @param aStore Store to inspect. |
|
122 |
* @return ETrue if the store is valid.s |
|
123 |
*/ |
|
124 |
TBool IsValidStoreL |
|
125 |
( MPbk2StoreValidityInformer& aInformer, MVPbkContactStore* aStore ) |
|
126 |
{ |
|
127 |
TBool isValid = EFalse; |
|
128 |
||
129 |
if ( aStore ) |
|
130 |
{ |
|
131 |
CVPbkContactStoreUriArray* currentlyValidStores = |
|
132 |
aInformer.CurrentlyValidStoresL(); |
|
133 |
TVPbkContactStoreUriPtr uri = |
|
134 |
aStore->StoreProperties().Uri(); |
|
135 |
isValid = currentlyValidStores->IsIncluded( uri ); |
|
136 |
delete currentlyValidStores; |
|
137 |
} |
|
138 |
return isValid; |
|
139 |
} |
|
140 |
||
141 |
} /// namespace |
|
142 |
||
143 |
||
144 |
// -------------------------------------------------------------------------- |
|
145 |
// CPmuCopyFromMmcCmd::CPmuCopyFromMmcCmd |
|
146 |
// -------------------------------------------------------------------------- |
|
147 |
// |
|
148 |
CPmuCopyFromMmcCmd::CPmuCopyFromMmcCmd( MPbk2ContactUiControl& aUiControl ) : |
|
149 |
CActive( EPriorityStandard ), |
|
150 |
iUiControl( &aUiControl ), |
|
151 |
iCheckDuplicates( ETrue ) |
|
152 |
{ |
|
153 |
CActiveScheduler::Add( this ); |
|
154 |
} |
|
155 |
||
156 |
// -------------------------------------------------------------------------- |
|
157 |
// CPmuCopyFromMmcCmd::~CPmuCopyFromMmcCmd |
|
158 |
// -------------------------------------------------------------------------- |
|
159 |
// |
|
160 |
CPmuCopyFromMmcCmd::~CPmuCopyFromMmcCmd() |
|
161 |
{ |
|
162 |
Cancel(); |
|
163 |
||
164 |
iReadStream.Close(); |
|
165 |
delete iDir; |
|
166 |
delete iDecorator; |
|
167 |
delete iImportOperation; |
|
168 |
delete iVCardEngine; |
|
169 |
Release( iAppServices ); |
|
170 |
} |
|
171 |
||
172 |
// -------------------------------------------------------------------------- |
|
173 |
// CPmuCopyFromMmcCmd::NewL |
|
174 |
// -------------------------------------------------------------------------- |
|
175 |
// |
|
176 |
CPmuCopyFromMmcCmd* CPmuCopyFromMmcCmd::NewL |
|
177 |
( MPbk2ContactUiControl& aUiControl ) |
|
178 |
{ |
|
179 |
CPmuCopyFromMmcCmd* self = |
|
180 |
new ( ELeave ) CPmuCopyFromMmcCmd( aUiControl ); |
|
181 |
CleanupStack::PushL( self ); |
|
182 |
self->ConstructL(); |
|
183 |
CleanupStack::Pop( self ); |
|
184 |
return self; |
|
185 |
} |
|
186 |
||
187 |
// -------------------------------------------------------------------------- |
|
188 |
// CPmuCopyFromMmcCmd::ConstructL |
|
189 |
// -------------------------------------------------------------------------- |
|
190 |
// |
|
191 |
inline void CPmuCopyFromMmcCmd::ConstructL() |
|
192 |
{ |
|
193 |
iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
194 |
||
195 |
iVCardEngine = CVPbkVCardEng::NewL |
|
196 |
( iAppServices->ContactManager() ); |
|
197 |
iDecorator = Pbk2ProcessDecoratorFactory::CreateProgressDialogDecoratorL |
|
198 |
( R_PMU_COPY_PROGRESS_NOTE, EFalse ); |
|
199 |
||
200 |
||
201 |
CPbk2StoreConfiguration* storeConfig = CPbk2StoreConfiguration::NewL(); |
|
202 |
CleanupStack::PushL( storeConfig ); |
|
203 |
iTargetStore = iAppServices->ContactManager().ContactStoresL().Find( |
|
204 |
storeConfig->DefaultSavingStoreL() ); |
|
205 |
CleanupStack::PopAndDestroy( storeConfig ); |
|
206 |
iCheckDuplicates = ( iTargetStore->StoreInfo().NumberOfContactsL() > 0 ); |
|
207 |
||
208 |
// set the default contacts path |
|
209 |
iContactsPath = PathInfo::MemoryCardContactsPath(); |
|
210 |
} |
|
211 |
||
212 |
// -------------------------------------------------------------------------- |
|
213 |
// CPmuCopyFromMmcCmd::RunL |
|
214 |
// -------------------------------------------------------------------------- |
|
215 |
// |
|
216 |
void CPmuCopyFromMmcCmd::RunL() |
|
217 |
{ |
|
218 |
switch ( iState ) |
|
219 |
{ |
|
220 |
case EPmuCopyFromMmcCmdPrepare: |
|
221 |
{ |
|
222 |
if ( iUiControl ) |
|
223 |
{ |
|
224 |
// Blank UI control to get performance improvement |
|
225 |
iUiControl->SetBlank( ETrue ); |
|
226 |
} |
|
227 |
||
228 |
iState = EPmuCopyFromMmcCmdRun; |
|
229 |
IssueRequest(); |
|
230 |
break; |
|
231 |
} |
|
232 |
||
233 |
case EPmuCopyFromMmcCmdRun: |
|
234 |
{ |
|
235 |
if ( iDir && iCurrentContactIndex < iDir->Count() ) |
|
236 |
{ |
|
237 |
CopyNextL(); |
|
238 |
} |
|
239 |
else |
|
240 |
{ |
|
241 |
// decorator calls processdismissed |
|
242 |
iDecorator->ProcessStopped(); |
|
243 |
} |
|
244 |
break; |
|
245 |
} |
|
246 |
case EPmuCopyFromMmcCmdComplete: |
|
247 |
{ |
|
248 |
CommandCompletedL(); |
|
249 |
break; |
|
250 |
} |
|
251 |
default: |
|
252 |
{ |
|
253 |
__ASSERT_DEBUG( EFalse, Panic( EPanic_Wrong_State ) ); |
|
254 |
break; |
|
255 |
} |
|
256 |
}; |
|
257 |
||
258 |
} |
|
259 |
||
260 |
// -------------------------------------------------------------------------- |
|
261 |
// CPmuCopyFromMmcCmd::DoCancel |
|
262 |
// -------------------------------------------------------------------------- |
|
263 |
// |
|
264 |
void CPmuCopyFromMmcCmd::DoCancel() |
|
265 |
{ |
|
266 |
delete iImportOperation; |
|
267 |
iImportOperation = NULL; |
|
268 |
} |
|
269 |
||
270 |
// -------------------------------------------------------------------------- |
|
271 |
// CPmuCopyFromMmcCmd::RunError |
|
272 |
// -------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
TInt CPmuCopyFromMmcCmd::RunError( TInt /*aError*/ ) |
|
275 |
{ |
|
276 |
delete iImportOperation; |
|
277 |
iImportOperation = NULL; |
|
278 |
||
279 |
// decorator calls processdismissed |
|
280 |
iDecorator->ProcessStopped(); |
|
281 |
||
282 |
return KErrNone; |
|
283 |
} |
|
284 |
||
285 |
// -------------------------------------------------------------------------- |
|
286 |
// CPmuCopyFromMmcCmd::ExecuteLD |
|
287 |
// -------------------------------------------------------------------------- |
|
288 |
// |
|
289 |
void CPmuCopyFromMmcCmd::ExecuteLD() |
|
290 |
{ |
|
291 |
__ASSERT_DEBUG( iCommandObserver, Panic( EExecuteLD_PreCond ) ); |
|
292 |
||
293 |
CleanupStack::PushL( this ); |
|
294 |
||
295 |
if ( !iTargetStore || |
|
296 |
!IsValidStoreL( iAppServices->StoreValidityInformer(), iTargetStore ) ) |
|
297 |
{ |
|
298 |
// if target store not available finish command |
|
299 |
ShowStoreNotAvailableNoteL |
|
300 |
( iAppServices->StoreProperties() ); |
|
301 |
iCommandObserver->CommandFinished(*this); |
|
302 |
} |
|
303 |
else |
|
304 |
{ |
|
305 |
if ( !ShowMemorySelectionDialogL() ) |
|
306 |
{ |
|
307 |
iCommandObserver->CommandFinished(*this); |
|
308 |
} |
|
309 |
else |
|
310 |
{ |
|
311 |
iAppServices->ContactManager(). |
|
312 |
FsSession().GetDir( |
|
313 |
iContactsPath, |
|
314 |
KEntryAttNormal | KEntryAttMatchMask, |
|
315 |
ESortNone, |
|
316 |
iDir ); |
|
317 |
||
318 |
if ( iDir ) |
|
319 |
{ |
|
320 |
iDecorator->ProcessStartedL( iDir->Count() ); |
|
321 |
iDecorator->SetObserver( *this ); |
|
322 |
iCurrentContactIndex = 0; |
|
323 |
iCountOfContacts = 0; |
|
324 |
iState = EPmuCopyFromMmcCmdPrepare; |
|
325 |
IssueRequest(); |
|
326 |
} |
|
327 |
else |
|
328 |
{ |
|
329 |
ShowResultsL(); |
|
330 |
iCommandObserver->CommandFinished( *this ); |
|
331 |
} |
|
332 |
} |
|
333 |
} |
|
334 |
||
335 |
CleanupStack::Pop(this); |
|
336 |
} |
|
337 |
||
338 |
// -------------------------------------------------------------------------- |
|
339 |
// CPmuCopyFromMmcCmd::AddObserver |
|
340 |
// -------------------------------------------------------------------------- |
|
341 |
// |
|
342 |
void CPmuCopyFromMmcCmd::AddObserver( MPbk2CommandObserver& aObserver ) |
|
343 |
{ |
|
344 |
iCommandObserver = &aObserver; |
|
345 |
} |
|
346 |
||
347 |
// -------------------------------------------------------------------------- |
|
348 |
// CPmuCopyFromMmcCmd::ResetUiControl |
|
349 |
// -------------------------------------------------------------------------- |
|
350 |
// |
|
351 |
void CPmuCopyFromMmcCmd::ResetUiControl( MPbk2ContactUiControl& aUiControl ) |
|
352 |
{ |
|
353 |
if ( iUiControl == &aUiControl ) |
|
354 |
{ |
|
355 |
iUiControl->SetBlank( EFalse ); |
|
356 |
iUiControl = NULL; |
|
357 |
} |
|
358 |
} |
|
359 |
||
360 |
// -------------------------------------------------------------------------- |
|
361 |
// CPmuCopyFromMmcCmd::FieldAddedToContact |
|
362 |
// -------------------------------------------------------------------------- |
|
363 |
// |
|
364 |
void CPmuCopyFromMmcCmd::FieldAddedToContact |
|
365 |
( MVPbkContactOperationBase& /*aOperation*/ ) |
|
366 |
{ |
|
367 |
// This command does not operate on contact field level |
|
368 |
} |
|
369 |
||
370 |
// -------------------------------------------------------------------------- |
|
371 |
// CPmuCopyFromMmcCmd::FieldAddingFailed |
|
372 |
// -------------------------------------------------------------------------- |
|
373 |
// |
|
374 |
void CPmuCopyFromMmcCmd::FieldAddingFailed |
|
375 |
( MVPbkContactOperationBase& /*aOperation*/, TInt /*aError*/ ) |
|
376 |
{ |
|
377 |
// This command does not operate on contact field level |
|
378 |
} |
|
379 |
||
380 |
// -------------------------------------------------------------------------- |
|
381 |
// CPmuCopyFromMmcCmd::ContactsSaved |
|
382 |
// -------------------------------------------------------------------------- |
|
383 |
// |
|
384 |
void CPmuCopyFromMmcCmd::ContactsSaved |
|
385 |
( MVPbkContactOperationBase& aOperation, |
|
386 |
MVPbkContactLinkArray* aResults ) |
|
387 |
{ |
|
388 |
if ( &aOperation == iImportOperation ) |
|
389 |
{ |
|
390 |
++iCountOfContacts; |
|
391 |
||
392 |
delete iImportOperation; |
|
393 |
iImportOperation = NULL; |
|
394 |
iReadStream.Close(); |
|
395 |
IssueRequest(); |
|
396 |
delete aResults; |
|
397 |
} |
|
398 |
} |
|
399 |
||
400 |
// -------------------------------------------------------------------------- |
|
401 |
// CPmuCopyFromMmcCmd::ContactsSavingFailed |
|
402 |
// -------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
void CPmuCopyFromMmcCmd::ContactsSavingFailed |
|
405 |
( MVPbkContactOperationBase& aOperation, TInt aError ) |
|
406 |
{ |
|
407 |
// Stop copying if the disk is full |
|
408 |
if ( aError == KErrDiskFull ) |
|
409 |
{ |
|
410 |
RunError( aError ); |
|
411 |
} |
|
412 |
else if ( &aOperation == iImportOperation ) |
|
413 |
{ |
|
414 |
delete iImportOperation; |
|
415 |
iImportOperation = NULL; |
|
416 |
iReadStream.Close(); |
|
417 |
IssueRequest(); |
|
418 |
} |
|
419 |
} |
|
420 |
||
421 |
// -------------------------------------------------------------------------- |
|
422 |
// CPmuCopyFromMmcCmd::ProcessDismissed |
|
423 |
// -------------------------------------------------------------------------- |
|
424 |
// |
|
425 |
void CPmuCopyFromMmcCmd::ProcessDismissed( TInt /*aCancelCode*/ ) |
|
426 |
{ |
|
427 |
Cancel(); |
|
428 |
||
429 |
delete iImportOperation; |
|
430 |
iImportOperation = NULL; |
|
431 |
iState = EPmuCopyFromMmcCmdComplete; |
|
432 |
IssueRequest(); |
|
433 |
} |
|
434 |
||
435 |
||
436 |
// -------------------------------------------------------------------------- |
|
437 |
// CPmuCopyFromMmcCmd::CopyNextL |
|
438 |
// -------------------------------------------------------------------------- |
|
439 |
// |
|
440 |
void CPmuCopyFromMmcCmd::CopyNextL() |
|
441 |
{ |
|
442 |
__ASSERT_DEBUG( iDir->Count() > iCurrentContactIndex, |
|
443 |
Panic( EPanic_CopyNextL_OOB ) ); |
|
444 |
||
445 |
TParse parse; |
|
446 |
parse.Set(( *iDir )[iCurrentContactIndex].iName, |
|
447 |
&iContactsPath, |
|
448 |
NULL ); |
|
449 |
||
450 |
User::LeaveIfError( |
|
451 |
iReadStream.Open( iAppServices->ContactManager().FsSession(), |
|
452 |
parse.FullName(), EFileRead ) ); |
|
453 |
||
454 |
// Duplicate checking is one of the major performance bottlenecks in |
|
455 |
// contact importing. ImportVCardForSyncL ignores the duplicate check so |
|
456 |
// it is used if the target store is empty before importing. |
|
457 |
if ( iCheckDuplicates ) |
|
458 |
{ |
|
459 |
iImportOperation = |
|
460 |
iVCardEngine->ImportVCardL( *iTargetStore, iReadStream, *this ); |
|
461 |
} |
|
462 |
else |
|
463 |
{ |
|
464 |
iImportOperation = |
|
465 |
iVCardEngine->ImportVCardForSyncL( *iTargetStore, iReadStream, *this ); |
|
466 |
} |
|
467 |
++iCurrentContactIndex; |
|
468 |
iDecorator->ProcessAdvance( 1 ); |
|
469 |
} |
|
470 |
||
471 |
// -------------------------------------------------------------------------- |
|
472 |
// CPmuCopyFromMmcCmd::IssueRequest |
|
473 |
// -------------------------------------------------------------------------- |
|
474 |
// |
|
475 |
void CPmuCopyFromMmcCmd::IssueRequest() |
|
476 |
{ |
|
477 |
if ( !IsActive() ) |
|
478 |
{ |
|
479 |
TRequestStatus* status = &iStatus; |
|
480 |
User::RequestComplete( status, KErrNone ); |
|
481 |
SetActive(); |
|
482 |
} |
|
483 |
} |
|
484 |
||
485 |
// -------------------------------------------------------------------------- |
|
486 |
// CPmuCopyFromMmcCmd::ShowResultsL |
|
487 |
// -------------------------------------------------------------------------- |
|
488 |
// |
|
489 |
void CPmuCopyFromMmcCmd::ShowResultsL() |
|
490 |
{ |
|
491 |
if ( iDir ) |
|
492 |
{ |
|
493 |
const TInt contactCount = iDir->Count(); |
|
494 |
if ( contactCount == KOneContact ) |
|
495 |
{ |
|
496 |
TParse parse; |
|
497 |
parse.Set( ( *iDir )[0].iName, |
|
498 |
&iContactsPath, |
|
499 |
NULL ); |
|
500 |
||
501 |
TPbk2CopyContactsResults results |
|
502 |
( iCountOfContacts, parse.Name() ); |
|
503 |
// If default saving store is not phone memory, show different |
|
504 |
// after copy note |
|
505 |
if ( !IsDefaultStorePhoneMemoryL() ) |
|
506 |
{ |
|
507 |
results.SetOneContactCopiedTextRes |
|
508 |
( R_QTN_PBCOP_NOTE_CONTACT_COPIED_PB2 ); |
|
509 |
} |
|
510 |
results.ShowNoteL(); |
|
511 |
} |
|
512 |
else |
|
513 |
{ |
|
514 |
TPbk2CopyContactsResults results( |
|
515 |
iCountOfContacts, iDir->Count() ); |
|
516 |
// If default saving store is not phone memory, show different |
|
517 |
// after copy note |
|
518 |
if ( !IsDefaultStorePhoneMemoryL() ) |
|
519 |
{ |
|
520 |
results.SetMultipleContactsCopiedTextRes |
|
521 |
( R_QTN_PBCOP_NOTE_N_ENTRY_COPY_PB ); |
|
522 |
} |
|
523 |
results.ShowNoteL(); |
|
524 |
} |
|
525 |
} |
|
526 |
else |
|
527 |
{ |
|
528 |
// The directory did not found, so the card migth be formatted. |
|
529 |
// Show "0 copied" note |
|
530 |
TPbk2CopyContactsResults results( |
|
531 |
iCountOfContacts, KZero ); |
|
532 |
// If default saving store is not phone memory, show different |
|
533 |
// after copy note |
|
534 |
if ( !IsDefaultStorePhoneMemoryL() ) |
|
535 |
{ |
|
536 |
results.SetMultipleContactsCopiedTextRes |
|
537 |
( R_QTN_PBCOP_NOTE_N_ENTRY_COPY_PB ); |
|
538 |
} |
|
539 |
results.ShowNoteL(); |
|
540 |
} |
|
541 |
} |
|
542 |
||
543 |
// -------------------------------------------------------------------------- |
|
544 |
// CPmuCopyFromMmcCmd::IsDefaultStorePhoneMemoryL |
|
545 |
// -------------------------------------------------------------------------- |
|
546 |
// |
|
547 |
TBool CPmuCopyFromMmcCmd::IsDefaultStorePhoneMemoryL() const |
|
548 |
{ |
|
549 |
TBool ret = EFalse; |
|
550 |
||
551 |
const TVPbkContactStoreUriPtr uri = |
|
552 |
iAppServices->StoreConfiguration().DefaultSavingStoreL(); |
|
553 |
||
554 |
TVPbkContactStoreUriPtr phoneMemoryUri |
|
555 |
( VPbkContactStoreUris::DefaultCntDbUri() ); |
|
556 |
||
557 |
if ( uri.Compare( phoneMemoryUri, |
|
558 |
TVPbkContactStoreUriPtr::EContactStoreUriStoreType ) == 0 ) |
|
559 |
{ |
|
560 |
ret = ETrue; |
|
561 |
} |
|
562 |
||
563 |
return ret; |
|
564 |
} |
|
565 |
||
566 |
// -------------------------------------------------------------------------- |
|
567 |
// CPmuCopyFromMmcCmd::CommandCompletedL |
|
568 |
// -------------------------------------------------------------------------- |
|
569 |
// |
|
570 |
void CPmuCopyFromMmcCmd::CommandCompletedL() |
|
571 |
{ |
|
572 |
if (iUiControl) |
|
573 |
{ |
|
574 |
iUiControl->SetBlank( EFalse ); |
|
575 |
} |
|
576 |
||
577 |
ShowResultsL(); |
|
578 |
||
579 |
if (iUiControl) |
|
580 |
{ |
|
581 |
iUiControl->UpdateAfterCommandExecution(); |
|
582 |
} |
|
583 |
||
584 |
if ( iCommandObserver ) |
|
585 |
{ |
|
586 |
iCommandObserver->CommandFinished( *this ); |
|
587 |
} |
|
588 |
} |
|
589 |
||
590 |
// -------------------------------------------------------------------------- |
|
591 |
// CPmuCopyFromMmcCmd::ShowMemorySelectionDialogL |
|
592 |
// -------------------------------------------------------------------------- |
|
593 |
// |
|
594 |
TBool CPmuCopyFromMmcCmd::ShowMemorySelectionDialogL() |
|
595 |
{ |
|
596 |
TBool driveSelected( EFalse ); |
|
597 |
||
598 |
TDriveNumber selectedMem; |
|
599 |
CAknMemorySelectionDialogMultiDrive* dlg = |
|
600 |
CAknMemorySelectionDialogMultiDrive::NewL( |
|
601 |
ECFDDialogTypeSelect, |
|
602 |
R_PHONEBOOK2_MEMORY_SELECTION_DIALOG, |
|
603 |
EFalse, |
|
604 |
AknCommonDialogsDynMem::EMemoryTypeMMCExternal | |
|
605 |
AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage ); |
|
606 |
CleanupStack::PushL( dlg ); |
|
607 |
driveSelected = dlg->ExecuteL( selectedMem ); |
|
608 |
CleanupStack::PopAndDestroy(); // dlg |
|
609 |
||
610 |
// If user didn't cancel the selection |
|
611 |
if ( driveSelected ) |
|
612 |
{ |
|
613 |
TInt err = PathInfo::GetFullPath |
|
614 |
( iContactsPath, selectedMem, |
|
615 |
PathInfo::EMemoryCardContactsPath ); |
|
616 |
User::LeaveIfError( err ); |
|
617 |
} |
|
618 |
||
619 |
return driveSelected; |
|
620 |
} |
|
621 |
// End of File |