|
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 #ifndef CPMUCOPYFROMMMCCMD_H |
|
20 #define CPMUCOPYFROMMMCCMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <s32file.h> |
|
25 #include <MPbk2Command.h> |
|
26 #include <MVPbkContactCopyObserver.h> |
|
27 #include <MPbk2ProcessDecorator.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MPbk2ContactUiControl; |
|
31 class MVPbkContactLinkArray; |
|
32 class MVPbkContactStore; |
|
33 class CVPbkVCardEng; |
|
34 class MVPbkContactOperationBase; |
|
35 class CPbk2ApplicationServices; |
|
36 |
|
37 /** |
|
38 * Phonebook 2 MMC UI extension copy from MMC command object. |
|
39 * Responsible for copying contacts from the MMC. |
|
40 */ |
|
41 class CPmuCopyFromMmcCmd : public CActive, |
|
42 public MPbk2Command, |
|
43 private MVPbkContactCopyObserver, |
|
44 private MPbk2ProcessDecoratorObserver |
|
45 { |
|
46 public: // Construction and destruction |
|
47 |
|
48 /** |
|
49 * Creates a new instance of this class. |
|
50 * |
|
51 * @param aUiControl UI control. |
|
52 * @return A new instance of this class. |
|
53 */ |
|
54 static CPmuCopyFromMmcCmd* NewL( |
|
55 MPbk2ContactUiControl& aUiControl ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 ~CPmuCopyFromMmcCmd(); |
|
61 |
|
62 private: // From CActive |
|
63 void RunL(); |
|
64 void DoCancel(); |
|
65 TInt RunError( |
|
66 TInt aError ); |
|
67 |
|
68 public: // From MPbk2Command |
|
69 void ExecuteLD(); |
|
70 void AddObserver( |
|
71 MPbk2CommandObserver& aObserver ); |
|
72 void ResetUiControl( |
|
73 MPbk2ContactUiControl& aUiControl ); |
|
74 |
|
75 private: // From MVPbkContactCopyObserver |
|
76 void FieldAddedToContact( |
|
77 MVPbkContactOperationBase& aOperation ); |
|
78 void FieldAddingFailed( |
|
79 MVPbkContactOperationBase& aOperation, |
|
80 TInt aError ); |
|
81 void ContactsSaved( |
|
82 MVPbkContactOperationBase& aOperation, |
|
83 MVPbkContactLinkArray* aResults ); |
|
84 void ContactsSavingFailed( |
|
85 MVPbkContactOperationBase& aOperation, |
|
86 TInt aError ); |
|
87 |
|
88 private: // From MPbk2ProcessDecoratorObserver |
|
89 void ProcessDismissed( |
|
90 TInt aCancelCode ); |
|
91 |
|
92 private: // Implementation |
|
93 CPmuCopyFromMmcCmd( |
|
94 MPbk2ContactUiControl& aUiControl ); |
|
95 void ConstructL(); |
|
96 void CopyNextL(); |
|
97 void IssueRequest(); |
|
98 void ShowResultsL(); |
|
99 TBool IsDefaultStorePhoneMemoryL() const; |
|
100 void CommandCompletedL(); |
|
101 TBool ShowMemorySelectionDialogL(); |
|
102 |
|
103 private: // Data |
|
104 /// Ref: UI control |
|
105 MPbk2ContactUiControl* iUiControl; |
|
106 /// Ref: Command observer |
|
107 MPbk2CommandObserver* iCommandObserver; |
|
108 /// Ref: Target store |
|
109 MVPbkContactStore* iTargetStore; |
|
110 /// Own: Decorator for copying process |
|
111 MPbk2ProcessDecorator* iDecorator; |
|
112 /// Own: VCard engine |
|
113 CVPbkVCardEng* iVCardEngine; |
|
114 /// Own: Current asynchronous import operation |
|
115 MVPbkContactOperationBase* iImportOperation; |
|
116 /// Own: Currently copied contact |
|
117 TInt iCurrentContactIndex; |
|
118 /// Own: Count of copied contacts |
|
119 TInt iCountOfContacts; |
|
120 /// Own: Directory to import from |
|
121 CDir* iDir; |
|
122 /// Own: Stream to read from |
|
123 RFileReadStream iReadStream; |
|
124 /// Own: Command's state |
|
125 TInt iState; |
|
126 /// Own: Path to contacts in memory card |
|
127 TFileName iContactsPath; |
|
128 /// Own: A handle to app services singleton |
|
129 CPbk2ApplicationServices* iAppServices; |
|
130 /// Own: ETrue if import must check duplicates. |
|
131 TBool iCheckDuplicates; |
|
132 |
|
133 }; |
|
134 |
|
135 #endif // CPMUCOPYFROMMMCCMD_H |
|
136 |
|
137 // End of File |