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 CSisxUISelectionCache |
|
15 * class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "SisxUISelectionCache.h" |
|
22 |
|
23 using namespace SwiUI; |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CSisxUISelectionCache::CSisxUISelectionCache |
|
29 // C++ default constructor can NOT contain any code, that |
|
30 // might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CSisxUISelectionCache::CSisxUISelectionCache() |
|
34 { |
|
35 |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CSisxUISelectionCache::ConstructL |
|
40 // Symbian 2nd phase constructor can leave. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 void CSisxUISelectionCache::ConstructL() |
|
44 { |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CSisxUISelectionCache::NewL |
|
49 // Two-phased constructor. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CSisxUISelectionCache* CSisxUISelectionCache::NewL() |
|
53 { |
|
54 CSisxUISelectionCache* self = new( ELeave ) CSisxUISelectionCache(); |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // Destructor |
|
62 CSisxUISelectionCache::~CSisxUISelectionCache() |
|
63 { |
|
64 iOptions.ResetAndDestroy(); |
|
65 iSelections.Reset(); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
70 // Indicates if language selection is cached. |
|
71 // (other items were commented in a header). |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 TBool CSisxUISelectionCache::LanguageCached() const |
|
75 { |
|
76 return iLanguageCached; |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
81 // Returns cached language. |
|
82 // (other items were commented in a header). |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 TLanguage CSisxUISelectionCache::Language() const |
|
86 { |
|
87 return iLanguage; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
92 // Sets the cached language. |
|
93 // (other items were commented in a header). |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CSisxUISelectionCache::SetLanguage( const TLanguage& aLanguage ) |
|
97 { |
|
98 iLanguage = aLanguage; |
|
99 iLanguageCached = ETrue; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
104 // Indicates if drive selection is cached. |
|
105 // (other items were commented in a header). |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TBool CSisxUISelectionCache::DriveCached() const |
|
109 { |
|
110 TBool result( EFalse ); |
|
111 |
|
112 if ( iDrive != 0 ) |
|
113 { |
|
114 result = ETrue; |
|
115 } |
|
116 return result; |
|
117 } |
|
118 |
|
119 |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
123 // Returns cached drive. |
|
124 // (other items were commented in a header). |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 TDriveUnit CSisxUISelectionCache::Drive() const |
|
128 { |
|
129 return iDrive; |
|
130 } |
|
131 |
|
132 |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
136 // Sets the cached drive. |
|
137 // (other items were commented in a header). |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CSisxUISelectionCache::SetDrive( TDriveUnit aDrive ) |
|
141 { |
|
142 iDrive = aDrive; |
|
143 } |
|
144 |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
148 // Indicates if options selection is cached. |
|
149 // (other items were commented in a header). |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TBool CSisxUISelectionCache::OptionsCached( const RPointerArray<TDesC>& aOptions ) const |
|
153 { |
|
154 TBool result( EFalse ); |
|
155 |
|
156 if ( iOptions.Count() > 0 && aOptions.Count() == iOptions.Count() ) |
|
157 { |
|
158 for ( TInt index = 0; index < iOptions.Count(); index++ ) |
|
159 { |
|
160 if ( aOptions[index] != iOptions[index] ) |
|
161 { |
|
162 result = EFalse; |
|
163 break; |
|
164 } |
|
165 } |
|
166 result = ETrue; |
|
167 } |
|
168 |
|
169 return result; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CSisxUISelectionCacheAppInfo::LanguageCached |
|
174 // Returns cached option selections. |
|
175 // (other items were commented in a header). |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void CSisxUISelectionCache::Options( RArray<TBool>& aSelections ) |
|
179 { |
|
180 for ( TInt index = 0; index < aSelections.Count(); index++ ) |
|
181 { |
|
182 aSelections[index] = iSelections[index]; |
|
183 } |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CSisxUISelectionCacheAppInfo::SetOptionsL |
|
188 // Sets the cached options. |
|
189 // (other items were commented in a header). |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CSisxUISelectionCache::SetOptionsL( const RPointerArray<TDesC>& aOptions, |
|
193 const RArray<TBool>& aSelections ) |
|
194 { |
|
195 TInt index( 0 ); |
|
196 |
|
197 iOptions.ResetAndDestroy(); |
|
198 iSelections.Reset(); |
|
199 |
|
200 for ( index = 0; index < aOptions.Count(); index++ ) |
|
201 { |
|
202 HBufC* tmp = aOptions[index]->AllocLC(); |
|
203 iOptions.Append( tmp ); |
|
204 } |
|
205 |
|
206 for ( index = 0; index < aSelections.Count(); index++ ) |
|
207 { |
|
208 iSelections.Append( aSelections[index] ); |
|
209 } |
|
210 } |
|
211 |
|
212 |
|
213 // End of File |
|