author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 22:59:08 +0300 | |
branch | RCL_3 |
changeset 46 | 5146369cfdc9 |
parent 23 | 50974a8b132e |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 2007-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 the License "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: This Class provides the interface for |
|
15 |
* calling the functionality to Application Manager SAPI. |
|
16 |
* Interafce |
|
17 |
* |
|
18 |
*/ |
|
19 |
||
20 |
||
21 |
||
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
22 |
#include <liwcommon.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
23 |
#include <liwbufferextension.h> |
5 | 24 |
#include <utf.h> |
46
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
25 |
#include <BAUTILS.H> |
5 | 26 |
#include "appmanagerinterface.h" |
27 |
#include "appmanagerservice.h" |
|
28 |
#include "appitemslist.h" |
|
29 |
#include "appserviceobserver.h" |
|
30 |
#include "serviceerrno.h" |
|
31 |
#include "appserviceerrmsg.hrh" |
|
32 |
||
33 |
||
34 |
#define KMAXCONTENTLENGTH 32 |
|
35 |
#define KMAXPATHLENGTH 255 |
|
36 |
||
37 |
//Supported Operation |
|
38 |
_LIT8(KGetList, "GetList"); |
|
39 |
_LIT8(KCancel, "Cancel"); |
|
40 |
_LIT8(KLaunchApp,"LaunchApp"); |
|
41 |
_LIT8(KLaunchDoc,"LaunchDoc"); |
|
42 |
||
43 |
//Input Keys/arguments |
|
44 |
||
45 |
// Data source name |
|
46 |
_LIT8(KType,"Type"); |
|
47 |
_LIT8(KApplicationID,"ApplicationID"); |
|
48 |
_LIT8(KCmdLine,"CmdLine"); |
|
49 |
_LIT8(KOptions,"Options"); |
|
50 |
_LIT8(KDocument,"Document"); |
|
51 |
_LIT8(KMimeType,"MimeType"); |
|
52 |
||
53 |
// Filter Map |
|
54 |
_LIT8(KFilter,"Filter"); |
|
55 |
||
56 |
||
57 |
//Filter criteria |
|
58 |
_LIT8(KDocumentPath,"DocumentPath"); |
|
59 |
_LIT8(KMode,"Mode"); |
|
60 |
_LIT8(KPosition,"Position"); |
|
61 |
//_LIT8(KPath ,"Path"); |
|
62 |
_LIT8(KHandle,"Handle"); |
|
63 |
_LIT8(KDocumentName,"DocumentName"); |
|
64 |
||
65 |
||
66 |
//Possible Content |
|
67 |
//_LIT(KUserInstalledPackage,"UserInstalledPackage"); |
|
68 |
//_LIT(KApplication,"Application"); |
|
69 |
||
70 |
||
71 |
//Output Keys/arguments |
|
72 |
_LIT8(KResponse,"ReturnValue"); |
|
73 |
_LIT8(KErrorCode,"ErrorCode"); |
|
74 |
_LIT8(KTransactionID,"TransactionID"); |
|
75 |
||
76 |
||
46
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
77 |
_LIT(KRtspPrefix,"rtsp://"); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
78 |
_LIT(KTempFile, "c:\\system\\temp\\tempvideo.ram"); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
79 |
_LIT(KTempPath, "c:\\system\\temp\\"); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
80 |
_LIT8(KRamMime, "application/ram"); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
81 |
|
5 | 82 |
|
83 |
// ----------------------------------------------------------------------------- |
|
84 |
// CAppManagerInterface::NewLC |
|
85 |
// Returns the instance of CAppManagerInterface. |
|
86 |
// ----------------------------------------------------------------------------- |
|
87 |
CAppManagerInterface* CAppManagerInterface::NewL() |
|
88 |
{ |
|
89 |
||
90 |
CAppManagerInterface* self = new ( ELeave )CAppManagerInterface(); |
|
91 |
CleanupStack::PushL( self ); |
|
92 |
self->ConstructL(); |
|
93 |
CleanupStack::Pop( self ); |
|
94 |
return self; |
|
95 |
} |
|
96 |
||
97 |
||
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// CAppManagerInterface::~CAppManagerInterface |
|
100 |
// Destructor of class |
|
101 |
// ----------------------------------------------------------------------------- |
|
102 |
CAppManagerInterface::~CAppManagerInterface() |
|
103 |
{ |
|
46
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
104 |
RFs fs; |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
105 |
User::LeaveIfError(fs.Connect()); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
106 |
if( BaflUtils::FileExists(fs,KTempFile) ) |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
107 |
{ |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
108 |
BaflUtils::DeleteFile(fs,KTempFile); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
109 |
} |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
110 |
fs.Close() ; |
5 | 111 |
//Release the instance of core class |
112 |
delete iCoreClass; |
|
113 |
iCoreClass = NULL; |
|
114 |
} |
|
115 |
||
116 |
||
117 |
// ----------------------------------------------------------------------------- |
|
118 |
// CAppManagerService::ExecuteCmdL |
|
119 |
// Request handler method of interface class |
|
120 |
// ----------------------------------------------------------------------------- |
|
121 |
||
122 |
void CAppManagerInterface::ExecuteCmdL(const TDesC8& aCmdName, |
|
123 |
const CLiwGenericParamList& aInParamList, |
|
124 |
CLiwGenericParamList& aOutParamList, |
|
125 |
TUint aCmdOptions , |
|
126 |
MLiwNotifyCallback* aCallBack) |
|
127 |
{ |
|
128 |
||
129 |
TInt32 transactionID = 0; |
|
130 |
TInt errCode = 0; |
|
131 |
TInt pos = 0; |
|
132 |
const TLiwGenericParam* param = NULL; |
|
133 |
TLiwGenericParam posbasedparam; |
|
134 |
||
135 |
if( (aCmdOptions & KLiwOptCancel ) && (0== aCmdName.CompareF( KCancel ))) // for cancel asynchronous request |
|
136 |
{ |
|
137 |
||
138 |
param = aInParamList.FindFirst( pos, KTransactionID ); |
|
139 |
if( !param ) |
|
140 |
{ |
|
141 |
||
142 |
if( aInParamList.Count() > 0 ) |
|
143 |
{ |
|
144 |
pos = 0; |
|
145 |
aInParamList.AtL( pos, posbasedparam ); |
|
146 |
if (posbasedparam.Value().IsEmpty() ) |
|
147 |
{ |
|
148 |
param = NULL; |
|
149 |
} |
|
150 |
else |
|
151 |
{ |
|
152 |
param = &posbasedparam; |
|
153 |
} |
|
154 |
} |
|
155 |
||
156 |
} |
|
157 |
||
158 |
||
159 |
if( param ) |
|
160 |
{ |
|
161 |
param->Value().Get( transactionID ); |
|
162 |
errCode = iCoreClass->Cancel( transactionID ); |
|
163 |
if ( KErrNone != errCode ) |
|
164 |
{ |
|
165 |
TInt sapiErr = SapiError(errCode); |
|
166 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)sapiErr))); |
|
167 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KIncorrectTransactionId ) ) ); |
|
168 |
} |
|
169 |
} |
|
170 |
else |
|
171 |
{ |
|
172 |
aOutParamList.AppendL( TLiwGenericParam ( KErrorCode,TLiwVariant( TInt32( SErrMissingArgument ) ) ) ); |
|
173 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KTransactionIdMissing ) ) ); |
|
174 |
} |
|
175 |
||
176 |
return; |
|
177 |
||
178 |
} |
|
179 |
||
180 |
||
181 |
||
182 |
// Check the command name;Cmd name should be GetList,LaunchApp or LaunchDoc |
|
183 |
if( 0 == aCmdName.CompareF( KGetList ) ) |
|
184 |
{ |
|
185 |
//Call GetListAPI |
|
186 |
if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request |
|
187 |
{ |
|
188 |
//No Asynch version of getlist is supported |
|
189 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrNotSupported)))); |
|
190 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant(KAsynchVersionNotSupported ) ) ); |
|
191 |
} |
|
192 |
else if( (!aCmdOptions) && ( NULL == aCallBack ) ) //Synchronous request |
|
193 |
{ |
|
194 |
GetListL( aInParamList, aOutParamList ); |
|
195 |
} |
|
196 |
else |
|
197 |
{ |
|
198 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrArgument)))); |
|
199 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KAsynchRequestNotProper ) ) ); |
|
200 |
} |
|
201 |
} |
|
202 |
else if( 0 == aCmdName.CompareF( KLaunchApp ) ) |
|
203 |
{ |
|
204 |
//Call LaunchApp API |
|
205 |
if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request |
|
206 |
{ |
|
207 |
||
208 |
//Asynch Call |
|
209 |
transactionID = aCallBack->GetTransactionID(); |
|
210 |
LaunchAppL( aInParamList, aOutParamList, aCallBack , transactionID ); |
|
211 |
||
212 |
} |
|
213 |
else if( (!aCmdOptions) && ( NULL == aCallBack ) ) //Synchronous request |
|
214 |
{ |
|
215 |
//Synchronous Call |
|
216 |
LaunchAppL( aInParamList, aOutParamList); |
|
217 |
} |
|
218 |
else |
|
219 |
{ |
|
220 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrArgument)))); |
|
221 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KAsynchRequestNotProper ) ) ); |
|
222 |
} |
|
223 |
||
224 |
} |
|
225 |
||
226 |
else if( 0 == aCmdName.CompareF( KLaunchDoc ) ) |
|
227 |
{ |
|
228 |
//Call LaunchDoc API |
|
229 |
if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request |
|
230 |
{ |
|
231 |
//Asynch Call |
|
232 |
transactionID = aCallBack->GetTransactionID(); |
|
233 |
LaunchDocL( aInParamList, aOutParamList, aCallBack , transactionID ); |
|
234 |
||
235 |
} |
|
236 |
else if( (!aCmdOptions) && ( NULL == aCallBack ) ) //Synchronous request |
|
237 |
{ |
|
238 |
//Synchronous Call |
|
239 |
LaunchDocL( aInParamList, aOutParamList); |
|
240 |
} |
|
241 |
else |
|
242 |
{ |
|
243 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrArgument)))); |
|
244 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KAsynchRequestNotProper ) ) ); |
|
245 |
} |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
//error code = command not supported |
|
250 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode,TLiwVariant((TInt32)SapiError(KErrNotSupported)))); |
|
251 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KCommandNotSupported ) ) ); |
|
252 |
} |
|
253 |
||
254 |
||
255 |
if( (aCmdOptions & KLiwOptASyncronous ) && ( NULL != aCallBack ) ) //Asynchronous request |
|
256 |
{ |
|
257 |
aOutParamList.AppendL( TLiwGenericParam( KTransactionID, TLiwVariant( transactionID ) ) ); |
|
258 |
} |
|
259 |
} |
|
260 |
||
261 |
||
262 |
// ----------------------------------------------------------------------------- |
|
263 |
// CAppManagerInterface::CAppManagerInterface |
|
264 |
// Constructor of class |
|
265 |
// ----------------------------------------------------------------------------- |
|
266 |
||
267 |
CAppManagerInterface::CAppManagerInterface() |
|
268 |
:iCoreClass( NULL ) |
|
269 |
||
270 |
{ |
|
271 |
||
272 |
} |
|
273 |
||
274 |
||
275 |
// ----------------------------------------------------------------------------- |
|
276 |
// CAppManagerInterface::ConstructL |
|
277 |
// Two-phased constructor of class |
|
278 |
// ----------------------------------------------------------------------------- |
|
279 |
||
280 |
void CAppManagerInterface::ConstructL() |
|
281 |
{ |
|
282 |
// Create the instance of core class |
|
283 |
iCoreClass = CAppManagerService::NewL(); |
|
284 |
||
285 |
} |
|
286 |
||
287 |
||
288 |
||
289 |
// ----------------------------------------------------------------------------- |
|
290 |
// CAppManagerInterface::GetListL |
|
291 |
// This function will send the request to Core class |
|
292 |
// ----------------------------------------------------------------------------- |
|
293 |
||
294 |
void CAppManagerInterface::GetListL(const CLiwGenericParamList& aInParamList , CLiwGenericParamList& aOutParamList ) |
|
295 |
||
296 |
{ |
|
297 |
||
298 |
||
299 |
||
300 |
TLiwGenericParam posbasedparam; |
|
301 |
TBool postionbasedsearching = EFalse; |
|
302 |
const TLiwGenericParam* param = NULL; |
|
303 |
TInt pos = 0; |
|
304 |
param = aInParamList.FindFirst( pos, KType ); |
|
305 |
||
306 |
if(!param) |
|
307 |
{ |
|
308 |
||
309 |
if( aInParamList.Count() > 0 ) |
|
310 |
{ |
|
311 |
pos = 0; |
|
312 |
aInParamList.AtL( pos,posbasedparam ); |
|
313 |
||
314 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
315 |
{ |
|
316 |
param = NULL; |
|
317 |
} |
|
318 |
else |
|
319 |
{ |
|
320 |
param = &posbasedparam; |
|
321 |
postionbasedsearching = ETrue; |
|
322 |
} |
|
323 |
} |
|
324 |
} |
|
325 |
TBuf<KMAXCONTENTLENGTH> content; |
|
326 |
if( param ) |
|
327 |
{ |
|
328 |
||
329 |
// content present : Mandatory Argument |
|
330 |
if (param->Value().TypeId() != LIW::EVariantTypeDesC || param->Value().AsDes().Length() > KMAXCONTENTLENGTH || !param->Value().Get( content ) ) |
|
331 |
{ |
|
332 |
//content type is different: append error and return |
|
333 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ((TInt32)SErrBadArgumentType) )); |
|
334 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KContentTypeMismatch ) ) ); |
|
335 |
||
336 |
posbasedparam.Reset(); |
|
337 |
||
338 |
return; |
|
339 |
} |
|
340 |
||
341 |
HBufC8* heapBuffer = NULL; |
|
342 |
param = NULL; |
|
343 |
if ( postionbasedsearching && ( aInParamList.Count() > 1) ) |
|
344 |
{ |
|
345 |
pos = 1; |
|
346 |
aInParamList.AtL( pos,posbasedparam ); |
|
347 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
348 |
{ |
|
349 |
param = NULL; |
|
350 |
} |
|
351 |
else |
|
352 |
{ |
|
353 |
param = &posbasedparam; |
|
354 |
} |
|
355 |
} |
|
356 |
else |
|
357 |
{ |
|
358 |
pos=0;//Search from starting point |
|
359 |
//filter map |
|
360 |
param = aInParamList.FindFirst( pos, KFilter ); |
|
361 |
} |
|
362 |
CFilterParam* filter = NULL; |
|
363 |
TLiwVariant documentname; |
|
364 |
TLiwVariant mimetype; |
|
365 |
||
366 |
||
367 |
//Filter is prsent |
|
368 |
if ( param && (param->Value().TypeId() != LIW::EVariantTypeNull ) ) |
|
369 |
{ |
|
370 |
||
371 |
filter = CFilterParam::NewL(); |
|
372 |
CleanupStack::PushL( filter ); |
|
373 |
const CLiwMap* filtermap; |
|
374 |
||
375 |
TPtrC val; |
|
376 |
filtermap = param->Value().AsMap(); |
|
377 |
||
378 |
if (filtermap ) |
|
379 |
{ |
|
380 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &documentname) ); |
|
381 |
||
382 |
if (filtermap->FindL( KDocumentPath, documentname ) && (documentname.TypeId() != LIW::EVariantTypeNull ) ) |
|
383 |
{ |
|
384 |
if ((documentname.AsDes().Length() < KMAXPATHLENGTH ) && documentname.Get(val)) |
|
385 |
{ |
|
386 |
filter->SetDocName(val); |
|
387 |
val.Set(NULL,0); |
|
388 |
} |
|
389 |
else |
|
390 |
{ |
|
391 |
//content type is different: do cleanup, append error and return |
|
392 |
CleanupStack::Pop(&documentname); |
|
393 |
documentname.Reset(); |
|
394 |
||
395 |
if( filter ) |
|
396 |
{ |
|
397 |
CleanupStack::PopAndDestroy( filter ); |
|
398 |
} |
|
399 |
||
400 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
401 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KFilterTypeMismatch ) ) ); |
|
402 |
||
403 |
posbasedparam.Reset(); |
|
404 |
||
405 |
return; |
|
406 |
} |
|
407 |
} |
|
408 |
||
409 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mimetype) ); |
|
410 |
if (filtermap->FindL( KMimeType, mimetype ) && (mimetype.TypeId() != LIW::EVariantTypeNull ) ) |
|
411 |
{ |
|
412 |
||
413 |
if ((mimetype.AsDes().Length() < KMAXPATHLENGTH ) && mimetype.Get(val)) |
|
414 |
{ |
|
415 |
//Before sending convert 16 bit to 8 Bit |
|
416 |
heapBuffer = HBufC8::NewL(val.Length()); |
|
417 |
TPtr8 val8(heapBuffer->Des()); |
|
418 |
val8.Copy(val); |
|
419 |
filter->SetmimeType(val8); |
|
420 |
} |
|
421 |
else |
|
422 |
{ |
|
423 |
//content type is different: do cleanup, append error and return |
|
424 |
||
425 |
CleanupStack::Pop(&mimetype); |
|
426 |
mimetype.Reset(); |
|
427 |
||
428 |
CleanupStack::Pop(&documentname); |
|
429 |
documentname.Reset(); |
|
430 |
||
431 |
if( filter ) |
|
432 |
{ |
|
433 |
CleanupStack::PopAndDestroy( filter ); |
|
434 |
} |
|
435 |
||
436 |
delete heapBuffer; |
|
437 |
||
438 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
439 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KFilterTypeMismatch ) ) ); |
|
440 |
||
441 |
posbasedparam.Reset(); |
|
442 |
||
443 |
return; |
|
444 |
} |
|
445 |
} |
|
446 |
CleanupStack::Pop(2); |
|
447 |
} |
|
448 |
else |
|
449 |
{ |
|
450 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType ) )); |
|
451 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KFilterTypeMismatch ) ) ); |
|
452 |
CleanupStack::PopAndDestroy( filter ); |
|
453 |
posbasedparam.Reset(); |
|
454 |
return; |
|
455 |
} |
|
456 |
||
457 |
} |
|
458 |
||
459 |
//Call GetList of Core class |
|
460 |
MIterator* iter = NULL; |
|
461 |
TRAPD ( errCode, iCoreClass->GetListL( iter, content, filter ) ); |
|
462 |
||
463 |
TInt sapiErr = SErrNone; |
|
464 |
if (errCode) |
|
465 |
{ |
|
466 |
sapiErr = SapiError(errCode); |
|
467 |
} |
|
468 |
||
469 |
aOutParamList.AppendL( TLiwGenericParam ( KErrorCode,TLiwVariant( ( TInt32 )sapiErr ) ) ); |
|
470 |
||
471 |
||
472 |
if( errCode == KErrNone ) |
|
473 |
||
474 |
{ |
|
475 |
// Fill the Iterator in Generic Paaram List |
|
476 |
TLiwVariant response; |
|
477 |
||
478 |
// Iterator will accept the MIterator * and will become the owner |
|
479 |
CAppItemsList *iterator = CAppItemsList::NewL( iter ); |
|
480 |
CleanupClosePushL( *iterator ); |
|
481 |
response.Set( iterator ); |
|
482 |
aOutParamList.AppendL( TLiwGenericParam ( KResponse, response ) ); |
|
483 |
CleanupStack::Pop( iterator ); |
|
484 |
iterator->DecRef(); |
|
485 |
||
486 |
} |
|
487 |
||
488 |
if( filter ) |
|
489 |
{ |
|
490 |
CleanupStack::PopAndDestroy( filter ); |
|
491 |
} |
|
492 |
||
493 |
mimetype.Reset(); |
|
494 |
documentname.Reset(); |
|
495 |
||
496 |
delete heapBuffer; |
|
497 |
||
498 |
} |
|
499 |
else |
|
500 |
{ |
|
501 |
//content type missig : Mandatory Argument |
|
502 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrMissingArgument))); |
|
503 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KContentMissing ) ) ); |
|
504 |
} |
|
505 |
||
506 |
posbasedparam.Reset(); |
|
507 |
||
508 |
} |
|
509 |
||
510 |
// ----------------------------------------------------------------------------- |
|
511 |
// CAppManagerInterface::LaunchAppL |
|
512 |
// This function will send the request to Core class |
|
513 |
// ----------------------------------------------------------------------------- |
|
514 |
||
515 |
void CAppManagerInterface::LaunchAppL(const CLiwGenericParamList& aInParamList , |
|
516 |
CLiwGenericParamList& aOutParamList, |
|
517 |
MLiwNotifyCallback* aCallBack, |
|
518 |
TInt32 aTransactionID ) |
|
519 |
||
520 |
{ |
|
521 |
TLiwGenericParam posbasedparam; |
|
522 |
TBool postionbasedsearching = EFalse; |
|
523 |
TOptions options; |
|
524 |
const TLiwGenericParam* param = NULL; |
|
525 |
TInt pos = 0; |
|
526 |
||
527 |
||
528 |
||
529 |
param = aInParamList.FindFirst( pos, KApplicationID ); |
|
530 |
||
531 |
if( !param ) |
|
532 |
{ |
|
533 |
||
534 |
if( aInParamList.Count() > 0 ) |
|
535 |
{ |
|
536 |
pos = 0; |
|
537 |
aInParamList.AtL( pos,posbasedparam ); |
|
538 |
||
539 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
540 |
{ |
|
541 |
param = NULL; |
|
542 |
} |
|
543 |
else |
|
544 |
{ |
|
545 |
param = &posbasedparam; |
|
546 |
postionbasedsearching = ETrue; |
|
547 |
} |
|
548 |
} |
|
549 |
} |
|
550 |
TBuf<KMAXCONTENTLENGTH> appId; |
|
551 |
if( param ) |
|
552 |
{ |
|
553 |
||
554 |
// content present : Mandatory Argument |
|
555 |
if (param->Value().TypeId() != LIW::EVariantTypeDesC || param->Value().AsDes().Length() > KMAXCONTENTLENGTH || !param->Value().Get( appId )) |
|
556 |
{ |
|
557 |
//content type is different: append error and return |
|
558 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ((TInt32)SErrBadArgumentType) )); |
|
559 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KApplicationIDMismatch ) ) ); |
|
560 |
||
561 |
posbasedparam.Reset(); |
|
562 |
||
563 |
return; |
|
564 |
} |
|
565 |
||
566 |
TPtrC cmdline; |
|
567 |
// TBuf<KMAXCONTENTLENGTH> cmdline; |
|
568 |
TLiwVariant mode; |
|
569 |
TLiwVariant postion; |
|
570 |
TLiwVariant document; |
|
571 |
||
572 |
param = NULL; |
|
573 |
if ( postionbasedsearching && ( aInParamList.Count() > 1) ) |
|
574 |
{ |
|
575 |
pos = 1; |
|
576 |
aInParamList.AtL( pos,posbasedparam ); |
|
577 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
578 |
{ |
|
579 |
param = NULL; |
|
580 |
} |
|
581 |
else |
|
582 |
{ |
|
583 |
param = &posbasedparam; |
|
584 |
} |
|
585 |
} |
|
586 |
else |
|
587 |
{ |
|
588 |
pos=0;//Search from starting point |
|
589 |
//filter map |
|
590 |
param = aInParamList.FindFirst( pos, KCmdLine ); |
|
591 |
} |
|
592 |
||
593 |
//CommandLine is prsent |
|
594 |
if ( param && (param->Value().TypeId() != LIW::EVariantTypeNull ) ) |
|
595 |
{ |
|
596 |
if( !param->Value().Get( cmdline ) ) |
|
597 |
{ |
|
598 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) ); |
|
599 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KCommandLineMismatch ) ) ); |
|
600 |
posbasedparam.Reset(); |
|
601 |
return; |
|
602 |
} |
|
603 |
} |
|
604 |
||
605 |
||
606 |
||
607 |
||
608 |
||
609 |
||
610 |
||
611 |
param = NULL; |
|
612 |
if ( postionbasedsearching && ( aInParamList.Count() > 2) ) |
|
613 |
{ |
|
614 |
pos = 2; |
|
615 |
aInParamList.AtL( pos,posbasedparam ); |
|
616 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
617 |
{ |
|
618 |
param = NULL; |
|
619 |
} |
|
620 |
else |
|
621 |
{ |
|
622 |
param = &posbasedparam; |
|
623 |
} |
|
624 |
} |
|
625 |
else |
|
626 |
{ |
|
627 |
pos=0;//Search from starting point |
|
628 |
//filter map |
|
629 |
param = aInParamList.FindFirst( pos, KOptions ); |
|
630 |
} |
|
631 |
||
632 |
||
633 |
||
634 |
||
635 |
//Options is prsent |
|
636 |
if ( param && (param->Value().TypeId() != LIW::EVariantTypeNull ) ) |
|
637 |
{ |
|
638 |
if( (param->Value().TypeId() != LIW::EVariantTypeMap ) && |
|
639 |
(param->Value().TypeId() != LIW::EVariantTypeNull )) |
|
640 |
{ |
|
641 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) ); |
|
642 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
643 |
posbasedparam.Reset(); |
|
644 |
return; |
|
645 |
} |
|
646 |
||
647 |
const CLiwMap* optionsmap = param->Value().AsMap(); |
|
648 |
||
649 |
if ( optionsmap ) |
|
650 |
{ |
|
651 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mode) ); |
|
652 |
||
653 |
if (optionsmap->FindL( KMode, mode ) && (mode.TypeId() != LIW::EVariantTypeNull )) |
|
654 |
{ |
|
655 |
if (( mode.AsDes().Length() > KMAXCONTENTLENGTH ) || !mode.Get( options.iMode )) |
|
656 |
{ |
|
657 |
//content type is different: do cleanup, append error and return |
|
658 |
||
659 |
CleanupStack::Pop(&mode); |
|
660 |
mode.Reset() ; |
|
661 |
||
662 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
663 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
664 |
||
665 |
posbasedparam.Reset(); |
|
666 |
return; |
|
667 |
} |
|
668 |
||
669 |
} |
|
670 |
||
671 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &postion) ); |
|
672 |
||
673 |
if (optionsmap->FindL( KPosition, postion ) && (postion.TypeId() != LIW::EVariantTypeNull )) |
|
674 |
{ |
|
675 |
if (( postion.AsDes().Length() > KMAXCONTENTLENGTH ) || !postion.Get( options.iPostion )) |
|
676 |
{ |
|
677 |
//content type is different: do cleanup, append error and return |
|
678 |
CleanupStack::Pop(&postion); |
|
679 |
CleanupStack::Pop(&mode); |
|
680 |
||
681 |
mode.Reset() ; |
|
682 |
postion.Reset() ; |
|
683 |
||
684 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
685 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
686 |
||
687 |
posbasedparam.Reset(); |
|
688 |
return; |
|
689 |
} |
|
690 |
} |
|
691 |
||
692 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &document) ); |
|
693 |
||
694 |
if (optionsmap->FindL( KDocumentPath, document ) || (document.TypeId() != LIW::EVariantTypeNull ) ) |
|
695 |
{ |
|
696 |
if ( ( document.AsDes().Length() > KMAXPATHLENGTH ) || !document.Get( options.iDocument ) ) |
|
697 |
{ |
|
698 |
//content type is different: do cleanup, append error and return |
|
699 |
CleanupStack::Pop(3); //document, position, mode |
|
700 |
||
701 |
mode.Reset() ; |
|
702 |
postion.Reset() ; |
|
703 |
document.Reset(); |
|
704 |
||
705 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
706 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
707 |
||
708 |
posbasedparam.Reset(); |
|
709 |
return; |
|
710 |
} |
|
711 |
} |
|
712 |
||
713 |
CleanupStack::Pop(3); //document, position, mode |
|
714 |
||
715 |
} |
|
716 |
||
717 |
} |
|
718 |
||
719 |
||
720 |
||
721 |
TInt errCode; |
|
722 |
||
723 |
//Converting command line form 16 to 8-bit |
|
724 |
||
725 |
HBufC8* heapBuffer = HBufC8::NewL( cmdline.Length() ); |
|
726 |
CleanupStack::PushL( heapBuffer ); |
|
727 |
TPtr8 cmdline8( heapBuffer->Des() ); |
|
728 |
cmdline8.Copy( cmdline ); |
|
729 |
||
730 |
if( aCallBack ) |
|
731 |
{ |
|
732 |
//Asynch Call |
|
733 |
CAppServiceObserver* observer = CAppServiceObserver::NewL( aCallBack ); |
|
734 |
CleanupStack::PushL( observer ); |
|
735 |
TRAP ( errCode, iCoreClass->LaunchApplicationL( appId, cmdline8, options, observer, aTransactionID ) ); |
|
736 |
CleanupStack::Pop( observer ); |
|
737 |
} |
|
738 |
else |
|
739 |
{ |
|
740 |
TRAP ( errCode, iCoreClass->LaunchApplicationL( appId, cmdline8, options ) ); |
|
741 |
} |
|
742 |
||
743 |
CleanupStack::PopAndDestroy( heapBuffer ); |
|
744 |
||
745 |
mode.Reset(); |
|
746 |
postion.Reset(); |
|
747 |
document.Reset(); |
|
748 |
||
749 |
TInt sapiErr = SErrNone; |
|
750 |
if (errCode) |
|
751 |
{ |
|
752 |
sapiErr = SapiError( errCode ); |
|
753 |
} |
|
754 |
||
755 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( ( TInt32 ) sapiErr ) )); |
|
756 |
||
757 |
} |
|
758 |
else |
|
759 |
{ |
|
760 |
//content type missig : Mandatory Argument |
|
761 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrMissingArgument) ) ); |
|
762 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KApplicationIDMissing ) ) ); |
|
763 |
} |
|
764 |
||
765 |
posbasedparam.Reset(); |
|
766 |
||
767 |
} |
|
768 |
||
769 |
||
770 |
||
771 |
// ----------------------------------------------------------------------------- |
|
772 |
// CAppManagerInterface::GetListL |
|
773 |
// This function will send the request to Core class |
|
774 |
// ----------------------------------------------------------------------------- |
|
775 |
||
776 |
void CAppManagerInterface::LaunchDocL(const CLiwGenericParamList& aInParamList, |
|
777 |
CLiwGenericParamList& aOutParamList, |
|
778 |
MLiwNotifyCallback* aCallBack, |
|
779 |
TInt32 aTransactionID ) |
|
780 |
||
781 |
{ |
|
782 |
||
783 |
TLiwGenericParam posbasedparam; |
|
784 |
TBool postionbasedsearching = EFalse; |
|
785 |
TDocument document; |
|
786 |
TOptions options; |
|
787 |
const TLiwGenericParam* param = NULL; |
|
788 |
TInt pos = 0; |
|
789 |
const CLiwMap* documentmap = NULL; |
|
790 |
TLiwVariant mode; |
|
791 |
TLiwVariant path; |
|
792 |
TLiwVariant handle; |
|
793 |
||
794 |
param = aInParamList.FindFirst( pos, KDocument ); |
|
795 |
||
796 |
if( !param ) |
|
797 |
{ |
|
798 |
||
799 |
if( aInParamList.Count() > 0 ) |
|
800 |
{ |
|
801 |
pos = 0; |
|
802 |
aInParamList.AtL( pos,posbasedparam ); |
|
803 |
||
804 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
805 |
{ |
|
806 |
param = NULL; |
|
807 |
} |
|
808 |
else |
|
809 |
{ |
|
810 |
param = &posbasedparam; |
|
811 |
postionbasedsearching = ETrue; |
|
812 |
} |
|
813 |
} |
|
814 |
} |
|
815 |
||
816 |
if ( param ) |
|
817 |
{ |
|
818 |
documentmap = param->Value().AsMap(); |
|
819 |
if ((param->Value().TypeId() != LIW::EVariantTypeNull) && |
|
820 |
(!documentmap && !postionbasedsearching)) |
|
821 |
{ |
|
822 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) ); |
|
823 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchDocMapTypeMismatch ) ) ); |
|
824 |
posbasedparam.Reset(); |
|
825 |
return; |
|
826 |
} |
|
827 |
||
828 |
} |
|
829 |
||
830 |
||
831 |
param = aInParamList.FindFirst( pos, KMimeType ); |
|
832 |
||
833 |
if( !param ) |
|
834 |
{ |
|
835 |
||
836 |
if( aInParamList.Count() > 1 ) |
|
837 |
{ |
|
838 |
pos = 1; |
|
839 |
aInParamList.AtL( pos,posbasedparam ); |
|
840 |
||
841 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
842 |
{ |
|
843 |
param = NULL; |
|
844 |
} |
|
845 |
else |
|
846 |
{ |
|
847 |
param = &posbasedparam; |
|
848 |
postionbasedsearching = ETrue; |
|
849 |
} |
|
850 |
} |
|
851 |
} |
|
852 |
||
853 |
||
854 |
if ((param) && (param->Value().TypeId() != LIW::EVariantTypeNull) && (param->Value().TypeId() != LIW::EVariantTypeDesC) ) |
|
855 |
{ |
|
856 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) ); |
|
857 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchDocMimeTypeMismatch ) ) ); |
|
858 |
posbasedparam.Reset(); |
|
859 |
return; |
|
860 |
} |
|
861 |
||
862 |
||
863 |
// present : Mandatory Argument |
|
864 |
TBuf<KMAXCONTENTLENGTH> mimetype; |
|
865 |
if( ( (param) && ( param->Value().AsDes().Length() < KMAXCONTENTLENGTH ) && (param->Value().Get( mimetype )) ) || ( documentmap ) ) |
|
866 |
{ |
|
867 |
||
868 |
||
869 |
||
870 |
param = NULL; |
|
871 |
if ( postionbasedsearching && ( aInParamList.Count() > 2) ) |
|
872 |
{ |
|
873 |
pos = 2; |
|
874 |
aInParamList.AtL( pos,posbasedparam ); |
|
875 |
if ( (posbasedparam.Name().CompareF(KNullDesC8) != 0 ) || posbasedparam.Value().IsEmpty() ) |
|
876 |
{ |
|
877 |
param = NULL; |
|
878 |
} |
|
879 |
else |
|
880 |
{ |
|
881 |
param = &posbasedparam; |
|
882 |
} |
|
883 |
} |
|
884 |
else |
|
885 |
{ |
|
886 |
pos=0;//Search from starting point |
|
887 |
//filter map |
|
888 |
param = aInParamList.FindFirst( pos, KOptions ); |
|
889 |
} |
|
890 |
||
891 |
||
892 |
//Options is prsent |
|
893 |
if ( param ) |
|
894 |
{ |
|
895 |
if( (param->Value().TypeId() != LIW::EVariantTypeMap ) && |
|
896 |
(param->Value().TypeId() != LIW::EVariantTypeNull ) ) |
|
897 |
{ |
|
898 |
//Option Type MisMatch |
|
899 |
||
900 |
mode.Reset(); |
|
901 |
||
902 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( (TInt32)SErrBadArgumentType ) ) ); |
|
903 |
aOutParamList.AppendL( TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchOptionsTypeMismatch ) ) ); |
|
904 |
posbasedparam.Reset(); |
|
905 |
return; |
|
906 |
} |
|
907 |
||
908 |
const CLiwMap* optionsmap = param->Value().AsMap(); |
|
909 |
||
910 |
if(optionsmap) |
|
911 |
||
912 |
{ |
|
913 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mode) ); |
|
914 |
optionsmap->FindL( KMode, mode ); |
|
915 |
if (( mode.AsDes().Length() > KMAXCONTENTLENGTH ) || !mode.Get( options.iMode )) |
|
916 |
{ |
|
917 |
||
918 |
CleanupStack::Pop(&mode); |
|
919 |
mode.Reset() ; |
|
920 |
||
921 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
922 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
923 |
||
924 |
posbasedparam.Reset(); |
|
925 |
return; |
|
926 |
} |
|
927 |
CleanupStack::Pop(&mode); |
|
928 |
} |
|
929 |
} |
|
930 |
||
931 |
||
932 |
//Document is prsent |
|
933 |
if ( documentmap ) |
|
934 |
{ |
|
935 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &path) ); |
|
936 |
if (documentmap->FindL( KDocumentPath, path )) |
|
937 |
{ |
|
938 |
||
939 |
if ( ( path.AsDes().Length() > KMAXPATHLENGTH ) || !path.Get( document.iPath ) ) |
|
940 |
{ |
|
941 |
//content type is different: do cleanup, append error and return |
|
942 |
CleanupStack::Pop(&path);//path |
|
943 |
path.Reset(); |
|
944 |
||
945 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
946 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
947 |
||
948 |
posbasedparam.Reset(); |
|
949 |
return; |
|
950 |
} |
|
951 |
||
952 |
} |
|
953 |
CleanupStack::Pop(); |
|
954 |
||
955 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &handle) ); |
|
956 |
if (documentmap->FindL( KHandle, handle ) && (handle.TypeId() != LIW::EVariantTypeNull )) |
|
957 |
{ |
|
958 |
if (!handle.Get( document.iHandle )) |
|
959 |
{ |
|
960 |
//do cleanup, append error and return |
|
961 |
CleanupStack::Pop(&handle); |
|
962 |
handle.Reset() ; |
|
963 |
||
964 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant ( (TInt32)SErrBadArgumentType) ) ); |
|
965 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KLaunchAppOptionsTypeMismatch ) ) ); |
|
966 |
||
967 |
posbasedparam.Reset(); |
|
968 |
return; |
|
969 |
} |
|
970 |
||
971 |
} |
|
972 |
||
973 |
CleanupStack::Pop(); |
|
974 |
/* |
|
975 |
// The follwing code will be introduced once default file buffer is created |
|
976 |
CLiwBuffer* buffer = NULL; |
|
977 |
buffer = handle.AsBuffer(); |
|
978 |
if ( KLiwBufferFile == buffer->TypeID() ) |
|
979 |
{ |
|
980 |
CLiwFileBuffer* filebuffer = ( CLiwFileBuffer* ) buffer; |
|
981 |
document.iHandle = filebuffer->AsFile(); |
|
982 |
} |
|
983 |
*/ |
|
984 |
} |
|
985 |
||
986 |
||
987 |
TInt errCode; |
|
988 |
//Converting command line form 16 to 8-bit |
|
989 |
||
990 |
HBufC8* heapBuffer = HBufC8::NewL( mimetype.Length() ); |
|
991 |
CleanupStack::PushL( heapBuffer ); |
|
992 |
TPtr8 mimetype8( heapBuffer->Des() ); |
|
993 |
mimetype8.Copy( mimetype ); |
|
994 |
TPtrC filename; |
|
46
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
995 |
// RTSP handling |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
996 |
if( ! document.iPath.Left(KRtspPrefix().Length()).CompareF(KRtspPrefix) ) |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
997 |
{ |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
998 |
RFs fs; |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
999 |
User::LeaveIfError(fs.Connect()); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1000 |
RFile file; |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1001 |
fs.MkDir( KTempPath ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1002 |
file.Replace( fs, KTempFile, EFileWrite | EFileStreamText ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1003 |
HBufC8 *tempPath = HBufC8::NewLC( document.iPath.Length() ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1004 |
tempPath->Des().Copy( document.iPath ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1005 |
file.Write( *tempPath ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1006 |
document.iPath.Set( KTempFile ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1007 |
file.Close(); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1008 |
fs.Close(); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1009 |
HBufC8 *tempMime; |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1010 |
tempMime = KRamMime().AllocLC(); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1011 |
mimetype8.Set( tempMime->Des() ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1012 |
CleanupStack::PopAndDestroy( tempMime ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1013 |
CleanupStack::PopAndDestroy( tempPath ); |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1014 |
} |
5146369cfdc9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1015 |
|
5 | 1016 |
|
1017 |
if( aCallBack ) |
|
1018 |
{ |
|
1019 |
//Asynch Call |
|
1020 |
CAppServiceObserver* observer = CAppServiceObserver::NewL( aCallBack ); |
|
1021 |
CleanupStack::PushL( observer ); |
|
1022 |
TRAP ( errCode, iCoreClass->LaunchDocumentL( document, mimetype8, options , filename, observer, aTransactionID ) ); |
|
1023 |
CleanupStack::Pop( observer ); |
|
1024 |
} |
|
1025 |
else |
|
1026 |
{ |
|
1027 |
TRAP ( errCode, iCoreClass->LaunchDocumentL(document, mimetype8, options , filename ) ); |
|
1028 |
} |
|
1029 |
||
1030 |
CleanupStack::PopAndDestroy( heapBuffer ); |
|
1031 |
path.Reset(); |
|
1032 |
handle.Reset(); |
|
1033 |
mode.Reset(); |
|
1034 |
||
1035 |
TInt sapiErr = SErrNone; |
|
1036 |
if (errCode) |
|
1037 |
{ |
|
1038 |
sapiErr = SapiError( errCode ); |
|
1039 |
} |
|
1040 |
||
1041 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( ( TInt32 ) sapiErr ) )); |
|
1042 |
||
1043 |
if( filename.Length() != 0) |
|
1044 |
{ |
|
1045 |
aOutParamList.AppendL( TLiwGenericParam( KDocumentName, TLiwVariant( filename ) )); |
|
1046 |
} |
|
1047 |
||
1048 |
} |
|
1049 |
else |
|
1050 |
{ |
|
1051 |
//missig : Mandatory Argument |
|
1052 |
aOutParamList.AppendL( TLiwGenericParam( KErrorCode, TLiwVariant( ( TInt32 ) SErrMissingArgument ) ) ); |
|
1053 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMsg, TLiwVariant( KDocumentMissing ) ) ); |
|
1054 |
} |
|
1055 |
||
1056 |
posbasedparam.Reset(); |
|
1057 |
||
1058 |
} |
|
1059 |
||
1060 |
||
1061 |
||
1062 |
// ----------------------------------------------------------------------------- |
|
1063 |
// CAppManagerInterface::SapiError |
|
1064 |
// This function is called by the user to get mapped SAPI generic error code |
|
1065 |
// from symbian error codes . |
|
1066 |
// ----------------------------------------------------------------------------- |
|
1067 |
||
1068 |
TInt CAppManagerInterface::SapiError( TInt aSymbianErr ) |
|
1069 |
{ |
|
1070 |
TInt sapiErr(SErrGeneralError); |
|
1071 |
||
1072 |
switch (aSymbianErr) |
|
1073 |
{ |
|
1074 |
case KErrArgument: |
|
1075 |
{ |
|
1076 |
sapiErr = SErrBadArgumentType; |
|
1077 |
break; |
|
1078 |
} |
|
1079 |
case KErrNotSupported: |
|
1080 |
{ |
|
1081 |
sapiErr = SErrServiceNotSupported; |
|
1082 |
break; |
|
1083 |
} |
|
1084 |
case KErrServerBusy: |
|
1085 |
{ |
|
1086 |
sapiErr = SErrServerBusy; |
|
1087 |
break; |
|
1088 |
} |
|
1089 |
case KErrGeneral: |
|
1090 |
case KErrBadName: |
|
1091 |
{ |
|
1092 |
sapiErr = SErrGeneralError; |
|
1093 |
break; |
|
1094 |
} |
|
1095 |
case KErrCancel: |
|
1096 |
{ |
|
1097 |
sapiErr = SErrCancelSuccess; |
|
1098 |
break; |
|
1099 |
} |
|
1100 |
case KErrNone: |
|
1101 |
{ |
|
1102 |
sapiErr= SErrNone; |
|
1103 |
break; |
|
1104 |
} |
|
1105 |
case KErrNotFound: |
|
1106 |
{ |
|
1107 |
sapiErr= SErrMissingArgument; |
|
1108 |
break; |
|
1109 |
} |
|
1110 |
case KErrNoMemory: |
|
1111 |
{ |
|
1112 |
sapiErr = SErrNoMemory; |
|
1113 |
break; |
|
1114 |
} |
|
1115 |
case KErrInUse: |
|
1116 |
{ |
|
1117 |
sapiErr = SErrServiceInUse; |
|
1118 |
break; |
|
1119 |
} |
|
1120 |
case KErrNotReady: |
|
1121 |
{ |
|
1122 |
sapiErr = SErrServiceNotReady; |
|
1123 |
break; |
|
1124 |
} |
|
1125 |
case KErrPathNotFound: |
|
1126 |
{ |
|
1127 |
sapiErr = SErrPathNotFound ; |
|
1128 |
break; |
|
1129 |
} |
|
1130 |
} |
|
1131 |
return sapiErr; |
|
1132 |
} |