|
1 /* |
|
2 * Copyright (c) 2005-2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPbk2NonTopContactSelector.h" |
|
20 #include <MVPbkBaseContact.h> |
|
21 #include <featmgr.h> |
|
22 |
|
23 // Virtual Phonebook |
|
24 #include <CVPbkTopContactManager.h> |
|
25 |
|
26 CPbk2NonTopContactSelector* CPbk2NonTopContactSelector::NewL() |
|
27 { |
|
28 CPbk2NonTopContactSelector* self = new (ELeave) CPbk2NonTopContactSelector(); |
|
29 CleanupStack::PushL( self ); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop( self ); |
|
32 return self; |
|
33 } |
|
34 |
|
35 CPbk2NonTopContactSelector::~CPbk2NonTopContactSelector() |
|
36 { |
|
37 } |
|
38 |
|
39 TBool CPbk2NonTopContactSelector::IsContactIncluded( |
|
40 const MVPbkBaseContact& aContact ) |
|
41 { |
|
42 TBool isContactIncluded( !CVPbkTopContactManager::IsTopContact( aContact ) ); |
|
43 |
|
44 if( iMyCardSupported ) |
|
45 { |
|
46 // this is temporary solution to hide own contact from phonebook contacts list, |
|
47 // TODO remove this code when we can hide own contact with contact model |
|
48 |
|
49 MVPbkBaseContact& contact = const_cast<MVPbkBaseContact&>( aContact ); |
|
50 TAny* extension = contact.BaseContactExtension( |
|
51 KVPbkBaseContactExtension2Uid ); |
|
52 |
|
53 if( isContactIncluded && extension ) |
|
54 { |
|
55 MVPbkBaseContact2* baseContactExtension = |
|
56 static_cast<MVPbkBaseContact2*>( extension ); |
|
57 TInt error( KErrNone ); |
|
58 isContactIncluded = |
|
59 ( !baseContactExtension->IsOwnContact( error ) ); |
|
60 } |
|
61 } |
|
62 |
|
63 return isContactIncluded; |
|
64 } |
|
65 |
|
66 |
|
67 CPbk2NonTopContactSelector::CPbk2NonTopContactSelector() |
|
68 { |
|
69 } |
|
70 |
|
71 void CPbk2NonTopContactSelector::ConstructL() |
|
72 { |
|
73 FeatureManager::InitializeLibL(); |
|
74 iMyCardSupported = |
|
75 FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ); |
|
76 FeatureManager::UnInitializeLib(); |
|
77 } |
|
78 |
|
79 // End of File |