|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * SyncInitiationNotifier.cpp |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <eikenv.h> |
|
20 #include <eikappui.h> |
|
21 #include <centralrepository.h> |
|
22 #include <NsmlOperatorErrorCRKeys.h> |
|
23 #include <bautils.h> // BaflUtils |
|
24 #include <utf.h> |
|
25 #include <APGWGNAM.H> //CApaWindowGroupName |
|
26 #include <APGTASK.H> |
|
27 |
|
28 #include "SyncInitiationNotifier.h" |
|
29 #include "CenrepUtils.h" |
|
30 |
|
31 |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ========================================= |
|
34 |
|
35 CSyncInitiationNotifier* CSyncInitiationNotifier::NewL() |
|
36 { |
|
37 CSyncInitiationNotifier* self = CSyncInitiationNotifier::NewLC(); |
|
38 CleanupStack::Pop( self ); |
|
39 return self; |
|
40 } |
|
41 |
|
42 CSyncInitiationNotifier* CSyncInitiationNotifier::NewLC() |
|
43 { |
|
44 CSyncInitiationNotifier* self = new ( ELeave ) CSyncInitiationNotifier; |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(); |
|
47 return self; |
|
48 } |
|
49 |
|
50 CSyncInitiationNotifier::~CSyncInitiationNotifier() |
|
51 { |
|
52 if( IsActive() ) |
|
53 { |
|
54 Cancel(); |
|
55 if( iRep ) |
|
56 { |
|
57 iRep->NotifyCancelAll(); |
|
58 } |
|
59 } |
|
60 delete iRep; |
|
61 iFs.Close(); |
|
62 } |
|
63 |
|
64 CSyncInitiationNotifier::CSyncInitiationNotifier(): |
|
65 CActive( CActive::EPriorityStandard ) |
|
66 { |
|
67 CActiveScheduler::Add( this ); |
|
68 } |
|
69 |
|
70 void CSyncInitiationNotifier::ConstructL( ) |
|
71 { |
|
72 iRep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ); |
|
73 ListenForKeyNotifications(); |
|
74 } |
|
75 |
|
76 |
|
77 // ---------------------------------------------------------------------------- |
|
78 // CSyncInitiationNotifier::ListenForKeyNotifications |
|
79 // ---------------------------------------------------------------------------- |
|
80 void CSyncInitiationNotifier::ListenForKeyNotifications() |
|
81 { |
|
82 iRep->NotifyRequest( KNsmlOpDsSyncInitiation, iStatus ); |
|
83 SetActive(); |
|
84 } |
|
85 |
|
86 void CSyncInitiationNotifier::DoCancel() |
|
87 { |
|
88 iRep->NotifyCancelAll(); |
|
89 } |
|
90 |
|
91 void CSyncInitiationNotifier::RunL() |
|
92 { |
|
93 if( iStatus > 0 ) |
|
94 { |
|
95 CCenrepUtils::WriteLogL( KNsmlOpDsSyncInitiation, ESyncInitiation ); |
|
96 |
|
97 TApaTask task(CEikonEnv::Static()->WsSession( )); |
|
98 task.SetWgId(CEikonEnv::Static()->RootWin().Identifier()); |
|
99 task.BringToForeground(); |
|
100 |
|
101 ListenForKeyNotifications(); |
|
102 } |
|
103 } |
|
104 |
|
105 // End of File |