|
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: Calendar action ui |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 //debug |
|
22 #include "calendarui_debug.h" |
|
23 |
|
24 #include "calenviewinfo.h" |
|
25 |
|
26 // ---------------------------------------------------------------------------- |
|
27 // CCalenViewInfo::NewL |
|
28 // Two phased constructor. |
|
29 // ---------------------------------------------------------------------------- |
|
30 // |
|
31 EXPORT_C CCalenViewInfo* CCalenViewInfo::NewL( TUid aViewUid, |
|
32 TUid aPluginUid, |
|
33 const TDesC& aMenuName, |
|
34 const TDesC& aSettingsName, |
|
35 CCalenView::TCyclePosition aPos ) |
|
36 { |
|
37 TRACE_ENTRY_POINT; |
|
38 |
|
39 CCalenViewInfo* self = new( ELeave )CCalenViewInfo( aViewUid, |
|
40 aPluginUid, |
|
41 aPos ); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL( aMenuName, aSettingsName ); |
|
44 CleanupStack::Pop( self ); |
|
45 |
|
46 TRACE_EXIT_POINT; |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------------------------------- |
|
51 // CCalenViewInfo::CCalenViewInfo |
|
52 // C++ constructor. |
|
53 // ---------------------------------------------------------------------------- |
|
54 // |
|
55 CCalenViewInfo::CCalenViewInfo( TUid aViewUid, |
|
56 TUid aPluginUid, |
|
57 CCalenView::TCyclePosition aCyclePos ) |
|
58 : iViewUid( aViewUid ), |
|
59 iPluginUid( aPluginUid ), |
|
60 iCyclePos( aCyclePos ) |
|
61 { |
|
62 TRACE_ENTRY_POINT; |
|
63 TRACE_EXIT_POINT; |
|
64 } |
|
65 |
|
66 // ---------------------------------------------------------------------------- |
|
67 // CCalenViewInfo::ConstructL |
|
68 // Second phase of construction. |
|
69 // ---------------------------------------------------------------------------- |
|
70 // |
|
71 void CCalenViewInfo::ConstructL( const TDesC& aMenuName, |
|
72 const TDesC& aSettingsName) |
|
73 { |
|
74 TRACE_ENTRY_POINT; |
|
75 |
|
76 iMenuName = aMenuName.AllocL(); |
|
77 iSettingsName = aSettingsName.AllocL(); |
|
78 |
|
79 TRACE_EXIT_POINT; |
|
80 } |
|
81 |
|
82 // ---------------------------------------------------------------------------- |
|
83 // CCalenViewInfo::~CCalenViewInfo |
|
84 // Destructor. |
|
85 // ---------------------------------------------------------------------------- |
|
86 // |
|
87 CCalenViewInfo::~CCalenViewInfo() |
|
88 { |
|
89 TRACE_ENTRY_POINT; |
|
90 |
|
91 delete iMenuName; |
|
92 delete iSettingsName; |
|
93 |
|
94 TRACE_EXIT_POINT; |
|
95 } |
|
96 |
|
97 // ---------------------------------------------------------------------------- |
|
98 // CCalenViewInfo::ViewUid |
|
99 // UID of the view. |
|
100 // ---------------------------------------------------------------------------- |
|
101 // |
|
102 EXPORT_C TUid CCalenViewInfo::ViewUid() const |
|
103 { |
|
104 TRACE_ENTRY_POINT; |
|
105 TRACE_EXIT_POINT; |
|
106 return iViewUid; |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------------------------------- |
|
110 // CCalenViewInfo::PluginUid |
|
111 // UID of the plugin. |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TUid CCalenViewInfo::PluginUid() const |
|
115 { |
|
116 TRACE_ENTRY_POINT; |
|
117 TRACE_EXIT_POINT; |
|
118 return iPluginUid; |
|
119 } |
|
120 |
|
121 // ---------------------------------------------------------------------------- |
|
122 // CCalenViewInfo::MenuName |
|
123 // Localised view name for view cycle menu. |
|
124 // ---------------------------------------------------------------------------- |
|
125 // |
|
126 EXPORT_C const TDesC& CCalenViewInfo::MenuName() const |
|
127 { |
|
128 TRACE_ENTRY_POINT; |
|
129 TRACE_EXIT_POINT; |
|
130 return *iMenuName; |
|
131 } |
|
132 |
|
133 // ---------------------------------------------------------------------------- |
|
134 // CCalenViewInfo::SettingsName |
|
135 // Localised view name for default view setting. |
|
136 // ---------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C const TDesC& CCalenViewInfo::SettingsName() const |
|
139 { |
|
140 TRACE_ENTRY_POINT; |
|
141 TRACE_EXIT_POINT; |
|
142 return *iSettingsName; |
|
143 } |
|
144 |
|
145 // ---------------------------------------------------------------------------- |
|
146 // CCalenViewInfo::CyclePosition |
|
147 // Position the view would like to go in view cycling. |
|
148 // ---------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C CCalenView::TCyclePosition CCalenViewInfo::CyclePosition() const |
|
151 { |
|
152 TRACE_ENTRY_POINT; |
|
153 TRACE_EXIT_POINT; |
|
154 |
|
155 return ( Hidden() ? CCalenView::ENoCyclePosition : iCyclePos ); |
|
156 } |
|
157 |
|
158 // ---------------------------------------------------------------------------- |
|
159 // CCalenViewInfo::MenuName |
|
160 // Localised view name for view cycle menu. |
|
161 // ---------------------------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C TBool CCalenViewInfo::Hidden() const |
|
164 { |
|
165 TRACE_ENTRY_POINT; |
|
166 TRACE_EXIT_POINT; |
|
167 return iHidden; |
|
168 } |
|
169 |
|
170 // ---------------------------------------------------------------------------- |
|
171 // CCalenViewInfo::MenuName |
|
172 // Localised view name for view cycle menu. |
|
173 // ---------------------------------------------------------------------------- |
|
174 // |
|
175 EXPORT_C void CCalenViewInfo::Hide( TBool aHide ) |
|
176 { |
|
177 TRACE_ENTRY_POINT; |
|
178 |
|
179 iHidden = aHide; |
|
180 |
|
181 TRACE_EXIT_POINT; |
|
182 } |
|
183 |
|
184 // ---------------------------------------------------------------------------- |
|
185 // CCalenViewInfo::CyclePositionComparison |
|
186 // Compares two views based upon their cycle position |
|
187 // (other items were commented in a header). |
|
188 // ---------------------------------------------------------------------------- |
|
189 // |
|
190 EXPORT_C TInt CCalenViewInfo::CyclePositionComparison( |
|
191 const CCalenViewInfo& aFirstView, |
|
192 const CCalenViewInfo& aSecondView ) |
|
193 { |
|
194 TRACE_ENTRY_POINT; |
|
195 |
|
196 CCalenView::TCyclePosition first = aFirstView.CyclePosition(); |
|
197 CCalenView::TCyclePosition second = aSecondView.CyclePosition(); |
|
198 |
|
199 TInt returnValue( 0 ); |
|
200 if ( first < second ) |
|
201 { |
|
202 returnValue = -1; |
|
203 } |
|
204 else if ( first > second ) |
|
205 { |
|
206 returnValue = 1; |
|
207 } |
|
208 else |
|
209 { |
|
210 returnValue = 0; |
|
211 } |
|
212 |
|
213 TRACE_EXIT_POINT; |
|
214 return returnValue; |
|
215 } |
|
216 |
|
217 // ---------------------------------------------------------------------------- |
|
218 // CCalenViewInfo::ViewPluginIdentifier |
|
219 // Matches a uid and a plugin uid. Used by when finding the views offered by |
|
220 // a plugin with a given uid. |
|
221 // (other items were commented in a header). |
|
222 // ---------------------------------------------------------------------------- |
|
223 // |
|
224 EXPORT_C TBool CCalenViewInfo::ViewPluginIdentifier( const TUid* aUid, |
|
225 const CCalenViewInfo& aArrayItem ) |
|
226 { |
|
227 TRACE_ENTRY_POINT; |
|
228 TRACE_EXIT_POINT; |
|
229 |
|
230 return ( *aUid == aArrayItem.PluginUid() ); |
|
231 } |
|
232 |
|
233 // ---------------------------------------------------------------------------- |
|
234 // CCalenViewInfo::Identifier |
|
235 // Matches an uid and a view uid. |
|
236 // (other items were commented in a header). |
|
237 // ---------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C TBool CCalenViewInfo::ViewInfoIdentifier( const TUid* aUid, |
|
240 const CCalenViewInfo& aArrayItem ) |
|
241 { |
|
242 TRACE_ENTRY_POINT; |
|
243 TRACE_EXIT_POINT; |
|
244 |
|
245 return ( *aUid == aArrayItem.ViewUid() ); |
|
246 } |
|
247 |
|
248 // End of file |