|
1 /* |
|
2 * Copyright (c) 2002-2005 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: This module contains the implementation of CDocAppInstLauncher |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <f32file.h> |
|
21 #include "DocAppInstLauncher.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CDocAppInstLauncher::CDocAppInstLauncher |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CDocAppInstLauncher::CDocAppInstLauncher() |
|
32 : CActive( CActive::EPriorityStandard ) |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CDocAppInstLauncher::ConstructL |
|
38 // Symbian 2nd phase constructor can leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 void CDocAppInstLauncher::ConstructL() |
|
42 { |
|
43 CActiveScheduler::Add( this ); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CDocAppInstLauncher::NewL |
|
48 // Two-phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CDocAppInstLauncher* CDocAppInstLauncher::NewL() |
|
52 { |
|
53 CDocAppInstLauncher* self = new( ELeave ) CDocAppInstLauncher(); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // Destructor |
|
61 CDocAppInstLauncher::~CDocAppInstLauncher() |
|
62 { |
|
63 Cancel(); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CDocAppInstLauncher::InstallL |
|
68 // Handle install request. |
|
69 // (other items were commented in a header). |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CDocAppInstLauncher::InstallL( RFile& aFile ) |
|
73 { |
|
74 iCalledWithParams = EFalse; |
|
75 User::LeaveIfError( iLauncher.Connect() ); |
|
76 iLauncher.Install( iStatus, aFile ); |
|
77 SetActive(); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CDocAppInstLauncher::InstallL |
|
82 // Handle install request. |
|
83 // (other items were commented in a header). |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CDocAppInstLauncher::InstallL( RFile& aFile, const TDesC8& aOptions ) |
|
87 { |
|
88 iCalledWithParams = ETrue; |
|
89 User::LeaveIfError( iLauncher.Connect() ); |
|
90 iLauncher.Install( iStatus, aFile, aOptions ); |
|
91 SetActive(); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CDocAppInstLauncher::SetExitObserver |
|
96 // Set exit observer |
|
97 // (other items were commented in a header). |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CDocAppInstLauncher::SetExitObserver( MAknServerAppExitObserver* aObserver ) |
|
101 { |
|
102 __ASSERT_DEBUG ( |
|
103 aObserver, |
|
104 User::Panic ( _L ( "DocumentHandler" ), KErrUnknown ) ); |
|
105 iExitObserver = aObserver; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CDocAppInstLauncher::RunL |
|
110 // Called by framework when request is finished. |
|
111 // (other items were commented in a header). |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void CDocAppInstLauncher::RunL() |
|
115 { |
|
116 // Close the installer |
|
117 iLauncher.Close(); |
|
118 |
|
119 // We have to inform launcher application that installer has exited. |
|
120 if ( iExitObserver ) |
|
121 { |
|
122 #ifdef _DEBUG |
|
123 RDebug::Print( _L("DocumentHandler: CDocAppInstLauncher::RunL : Exit notification forwarded.")); |
|
124 #endif |
|
125 iExitObserver->HandleServerAppExit( 0 ); |
|
126 } |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CDocAppInstLauncher::DoCancelL |
|
131 // Called by framework when request is cancelled. |
|
132 // (other items were commented in a header). |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 void CDocAppInstLauncher::DoCancel() |
|
136 { |
|
137 if ( iCalledWithParams ) |
|
138 { |
|
139 iLauncher.CancelAsyncRequest( SwiUI::ERequestInstallParamsHandle ); |
|
140 } |
|
141 else |
|
142 { |
|
143 iLauncher.CancelAsyncRequest( SwiUI::ERequestInstallHandle ); |
|
144 } |
|
145 iLauncher.Close(); |
|
146 } |
|
147 |
|
148 |
|
149 // End of File |