1 /* |
|
2 * Copyright (c) 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: This module contains the implementation of CPEContactHandlingProxy class |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "cpecontacthandling.h" |
|
20 #include "cpecontacthandlingproxy.h" |
|
21 #include "cpecontacthandlingdummy.h" |
|
22 #include "cpecontactmatch.h" |
|
23 #include <mpedatastore.h> |
|
24 #include <e32std.h> |
|
25 #include <mpephonemodelinternal.h> |
|
26 #include <pepanic.pan> |
|
27 #include <barsc.h> |
|
28 #include <barsread.h> |
|
29 #include <talogger.h> |
|
30 #include <bldvariant.hrh> |
|
31 #include <featmgr.h> |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ======================================= |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CPEContactHandlingProxy::CreateFirstPhaseL |
|
36 // This method creates the contact handling proxy and dummy implementation |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 EXPORT_C MPEContactHandling* CPEContactHandlingProxy::CreateFirstPhaseL() |
|
40 { |
|
41 TEFLOGSTRING( KTAOBJECT, "CNT CPEContactHandlingProxy::CreateFirstPhaseL start." ); |
|
42 CPEContactHandlingProxy* self = new ( ELeave ) CPEContactHandlingProxy(); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop( self ); |
|
46 TEFLOGSTRING( KTAOBJECT, "CNT CPEContactHandlingProxy::CreateFirstPhaseL Complete." ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CPEContactHandlingProxy::CreateSecondPhaseL |
|
52 // This method creates the actual contact handling implementation |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 EXPORT_C void CPEContactHandlingProxy::CreateSecondPhaseL( |
|
56 MPEPhoneModelInternal& aModel, |
|
57 RFs& aFsSession |
|
58 ) |
|
59 { |
|
60 TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateSecondPhaseL start." ); |
|
61 iContactHandling = CPEContactHandling::NewL( aModel, aFsSession ); |
|
62 TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::CreateSecondPhaseL complete." ); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CPEContactHandlingProxy::CPEContactHandlingProxy |
|
67 // C++ default constructor can NOT contain any code, that |
|
68 // might leave. |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CPEContactHandlingProxy::CPEContactHandlingProxy() |
|
72 { |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CPEContactHandlingProxy::ConstructL |
|
77 // Symbian 2nd phase constructor can leave. |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CPEContactHandlingProxy::ConstructL() |
|
81 { |
|
82 TEFLOGSTRING( KTAOBJECT, "LOG CPEContactHandlingProxy::ConstructL" ); |
|
83 // Create an instance of the log handling dummy implementation |
|
84 iContactHandlingDummy = CPEContactHandlingDummy::NewL(); |
|
85 } |
|
86 |
|
87 // Destructor |
|
88 CPEContactHandlingProxy::~CPEContactHandlingProxy() |
|
89 { |
|
90 TEFLOGSTRING( KTAOBJECT, "LOG CPELogHandlingProxy::~CPEContactHandlingProxy" ); |
|
91 delete iContactHandling; |
|
92 delete iContactHandlingDummy; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CPEContactHandlingProxy::FindContactInfoSync |
|
97 // Calls method FindContactInfoSyncL which can leave. This leave is trapped in |
|
98 // this function. |
|
99 // (other items were commented in a header). |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 EXPORT_C TInt CPEContactHandlingProxy::FindContactInfoSync |
|
103 ( |
|
104 const TInt aCallId, |
|
105 const TPEFindContactKey aFindKey |
|
106 ) |
|
107 { |
|
108 if ( iContactHandling ) |
|
109 { |
|
110 TEFLOGSTRING( KTAINT, "CNT CPEContactHandlingProxy::FindContactInfoSync > CPEContactHandling::FindContactInfoSync" ); |
|
111 return iContactHandling->FindContactInfoSync( aCallId, aFindKey ); |
|
112 } |
|
113 else if ( iContactHandlingDummy ) |
|
114 { |
|
115 TEFLOGSTRING( KTAINT, "CNT CPEContactHandlingProxy::FindContactInfoSync > CPEContactHandlingDummy::FindContactInfoSync" ); |
|
116 return iContactHandlingDummy->FindContactInfoSync( aCallId, aFindKey ); |
|
117 } |
|
118 else |
|
119 { |
|
120 TEFLOGSTRING( KTAERROR, "CNT CPECONTACTHANDLINGPROXY::FINDCONTACTINFOSYNC ! NEITHER CONTACT HANDLING NOR CONTACT HANDLING DUMMY EXISTS" ); |
|
121 User::Invariant(); |
|
122 } |
|
123 return KErrBadHandle; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CPEContactHandlingProxy::GetSpeedDialLocation |
|
128 // Get's phone number and contact id from given location. |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C TInt CPEContactHandlingProxy::GetSpeedDialLocation( |
|
132 TInt aLocationIndex, |
|
133 TPEPhoneNumber& aNumber ) |
|
134 { |
|
135 if ( iContactHandling ) |
|
136 { |
|
137 TEFLOGSTRING( |
|
138 KTAINT, |
|
139 "CNT CPEContactHandlingProxy::GetSpeedDialLocation > CPEContactHandling::GetSpeedDialLocation" ); |
|
140 return iContactHandling->GetSpeedDialLocation( aLocationIndex, aNumber ); |
|
141 } |
|
142 else if ( iContactHandlingDummy ) |
|
143 { |
|
144 TEFLOGSTRING( |
|
145 KTAINT, |
|
146 "CNT CPEContactHandlingProxy::GetSpeedDialLocation > CPEContactHandlingDummy::GetSpeedDialLocation" ); |
|
147 return iContactHandlingDummy->GetSpeedDialLocation( |
|
148 aLocationIndex, |
|
149 aNumber ); |
|
150 } |
|
151 else |
|
152 { |
|
153 TEFLOGSTRING( |
|
154 KTAERROR, |
|
155 "CNT CPECONTACTHANDLINGPROXY::GETSPEEDDIALLOCATION ! NEITHER CONTACT HANDLING NOR CONTACT HANDLING DUMMY EXISTS" ); |
|
156 User::Invariant(); |
|
157 } |
|
158 return KErrBadHandle; |
|
159 } |
|
160 |
|
161 // ================= OTHER EXPORTED FUNCTIONS =============================== |
|
162 |
|
163 // End of File |
|