1 /*! |
|
2 * Copyright (c) 2009 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: Wraps the QContact for the legacy handling in the phone engine |
|
15 */ |
|
16 |
|
17 #include <e32base.h> |
|
18 #include <utf.h> |
|
19 #include <qcontact.h> |
|
20 #include "cphcntcontactidimpl2.h" |
|
21 // --------------------------------------------------------------------------- |
|
22 // c'tor |
|
23 // --------------------------------------------------------------------------- |
|
24 // |
|
25 |
|
26 CPhCntContactIdImpl2::~CPhCntContactIdImpl2() |
|
27 { |
|
28 |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // copy c'tor |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CPhCntContactIdImpl2::CPhCntContactIdImpl2(const QContact aContact) |
|
36 :iContact(aContact), iValid(true) |
|
37 { |
|
38 |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Static constructor |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CPhCntContactIdImpl2* CPhCntContactIdImpl2::NewL(const QContact aContact) |
|
46 { |
|
47 CPhCntContactIdImpl2* self = new( ELeave ) CPhCntContactIdImpl2(aContact); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CloneL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CPhCntContactId* CPhCntContactIdImpl2::CloneL() const |
|
56 { |
|
57 return CPhCntContactIdImpl2::NewL(Contact()); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Invalidate |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 |
|
65 void CPhCntContactIdImpl2::Invalidate() |
|
66 { |
|
67 iValid = false; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // IsValid |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 TBool CPhCntContactIdImpl2::IsValid() const |
|
75 { |
|
76 return iValid; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // ContactId |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 TContactItemId CPhCntContactIdImpl2::ContactId() const |
|
84 { |
|
85 if (IsValid()) |
|
86 { |
|
87 return iContact.localId(); |
|
88 } |
|
89 else |
|
90 { |
|
91 return KErrNotFound; |
|
92 } |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // PackLC |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 HBufC8* CPhCntContactIdImpl2::PackLC() const |
|
100 |
|
101 |
|
102 { |
|
103 HBufC8* valueToReturn = NULL; |
|
104 |
|
105 if (IsValid()) |
|
106 { |
|
107 QString str; |
|
108 str.setNum(iContact.localId()); |
|
109 TPtrC16 value(str.utf16()); |
|
110 valueToReturn = CnvUtfConverter::ConvertFromUnicodeToUtf8L(value); |
|
111 CleanupStack::PushL(valueToReturn); |
|
112 } |
|
113 |
|
114 return valueToReturn; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // Contact |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 const QContact CPhCntContactIdImpl2::Contact() const |
|
122 { |
|
123 return iContact; |
|
124 } |
|
125 |
|
126 |
|
127 |
|
128 |
|