|
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 editor form. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef UDICTFRM_H |
|
24 #define UDICTFRM_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <AknForm.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CUserDictView; |
|
31 class TUDictElement; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * This class defines the form of Japanese user dictionary editor. |
|
37 * Edits an entry of Japanese user dictionary, which has a word and |
|
38 * the reading. |
|
39 * @since 2.6 |
|
40 */ |
|
41 class CUserDictForm : public CAknForm |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 * @param aItem is a reference to the entry item |
|
48 * @param aView |
|
49 */ |
|
50 static CUserDictForm* NewL(const TUDictElement& aItem, |
|
51 CUserDictView& aView); |
|
52 |
|
53 private: |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CUserDictForm(); |
|
59 |
|
60 private: |
|
61 |
|
62 /** |
|
63 * C++ default constructor. |
|
64 * @param aItem is a reference to the entry item |
|
65 * @param aView |
|
66 */ |
|
67 CUserDictForm(const TUDictElement& aItem, CUserDictView& aView); |
|
68 |
|
69 /** |
|
70 * By default Symbian 2nd phase constructor is private. |
|
71 */ |
|
72 void ConstructL(); |
|
73 |
|
74 private: // New functions |
|
75 |
|
76 /** |
|
77 * Gets the edited data, and sets the data to aEntry. |
|
78 * @param aEntry is set the edited data. |
|
79 */ |
|
80 void GetData(TUDictElement& aEntry) const; |
|
81 |
|
82 /** |
|
83 * Sets the entry data to the controls which the form has. |
|
84 */ |
|
85 void SetDataL() const; |
|
86 |
|
87 /** |
|
88 * Saves the entry, and if an error has occurred at the saving time, |
|
89 * it shows an error note. |
|
90 * @return EFalse, if it needs to fix the entry. |
|
91 */ |
|
92 TBool SaveL(); |
|
93 |
|
94 /** |
|
95 * Tests if the entry fields are blank. |
|
96 * @return EFalse, if the word and the reading are not empty. |
|
97 */ |
|
98 TBool IsBlank() const; |
|
99 |
|
100 /** |
|
101 * Tests if the characters of the reading entry is valid. |
|
102 * @return EFalse, the reading entry has invalid characters. |
|
103 */ |
|
104 TBool IsValidReadingL(const TUDictElement& aItem) const; |
|
105 |
|
106 private: // Functions from base classes |
|
107 |
|
108 /** |
|
109 * From CEikDialog |
|
110 * Initializes the form. |
|
111 */ |
|
112 void PreLayoutDynInitL(); |
|
113 |
|
114 /** |
|
115 * From CEikDialog, handles exit event of the form. |
|
116 * It calls SaveL(). If the saving finishes with EFalse, |
|
117 * this function returns EFalse. |
|
118 * @param aKeycode |
|
119 * @return ETrue, when exits the form. |
|
120 */ |
|
121 TBool OkToExitL(TInt aKeycode); |
|
122 |
|
123 /** |
|
124 * From MCoeControlObserver, handles event of the form state changes. |
|
125 * It switches the "Done" softkey visible or hidden. |
|
126 * @param aControlId |
|
127 */ |
|
128 void HandleControlStateChangeL(TInt aControlId); |
|
129 |
|
130 /** |
|
131 * From CCoeControl |
|
132 * Handles key events. |
|
133 * @param aKeyEvent |
|
134 * @param aType |
|
135 */ |
|
136 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
137 TEventCode aType); |
|
138 |
|
139 private: // Data |
|
140 |
|
141 // The Entry keeping the initial state |
|
142 const TUDictElement& iInitEntry; |
|
143 |
|
144 // The reference of View |
|
145 // It's used for calling the saving function. |
|
146 CUserDictView& iView; |
|
147 |
|
148 // The resource id for displaying softkey |
|
149 TUint iSoftkeyResource; |
|
150 }; |
|
151 |
|
152 #endif // UDICTFRM_H |
|
153 |
|
154 // End of File |