|
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 #include "afactivitylauncher_p.h" |
|
19 |
|
20 #include <uri16.h> |
|
21 #include <delimitedquery16.h> |
|
22 |
|
23 #include <afstorageclient.h> |
|
24 #include <afentry.h> |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // Public part of construction, destructor |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CAfActivityLauncherPrivate *CAfActivityLauncherPrivate::NewL(RApaLsSession &apaLsSession, RWsSession &wsSession) |
|
31 { |
|
32 CAfActivityLauncherPrivate *self = new (ELeave)CAfActivityLauncherPrivate(apaLsSession, wsSession); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CAfActivityLauncherPrivate::~CAfActivityLauncherPrivate() |
|
40 { |
|
41 delete mActivitiesClient; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // Private part of construction |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CAfActivityLauncherPrivate::CAfActivityLauncherPrivate(RApaLsSession &apaLsSession, RWsSession &wsSession) : mApplicationLauncher(apaLsSession, wsSession) |
|
49 { |
|
50 } |
|
51 |
|
52 void CAfActivityLauncherPrivate::ConstructL() |
|
53 { |
|
54 mActivitiesClient = CAfStorageClient::NewL(*this); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // Implementation of MAfAsyncRequestObserver interface. We don't need any |
|
59 // notifications, but we have to pass an instance of this interface to |
|
60 // CAfStorageClient constructor. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void CAfActivityLauncherPrivate::waitActivityRequestCompleted(int /*result*/, const TDesC8 &/*data*/) |
|
64 { |
|
65 } |
|
66 |
|
67 void CAfActivityLauncherPrivate::getThumbnailRequestCompleted(int /*result*/, int /*bitmapHandle*/, void */*userData*/) |
|
68 { |
|
69 } |
|
70 |
|
71 void CAfActivityLauncherPrivate::dataChangeNotificationCompleted(int /*result*/) |
|
72 { |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // Actual activity launching |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 |
|
80 void CAfActivityLauncherPrivate::launchActivityL(const TDesC &uriDesc) |
|
81 { |
|
82 TUriParser16 parser; |
|
83 parser.Parse(uriDesc); |
|
84 |
|
85 if (parser.Extract(EUriScheme).Compare(_L("appto")) == 0) { |
|
86 TLex16 uidParser(parser.Extract(EUriHost)); |
|
87 TUint uid; |
|
88 User::LeaveIfError(uidParser.Val(uid, EHex)); |
|
89 |
|
90 if (mApplicationLauncher.isRunning(TUid::Uid(uid))) { |
|
91 CAfEntry *launchRequest = CAfEntry::NewLC(0, uid, uriDesc, KNullDesC(), KNullDesC8(), KNullDesC8()); |
|
92 User::LeaveIfError(mActivitiesClient->launchActivity(*launchRequest)); |
|
93 CleanupStack::PopAndDestroy(launchRequest); |
|
94 } else { |
|
95 mApplicationLauncher.startApplicationL(TUid::Uid(uid), uriDesc); |
|
96 } |
|
97 } else { |
|
98 User::Leave(KErrArgument); |
|
99 } |
|
100 } |