|
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: Implementation of CVmbxCenRepObserver class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <centralrepository.h> |
|
20 |
|
21 #include "vmbxlogger.h" |
|
22 #include "voicemailboxdomaincrkeys.h" |
|
23 #include "voicemailboxprivatecrkeys.h" |
|
24 #include "voicemailboxdefsinternal.h" |
|
25 #include "vmbxcenrepobserver.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS ============================= |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // CVmbxCenRepObserver::CVmbxCenRepObserver |
|
33 // C++ default constructor can NOT contain any code, that might leave. |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CVmbxCenRepObserver::CVmbxCenRepObserver( MVmbxCenRepObserver& aObserver ): |
|
37 iObserver( aObserver ) |
|
38 { |
|
39 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::CVmbxCenRepObserver =>" ); |
|
40 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::CVmbxCenRepObserver <=" ); |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CVmbxCenRepObserver::ConstructL |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 void CVmbxCenRepObserver::ConstructL() |
|
49 { |
|
50 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::ConstructL =>" ); |
|
51 iCRSession = CRepository::NewL( KCRUidVoiceMailbox ); |
|
52 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iCRSession ); |
|
53 iNotifyHandler->StartListeningL(); |
|
54 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::ConstructL <=" ); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CVmbxCenRepObserver::NewL |
|
59 // Two-phased constructor. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CVmbxCenRepObserver* CVmbxCenRepObserver::NewL( MVmbxCenRepObserver& aObserver ) |
|
63 { |
|
64 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::NewL =>" ); |
|
65 CVmbxCenRepObserver* self = CVmbxCenRepObserver::NewLC( aObserver ); |
|
66 CleanupStack::Pop( self ); |
|
67 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::NewL <=" ); |
|
68 return self; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CVmbxCenRepObserver::NewLC |
|
73 // Two-phased constructor. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CVmbxCenRepObserver* CVmbxCenRepObserver::NewLC( MVmbxCenRepObserver& aObserver ) |
|
77 { |
|
78 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::NewLC =>" ); |
|
79 CVmbxCenRepObserver* self = new (ELeave) CVmbxCenRepObserver( aObserver ); |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL(); |
|
82 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::NewLC <=" ); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CVmbxCenRepObserver::~CVmbxCenRepObserver |
|
88 // Destructor |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 CVmbxCenRepObserver::~CVmbxCenRepObserver() |
|
92 { |
|
93 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::~CVmbxCenRepObserver =>" ); |
|
94 if ( iNotifyHandler ) |
|
95 { |
|
96 iNotifyHandler->StopListening(); |
|
97 delete iNotifyHandler; |
|
98 iNotifyHandler = NULL; |
|
99 } |
|
100 delete iCRSession; |
|
101 VMBLOGSTRING( "VMBX:CVmbxCenRepObserver::~CVmbxCenRepObserver <=" ); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CVmbxCenRepObserver::HandleNotifyGeneric |
|
106 // To notify the client about changes for string value keys |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CVmbxCenRepObserver::HandleNotifyGeneric( TUint32 aId ) |
|
110 { |
|
111 VMBLOGSTRING( "VMBX: CVmbxCenRepObserver::HandleNotifyGeneric =>" ); |
|
112 if ( KVmbxNumberLinePrimary == aId |
|
113 || KVmbxVideoNmbrLinePrimary == aId |
|
114 || KVmbxNumberLineAlternate == aId |
|
115 || KVmbxVideoNmbrLineAlternate == aId |
|
116 ) |
|
117 { |
|
118 VMBLOGSTRING2( "VMBX: CVmbxCenRepObserver::HandleNotifyGeneric: aId %X", |
|
119 aId ); |
|
120 |
|
121 TVmbxCenRepKey cenRepKey( EVmbxCenRepMax ); |
|
122 if ( KVmbxNumberLinePrimary == aId ) |
|
123 { |
|
124 cenRepKey = EVmbxVoiceLinePrimaryKey; |
|
125 } |
|
126 else if ( KVmbxVideoNmbrLinePrimary == aId ) |
|
127 { |
|
128 cenRepKey = EVmbxVideoLinePrimaryKey; |
|
129 } |
|
130 else if ( KVmbxNumberLineAlternate == aId ) |
|
131 { |
|
132 cenRepKey = EVmbxVoiceLineAlternateKey; |
|
133 } |
|
134 else if ( KVmbxVideoNmbrLineAlternate == aId ) |
|
135 { |
|
136 cenRepKey = EVmbxVideoLineAlternateKey; |
|
137 } |
|
138 |
|
139 // Notify the primary/alternate support keys are changed |
|
140 iObserver.HandleCenRepChange( cenRepKey ); |
|
141 } |
|
142 VMBLOGSTRING( "VMBX: CVmbxCenRepObserver::HandleNotifyGeneric<="); |
|
143 } |
|
144 |
|
145 // End of File |