102 return EKeyWasNotConsumed; |
104 return EKeyWasNotConsumed; |
103 |
105 |
104 if (aKeyEvent.iCode == EKeyF21) // FEP generates F21 on long shift press |
106 if (aKeyEvent.iCode == EKeyF21) // FEP generates F21 on long shift press |
105 { |
107 { |
106 if (aType == EEventKey) |
108 if (aType == EEventKey) |
107 { |
109 { |
108 delete iCba; |
110 DeleteCBAL(); |
109 iCba = NULL; |
111 CEikAppUi* eikAppUi = (CEikAppUi *)CCoeEnv::Static()->AppUi(); |
110 iCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, this, R_AVKON_SOFTKEYS_EMPTY); |
112 if( eikAppUi!= NULL && eikAppUi->IsDisplayingDialog() && eikAppUi->TopFocusedControl() ) |
111 iCba->SetBoundingRect(iEikonEnv->EikAppUi()->ApplicationRect()); |
113 { |
|
114 CEikDialog* dlg = eikAppUi->TopFocusedControl()->MopGetObject( dlg ); |
|
115 if ( dlg ) |
|
116 { |
|
117 CEikButtonGroupContainer* currentCba = dlg->MopGetObject( currentCba ); |
|
118 |
|
119 if ( currentCba ) |
|
120 { |
|
121 CEikCba* dlgcba = static_cast<CEikCba*>( currentCba->ButtonGroup() ); |
|
122 TUint flags( 0 ); |
|
123 flags |= CEikButtonGroupContainer::EIsEmbedded | CEikButtonGroupContainer::EAddToStack; |
|
124 iCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, |
|
125 this, R_AVKON_SOFTKEYS_EMPTY, flags ); |
|
126 |
|
127 CEikCba* cba = static_cast<CEikCba*>( |
|
128 iCba->ButtonGroup() ); |
|
129 |
|
130 if( ! isCbaEmded ) |
|
131 { |
|
132 currentCba->AddCommandToStackL(ELeftSoftkeyIndex, -1, _L(""), NULL, NULL); |
|
133 currentCba->AddCommandToStackL(ERightSoftkeyIndex, -1, _L(""), NULL, NULL); |
|
134 currentCba->ActivateL(); |
|
135 currentCba->DrawNow(); |
|
136 iDialogCba = currentCba; |
|
137 isCbaEmded = ETrue; |
|
138 } |
|
139 |
|
140 cba->SetButtonGroupFlags( ~(EEikCbaFlagTransparent | EEikCbaFlagOutlineFont) ); |
|
141 TRect dlgRect(dlg->Rect()); |
|
142 TRect cbaRect(currentCba->Rect()); |
|
143 iCba->SetRect( currentCba->Rect()); |
|
144 iCba->SetPosition(TPoint(dlg->DrawableWindow()->Position().iX,dlg->DrawableWindow()->Position().iY + dlgRect.Height() - cbaRect.Height())); |
|
145 iCba->SetBoundingRect( dlg->Rect()); |
|
146 |
|
147 } |
|
148 |
|
149 } |
|
150 |
|
151 } |
|
152 if(iCba == NULL)//if iCba was not create in the above branch but was deleted by DeleteCBA |
|
153 { |
|
154 iCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, this, R_AVKON_SOFTKEYS_EMPTY); |
|
155 iCba->SetBoundingRect(iEikonEnv->EikAppUi()->ApplicationRect()); |
|
156 } |
112 UpdateCBALabelsL(); |
157 UpdateCBALabelsL(); |
113 } |
158 } |
114 return EKeyWasConsumed; |
159 return EKeyWasConsumed; |
115 } |
160 } |
116 else if (aType == EEventKey && |
161 else if (aType == EEventKey && |
176 change = UpdateCBALabelL(ERightSoftkeyIndex, EEikCmdEditPaste, R_TEXT_SOFTKEY_PASTE) || change; |
222 change = UpdateCBALabelL(ERightSoftkeyIndex, EEikCmdEditPaste, R_TEXT_SOFTKEY_PASTE) || change; |
177 else |
223 else |
178 change = UpdateCBALabelL(ERightSoftkeyIndex, ENullCommandId, R_TEXT_SOFTKEY_EMPTY) || change; |
224 change = UpdateCBALabelL(ERightSoftkeyIndex, ENullCommandId, R_TEXT_SOFTKEY_EMPTY) || change; |
179 |
225 |
180 if (change) |
226 if (change) |
|
227 { |
181 iCba->DrawNow(); |
228 iCba->DrawNow(); |
|
229 } |
182 } |
230 } |
183 |
231 |
184 TBool CAknCcpuSupport::UpdateCBALabelL(TInt aPosition, TInt aCommandId, TInt aTextResId) |
232 TBool CAknCcpuSupport::UpdateCBALabelL(TInt aPosition, TInt aCommandId, TInt aTextResId) |
185 { |
233 { |
186 if (iCba->ButtonGroup()->CommandId(aPosition) != aCommandId) |
234 if (iCba->ButtonGroup()->CommandId(aPosition) != aCommandId) |
204 |
252 |
205 EXPORT_C void* CAknCcpuSupport::ExtensionInterface( TUid /*aInterface*/ ) |
253 EXPORT_C void* CAknCcpuSupport::ExtensionInterface( TUid /*aInterface*/ ) |
206 { |
254 { |
207 return NULL; |
255 return NULL; |
208 } |
256 } |
209 |
257 void CAknCcpuSupport::DeleteCBAL() |
210 |
258 { |
|
259 if ( iCba != NULL ) |
|
260 { |
|
261 delete iCba; |
|
262 iCba = NULL; |
|
263 } |
|
264 if (isCbaEmded) |
|
265 { |
|
266 CEikAppUi* eikAppUi = (CEikAppUi *)CCoeEnv::Static()->AppUi(); |
|
267 if( eikAppUi!= NULL && eikAppUi->IsDisplayingDialog() && eikAppUi->TopFocusedControl() ) |
|
268 { |
|
269 CEikDialog* dlg = eikAppUi->TopFocusedControl()->MopGetObject( dlg ); |
|
270 if ( dlg ) |
|
271 { |
|
272 CEikButtonGroupContainer* currentCba = dlg->MopGetObject( currentCba ); |
|
273 CEikCba* dlgcba = static_cast<CEikCba*>( |
|
274 currentCba->ButtonGroup() ); |
|
275 if ( currentCba && iDialogCba == currentCba ) |
|
276 { |
|
277 currentCba->RemoveCommandFromStack(ELeftSoftkeyIndex,-1); |
|
278 currentCba->RemoveCommandFromStack(ERightSoftkeyIndex,-1); |
|
279 |
|
280 //dlgcba->UpdateCbaLabels(EFalse); |
|
281 currentCba->DrawNow(); |
|
282 currentCba->ActivateL(); |
|
283 iDialogCba = NULL; |
|
284 isCbaEmded = EFalse; |
|
285 } |
|
286 } |
|
287 } |
|
288 } |
|
289 |
|
290 } |