|
1 /* |
|
2 * Copyright (c) 2002 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: Publish & Subscribe property change observer implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "VmDetDlgPropertyObserver.h" |
|
22 #include "VoiceMailboxAppPrivateCRKeys.h" |
|
23 #include "VmDetailsDialog.h" |
|
24 |
|
25 #include <e32property.h> |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CVmDetDlgPropertyObserver::CVmDetDlgPropertyObserver |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CVmDetDlgPropertyObserver::CVmDetDlgPropertyObserver( |
|
37 CVmDetailsDialog& aDetDialog ) |
|
38 : CActive( CActive::EPriorityLow ), |
|
39 iDetDialog( aDetDialog ) |
|
40 { |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CVmDetDlgPropertyObserver::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CVmDetDlgPropertyObserver::ConstructL() |
|
49 { |
|
50 CActiveScheduler::Add( this ); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CMGXPropertyObserver::NewL |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CVmDetDlgPropertyObserver* CVmDetDlgPropertyObserver::NewL( |
|
59 CVmDetailsDialog& aDetDialog ) |
|
60 { |
|
61 CVmDetDlgPropertyObserver* self = |
|
62 new( ELeave ) CVmDetDlgPropertyObserver( aDetDialog ); |
|
63 |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 // ---------------------------------------------------------------------------- |
|
72 // CVmDetDlgPropertyObserver::~CVmDetDlgPropertyObserver |
|
73 // Destructor. |
|
74 // ---------------------------------------------------------------------------- |
|
75 // |
|
76 CVmDetDlgPropertyObserver::~CVmDetDlgPropertyObserver() |
|
77 { |
|
78 if ( IsActive() ) |
|
79 { |
|
80 Cancel(); |
|
81 } |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CVmDetDlgPropertyObserver::ObservePropertyChangeL |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CVmDetDlgPropertyObserver::ObservePropertyChangeL( TUid aCategory, |
|
89 TUint aKey ) |
|
90 { |
|
91 if ( IsActive() ) |
|
92 { |
|
93 Cancel(); |
|
94 } |
|
95 User::LeaveIfError( iProperty.Attach( aCategory, aKey ) ); |
|
96 iProperty.Subscribe( iStatus ); |
|
97 SetActive(); |
|
98 iKey = aKey; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CVmDetDlgPropertyObserver::RunL |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CVmDetDlgPropertyObserver::RunL() |
|
106 { |
|
107 TFileName fileName( KNullDesC ); |
|
108 |
|
109 if ( iKey == KVmSummaryInfoIsSet ) |
|
110 { |
|
111 User::LeaveIfError( iProperty.Get( fileName ) ); |
|
112 } |
|
113 |
|
114 iDetDialog.HandlePropertyNotificationEventL( fileName ); |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CVmDetDlgPropertyObserver::DoCancel |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CVmDetDlgPropertyObserver::DoCancel() |
|
122 { |
|
123 iProperty.Cancel(); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CVmDetDlgPropertyObserver::RunError |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TInt CVmDetDlgPropertyObserver::RunError( TInt /*aError*/ ) |
|
131 { |
|
132 // Return no error to prevent ui note from being displayed, |
|
133 // nothing else can be done. |
|
134 return KErrNone; |
|
135 } |
|
136 |
|
137 // End of File |