|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Japanese user dictionary View class. |
|
15 * It owns CUserDictContainer object as container control. |
|
16 * It handles the events and switches the view state to Word list |
|
17 * view or to User dictionary editor. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef UDICTVIEW_H |
|
26 #define UDICTVIEW_H |
|
27 |
|
28 // INCLUDES |
|
29 #include <aknview.h> |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CUserDictContainer; |
|
33 class CUserDictModel; |
|
34 class TUDictElement; |
|
35 class CIdle; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Japanese user dictionary View class. |
|
41 * It owns CUserDictContainer object as container control. |
|
42 * @since 2.6 |
|
43 */ |
|
44 class CUserDictView : public CAknView |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aModel |
|
51 */ |
|
52 static CUserDictView* NewLC(CUserDictModel& aModel); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CUserDictView(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Saves the changes of the element and updates ListBox. |
|
63 * It calls the model's function to add or to modify the entry to |
|
64 * the User dictionary. |
|
65 * @param aNewItem is the element after changes. |
|
66 * @param aOldItem is the element before changes. |
|
67 */ |
|
68 void SaveL(const TUDictElement& aNewItem, |
|
69 const TUDictElement& aOldItem) const; |
|
70 |
|
71 /** |
|
72 * Displays an information note with a message defined by aResourceId. |
|
73 * @param aResourceId is the ID of the resource of the message string. |
|
74 */ |
|
75 void ShowInformationNoteL(TInt aResourceId) const; |
|
76 |
|
77 /** |
|
78 * From CAknView |
|
79 * Handles the client rectangle is changed. |
|
80 */ |
|
81 void HandleClientRectChange(); |
|
82 |
|
83 private: // Constructors |
|
84 |
|
85 /** |
|
86 * C++ default constructor. |
|
87 * @param aModel |
|
88 */ |
|
89 CUserDictView(CUserDictModel& aModel); |
|
90 |
|
91 /** |
|
92 * By default Symbian 2nd phase constructor is private. |
|
93 */ |
|
94 void ConstructL(); |
|
95 |
|
96 private: // New functions |
|
97 |
|
98 /** |
|
99 * Shows a delete confirmation query. |
|
100 * @param aCount is the number of the deleting words. |
|
101 * @return zero, if user cancels confirmation. |
|
102 */ |
|
103 TInt ShowDeleteConfQueryL(TInt aCount = 1) const; |
|
104 |
|
105 /** |
|
106 * Shows the form of User dictionary editor. |
|
107 * @param aItem is the reference to the entry item. |
|
108 */ |
|
109 void ShowEditorFormL(const TUDictElement& aItem); |
|
110 |
|
111 /** |
|
112 * Re-initializes the registered word list and updates the ListBox. |
|
113 */ |
|
114 void UpdateListL(); |
|
115 |
|
116 /** |
|
117 * The iIdle's callback function |
|
118 * @param aView |
|
119 * @return zero |
|
120 */ |
|
121 static TInt RegisterByAnotherApp(TAny* aView); |
|
122 |
|
123 /** |
|
124 * This function is only called when the application is launched |
|
125 * by another application. |
|
126 * The function starts the User dictionary editor and closes |
|
127 * this application after the editor is closed. |
|
128 */ |
|
129 void DoRegisterByAnotherApp(); |
|
130 |
|
131 /** |
|
132 * In this function the correct softkey is shown. |
|
133 */ |
|
134 void ShowSoftkeyL(); |
|
135 |
|
136 private: // Functions from base classes |
|
137 |
|
138 /** |
|
139 * From CAknView, returns this view Id. |
|
140 * @return this view Id |
|
141 */ |
|
142 TUid Id() const; |
|
143 |
|
144 /** |
|
145 * From CAknView |
|
146 * Handles the commands. |
|
147 * @param aCommand |
|
148 */ |
|
149 void HandleCommandL(TInt aCommand); |
|
150 |
|
151 /** |
|
152 * From CAknView, activates the view. |
|
153 * It creates and initializes CUserDictContainer object. |
|
154 * If it is started by another application, this function creates |
|
155 * the CIdle object to call RegisterByAnotherAppL(). |
|
156 * @param aPrevViewId |
|
157 * @param aCustomMessageId |
|
158 * @param aCustomMessage |
|
159 */ |
|
160 void DoActivateL( |
|
161 const TVwsViewId& aPrevViewId, |
|
162 TUid aCustomMessageId, |
|
163 const TDesC8& aCustomMessage); |
|
164 |
|
165 /** |
|
166 * From CAknView |
|
167 * Deactivates the view. |
|
168 */ |
|
169 void DoDeactivate(); |
|
170 |
|
171 /** |
|
172 * From CAknView |
|
173 */ |
|
174 void HandleForegroundEventL(TBool aForeground); |
|
175 |
|
176 /** |
|
177 * From MEikMenuObserver |
|
178 * Initializes the menu pane. |
|
179 * @param aResourceId is the Resource ID of the menu pane |
|
180 * @param aMenuPane |
|
181 */ |
|
182 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
183 |
|
184 private: // Data |
|
185 |
|
186 // View Container Control |
|
187 CUserDictContainer* iContainer; // own |
|
188 |
|
189 // Japanese User Dictionary Model |
|
190 // It provides the access to the User dictionary data. |
|
191 CUserDictModel& iModel; |
|
192 |
|
193 // CIdle active object |
|
194 CIdle* iIdle; // own |
|
195 |
|
196 // Flag to forbid the re-initializing of the list. |
|
197 TBool iLockListUpdate; |
|
198 // ETrue is embedded |
|
199 TBool iEmbedded; |
|
200 }; |
|
201 |
|
202 #endif // UDICTVIEW_H |
|
203 |
|
204 // End of File |