diff -r 000000000000 -r 5e5d6b214f4f instantmessagesalert/tsrc/testinstantmsgalert/data/Branch_Coverage/indexD2.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/instantmessagesalert/tsrc/testinstantmsgalert/data/Branch_Coverage/indexD2.html Tue Feb 02 10:12:18 2010 +0200 @@ -0,0 +1,230 @@ + +
+Start/ | End/ | |||
True | False | - | Line | Source |
1 | /* | |||
2 | * ============================================================================== | |||
3 | * Name : cimalertnotifierimpl.cpp | |||
4 | * Part of : conversations/instantmessagesalert | |||
5 | * Description : Publish and subscribe implementation | |||
6 | * Version : %version: 2 % | |||
7 | * | |||
8 | * Copyright © 2009 Nokia. All rights reserved.. | |||
9 | * This material, including documentation and any related | |||
10 | * computer programs, is protected by copyright controlled by | |||
11 | * Nokia. All rights are reserved. Copying, including | |||
12 | * reproducing, storing, adapting or translating, any | |||
13 | * or all of this material requires the prior written consent of | |||
14 | * Nokia. This material also contains confidential | |||
15 | * information which may not be disclosed to others without the | |||
16 | * prior written consent of Nokia. | |||
17 | * ============================================================================== | |||
18 | */ | |||
19 | ||||
20 | ||||
21 | // INCLUDE FILES | |||
22 | #include "cimalertnotifierimpl.h" | |||
23 | #include "mimalertnotifierkeyobserver.h" | |||
24 | #include "cimalertpropertyobserver.h" | |||
25 | #include <e32property.h> | |||
26 | ||||
27 | // ============================ MEMBER FUNCTIONS =============================== | |||
28 | ||||
29 | // ----------------------------------------------------------------------------- | |||
30 | // CIMAlertNotifierImpl::CIMAlertNotifierImpl | |||
31 | // C++ default constructor can NOT contain any code, that | |||
32 | // might leave. | |||
33 | // ----------------------------------------------------------------------------- | |||
34 | // | |||
Top | ||||
17 | 17 | 35 | CIMAlertNotifierImpl::CIMAlertNotifierImpl( MIMAlertNotifierKeyObserver* aObserver ) | |
36 | :iObserver( aObserver ) | |||
37 | { | |||
38 | } | |||
39 | ||||
40 | // ----------------------------------------------------------------------------- | |||
41 | // CIMAlertNotifierImpl::NewL | |||
42 | // Two-phased constructor. | |||
43 | // ----------------------------------------------------------------------------- | |||
44 | // | |||
Top | ||||
17 | 0 | 45 | CIMAlertNotifierImpl* CIMAlertNotifierImpl::NewL( MIMAlertNotifierKeyObserver* aObserver ) | |
46 | { | |||
47 | CIMAlertNotifierImpl* self = new( ELeave ) CIMAlertNotifierImpl( aObserver ); | |||
17 | 48 | return self; | ||
49 | } | |||
50 | ||||
51 | ||||
52 | // Destructor | |||
Top | ||||
17 | 17 | 53 | CIMAlertNotifierImpl::~CIMAlertNotifierImpl() | |
54 | { | |||
55 | delete iPropWatcher; | |||
56 | delete iCallState; | |||
57 | } | |||
58 | ||||
59 | // ----------------------------------------------------------------------------- | |||
60 | // CIMAlertNotifierImpl::SetInt | |||
61 | // (other items were commented in a header). | |||
62 | // ----------------------------------------------------------------------------- | |||
63 | // | |||
Top | ||||
2 | 0 | 64 | TInt CIMAlertNotifierImpl::SetInt( TNotifyKey aKey, TInt aValue ) | |
65 | { | |||
66 | TInt err = KErrNone; | |||
67 | switch ( aKey ) | |||
68 | { | |||
2 | 69 | case EMSGToneQuitKey: | ||
70 | err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit, aValue ); | |||
2 | 71 | break; | ||
0 | - | 72 | case ECallState: | |
73 | { | |||
74 | err = RProperty::Set( KPSUidCtsyCallInformation, KCTsyCallState, aValue ); | |||
0 | - | 75 | break; | |
76 | } | |||
0 | - | 77 | default: | |
78 | { | |||
0 | - | 79 | return KErrNotFound; | |
80 | } | |||
81 | } | |||
2 | 82 | return err; | ||
83 | } | |||
84 | ||||
85 | // ----------------------------------------------------------------------------- | |||
86 | // CIMAlertNotifierImpl::GetInt | |||
87 | // (other items were commented in a header). | |||
88 | // ----------------------------------------------------------------------------- | |||
89 | // | |||
Top | ||||
0 | 0 | - | 90 | TInt CIMAlertNotifierImpl::GetInt( TNotifyKey aKey, TInt& aValue ) |
91 | { | |||
92 | TInt err = KErrNone; | |||
93 | switch ( aKey ) | |||
94 | { | |||
0 | - | 95 | case EMSGToneQuitKey: | |
96 | { | |||
97 | err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit, aValue ); | |||
0 | - | 98 | break; | |
99 | } | |||
0 | - | 100 | case ECallState: | |
101 | { | |||
102 | err = RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, aValue ); | |||
0 | - | 103 | break; | |
104 | } | |||
0 | - | 105 | default: | |
106 | { | |||
107 | err = KErrNotFound; | |||
0 | - | 108 | break; | |
109 | } | |||
110 | } | |||
0 | - | 111 | return err; | |
112 | } | |||
113 | ||||
114 | // ----------------------------------------------------------------------------- | |||
115 | // CIMAlertNotifierImpl::ListenKeyChanges | |||
116 | // (other items were commented in a header). | |||
117 | // ----------------------------------------------------------------------------- | |||
118 | // | |||
Top | ||||
34 | 0 | 119 | TInt CIMAlertNotifierImpl::ListenKeyChanges( TNotifyKey aKey ) | |
120 | { | |||
121 | TInt err = KErrNone; | |||
122 | switch ( aKey ) | |||
123 | { | |||
17 | 124 | case EMSGToneQuitKey: | ||
125 | { | |||
126 | delete iPropWatcher; | |||
127 | iPropWatcher = NULL; | |||
17 | 17 | 128 | TRAP( err, iPropWatcher = CIMAlertPropertyObserver::NewL( *this ) ); | |
0 | - | 128 | catch (XLeaveException & l) | |
0 | - | 128 | catch (...) | |
17 | 0 | - | 129 | if( !err ) |
130 | { | |||
17 | 17 | 131 | TRAP( err, iPropWatcher->ObservePropertyChangeL( | |
0 | - | 131 | catch (XLeaveException & l) | |
0 | - | 131 | catch (...) | |
132 | KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit ) ); | |||
133 | } | |||
17 | 134 | break; | ||
135 | } | |||
17 | 136 | case ECallState: | ||
137 | { | |||
138 | delete iCallState; | |||
139 | iCallState = NULL; | |||
17 | 17 | 140 | TRAP( err, iCallState = CIMAlertPropertyObserver::NewL( *this ) ); | |
0 | - | 140 | catch (XLeaveException & l) | |
0 | - | 140 | catch (...) | |
17 | 0 | - | 141 | if( !err ) |
142 | { | |||
17 | 17 | 143 | TRAP( err, iCallState->ObservePropertyChangeL( | |
0 | - | 143 | catch (XLeaveException & l) | |
0 | - | 143 | catch (...) | |
144 | KPSUidCtsyCallInformation, KCTsyCallState ) ); | |||
145 | } | |||
17 | 146 | break; | ||
147 | } | |||
0 | - | 148 | default: | |
149 | { | |||
150 | err = KErrNotFound; | |||
0 | - | 151 | break; | |
152 | } | |||
153 | } | |||
34 | 154 | return err; | ||
155 | } | |||
156 | ||||
157 | // ----------------------------------------------------------------------------- | |||
158 | // CIMAlertNotifierImpl::HandlePropertyNotificationEventL | |||
159 | // (other items were commented in a header). | |||
160 | // ----------------------------------------------------------------------------- | |||
161 | // | |||
Top | ||||
0 | 0 | - | 162 | void CIMAlertNotifierImpl::HandlePropertyNotificationEventL( TUid aCategory , TUint aKey ) |
163 | { | |||
164 | TInt value( 0 ); | |||
165 | TUpdatedKey key; | |||
166 | // KPSUidCoreApplicationUIs status changed | |||
0 | 0 | - | 167 | if ( aCategory == KPSUidCoreApplicationUIs && aKey == KCoreAppUIsMessageToneQuit ) |
168 | { | |||
169 | User::LeaveIfError( | |||
170 | RProperty::Get( KPSUidCoreApplicationUIs, aKey, value ) ); | |||
171 | key.iUid = KPSUidCoreApplicationUIs; | |||
172 | key.iKey = aKey; | |||
173 | key.iValue = value; | |||
174 | } | |||
175 | // call status changed | |||
0 | 0 | - | 176 | if ( aCategory == KPSUidCtsyCallInformation && aKey == KCTsyCallState ) |
177 | { | |||
178 | User::LeaveIfError( | |||
179 | RProperty::Get( KPSUidCtsyCallInformation, aKey, value ) ); | |||
180 | key.iUid = KPSUidCtsyCallInformation; | |||
181 | key.iKey = aKey; | |||
182 | key.iValue = value; | |||
183 | } | |||
184 | iObserver->HandleKeyChange( key ); | |||
185 | } | |||
186 | ||||
187 | // End of File | |||
***TER 41% (20/49) of SOURCE FILE cimalertnotifierimpl.cpp |