|
1 /* |
|
2 * Copyright (c) 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 of CPhCntSpeedDialContactL class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cphcntspeeddialcontactlinkfetch.h" |
|
20 #include "MPhCntContactManager.h" |
|
21 #include "MVPbkContactLinkArray.h" |
|
22 #include "MVPbkContactOperationBase.h" |
|
23 |
|
24 |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // ?description_if_needed |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CPhCntSpeedDialContactLinkFetch::CPhCntSpeedDialContactLinkFetch( |
|
33 MPhCntContactManager& aContactManager ) : |
|
34 iContactManager( aContactManager ) |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // ?description_if_needed |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 void CPhCntSpeedDialContactLinkFetch::ConstructL() |
|
44 { |
|
45 CPhCntContactLinkArrayFetch::BaseConstructL(); |
|
46 } |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // ?description_if_needed |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CPhCntSpeedDialContactLinkFetch* CPhCntSpeedDialContactLinkFetch::NewL( |
|
54 MPhCntContactManager& aContactManager ) |
|
55 { |
|
56 CPhCntSpeedDialContactLinkFetch* self = |
|
57 CPhCntSpeedDialContactLinkFetch::NewLC( aContactManager ); |
|
58 CleanupStack::Pop( self ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // ?description_if_needed |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CPhCntSpeedDialContactLinkFetch* CPhCntSpeedDialContactLinkFetch::NewLC( |
|
68 MPhCntContactManager& aContactManager ) |
|
69 { |
|
70 CPhCntSpeedDialContactLinkFetch* self = |
|
71 new( ELeave ) CPhCntSpeedDialContactLinkFetch( aContactManager ); |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL(); |
|
74 return self; |
|
75 } |
|
76 |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // ?description_if_needed |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CPhCntSpeedDialContactLinkFetch::~CPhCntSpeedDialContactLinkFetch() |
|
83 { |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // ?implementation_description |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 const MVPbkContactLink& CPhCntSpeedDialContactLinkFetch::FetchSpeedDialLinkL( |
|
91 TInt aSpeedDialPosition ) |
|
92 { |
|
93 iSpeedDialPosition = aSpeedDialPosition; |
|
94 TInt error( MakeAsyncRequest() ); |
|
95 |
|
96 delete iOperation; |
|
97 iOperation = NULL; |
|
98 |
|
99 const MVPbkContactLink* contactLink = NULL; |
|
100 if( !error ) |
|
101 { |
|
102 if( iFetchedContactLinks && iFetchedContactLinks->Count() == 1 ) |
|
103 { |
|
104 contactLink = &iFetchedContactLinks->At( 0 ); |
|
105 } |
|
106 else |
|
107 { |
|
108 delete iFetchedContactLinks; |
|
109 iFetchedContactLinks = NULL; |
|
110 error = KErrNotFound; |
|
111 } |
|
112 } |
|
113 User::LeaveIfError( error ); |
|
114 |
|
115 return *contactLink; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // From CPhCntAsyncToSync |
|
120 // ?implementation_description |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 void CPhCntSpeedDialContactLinkFetch::DoMakeAsyncRequestL() |
|
124 { |
|
125 if( !IsActive() ) |
|
126 { |
|
127 iOperation = iContactManager.RetrieveSpeedDialContactLinkL( |
|
128 iSpeedDialPosition, *this ); |
|
129 } |
|
130 else |
|
131 { |
|
132 User::Leave( KErrInUse ); |
|
133 } |
|
134 } |