|
1 /* |
|
2 * Copyright (c) 2006 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: Contains CNcdInstalledApplication class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ncdnodeinstallproxy.h" |
|
20 #include "ncdinstalledapplicationimpl.h" |
|
21 #include "ncdinstallationservice.h" |
|
22 #include "catalogsinterfaceidentifier.h" |
|
23 #include "catalogsutils.h" |
|
24 #include "catalogsdebug.h" |
|
25 |
|
26 |
|
27 // ======== PUBLIC MEMBER FUNCTIONS ======== |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // Constructor |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CNcdInstalledApplication::CNcdInstalledApplication( |
|
35 CNcdNodeInstallProxy& aParent, |
|
36 const TUid& aUid, |
|
37 MNcdInstalledContent::TInstalledContentType aType, |
|
38 TBool aUriExists ) |
|
39 : CNcdInstalledContent( aParent, aType ), |
|
40 iUid( aUid ), |
|
41 iUriExists( aUriExists ) |
|
42 { |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // 2nd phase constructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 void CNcdInstalledApplication::ConstructL( |
|
51 const TDesC& aVersion, |
|
52 const TDesC& aDocumentName ) |
|
53 { |
|
54 DLTRACEIN(("this: %x, iUid: %x", this, iUid.iUid )); |
|
55 CNcdInstalledContent::ConstructL(); |
|
56 |
|
57 // Register the interface |
|
58 MNcdInstalledApplication* interface( this ); |
|
59 AddInterfaceL( |
|
60 CCatalogsInterfaceIdentifier::NewL( interface, this, |
|
61 MNcdInstalledApplication::KInterfaceUid ) ); |
|
62 |
|
63 TRAPD( err, TCatalogsVersion::ConvertL( iVersion, aVersion ) ); |
|
64 LeaveIfNotErrorL( err, KErrArgument, KErrGeneral ); |
|
65 iDocumentName = aDocumentName.AllocL(); |
|
66 } |
|
67 |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // NewLC |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 CNcdInstalledApplication* CNcdInstalledApplication::NewLC( |
|
74 CNcdNodeInstallProxy& aParent, |
|
75 const TUid& aUid, |
|
76 const TDesC& aVersion, |
|
77 const TDesC& aDocumentName, |
|
78 MNcdInstalledContent::TInstalledContentType aType, |
|
79 TBool aUriExists ) |
|
80 { |
|
81 CNcdInstalledApplication* self = |
|
82 new( ELeave ) CNcdInstalledApplication( |
|
83 aParent, aUid, aType, aUriExists ); |
|
84 // Using normal PushL because the object does not have any references yet |
|
85 CleanupStack::PushL( self ); |
|
86 self->ConstructL( aVersion, aDocumentName ); |
|
87 return self; |
|
88 } |
|
89 |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // Destructor |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 CNcdInstalledApplication::~CNcdInstalledApplication() |
|
96 { |
|
97 DLTRACEIN(("this: %x", this)); |
|
98 |
|
99 // Remove interfaces implemented by this class from the interface list. |
|
100 // So, the interface list is up to date when this class object is deleted. |
|
101 RemoveInterface( MNcdInstalledApplication::KInterfaceUid ); |
|
102 |
|
103 |
|
104 // Delete member variables here |
|
105 // Do not delete node and operation manager because |
|
106 // this object does not own them. |
|
107 delete iDocumentName; |
|
108 } |
|
109 |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // Is installed |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 TBool CNcdInstalledApplication::IsInstalledL() const |
|
116 { |
|
117 DLTRACEIN(("")); |
|
118 if ( !iUriExists ) |
|
119 { |
|
120 DLTRACEOUT(("No URI, considered as installed")); |
|
121 return ETrue; |
|
122 } |
|
123 |
|
124 return ContentOwner().InstallationService().IsApplicationInstalledL( |
|
125 iUid, iVersion ) >= ENcdApplicationInstalled; |
|
126 } |
|
127 |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // UID getter |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 TUid CNcdInstalledApplication::Uid() const |
|
134 { |
|
135 DLTRACEIN(("UID: %x", iUid.iUid)); |
|
136 return iUid; |
|
137 } |
|
138 |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // Document name getter |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 const TDesC& CNcdInstalledApplication::DocumentName() const |
|
145 { |
|
146 DASSERT( iDocumentName ); |
|
147 DLTRACEIN(( _L("document: %S"), iDocumentName )); |
|
148 return *iDocumentName; |
|
149 } |