|
1 /* |
|
2 * Copyright (c) 2008 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: implementation for CVIMPSTCmdAddToPbk |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cvimpstcmdaddtopbk.h" |
|
21 #include "vimpstcmd.hrh" |
|
22 #include "mvimpstcmdobserver.h" |
|
23 #include "vimpstdebugprint.h" |
|
24 |
|
25 #include <e32def.h> |
|
26 #include <MVPbkStoreContact.h> |
|
27 #include "mvimpstengine.h" |
|
28 #include "mvimpststorageserviceview.h" |
|
29 #include "cvimpststoragemanagerfactory.h" |
|
30 |
|
31 // Constants |
|
32 |
|
33 // -------------------------------------------------------------------------- |
|
34 // CVIMPSTCmdAddToPbk::CVIMPSTCmdAddToPbk |
|
35 // -------------------------------------------------------------------------- |
|
36 // |
|
37 CVIMPSTCmdAddToPbk::CVIMPSTCmdAddToPbk( const TInt aCommandId , |
|
38 const MVIMPSTStorageContact& aStoreContact, |
|
39 MVIMPSTEngine& aEngine) : |
|
40 iCommandId( aCommandId ), |
|
41 iStoreContact( aStoreContact ), |
|
42 iEngine( aEngine ) |
|
43 { |
|
44 } |
|
45 |
|
46 // -------------------------------------------------------------------------- |
|
47 // CVIMPSTCmdAddToPbk::~CVIMPSTCmdAddToPbk |
|
48 // -------------------------------------------------------------------------- |
|
49 // |
|
50 CVIMPSTCmdAddToPbk::~CVIMPSTCmdAddToPbk() |
|
51 { |
|
52 |
|
53 } |
|
54 |
|
55 // -------------------------------------------------------------------------- |
|
56 // CVIMPSTCmdAddToPbk::NewL |
|
57 // -------------------------------------------------------------------------- |
|
58 // |
|
59 CVIMPSTCmdAddToPbk* CVIMPSTCmdAddToPbk::NewL( const TInt aCommandId, |
|
60 const MVIMPSTStorageContact& aStoreContact, |
|
61 MVIMPSTEngine& aEngine) |
|
62 { |
|
63 CVIMPSTCmdAddToPbk* self = new (ELeave ) CVIMPSTCmdAddToPbk( aCommandId, aStoreContact, aEngine); |
|
64 self->ConstructL(); //use contsurctL if necessary |
|
65 return self; |
|
66 } |
|
67 // -------------------------------------------------------------------------- |
|
68 // CVIMPSTCmdAddToPbk::ConstructL |
|
69 // -------------------------------------------------------------------------- |
|
70 // |
|
71 void CVIMPSTCmdAddToPbk::ConstructL() |
|
72 { |
|
73 iError = KErrNone; |
|
74 } |
|
75 |
|
76 // -------------------------------------------------------------------------- |
|
77 // CVIMPSTCmdAddToPbk::ExecuteLD |
|
78 // -------------------------------------------------------------------------- |
|
79 // |
|
80 void CVIMPSTCmdAddToPbk::ExecuteLD() |
|
81 { |
|
82 CHAT_DP_FUNC_ENTER("CVIMPSTCmdAddToPbk::ExecuteLD"); |
|
83 //push to the cleanupstack |
|
84 CleanupStack::PushL( this ); |
|
85 MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iEngine.ServiceId()) ; |
|
86 if(storage) |
|
87 { |
|
88 //storage->AddContactToPhoneBookL(iStoreContact); |
|
89 } |
|
90 else |
|
91 { |
|
92 iError = KErrGeneral; |
|
93 } |
|
94 if(iObserver) |
|
95 { |
|
96 iObserver->CommandFinishedL(*this); |
|
97 } |
|
98 CHAT_DP_FUNC_ENTER("CVIMPSTCmdAddToPbk:: CommandFinished"); |
|
99 CleanupStack::PopAndDestroy(); |
|
100 CHAT_DP_FUNC_DONE("CVIMPSTCmdAddToPbk::ExecuteLD"); |
|
101 } |
|
102 |
|
103 |
|
104 // -------------------------------------------------------------------------- |
|
105 // CVIMPSTCmdAddToPbk::AddObserver |
|
106 // -------------------------------------------------------------------------- |
|
107 // |
|
108 void CVIMPSTCmdAddToPbk::AddObserver( MVIMPSTCmdObserver& aObserver ) |
|
109 { |
|
110 // store the observer to notify the command completion |
|
111 iObserver = &aObserver; |
|
112 } |
|
113 |
|
114 |
|
115 // -------------------------------------------------------------------------- |
|
116 // CVIMPSTCmdAddToPbk::CommandId |
|
117 // -------------------------------------------------------------------------- |
|
118 // |
|
119 TInt CVIMPSTCmdAddToPbk::CommandId() const |
|
120 { |
|
121 return iCommandId; |
|
122 } |
|
123 |
|
124 // -------------------------------------------------------------------------- |
|
125 // CVIMPSTCmdAddToPbk::Result |
|
126 // -------------------------------------------------------------------------- |
|
127 // |
|
128 TInt CVIMPSTCmdAddToPbk::Result() const |
|
129 { |
|
130 //return valid data regd the command operation |
|
131 return iError; |
|
132 } |
|
133 |
|
134 // End of File |
|
135 |