|
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: Model class for vcommand application wrapping CVCommandHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CVCMODEL_H |
|
20 #define CVCMODEL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <vcommandapi.h> |
|
24 #include "vcommanduientry.h" |
|
25 #include "vcommanduientryarray.h" |
|
26 #include "vcmodelappuiinterface.h" |
|
27 |
|
28 //class MVcModelAppUiInterface; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Wraps a list voice commands (CVCommand-objects wrapped in CVCommandUiEntry- |
|
34 * objects). |
|
35 */ |
|
36 class CVCModel : public CBase, public MVCommandHandlerObserver |
|
37 { |
|
38 public: // Constructor and destructor |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 */ |
|
43 static CVCModel* NewL( MVcModelAppUiInterface* aAppUi ); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CVCModel(); |
|
49 |
|
50 public: // Functions from base classes |
|
51 |
|
52 /** |
|
53 * From MVCommandHandlerObserver. Is called whenever the VCommand set is |
|
54 * changed by another instance of CVCommandHandler (not the one this |
|
55 * class wraps. This function, however,does not load the new set. |
|
56 */ |
|
57 void CommandSetChanged(); |
|
58 |
|
59 public: // New Functions |
|
60 |
|
61 /** |
|
62 * Returns a CVCommandUiEntry-object based on its written text. If a |
|
63 * command matching with the written text is not found, this function |
|
64 * leaves |
|
65 * @param aWrittenText Text displayed in for this voice command |
|
66 * @return CVCommandUiEntry |
|
67 */ |
|
68 virtual const CVCommandUiEntry& GetVCommandL( const TDesC& aWrittenText ); |
|
69 |
|
70 /** |
|
71 * Returns a CVCommandUiEntry-object. |
|
72 * @param aIndex Commands index in the list of commands |
|
73 */ |
|
74 virtual const CVCommandUiEntry& At( TInt aIndex ) const; |
|
75 |
|
76 /** |
|
77 * Loads vcommands from CVCommandHandler |
|
78 */ |
|
79 virtual void LoadVCommandsL(); |
|
80 |
|
81 /** |
|
82 * Sets a new spoken text for a voice vommand. |
|
83 * @param aWrittenText Text displayed for this voice command |
|
84 */ |
|
85 virtual void SetNewSpokenTextL( const TDesC& aWrittenText, const TDesC& aNewSpokenText ); |
|
86 |
|
87 /** |
|
88 * Returns a boolean value on whether a voice command with a given written text exists. |
|
89 * @param aWrittenText Text displayed in listbox for this voice command |
|
90 * @return TBool |
|
91 */ |
|
92 virtual TBool HasCommandL( const TDesC& aWrittenText ); |
|
93 |
|
94 /** |
|
95 * Returns the number of voice commands |
|
96 * @return TInt |
|
97 */ |
|
98 virtual TInt Count() const; |
|
99 |
|
100 /** |
|
101 * Returns a list of CVCommandUiEntry-objects. Ownership of the array |
|
102 * is passed to the client. |
|
103 * @return CVCommandUiEntryArray |
|
104 */ |
|
105 CVCommandUiEntryArray* VCommandArrayL(); |
|
106 |
|
107 /** |
|
108 * Returns a CVCommandHandler-object this class wraps. |
|
109 */ |
|
110 CVCommandHandler& Service(); |
|
111 |
|
112 protected: |
|
113 /** |
|
114 * C++ default constructor. |
|
115 */ |
|
116 CVCModel( MVcModelAppUiInterface* aAppUi ); |
|
117 |
|
118 private: |
|
119 |
|
120 /** |
|
121 * By default Symbian OS constructor is private. |
|
122 */ |
|
123 void ConstructL(); |
|
124 |
|
125 private: // New Functions |
|
126 |
|
127 /** |
|
128 * Utility function returning the index of a voice command in the list |
|
129 * of voice commands |
|
130 * @param aWrittenText Text displayed in listbox for a voice command |
|
131 * @return TInt |
|
132 */ |
|
133 TInt FindVCommandIndexL( const TDesC& aWrittenText ); |
|
134 |
|
135 private: // data |
|
136 |
|
137 MVcModelAppUiInterface* iAppUi; |
|
138 |
|
139 CVCommandHandler* iVcHandler; |
|
140 |
|
141 CVCommandUiEntryArray* iListBoxVCommands; |
|
142 }; |
|
143 |
|
144 #endif // CVCMODEL_H |
|
145 |
|
146 // End of File |
|
147 |
|
148 |