|
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 : Source file for EmailServer shutdown watcher |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <apgtask.h> |
|
20 |
|
21 #include "emailtrace.h" |
|
22 #include "emailshutdownconst.h" |
|
23 |
|
24 #include "emailservershutdownobserver.h" |
|
25 #include "FsEmailGlobalDialogsAppUi.h" |
|
26 |
|
27 CEmailServerShutdownObserver* CEmailServerShutdownObserver::NewL( |
|
28 CFsEmailGlobalDialogsAppUi& aAppUi ) |
|
29 { |
|
30 CEmailServerShutdownObserver* self=new(ELeave) CEmailServerShutdownObserver( aAppUi ); |
|
31 CleanupStack::PushL(self); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CEmailServerShutdownObserver::CEmailServerShutdownObserver( |
|
38 CFsEmailGlobalDialogsAppUi& aAppUi ) |
|
39 : CActive( EPriorityStandard ), iAppUi(aAppUi) |
|
40 {} |
|
41 |
|
42 void CEmailServerShutdownObserver::ConstructL() |
|
43 { |
|
44 FUNC_LOG; |
|
45 |
|
46 // Attach and subscribe to P&S to get the shutdown event from shutter app |
|
47 User::LeaveIfError( iProperty.Attach( KEmailShutdownPsCategory, |
|
48 EEmailPsKeyShutdownClients )); |
|
49 CActiveScheduler::Add(this); |
|
50 |
|
51 iProperty.Subscribe(iStatus); |
|
52 SetActive(); |
|
53 } |
|
54 |
|
55 CEmailServerShutdownObserver::~CEmailServerShutdownObserver() |
|
56 { |
|
57 Cancel(); |
|
58 iProperty.Close(); |
|
59 } |
|
60 |
|
61 void CEmailServerShutdownObserver::DoCancel() |
|
62 { |
|
63 iProperty.Cancel(); |
|
64 } |
|
65 |
|
66 void CEmailServerShutdownObserver::RunL() |
|
67 { |
|
68 FUNC_LOG; |
|
69 |
|
70 // Property updated, which means that installation is starting and |
|
71 // FsMailServer needs to shutdown |
|
72 INFO( "Shutdown event received" ); |
|
73 iAppUi.Exit(); |
|
74 } |
|
75 |