17 */ |
17 */ |
18 |
18 |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include "CProfileChangeEvent.h" |
21 #include "CProfileChangeEvent.h" |
22 #include "ProfileEnginePrivateCRKeys.h" |
|
23 #include "ProfilesDebug.h" |
|
24 |
22 |
25 #include <e32svr.h> |
23 #include <e32svr.h> |
26 #include <MProfileEngine.h> |
24 #include <MProfileEngine.h> |
|
25 #include <AknGlobalNote.h> |
27 #include <data_caging_path_literals.hrh> |
26 #include <data_caging_path_literals.hrh> |
28 #include <centralrepository.h> |
27 #include <centralrepository.h> |
29 |
28 #include <barsc.h> |
30 #include <ProfileScheduleEvent.rsg> |
29 #include <bautils.h> |
|
30 |
|
31 #include <secondarydisplay/SecondaryDisplayProfilesAPI.h> |
|
32 #include <aknSDData.h> |
|
33 #include <featmgr.h> |
|
34 |
|
35 #include <profilescheduleevent.rsg> |
|
36 #include "ProfileEnginePrivateCRKeys.h" |
31 #include <ProfileEngineConstants.h> |
37 #include <ProfileEngineConstants.h> |
|
38 #include "ProfilesDebug.h" |
32 |
39 |
33 |
40 |
34 // CONSTANTS |
41 // CONSTANTS |
35 namespace |
42 namespace |
36 { |
43 { |
37 _LIT( KProfileScheduleEventResourceDriveAndDir, "Z:ProfileScheduleEvent.rsc" ); |
44 _LIT( KProfileScheduleEventResourceDriveAndDir, "z:profilescheduleevent.rsc" ); |
38 } |
45 } |
39 |
46 |
40 // ============================ MEMBER FUNCTIONS =============================== |
47 // ============================ MEMBER FUNCTIONS =============================== |
41 |
48 |
42 // ----------------------------------------------------------------------------- |
49 // ----------------------------------------------------------------------------- |
54 // Symbian 2nd phase constructor can leave. |
61 // Symbian 2nd phase constructor can leave. |
55 // ----------------------------------------------------------------------------- |
62 // ----------------------------------------------------------------------------- |
56 // |
63 // |
57 void CProfileChangeEvent::ConstructL() |
64 void CProfileChangeEvent::ConstructL() |
58 { |
65 { |
|
66 FeatureManager::InitializeLibL(); |
|
67 iCoverDisplay = FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ); |
|
68 |
|
69 |
59 User::LeaveIfError( iFs.Connect() ); |
70 User::LeaveIfError( iFs.Connect() ); |
60 // Open/Create mutex |
71 // Open/Create mutex |
61 TInt error( KErrNotFound ); |
72 TInt error( KErrNotFound ); |
62 while( error == KErrNotFound ) |
73 while( error == KErrNotFound ) |
63 { |
74 { |
68 } |
79 } |
69 error = iMutex.OpenGlobal( KProfileMutexName ); |
80 error = iMutex.OpenGlobal( KProfileMutexName ); |
70 } |
81 } |
71 User::LeaveIfError( error ); |
82 User::LeaveIfError( error ); |
72 iProfileEngine = CreateProfileEngineL( &iFs ); |
83 iProfileEngine = CreateProfileEngineL( &iFs ); |
|
84 iGlobalNote = CAknGlobalNote::NewL(); |
73 ReadResourcesL(); |
85 ReadResourcesL(); |
74 } |
86 } |
75 |
87 |
76 // ----------------------------------------------------------------------------- |
88 // ----------------------------------------------------------------------------- |
77 // CProfileChangeEvent::NewL |
89 // CProfileChangeEvent::NewL |
184 // (other items were commented in a header). |
200 // (other items were commented in a header). |
185 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
186 // |
202 // |
187 void CProfileChangeEvent::ShowNoteL() |
203 void CProfileChangeEvent::ShowNoteL() |
188 { |
204 { |
|
205 PRODEBUG1( " CProfileChangeEvent:ShowNoteL(%S)", iNoteText ); |
|
206 // Set secondary display data if cover ui is supported |
|
207 if ( iCoverDisplay ) |
|
208 { |
|
209 CAknSDData* sd = CAknSDData::NewL(KCatProfiles, |
|
210 ECmdShowTimedProfileExpiryNote, KNullDesC8); |
|
211 iGlobalNote->SetSecondaryDisplayData( sd ); // ownership transferred |
|
212 } |
|
213 iGlobalNote->ShowNoteL( EAknGlobalConfirmationNote, *iNoteText ); |
189 } |
214 } |
190 |
215 |
191 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
192 // CProfileChangeEvent::ReadResourcesL |
217 // CProfileChangeEvent::ReadResourcesL |
193 // (other items were commented in a header). |
218 // (other items were commented in a header). |
194 // ----------------------------------------------------------------------------- |
219 // ----------------------------------------------------------------------------- |
195 // |
220 // |
196 void CProfileChangeEvent::ReadResourcesL() |
221 void CProfileChangeEvent::ReadResourcesL() |
197 { |
222 { |
|
223 PRODEBUG( " CProfileChangeEvent:ReadResourcesL" ); |
|
224 TParse* fp = new ( ELeave ) TParse(); |
|
225 fp->Set( KProfileScheduleEventResourceDriveAndDir, |
|
226 &KDC_RESOURCE_FILES_DIR, NULL ); |
|
227 iResourceFile.Copy( fp->FullName() ); |
|
228 delete fp; |
|
229 |
|
230 PRODEBUG( " CProfileChangeEvent:ReadResourcesL 2" ); |
|
231 BaflUtils::NearestLanguageFile( iFs, iResourceFile ); |
|
232 PRODEBUG1( " CProfileChangeEvent:ReadResourcesL 3 iResourceFile=%S", &iResourceFile ); |
|
233 |
|
234 RResourceFile resourceFile; |
|
235 resourceFile.OpenL( iFs, iResourceFile ); |
|
236 CleanupClosePushL( resourceFile ); |
|
237 |
|
238 PRODEBUG( " CProfileChangeEvent:ReadResourcesL 4" ); |
|
239 resourceFile.ConfirmSignatureL(); |
|
240 PRODEBUG( " CProfileChangeEvent:ReadResourcesL 5" ); |
|
241 |
|
242 HBufC8* dataBuffer = resourceFile.AllocReadLC( R_PROFILES_CONFIRM_TIMED_EXPIRED ); |
|
243 |
|
244 PRODEBUG( " CProfileChangeEvent:ReadResourcesL 6" ); |
|
245 TResourceReader rsReader; |
|
246 rsReader.SetBuffer( dataBuffer ); |
|
247 iNoteText = rsReader.ReadHBufCL(); |
|
248 PRODEBUG( " CProfileChangeEvent:ReadResourcesL 7" ); |
|
249 |
|
250 CleanupStack::PopAndDestroy( 2 ); // dataBuffer, resourceFile |
|
251 PRODEBUG( " CProfileChangeEvent:ReadResourcesL 8" ); |
198 } |
252 } |
199 |
253 |
200 // End of File |
254 // End of File |
201 |
255 |