|
1 /* |
|
2 * Copyright (c) 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: Triplet that contains the service id, presence status and the |
|
15 * index of the presence status icon in the listbox's icon array |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "clogspresenceindextableentry.h" |
|
23 #include "simpledebug.h" |
|
24 |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // NewL |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CLogsPresenceIndexTableEntry* CLogsPresenceIndexTableEntry::NewL( |
|
31 const TUint32 aServiceId, |
|
32 const TDesC& aPresenceStatusString, |
|
33 TInt aPresenceIconIndex ) |
|
34 { |
|
35 CLogsPresenceIndexTableEntry* self = CLogsPresenceIndexTableEntry::NewLC( |
|
36 aServiceId, |
|
37 aPresenceStatusString, |
|
38 aPresenceIconIndex ); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // NewLC |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CLogsPresenceIndexTableEntry* CLogsPresenceIndexTableEntry::NewLC( |
|
49 const TUint32 aServiceId, |
|
50 const TDesC& aPresenceStatusString, |
|
51 const TInt aPresenceIconIndex ) |
|
52 { |
|
53 CLogsPresenceIndexTableEntry* self = |
|
54 new( ELeave ) CLogsPresenceIndexTableEntry( aServiceId ); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL( aPresenceStatusString, aPresenceIconIndex ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Symbian second phase constructor |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CLogsPresenceIndexTableEntry::ConstructL( |
|
65 const TDesC& aPresenceStatusString, |
|
66 const TInt aPresenceIconIndex ) |
|
67 { |
|
68 _LOG("CLogsPresenceIndexTableEntry::ConstructL: begin") |
|
69 iPresenceStatusString = aPresenceStatusString.AllocL(); |
|
70 iPresenceIconIndex = aPresenceIconIndex; |
|
71 _LOG("CLogsPresenceIndexTableEntry::ConstructL: end") |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // Destructor |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CLogsPresenceIndexTableEntry::~CLogsPresenceIndexTableEntry() |
|
80 { |
|
81 _LOG("CLogsPresenceIndexTableEntry::~CLogsPresenceIndexTableEntry: begin") |
|
82 delete iPresenceStatusString; |
|
83 _LOG("CLogsPresenceIndexTableEntry::~CLogsPresenceIndexTableEntry: end") |
|
84 } |
|
85 |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // Constructor |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 CLogsPresenceIndexTableEntry::CLogsPresenceIndexTableEntry( |
|
92 const TUint32 aServiceId ) : iServiceId( aServiceId ) |
|
93 { |
|
94 _LOG("CLogsPresenceIndexTableEntry::CLogsPresenceIndexTableEntry: begin") |
|
95 } |
|
96 |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // Returns the service id of this index table entry. |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 TUint32 CLogsPresenceIndexTableEntry::ServiceId() const |
|
103 { |
|
104 _LOG("CLogsPresenceIndexTableEntry::ServiceId(): begin") |
|
105 return iServiceId; |
|
106 } |
|
107 |
|
108 |
|
109 // ---------------------------------------------------------------------------- |
|
110 // Returns the presence status string of this index table entry. |
|
111 // ---------------------------------------------------------------------------- |
|
112 // |
|
113 TDesC& CLogsPresenceIndexTableEntry::PresenceStatusString() const |
|
114 { |
|
115 _LOG("CLogsPresenceIndexTableEntry::PresenceStatusString(): begin") |
|
116 return *iPresenceStatusString; |
|
117 } |
|
118 |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // Returns the presence icon index of this index table entry |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 TInt CLogsPresenceIndexTableEntry::PresenceIconIndex() const |
|
125 { |
|
126 return iPresenceIconIndex; |
|
127 } |
|
128 |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // Sets the presence icon index of this index table entry |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 TInt CLogsPresenceIndexTableEntry::SetPresenceIconIndex( |
|
135 TInt aPresenceIconIndex ) |
|
136 { |
|
137 _LOG("CLogsPresenceIndexTableEntry::SetPresenceIconIndex: begin ...") |
|
138 _LOGP("...aPresenceIconIndex=%d", aPresenceIconIndex ) |
|
139 TInt error( KErrArgument ); |
|
140 if ( aPresenceIconIndex >= 0 ) |
|
141 { |
|
142 iPresenceIconIndex = aPresenceIconIndex; |
|
143 error = KErrNone; |
|
144 } |
|
145 _LOGP("CLogsPresenceIndexTableEntry::SetPresenceIconIndex: end error=%d ", |
|
146 error ) |
|
147 return error; |
|
148 } |
|
149 |