|
1 /* |
|
2 * Copyright (c) 2006 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: See class description. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <bautils.h> |
|
21 #include <data_caging_path_literals.hrh> |
|
22 #include <pslninternalcrkeys.h> |
|
23 |
|
24 #include "phoneconstants.h" |
|
25 #include "cphonecallthememonitor.h" |
|
26 #include "phonelogger.h" |
|
27 #include "cphonecenrepproxy.h" |
|
28 #include "mphonecenrepobserver.h" |
|
29 #include "phoneui.pan" |
|
30 |
|
31 // Values for KThemesCallImageSettings CR key |
|
32 const TInt KPslnCRUserDefinedCallImage = 1; |
|
33 |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CPhoneCallThemeMonitor::CPhoneCallThemeMonitor |
|
39 // C++ default constructor can NOT contain any code, that |
|
40 // might leave. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CPhoneCallThemeMonitor::CPhoneCallThemeMonitor() |
|
44 { |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CPhoneCallThemeMonitor::ConstructL |
|
49 // Symbian 2nd phase constructor can leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CPhoneCallThemeMonitor::ConstructL() |
|
53 { |
|
54 __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneCallThemeMonitor::ConstructL ()" ); |
|
55 |
|
56 // Get all current values |
|
57 TRAP_IGNORE( ReadAllL() ); |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CPhoneCallThemeMonitor::NewL |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C CPhoneCallThemeMonitor* CPhoneCallThemeMonitor::NewL() |
|
66 { |
|
67 CPhoneCallThemeMonitor* self = |
|
68 new (ELeave) CPhoneCallThemeMonitor(); |
|
69 |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 CleanupStack::Pop( self ); |
|
73 |
|
74 return self; |
|
75 } |
|
76 |
|
77 // Destructor |
|
78 EXPORT_C CPhoneCallThemeMonitor::~CPhoneCallThemeMonitor() |
|
79 { |
|
80 delete iCallerImageThemePath; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CPhoneCallThemeMonitor::CallImageThemeSettings |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C TInt CPhoneCallThemeMonitor::CallImageThemeSettings() const |
|
88 { |
|
89 __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneCallThemeMonitor::CallImageThemeSettings ()" ); |
|
90 return iThemeCallImageSettings; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CPhoneCallThemeMonitor::CallImageThemeFilePath |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C TPtrC CPhoneCallThemeMonitor::CallImageThemeFilePath() const |
|
98 { |
|
99 __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneCallThemeMonitor::CallImageThemeFilePath ()" ); |
|
100 if ( iCallerImageThemePath ) |
|
101 { |
|
102 return *iCallerImageThemePath; |
|
103 } |
|
104 else |
|
105 { |
|
106 return KNullDesC(); |
|
107 } |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CPhoneCallThemeMonitor::SetCallThemeSettingsObserver |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C void CPhoneCallThemeMonitor::SetCallThemeSettingsObserver( |
|
115 MPhoneCallThemeSettingsObserver* aObserver ) |
|
116 { |
|
117 __ASSERT_DEBUG( iObserver == NULL, Panic( KErrNotSupported ) ); |
|
118 iObserver = aObserver; |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------- |
|
122 // CPhoneCallThemeMonitor::HandleCenRepChangeL |
|
123 // ----------------------------------------------------------- |
|
124 // |
|
125 void CPhoneCallThemeMonitor::HandleCenRepChangeL( |
|
126 const TUid& aUid, |
|
127 const TUint aId ) |
|
128 { |
|
129 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneCallThemeMonitor::HandleCenRepChangeL( ) "); |
|
130 if ( aUid == KCRUidThemes ) |
|
131 { |
|
132 if (aId == KThemesCallImagePath || aId == KThemesCallImageSetting ) |
|
133 { |
|
134 ReadAllL(); |
|
135 if ( iObserver ) |
|
136 { |
|
137 iObserver->CallThemeSettingsChanged(); |
|
138 } |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CPhoneCallThemeMonitor::ReadAllL |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CPhoneCallThemeMonitor::ReadAllL() |
|
148 { |
|
149 __LOGMETHODSTARTEND( EPhoneUIUtils, "CPhoneCallThemeMonitor::ReadAllL ()" ); |
|
150 |
|
151 // Call image status |
|
152 TInt value( KErrNone ); |
|
153 TInt err( CPhoneCenRepProxy::Instance()->GetInt( |
|
154 KCRUidThemes, |
|
155 KThemesCallImageSetting, |
|
156 value ) ); |
|
157 |
|
158 if ( err == KErrNone ) |
|
159 { |
|
160 iThemeCallImageSettings = value; |
|
161 } |
|
162 |
|
163 if ( iThemeCallImageSettings == KPslnCRUserDefinedCallImage ) |
|
164 { |
|
165 delete iCallerImageThemePath; |
|
166 iCallerImageThemePath = NULL; |
|
167 iCallerImageThemePath = HBufC::NewL( KMaxFilePathLength ); |
|
168 TPtr imagePtr ( iCallerImageThemePath->Des() ); |
|
169 |
|
170 __PHONELOG1( EBasic, EPhoneUIUtils, |
|
171 "CPhoneCallThemeMonitor::ReadAllL -> image path = %S", &imagePtr ); |
|
172 } |
|
173 else |
|
174 { |
|
175 delete iCallerImageThemePath; |
|
176 iCallerImageThemePath = NULL; |
|
177 } |
|
178 } |
|
179 |
|
180 // End of File |