|
1 /* |
|
2 * Copyright (c) 2006-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: VCommandManager Application UI class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknenv.h> |
|
21 #include <akntitle.h> |
|
22 #include <f32file.h> |
|
23 #include <apgwgnam.h> |
|
24 #include <AknSgcc.h> |
|
25 #include <nssvasccontacthandler.h> |
|
26 #include <data_caging_path_literals.hrh> |
|
27 #include "nssvoiceuipluginhandler.h" |
|
28 #include "rubydebug.h" |
|
29 #include "vcmanagerappui.h" |
|
30 #include "vcommandrecogmanager.h" |
|
31 #include "vcommandmanager.h" |
|
32 #include "vcmanagervoicekeylauncher.h" |
|
33 #include "vcmanagervoiceheadsetlauncher.h" |
|
34 #include "vcmanagercontactselecthandler_aiw.h" |
|
35 |
|
36 #include "vcmanagerbackupobserver.h" |
|
37 |
|
38 // CONSTANTS |
|
39 _LIT( KVCThreadName, "VCManagerThread" ); |
|
40 const TThreadPriority KVCThreadPriority = EPriorityAbsoluteLow; |
|
41 |
|
42 // Thread heap min-max |
|
43 const TInt KVCHeapMinSize = KMinHeapSize; |
|
44 const TInt KVCHeapMaxSize = 0x200000; // Max size is set to 2MB |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CVCommandManagerAppUi::StartServicesL |
|
48 // Starts SIND services |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void CVCommandManagerAppUi::StartServicesL() |
|
52 { |
|
53 RUBY_DEBUG0( "CVCommandManagerAppUi::StarServices" ); |
|
54 |
|
55 TInt error = KErrNone; |
|
56 |
|
57 TSecureId sid = RThread().SecureId(); |
|
58 RUBY_DEBUG1( "VCommandManager secure id [%x]", sid.iId ); |
|
59 |
|
60 // Create thread which starts to run the xml parsing |
|
61 RThread parserThread; |
|
62 |
|
63 error = parserThread.Create( KVCThreadName, CVCommandManager::VCMThreadFunction, |
|
64 KDefaultStackSize, KVCHeapMinSize, KVCHeapMaxSize, NULL ); |
|
65 CleanupClosePushL( parserThread ); |
|
66 |
|
67 if ( error == KErrNone ) |
|
68 { |
|
69 parserThread.SetPriority( KVCThreadPriority ); |
|
70 |
|
71 // Create VoiceUI Plug-in handler |
|
72 iPluginHandler = CNssVoiceUIPluginHandler::NewL(); |
|
73 |
|
74 // Recognition selection handling |
|
75 iRecogManager = CVCRecognitionManager::NewL(); |
|
76 |
|
77 // Create backup/restore observer |
|
78 iBackupObserver = CVCommandManagerBackupObserver::NewL(); |
|
79 |
|
80 // Create dialer |
|
81 RUBY_DEBUG0( "CVCommandManagerAppUi::StarServices creating dialer" ); |
|
82 |
|
83 iVasDbManager = CNssVASDBMgr::NewL(); |
|
84 iVasDbManager->InitializeL(); |
|
85 iContextManager = iVasDbManager->GetContextMgr(); |
|
86 |
|
87 iSelectNotificationBuilder = CNssSelectNotificationBuilder::NewL(); |
|
88 iSelectNotificationBuilder->InitializeL(); |
|
89 iTagSelectNotification = iSelectNotificationBuilder->GetTagSelectNotification(); |
|
90 |
|
91 iContactSelectHandler = CVcManagerContactSelectHandler::NewL( iContextManager, |
|
92 iTagSelectNotification ); |
|
93 |
|
94 delete iVasDbManager; |
|
95 iVasDbManager = NULL; |
|
96 |
|
97 iVoiceKeyLauncher = CVCommandManagerVoiceKeyLauncher::NewL(); |
|
98 iVoiceHeadSetLauncher = CVCommandManagerVoiceHeadSetLauncher::NewL(); |
|
99 |
|
100 // Dialer created |
|
101 RUBY_DEBUG0( "CVCommandManagerAppUi::StarServices dialer created" ); |
|
102 |
|
103 // Create VAS contact handler |
|
104 iContactHandler = CNssContactHandler::NewL(); |
|
105 |
|
106 // Start XML parsing |
|
107 parserThread.Resume(); |
|
108 |
|
109 CleanupStack::PopAndDestroy( &parserThread ); |
|
110 } |
|
111 else |
|
112 { |
|
113 RUBY_ERROR0( "CVCommandManagerAppUi::StarServices cannot create thread" ); |
|
114 } |
|
115 } |
|
116 |
|
117 |
|
118 // ============================ MEMBER FUNCTIONS =============================== |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CVCommandManagerAppUi::ConstructL |
|
122 // Symbian 2nd phase constructor can leave. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CVCommandManagerAppUi::ConstructL() |
|
126 { |
|
127 RUBY_DEBUG_BLOCK( "CVCommandManagerAppUi::ConstructL version 9" ); |
|
128 |
|
129 // Remember the idle status pane resource id |
|
130 iInitialStatuspaneResourceId = CAknSgcClient::CurrentStatuspaneResource(); |
|
131 |
|
132 // Cannot set ENoScreenFurniture here since after that StatusPane() function |
|
133 // returns NULL. "Voice mailbox" command requires status pane to be available |
|
134 // when executing. |
|
135 // ENoAppResourceFile seems to have no effect -> not setting that either |
|
136 BaseConstructL( EAknEnableSkin ); |
|
137 |
|
138 // Set this as system application |
|
139 iEikonEnv->SetSystem( ETrue ); |
|
140 |
|
141 iEikonEnv->SetAutoForwarding( ETrue ); |
|
142 |
|
143 UpdateStatusPaneL(); |
|
144 |
|
145 StartServicesL(); |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CVCommandManagerAppUi::~CVCommandManagerAppUi |
|
150 // Destructor |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 CVCommandManagerAppUi::~CVCommandManagerAppUi() |
|
154 { |
|
155 RUBY_DEBUG0( "CVCommandManagerAppUi::~CVCommandManagerAppUi" ); |
|
156 // Destroy VAS contact handler |
|
157 delete iContactHandler; |
|
158 // Destroy VAS global context |
|
159 delete iRecogManager; |
|
160 // Destroy VoiceUI Plug-in handler |
|
161 delete iPluginHandler; |
|
162 |
|
163 delete iContactSelectHandler; |
|
164 delete iSelectNotificationBuilder; |
|
165 delete iVasDbManager; |
|
166 delete iBackupObserver; |
|
167 delete iVoiceKeyLauncher; |
|
168 delete iVoiceHeadSetLauncher; |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CVCommandManagerAppUi::EikonEnv |
|
173 // Returns the CEikonEnv |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 CEikonEnv* CVCommandManagerAppUi::EikonEnv() const |
|
177 { |
|
178 return iEikonEnv; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CVCommandManagerAppUi::UpdateStatusPaneL |
|
183 // Switch to initial status pane |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CVCommandManagerAppUi::UpdateStatusPaneL() |
|
187 { |
|
188 // Use same status pane as idle has |
|
189 StatusPane()->SwitchLayoutL( iInitialStatuspaneResourceId ); |
|
190 |
|
191 // Title pane is set as empty |
|
192 CAknTitlePane* title = |
|
193 static_cast<CAknTitlePane*>( |
|
194 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
195 |
|
196 //const TDesC* temp = title->Text(); |
|
197 title->SetTextL( KNullDesC ); |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CVCommandManagerAppUi::HandleScreenDeviceChangedL |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 void CVCommandManagerAppUi::HandleScreenDeviceChangedL() |
|
205 { |
|
206 CAknAppUiBase::HandleScreenDeviceChangedL(); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CVCommandManagerAppUi::HandleCommandL |
|
211 // Handle events from app framework |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CVCommandManagerAppUi::HandleCommandL( TInt aCommand ) |
|
215 { |
|
216 switch ( aCommand ) |
|
217 { |
|
218 case EEikCmdExit: |
|
219 { |
|
220 Exit(); |
|
221 break; |
|
222 } |
|
223 |
|
224 default: |
|
225 break; |
|
226 } |
|
227 } |
|
228 |
|
229 |
|
230 // End of File |