1 /* |
|
2 * Copyright (c) 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: Base class implementation for AppMngr2 plug-ins |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "appmngr2runtime.h" // CAppMngr2Runtime |
|
20 #include "appmngr2driveutils.h" // TAppMngr2DriveUtils |
|
21 #include "appmngr2debugutils.h" // FLOG macros |
|
22 #include <ecom/ecom.h> // REComSession |
|
23 #include <eikenv.h> // CEikonEnv |
|
24 |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CAppMngr2Runtime::NewL() |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C CAppMngr2Runtime* CAppMngr2Runtime::NewL( TUid aImplementationUid, |
|
33 MAppMngr2RuntimeObserver &aObserver ) |
|
34 { |
|
35 FLOG( "CAppMngr2Runtime::NewL( 0x%08x )", aImplementationUid.iUid ); |
|
36 TUid destructorIDKey; |
|
37 TAny* ptr = REComSession::CreateImplementationL( aImplementationUid, |
|
38 destructorIDKey, &aObserver ); |
|
39 CAppMngr2Runtime* self = reinterpret_cast<CAppMngr2Runtime*>( ptr ); |
|
40 if( self ) |
|
41 { |
|
42 CleanupStack::PushL( self ); |
|
43 self->iDtorIDKey = destructorIDKey; |
|
44 self->ConstructL( aImplementationUid ); |
|
45 CleanupStack::Pop( self ); |
|
46 } |
|
47 return self; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CAppMngr2Runtime::~CAppMngr2Runtime() |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C CAppMngr2Runtime::~CAppMngr2Runtime() |
|
55 { |
|
56 FLOG( "CAppMngr2Runtime::~CAppMngr2Runtime( 0x%08x )", iRuntimeUid.iUid ); |
|
57 REComSession::DestroyedImplementation( iDtorIDKey ); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CAppMngr2Runtime::RuntimeUid() |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C const TUid CAppMngr2Runtime::RuntimeUid() const |
|
65 { |
|
66 return iRuntimeUid; |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CAppMngr2Runtime::AddNearestResourceFileL() |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C TInt CAppMngr2Runtime::AddNearestResourceFileL( const TDesC& aFileName ) |
|
74 { |
|
75 TFileName* fullName = TAppMngr2DriveUtils::NearestResourceFileLC( aFileName, |
|
76 EikonEnv().FsSession() ); |
|
77 TInt resourceId = EikonEnv().AddResourceFileL( *fullName ); |
|
78 CleanupStack::PopAndDestroy( fullName ); |
|
79 return resourceId; |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CAppMngr2Runtime::FullBitmapFileNameLC() |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 EXPORT_C HBufC* CAppMngr2Runtime::FullBitmapFileNameLC( const TDesC& aBitmapFile ) |
|
87 { |
|
88 HBufC* fullName = TAppMngr2DriveUtils::FullBitmapFileNameLC( aBitmapFile, |
|
89 EikonEnv().FsSession() ); |
|
90 return fullName; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CAppMngr2Runtime::EikonEnv() |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C CEikonEnv& CAppMngr2Runtime::EikonEnv() |
|
98 { |
|
99 if( !iCachedEikonEnv ) |
|
100 { |
|
101 iCachedEikonEnv = CEikonEnv::Static(); |
|
102 } |
|
103 return *iCachedEikonEnv; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CAppMngr2Runtime::Observer() |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C MAppMngr2RuntimeObserver& CAppMngr2Runtime::Observer() |
|
111 { |
|
112 return iObserver; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CAppMngr2Runtime::GetAdditionalDirsToScanL() |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C void CAppMngr2Runtime::GetAdditionalDirsToScanL( RFs& /*aFsSession*/, |
|
120 RPointerArray<HBufC>& /*aDirs*/ ) |
|
121 { |
|
122 // no additional directories by default |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CAppMngr2Runtime::CAppMngr2Runtime() |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 EXPORT_C CAppMngr2Runtime::CAppMngr2Runtime( MAppMngr2RuntimeObserver &aObserver ) |
|
130 : iObserver( aObserver ) |
|
131 { |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // CAppMngr2Runtime::ConstructL() |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CAppMngr2Runtime::ConstructL( TUid aImplementationUid ) |
|
139 { |
|
140 iRuntimeUid = aImplementationUid; |
|
141 } |
|
142 |
|