21
|
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: Implement of class CTruiShortcutsContainer
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <barsread.h>
|
|
20 |
#include <aknnavide.h>
|
|
21 |
#include <akntabgrp.h>
|
|
22 |
#include <eikspane.h>
|
|
23 |
#include <aknViewAppUi.h>
|
|
24 |
#include <aknlists.h>
|
|
25 |
#include <AknIconArray.h>
|
|
26 |
#include <eikclbd.h>
|
|
27 |
#include <trui.rsg>
|
|
28 |
#include <StringLoader.h>
|
|
29 |
#include <trui_icons.mbg>
|
|
30 |
#include <AknIconUtils.h>
|
|
31 |
#include <gulicon.h>
|
|
32 |
#include <akntextsettingpage.h>
|
|
33 |
#include <AknQueryDialog.h>
|
|
34 |
#include <AknPreviewPopUpController.h>
|
|
35 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
36 |
#include <layoutmetadata.cdl.h>
|
|
37 |
#include <akntoolbar.h>
|
|
38 |
#include <aknbutton.h>
|
|
39 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
40 |
#include <biditext.h>
|
|
41 |
|
|
42 |
#include "truicontainerbase.h"
|
|
43 |
#include "truishortcutscontainer.h"
|
|
44 |
#include "truimainview.h"
|
|
45 |
#include "truiengine.h"
|
|
46 |
#include "truiappui.h"
|
|
47 |
#include "truiengine.h"
|
|
48 |
#include "truishortcuteditview.h"
|
|
49 |
#include "trui.hrh"
|
|
50 |
#include "truiapplication.h"
|
|
51 |
#include "truihelp.h"
|
|
52 |
#include "truihwrbox.h"
|
|
53 |
#include "truishortcutedittextview.h"
|
|
54 |
#include "truiinfomessageview.h"
|
|
55 |
#include "truishortcutsview.h"
|
|
56 |
|
|
57 |
_LIT( KTRUIICONSFILENAME, "\\resource\\apps\\trui_icons.mif" );
|
|
58 |
|
|
59 |
// Initialized size for item array
|
|
60 |
const TInt KItemArraySize = 1;
|
|
61 |
|
|
62 |
// Initialized size for icon array
|
|
63 |
const TInt KIconArraySize = 3;
|
|
64 |
|
|
65 |
// listbox item format string
|
|
66 |
_LIT( KListItemWithPicFormat, "1\t%S\t\t" );
|
|
67 |
_LIT( KListItemFormat, "\t%S\t\t" );
|
|
68 |
|
|
69 |
// Delay time of showing tooltip
|
|
70 |
const TTimeIntervalMicroSeconds32 KTooltipShowDelay = 1000000;
|
|
71 |
|
|
72 |
// Delay time of hiding tooltip
|
|
73 |
const TTimeIntervalMicroSeconds32 KTooltipHideDelay = 3000000;
|
|
74 |
|
|
75 |
// Rect of popup hwrbox
|
|
76 |
const TRect KPopupHwrBoxRect = TRect( TPoint( 0, 0 ), TSize( 75, 75 ) );
|
|
77 |
|
|
78 |
const TPoint KPopupHwrBoxPosLandscape = TPoint( 479, 360 );
|
|
79 |
const TPoint KPopupHwrBoxPosPortrait = TPoint( 337, 500 );
|
|
80 |
|
|
81 |
const TInt KPopupWindowVarity = 0;
|
|
82 |
|
|
83 |
const TInt KParaDelimiterSize = 1;
|
|
84 |
_LIT( KParaDelimiterFormat, "%c" );
|
|
85 |
|
|
86 |
// ======== MEMBER FUNCTIONS ========
|
|
87 |
|
|
88 |
CTruiShortcutsContainer::CTruiShortcutsContainer()
|
|
89 |
{
|
|
90 |
}
|
|
91 |
|
|
92 |
void CTruiShortcutsContainer::ConstructL( const TRect& aRect )
|
|
93 |
{
|
|
94 |
// Initialize control array
|
|
95 |
InitComponentArrayL();
|
|
96 |
|
|
97 |
// Set parent control or owning window
|
|
98 |
CreateWindowL();
|
|
99 |
|
|
100 |
// Load shortcuts
|
|
101 |
iEngine->UpdateShortcutListL();
|
|
102 |
|
|
103 |
// Initialize controls
|
|
104 |
InitializeControlsL();
|
|
105 |
SetRect( aRect );
|
|
106 |
|
|
107 |
// Set default selected index
|
|
108 |
iListBox->SetCurrentItemIndex( iEngine->CurrentSelectedIndex() );
|
|
109 |
|
|
110 |
HandleListBoxFocusChangedL( CurrentItemIndex() );
|
|
111 |
|
|
112 |
ActivateL();
|
|
113 |
}
|
|
114 |
|
|
115 |
CTruiShortcutsContainer* CTruiShortcutsContainer::NewL( const TRect& aRect )
|
|
116 |
{
|
|
117 |
CTruiShortcutsContainer* self = CTruiShortcutsContainer::NewLC( aRect );
|
|
118 |
CleanupStack::Pop( self );
|
|
119 |
return self;
|
|
120 |
}
|
|
121 |
|
|
122 |
CTruiShortcutsContainer* CTruiShortcutsContainer::NewLC
|
|
123 |
( const TRect& aRect )
|
|
124 |
{
|
|
125 |
CTruiShortcutsContainer* self = new (ELeave) CTruiShortcutsContainer();
|
|
126 |
CleanupStack::PushL( self );
|
|
127 |
self->ConstructL( aRect );
|
|
128 |
return self;
|
|
129 |
}
|
|
130 |
|
|
131 |
CTruiShortcutsContainer::~CTruiShortcutsContainer()
|
|
132 |
{
|
|
133 |
delete iPopupController;
|
|
134 |
delete iHwrBox;
|
|
135 |
}
|
|
136 |
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
// Create controls to be displayed in this container.
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
void CTruiShortcutsContainer::InitializeControlsL()
|
|
142 |
{
|
|
143 |
// Create toolbar
|
|
144 |
CAknToolbar* toolbar = iAppUi->View( KTruiShortcutsViewId )->Toolbar();
|
|
145 |
// Get Clear button from toolbar
|
|
146 |
CAknButton* deleteButton = static_cast<CAknButton*>
|
|
147 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdDelete ) );
|
|
148 |
|
|
149 |
// Create listbox
|
|
150 |
CreateListBoxL();
|
|
151 |
|
|
152 |
// Create preview popup window
|
|
153 |
iPopupController = CreatePopupHwrBoxL();
|
|
154 |
}
|
|
155 |
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
// From class CCoeControl.
|
|
158 |
// Responds to changes to the size and position of the contents of this control.
|
|
159 |
// ---------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
void CTruiShortcutsContainer::SizeChanged()
|
|
162 |
{
|
|
163 |
if ( iListBox )
|
|
164 |
{
|
|
165 |
iListBox->SetRect( Rect() );
|
|
166 |
}
|
|
167 |
|
|
168 |
// caculate main pane
|
|
169 |
TRect rect = Rect();
|
|
170 |
TAknWindowComponentLayout main_pane_layout =
|
|
171 |
AknLayoutScalable_Apps::main_hwr_training_pane();
|
|
172 |
TAknLayoutRect main_pane_layout_rect;
|
|
173 |
main_pane_layout_rect.LayoutRect( rect, main_pane_layout );
|
|
174 |
TRect main_pane_rect = main_pane_layout_rect.Rect();
|
|
175 |
|
|
176 |
// Calculate popup_hwr_training_preview_window
|
|
177 |
TAknWindowComponentLayout preview_popup_layout =
|
|
178 |
AknLayoutScalable_Apps::popup_hwr_training_preview_window
|
|
179 |
( KPopupWindowVarity );
|
|
180 |
TAknLayoutRect preview_popup_layout_rect;
|
|
181 |
preview_popup_layout_rect.LayoutRect( main_pane_rect, preview_popup_layout );
|
|
182 |
|
|
183 |
iHwrBox->SetSize( preview_popup_layout_rect.Rect().Size() );
|
|
184 |
|
|
185 |
TPoint itemPos = PopupWindowPosition( CurrentItemIndex() );
|
|
186 |
iPopupController->SetPosition( itemPos );
|
|
187 |
}
|
|
188 |
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
// From class CCoeControl.
|
|
191 |
// This is called whenever the control gains or loses focus,
|
|
192 |
// ---------------------------------------------------------------------------
|
|
193 |
//
|
|
194 |
void CTruiShortcutsContainer::FocusChanged( TDrawNow /*aDrawNow*/ )
|
|
195 |
{
|
|
196 |
if ( IsFocused() )
|
|
197 |
{
|
|
198 |
if ( iDisplayPopupWindow )
|
|
199 |
{
|
|
200 |
TRAPD( err, CheckAndPreviewShortcutModelL( CurrentItemIndex() ) );
|
|
201 |
if ( err != KErrNone )
|
|
202 |
{
|
|
203 |
iDisplayPopupWindow = EFalse;
|
|
204 |
}
|
|
205 |
}
|
|
206 |
}
|
|
207 |
else
|
|
208 |
{
|
|
209 |
// Close pupup preview window
|
|
210 |
iPopupController->HidePopUp();
|
|
211 |
}
|
|
212 |
}
|
|
213 |
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
// From class CCoeControl.
|
|
216 |
// Handles pointer events.
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CTruiShortcutsContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
|
|
220 |
{
|
|
221 |
iPenDownPoint = aPointerEvent.iPosition;
|
|
222 |
CCoeControl::HandlePointerEventL( aPointerEvent );
|
|
223 |
}
|
|
224 |
|
|
225 |
// ---------------------------------------------------------------------------
|
|
226 |
// Popup the TextSettingPage and added the new shortcut to ListBox.
|
|
227 |
// ---------------------------------------------------------------------------
|
|
228 |
//
|
|
229 |
void CTruiShortcutsContainer::AddShortcutL()
|
|
230 |
{
|
|
231 |
iEngine->NewShortcut( ETrue );
|
|
232 |
iEngine->SetShortcut( KNullDesC );
|
|
233 |
// Get always display setting from ini file
|
|
234 |
TInt isNotDisplayWizard = 0;
|
|
235 |
TRAPD( err, GetSettingFromIniFileL( KAlwaysDisplayWizardKey, isNotDisplayWizard ) );
|
|
236 |
if ( err != KErrNone )
|
|
237 |
{
|
|
238 |
isNotDisplayWizard = 0;
|
|
239 |
}
|
|
240 |
|
|
241 |
if ( isNotDisplayWizard )
|
|
242 |
{
|
|
243 |
iEngine->SetDisplayWizard( EFalse );
|
|
244 |
iAppUi->ActivateLocalViewL( KTruiShortcutEditTextViewId );
|
|
245 |
}
|
|
246 |
else
|
|
247 |
{
|
|
248 |
iEngine->SetDisplayWizard( ETrue );
|
|
249 |
iAppUi->ActivateLocalViewL( KTruiInfoMessageViewId );
|
|
250 |
}
|
|
251 |
}
|
|
252 |
|
|
253 |
// ---------------------------------------------------------------------------
|
|
254 |
// Edit shortcut
|
|
255 |
// ---------------------------------------------------------------------------
|
|
256 |
//
|
|
257 |
void CTruiShortcutsContainer::EditShortcutL( TBool aOnlyEditText )
|
|
258 |
{
|
|
259 |
CDesCArray* shortcutlist = iEngine->ShortcutTextList();
|
|
260 |
TInt posInEngine = iListBox->CurrentItemIndex() - 1;
|
|
261 |
iEngine->SetShortcut( shortcutlist->MdcaPoint( posInEngine ) );
|
|
262 |
iEngine->NewShortcut( EFalse );
|
|
263 |
// Switch to shortcut edit view
|
|
264 |
if ( aOnlyEditText )
|
|
265 |
{
|
|
266 |
iAppUi->ActivateLocalViewL( KTruiShortcutEditTextViewId );
|
|
267 |
}
|
|
268 |
else
|
|
269 |
{
|
|
270 |
iAppUi->ActivateLocalViewL( KTruiShortcutEditViewId );
|
|
271 |
}
|
|
272 |
}
|
|
273 |
|
|
274 |
// ---------------------------------------------------------------------------
|
|
275 |
// Check if reset introduction
|
|
276 |
// ---------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
TBool CTruiShortcutsContainer::IsResetIntroduction()
|
|
279 |
{
|
|
280 |
TInt value = 0;
|
|
281 |
TRAPD( err, GetSettingFromIniFileL( KAlwaysDisplayWizardKey, value ) );
|
|
282 |
if ( err != KErrNone )
|
|
283 |
{
|
|
284 |
value = 0;
|
|
285 |
}
|
|
286 |
return value ? ETrue: EFalse;
|
|
287 |
}
|
|
288 |
|
|
289 |
// ---------------------------------------------------------------------------
|
|
290 |
// Reset introduction
|
|
291 |
// ---------------------------------------------------------------------------
|
|
292 |
//
|
|
293 |
void CTruiShortcutsContainer::ResetIntroductionL()
|
|
294 |
{
|
|
295 |
SaveSettingIntoIniFileL( KAlwaysDisplayWizardKey, 0 );
|
|
296 |
iAppUi->ActivateLocalViewL( KTruiInfoMessageViewId );
|
|
297 |
}
|
|
298 |
|
|
299 |
// ---------------------------------------------------------------------------
|
|
300 |
// From MEikListBoxObserver
|
|
301 |
// Handle event from an listbox
|
|
302 |
// ---------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void CTruiShortcutsContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
|
|
305 |
TListBoxEvent aEventType )
|
|
306 |
{
|
|
307 |
switch( aEventType )
|
|
308 |
{
|
|
309 |
case EEventPenDownOnItem:
|
|
310 |
{
|
|
311 |
iPopupController->HidePopUp();
|
|
312 |
// Check index
|
|
313 |
TInt index = CurrentItemIndex();
|
|
314 |
iListBox->View()->XYPosToItemIndex( iPenDownPoint, index );
|
|
315 |
// Popup preview window
|
|
316 |
HandleListBoxFocusChangedL( index );
|
|
317 |
}
|
|
318 |
break;
|
|
319 |
case EEventItemClicked:
|
|
320 |
{
|
|
321 |
break;
|
|
322 |
}
|
|
323 |
case EEventItemDoubleClicked:
|
|
324 |
{
|
|
325 |
if ( CurrentItemIndex() > 0 )
|
|
326 |
{
|
|
327 |
if ( MarkCount() == 0 )
|
|
328 |
{
|
|
329 |
// Pop context menu
|
|
330 |
PopupContextMenuL( R_TRUI_SHORTCUTSVIEW_CONTEXT_MENUBAR );
|
|
331 |
}
|
|
332 |
}
|
|
333 |
else
|
|
334 |
{
|
|
335 |
// Tap on "New shortcut"
|
|
336 |
AddShortcutL();
|
|
337 |
}
|
|
338 |
// Set the current index into engine
|
|
339 |
// Update toolbar button's status
|
|
340 |
break;
|
|
341 |
}
|
|
342 |
case EEventItemDraggingActioned:
|
|
343 |
{
|
|
344 |
iPopupController->HidePopUp();
|
|
345 |
TInt index = CurrentItemIndex();
|
|
346 |
iListBox->View()->XYPosToItemIndex( iPenDownPoint, index );
|
|
347 |
// Popup preview window
|
|
348 |
HandleListBoxFocusChangedL( index );
|
|
349 |
break;
|
|
350 |
}
|
|
351 |
}
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
// From class CCoeControl.
|
|
356 |
// Handles key event.
|
|
357 |
// ---------------------------------------------------------------------------
|
|
358 |
//
|
|
359 |
TKeyResponse CTruiShortcutsContainer::OfferKeyEventL
|
|
360 |
( const TKeyEvent& aKeyEvent,
|
|
361 |
TEventCode aType )
|
|
362 |
{
|
|
363 |
if ( aType == EEventKey )
|
|
364 |
{
|
|
365 |
switch ( aKeyEvent.iCode )
|
|
366 |
{
|
|
367 |
case EKeyLeftArrow:
|
|
368 |
{
|
|
369 |
CAknNavigationDecorator* naviDecorator =
|
|
370 |
iAppUi->GetNaviDecorator();
|
|
371 |
CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>
|
|
372 |
( naviDecorator->DecoratedControl() );
|
|
373 |
return tabGroup->OfferKeyEventL( aKeyEvent, aType );
|
|
374 |
}
|
|
375 |
case EKeyRightArrow:
|
|
376 |
{
|
|
377 |
return EKeyWasConsumed;
|
|
378 |
}
|
|
379 |
case EKeyUpArrow:
|
|
380 |
case EKeyDownArrow:
|
|
381 |
{
|
|
382 |
if ( iListBox )
|
|
383 |
{
|
|
384 |
iPopupController->HidePopUp();
|
|
385 |
TKeyResponse keyResponse = iListBox->OfferKeyEventL
|
|
386 |
( aKeyEvent, aType );
|
|
387 |
// Set the CBA button
|
|
388 |
if ( IsMarked( 0 ) )
|
|
389 |
{
|
|
390 |
iListBox->SetCurrentItemIndex( 0 );
|
|
391 |
AknSelectionService::HandleMarkableListProcessCommandL
|
|
392 |
( EAknCmdUnmark, iListBox );
|
|
393 |
iListBox->SetCurrentItemIndexAndDraw( iEngine->CurrentSelectedIndex() );
|
|
394 |
}
|
|
395 |
HandleListBoxFocusChangedL( CurrentItemIndex() );
|
|
396 |
return keyResponse;
|
|
397 |
}
|
|
398 |
}
|
|
399 |
case EKeyEnter:
|
|
400 |
case EKeyOK:
|
|
401 |
{
|
|
402 |
|
|
403 |
if ( iListBox != NULL && CurrentItemIndex() == 0 )
|
|
404 |
{
|
|
405 |
// Select "Create new shortcut" item
|
|
406 |
AddShortcutL();
|
|
407 |
}
|
|
408 |
else
|
|
409 |
{
|
|
410 |
if ( MarkCount() == 0 )
|
|
411 |
{
|
|
412 |
// Pop context menu
|
|
413 |
PopupContextMenuL( R_TRUI_SHORTCUTSVIEW_CONTEXT_MENUBAR );
|
|
414 |
}
|
|
415 |
}
|
|
416 |
return EKeyWasConsumed;
|
|
417 |
}
|
|
418 |
default:
|
|
419 |
break;
|
|
420 |
}
|
|
421 |
}
|
|
422 |
return EKeyWasNotConsumed;
|
|
423 |
}
|
|
424 |
|
|
425 |
// ---------------------------------------------------------------------------
|
|
426 |
// Gets the control's help context. Returns a NULL context by default.
|
|
427 |
// ---------------------------------------------------------------------------
|
|
428 |
//
|
|
429 |
void CTruiShortcutsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
|
|
430 |
{
|
|
431 |
aContext.iMajor = KUidtruiApp;
|
|
432 |
aContext.iContext = HWRT_HLP_SHORTCUTS;
|
|
433 |
}
|
|
434 |
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
// Delete shortcut from ListBox
|
|
437 |
// ---------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
void CTruiShortcutsContainer::DeleteItemsL()
|
|
440 |
{
|
|
441 |
CTextListBoxModel* model = iListBox->Model();
|
|
442 |
CDesCArray* itemArray = static_cast<CDesCArray*>( model->ItemTextArray() );
|
|
443 |
if ( MarkCount() > 0 )
|
|
444 |
{
|
|
445 |
// Delete all marked items, ignoring the selected item.
|
|
446 |
RArray<TInt> selectionIndexes;
|
|
447 |
CleanupClosePushL( selectionIndexes );
|
|
448 |
const CArrayFix<TInt>* indexArray = iListBox->SelectionIndexes();
|
|
449 |
TInt indexArrayLen = indexArray->Count();
|
|
450 |
|
|
451 |
// Copy the selection indexes array into RArray<TInt>
|
|
452 |
for ( TInt i = 0; i < indexArrayLen; i++ )
|
|
453 |
{
|
|
454 |
selectionIndexes.Append( ( *indexArray )[i] );
|
|
455 |
}
|
|
456 |
selectionIndexes.Sort();
|
|
457 |
// Delete all marked items
|
|
458 |
TInt selectionCount = selectionIndexes.Count();
|
|
459 |
for ( TInt i = selectionCount - 1; i >= 0; i-- )
|
|
460 |
{
|
|
461 |
// Delete item from Engine
|
|
462 |
TInt itemArrayIndex = selectionIndexes[i];
|
|
463 |
CDesCArray* shortcutList = iEngine->ShortcutTextList();
|
|
464 |
|
|
465 |
if ( shortcutList )
|
|
466 |
{
|
|
467 |
iEngine->DeleteShortcut( (*shortcutList)[itemArrayIndex-1] );
|
|
468 |
// Delete the currently selected item from array
|
|
469 |
itemArray->Delete( itemArrayIndex );
|
|
470 |
// Update ListBox
|
|
471 |
AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( iListBox,
|
|
472 |
itemArrayIndex,
|
|
473 |
ETrue);
|
|
474 |
}
|
|
475 |
}
|
|
476 |
CleanupStack::PopAndDestroy( &selectionIndexes ); // selectionIndexes
|
|
477 |
}
|
|
478 |
else
|
|
479 |
{
|
|
480 |
// Delete the currently selected item.
|
|
481 |
// Get the currently selected item
|
|
482 |
TInt selectedIndex = CurrentItemIndex();
|
|
483 |
|
|
484 |
// Delete item from Engine
|
|
485 |
CDesCArray* shortcutList = iEngine->ShortcutTextList();
|
|
486 |
if ( shortcutList )
|
|
487 |
{
|
|
488 |
iEngine->DeleteShortcut( (*shortcutList)[selectedIndex-1] );
|
|
489 |
// Delete the currently selected item from array
|
|
490 |
itemArray->Delete( selectedIndex );
|
|
491 |
// Update ListBox
|
|
492 |
AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( iListBox,
|
|
493 |
selectedIndex,
|
|
494 |
ETrue);
|
|
495 |
}
|
|
496 |
}
|
|
497 |
iListBox->DrawNow();
|
|
498 |
iEngine->UpdateShortcutListL();
|
|
499 |
// Set the current CBA
|
|
500 |
HandleListBoxFocusChangedL( CurrentItemIndex() );
|
|
501 |
}
|
|
502 |
|
|
503 |
// ---------------------------------------------------------------------------
|
|
504 |
// Delete shortcut
|
|
505 |
// ---------------------------------------------------------------------------
|
|
506 |
//
|
|
507 |
void CTruiShortcutsContainer::DeleteShortcutL()
|
|
508 |
{
|
|
509 |
// Popup note dialog
|
|
510 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
511 |
HBufC* prompt = NULL;
|
|
512 |
TInt count = MarkCount();
|
|
513 |
if ( count )
|
|
514 |
{
|
|
515 |
prompt = StringLoader::LoadLC( R_QTN_HWRT_QUERY_DELETE_SEVERAL_SHORTCUTS, count );
|
|
516 |
}
|
|
517 |
else
|
|
518 |
{
|
|
519 |
prompt = StringLoader::LoadLC( R_QTN_HWRT_QUERY_DELETE_SHORTCUT );
|
|
520 |
}
|
|
521 |
|
|
522 |
if ( dlg->ExecuteLD( R_TRUI_QUERYDIALOG_DELETE_SHORTCUT, *prompt ) )
|
|
523 |
{
|
|
524 |
// press yes
|
|
525 |
// Delete item from Listbox, also delete from Engine in it.
|
|
526 |
iPopupController->HidePopUp();
|
|
527 |
DeleteItemsL();
|
|
528 |
}
|
|
529 |
CleanupStack::PopAndDestroy( prompt ); // prompt
|
|
530 |
}
|
|
531 |
|
|
532 |
// ---------------------------------------------------------------------------
|
|
533 |
// Handle event when listbox change to another focused item.
|
|
534 |
// ---------------------------------------------------------------------------
|
|
535 |
//
|
|
536 |
void CTruiShortcutsContainer::HandleListBoxFocusChangedL( TInt aIndex )
|
|
537 |
{
|
|
538 |
// Set the current index into engine
|
|
539 |
iEngine->SetCurrentSelectedIndex( aIndex );
|
|
540 |
// Update toolbar button's status
|
|
541 |
UpdateToolbarButtonStatus( aIndex );
|
|
542 |
// Draw current item // add this line
|
|
543 |
iListBox->DrawItem( aIndex ); // add this line
|
|
544 |
// Preview shortcut model if it has model.
|
|
545 |
CheckAndPreviewShortcutModelL( aIndex );
|
|
546 |
}
|
|
547 |
|
|
548 |
// ---------------------------------------------------------------------------
|
|
549 |
// Mark shortcut
|
|
550 |
// ---------------------------------------------------------------------------
|
|
551 |
//
|
|
552 |
void CTruiShortcutsContainer::MarkShortcutL()
|
|
553 |
{
|
|
554 |
// The first item mustn't be marked
|
|
555 |
TInt currentIndex = CurrentItemIndex();
|
|
556 |
if ( currentIndex != 0 )
|
|
557 |
{
|
|
558 |
AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdMark,
|
|
559 |
iListBox );
|
|
560 |
}
|
|
561 |
|
|
562 |
CAknToolbar* toolbar = iAppUi->View( KTruiShortcutsViewId )->Toolbar();
|
|
563 |
if ( toolbar )
|
|
564 |
{
|
|
565 |
// Set edit text button's status
|
|
566 |
CAknButton* editTextButton = static_cast<CAknButton*>
|
|
567 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdEditText ) );
|
|
568 |
editTextButton->SetDimmed( ETrue );
|
|
569 |
editTextButton->DrawNow();
|
|
570 |
// Set edit model button's status
|
|
571 |
CAknButton* editModelButton = static_cast<CAknButton*>
|
|
572 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdEditModel ) );
|
|
573 |
editModelButton->SetDimmed( ETrue );
|
|
574 |
editModelButton->DrawNow();
|
|
575 |
}
|
|
576 |
}
|
|
577 |
|
|
578 |
// ---------------------------------------------------------------------------
|
|
579 |
// Unmark shortcut
|
|
580 |
// ---------------------------------------------------------------------------
|
|
581 |
//
|
|
582 |
void CTruiShortcutsContainer::UnmarkShortcutL()
|
|
583 |
{
|
|
584 |
// The first item mustn't be unmarked
|
|
585 |
TInt currentIndex = CurrentItemIndex();
|
|
586 |
if ( currentIndex != 0 )
|
|
587 |
{
|
|
588 |
AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdUnmark,
|
|
589 |
iListBox );
|
|
590 |
}
|
|
591 |
if ( MarkCount() == 0 )
|
|
592 |
{
|
|
593 |
CAknToolbar* toolbar = iAppUi->View( KTruiShortcutsViewId )->Toolbar();
|
|
594 |
if ( toolbar )
|
|
595 |
{
|
|
596 |
// Set edit text button's status
|
|
597 |
CAknButton* editTextButton = static_cast<CAknButton*>
|
|
598 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdEditText ) );
|
|
599 |
editTextButton->SetDimmed( EFalse );
|
|
600 |
editTextButton->DrawNow();
|
|
601 |
// Set edit model button's status
|
|
602 |
CAknButton* editModelButton = static_cast<CAknButton*>
|
|
603 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdEditModel ) );
|
|
604 |
editModelButton->SetDimmed( EFalse );
|
|
605 |
editModelButton->DrawNow();
|
|
606 |
}
|
|
607 |
}
|
|
608 |
}
|
|
609 |
|
|
610 |
// ---------------------------------------------------------------------------
|
|
611 |
// Return current selected item's index
|
|
612 |
// ---------------------------------------------------------------------------
|
|
613 |
//
|
|
614 |
TInt CTruiShortcutsContainer::CurrentItemIndex()
|
|
615 |
{
|
|
616 |
return iListBox->CurrentItemIndex();
|
|
617 |
}
|
|
618 |
|
|
619 |
// ---------------------------------------------------------------------------
|
|
620 |
// Test if the currently selected index is marked
|
|
621 |
// ---------------------------------------------------------------------------
|
|
622 |
//
|
|
623 |
TBool CTruiShortcutsContainer::IsMarked( TInt aSelectedIndex )
|
|
624 |
{
|
|
625 |
const CArrayFix<TInt>* aIndexArray = iListBox->SelectionIndexes();
|
|
626 |
for ( TInt index = 0; index < aIndexArray->Count(); index++ )
|
|
627 |
{
|
|
628 |
if ( aSelectedIndex == ( *aIndexArray )[index] )
|
|
629 |
{
|
|
630 |
return ETrue;
|
|
631 |
}
|
|
632 |
}
|
|
633 |
return EFalse;
|
|
634 |
}
|
|
635 |
|
|
636 |
// ---------------------------------------------------------------------------
|
|
637 |
// Return the count of being marked currently.
|
|
638 |
// ---------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
TInt CTruiShortcutsContainer::MarkCount()
|
|
641 |
{
|
|
642 |
const CArrayFix<TInt>* aIndexArray = iListBox->SelectionIndexes();
|
|
643 |
return aIndexArray->Count();
|
|
644 |
}
|
|
645 |
|
|
646 |
// ---------------------------------------------------------------------------
|
|
647 |
// Create preview popup controller to show popup hwrbox.
|
|
648 |
// ---------------------------------------------------------------------------
|
|
649 |
//
|
|
650 |
CAknPreviewPopUpController* CTruiShortcutsContainer::CreatePopupHwrBoxL()
|
|
651 |
{
|
|
652 |
iHwrBox = CTruiHwrBox::NewL( this, NULL );
|
|
653 |
iHwrBox->SetHwrBoxFlag( CTruiHwrBox::ENoFrameHwrBox
|
|
654 |
| CTruiHwrBox::EReadOnlyHwrBox );
|
|
655 |
CAknPreviewPopUpController* popupController =
|
|
656 |
CAknPreviewPopUpController::NewL
|
|
657 |
( *iHwrBox, CAknPreviewPopUpController::EPermanentMode );
|
|
658 |
popupController->AddObserverL( *this );
|
|
659 |
return popupController;
|
|
660 |
}
|
|
661 |
|
|
662 |
// ---------------------------------------------------------------------------
|
|
663 |
// Show the text tooltip.
|
|
664 |
// ---------------------------------------------------------------------------
|
|
665 |
//
|
|
666 |
void CTruiShortcutsContainer::PopupHwrBoxL( const TPoint& aPosition,
|
|
667 |
const TTimeIntervalMicroSeconds32& aShowDelay,
|
|
668 |
const TTimeIntervalMicroSeconds32& aHideDelay )
|
|
669 |
{
|
|
670 |
if ( iPopupController && iHwrBox )
|
|
671 |
{
|
|
672 |
iPopupController->SetPosition( aPosition );
|
|
673 |
// Set hwrbox's rect to engine and set guiding line to hwrbox
|
|
674 |
iHwrBox->SetDisplayBottomGuideLine( ETrue );
|
|
675 |
if ( iEngine->CurrentLanguageScript() == EMainViewSubmenuHebrew )
|
|
676 |
{
|
|
677 |
iHwrBox->SetDisplayTopGuideLine( ETrue );
|
|
678 |
}
|
|
679 |
iPopupController->SetPopUpShowDelay( aShowDelay );
|
|
680 |
iPopupController->SetPopUpHideDelay( aHideDelay );
|
|
681 |
iPopupController->ShowPopUp();
|
|
682 |
}
|
|
683 |
}
|
|
684 |
|
|
685 |
// ---------------------------------------------------------------------------
|
|
686 |
// Preview shortcut model in popup hwrbox.
|
|
687 |
// ---------------------------------------------------------------------------
|
|
688 |
//
|
|
689 |
void CTruiShortcutsContainer::PreviewShortcutModelL( const TDesC& aShortcutText,
|
|
690 |
TInt aIndex )
|
|
691 |
{
|
|
692 |
// Get shortcut model
|
|
693 |
if ( iEngine->CheckShortcutModel( aShortcutText ) )
|
|
694 |
{
|
|
695 |
TRAPD( err, iEngine->GetShortcutModelL( aShortcutText,
|
|
696 |
iHwrBox->Model(),
|
|
697 |
iShortcutUnicode ) );
|
|
698 |
if ( err == KErrNone )
|
|
699 |
{
|
|
700 |
// Popup hwrbox
|
|
701 |
// Get position for popup window
|
|
702 |
TPoint itemPos = PopupWindowPosition( aIndex );
|
|
703 |
PopupHwrBoxL( itemPos,
|
|
704 |
KTooltipShowDelay,
|
|
705 |
KTooltipHideDelay );
|
|
706 |
}
|
|
707 |
}
|
|
708 |
}
|
|
709 |
|
|
710 |
// ---------------------------------------------------------------------------
|
|
711 |
// Called by the preview popup when an appropriate event takes place.
|
|
712 |
// ---------------------------------------------------------------------------
|
|
713 |
//
|
|
714 |
void CTruiShortcutsContainer::HandlePreviewPopUpEventL(
|
|
715 |
CAknPreviewPopUpController* aController, TPreviewPopUpEvent aEvent )
|
|
716 |
{
|
|
717 |
if ( aController == iPopupController && aEvent == EPreviewPopUpShown )
|
|
718 |
{
|
|
719 |
TSize refSize = CTruiContainerBase::OriginSymbolSize();
|
|
720 |
iHwrBox->ShowTrails( iHwrBox->Model(), ETrue, refSize );
|
|
721 |
iDisplayPopupWindow = EFalse;
|
|
722 |
}
|
|
723 |
else
|
|
724 |
{
|
|
725 |
iHwrBox->ClearExistModel();
|
|
726 |
iHwrBox->DrawNow();
|
|
727 |
iDisplayPopupWindow = ETrue;
|
|
728 |
}
|
|
729 |
}
|
|
730 |
|
|
731 |
// ---------------------------------------------------------------------------
|
|
732 |
// Create list box to display all shortcut
|
|
733 |
// ---------------------------------------------------------------------------
|
|
734 |
//
|
|
735 |
void CTruiShortcutsContainer::CreateListBoxL()
|
|
736 |
{
|
|
737 |
// listbox instance
|
|
738 |
iListBox = new (ELeave) CAknSingleGraphicStyleListBox;
|
|
739 |
Components().AppendLC( iListBox );
|
|
740 |
CleanupStack::Pop( iListBox ); // iListBox
|
|
741 |
|
|
742 |
// Construct listbox
|
|
743 |
iListBox->ConstructL( this, EAknListBoxMarkableList );
|
|
744 |
|
|
745 |
// Set container control
|
|
746 |
iListBox->SetContainerWindowL( *this );
|
|
747 |
|
|
748 |
// Set observer
|
|
749 |
iListBox->SetListBoxObserver( this );
|
|
750 |
|
|
751 |
// Add scrollbars to listbox
|
|
752 |
iListBox->CreateScrollBarFrameL(ETrue);
|
|
753 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
754 |
CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
|
|
755 |
|
|
756 |
// Get shortcut list from engine
|
|
757 |
CDesCArray* primalList = iEngine->ShortcutTextList();
|
|
758 |
|
|
759 |
LoadTextArrayL( primalList );
|
|
760 |
|
|
761 |
// construct icon array with granularity 3
|
|
762 |
CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray( KIconArraySize );
|
|
763 |
CleanupStack::PushL( iconList );
|
|
764 |
CFbsBitmap* bitmap;
|
|
765 |
CFbsBitmap* bitmapm;
|
|
766 |
|
|
767 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
768 |
AknsUtils::CreateColorIconL( skin,
|
|
769 |
KAknsIIDQgnIndiMarkedAdd,
|
|
770 |
KAknsIIDQsnIconColors,
|
|
771 |
EAknsCIQsnIconColorsCG16,
|
|
772 |
bitmap,
|
|
773 |
bitmapm,
|
|
774 |
KTRUIICONSFILENAME,
|
|
775 |
EMbmTrui_iconsQgn_indi_marked_add,
|
|
776 |
EMbmTrui_iconsQgn_indi_marked_add_mask,
|
|
777 |
KRgbBlack
|
|
778 |
);
|
|
779 |
CleanupStack::PushL( bitmap );
|
|
780 |
CleanupStack::PushL( bitmapm );
|
|
781 |
CGulIcon* iconMark = CGulIcon::NewL( bitmap, bitmapm ); // Ownership transfered
|
|
782 |
CleanupStack::Pop( bitmapm );
|
|
783 |
CleanupStack::Pop( bitmap );
|
|
784 |
CleanupStack::PushL( iconMark );
|
|
785 |
iconList->AppendL( iconMark );
|
|
786 |
CleanupStack::Pop( iconMark );
|
|
787 |
|
|
788 |
AknsUtils::CreateIconL( skin,
|
|
789 |
KAknsIIDQgnPropHwrTrainingShortcut,
|
|
790 |
bitmap,
|
|
791 |
bitmapm,
|
|
792 |
KTRUIICONSFILENAME,
|
|
793 |
EMbmTrui_iconsQgn_prop_hwrtraining_shortcut_new,
|
|
794 |
EMbmTrui_iconsQgn_prop_hwrtraining_shortcut_new_mask
|
|
795 |
);
|
|
796 |
CleanupStack::PushL( bitmap );
|
|
797 |
CleanupStack::PushL( bitmapm );
|
|
798 |
CGulIcon* iconNew = CGulIcon::NewL( bitmap, bitmapm ); // Ownership transfered
|
|
799 |
CleanupStack::Pop( bitmapm );
|
|
800 |
CleanupStack::Pop( bitmap );
|
|
801 |
CleanupStack::PushL( iconNew );
|
|
802 |
iconList->AppendL( iconNew );
|
|
803 |
CleanupStack::Pop( iconNew );
|
|
804 |
|
|
805 |
iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
|
|
806 |
|
|
807 |
CleanupStack::Pop( iconList ); // iconList
|
|
808 |
|
|
809 |
iListBox->SetFocus( ETrue );
|
|
810 |
// update listbox
|
|
811 |
iListBox->ActivateL();
|
|
812 |
}
|
|
813 |
|
|
814 |
// ---------------------------------------------------------------------------
|
|
815 |
// Setup text data for listbox
|
|
816 |
// ---------------------------------------------------------------------------
|
|
817 |
//
|
|
818 |
void CTruiShortcutsContainer::LoadTextArrayL( const CDesCArray* aTextArray )
|
|
819 |
{
|
|
820 |
// Construct listbox item array.
|
|
821 |
// The items in the list contain an option of create new shortcut
|
|
822 |
// and the primal shortcuts from HWR engine
|
|
823 |
CDesCArray* itemList = new (ELeave) CDesCArrayFlat( KItemArraySize );
|
|
824 |
CleanupStack::PushL(itemList);
|
|
825 |
|
|
826 |
TBuf<KShortcutMaxLength> item;
|
|
827 |
HBufC* newShortcutText = StringLoader::LoadL( R_TRUI_SHORTCUTVIEW_NEW_SHORTCUT );
|
|
828 |
item.Format( KListItemWithPicFormat, newShortcutText );
|
|
829 |
delete newShortcutText;
|
|
830 |
newShortcutText = NULL;
|
|
831 |
itemList->AppendL(item);
|
|
832 |
|
|
833 |
// if at least one shortcut exists
|
|
834 |
if ( aTextArray )
|
|
835 |
{
|
|
836 |
// Item from WHR engine
|
|
837 |
for ( TInt i=0; i < aTextArray->Count(); i++ )
|
|
838 |
{
|
|
839 |
TBuf<KShortcutMaxLength> itemPrimal;
|
|
840 |
itemPrimal = aTextArray->MdcaPoint(i);
|
|
841 |
item.Format( KListItemFormat, &itemPrimal );
|
|
842 |
TBuf<KParaDelimiterSize> paraDelimiter;
|
|
843 |
paraDelimiter.Format( KParaDelimiterFormat, EKeyEnter );
|
|
844 |
AknTextUtils::ReplaceCharacters( item, paraDelimiter, TChar( EKeySpace ) );
|
|
845 |
itemList->AppendL( item );
|
|
846 |
}
|
|
847 |
}
|
|
848 |
// set items and ownership
|
|
849 |
CleanupStack::Pop( itemList );
|
|
850 |
iListBox->Model()->SetItemTextArray( itemList );
|
|
851 |
iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
|
|
852 |
iListBox->HandleItemAdditionL();
|
|
853 |
}
|
|
854 |
|
|
855 |
// ---------------------------------------------------------------------------
|
|
856 |
// Popup context menu.
|
|
857 |
// ---------------------------------------------------------------------------
|
|
858 |
//
|
|
859 |
void CTruiShortcutsContainer::PopupContextMenuL( TInt aResourceId )
|
|
860 |
{
|
|
861 |
// Hide popup preview window
|
|
862 |
iPopupController->HidePopUp();
|
|
863 |
// Popup context menu
|
|
864 |
CEikMenuBar* parentMenuBar = iAppUi->View( KTruiShortcutsViewId )->MenuBar();
|
|
865 |
if ( parentMenuBar )
|
|
866 |
{
|
|
867 |
parentMenuBar->SetMenuTitleResourceId( aResourceId );
|
|
868 |
parentMenuBar->SetMenuType( CEikMenuBar::EMenuContext );
|
|
869 |
parentMenuBar->TryDisplayMenuBarL();
|
|
870 |
parentMenuBar->SetMenuTitleResourceId( R_TRUI_SHORTCUTSVIEW_MENUBAR );
|
|
871 |
parentMenuBar->SetMenuType( CEikMenuBar::EMenuOptions );
|
|
872 |
}
|
|
873 |
}
|
|
874 |
|
|
875 |
// ---------------------------------------------------------------------------
|
|
876 |
// Get position relative to screen origin for popup window.
|
|
877 |
// ---------------------------------------------------------------------------
|
|
878 |
//
|
|
879 |
TPoint CTruiShortcutsContainer::PopupWindowPosition( TInt aIndex )
|
|
880 |
{
|
|
881 |
// Place popup window to left-bottom
|
|
882 |
TPoint itemPos = iListBox->View()->ItemPos( aIndex )
|
|
883 |
+ iListBox->PositionRelativeToScreen();
|
|
884 |
TSize itemSize = iListBox->View()->ItemSize( aIndex );
|
|
885 |
itemPos.iY += itemSize.iHeight;
|
|
886 |
|
|
887 |
// if direction is upforwards.
|
|
888 |
if ( Rect().iBr.iY + iListBox->PositionRelativeToScreen().iY -
|
|
889 |
( itemPos.iY + iPopupController->Size().iHeight ) < 0 )
|
|
890 |
{
|
|
891 |
itemPos.iY -= ( itemSize.iHeight + iPopupController->Size().iHeight );
|
|
892 |
}
|
|
893 |
|
|
894 |
if ( TBidiText::ScriptDirectionality( User::Language() )
|
|
895 |
== TBidiText::ELeftToRight )
|
|
896 |
{ // None-arabic,hebrew, place popup window to right-bottom
|
|
897 |
itemPos.iX += itemSize.iWidth;
|
|
898 |
// Sub width of scroll bar
|
|
899 |
TInt scrollbarWidth = 0;
|
|
900 |
if ( iListBox->ScrollBarFrame() )
|
|
901 |
{
|
|
902 |
scrollbarWidth = iListBox->ScrollBarFrame()
|
|
903 |
->ScrollBarBreadth( CEikScrollBar::EVertical );
|
|
904 |
}
|
|
905 |
itemPos.iX -= scrollbarWidth;
|
|
906 |
}
|
|
907 |
else
|
|
908 |
{
|
|
909 |
itemPos.iX += iPopupController->Size().iWidth;
|
|
910 |
}
|
|
911 |
return itemPos;
|
|
912 |
}
|
|
913 |
|
|
914 |
// ---------------------------------------------------------------------------
|
|
915 |
// Check if need to preview shortcut and perform previewing necessarily.
|
|
916 |
// ---------------------------------------------------------------------------
|
|
917 |
//
|
|
918 |
TBool CTruiShortcutsContainer::CheckAndPreviewShortcutModelL( TInt aIndex )
|
|
919 |
{
|
|
920 |
TBool ret = EFalse;
|
|
921 |
if ( aIndex > 0 )
|
|
922 |
{
|
|
923 |
// Get selected shortcut text
|
|
924 |
CDesCArray* shortcutlist = iEngine->ShortcutTextList();
|
|
925 |
TInt posInEngine = aIndex - 1;
|
|
926 |
// Popup hwr box to preview
|
|
927 |
PreviewShortcutModelL( shortcutlist->MdcaPoint( posInEngine ), aIndex );
|
|
928 |
ret = ETrue;
|
|
929 |
}
|
|
930 |
else
|
|
931 |
{
|
|
932 |
iPopupController->HidePopUp();
|
|
933 |
ret = EFalse;
|
|
934 |
}
|
|
935 |
return ret;
|
|
936 |
}
|
|
937 |
|
|
938 |
// ---------------------------------------------------------------------------
|
|
939 |
// Update buttons' status in toolbar
|
|
940 |
// ---------------------------------------------------------------------------
|
|
941 |
//
|
|
942 |
void CTruiShortcutsContainer::UpdateToolbarButtonStatus( TInt aIndex )
|
|
943 |
{
|
|
944 |
CAknToolbar* toolbar = iAppUi->View( KTruiShortcutsViewId )->Toolbar();
|
|
945 |
if ( toolbar )
|
|
946 |
{
|
|
947 |
// Set edit text button's status
|
|
948 |
CAknButton* editTextButton = static_cast<CAknButton*>
|
|
949 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdEditText ) );
|
|
950 |
if ( editTextButton )
|
|
951 |
{
|
|
952 |
if ( aIndex > 0 )
|
|
953 |
{
|
|
954 |
if ( MarkCount() > 0 )
|
|
955 |
{
|
|
956 |
editTextButton->SetDimmed( ETrue );
|
|
957 |
}
|
|
958 |
else
|
|
959 |
{
|
|
960 |
editTextButton->SetDimmed( EFalse );
|
|
961 |
}
|
|
962 |
}
|
|
963 |
else
|
|
964 |
{
|
|
965 |
editTextButton->SetDimmed( ETrue );
|
|
966 |
}
|
|
967 |
editTextButton->DrawNow();
|
|
968 |
}
|
|
969 |
|
|
970 |
// Set edit model button's status
|
|
971 |
CAknButton* editModelButton = static_cast<CAknButton*>
|
|
972 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdEditModel ) );
|
|
973 |
if ( editModelButton )
|
|
974 |
{
|
|
975 |
if( aIndex > 0 )
|
|
976 |
{
|
|
977 |
if ( MarkCount() > 0 )
|
|
978 |
{
|
|
979 |
editModelButton->SetDimmed( ETrue );
|
|
980 |
}
|
|
981 |
else
|
|
982 |
{
|
|
983 |
CDesCArray* shortcutlist = iEngine->ShortcutTextList();
|
|
984 |
TInt posInEngine = aIndex - 1;
|
|
985 |
if ( iEngine->CheckShortcutModel
|
|
986 |
( shortcutlist->MdcaPoint( posInEngine ) ) )
|
|
987 |
{
|
|
988 |
// Shortcut model exist and allow to edit model.
|
|
989 |
editModelButton->SetDimmed( EFalse );
|
|
990 |
}
|
|
991 |
}
|
|
992 |
}
|
|
993 |
else
|
|
994 |
{
|
|
995 |
editModelButton->SetDimmed( ETrue );
|
|
996 |
}
|
|
997 |
editModelButton->DrawNow();
|
|
998 |
}
|
|
999 |
|
|
1000 |
// Set delete button's status
|
|
1001 |
CAknButton* deleteButton = static_cast<CAknButton*>
|
|
1002 |
( toolbar->ControlOrNull( EShortcutsViewButtonIdDelete ) );
|
|
1003 |
if ( deleteButton )
|
|
1004 |
{
|
|
1005 |
TBool isDimmed = aIndex > 0 ? EFalse : ETrue;
|
|
1006 |
deleteButton->SetDimmed( isDimmed );
|
|
1007 |
deleteButton->DrawNow();
|
|
1008 |
}
|
|
1009 |
}
|
|
1010 |
}
|