27 // User Includes |
27 // User Includes |
28 #include "lbtmgmtplugincontainer.h" |
28 #include "lbtmgmtplugincontainer.h" |
29 #include "lbtmgmtplugincmdhdlr.h" |
29 #include "lbtmgmtplugincmdhdlr.h" |
30 #include "lbtmgmtplugin.hrh" |
30 #include "lbtmgmtplugin.hrh" |
31 #include "lbtmgmtpluginuid.hrh" |
31 #include "lbtmgmtpluginuid.hrh" |
|
32 #include "lbtmgmtpluginview.h" |
|
33 #include "lbtmgmtpluginengine.h" |
32 |
34 |
33 // Constant defintions |
35 // Constant defintions |
34 const TInt KNoofComponentControls = 1; |
36 const TInt KNoofComponentControls = 1; |
35 |
37 |
36 |
38 |
40 // CLbtMgmtPluginContainer::CLbtMgmtPluginContainer |
42 // CLbtMgmtPluginContainer::CLbtMgmtPluginContainer |
41 // Overloaded Constructor |
43 // Overloaded Constructor |
42 // |
44 // |
43 // --------------------------------------------------------------------------- |
45 // --------------------------------------------------------------------------- |
44 // |
46 // |
45 CLbtMgmtPluginContainer::CLbtMgmtPluginContainer( |
47 CLbtMgmtPluginContainer::CLbtMgmtPluginContainer(MDesCArray& aListBoxModel, |
46 MDesCArray& aListBoxModel, |
48 MLbtMgmtPluginCmdHdlr& aCmdHandler, CLbtMgmtPluginView* aView) : |
47 MLbtMgmtPluginCmdHdlr& aCmdHandler ) |
49 iListBoxModel(aListBoxModel), iCmdHandler(aCmdHandler), iView(aView) |
48 :iListBoxModel( aListBoxModel ), |
|
49 iCmdHandler( aCmdHandler ) |
|
50 { |
50 { |
51 } |
51 } |
52 |
52 |
53 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
54 // CLbtMgmtPluginContainer::~CLbtMgmtPluginContainer |
54 // CLbtMgmtPluginContainer::~CLbtMgmtPluginContainer |
70 // @param aListBoxModel Model for the container's list box |
70 // @param aListBoxModel Model for the container's list box |
71 // @param aCmdHandler List box command handler |
71 // @param aCmdHandler List box command handler |
72 // @return CLbtMgmtPluginContainer* Reference to the object created |
72 // @return CLbtMgmtPluginContainer* Reference to the object created |
73 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
74 // |
74 // |
75 CLbtMgmtPluginContainer* CLbtMgmtPluginContainer::NewL( |
75 CLbtMgmtPluginContainer* CLbtMgmtPluginContainer::NewL(const TRect& aRect, |
76 const TRect& aRect, |
76 MDesCArray& aListBoxModel, MLbtMgmtPluginCmdHdlr& aCmdHandler, |
77 MDesCArray& aListBoxModel, |
77 CLbtMgmtPluginView* aView) |
78 MLbtMgmtPluginCmdHdlr& aCmdHandler ) |
78 { |
79 { |
79 CLbtMgmtPluginContainer* self = NewLC(aRect, aListBoxModel, aCmdHandler, |
80 CLbtMgmtPluginContainer* self = |
80 aView); |
81 NewLC( aRect, aListBoxModel, aCmdHandler ); |
81 CleanupStack::Pop(self); |
82 CleanupStack::Pop( self ); |
|
83 return self; |
82 return self; |
84 } |
83 } |
85 |
84 |
86 // --------------------------------------------------------------------------- |
85 // --------------------------------------------------------------------------- |
87 // CLbtMgmtPluginContainer* CLbtMgmtPluginContainer::NewLC |
86 // CLbtMgmtPluginContainer* CLbtMgmtPluginContainer::NewLC |
91 // @param aListBoxModel Model for the container's list box |
90 // @param aListBoxModel Model for the container's list box |
92 // @param aCmdHandler List box command handler |
91 // @param aCmdHandler List box command handler |
93 // @return CLbtMgmtPluginContainer* Reference to the object created |
92 // @return CLbtMgmtPluginContainer* Reference to the object created |
94 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
95 // |
94 // |
96 CLbtMgmtPluginContainer* CLbtMgmtPluginContainer::NewLC( |
95 CLbtMgmtPluginContainer* CLbtMgmtPluginContainer::NewLC(const TRect& aRect, |
97 const TRect& aRect, |
96 MDesCArray& aListBoxModel, MLbtMgmtPluginCmdHdlr& aCmdHandler, |
98 MDesCArray& aListBoxModel, |
97 CLbtMgmtPluginView* aView) |
99 MLbtMgmtPluginCmdHdlr& aCmdHandler ) |
98 { |
100 { |
99 CLbtMgmtPluginContainer* self = new (ELeave) CLbtMgmtPluginContainer( |
101 CLbtMgmtPluginContainer* self = |
100 aListBoxModel, aCmdHandler, aView); |
102 new(ELeave) CLbtMgmtPluginContainer( aListBoxModel, aCmdHandler ); |
101 CleanupStack::PushL(self); |
103 CleanupStack::PushL( self ); |
102 self->ConstructL(aRect); |
104 self->ConstructL( aRect ); |
|
105 return self; |
103 return self; |
106 } |
104 } |
107 |
105 |
108 // --------------------------------------------------------------------------- |
106 // --------------------------------------------------------------------------- |
109 // void CLbtMgmtPluginContainer::ConstructL |
107 // void CLbtMgmtPluginContainer::ConstructL |
224 // --------------------------------------------------------------------------- |
222 // --------------------------------------------------------------------------- |
225 // void CLbtMgmtPluginContainer::HandleListBoxEventL |
223 // void CLbtMgmtPluginContainer::HandleListBoxEventL |
226 // |
224 // |
227 // --------------------------------------------------------------------------- |
225 // --------------------------------------------------------------------------- |
228 // |
226 // |
229 void CLbtMgmtPluginContainer::HandleListBoxEventL( |
227 void CLbtMgmtPluginContainer::HandleListBoxEventL( |
230 CEikListBox* /* aListBox */, |
228 CEikListBox* /* aListBox */, |
231 MEikListBoxObserver::TListBoxEvent aEventType ) |
229 MEikListBoxObserver::TListBoxEvent aEventType) |
232 { |
230 { |
233 switch ( aEventType ) |
231 switch (aEventType) |
234 { |
232 { |
235 // List box Item Selection |
233 // List box Item Selection |
236 case EEventEnterKeyPressed: |
234 case EEventEnterKeyPressed: |
237 case EEventItemSingleClicked: |
235 case EEventItemSingleClicked: |
238 { |
236 { |
|
237 if (iView->GetLbtMgmtPluginEngine()->ActiveTriggers()) |
|
238 { |
|
239 iView->HandleCommandL(ELbtMgmtShowCSMenu); |
|
240 } |
239 // Settings element has been selected. Command has to be issued to |
241 // Settings element has been selected. Command has to be issued to |
240 // change the settings configuration |
242 // change the settings configuration |
241 iCmdHandler.HandleCmdL( MLbtMgmtPluginCmdHdlr::EListBoxItemSelected ); |
243 iCmdHandler.HandleCmdL( |
|
244 MLbtMgmtPluginCmdHdlr::EListBoxItemSelected); |
242 break; |
245 break; |
243 } |
246 } |
244 default: |
247 default: |
245 break; |
248 break; |
246 } |
249 } |
363 { |
366 { |
364 iListBox->DrawDeferred(); |
367 iListBox->DrawDeferred(); |
365 } |
368 } |
366 } |
369 } |
367 |
370 |
|
371 // --------------------------------------------------------------------------- |
|
372 // void CLbtMgmtPluginContainer::ShowContextMenuL |
|
373 // Shows context specific menu items |
|
374 // --------------------------------------------------------------------------- |
|
375 // |
|
376 void CLbtMgmtPluginContainer::ShowContextMenuL() |
|
377 { |
|
378 // Switch to Context specific options menu, |
|
379 // Show it and switch back to main options menu. |
|
380 CEikMenuBar* menuBar = iView->MenuBar(); |
|
381 // TRAP displaying of menu bar. |
|
382 // If it fails, the correct resource is set back before leave. |
|
383 TRAPD( err, menuBar->TryDisplayContextMenuBarL() ); |
|
384 User::LeaveIfError(err); |
|
385 |
|
386 } |
|
387 |