25
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: This file defines class CFSEmailUiShortcutBinding.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __FS_EMAIL_UI_SHORTCUT_BINDING_H
|
|
20 |
#define __FS_EMAIL_UI_SHORTCUT_BINDING_H
|
|
21 |
|
|
22 |
#include <PtiDefs.h>
|
|
23 |
#include <e32property.h>
|
|
24 |
#include "FreestyleEmailUi.hrh"
|
|
25 |
|
|
26 |
|
|
27 |
// CONSTANTS
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CEikMenuPane;
|
|
31 |
class CPtiEngine;
|
|
32 |
class CPtiKeyMappings;
|
|
33 |
class CPtiQwertyKeyMappings;
|
|
34 |
class CPtiHalfQwertyKeyMappings;
|
|
35 |
|
|
36 |
|
|
37 |
// CLASS DECLARATION
|
|
38 |
class CFSEmailUiShortcutBinding : public CBase
|
|
39 |
{
|
|
40 |
public: // types
|
|
41 |
|
|
42 |
//! Defines a view where the shortcut is used
|
|
43 |
enum TShortcutContext
|
|
44 |
{
|
|
45 |
EContextMailList,
|
|
46 |
EContextSearchResults,
|
|
47 |
EContextMailViewer,
|
|
48 |
EContextHtmlViewer,
|
|
49 |
EContextMailDetails,
|
|
50 |
EContextFolderList,
|
|
51 |
EContextAttachmentList,
|
|
52 |
EContextDownloadManager,
|
|
53 |
EContextMainGrid,
|
|
54 |
EContextSettings,
|
|
55 |
EContextSendAttachmentList
|
|
56 |
};
|
|
57 |
|
|
58 |
//! @internal
|
|
59 |
struct TShortcutBinding
|
|
60 |
{
|
|
61 |
TText iItutShortcut; //!< Shortcut character on ITU-T. 0 if N/A.
|
|
62 |
|
|
63 |
TText iQwertyShortcut; //!< Shortcut character on QWERTY. 0 if N/A.
|
|
64 |
TUint32 iQwertyModifiers; //!< Modifiers of type TEventModifier required for the QWERTY shortcut. 0 if none.
|
|
65 |
|
|
66 |
TInt iCommandId; //!< The command for the shortcut.
|
|
67 |
};
|
|
68 |
|
|
69 |
public: // construction & destruction
|
|
70 |
|
|
71 |
static CFSEmailUiShortcutBinding* NewL();
|
|
72 |
|
|
73 |
~CFSEmailUiShortcutBinding();
|
|
74 |
|
|
75 |
public: // methods
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Gives a command ID for the given shortcut key. In the QWERTY mode, this
|
|
79 |
* depends on the English key mappings of the used device.
|
|
80 |
* @param aKey Key event for which the command is fetched
|
|
81 |
* @param aContext The view where the shortcut is used
|
|
82 |
* @return The command ID for the given key.
|
|
83 |
* KErrNotFound if there is no command binded to the key in the given context.
|
|
84 |
*/
|
|
85 |
TInt CommandForShortcutKey( const TKeyEvent& aKey, TShortcutContext aContext ) const;
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Gives a command ID for the given shortcut. As opposed to the function
|
|
89 |
* CommandForShortcutKey(), this function does no mapping for the given
|
|
90 |
* shortcut.
|
|
91 |
* @param aShortcut The shortcut character for which the command is fetched.
|
|
92 |
* @param aContext The view where the shortcut is used.
|
|
93 |
* @param aModifier Modifiers (like ctrl) which are used when entering the shortcut.
|
|
94 |
* @return The command ID for the given shortcut.
|
|
95 |
* KErrNotFound if there is no command binded to the shortcut in the given context.
|
|
96 |
*/
|
|
97 |
static TInt CommandForShortcut( TText aShortcut, TShortcutContext aContext, TUint32 aModifiers=0 );
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Gives a shortcut character for the given command. This function supports only
|
|
101 |
* one key shortcuts: if the shortcut is made up of a modifer (like ctrl) and the
|
|
102 |
* base key, this function does not find it.
|
|
103 |
* @param aCommandId The command for which a shortcut is fetched.
|
|
104 |
* @param aContext The view where the shortcut should be available.
|
|
105 |
* @param aQwertyMode Is the shortcut for QWERTY or ITU-T mode required.
|
|
106 |
* ETrue means QWERTY mode.
|
|
107 |
* @return The shortcut character for the given command.
|
|
108 |
* 0 if no such command was found.
|
|
109 |
*/
|
|
110 |
static TText ShortcutForCommand( TInt aCommandId, TShortcutContext aContext, TBool aQwertyMode );
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Adds the shortcut hints to the given menu. If the device is currently in the QWERTY
|
|
114 |
* mode, the QWERTY shortcuts are used. Otherwise, the ITU-T shortcuts are used.
|
|
115 |
* Only one key shortcuts are hinted: if a QWERTY shortcut needs a modifier key (like ctrl),
|
|
116 |
* no hint is added to the menu.
|
|
117 |
* @param aMenuPane The menu where the shortcuts should be added.
|
|
118 |
* @param aContext The view in which the menu is shown.
|
|
119 |
*/
|
|
120 |
void AppendShortcutHintsL( CEikMenuPane& aMenuPane, TShortcutContext aContext ) const;
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Possible keyboard modes. Values match values stored to property key KAknKeyBoardLayout.
|
|
124 |
*/
|
|
125 |
enum TKeyBoardType
|
|
126 |
{
|
|
127 |
ENoKeyboard = 0,
|
|
128 |
EItutKeyPad = 1,
|
|
129 |
EQwerty4x12 = 2,
|
|
130 |
EQwerty4x10 = 3,
|
|
131 |
EQwerty3x11 = 4,
|
|
132 |
EHalfQwerty = 5,
|
|
133 |
ECustomQwerty = 6
|
|
134 |
};
|
|
135 |
|
|
136 |
/**
|
|
137 |
* For checking current keyboard mode
|
|
138 |
* @return Type of the currently active keyboard
|
|
139 |
*/
|
|
140 |
TKeyBoardType KeyBoardType() const;
|
|
141 |
|
|
142 |
|
|
143 |
private: // construction
|
|
144 |
|
|
145 |
CFSEmailUiShortcutBinding();
|
|
146 |
|
|
147 |
void ConstructL();
|
|
148 |
|
|
149 |
private: // methods
|
|
150 |
|
|
151 |
//! Utility function for selecting the correct binding table for the given view.
|
|
152 |
static void GetBindingsForContext( const TShortcutBinding*& aBindingArray,
|
|
153 |
TInt& aBindingCount,
|
|
154 |
TShortcutContext aContext );
|
|
155 |
|
|
156 |
//! Appends the given shortcut hint with decorations to the given descriptor.
|
|
157 |
static void AppendHintToCaption( TDes& aCaption, TText aHint );
|
|
158 |
|
|
159 |
private: // data
|
|
160 |
|
|
161 |
CPtiEngine* iPtiEngine;
|
|
162 |
|
|
163 |
RProperty iKbLayoutProperty;
|
|
164 |
|
|
165 |
CPtiQwertyKeyMappings* iQwertyMappings; // owned by iPtiEngine
|
|
166 |
CPtiHalfQwertyKeyMappings* iHalfQwertyMappings; // owned by iPtiEngine
|
|
167 |
};
|
|
168 |
|
|
169 |
#endif // __FS_EMAIL_UI_SHORTCUT_BINDING_H
|