33 // --------------------------------------------------------------------------- |
32 // --------------------------------------------------------------------------- |
34 // |
33 // |
35 EXPORT_C void AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( |
34 EXPORT_C void AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( |
36 MObjectProvider* aMenuBarOwner ) |
35 MObjectProvider* aMenuBarOwner ) |
37 { |
36 { |
38 _AKNTRACE_FUNC_ENTER; |
37 if ( AppUiSingleClickCompatible() ) |
39 |
38 { |
40 AknItemActionMenuRegister* instance( Instance() ); |
39 AknItemActionMenuRegister* instance( Instance() ); |
41 |
40 if ( instance ) |
42 if ( instance ) |
41 { |
43 { |
42 instance->iMenuBarOwner = aMenuBarOwner; |
44 instance->iMenuBarOwner = aMenuBarOwner; |
43 } |
45 } |
44 } |
46 |
|
47 _AKNTRACE_FUNC_EXIT; |
|
48 } |
45 } |
49 |
46 |
50 |
47 |
51 // --------------------------------------------------------------------------- |
48 // --------------------------------------------------------------------------- |
52 // AknItemActionMenuRegister::SetOverridingMenuBarOwnerL |
49 // AknItemActionMenuRegister::SetOverridingMenuBarOwnerL |
53 // --------------------------------------------------------------------------- |
50 // --------------------------------------------------------------------------- |
54 // |
51 // |
55 EXPORT_C void AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( |
52 EXPORT_C void AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( |
56 MObjectProvider* aMenuBarOwner, TUint /*aFlags*/ ) |
53 MObjectProvider* aMenuBarOwner, TUint /*aFlags*/ ) |
57 { |
54 { |
58 _AKNTRACE_FUNC_ENTER; |
|
59 |
|
60 if ( AppUiSingleClickCompatible() ) |
55 if ( AppUiSingleClickCompatible() ) |
61 { |
56 { |
62 AknItemActionMenuRegister* instance( Instance() ); |
57 AknItemActionMenuRegister* instance( Instance() ); |
63 if ( instance ) |
58 if ( instance ) |
64 { |
59 { |
65 instance->iOverridingMenuBarOwner = aMenuBarOwner; |
60 instance->iOverridingMenuBarOwner = aMenuBarOwner; |
66 } |
61 } |
67 } |
62 } |
68 |
|
69 _AKNTRACE_FUNC_EXIT; |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // AknItemActionMenuRegister::RemoveConstructingMenuBarOwner |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C void AknItemActionMenuRegister::RemoveConstructingMenuBarOwner( |
|
78 MObjectProvider* aMenuBarOwner ) |
|
79 { |
|
80 _AKNTRACE_FUNC_ENTER; |
|
81 |
|
82 if ( AppUiSingleClickCompatible() ) |
|
83 { |
|
84 AknItemActionMenuRegister* instance( Instance() ); |
|
85 |
|
86 if ( instance ) |
|
87 { |
|
88 instance->DoRemoveConstructingMenuBarOwner( aMenuBarOwner ); |
|
89 } |
|
90 } |
|
91 |
|
92 _AKNTRACE_FUNC_EXIT; |
|
93 } |
63 } |
94 |
64 |
95 |
65 |
96 // --------------------------------------------------------------------------- |
66 // --------------------------------------------------------------------------- |
97 // AknItemActionMenuRegister::RegisterCollectionL |
67 // AknItemActionMenuRegister::RegisterCollectionL |
98 // --------------------------------------------------------------------------- |
68 // --------------------------------------------------------------------------- |
99 // |
69 // |
100 CAknItemActionMenu* AknItemActionMenuRegister::RegisterCollectionL( |
70 CAknItemActionMenu* AknItemActionMenuRegister::RegisterCollectionL( |
101 MAknCollection& aCollectionState, MObjectProvider* aMenuBarOwner ) |
71 MAknCollection& aCollectionState ) |
102 { |
72 { |
103 _AKNTRACE_FUNC_ENTER; |
|
104 |
|
105 CAknItemActionMenu* menu( NULL ); |
73 CAknItemActionMenu* menu( NULL ); |
106 if ( AppUiSingleClickCompatible() ) |
74 if ( AppUiSingleClickCompatible() ) |
107 { |
75 { |
108 AknItemActionMenuRegister* instance( Instance() ); |
76 AknItemActionMenuRegister* instance( Instance() ); |
109 if ( instance ) |
77 if ( instance ) |
110 { |
78 { |
111 menu = instance->DoRegisterCollectionL( |
79 menu = instance->DoRegisterCollectionL( aCollectionState ); |
112 aCollectionState, aMenuBarOwner ); |
80 } |
113 } |
81 } |
114 } |
|
115 |
|
116 _AKNTRACE_FUNC_EXIT; |
|
117 return menu; |
82 return menu; |
118 } |
83 } |
119 |
84 |
120 |
85 |
121 // --------------------------------------------------------------------------- |
86 // --------------------------------------------------------------------------- |
123 // --------------------------------------------------------------------------- |
88 // --------------------------------------------------------------------------- |
124 // |
89 // |
125 void AknItemActionMenuRegister::RegisterMenuBarL( |
90 void AknItemActionMenuRegister::RegisterMenuBarL( |
126 CEikMenuBar& aMenuBar ) |
91 CEikMenuBar& aMenuBar ) |
127 { |
92 { |
128 _AKNTRACE_FUNC_ENTER; |
|
129 |
|
130 if ( AppUiSingleClickCompatible() ) |
93 if ( AppUiSingleClickCompatible() ) |
131 { |
94 { |
132 AknItemActionMenuRegister* instance( Instance() ); |
95 AknItemActionMenuRegister* instance( Instance() ); |
133 if ( instance ) |
96 if ( instance ) |
134 { |
97 { |
135 instance->DoRegisterMenuBarL( aMenuBar ); |
98 instance->DoRegisterMenuBarL( aMenuBar ); |
136 } |
99 } |
137 } |
100 } |
138 |
|
139 _AKNTRACE_FUNC_EXIT; |
|
140 } |
101 } |
141 |
102 |
142 |
103 |
143 // --------------------------------------------------------------------------- |
104 // --------------------------------------------------------------------------- |
144 // AknItemActionMenuRegister::UnregisterMenuBar |
105 // AknItemActionMenuRegister::UnregisterMenuBar |
145 // --------------------------------------------------------------------------- |
106 // --------------------------------------------------------------------------- |
146 // |
107 // |
147 void AknItemActionMenuRegister::UnregisterMenuBar( |
108 void AknItemActionMenuRegister::UnregisterMenuBar( |
148 CEikMenuBar& aMenuBar ) |
109 CEikMenuBar& aMenuBar ) |
149 { |
110 { |
150 _AKNTRACE_FUNC_ENTER; |
|
151 |
|
152 if ( AppUiSingleClickCompatible() ) |
111 if ( AppUiSingleClickCompatible() ) |
153 { |
112 { |
154 AknItemActionMenuRegister* instance( Instance() ); |
113 AknItemActionMenuRegister* instance( Instance() ); |
155 if ( instance ) |
114 if ( instance ) |
156 { |
115 { |
157 instance->DoUnregisterMenuBar( aMenuBar ); |
116 instance->DoUnregisterMenuBar( aMenuBar ); |
158 } |
117 } |
159 } |
118 } |
160 |
119 } |
161 _AKNTRACE_FUNC_EXIT; |
|
162 } |
|
163 |
120 |
164 |
121 |
165 // --------------------------------------------------------------------------- |
122 // --------------------------------------------------------------------------- |
166 // AknItemActionMenuRegister::RegisterItemActionMenuL |
123 // AknItemActionMenuRegister::RegisterItemActionMenuL |
167 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
168 // |
125 // |
169 void AknItemActionMenuRegister::RegisterItemActionMenuL( |
126 void AknItemActionMenuRegister::RegisterItemActionMenuL( |
170 CAknItemActionMenu& aItemActionMenu ) |
127 CAknItemActionMenu& aItemActionMenu ) |
171 { |
128 { |
172 _AKNTRACE_FUNC_ENTER; |
|
173 |
|
174 AknItemActionMenuRegister* instance( Instance() ); |
129 AknItemActionMenuRegister* instance( Instance() ); |
175 if ( instance ) |
130 if ( instance ) |
176 { |
131 { |
177 instance->DoRegisterItemActionMenuL( aItemActionMenu ); |
132 instance->DoRegisterItemActionMenuL( aItemActionMenu ); |
178 } |
133 } |
179 |
|
180 _AKNTRACE_FUNC_EXIT; |
|
181 } |
134 } |
182 |
135 |
183 |
136 |
184 // --------------------------------------------------------------------------- |
137 // --------------------------------------------------------------------------- |
185 // AknItemActionMenuRegister::UnregisterItemActionMenu |
138 // AknItemActionMenuRegister::UnregisterItemActionMenu |
186 // --------------------------------------------------------------------------- |
139 // --------------------------------------------------------------------------- |
187 // |
140 // |
188 void AknItemActionMenuRegister::UnregisterItemActionMenu( |
141 void AknItemActionMenuRegister::UnregisterItemActionMenu( |
189 CAknItemActionMenu& aItemActionMenu ) |
142 CAknItemActionMenu& aItemActionMenu ) |
190 { |
143 { |
191 _AKNTRACE_FUNC_ENTER; |
|
192 |
|
193 if ( AppUiSingleClickCompatible() ) |
144 if ( AppUiSingleClickCompatible() ) |
194 { |
145 { |
195 AknItemActionMenuRegister* instance( Instance() ); |
146 AknItemActionMenuRegister* instance( Instance() ); |
196 if ( instance ) |
147 if ( instance ) |
197 { |
148 { |
198 instance->DoUnregisterItemActionMenu( aItemActionMenu ); |
149 instance->DoUnregisterItemActionMenu( aItemActionMenu ); |
199 } |
150 } |
200 } |
151 } |
201 |
|
202 _AKNTRACE_FUNC_EXIT; |
|
203 } |
152 } |
204 |
153 |
205 |
154 |
206 // --------------------------------------------------------------------------- |
155 // --------------------------------------------------------------------------- |
207 // AknItemActionMenuRegister::RegisterCollectionObserverL |
156 // AknItemActionMenuRegister::RegisterCollectionObserverL |
208 // --------------------------------------------------------------------------- |
157 // --------------------------------------------------------------------------- |
209 // |
158 // |
210 void AknItemActionMenuRegister::RegisterCollectionObserverL( |
159 void AknItemActionMenuRegister::RegisterCollectionObserverL( |
211 MAknCollectionObserver& aObserver ) |
160 MAknCollectionObserver& aObserver ) |
212 { |
161 { |
213 _AKNTRACE_FUNC_ENTER; |
|
214 |
|
215 if ( AppUiSingleClickCompatible() ) |
162 if ( AppUiSingleClickCompatible() ) |
216 { |
163 { |
217 AknItemActionMenuRegister* instance( Instance() ); |
164 AknItemActionMenuRegister* instance( Instance() ); |
218 if ( instance ) |
165 if ( instance ) |
219 { |
166 { |
220 instance->DoRegisterCollectionObserverL( aObserver ); |
167 instance->DoRegisterCollectionObserverL( aObserver ); |
221 } |
168 } |
222 } |
169 } |
223 |
|
224 _AKNTRACE_FUNC_EXIT; |
|
225 } |
170 } |
226 |
171 |
227 |
172 |
228 // --------------------------------------------------------------------------- |
173 // --------------------------------------------------------------------------- |
229 // AknItemActionMenuRegister::UnregisterCollectionObserver |
174 // AknItemActionMenuRegister::UnregisterCollectionObserver |
230 // --------------------------------------------------------------------------- |
175 // --------------------------------------------------------------------------- |
231 // |
176 // |
232 void AknItemActionMenuRegister::UnregisterCollectionObserver( |
177 void AknItemActionMenuRegister::UnregisterCollectionObserver( |
233 MAknCollectionObserver& aObserver ) |
178 MAknCollectionObserver& aObserver ) |
234 { |
179 { |
235 _AKNTRACE_FUNC_ENTER; |
|
236 |
|
237 if ( AppUiSingleClickCompatible() ) |
180 if ( AppUiSingleClickCompatible() ) |
238 { |
181 { |
239 AknItemActionMenuRegister* instance( Instance() ); |
182 AknItemActionMenuRegister* instance( Instance() ); |
240 if ( instance ) |
183 if ( instance ) |
241 { |
184 { |
242 instance->DoUnregisterCollectionObserver( aObserver ); |
185 instance->DoUnregisterCollectionObserver( aObserver ); |
243 } |
186 } |
244 } |
187 } |
245 |
|
246 _AKNTRACE_FUNC_EXIT; |
|
247 } |
188 } |
248 |
189 |
249 |
190 |
250 // --------------------------------------------------------------------------- |
191 // --------------------------------------------------------------------------- |
251 // AknItemActionMenuRegister::~AknItemActionMenuRegister |
192 // AknItemActionMenuRegister::~AknItemActionMenuRegister |
252 // --------------------------------------------------------------------------- |
193 // --------------------------------------------------------------------------- |
253 // |
194 // |
254 AknItemActionMenuRegister::~AknItemActionMenuRegister() |
195 AknItemActionMenuRegister::~AknItemActionMenuRegister() |
255 { |
196 { |
256 _AKNTRACE_FUNC_ENTER; |
|
257 |
|
258 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
197 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
259 { |
198 { |
260 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
199 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
261 delete data.iMenu; |
200 delete data.iMenu; |
262 data.iMenu = NULL; |
201 data.iMenu = NULL; |
263 } |
202 } |
264 iUnregisteredMenus.Close(); |
203 iUnregisteredMenus.Close(); |
265 iUnregisteredObservers.Close(); |
204 iUnregisteredObservers.Close(); |
266 delete iRegisterArray; |
205 delete iRegisterArray; |
267 |
|
268 _AKNTRACE_FUNC_EXIT; |
|
269 } |
206 } |
270 |
207 |
271 |
208 |
272 // --------------------------------------------------------------------------- |
209 // --------------------------------------------------------------------------- |
273 // AknItemActionMenuRegister::AknItemActionMenuRegister |
210 // AknItemActionMenuRegister::AknItemActionMenuRegister |
275 // |
212 // |
276 AknItemActionMenuRegister::AknItemActionMenuRegister() |
213 AknItemActionMenuRegister::AknItemActionMenuRegister() |
277 : CCoeStatic( KAknItemActionMenuRegister, KRegisterDestructionPriority ), |
214 : CCoeStatic( KAknItemActionMenuRegister, KRegisterDestructionPriority ), |
278 iMenuBarOwner( NULL ) |
215 iMenuBarOwner( NULL ) |
279 { |
216 { |
280 _AKNTRACE_FUNC_ENTER; |
|
281 _AKNTRACE_FUNC_EXIT; |
|
282 } |
217 } |
283 |
218 |
284 |
219 |
285 // --------------------------------------------------------------------------- |
220 // --------------------------------------------------------------------------- |
286 // AknItemActionMenuRegister::ConstructL |
221 // AknItemActionMenuRegister::ConstructL |
287 // --------------------------------------------------------------------------- |
222 // --------------------------------------------------------------------------- |
288 // |
223 // |
289 void AknItemActionMenuRegister::ConstructL() |
224 void AknItemActionMenuRegister::ConstructL() |
290 { |
225 { |
291 _AKNTRACE_FUNC_ENTER; |
|
292 |
|
293 iRegisterArray = CAknItemActionMenuRegisterArray::NewL(); |
226 iRegisterArray = CAknItemActionMenuRegisterArray::NewL(); |
294 |
|
295 _AKNTRACE_FUNC_EXIT; |
|
296 } |
227 } |
297 |
228 |
298 |
229 |
299 // --------------------------------------------------------------------------- |
230 // --------------------------------------------------------------------------- |
300 // AknItemActionMenuRegister::AppUiSingleClickCompatible |
231 // AknItemActionMenuRegister::AppUiSingleClickCompatible |
301 // --------------------------------------------------------------------------- |
232 // --------------------------------------------------------------------------- |
302 // |
233 // |
303 TBool AknItemActionMenuRegister::AppUiSingleClickCompatible() |
234 TBool AknItemActionMenuRegister::AppUiSingleClickCompatible() |
304 { |
235 { |
305 _AKNTRACE_FUNC_ENTER; |
236 CAknAppUi* appUi = |
306 |
237 static_cast<CAknAppUi*>( CEikonEnv::Static()->AppUi() ); |
307 TBool isCompatible = EFalse; |
238 return appUi->IsSingleClickCompatible(); |
308 CAknAppUi* appUi = AppUI(); |
|
309 |
|
310 if ( appUi ) |
|
311 { |
|
312 isCompatible = appUi->IsSingleClickCompatible(); |
|
313 } |
|
314 |
|
315 _AKNTRACE_FUNC_EXIT; |
|
316 |
|
317 return isCompatible; |
|
318 } |
239 } |
319 |
240 |
320 // --------------------------------------------------------------------------- |
241 // --------------------------------------------------------------------------- |
321 // AknItemActionMenuRegister::Instance |
242 // AknItemActionMenuRegister::Instance |
322 // --------------------------------------------------------------------------- |
243 // --------------------------------------------------------------------------- |
323 // |
244 // |
324 AknItemActionMenuRegister* AknItemActionMenuRegister::Instance() |
245 AknItemActionMenuRegister* AknItemActionMenuRegister::Instance() |
325 { |
246 { |
326 _AKNTRACE_FUNC_ENTER; |
|
327 |
|
328 AknItemActionMenuRegister* instance = |
247 AknItemActionMenuRegister* instance = |
329 static_cast<AknItemActionMenuRegister*>( |
248 static_cast<AknItemActionMenuRegister*>( |
330 CCoeEnv::Static( KAknItemActionMenuRegister ) ); |
249 CCoeEnv::Static( KAknItemActionMenuRegister ) ); |
331 if ( !instance ) |
250 if ( !instance ) |
332 { |
251 { |
333 TRAP_IGNORE( instance = CreateInstanceL() ); |
252 TRAP_IGNORE( instance = CreateInstanceL() ); |
334 } |
253 } |
335 |
|
336 _AKNTRACE_FUNC_EXIT; |
|
337 |
|
338 return instance; |
254 return instance; |
339 } |
255 } |
340 |
256 |
341 |
257 |
342 // --------------------------------------------------------------------------- |
258 // --------------------------------------------------------------------------- |
343 // AknItemActionMenuRegister::DoRegisterCollectionL |
259 // AknItemActionMenuRegister::DoRegisterCollectionL |
344 // --------------------------------------------------------------------------- |
260 // --------------------------------------------------------------------------- |
345 // |
261 // |
346 CAknItemActionMenu* AknItemActionMenuRegister::DoRegisterCollectionL( |
262 CAknItemActionMenu* AknItemActionMenuRegister::DoRegisterCollectionL( |
347 MAknCollection& aCollectionState, MObjectProvider* aMenuBarOwner ) |
263 MAknCollection& aCollectionState ) |
348 { |
264 { |
349 _AKNTRACE_FUNC_ENTER; |
|
350 |
|
351 CAknItemActionMenu* menu( NULL ); |
265 CAknItemActionMenu* menu( NULL ); |
352 CEikMenuBar* menuBar = NULL; |
266 CEikMenuBar* menuBar = FindCurrentMenuBarL(); |
353 |
|
354 if ( aMenuBarOwner ) |
|
355 { |
|
356 aMenuBarOwner->MopGetObject( menuBar ); |
|
357 } |
|
358 |
|
359 if ( !menuBar ) |
|
360 { |
|
361 menuBar = FindCurrentMenuBar(); |
|
362 } |
|
363 menu = RegisterStateToItemActionMenuL( menuBar, aCollectionState ); |
267 menu = RegisterStateToItemActionMenuL( menuBar, aCollectionState ); |
364 |
|
365 _AKNTRACE_FUNC_EXIT; |
|
366 |
|
367 return menu; |
268 return menu; |
368 } |
269 } |
369 |
270 |
370 |
271 |
371 // --------------------------------------------------------------------------- |
272 // --------------------------------------------------------------------------- |
372 // AknItemActionMenuRegister::DoRegisterMenuBarL |
273 // AknItemActionMenuRegister::DoRegisterMenuBarL |
373 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
374 // |
275 // |
375 void AknItemActionMenuRegister::DoRegisterMenuBarL( CEikMenuBar& aMenuBar ) |
276 void AknItemActionMenuRegister::DoRegisterMenuBarL( CEikMenuBar& aMenuBar ) |
376 { |
277 { |
377 _AKNTRACE_FUNC_ENTER; |
|
378 |
|
379 CAknItemActionMenu* menu( NULL ); |
278 CAknItemActionMenu* menu( NULL ); |
380 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
279 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
381 { |
280 { |
382 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
281 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
383 if ( data.iOwner ) |
282 CEikMenuBar* ownerMenubar( NULL ); |
384 { |
283 data.iOwner->MopGetObjectNoChaining( ownerMenubar ); |
385 CEikMenuBar* ownerMenubar( NULL ); |
284 if ( ownerMenubar == &aMenuBar ) |
386 data.iOwner->MopGetObjectNoChaining( ownerMenubar ); |
285 { |
387 if ( ownerMenubar == &aMenuBar ) |
286 menu = data.iMenu; |
|
287 if ( menu ) |
388 { |
288 { |
389 menu = data.iMenu; |
289 AddRegisterEntryL( aMenuBar, *menu ); |
390 if ( menu ) |
|
391 { |
|
392 AddRegisterEntryL( aMenuBar, *menu ); |
|
393 iUnregisteredMenus.Remove( i ); |
|
394 } |
|
395 break; |
|
396 } |
290 } |
397 } |
291 iUnregisteredMenus.Remove( i ); |
398 } |
292 break; |
399 |
293 } |
400 _AKNTRACE_FUNC_EXIT; |
294 } |
401 } |
295 } |
402 |
296 |
403 |
297 |
404 // --------------------------------------------------------------------------- |
298 // --------------------------------------------------------------------------- |
405 // AknItemActionMenuRegister::DoUnregisterMenuBar |
299 // AknItemActionMenuRegister::DoUnregisterMenuBar |
406 // --------------------------------------------------------------------------- |
300 // --------------------------------------------------------------------------- |
407 // |
301 // |
408 void AknItemActionMenuRegister::DoUnregisterMenuBar( CEikMenuBar& aMenuBar ) |
302 void AknItemActionMenuRegister::DoUnregisterMenuBar( CEikMenuBar& aMenuBar ) |
409 { |
303 { |
410 _AKNTRACE_FUNC_ENTER; |
|
411 |
|
412 iRegisterArray->UnregisterMenuBar( aMenuBar ); |
304 iRegisterArray->UnregisterMenuBar( aMenuBar ); |
413 |
|
414 _AKNTRACE_FUNC_EXIT; |
|
415 } |
305 } |
416 |
306 |
417 |
307 |
418 // --------------------------------------------------------------------------- |
308 // --------------------------------------------------------------------------- |
419 // AknItemActionMenuRegister::DoRegisterItemActionMenuL |
309 // AknItemActionMenuRegister::DoRegisterItemActionMenuL |
420 // --------------------------------------------------------------------------- |
310 // --------------------------------------------------------------------------- |
421 // |
311 // |
422 void AknItemActionMenuRegister::DoRegisterItemActionMenuL( |
312 void AknItemActionMenuRegister::DoRegisterItemActionMenuL( |
423 CAknItemActionMenu& aItemActionMenu ) |
313 CAknItemActionMenu& aItemActionMenu ) |
424 { |
314 { |
425 _AKNTRACE_FUNC_ENTER; |
|
426 |
|
427 CEikMenuBar* menuBar( NULL ); |
315 CEikMenuBar* menuBar( NULL ); |
428 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
316 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
429 { |
317 { |
430 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
318 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
431 if ( data.iMenu == &aItemActionMenu ) |
319 if ( data.iMenu == &aItemActionMenu ) |
432 { |
320 { |
433 if ( data.iOwner ) |
321 data.iOwner->MopGetObjectNoChaining( menuBar ); |
|
322 if ( menuBar ) |
434 { |
323 { |
435 data.iOwner->MopGetObjectNoChaining( menuBar ); |
324 AddRegisterEntryL( *menuBar, aItemActionMenu ); |
436 if ( menuBar ) |
|
437 { |
|
438 AddRegisterEntryL( *menuBar, aItemActionMenu ); |
|
439 iUnregisteredMenus.Remove( i ); |
|
440 } |
|
441 } |
325 } |
|
326 iUnregisteredMenus.Remove( i ); |
442 break; |
327 break; |
443 } |
328 } |
444 } |
329 } |
445 |
|
446 _AKNTRACE_FUNC_EXIT; |
|
447 } |
330 } |
448 |
331 |
449 |
332 |
450 // --------------------------------------------------------------------------- |
333 // --------------------------------------------------------------------------- |
451 // AknItemActionMenuRegister::DoUnregisterItemActionMenu |
334 // AknItemActionMenuRegister::DoUnregisterItemActionMenu |
452 // --------------------------------------------------------------------------- |
335 // --------------------------------------------------------------------------- |
453 // |
336 // |
454 void AknItemActionMenuRegister::DoUnregisterItemActionMenu( |
337 void AknItemActionMenuRegister::DoUnregisterItemActionMenu( |
455 CAknItemActionMenu& aItemActionMenu ) |
338 CAknItemActionMenu& aItemActionMenu ) |
456 { |
339 { |
457 _AKNTRACE_FUNC_ENTER; |
|
458 |
|
459 iRegisterArray->UnregisterItemActionMenu( aItemActionMenu ); |
340 iRegisterArray->UnregisterItemActionMenu( aItemActionMenu ); |
460 |
|
461 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
|
462 { |
|
463 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
|
464 if ( data.iMenu == &aItemActionMenu ) |
|
465 { |
|
466 delete data.iMenu; |
|
467 iUnregisteredMenus.Remove( i ); |
|
468 break; |
|
469 } |
|
470 } |
|
471 |
|
472 _AKNTRACE_FUNC_EXIT; |
|
473 } |
341 } |
474 |
342 |
475 |
343 |
476 // --------------------------------------------------------------------------- |
344 // --------------------------------------------------------------------------- |
477 // AknItemActionMenuRegister::DoRegisterCollectionObserverL |
345 // AknItemActionMenuRegister::DoRegisterCollectionObserverL |
478 // --------------------------------------------------------------------------- |
346 // --------------------------------------------------------------------------- |
479 // |
347 // |
480 void AknItemActionMenuRegister::DoRegisterCollectionObserverL( |
348 void AknItemActionMenuRegister::DoRegisterCollectionObserverL( |
481 MAknCollectionObserver& aObserver ) |
349 MAknCollectionObserver& aObserver ) |
482 { |
350 { |
483 _AKNTRACE_FUNC_ENTER; |
351 CEikMenuBar* menuBar = FindCurrentMenuBarL(); |
484 |
|
485 CEikMenuBar* menuBar = FindCurrentMenuBar(); |
|
486 if ( !menuBar || !iRegisterArray->RegisterCollectionObserverL( |
352 if ( !menuBar || !iRegisterArray->RegisterCollectionObserverL( |
487 *menuBar, aObserver ) ) |
353 *menuBar, aObserver ) ) |
488 { |
354 { |
489 TAknUnregisteredObserverData newData( menuBar, |
355 TAknUnregisteredObserverData newData( menuBar, aObserver ); |
490 aObserver, Owner() ); |
|
491 |
|
492 |
|
493 _AKNTRACE( " Added observer %d", &aObserver ); |
|
494 iUnregisteredObservers.AppendL( newData ); |
356 iUnregisteredObservers.AppendL( newData ); |
495 } |
357 } |
496 |
|
497 _AKNTRACE_FUNC_EXIT; |
|
498 } |
358 } |
499 |
359 |
500 |
360 |
501 // --------------------------------------------------------------------------- |
361 // --------------------------------------------------------------------------- |
502 // AknItemActionMenuRegister::DoUnregisterCollectionObserver |
362 // AknItemActionMenuRegister::DoUnregisterCollectionObserver |
503 // --------------------------------------------------------------------------- |
363 // --------------------------------------------------------------------------- |
504 // |
364 // |
505 void AknItemActionMenuRegister::DoUnregisterCollectionObserver( |
365 void AknItemActionMenuRegister::DoUnregisterCollectionObserver( |
506 MAknCollectionObserver& aObserver ) |
366 MAknCollectionObserver& aObserver ) |
507 { |
367 { |
508 _AKNTRACE_FUNC_ENTER; |
|
509 |
|
510 iRegisterArray->UnregisterCollectionObserver( aObserver ); |
368 iRegisterArray->UnregisterCollectionObserver( aObserver ); |
511 |
|
512 for ( TInt i = 0; i < iUnregisteredObservers.Count(); i++ ) |
369 for ( TInt i = 0; i < iUnregisteredObservers.Count(); i++ ) |
513 { |
370 { |
514 TAknUnregisteredObserverData& data( iUnregisteredObservers[ i ] ); |
371 TAknUnregisteredObserverData& data( iUnregisteredObservers[ i ] ); |
515 if ( &data.iObserver == &aObserver ) |
372 if ( &data.iObserver == &aObserver ) |
516 { |
373 { |
517 iUnregisteredObservers.Remove( i ); |
374 iUnregisteredObservers.Remove( i ); |
518 _AKNTRACE_FUNC_EXIT; |
375 break; |
519 |
376 } |
520 return; |
377 } |
521 } |
|
522 } |
|
523 |
|
524 for ( TInt i = 0; i < iUnregisteredMenus.Count(); i++ ) |
|
525 { |
|
526 TAknUnregisteredMenuData& data( iUnregisteredMenus[ i ] ); |
|
527 data.iMenu->RemoveCollectionObserver( aObserver ); |
|
528 } |
|
529 |
|
530 _AKNTRACE_FUNC_EXIT; |
|
531 } |
378 } |
532 |
379 |
533 |
380 |
534 // --------------------------------------------------------------------------- |
381 // --------------------------------------------------------------------------- |
535 // AknItemActionMenuRegister::DialogMenuBar |
382 // AknItemActionMenuRegister::DialogMenuBar |
536 // --------------------------------------------------------------------------- |
383 // --------------------------------------------------------------------------- |
537 // |
384 // |
538 CEikMenuBar* AknItemActionMenuRegister::DialogMenuBar( CAknAppUi* aAppUi ) |
385 CEikMenuBar* AknItemActionMenuRegister::DialogMenuBar( CAknAppUi* aAppUi ) |
539 { |
386 { |
540 _AKNTRACE_FUNC_ENTER; |
|
541 |
|
542 CEikMenuBar* menuBar( NULL ); |
387 CEikMenuBar* menuBar( NULL ); |
543 // Check if there is an active dialog and fetch its menubar |
388 // Check if there is an active dialog and fetch its menubar |
544 if ( aAppUi && aAppUi->IsDisplayingMenuOrDialog() ) |
389 if ( aAppUi->IsDisplayingMenuOrDialog() ) |
545 { |
390 { |
546 CCoeControl* ctrl = aAppUi->TopFocusedControl(); |
391 CCoeControl* ctrl = aAppUi->TopFocusedControl(); |
547 if ( ctrl ) |
392 if ( ctrl ) |
548 { |
393 { |
549 CEikDialog* dialog = ctrl->MopGetObjectNoChaining( dialog ); |
394 CEikDialog* dialog = ctrl->MopGetObjectNoChaining( dialog ); |
551 { |
396 { |
552 dialog->MopGetObject( menuBar ); |
397 dialog->MopGetObject( menuBar ); |
553 } |
398 } |
554 } |
399 } |
555 } |
400 } |
556 |
|
557 _AKNTRACE_FUNC_EXIT; |
|
558 |
|
559 return menuBar; |
401 return menuBar; |
560 } |
402 } |
561 |
403 |
562 |
404 |
563 // --------------------------------------------------------------------------- |
405 // --------------------------------------------------------------------------- |
564 // AknItemActionMenuRegister::ViewMenuBar |
406 // AknItemActionMenuRegister::ViewMenuBar |
565 // --------------------------------------------------------------------------- |
407 // --------------------------------------------------------------------------- |
566 // |
408 // |
567 CEikMenuBar* AknItemActionMenuRegister::ViewMenuBar( CAknAppUi* aAppUi ) |
409 CEikMenuBar* AknItemActionMenuRegister::ViewMenuBar( CAknAppUi* aAppUi ) |
568 { |
410 { |
569 _AKNTRACE_FUNC_ENTER; |
|
570 |
|
571 CEikMenuBar* menuBar( NULL ); |
411 CEikMenuBar* menuBar( NULL ); |
572 CAknView* view = View( aAppUi ); |
412 CAknViewAppUi* appUi( static_cast<CAknViewAppUi*>( aAppUi ) ); |
573 |
413 |
574 if ( view ) |
414 // Check if there is an active view |
575 { |
415 TVwsViewId uid; |
576 menuBar = view->MenuBar(); |
416 if ( appUi->GetActiveViewId( uid ) == KErrNone ) |
577 } |
417 { |
578 |
418 if ( uid.iAppUid != uid.iViewUid ) |
579 _AKNTRACE_FUNC_EXIT; |
419 { |
580 |
420 CAknView* view = appUi->View( uid.iViewUid ); |
|
421 if ( view ) |
|
422 { |
|
423 menuBar = view->MenuBar(); |
|
424 } |
|
425 } |
|
426 } |
581 return menuBar; |
427 return menuBar; |
582 } |
428 } |
583 |
429 |
584 |
430 |
585 // --------------------------------------------------------------------------- |
431 // --------------------------------------------------------------------------- |
586 // AknItemActionMenuRegister::ConstructingObjectMenuBar |
432 // AknItemActionMenuRegister::ConstructingObjectMenuBar |
587 // --------------------------------------------------------------------------- |
433 // --------------------------------------------------------------------------- |
588 // |
434 // |
589 CEikMenuBar* AknItemActionMenuRegister::ConstructingObjectMenuBar() |
435 CEikMenuBar* AknItemActionMenuRegister::ConstructingObjectMenuBar() |
590 { |
436 { |
591 _AKNTRACE_FUNC_ENTER; |
|
592 |
|
593 CEikMenuBar* menuBar( NULL ); |
437 CEikMenuBar* menuBar( NULL ); |
594 if ( iMenuBarOwner ) |
438 if ( iMenuBarOwner ) |
595 { |
439 { |
596 iMenuBarOwner->MopGetObjectNoChaining( menuBar ); |
440 iMenuBarOwner->MopGetObjectNoChaining( menuBar ); |
597 } |
441 } |
598 |
|
599 _AKNTRACE_FUNC_EXIT; |
|
600 |
|
601 return menuBar; |
442 return menuBar; |
602 } |
443 } |
603 |
444 |
604 |
445 |
605 // --------------------------------------------------------------------------- |
446 // --------------------------------------------------------------------------- |
606 // AknItemActionMenuRegister::OverridingObjectMenuBar |
447 // AknItemActionMenuRegister::OverridingObjectMenuBar |
607 // --------------------------------------------------------------------------- |
448 // --------------------------------------------------------------------------- |
608 // |
449 // |
609 CEikMenuBar* AknItemActionMenuRegister::OverridingObjectMenuBar() |
450 CEikMenuBar* AknItemActionMenuRegister::OverridingObjectMenuBar() |
610 { |
451 { |
611 _AKNTRACE_FUNC_ENTER; |
|
612 |
|
613 CEikMenuBar* menuBar( NULL ); |
452 CEikMenuBar* menuBar( NULL ); |
614 if ( iOverridingMenuBarOwner ) |
453 if ( iOverridingMenuBarOwner ) |
615 { |
454 { |
616 iOverridingMenuBarOwner->MopGetObjectNoChaining( menuBar ); |
455 iOverridingMenuBarOwner->MopGetObjectNoChaining( menuBar ); |
617 } |
456 } |
618 |
|
619 _AKNTRACE_FUNC_EXIT; |
|
620 |
|
621 return menuBar; |
457 return menuBar; |
622 } |
|
623 |
|
624 |
|
625 // --------------------------------------------------------------------------- |
|
626 // AknItemActionMenuRegister::Owner |
|
627 // --------------------------------------------------------------------------- |
|
628 // |
|
629 MObjectProvider* AknItemActionMenuRegister::Owner() const |
|
630 { |
|
631 _AKNTRACE_FUNC_ENTER; |
|
632 |
|
633 MObjectProvider* owner = NULL; |
|
634 CAknAppUi* appUi = AppUI(); |
|
635 |
|
636 if ( iOverridingMenuBarOwner ) |
|
637 { |
|
638 owner = iOverridingMenuBarOwner; |
|
639 } |
|
640 else |
|
641 { |
|
642 owner = View( appUi ); |
|
643 |
|
644 if ( !owner ) |
|
645 { |
|
646 owner = iMenuBarOwner; |
|
647 } |
|
648 } |
|
649 |
|
650 if ( !owner ) |
|
651 { |
|
652 owner = appUi; |
|
653 } |
|
654 |
|
655 __ASSERT_DEBUG( owner, User::Invariant() ); |
|
656 _AKNTRACE_FUNC_EXIT; |
|
657 |
|
658 return owner; |
|
659 } |
|
660 |
|
661 |
|
662 // --------------------------------------------------------------------------- |
|
663 // AknItemActionMenuRegister::View |
|
664 // --------------------------------------------------------------------------- |
|
665 // |
|
666 CAknView* AknItemActionMenuRegister::View( CAknAppUi* aAppUi ) const |
|
667 { |
|
668 _AKNTRACE_FUNC_ENTER; |
|
669 |
|
670 CAknView* view = NULL; |
|
671 |
|
672 if ( aAppUi ) |
|
673 { |
|
674 // Check if there is an active view |
|
675 TVwsViewId uid; |
|
676 |
|
677 if ( aAppUi->GetActiveViewId( uid ) == KErrNone ) |
|
678 { |
|
679 if ( uid.iAppUid != uid.iViewUid ) |
|
680 { |
|
681 view = static_cast<CAknViewAppUi*>( |
|
682 aAppUi )->View( uid.iViewUid ); |
|
683 } |
|
684 } |
|
685 } |
|
686 |
|
687 _AKNTRACE_FUNC_EXIT; |
|
688 |
|
689 return view; |
|
690 } |
|
691 |
|
692 |
|
693 // --------------------------------------------------------------------------- |
|
694 // AknItemActionMenuRegister::AppUI |
|
695 // --------------------------------------------------------------------------- |
|
696 // |
|
697 CAknAppUi* AknItemActionMenuRegister::AppUI() |
|
698 { |
|
699 _AKNTRACE_FUNC_ENTER; |
|
700 |
|
701 CAknAppUi* appUi = NULL; |
|
702 CCoeEnv* env = CCoeEnv::Static(); |
|
703 |
|
704 if ( env ) |
|
705 { |
|
706 appUi = static_cast<CAknAppUi*>( env->AppUi() ); |
|
707 } |
|
708 |
|
709 |
|
710 _AKNTRACE_FUNC_EXIT; |
|
711 |
|
712 return appUi; |
|
713 } |
458 } |
714 |
459 |
715 |
460 |
716 // --------------------------------------------------------------------------- |
461 // --------------------------------------------------------------------------- |
717 // AknItemActionMenuRegister::RegisterStateToItemActionMenuL |
462 // AknItemActionMenuRegister::RegisterStateToItemActionMenuL |
762 } |
505 } |
763 } |
506 } |
764 // No unregistered menu found -> create one and add to list |
507 // No unregistered menu found -> create one and add to list |
765 if ( !viewRegistered ) |
508 if ( !viewRegistered ) |
766 { |
509 { |
767 menu = CAknItemActionMenu::NewLC( aCollectionState, Owner() ); |
510 menu = CAknItemActionMenu::NewL( aCollectionState ); |
768 TAknUnregisteredMenuData newData; |
511 TAknUnregisteredMenuData newData; |
769 newData.iOwner = iMenuBarOwner; |
512 newData.iOwner = iMenuBarOwner; |
770 newData.iMenu = menu; |
513 newData.iMenu = menu; |
771 iUnregisteredMenus.AppendL( newData ); |
514 iUnregisteredMenus.AppendL( newData ); |
772 CleanupStack::Pop( menu ); |
|
773 } |
515 } |
774 } |
516 } |
775 if ( menu ) |
517 if ( menu ) |
776 { |
518 { |
777 // Set observers with menubar to menu |
519 // Set observers with menubar to menu |
778 AddObserversToItemActionMenuL( *menu ); |
520 AddObserversToItemActionMenuL( aMenuBar, *menu ); |
779 } |
521 } |
780 |
|
781 _AKNTRACE_FUNC_EXIT; |
|
782 |
|
783 return menu; |
522 return menu; |
784 } |
523 } |
785 |
524 |
786 |
525 |
787 // --------------------------------------------------------------------------- |
526 // --------------------------------------------------------------------------- |
788 // AknItemActionMenuRegister::FindCurrentMenuBar |
527 // AknItemActionMenuRegister::FindCurrentMenuBarL |
789 // --------------------------------------------------------------------------- |
528 // --------------------------------------------------------------------------- |
790 // |
529 // |
791 CEikMenuBar* AknItemActionMenuRegister::FindCurrentMenuBar() |
530 CEikMenuBar* AknItemActionMenuRegister::FindCurrentMenuBarL() |
792 { |
531 { |
793 _AKNTRACE_FUNC_ENTER; |
|
794 |
|
795 CAknAppUi* appUi = AppUI(); |
|
796 CEikonEnv* eikonEnv( CEikonEnv::Static() ); |
532 CEikonEnv* eikonEnv( CEikonEnv::Static() ); |
|
533 CAknAppUi* appUi( static_cast<CAknAppUi*>( eikonEnv->AppUi() ) ); |
|
534 TBool isConstructingDialog( EFalse ); |
797 CEikMenuBar* menuBar( NULL ); |
535 CEikMenuBar* menuBar( NULL ); |
798 |
536 |
799 // If overriding menubar owner is set then it's the one to obey. If the |
537 // If overriding menubar owner is set then it's the one to obey. If the |
800 // overriding menubar owner doesn't supply a menubar object then there |
538 // overriding menubar owner doesn't supply a menubar object then there |
801 // isn't proper one available. |
539 // isn't proper one available. |
802 if ( iOverridingMenuBarOwner ) |
540 if ( iOverridingMenuBarOwner ) |
803 { |
541 { |
804 _AKNTRACE_FUNC_EXIT; |
|
805 return OverridingObjectMenuBar(); |
542 return OverridingObjectMenuBar(); |
806 } |
543 } |
807 |
544 |
808 // by default choose the current constructing menubar owner |
545 // Check if there is existing constructing dialog |
809 if ( iMenuBarOwner ) |
546 if ( iMenuBarOwner ) |
810 { |
547 { |
811 menuBar = ConstructingObjectMenuBar(); |
548 CEikDialog* dialog( NULL ); |
812 } |
549 iMenuBarOwner->MopGetObjectNoChaining( dialog ); |
813 else |
550 if ( dialog ) |
|
551 { |
|
552 isConstructingDialog = ETrue; |
|
553 } |
|
554 } |
|
555 // No constructing dialog |
|
556 if ( !isConstructingDialog ) |
814 { |
557 { |
815 // Fetch pointer to dialog that is currently displayed |
558 // Fetch pointer to dialog that is currently displayed |
816 menuBar = DialogMenuBar( appUi ); |
559 menuBar = DialogMenuBar( appUi ); |
817 |
|
818 // No dialog - pointer to active view menu bar |
560 // No dialog - pointer to active view menu bar |
819 if ( !menuBar ) |
561 if ( !menuBar ) |
820 { |
562 { |
821 menuBar = ViewMenuBar( appUi ); |
563 menuBar = ViewMenuBar( appUi ); |
822 } |
564 } |
823 } |
565 } |
|
566 |
|
567 // Fetch pointer to constructing object menu bar |
|
568 if ( !menuBar ) |
|
569 { |
|
570 menuBar = ConstructingObjectMenuBar(); |
|
571 } |
824 |
572 |
825 // Finally, if no luck with others, fetch pointer to appUi menu bar. |
573 // Finally, if no luck with others, fetch pointer to appUi menu bar. |
826 if ( !menuBar && eikonEnv ) |
574 if ( !menuBar ) |
827 { |
575 { |
828 menuBar = eikonEnv->AppUiFactory()->MenuBar(); |
576 menuBar = eikonEnv->AppUiFactory()->MenuBar(); |
829 } |
577 } |
830 |
|
831 _AKNTRACE_FUNC_EXIT; |
|
832 |
|
833 return menuBar; |
578 return menuBar; |
834 } |
579 } |
835 |
580 |
836 |
581 |
837 // --------------------------------------------------------------------------- |
582 // --------------------------------------------------------------------------- |
839 // --------------------------------------------------------------------------- |
584 // --------------------------------------------------------------------------- |
840 // |
585 // |
841 void AknItemActionMenuRegister::AddRegisterEntryL( |
586 void AknItemActionMenuRegister::AddRegisterEntryL( |
842 CEikMenuBar& aMenuBar, CAknItemActionMenu& aItemActionMenu ) |
587 CEikMenuBar& aMenuBar, CAknItemActionMenu& aItemActionMenu ) |
843 { |
588 { |
844 _AKNTRACE_FUNC_ENTER; |
|
845 |
|
846 aMenuBar.SetItemActionMenu( &aItemActionMenu ); |
589 aMenuBar.SetItemActionMenu( &aItemActionMenu ); |
847 iRegisterArray->AddEntryL( aMenuBar, aItemActionMenu ); |
590 iRegisterArray->AddEntryL( aMenuBar, aItemActionMenu ); |
848 AddObserversToItemActionMenuL( aItemActionMenu ); |
591 AddObserversToItemActionMenuL( &aMenuBar, aItemActionMenu ); |
849 |
|
850 _AKNTRACE_FUNC_EXIT; |
|
851 } |
592 } |
852 |
593 |
853 |
594 |
854 // --------------------------------------------------------------------------- |
595 // --------------------------------------------------------------------------- |
855 // AknItemActionMenuRegister::AddObserversToItemActionMenuL |
596 // AknItemActionMenuRegister::AddObserversToItemActionMenuL |
856 // --------------------------------------------------------------------------- |
597 // --------------------------------------------------------------------------- |
857 // |
598 // |
858 void AknItemActionMenuRegister::AddObserversToItemActionMenuL( |
599 void AknItemActionMenuRegister::AddObserversToItemActionMenuL( |
859 CAknItemActionMenu& aItemActionMenu ) |
600 CEikMenuBar* aMenuBar, CAknItemActionMenu& aItemActionMenu ) |
860 { |
601 { |
861 _AKNTRACE_FUNC_ENTER; |
602 for ( TInt i = 0; i < iUnregisteredObservers.Count(); i++ ) |
862 |
603 { |
863 TInt i = 0; |
604 TAknUnregisteredObserverData& data( iUnregisteredObservers[ i ] ); |
864 |
605 // Add if matching menubar or observer with no menubar |
865 while ( i < iUnregisteredObservers.Count() ) |
606 if ( data.iMenuBar == aMenuBar || !data.iMenuBar ) |
866 { |
607 { |
867 TAknUnregisteredObserverData& data( iUnregisteredObservers[i] ); |
|
868 |
|
869 // Register to item action menu if observer's owner matches item action |
|
870 // menu's owner. |
|
871 if ( data.iOwner == aItemActionMenu.Owner() ) |
|
872 { |
|
873 _AKNTRACE( " Observer %d added to item action menu", &data.iObserver ); |
|
874 |
|
875 aItemActionMenu.RegisterCollectionObserverL( |
608 aItemActionMenu.RegisterCollectionObserverL( |
876 data.iObserver ); |
609 data.iObserver ); |
877 |
610 } |
878 iUnregisteredObservers.Remove( i ); |
611 } |
879 } |
612 iUnregisteredObservers.Reset(); |
880 else |
613 } |
881 { |
|
882 ++i; |
|
883 } |
|
884 } |
|
885 |
|
886 _AKNTRACE_FUNC_EXIT; |
|
887 } |
|
888 |
|
889 |
614 |
890 // --------------------------------------------------------------------------- |
615 // --------------------------------------------------------------------------- |
891 // AknItemActionMenuRegister::CreateInstanceL |
616 // AknItemActionMenuRegister::CreateInstanceL |
892 // --------------------------------------------------------------------------- |
617 // --------------------------------------------------------------------------- |
893 // |
618 // |
894 AknItemActionMenuRegister* AknItemActionMenuRegister::CreateInstanceL() |
619 AknItemActionMenuRegister* AknItemActionMenuRegister::CreateInstanceL() |
895 { |
620 { |
896 _AKNTRACE_FUNC_ENTER; |
|
897 |
|
898 AknItemActionMenuRegister* instance = NULL; |
621 AknItemActionMenuRegister* instance = NULL; |
899 instance = new ( ELeave ) AknItemActionMenuRegister(); |
622 instance = new ( ELeave ) AknItemActionMenuRegister(); |
900 CleanupStack::PushL( instance ); |
623 CleanupStack::PushL( instance ); |
901 instance->ConstructL(); |
624 instance->ConstructL(); |
902 CleanupStack::Pop( instance ); |
625 CleanupStack::Pop( instance ); |
903 |
|
904 _AKNTRACE_FUNC_EXIT; |
|
905 return instance; |
626 return instance; |
906 } |
627 } |
907 |
|
908 |
|
909 // --------------------------------------------------------------------------- |
|
910 // AknItemActionMenuRegister::DoRemoveConstructingMenuBarOwner |
|
911 // --------------------------------------------------------------------------- |
|
912 // |
|
913 void AknItemActionMenuRegister::DoRemoveConstructingMenuBarOwner( |
|
914 MObjectProvider* aMenuBarOwner ) |
|
915 { |
|
916 TInt i = 0; |
|
917 |
|
918 // set all references to removed menubar owner to NULL |
|
919 while ( i < iUnregisteredMenus.Count() ) |
|
920 { |
|
921 TAknUnregisteredMenuData& data( iUnregisteredMenus[i] ); |
|
922 |
|
923 if ( data.iOwner == aMenuBarOwner ) |
|
924 { |
|
925 data.iOwner = NULL; |
|
926 } |
|
927 ++i; |
|
928 } |
|
929 |
|
930 // NULL also possible references in unregistered observers |
|
931 for ( i = 0; i < iUnregisteredObservers.Count(); ++i ) |
|
932 { |
|
933 TAknUnregisteredObserverData& data( iUnregisteredObservers[i] ); |
|
934 |
|
935 if ( data.iOwner == aMenuBarOwner ) |
|
936 { |
|
937 data.iOwner = NULL; |
|
938 } |
|
939 } |
|
940 |
|
941 if ( iMenuBarOwner == aMenuBarOwner ) |
|
942 { |
|
943 iMenuBarOwner = NULL; |
|
944 } |
|
945 } |
|
946 |
|
947 |
628 |
948 // --------------------------------------------------------------------------- |
629 // --------------------------------------------------------------------------- |
949 // AknItemActionMenuRegister::TAknUnregisteredObserverData |
630 // AknItemActionMenuRegister::TAknUnregisteredObserverData |
950 // ::TAknUnregisteredObserverData |
631 // ::TAknUnregisteredObserverData |
951 // --------------------------------------------------------------------------- |
632 // --------------------------------------------------------------------------- |
952 // |
633 // |
953 AknItemActionMenuRegister::TAknUnregisteredObserverData::\ |
634 AknItemActionMenuRegister::TAknUnregisteredObserverData::\ |
954 TAknUnregisteredObserverData( |
635 TAknUnregisteredObserverData( |
955 CEikMenuBar* aMenuBar, MAknCollectionObserver& aObserver, |
636 CEikMenuBar* aMenuBar, MAknCollectionObserver& aObserver ) |
956 MObjectProvider* aOwner ) |
|
957 : iMenuBar( aMenuBar ), |
637 : iMenuBar( aMenuBar ), |
958 iObserver( aObserver ), |
638 iObserver( aObserver ) |
959 iOwner( aOwner ) |
639 { |
960 { |
640 } |
961 } |
641 |
962 |
642 |
963 // End of File |
643 // End of File |
964 |
644 |