1 /* |
|
2 * Copyright (c) 2002-2004 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 file contains the implementation of CStartupItem |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <starterclient.h> |
|
22 #include <s32strm.h> |
|
23 #include "StartupItem.h" |
|
24 |
|
25 using namespace SwiUI; |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CStartupItem::CStartupItem |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CStartupItem::CStartupItem() |
|
36 : iRecoveryPolicy( EStartupItemExPolicyNone ) |
|
37 { |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CStartupItem::ConstructL |
|
42 // Symbian 2nd phase constructor can leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CStartupItem::ConstructL( const TStartupTaskParam& aParam ) |
|
46 { |
|
47 iExecutableFile = aParam.iFileName.AllocL(); |
|
48 iRecoveryPolicy = aParam.iRecoveryPolicy; |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CStartupItem::ConstructL |
|
53 // Symbian 2nd phase constructor can leave. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 void CStartupItem::ConstructL( RReadStream& aStream ) |
|
57 { |
|
58 iExecutableFile = HBufC::NewL( aStream, KMaxFileName ); |
|
59 iRecoveryPolicy = TStartupExceptionPolicy( aStream.ReadInt32L() ); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CStartupItem::NewL |
|
64 // Two-phased constructor. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CStartupItem* CStartupItem::NewL( const TStartupTaskParam& aParam ) |
|
68 { |
|
69 CStartupItem* self = new( ELeave ) CStartupItem(); |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL( aParam ); |
|
72 CleanupStack::Pop( self ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CStartupItem::NewL |
|
78 // Two-phased constructor. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CStartupItem* CStartupItem::NewL( RReadStream& aStream ) |
|
82 { |
|
83 CStartupItem* self = new( ELeave ) CStartupItem(); |
|
84 CleanupStack::PushL( self ); |
|
85 self->ConstructL( aStream ); |
|
86 CleanupStack::Pop( self ); |
|
87 return self; |
|
88 } |
|
89 |
|
90 // Destructor |
|
91 CStartupItem::~CStartupItem() |
|
92 { |
|
93 delete iExecutableFile; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CStartupItem::ExecutableFile |
|
98 // Get the executable file of this startup item. |
|
99 // (other items were commented in a header). |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 const TDesC& CStartupItem::ExecutableFile() const |
|
103 { |
|
104 if ( iExecutableFile ) |
|
105 { |
|
106 return *iExecutableFile; |
|
107 } |
|
108 else |
|
109 { |
|
110 return KNullDesC(); |
|
111 } |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CStartupItem::RecoveryPolicy |
|
116 // Get the startup recovery policy for this item. |
|
117 // (other items were commented in a header). |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TStartupExceptionPolicy CStartupItem::RecoveryPolicy() const |
|
121 { |
|
122 return iRecoveryPolicy; |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CStartupItem::ExternalizeL |
|
127 // Externalize the class. |
|
128 // (other items were commented in a header). |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CStartupItem::ExternalizeL( RWriteStream& aStream ) const |
|
132 { |
|
133 aStream << *iExecutableFile; |
|
134 aStream.WriteInt32L( iRecoveryPolicy ); |
|
135 } |
|
136 |
|
137 // End of File |
|