75 TInt CAHAppLauncher::ExecuteTypeLaunchL( const CLiwMap* aMap ) |
75 TInt CAHAppLauncher::ExecuteTypeLaunchL( const CLiwMap* aMap ) |
76 { |
76 { |
77 TInt errCode(KErrArgument); |
77 TInt errCode(KErrArgument); |
78 RBuf launchMethod; |
78 RBuf launchMethod; |
79 CleanupClosePushL( launchMethod ); |
79 CleanupClosePushL( launchMethod ); |
80 |
80 |
81 if ( !ExtractDesL( aMap, launchMethod, KLaunchMethod ) ) |
81 if ( !ExtractDesL( aMap, launchMethod, KLaunchMethod ) ) |
82 { |
82 { |
83 if ( !launchMethod.CompareF( KLaunchMethodValueCmdLine ) ) |
83 if ( !launchMethod.CompareF( KLaunchMethodValueCmdLine ) ) |
84 { |
84 { |
85 errCode = ExecuteCommmandLineL( aMap ); |
85 errCode = ExecuteCommmandLineL( aMap ); |
88 || !launchMethod.CompareF( KLaunchMethodValueMessageWithTail ) ) |
88 || !launchMethod.CompareF( KLaunchMethodValueMessageWithTail ) ) |
89 { |
89 { |
90 errCode = ExecuteApaMessageL( aMap ); |
90 errCode = ExecuteApaMessageL( aMap ); |
91 } |
91 } |
92 } |
92 } |
93 |
93 |
94 CleanupStack::PopAndDestroy( &launchMethod ); |
94 CleanupStack::PopAndDestroy( &launchMethod ); |
95 return errCode; |
95 return errCode; |
96 } |
96 } |
97 |
97 |
98 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
99 // Executes provided command line action |
99 // Executes provided command line action |
131 } |
131 } |
132 |
132 |
133 // --------------------------------------------------------------------------- |
133 // --------------------------------------------------------------------------- |
134 // Executes provided apa message action |
134 // Executes provided apa message action |
135 // --------------------------------------------------------------------------- |
135 // --------------------------------------------------------------------------- |
136 // |
136 // |
137 TInt CAHAppLauncher::ExecuteApaMessageL( const CLiwMap* aMap ) |
137 TInt CAHAppLauncher::ExecuteApaMessageL( const CLiwMap* aMap ) |
138 { |
138 { |
139 TInt errCode(KErrArgument); |
139 TInt errCode(KErrArgument); |
140 TUid appUid= TUid::Null( ); |
140 TUid appUid= TUid::Null( ); |
141 if ( !ExtractUidL( aMap, appUid, KApplicationUid ) ) |
141 if ( !ExtractUidL( aMap, appUid, KApplicationUid ) ) |
142 { |
142 { |
143 TApaTaskList taskList( iEnv->WsSession() ); |
143 TApaTaskList taskList( iEnv->WsSession() ); |
144 TApaTask task = taskList.FindApp( appUid ); |
144 TApaTask task = taskList.FindApp( appUid ); |
145 if ( task.Exists( ) ) |
145 if ( task.Exists( ) ) |
146 { |
146 { |
147 TUid messageUid= TUid::Null( ); |
147 TUid messageUid= TUid::Null( ); |
148 |
148 |
149 RBuf8 additionalData; |
149 RBuf8 additionalData; |
150 CleanupClosePushL( additionalData ); |
150 CleanupClosePushL( additionalData ); |
151 if ( !ExtractUidL( aMap, messageUid, KMessageUid ) |
151 if ( !ExtractUidL( aMap, messageUid, KMessageUid ) |
152 && !ExtractDes8L( aMap, additionalData, KAdditionalData ) ) |
152 && !ExtractDes8L( aMap, additionalData, KAdditionalData ) ) |
153 { |
153 { |
154 errCode = task.SendMessage( messageUid, additionalData ); |
154 errCode = task.SendMessage( messageUid, additionalData ); |
155 } |
155 } |
156 CleanupStack::PopAndDestroy( &additionalData ); |
156 CleanupStack::PopAndDestroy( &additionalData ); |
157 } |
157 } |
158 else |
158 else |
159 { // app not yet running |
159 { // app not yet running |
160 RBuf launchMethod; |
160 RBuf launchMethod; |
161 CleanupClosePushL( launchMethod ); |
161 CleanupClosePushL( launchMethod ); |
168 else if ( !launchMethod.CompareF( KLaunchMethodValueMessageWithTail ) ) |
168 else if ( !launchMethod.CompareF( KLaunchMethodValueMessageWithTail ) ) |
169 { |
169 { |
170 errCode = StartAppL( aMap ); |
170 errCode = StartAppL( aMap ); |
171 } |
171 } |
172 } |
172 } |
173 CleanupStack::PopAndDestroy( &launchMethod ); |
173 CleanupStack::PopAndDestroy( &launchMethod ); |
174 } |
174 } |
175 } |
175 } |
176 return errCode; |
176 return errCode; |
177 |
177 |
178 } |
178 } |
179 // --------------------------------------------------------------------------- |
179 // --------------------------------------------------------------------------- |
180 // Start document |
180 // Start document |
181 // --------------------------------------------------------------------------- |
181 // --------------------------------------------------------------------------- |
182 // |
182 // |
183 TInt CAHAppLauncher::StartDocumentL( const CLiwMap* aMap ) |
183 TInt CAHAppLauncher::StartDocumentL( const CLiwMap* aMap ) |
184 { |
184 { |
185 TInt errCode(KErrArgument); |
185 TInt errCode(KErrArgument); |
186 TUid appUid= TUid::Null( ); |
186 TUid appUid= TUid::Null( ); |
187 RBuf documentNameValue; |
187 RBuf documentNameValue; |
188 CleanupClosePushL( documentNameValue ); |
188 CleanupClosePushL( documentNameValue ); |
189 if ( !ExtractUidL( aMap, appUid, KApplicationUid ) |
189 if ( !ExtractUidL( aMap, appUid, KApplicationUid ) |
190 && !ExtractDesL( aMap, documentNameValue, KDocumentName ) ) |
190 && !ExtractDesL( aMap, documentNameValue, KDocumentName ) ) |
191 { |
191 { |
192 RApaLsSession appArcSession; |
192 RApaLsSession appArcSession; |
193 CleanupClosePushL( appArcSession ); |
193 CleanupClosePushL( appArcSession ); |
194 User::LeaveIfError( appArcSession.Connect( ) ); |
194 User::LeaveIfError( appArcSession.Connect( ) ); |
200 return errCode; |
200 return errCode; |
201 } |
201 } |
202 // --------------------------------------------------------------------------- |
202 // --------------------------------------------------------------------------- |
203 // Starts application |
203 // Starts application |
204 // --------------------------------------------------------------------------- |
204 // --------------------------------------------------------------------------- |
205 // |
205 // |
206 TInt CAHAppLauncher::StartAppL( const CLiwMap* aMap ) |
206 TInt CAHAppLauncher::StartAppL( const CLiwMap* aMap ) |
207 { |
207 { |
208 TInt errCode(KErrArgument); |
208 TInt errCode(KErrArgument); |
209 TUid appUid= TUid::Null( ); |
209 TUid appUid= TUid::Null( ); |
210 RBuf8 additionalData; |
210 RBuf8 additionalData; |
292 CleanupStack::PopAndDestroy( &type ); |
292 CleanupStack::PopAndDestroy( &type ); |
293 return errCode; |
293 return errCode; |
294 } |
294 } |
295 |
295 |
296 // --------------------------------------------------------------------------- |
296 // --------------------------------------------------------------------------- |
297 // |
297 // |
298 // --------------------------------------------------------------------------- |
298 // --------------------------------------------------------------------------- |
299 // |
299 // |
300 TInt CAHAppLauncher::ExtractDesL( const CLiwMap* aMap, |
300 TInt CAHAppLauncher::ExtractDesL( const CLiwMap* aMap, |
301 RBuf& aString, const TDesC8& aMapName ) |
301 RBuf& aString, const TDesC8& aMapName ) |
302 { |
302 { |
304 TLiwVariant variant; |
304 TLiwVariant variant; |
305 variant.PushL( ); |
305 variant.PushL( ); |
306 TPtrC tempString( KNullDesC ); |
306 TPtrC tempString( KNullDesC ); |
307 if ( aMap->FindL( aMapName, variant ) ) |
307 if ( aMap->FindL( aMapName, variant ) ) |
308 { |
308 { |
309 variant.Get( tempString ); |
309 if ( variant.Get( tempString ) ) |
310 aString.ReAllocL( tempString.Length( ) ); |
310 { |
311 aString.Append( tempString ); |
311 aString.ReAllocL( tempString.Length( ) ); |
312 errCode = KErrNone; |
312 aString.Append( tempString ); |
313 } |
313 errCode = KErrNone; |
314 CleanupStack::PopAndDestroy( &variant ); |
314 } |
315 return errCode; |
315 else |
316 } |
316 { |
317 |
317 errCode = KErrCorrupt; |
318 // --------------------------------------------------------------------------- |
318 } |
319 // |
319 } |
|
320 CleanupStack::PopAndDestroy( &variant ); |
|
321 return errCode; |
|
322 } |
|
323 |
|
324 // --------------------------------------------------------------------------- |
|
325 // |
320 // --------------------------------------------------------------------------- |
326 // --------------------------------------------------------------------------- |
321 // |
327 // |
322 TInt CAHAppLauncher::ExtractDes8L( const CLiwMap* aMap, |
328 TInt CAHAppLauncher::ExtractDes8L( const CLiwMap* aMap, |
323 RBuf8& aString, const TDesC8& aMapName ) |
329 RBuf8& aString, const TDesC8& aMapName ) |
324 { |
330 { |
326 TLiwVariant variant; |
332 TLiwVariant variant; |
327 variant.PushL( ); |
333 variant.PushL( ); |
328 TPtrC8 tempString( KNullDesC8 ); |
334 TPtrC8 tempString( KNullDesC8 ); |
329 if ( aMap->FindL( aMapName, variant ) ) |
335 if ( aMap->FindL( aMapName, variant ) ) |
330 { |
336 { |
331 variant.Get( tempString ); |
337 if ( variant.Get( tempString ) ) |
332 aString.ReAllocL( tempString.Length( ) ); |
338 { |
333 aString.Append( tempString ); |
339 aString.ReAllocL( tempString.Length( ) ); |
334 errCode = KErrNone; |
340 aString.Append( tempString ); |
335 } |
341 errCode = KErrNone; |
336 CleanupStack::PopAndDestroy( &variant ); |
342 } |
337 return errCode; |
343 else |
338 } |
344 { |
339 |
345 errCode = KErrCorrupt; |
340 // --------------------------------------------------------------------------- |
346 } |
341 // |
347 } |
|
348 CleanupStack::PopAndDestroy( &variant ); |
|
349 return errCode; |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------------------------- |
|
353 // |
342 // --------------------------------------------------------------------------- |
354 // --------------------------------------------------------------------------- |
343 // |
355 // |
344 TInt CAHAppLauncher::ExtractUidL( const CLiwMap* aMap, TUid& aUid, |
356 TInt CAHAppLauncher::ExtractUidL( const CLiwMap* aMap, TUid& aUid, |
345 const TDesC8& aMapName ) |
357 const TDesC8& aMapName ) |
346 |
358 |
349 TInt32 temp; |
361 TInt32 temp; |
350 TLiwVariant variant; |
362 TLiwVariant variant; |
351 variant.PushL( ); |
363 variant.PushL( ); |
352 if ( aMap->FindL( aMapName, variant ) ) |
364 if ( aMap->FindL( aMapName, variant ) ) |
353 { |
365 { |
354 variant.Get( temp ); |
366 if ( variant.Get( temp ) ) |
355 aUid = TUid::Uid( temp ); |
367 { |
356 errCode = KErrNone; |
368 aUid = TUid::Uid( temp ); |
|
369 errCode = KErrNone; |
|
370 } |
|
371 else |
|
372 { |
|
373 errCode = KErrCorrupt; |
|
374 } |
357 } |
375 } |
358 CleanupStack::PopAndDestroy( &variant ); |
376 CleanupStack::PopAndDestroy( &variant ); |
359 return errCode; |
377 return errCode; |
360 } |
378 } |
361 |
379 |
362 // --------------------------------------------------------------------------- |
380 // --------------------------------------------------------------------------- |
363 // |
381 // |
364 // --------------------------------------------------------------------------- |
382 // --------------------------------------------------------------------------- |
365 // |
383 // |
366 TInt CAHAppLauncher::ExtractViewIdL( const CLiwMap* aMap, TVwsViewId& aViewId ) |
384 TInt CAHAppLauncher::ExtractViewIdL( const CLiwMap* aMap, TVwsViewId& aViewId ) |
367 |
385 |
368 { |
386 { |
369 TInt errCode(KErrNotFound); |
387 TInt errCode(KErrNotFound); |
370 TLiwVariant variant; |
388 TLiwVariant variant; |
371 if ( aMap->FindL( KViewId, variant ) ) |
389 if ( aMap->FindL( KViewId, variant ) ) |
372 { |
390 { |
373 variant.Get( aViewId.iViewUid.iUid ); |
391 if ( variant.Get( aViewId.iViewUid.iUid ) ) |
374 variant.Reset( ); |
392 { |
375 if ( aMap->FindL( KViewAppUid, variant ) ) |
|
376 { |
|
377 variant.Get( aViewId.iAppUid.iUid ); |
|
378 variant.Reset( ); |
393 variant.Reset( ); |
379 errCode = KErrNone; |
394 if ( aMap->FindL( KViewAppUid, variant ) ) |
380 } |
395 { |
381 } |
396 if ( variant.Get( aViewId.iAppUid.iUid ) ) |
382 |
397 { |
383 return errCode; |
398 variant.Reset( ); |
384 } |
399 errCode = KErrNone; |
385 |
400 } |
386 // --------------------------------------------------------------------------- |
401 else |
387 // |
402 { |
|
403 errCode = KErrCorrupt; |
|
404 } |
|
405 } |
|
406 } |
|
407 else |
|
408 { |
|
409 errCode = KErrCorrupt; |
|
410 } |
|
411 } |
|
412 |
|
413 return errCode; |
|
414 } |
|
415 |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
388 // --------------------------------------------------------------------------- |
418 // --------------------------------------------------------------------------- |
389 // |
419 // |
390 TApaCommand CAHAppLauncher::GetCommandL( const CLiwMap* aMap ) |
420 TApaCommand CAHAppLauncher::GetCommandL( const CLiwMap* aMap ) |
391 { |
421 { |
392 TApaCommand command(EApaCommandOpen); |
422 TApaCommand command(EApaCommandOpen); |