|
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: Finds voip contacts from phonebook |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <MVPbkContactOperationBase.h> |
|
20 |
|
21 #include "cphcntvoipcontactmatchstrategy.h" |
|
22 #include "mphcntvoipcontactfinder.h" |
|
23 #include "PhCntPanic.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // Constructor |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CPhCntVoipContactMatchStrategy::CPhCntVoipContactMatchStrategy( |
|
32 MPhCntVoipContactFinder& aVoipContactFinder, |
|
33 MVPbkContactFindObserver& aObserver ) : |
|
34 iVoipContactFinder( aVoipContactFinder ), |
|
35 iObserver( aObserver ) |
|
36 { |
|
37 } |
|
38 |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // Secondphase constructor |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 void CPhCntVoipContactMatchStrategy::ConstructL() |
|
45 { |
|
46 } |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // Constructor |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CPhCntVoipContactMatchStrategy* CPhCntVoipContactMatchStrategy::NewL( |
|
54 MPhCntVoipContactFinder& aVoipContactFinder, |
|
55 MVPbkContactFindObserver& aObserver ) |
|
56 { |
|
57 CPhCntVoipContactMatchStrategy* self = |
|
58 CPhCntVoipContactMatchStrategy::NewLC( aVoipContactFinder, aObserver ); |
|
59 CleanupStack::Pop( self ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // Constructor |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CPhCntVoipContactMatchStrategy* CPhCntVoipContactMatchStrategy::NewLC( |
|
69 MPhCntVoipContactFinder& aVoipContactFinder, |
|
70 MVPbkContactFindObserver& aObserver ) |
|
71 { |
|
72 CPhCntVoipContactMatchStrategy* self = |
|
73 new( ELeave ) CPhCntVoipContactMatchStrategy( |
|
74 aVoipContactFinder, aObserver ); |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // Destructor |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 CPhCntVoipContactMatchStrategy::~CPhCntVoipContactMatchStrategy() |
|
86 { |
|
87 delete iFindOperation; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // From class MPhCntContactMatchStrategy |
|
92 // Starts the find |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CPhCntVoipContactMatchStrategy::FindMatchesL( |
|
96 const TDesC& aMatchString ) |
|
97 { |
|
98 __ASSERT_ALWAYS( !iFindOperation, |
|
99 PhCntPanic( EPhCntOperationAlreadyOngoing ) ); |
|
100 iFindOperation = |
|
101 iVoipContactFinder.FindVoipContactsL( aMatchString, *this ); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // From class MVPbkContactFindObserver |
|
106 // Notification that find is done succesfully |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CPhCntVoipContactMatchStrategy::FindCompleteL( |
|
110 MVPbkContactLinkArray* aResults ) |
|
111 { |
|
112 delete iFindOperation; |
|
113 iFindOperation = NULL; |
|
114 iObserver.FindCompleteL( aResults ); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // From class MVPbkContactFindObserver |
|
119 // Notification that find failed |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CPhCntVoipContactMatchStrategy::FindFailed( |
|
123 TInt aError ) |
|
124 { |
|
125 delete iFindOperation; |
|
126 iFindOperation = NULL; |
|
127 iObserver.FindFailed( aError ); |
|
128 } |
|
129 |