|
1 /* |
|
2 * Copyright (c) 2005-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: CContactRetriever - Contact retriever implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "contactretriever.h" |
|
21 #include "contact.h" |
|
22 #include "contactstore.h" |
|
23 #include <mvpbksinglecontactoperationobserver.h> |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // LDAP Store namespace |
|
27 // ----------------------------------------------------------------------------- |
|
28 namespace LDAPStore { |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CContactRetriever::CContactRetriever |
|
32 // C++ default constructor can NOT contain any code, that might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CContactRetriever::CContactRetriever(CContactStore& aStore, |
|
36 MVPbkSingleContactOperationObserver& aObserver) |
|
37 : CActive(EPriorityStandard), iStore(aStore), iObserver(aObserver) |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CContactRetriever::ConstructL |
|
43 // CContactRetriever constructor for performing 2nd stage construction |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CContactRetriever::ConstructL(TInt aIndex) |
|
47 { |
|
48 CActiveScheduler::Add(this); |
|
49 // New contact |
|
50 iContact = iStore.CreateContactL(aIndex); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CContactRetriever::NewL |
|
55 // CContactRetriever two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CContactRetriever* CContactRetriever::NewL(CContactStore& aStore,TInt aIndex, |
|
59 MVPbkSingleContactOperationObserver& aObserver) |
|
60 { |
|
61 CContactRetriever* self = new (ELeave) CContactRetriever(aStore,aObserver); |
|
62 CleanupStack::PushL(self); |
|
63 self->ConstructL(aIndex); |
|
64 CleanupStack::Pop(self); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CContactRetriever::~CContactRetriever |
|
70 // CContactRetriever Destructor |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CContactRetriever::~CContactRetriever() |
|
74 { |
|
75 Cancel(); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // MVPbkContactOperation implementation |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CContactRetriever::StartL |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CContactRetriever::StartL() |
|
85 { |
|
86 TRequestStatus* status = &iStatus; |
|
87 User::RequestComplete(status,KErrNone); |
|
88 SetActive(); |
|
89 } |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CContactRetriever::Cancel |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 void CContactRetriever::Cancel() |
|
95 { |
|
96 CActive::Cancel(); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CActive implementation |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CContactRetriever::DoCancel |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CContactRetriever::DoCancel() |
|
106 { |
|
107 } |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CContactRetriever::RunL |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CContactRetriever::RunL() |
|
113 { |
|
114 // Operation completition |
|
115 iObserver.VPbkSingleContactOperationComplete(*this,iContact); |
|
116 // Ownership of contact is given above operation complete |
|
117 iContact = NULL; |
|
118 } |
|
119 |
|
120 } // End of namespace LDAPStore |
|
121 // ----------------------------------------------------------------------------- |
|
122 // End of File |
|
123 // ----------------------------------------------------------------------------- |