|
1 /* |
|
2 * Copyright (c) 2004-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: Statuspane related utilities. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <avkon.rsg> |
|
20 #include <AknLayout.lag> |
|
21 #include <eikspane.h> |
|
22 #include <AknSgcc.h> |
|
23 #include <layoutmetadata.cdl.h> |
|
24 #include <eikappui.h> |
|
25 #include <eikapp.h> |
|
26 |
|
27 #include "AknStatuspaneUtils.h" |
|
28 #include "aknenv.h" |
|
29 |
|
30 EXPORT_C TBool AknStatuspaneUtils::IdleLayoutActive() |
|
31 { |
|
32 TBool retVal = EFalse; |
|
33 |
|
34 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
35 |
|
36 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE || |
|
37 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT || |
|
38 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT || |
|
39 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_MIRRORED || |
|
40 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT || |
|
41 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED || |
|
42 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT || |
|
43 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT || |
|
44 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE || |
|
45 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT || |
|
46 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS ); |
|
47 |
|
48 return retVal; |
|
49 } |
|
50 |
|
51 EXPORT_C TBool AknStatuspaneUtils::UsualLayoutActive() |
|
52 { |
|
53 TBool retVal = EFalse; |
|
54 |
|
55 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
56 |
|
57 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL || |
|
58 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT || |
|
59 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT || |
|
60 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED || |
|
61 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT || |
|
62 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT || |
|
63 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL || |
|
64 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT || |
|
65 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS ); |
|
66 |
|
67 return retVal; |
|
68 } |
|
69 |
|
70 |
|
71 EXPORT_C TBool AknStatuspaneUtils::SmallLayoutActive() |
|
72 { |
|
73 TBool retVal = EFalse; |
|
74 |
|
75 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
76 |
|
77 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE || |
|
78 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED || |
|
79 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_SMALL ); |
|
80 |
|
81 return retVal; |
|
82 } |
|
83 |
|
84 EXPORT_C TBool AknStatuspaneUtils::StaconPaneActive() |
|
85 { |
|
86 TBool retVal = EFalse; |
|
87 |
|
88 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
89 |
|
90 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT || |
|
91 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT || |
|
92 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT || |
|
93 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT || |
|
94 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT || |
|
95 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT ); |
|
96 |
|
97 return retVal; |
|
98 } |
|
99 |
|
100 |
|
101 EXPORT_C TBool AknStatuspaneUtils::StaconSoftKeysLeft() |
|
102 { |
|
103 TBool retVal = EFalse; |
|
104 |
|
105 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
106 |
|
107 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT || |
|
108 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT || |
|
109 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT ); |
|
110 |
|
111 return retVal; |
|
112 } |
|
113 |
|
114 EXPORT_C TBool AknStatuspaneUtils::StaconSoftKeysRight() |
|
115 { |
|
116 TBool retVal = EFalse; |
|
117 |
|
118 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
119 |
|
120 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT || |
|
121 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT || |
|
122 currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT ) || |
|
123 ( HDLayoutActive() && currentStatusPaneLayoutResId != R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS ); |
|
124 |
|
125 return retVal; |
|
126 } |
|
127 |
|
128 EXPORT_C TBool AknStatuspaneUtils::FlatLayoutActive() |
|
129 { |
|
130 TBool retVal = EFalse; |
|
131 |
|
132 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
133 |
|
134 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT || |
|
135 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT || |
|
136 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT || |
|
137 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT || |
|
138 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS || |
|
139 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS ); |
|
140 |
|
141 return retVal; |
|
142 } |
|
143 |
|
144 EXPORT_C TBool AknStatuspaneUtils::TouchPaneCompatibleLayoutActive() |
|
145 { |
|
146 TBool retVal = EFalse; |
|
147 |
|
148 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
149 |
|
150 retVal = ( currentStatusPaneLayoutResId != R_AVKON_STATUS_PANE_LAYOUT_EMPTY && |
|
151 currentStatusPaneLayoutResId != R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE && |
|
152 currentStatusPaneLayoutResId != R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_LEFT && |
|
153 currentStatusPaneLayoutResId != R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT ); |
|
154 |
|
155 return retVal; |
|
156 } |
|
157 |
|
158 EXPORT_C TBool AknStatuspaneUtils::ExtendedLayoutActive() |
|
159 { |
|
160 TBool retVal = EFalse; |
|
161 |
|
162 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
163 |
|
164 retVal = ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT || |
|
165 currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_EXT || |
|
166 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL || |
|
167 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE ); |
|
168 |
|
169 return retVal; |
|
170 |
|
171 } |
|
172 |
|
173 |
|
174 TBool AknStatuspaneUtils::HDLayoutActive() |
|
175 { |
|
176 TBool retVal = EFalse; |
|
177 |
|
178 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
179 { |
|
180 // Can be widescreen only in landscape orientation. |
|
181 TInt currentStatusPaneLayoutResId = CurrentStatusPaneLayoutResId(); |
|
182 |
|
183 retVal = ( currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL || |
|
184 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE || |
|
185 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT || |
|
186 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT || |
|
187 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS || |
|
188 currentStatusPaneLayoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS ); |
|
189 } |
|
190 |
|
191 return retVal; |
|
192 } |
|
193 |
|
194 |
|
195 EXPORT_C TBool AknStatuspaneUtils::ExtendedStaconPaneActive() |
|
196 { |
|
197 if ( AknStatuspaneUtils::StaconPaneActive() ) |
|
198 { |
|
199 TBool smallDigitalClockShownInStacon = ETrue; |
|
200 |
|
201 // Check for small digital clock if app has no status pane. Status pane clock |
|
202 // is shown only in resolutions having aspect ratio equal or wider than qvga |
|
203 // because otherwise there is no space for it. |
|
204 TAknWindowLineLayout screenLayout = |
|
205 AknLayout::screen(); |
|
206 TRect screenRect = screenLayout.Rect(); |
|
207 |
|
208 TReal aspectRatio = TReal(screenRect.Width()) / TReal(screenRect.Height()); |
|
209 if ( aspectRatio <= 1.33 ) |
|
210 { |
|
211 smallDigitalClockShownInStacon = EFalse; |
|
212 } |
|
213 |
|
214 return smallDigitalClockShownInStacon; |
|
215 } |
|
216 else |
|
217 { |
|
218 return EFalse; |
|
219 } |
|
220 } |
|
221 |
|
222 EXPORT_C TBool AknStatuspaneUtils::ExtendedFlatLayoutActive() |
|
223 { |
|
224 if ( FlatLayoutActive() && |
|
225 Layout_Meta_Data::IsLandscapeOrientation() && |
|
226 !HDLayoutActive() ) |
|
227 { |
|
228 TBool smallDigitalClockShown = EFalse; |
|
229 |
|
230 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
231 |
|
232 if (statusPane && statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidDigitalClock)).IsInCurrentLayout()) |
|
233 { |
|
234 // Final check for small digital clock, shown only in resolutions having aspect |
|
235 // ratio equal or wider than qvga because otherwise there is no space for it. |
|
236 TAknWindowLineLayout screenLayout = |
|
237 AknLayout::screen(); |
|
238 TRect screenRect = screenLayout.Rect(); |
|
239 |
|
240 TReal aspectRatio = TReal(screenRect.Width()) / TReal(screenRect.Height()); |
|
241 if ( aspectRatio > 1.33 ) |
|
242 { |
|
243 smallDigitalClockShown = ETrue; |
|
244 } |
|
245 } |
|
246 return smallDigitalClockShown; |
|
247 } |
|
248 else |
|
249 { |
|
250 return EFalse; |
|
251 } |
|
252 } |
|
253 |
|
254 EXPORT_C TInt AknStatuspaneUtils::CurrentStatusPaneLayoutResId() |
|
255 { |
|
256 TInt resourceId = 0; |
|
257 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
258 |
|
259 if ( statusPane ) // Return the resource ID of app statuspane if it exists. |
|
260 { |
|
261 resourceId = statusPane->CurrentLayoutResId(); |
|
262 } |
|
263 else // If this app does not have statuspane, then we ask the layout from AknCapServer. |
|
264 { |
|
265 resourceId = CAknSgcClient::CurrentStatuspaneResource(); |
|
266 } |
|
267 |
|
268 return resourceId; |
|
269 } |
|
270 |
|
271 TBool AknStatuspaneUtils::IsActiveIdle() |
|
272 { |
|
273 TBool isAcIdle = EFalse; |
|
274 |
|
275 const TUid KActiveIdle2Uid = {0x102750F0}; |
|
276 CEikApplication* app = CEikonEnv::Static()->EikAppUi()->Application(); |
|
277 |
|
278 if ( app && app->AppDllUid() == KActiveIdle2Uid ) |
|
279 { |
|
280 isAcIdle = ETrue; |
|
281 } |
|
282 |
|
283 return isAcIdle; |
|
284 } |
|
285 |