1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 #ifndef AKNFEPPREDOWNWORDSLISTBOX_H_ |
|
28 #define AKNFEPPREDOWNWORDSLISTBOX_H_ |
|
29 |
|
30 #include <e32base.h> |
|
31 #include <eikclb.h> |
|
32 |
|
33 //For accessing user dictionary through PtiEngine: |
|
34 #include <PtiDefs.h> |
|
35 #include <PtiEngine.h> |
|
36 #include <PtiUserDicEntry.h> |
|
37 |
|
38 |
|
39 class CAknFepPredOwnWordsModel : public CBase |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Function: NewL |
|
44 * |
|
45 * Discussion: Factory function used to create a new instance of |
|
46 * CAknFepPredictiveSettingDialog |
|
47 * |
|
48 * Params : aTextArray - pointer to array of UDB entries |
|
49 * Returns: A newly created instance of CAknFepPredOwnWordsModel |
|
50 */ |
|
51 static CAknFepPredOwnWordsModel* NewL( MDesCArray* aTextArray ); |
|
52 |
|
53 /** |
|
54 * Function: NewLC |
|
55 * |
|
56 * Discussion: Factory function used to create a new instance of |
|
57 * CAknFepPredictiveSettingDialog and leave a pointer to it on the |
|
58 * cleanup stack. |
|
59 * |
|
60 * Params: aTextArray - pointer to array of UDB entries |
|
61 * Returns: A newly created instance of CAknFepUserDictionaryEditDialog |
|
62 */ |
|
63 static CAknFepPredOwnWordsModel* NewLC( MDesCArray* aTextArray ); |
|
64 |
|
65 //Destructor |
|
66 ~CAknFepPredOwnWordsModel(); |
|
67 |
|
68 /** |
|
69 * Function: RemoveSelectedWordL |
|
70 * |
|
71 * Discussion: Removes existing word from UDB |
|
72 * |
|
73 * Params: aWordIndex - index to the word to be removed |
|
74 * in the list of UDB entries |
|
75 * Returns: If successful, it returns the index of the word |
|
76 * in the list of UDB entries which should be focussed. |
|
77 * Else, returns one of the system wide error codes. |
|
78 */ |
|
79 TInt RemoveSelectedWordL( TInt aWordIndex ); |
|
80 |
|
81 /** |
|
82 * Function: RemoveSelectedWordsL |
|
83 * |
|
84 * Discussion: Removes existing word from UDB |
|
85 * |
|
86 * Params: aSelectedItems - array of indices to the words to be |
|
87 * removed from the list of UDB entries |
|
88 * Returns: If successful, it returns KErrNone. |
|
89 * Else, returns one of the system wide error codes. |
|
90 */ |
|
91 TInt RemoveSelectedWordsL( const CArrayFix<TInt>* aSelectedItems ); |
|
92 |
|
93 /** |
|
94 * Function: AddNewWordL |
|
95 * |
|
96 * Discussion: Adds the word to UDB |
|
97 * |
|
98 * Params: aNewWord - new word to be added |
|
99 * Returns: If successful, it returns the index of the newly added word |
|
100 * in the list of UDB entries. |
|
101 * Else, returns one of the system wide error codes |
|
102 */ |
|
103 TInt AddNewWordL( TDesC& aNewWord ); |
|
104 |
|
105 private: |
|
106 CAknFepPredOwnWordsModel(); |
|
107 void ConstructL( MDesCArray* aTextArray ); |
|
108 |
|
109 //Helper methods: |
|
110 /** |
|
111 * Function: UpdateItemsL |
|
112 * |
|
113 * Discussion: Refreshes the word list with the current UDB entries |
|
114 * |
|
115 * Params: aTextArray |
|
116 * Returns: no return value. |
|
117 */ |
|
118 void UpdateItemsL( MDesCArray* aTextArray ); |
|
119 |
|
120 //to read user dictionary entries through PtiEngine |
|
121 void ReadUDBEntriesL(); |
|
122 |
|
123 //to format the words for list box |
|
124 HBufC* FormListBoxEntryFromWordLC( const TDesC& aWord ); |
|
125 |
|
126 //data: |
|
127 CPtiEngine* iPtiEngine; |
|
128 CDesCArrayFlat* iUDBWords; |
|
129 |
|
130 }; |
|
131 #endif /*AKNFEPPREDOWNWORDSLISTBOX_H_*/ |
|