60
|
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: Handles the notifications for voice mail messages
|
|
15 |
* : Keeps track about the number of voice mail messages
|
|
16 |
* : Has support for alternative line (ALS)
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
#include <centralrepository.h>
|
|
24 |
#include <messagingvariant.hrh> // For CR key handling local variation flags
|
|
25 |
#include <centralrepository.h> // For CR key handling
|
|
26 |
#include <NcnListInternalCRKeys.h> // For CR key handling
|
|
27 |
#include <RSSSettings.h> // For ALS detection
|
|
28 |
#include <startupdomainpskeys.h>
|
|
29 |
#include <MessagingDomainCRKeys.h>
|
|
30 |
|
|
31 |
#include "NcnDebug.h"
|
|
32 |
#include "NcnCRHandler.h"
|
|
33 |
#include "CVoiceMailManager.h"
|
|
34 |
#include "CNcnNotifier.h"
|
|
35 |
#include "NcnModelBase.h"
|
|
36 |
#include "MNcnMsgWaitingManager.h"
|
|
37 |
|
|
38 |
|
|
39 |
// -----------------------------------------------------------------
|
|
40 |
// CVoiceMailManager::NewL
|
|
41 |
// -----------------------------------------------------------------
|
|
42 |
CVoiceMailManager* CVoiceMailManager::NewL( CNcnModelBase& aModel )
|
|
43 |
{
|
|
44 |
CVoiceMailManager* self = new (ELeave) CVoiceMailManager( aModel );
|
|
45 |
|
|
46 |
CleanupStack::PushL( self );
|
|
47 |
self->ConstructL();
|
|
48 |
CleanupStack::Pop( self );
|
|
49 |
|
|
50 |
return self;
|
|
51 |
}
|
|
52 |
|
|
53 |
// -----------------------------------------------------------------
|
|
54 |
// CVoiceMailManager::~CVoiceMailManager
|
|
55 |
// -----------------------------------------------------------------
|
|
56 |
CVoiceMailManager::~CVoiceMailManager()
|
|
57 |
{
|
|
58 |
}
|
|
59 |
|
|
60 |
// -----------------------------------------------------------------
|
|
61 |
// CVoiceMailManager::CVoiceMailManager
|
|
62 |
// -----------------------------------------------------------------
|
|
63 |
CVoiceMailManager::CVoiceMailManager( CNcnModelBase& aModel ) :
|
|
64 |
iIsALSSupported(EFalse),
|
|
65 |
iModel( aModel )
|
|
66 |
{
|
|
67 |
// EMPTY
|
|
68 |
}
|
|
69 |
|
|
70 |
// -----------------------------------------------------------------
|
|
71 |
// CVoiceMailManager::ConstructL
|
|
72 |
// -----------------------------------------------------------------
|
|
73 |
void CVoiceMailManager::ConstructL( )
|
|
74 |
{
|
|
75 |
NCN_RDEBUG( _L("CVoiceMailManager : Constructing") );
|
|
76 |
|
|
77 |
//Clear soft notifications that might be drawn automatically by avkon
|
|
78 |
//TSW Error TWOK-6PNT26
|
|
79 |
ClearVoiceMailSoftNotes();
|
|
80 |
//clear Voicemail indicators only when KMuiuSupressAllNotificationConfiguration(VVM) is enabled.
|
|
81 |
if(CheckSupressNotificationSettingL())
|
|
82 |
{
|
|
83 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine1, EFalse );
|
|
84 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine2, EFalse );
|
|
85 |
}
|
|
86 |
//Get SIM change status at the startup. If the SIM will change after
|
|
87 |
//boot-up we get notifed by the Model so no need to subscribe for this key
|
|
88 |
//TSW ID EHCN-6NRAZE
|
|
89 |
TInt simValue = 0;
|
|
90 |
TInt status = RProperty::Get( KPSUidStartup, KPSSimChanged, simValue );
|
|
91 |
NCN_RDEBUG_INT2(_L("CVoiceMailManager : Requested SIM change! status: %d value: %d"), status, simValue );
|
|
92 |
|
|
93 |
//Handle SIM change in a separate method
|
|
94 |
//no need to continue in constructor after this
|
|
95 |
if( status == KErrNone && simValue == ESimChanged )
|
|
96 |
{
|
|
97 |
NotifyAboutSIMChange();
|
|
98 |
return;
|
|
99 |
}
|
|
100 |
|
|
101 |
//Get the ALS status
|
|
102 |
iIsALSSupported = UpdateALSStatus();
|
|
103 |
|
|
104 |
///////////////////////////////////////////////////////////////////////////////////////
|
|
105 |
// Soft notification must be drawn and the right icon triggered at the boot
|
|
106 |
// if there are active voice mail messages waiting
|
|
107 |
///////////////////////////////////////////////////////////////////////////////////////
|
|
108 |
}
|
|
109 |
|
|
110 |
// ---------------------------------------------------------
|
|
111 |
// CVoiceMailManager::VMReceived
|
|
112 |
// Received a voice mail message to line 1 or 2
|
|
113 |
// ---------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CVoiceMailManager::VMMessageReceived( MNcnMsgWaitingManager::TNcnMessageType aLineType, TUint aAmount )
|
|
116 |
{
|
|
117 |
//Check the value. It must be between 0 - 254 (0xfe) or fuzzy note will be used
|
|
118 |
if( aAmount > EVMMaximumNumber )
|
|
119 |
{
|
|
120 |
aAmount = EVMExistsButCountNotKnown;
|
|
121 |
}
|
|
122 |
|
|
123 |
//The amount might be an exact value 0-254 or a special value EVMExistsButCountNotKnown
|
|
124 |
iModel.MsgWaitingManager().SetMessageCount( aLineType, aAmount, EFalse );
|
|
125 |
|
|
126 |
//Update notifications
|
|
127 |
UpdateVMNotifications();
|
|
128 |
}
|
|
129 |
|
|
130 |
|
|
131 |
// ---------------------------------------------------------
|
|
132 |
// CVoiceMailManager::NotifyAboutSIMChange()
|
|
133 |
// SIM has changed so we will need to erase old notes.
|
|
134 |
// Model uses this method to notify voice mail manager
|
|
135 |
// We also use this in the ConstructL if we notice that
|
|
136 |
// the SIM has changed in boot-up
|
|
137 |
// ---------------------------------------------------------
|
|
138 |
//
|
|
139 |
void CVoiceMailManager::NotifyAboutSIMChange()
|
|
140 |
{
|
|
141 |
NCN_RDEBUG(_L("CVoiceMailManager::NotifyAboutSIMChange - SIM has changed!"));
|
|
142 |
|
|
143 |
//Get the ALS status. ALS status can change if SIM changes
|
|
144 |
iIsALSSupported = UpdateALSStatus();
|
|
145 |
|
|
146 |
//Update notifications
|
|
147 |
UpdateVMNotifications();
|
|
148 |
}
|
|
149 |
|
|
150 |
// ---------------------------------------------------------
|
|
151 |
// CVoiceMailManager::HandlePropertyChangedL()
|
|
152 |
// Handles the subscribed PS property changes.
|
|
153 |
// ---------------------------------------------------------
|
|
154 |
//
|
|
155 |
void CVoiceMailManager::HandlePropertyChangedL( const TUid& /*aCategory*/, TInt /*aKey*/ )
|
|
156 |
{
|
|
157 |
// Empty
|
|
158 |
}
|
|
159 |
|
|
160 |
// ---------------------------------------------------------
|
|
161 |
// CVoiceMailManager::ClearVoiceMailSoftNotes
|
|
162 |
// In boot-up Avkon automatically draws the soft notes that
|
|
163 |
// were present at the time of the shut down. This is not
|
|
164 |
// wanted for the voice mails so we manually null them during
|
|
165 |
// the boot.
|
|
166 |
// ---------------------------------------------------------
|
|
167 |
//
|
|
168 |
void CVoiceMailManager::ClearVoiceMailSoftNotes()
|
|
169 |
{
|
|
170 |
NCN_RDEBUG(_L("CVoiceMailManager::ClearVoiceMailSoftNotes") );
|
|
171 |
iModel.NcnNotifier().SetNotification( MNcnNotifier::ENcnVoiceMailNotification, 0 );
|
|
172 |
iModel.NcnNotifier().SetNotification( MNcnNotifier::ENcnVoiceMailOnLine1Notification, 0 );
|
|
173 |
iModel.NcnNotifier().SetNotification( MNcnNotifier::ENcnVoiceMailOnLine2Notification, 0 );
|
|
174 |
}
|
|
175 |
|
|
176 |
|
|
177 |
// ---------------------------------------------------------
|
|
178 |
// Indication message updates status only for one line at a time.
|
|
179 |
// Both lines need to be updated.
|
|
180 |
// ---------------------------------------------------------
|
|
181 |
//
|
|
182 |
void CVoiceMailManager::UpdateNoteAndIndicationWithALS( TInt aVoiceMailsInLine1, TInt aVoiceMailsInLine2 )
|
|
183 |
{
|
|
184 |
//Soft notifications
|
|
185 |
NCN_RDEBUG_INT(_L("CVoiceMailManager : %d voice mails in line 1 (ALS supported)"), aVoiceMailsInLine1 );
|
|
186 |
NCN_RDEBUG_INT(_L("CVoiceMailManager : %d voice mails in line 2 (ALS supported)"), aVoiceMailsInLine2 );
|
|
187 |
|
|
188 |
if(!CheckSupressNotificationSettingL())
|
|
189 |
{
|
|
190 |
iModel.NcnNotifier().SetNotification( MNcnNotifier::ENcnVoiceMailOnLine1Notification, aVoiceMailsInLine1 );
|
|
191 |
iModel.NcnNotifier().SetNotification( MNcnNotifier::ENcnVoiceMailOnLine2Notification, aVoiceMailsInLine2 );
|
|
192 |
NCN_RDEBUG( _L("CVoiceMailManager: UpdateNoteAndIndicationWithALS With VVM off") );
|
|
193 |
// Indications
|
|
194 |
// SysApp checks ALS support and decides whether to use o_o or O_o (left O full), if ALS supported
|
|
195 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine1, aVoiceMailsInLine1 ? ETrue : EFalse );
|
|
196 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine2, aVoiceMailsInLine2 ? ETrue : EFalse );
|
|
197 |
}
|
|
198 |
}
|
|
199 |
|
|
200 |
// ---------------------------------------------------------
|
|
201 |
// Update soft notification and trigger icon drawing to
|
|
202 |
// reflect the current state of the lines
|
|
203 |
// ---------------------------------------------------------
|
|
204 |
//
|
|
205 |
void CVoiceMailManager::UpdateVMNotifications()
|
|
206 |
{
|
|
207 |
//We now need a conversion from our internally held voice mail count number
|
|
208 |
//to a format that is used in soft notifications.
|
|
209 |
//
|
|
210 |
|
|
211 |
if ( !iModel.MsgWaitingManager().ConstructionReady() )
|
|
212 |
{
|
|
213 |
return;
|
|
214 |
}
|
|
215 |
|
|
216 |
TUint voiceMailsInLine1 = 0;
|
|
217 |
TUint voiceMailsInLine2 = 0;
|
|
218 |
|
|
219 |
//Internally we use value EVMExistsButCountNotKnown to specify a case where the
|
|
220 |
//exact count of the voice mails is not know. However, the soft notes are designed
|
|
221 |
//so that voice mail strings are either exact or "fuzzy", meaning that the expression
|
|
222 |
//used in the string does not imply the exact number.
|
|
223 |
//The "fuzzy" string is the singular string in the voice mail's soft note. To
|
|
224 |
//use the singular form of the string we need to give voice mail count 1 in case the
|
|
225 |
//internal value is EVMExistsButCountNotKnown.
|
|
226 |
TBool line1(EFalse);
|
|
227 |
TBool line2(EFalse);
|
|
228 |
|
|
229 |
iModel.MsgWaitingManager().GetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine1, line1 );
|
|
230 |
iModel.MsgWaitingManager().GetMessageCount( MNcnMsgWaitingManager::ENcnMessageTypeVMLine1, voiceMailsInLine1 );
|
|
231 |
NCN_RDEBUG_INT2(_L("CVoiceMailManager : line 1 indicator %d, count %d"), line1, voiceMailsInLine1 );
|
|
232 |
|
|
233 |
if ( line1 && voiceMailsInLine1 == 0)
|
|
234 |
{
|
|
235 |
voiceMailsInLine1 = EVMExistsButCountNotKnown;
|
|
236 |
}
|
|
237 |
|
|
238 |
iModel.MsgWaitingManager().GetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine2, line2 );
|
|
239 |
iModel.MsgWaitingManager().GetMessageCount( MNcnMsgWaitingManager::ENcnMessageTypeVMLine2, voiceMailsInLine2 );
|
|
240 |
NCN_RDEBUG_INT2(_L("CVoiceMailManager : line 2 indicator %d, count %d"), line2, voiceMailsInLine2 );
|
|
241 |
|
|
242 |
if ( line2 && voiceMailsInLine2 == 0)
|
|
243 |
{
|
|
244 |
voiceMailsInLine2 = EVMExistsButCountNotKnown;
|
|
245 |
}
|
|
246 |
|
|
247 |
//The most common case. ALS is not supported in the terminal
|
|
248 |
//Notifications show no line information. Only the information in
|
|
249 |
//iVoiceMailCountInLine1 matters
|
|
250 |
if( iIsALSSupported == EFalse &&
|
|
251 |
voiceMailsInLine1 > 0)
|
|
252 |
{
|
|
253 |
NCN_RDEBUG_INT(_L("CVoiceMailManager : %d voice mails in line 1 (ALS not supported)"), voiceMailsInLine1 );
|
|
254 |
|
|
255 |
if(!CheckSupressNotificationSettingL())
|
|
256 |
{
|
|
257 |
NCN_RDEBUG( _L("CVoiceMailManager:SetIndicator and Notification ALS not supported With VVM off") );
|
|
258 |
//Soft notification. The SN must not contain any reference to line numbers
|
|
259 |
iModel.NcnNotifier().SetNotification( MNcnNotifier::ENcnVoiceMailNotification, voiceMailsInLine1 );
|
|
260 |
|
|
261 |
// SysApp checks ALS support and decides whether to use o_o or O_o (left O full), if ALS supported
|
|
262 |
// ENcnIndicatorVMLine1 is mapped to KDisplayVoicemailActive in CNcnMsgWaitingManager
|
|
263 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine1, ETrue );
|
|
264 |
}
|
|
265 |
}
|
|
266 |
else if( iIsALSSupported == TRUE )
|
|
267 |
{
|
|
268 |
UpdateNoteAndIndicationWithALS( voiceMailsInLine1, voiceMailsInLine2 );
|
|
269 |
}
|
|
270 |
|
|
271 |
//No voice mails waiting. Clear the messages
|
|
272 |
else
|
|
273 |
{
|
|
274 |
NCN_RDEBUG( _L("CVoiceMailManager : No voice mails in line 1 nor in line 2") );
|
|
275 |
|
|
276 |
//Clear soft notifications
|
|
277 |
ClearVoiceMailSoftNotes();
|
|
278 |
|
|
279 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine1, EFalse );
|
|
280 |
iModel.MsgWaitingManager().SetIndicator( MNcnMsgWaitingManager::ENcnIndicatorVMLine2, EFalse );
|
|
281 |
}
|
|
282 |
}
|
|
283 |
|
|
284 |
// -------------------------------------------------------------------
|
|
285 |
// Find out if alternative line subscription is active in the terminal
|
|
286 |
// -------------------------------------------------------------------
|
|
287 |
//
|
|
288 |
TBool CVoiceMailManager::UpdateALSStatus()
|
|
289 |
{
|
|
290 |
//Open the information settings
|
|
291 |
RSSSettings settings;
|
|
292 |
TInt status = settings.Open();
|
|
293 |
NCN_RDEBUG_INT( _L("CVoiceMailManager.UpdateALSStatus() : Opened RSSSettings! status %d"), status );
|
|
294 |
|
|
295 |
//Get the ALS information,
|
|
296 |
// ALS is supported, if:
|
|
297 |
// 1. supported by the device (ALS PP enabled)
|
|
298 |
// 2. CSP enabled and SIM supports alternative service line (line2)
|
|
299 |
TInt alsValue = KErrUnknown;
|
|
300 |
status = settings.Get( ESSSettingsAls, alsValue );
|
|
301 |
NCN_RDEBUG_INT2( _L("CVoiceMailManager.UpdateALSStatus() : Got ALS info Status: %d Value: %d"), status, alsValue);
|
|
302 |
|
|
303 |
//Close the settings, they are no longer needed
|
|
304 |
settings.Close();
|
|
305 |
|
|
306 |
//Meaning of the ALS values
|
|
307 |
// ESSSettingsAlsNotSupported - ALS not supported, always primary line.
|
|
308 |
// ESSSettingsAlsPrimary - ALS supported, primary line selected.
|
|
309 |
// ESSSettingsAlsAlternate - ALS supported, alternate line selected.
|
|
310 |
|
|
311 |
//Value read OK and ALS not supported
|
|
312 |
if( status == KErrNone && alsValue == ESSSettingsAlsNotSupported )
|
|
313 |
{
|
|
314 |
NCN_RDEBUG( _L("ALS value read properly! ALS not supported!") );
|
|
315 |
return EFalse;
|
|
316 |
}
|
|
317 |
//Value read OK and ALS is supported
|
|
318 |
else if( status == KErrNone &&
|
|
319 |
( alsValue == ESSSettingsAlsPrimary || alsValue == ESSSettingsAlsAlternate ) )
|
|
320 |
{
|
|
321 |
NCN_RDEBUG( _L("ALS value read properly! ALS is supported!") );
|
|
322 |
return ETrue;
|
|
323 |
}
|
|
324 |
//Default value. ALS not supported. Returned if ALS status can't be read properly!
|
|
325 |
else
|
|
326 |
{
|
|
327 |
NCN_RDEBUG_INT2( _L("ALS value NOT read properly! Status: %d Value: %d"), status, alsValue );
|
|
328 |
return EFalse;
|
|
329 |
}
|
|
330 |
}
|
|
331 |
|
|
332 |
// -------------------------------------------------------------------
|
|
333 |
// Check the KMuiuSupressAllNotificationConfiguration value
|
|
334 |
// -------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
TBool CVoiceMailManager::CheckSupressNotificationSettingL()
|
|
337 |
{
|
|
338 |
TBool result = EFalse;
|
|
339 |
TInt value = 0;
|
|
340 |
CRepository* repository = NULL;
|
|
341 |
|
|
342 |
TRAPD( err, repository = CRepository::NewL( KCRUidMuiuMessagingConfiguration ) );
|
|
343 |
if( err == KErrNone && repository != NULL )
|
|
344 |
{
|
|
345 |
CleanupStack::PushL( repository );
|
|
346 |
err = repository->Get( KMuiuSupressAllNotificationConfiguration, value );
|
|
347 |
|
|
348 |
if(err == KErrNone && (value & KMuiuNotificationSupressedForVoiceMail ))
|
|
349 |
{
|
|
350 |
result = ETrue;
|
|
351 |
}
|
|
352 |
}
|
|
353 |
NCN_RDEBUG_INT( _L("CNcnNotifier::CheckSupressNotificationSetting() - result: %d"), result );
|
|
354 |
CleanupStack::PopAndDestroy( repository );
|
|
355 |
return result;
|
|
356 |
}
|
|
357 |
// End of File
|