19
|
1 |
/*
|
|
2 |
* Copyright (c) 2004-2007 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <coemain.h>
|
|
21 |
#include <centralrepository.h>
|
|
22 |
#include <featmgr.h>
|
|
23 |
|
|
24 |
#include <PbkFields.hrh>
|
|
25 |
|
|
26 |
#include <VPbkEng.rsg>
|
|
27 |
|
|
28 |
#include <CVPbkContactManager.h>
|
|
29 |
#include <CVPbkContactStoreUriArray.h>
|
|
30 |
#include <VPbkContactStoreUris.h>
|
|
31 |
#include <TVPbkContactStoreUriPtr.h>
|
|
32 |
#include <MVPbkContactStoreList.h>
|
|
33 |
#include <CVPbkContactIdConverter.h>
|
|
34 |
#include <MVPbkContactOperationBase.h>
|
|
35 |
#include <MVPbkStoreContact.h>
|
|
36 |
#include <MVPbkFieldType.h>
|
|
37 |
#include <CVPbkDefaultAttribute.h>
|
|
38 |
#include <MVPbkContactAttributeManager.h>
|
|
39 |
#include <MVPbkContactFieldTextData.h>
|
|
40 |
#include <MVPbkContactFieldUriData.h>
|
|
41 |
#include <MVPbkContactViewBase.h>
|
|
42 |
#include <CVPbkContactViewDefinition.h>
|
|
43 |
|
|
44 |
#include <nssvasmtag.h>
|
|
45 |
#include <nssvascoreconstant.h>
|
|
46 |
|
|
47 |
#include "vascvpbkhandler.h"
|
|
48 |
#include "vasmcontactobserver.h"
|
|
49 |
|
|
50 |
#include "srsfprivatecrkeys.h"
|
|
51 |
|
|
52 |
#include "rubydebug.h"
|
|
53 |
|
|
54 |
// CONSTANTS
|
|
55 |
|
|
56 |
// Priority list of virtual phonebook fields
|
|
57 |
const TInt KFieldPriority[] =
|
|
58 |
{
|
|
59 |
R_VPBK_FIELD_TYPE_LANDPHONEGEN,
|
|
60 |
R_VPBK_FIELD_TYPE_LANDPHONEHOME,
|
|
61 |
R_VPBK_FIELD_TYPE_LANDPHONEWORK,
|
|
62 |
R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,
|
|
63 |
R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
|
|
64 |
R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
|
|
65 |
R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
|
|
66 |
R_VPBK_FIELD_TYPE_VIDEONUMBERHOME,
|
|
67 |
R_VPBK_FIELD_TYPE_VIDEONUMBERWORK,
|
|
68 |
R_VPBK_FIELD_TYPE_FAXNUMBERGEN,
|
|
69 |
R_VPBK_FIELD_TYPE_FAXNUMBERHOME,
|
|
70 |
R_VPBK_FIELD_TYPE_FAXNUMBERWORK,
|
|
71 |
R_VPBK_FIELD_TYPE_VOIPGEN,
|
|
72 |
R_VPBK_FIELD_TYPE_VOIPHOME,
|
|
73 |
R_VPBK_FIELD_TYPE_VOIPWORK,
|
|
74 |
R_VPBK_FIELD_TYPE_IMPP,
|
|
75 |
R_VPBK_FIELD_TYPE_EMAILGEN,
|
|
76 |
R_VPBK_FIELD_TYPE_EMAILHOME,
|
|
77 |
R_VPBK_FIELD_TYPE_EMAILWORK,
|
|
78 |
R_VPBK_FIELD_TYPE_FIRSTNAMEREADING,
|
|
79 |
R_VPBK_FIELD_TYPE_FIRSTNAME,
|
|
80 |
R_VPBK_FIELD_TYPE_LASTNAMEREADING,
|
|
81 |
R_VPBK_FIELD_TYPE_LASTNAME,
|
|
82 |
R_VPBK_FIELD_TYPE_COMPANYNAME,
|
|
83 |
R_VPBK_FIELD_TYPE_SECONDNAME
|
|
84 |
};
|
|
85 |
const TInt KFieldPriorityCount = sizeof( KFieldPriority ) / sizeof ( TInt );
|
|
86 |
|
|
87 |
// ================= MEMBER FUNCTIONS =======================
|
|
88 |
|
|
89 |
// ---------------------------------------------------------
|
|
90 |
// CVasVPbkHandler* CVasVPbkHandler::NewL
|
|
91 |
// Two-phased constructor.
|
|
92 |
// ---------------------------------------------------------
|
|
93 |
//
|
|
94 |
EXPORT_C CVasVPbkHandler* CVasVPbkHandler::NewL()
|
|
95 |
{
|
|
96 |
CVasVPbkHandler* self = new (ELeave) CVasVPbkHandler;
|
|
97 |
CleanupStack::PushL( self );
|
|
98 |
self->ConstructL();
|
|
99 |
CleanupStack::Pop( self );
|
|
100 |
return self;
|
|
101 |
}
|
|
102 |
|
|
103 |
// Destructor
|
|
104 |
EXPORT_C CVasVPbkHandler::~CVasVPbkHandler()
|
|
105 |
{
|
|
106 |
RUBY_DEBUG0( "CVasVPbkHandler::~CVasVPbkHandler START" );
|
|
107 |
|
|
108 |
iObserver = NULL;
|
|
109 |
|
|
110 |
delete iField;
|
|
111 |
|
|
112 |
delete iContact;
|
|
113 |
|
|
114 |
delete iOperation;
|
|
115 |
|
|
116 |
delete iConverter;
|
|
117 |
|
|
118 |
if ( iContactManager )
|
|
119 |
{
|
|
120 |
TRAP_IGNORE( iContactManager->ContactStoresL().CloseAll( *this ) );
|
|
121 |
}
|
|
122 |
delete iContactManager;
|
|
123 |
|
|
124 |
RUBY_DEBUG0( "CVasVPbkHandler::~CVasVPbkHandler EXIT" );
|
|
125 |
}
|
|
126 |
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
// CVasVPbkHandler::InitializeL
|
|
129 |
// Initializes phonebook handles
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
EXPORT_C void CVasVPbkHandler::InitializeL()
|
|
133 |
{
|
|
134 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::InitializeL" );
|
|
135 |
|
|
136 |
__ASSERT_ALWAYS( !iContactManager, User::Leave( KErrAlreadyExists ) );
|
|
137 |
__ASSERT_ALWAYS( !iConverter, User::Leave( KErrAlreadyExists ) );
|
|
138 |
|
|
139 |
FeatureManager::InitializeLibL();
|
|
140 |
|
|
141 |
iMMSSupported = FeatureManager::FeatureSupported( KFeatureIdMMS );
|
|
142 |
|
|
143 |
FeatureManager::UnInitializeLib();
|
|
144 |
|
|
145 |
CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
|
|
146 |
uriArray->AppendL( TVPbkContactStoreUriPtr( VPbkContactStoreUris::DefaultCntDbUri() ) );
|
|
147 |
|
|
148 |
iContactManager = CVPbkContactManager::NewL( *uriArray, NULL );
|
|
149 |
CleanupStack::PopAndDestroy( uriArray );
|
|
150 |
|
|
151 |
MVPbkContactStoreList& storeList = iContactManager->ContactStoresL();
|
|
152 |
storeList.OpenAllL( *this );
|
|
153 |
|
|
154 |
// Synchronize the OpenAllL call
|
|
155 |
iWait.Start();
|
|
156 |
|
|
157 |
User::LeaveIfError( iError );
|
|
158 |
|
|
159 |
iConverter = CVPbkContactIdConverter::NewL( iContactManager->ContactStoresL().At( 0 ) );
|
|
160 |
}
|
|
161 |
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
// CVasVPbkHandler::CreateContactObserverL
|
|
164 |
// Creates the contact change notifier and sets observer as a listener
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
EXPORT_C void CVasVPbkHandler::CreateContactObserverL( MVasContactObserver* aObserver )
|
|
168 |
{
|
|
169 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::CreateContactObserverL" );
|
|
170 |
iObserver = aObserver;
|
|
171 |
}
|
|
172 |
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
// CVasVPbkHandler::CompressL
|
|
175 |
// Compresses database
|
|
176 |
// -----------------------------------------------------------------------------
|
|
177 |
//
|
|
178 |
EXPORT_C void CVasVPbkHandler::CompressL()
|
|
179 |
{
|
|
180 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::CompressL" );
|
|
181 |
|
|
182 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
183 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
184 |
|
|
185 |
iOperation = iContactManager->CompressStoresL( *this );
|
|
186 |
|
|
187 |
iWait.Start();
|
|
188 |
|
|
189 |
User::LeaveIfError( iError );
|
|
190 |
}
|
|
191 |
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
// CVasVPbkHandler::CompressL
|
|
194 |
// Returns all contact ids from database
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
//
|
|
197 |
EXPORT_C CContactIdArray* CVasVPbkHandler::ContactIdArrayLC()
|
|
198 |
{
|
|
199 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactIdArrayLC START" );
|
|
200 |
|
|
201 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
202 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
203 |
|
|
204 |
CContactIdArray* array = CContactIdArray::NewLC();
|
|
205 |
|
|
206 |
CVPbkContactViewDefinition* definition = CVPbkContactViewDefinition::NewL();
|
|
207 |
CleanupStack::PushL( definition );
|
|
208 |
|
|
209 |
definition->SetType( EVPbkContactsView );
|
|
210 |
definition->SetUriL( VPbkContactStoreUris::DefaultCntDbUri() );
|
|
211 |
|
|
212 |
MVPbkContactViewBase* view =
|
|
213 |
iContactManager->CreateContactViewLC( *this, *definition, iContactManager->FieldTypes() );
|
|
214 |
|
|
215 |
iWait.Start();
|
|
216 |
|
|
217 |
User::LeaveIfError( iError );
|
|
218 |
|
|
219 |
for( int i = 0; i < view->ContactCountL(); ++i )
|
|
220 |
{
|
|
221 |
MVPbkContactLink* link = view->CreateLinkLC( i );
|
|
222 |
|
|
223 |
if ( link )
|
|
224 |
{
|
|
225 |
array->AddL( iConverter->LinkToIdentifier( *link ) );
|
|
226 |
|
|
227 |
CleanupStack::PopAndDestroy(); // Destroy link
|
|
228 |
}
|
|
229 |
}
|
|
230 |
|
|
231 |
CleanupStack::PopAndDestroy(); // Destroy view
|
|
232 |
CleanupStack::PopAndDestroy( definition );
|
|
233 |
|
|
234 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactIdArrayLC EXIT" );
|
|
235 |
|
|
236 |
return array;
|
|
237 |
}
|
|
238 |
|
|
239 |
// -----------------------------------------------------------------------------
|
|
240 |
// CVasVPbkHandler::FindContactL
|
|
241 |
// Finds a contact from the phonebook that matches given tag
|
|
242 |
// -----------------------------------------------------------------------------
|
|
243 |
//
|
|
244 |
EXPORT_C void CVasVPbkHandler::FindContactL( MNssTag* aTag )
|
|
245 |
{
|
|
246 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FindContactL" );
|
|
247 |
|
|
248 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
249 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
250 |
|
|
251 |
delete iField;
|
|
252 |
iField = NULL;
|
|
253 |
|
|
254 |
delete iContact;
|
|
255 |
iContact = NULL;
|
|
256 |
|
|
257 |
MVPbkContactLink* link =
|
|
258 |
iConverter->IdentifierToLinkLC( aTag->RRD()->IntArray()->At( KVasContactIdRrdLocation ) );
|
|
259 |
|
|
260 |
iOperation = iContactManager->RetrieveContactL( *link, *this );
|
|
261 |
|
|
262 |
iWait.Start();
|
|
263 |
|
|
264 |
// If contact was not found, then request for immediate contact db resync
|
|
265 |
if ( iError == KErrNotFound )
|
|
266 |
{
|
|
267 |
CRepository* repository = CRepository::NewLC( KCRUidSRSFSettings );
|
|
268 |
|
|
269 |
repository->Set( KSRSFFullResyncNeeded, KImmediateResync );
|
|
270 |
|
|
271 |
CleanupStack::PopAndDestroy( repository );
|
|
272 |
}
|
|
273 |
|
|
274 |
User::LeaveIfError( iError );
|
|
275 |
|
|
276 |
CleanupStack::PopAndDestroy(); // Destroys the link
|
|
277 |
}
|
|
278 |
|
|
279 |
// -----------------------------------------------------------------------------
|
|
280 |
// CVasVPbkHandler::FindContactL
|
|
281 |
// Finds a contact from the phonebook that matches given contact id
|
|
282 |
// -----------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
EXPORT_C void CVasVPbkHandler::FindContactL( TInt32 aContactId, TBool aReadOnly )
|
|
285 |
{
|
|
286 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FindContactL" );
|
|
287 |
|
|
288 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
289 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
290 |
|
|
291 |
delete iField;
|
|
292 |
iField = NULL;
|
|
293 |
|
|
294 |
delete iContact;
|
|
295 |
iContact = NULL;
|
|
296 |
|
|
297 |
MVPbkContactLink* link = iConverter->IdentifierToLinkLC( aContactId );
|
|
298 |
|
|
299 |
iOperation = iContactManager->RetrieveContactL( *link, *this );
|
|
300 |
|
|
301 |
iWait.Start();
|
|
302 |
|
|
303 |
User::LeaveIfError( iError );
|
|
304 |
|
|
305 |
if ( !aReadOnly )
|
|
306 |
{
|
|
307 |
iContact->LockL( *this );
|
|
308 |
|
|
309 |
iWait.Start();
|
|
310 |
|
|
311 |
User::LeaveIfError( iError );
|
|
312 |
}
|
|
313 |
|
|
314 |
CleanupStack::PopAndDestroy(); // Destroys the link
|
|
315 |
}
|
|
316 |
|
|
317 |
// -----------------------------------------------------------------------------
|
|
318 |
// CVasVPbkHandler::CloseContactL
|
|
319 |
// Closes contact with or without saving changes
|
|
320 |
// -----------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
EXPORT_C void CVasVPbkHandler::CloseContactL( TBool aSaveChanges )
|
|
323 |
{
|
|
324 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::CloseContactL" );
|
|
325 |
|
|
326 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
327 |
__ASSERT_ALWAYS( iContact, User::Leave( KErrArgument ) );
|
|
328 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
329 |
|
|
330 |
if ( aSaveChanges )
|
|
331 |
{
|
|
332 |
iContact->CommitL( *this );
|
|
333 |
|
|
334 |
iWait.Start();
|
|
335 |
|
|
336 |
User::LeaveIfError( iError );
|
|
337 |
}
|
|
338 |
|
|
339 |
delete iContact;
|
|
340 |
iContact = NULL;
|
|
341 |
}
|
|
342 |
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
// CVasVPbkHandler::FindFieldL
|
|
345 |
// Finds a contact field that matches given tag
|
|
346 |
// -----------------------------------------------------------------------------
|
|
347 |
//
|
|
348 |
EXPORT_C void CVasVPbkHandler::FindFieldL( MNssTag* aTag )
|
|
349 |
{
|
|
350 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FindFieldL" );
|
|
351 |
|
|
352 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
353 |
__ASSERT_ALWAYS( iContact, User::Leave( KErrArgument ) );
|
|
354 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
355 |
|
|
356 |
delete iField;
|
|
357 |
iField = NULL;
|
|
358 |
|
|
359 |
TRAPD( error,
|
|
360 |
FindDefaultContactFieldL( aTag->RRD()->IntArray()->At( KVasExtensionCommandRrdLocation ) ) );
|
|
361 |
if ( error == KErrNotFound )
|
|
362 |
{
|
|
363 |
FindFieldL( aTag->RRD()->IntArray()->At( KVasFieldIdRrdLocation ) );
|
|
364 |
}
|
|
365 |
|
|
366 |
if ( !iField )
|
|
367 |
{
|
|
368 |
User::Leave( KErrNotFound );
|
|
369 |
}
|
|
370 |
|
|
371 |
}
|
|
372 |
|
|
373 |
// -----------------------------------------------------------------------------
|
|
374 |
// CVasVPbkHandler::FindFieldL
|
|
375 |
// Finds a contact field that matches given field id
|
|
376 |
// -----------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
EXPORT_C void CVasVPbkHandler::FindFieldL( TInt aFieldId )
|
|
379 |
{
|
|
380 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FindFieldL" );
|
|
381 |
|
|
382 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
383 |
__ASSERT_ALWAYS( iContact, User::Leave( KErrArgument ) );
|
|
384 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
385 |
|
|
386 |
delete iField;
|
|
387 |
iField = NULL;
|
|
388 |
|
|
389 |
MVPbkStoreContactFieldCollection& fields = iContact->Fields();
|
|
390 |
|
|
391 |
TInt priority = KFieldPriorityCount;
|
|
392 |
for ( TInt index = 0; index < fields.FieldCount(); ++index )
|
|
393 |
{
|
|
394 |
if ( ConvertFieldId( fields.FieldAt( index ) ) == aFieldId &&
|
|
395 |
FieldPriority( fields.FieldAt( index ) ) < priority )
|
|
396 |
{
|
|
397 |
priority = FieldPriority( fields.FieldAt( index ) );
|
|
398 |
|
|
399 |
delete iField;
|
|
400 |
iField = NULL;
|
|
401 |
|
|
402 |
iField = fields.FieldAtLC( index );
|
|
403 |
CleanupStack::Pop(); // Pops iField
|
|
404 |
}
|
|
405 |
}
|
|
406 |
|
|
407 |
if ( !iField )
|
|
408 |
{
|
|
409 |
User::Leave( KErrNotFound );
|
|
410 |
}
|
|
411 |
}
|
|
412 |
|
|
413 |
// -----------------------------------------------------------------------------
|
|
414 |
// CVasVPbkHandler::FindContactFieldL
|
|
415 |
// Finds a contact and a field that mathes given tag
|
|
416 |
// -----------------------------------------------------------------------------
|
|
417 |
//
|
|
418 |
EXPORT_C void CVasVPbkHandler::FindContactFieldL( MNssTag* aTag )
|
|
419 |
{
|
|
420 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FindContactFieldL" );
|
|
421 |
|
|
422 |
FindContactL( aTag );
|
|
423 |
FindFieldL( aTag );
|
|
424 |
}
|
|
425 |
|
|
426 |
// -----------------------------------------------------------------------------
|
|
427 |
// CVasVPbkHandler::FindDefaultContactFieldL
|
|
428 |
// Tries to find a default field of given type from found contact
|
|
429 |
// -----------------------------------------------------------------------------
|
|
430 |
//
|
|
431 |
EXPORT_C void CVasVPbkHandler::FindDefaultContactFieldL( TInt aCommandType )
|
|
432 |
{
|
|
433 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FindDefaultContactFieldL" );
|
|
434 |
|
|
435 |
__ASSERT_ALWAYS( iContactManager, User::Leave( KErrArgument ) );
|
|
436 |
__ASSERT_ALWAYS( iContact, User::Leave( KErrArgument ) );
|
|
437 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
438 |
|
|
439 |
TInt found = KErrNotFound;
|
|
440 |
|
|
441 |
TVPbkDefaultType type = SelectDefaultType( aCommandType );
|
|
442 |
|
|
443 |
if ( type != EVPbkDefaultTypeUndefined )
|
|
444 |
{
|
|
445 |
MVPbkContactAttributeManager& attributeManager = iContactManager->ContactAttributeManagerL();
|
|
446 |
|
|
447 |
CVPbkDefaultAttribute* attribute = CVPbkDefaultAttribute::NewL( type );
|
|
448 |
CleanupStack::PushL( attribute );
|
|
449 |
|
|
450 |
MVPbkStoreContactField* field =
|
|
451 |
attributeManager.FindFieldWithAttributeL( *attribute, *iContact );
|
|
452 |
|
|
453 |
if ( field && AcceptDefaultField( *field, aCommandType ) )
|
|
454 |
{
|
|
455 |
iField = field->CloneLC();
|
|
456 |
CleanupStack::Pop(); // Pops iField
|
|
457 |
found = KErrNone;
|
|
458 |
}
|
|
459 |
|
|
460 |
CleanupStack::PopAndDestroy( attribute );
|
|
461 |
}
|
|
462 |
|
|
463 |
User::LeaveIfError( found );
|
|
464 |
}
|
|
465 |
|
|
466 |
// -----------------------------------------------------------------------------
|
|
467 |
// CVasVPbkHandler::ChangeVoiceTagFieldL
|
|
468 |
// Changes current field's voice tag field status
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
//
|
|
471 |
EXPORT_C void CVasVPbkHandler::ChangeVoiceTagFieldL( TBool /*aSet*/ )
|
|
472 |
{
|
|
473 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::ChangeVoiceTagFieldL" );
|
|
474 |
|
|
475 |
User::Leave( KErrNotSupported );
|
|
476 |
}
|
|
477 |
|
|
478 |
// -----------------------------------------------------------------------------
|
|
479 |
// CVasVPbkHandler::LabelL
|
|
480 |
// Returns the field label
|
|
481 |
// -----------------------------------------------------------------------------
|
|
482 |
//
|
|
483 |
EXPORT_C TPtrC CVasVPbkHandler::LabelL()
|
|
484 |
{
|
|
485 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::LabelL" );
|
|
486 |
|
|
487 |
__ASSERT_ALWAYS( iField, User::Leave( KErrArgument ) );
|
|
488 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
489 |
|
|
490 |
if ( iField->BestMatchingFieldType()->FieldTypeResId() == R_VPBK_FIELD_TYPE_IMPP &&
|
|
491 |
iField->FieldData().DataType() == EVPbkFieldStorageTypeUri )
|
|
492 |
{
|
|
493 |
return MVPbkContactFieldUriData::Cast( iField->FieldData()).Scheme();
|
|
494 |
}
|
|
495 |
|
|
496 |
return iField->FieldLabel();
|
|
497 |
}
|
|
498 |
|
|
499 |
// -----------------------------------------------------------------------------
|
|
500 |
// CVasVPbkHandler::TextL
|
|
501 |
// Returns the field text
|
|
502 |
// -----------------------------------------------------------------------------
|
|
503 |
//
|
|
504 |
EXPORT_C TPtrC CVasVPbkHandler::TextL()
|
|
505 |
{
|
|
506 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::TextL" );
|
|
507 |
|
|
508 |
__ASSERT_ALWAYS( iField, User::Leave( KErrArgument ) );
|
|
509 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
510 |
|
|
511 |
if ( iField->FieldData().DataType() == EVPbkFieldStorageTypeText )
|
|
512 |
{
|
|
513 |
return MVPbkContactFieldTextData::Cast( iField->FieldData() ).Text();
|
|
514 |
}
|
|
515 |
else if ( iField->FieldData().DataType() == EVPbkFieldStorageTypeUri )
|
|
516 |
{
|
|
517 |
return MVPbkContactFieldUriData::Cast( iField->FieldData() ).Text();
|
|
518 |
}
|
|
519 |
else
|
|
520 |
{
|
|
521 |
return KNullDesC();
|
|
522 |
}
|
|
523 |
}
|
|
524 |
|
|
525 |
// -----------------------------------------------------------------------------
|
|
526 |
// CVasVPbkHandler::FieldTypeL
|
|
527 |
// Returns field type as an UID
|
|
528 |
// -----------------------------------------------------------------------------
|
|
529 |
//
|
|
530 |
EXPORT_C TFieldType CVasVPbkHandler::FieldTypeL()
|
|
531 |
{
|
|
532 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FieldTypeL" );
|
|
533 |
|
|
534 |
__ASSERT_ALWAYS( iField, User::Leave( KErrArgument ) );
|
|
535 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
536 |
|
|
537 |
TFieldType uid = KNullUid;
|
|
538 |
|
|
539 |
switch( iField->BestMatchingFieldType()->FieldTypeResId() )
|
|
540 |
{
|
|
541 |
case R_VPBK_FIELD_TYPE_LANDPHONEHOME:
|
|
542 |
case R_VPBK_FIELD_TYPE_LANDPHONEWORK:
|
|
543 |
case R_VPBK_FIELD_TYPE_LANDPHONEGEN:
|
|
544 |
{
|
|
545 |
uid = KUidContactFieldVCardMapVOICE;
|
|
546 |
break;
|
|
547 |
}
|
|
548 |
|
|
549 |
case R_VPBK_FIELD_TYPE_MOBILEPHONEHOME:
|
|
550 |
case R_VPBK_FIELD_TYPE_MOBILEPHONEWORK:
|
|
551 |
case R_VPBK_FIELD_TYPE_MOBILEPHONEGEN:
|
|
552 |
{
|
|
553 |
uid = KUidContactFieldVCardMapCELL;
|
|
554 |
break;
|
|
555 |
}
|
|
556 |
|
|
557 |
case R_VPBK_FIELD_TYPE_VIDEONUMBERHOME:
|
|
558 |
case R_VPBK_FIELD_TYPE_VIDEONUMBERWORK:
|
|
559 |
case R_VPBK_FIELD_TYPE_VIDEONUMBERGEN:
|
|
560 |
{
|
|
561 |
uid = KUidContactFieldVCardMapVIDEO;
|
|
562 |
break;
|
|
563 |
}
|
|
564 |
|
|
565 |
case R_VPBK_FIELD_TYPE_FAXNUMBERHOME:
|
|
566 |
case R_VPBK_FIELD_TYPE_FAXNUMBERWORK:
|
|
567 |
case R_VPBK_FIELD_TYPE_FAXNUMBERGEN:
|
|
568 |
{
|
|
569 |
uid = KUidContactFieldVCardMapFAX;
|
|
570 |
break;
|
|
571 |
}
|
|
572 |
|
|
573 |
case R_VPBK_FIELD_TYPE_VOIPHOME:
|
|
574 |
case R_VPBK_FIELD_TYPE_VOIPWORK:
|
|
575 |
case R_VPBK_FIELD_TYPE_VOIPGEN:
|
|
576 |
case R_VPBK_FIELD_TYPE_IMPP:
|
|
577 |
{
|
|
578 |
uid = KUidContactFieldVCardMapVOIP;
|
|
579 |
break;
|
|
580 |
}
|
|
581 |
|
|
582 |
case R_VPBK_FIELD_TYPE_EMAILHOME:
|
|
583 |
case R_VPBK_FIELD_TYPE_EMAILWORK:
|
|
584 |
case R_VPBK_FIELD_TYPE_EMAILGEN:
|
|
585 |
{
|
|
586 |
uid = KUidContactFieldVCardMapEMAILINTERNET;
|
|
587 |
break;
|
|
588 |
}
|
|
589 |
|
|
590 |
case R_VPBK_FIELD_TYPE_FIRSTNAME:
|
|
591 |
{
|
|
592 |
uid = KUidContactFieldGivenName;
|
|
593 |
break;
|
|
594 |
}
|
|
595 |
|
|
596 |
case R_VPBK_FIELD_TYPE_FIRSTNAMEREADING:
|
|
597 |
{
|
|
598 |
uid = KUidContactFieldGivenNamePronunciation;
|
|
599 |
break;
|
|
600 |
}
|
|
601 |
|
|
602 |
case R_VPBK_FIELD_TYPE_LASTNAME:
|
|
603 |
{
|
|
604 |
uid = KUidContactFieldFamilyName;
|
|
605 |
break;
|
|
606 |
}
|
|
607 |
|
|
608 |
case R_VPBK_FIELD_TYPE_LASTNAMEREADING:
|
|
609 |
{
|
|
610 |
uid = KUidContactFieldFamilyNamePronunciation;
|
|
611 |
break;
|
|
612 |
}
|
|
613 |
|
|
614 |
case R_VPBK_FIELD_TYPE_COMPANYNAME:
|
|
615 |
{
|
|
616 |
uid = KUidContactFieldCompanyName;
|
|
617 |
break;
|
|
618 |
}
|
|
619 |
|
|
620 |
case R_VPBK_FIELD_TYPE_SECONDNAME:
|
|
621 |
{
|
|
622 |
uid = KUidContactFieldSecondName;
|
|
623 |
break;
|
|
624 |
}
|
|
625 |
}
|
|
626 |
|
|
627 |
return uid;
|
|
628 |
}
|
|
629 |
|
|
630 |
// -----------------------------------------------------------------------------
|
|
631 |
// CVasVPbkHandler::FieldIdL
|
|
632 |
// Returns field id as a phonebook id
|
|
633 |
// -----------------------------------------------------------------------------
|
|
634 |
//
|
|
635 |
EXPORT_C TInt CVasVPbkHandler::FieldIdL()
|
|
636 |
{
|
|
637 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::FieldIdL" );
|
|
638 |
|
|
639 |
__ASSERT_ALWAYS( iField, User::Leave( KErrArgument ) );
|
|
640 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
641 |
|
|
642 |
return ConvertFieldId( *iField );
|
|
643 |
}
|
|
644 |
|
|
645 |
// -----------------------------------------------------------------------------
|
|
646 |
// CVasVPbkHandler::IsFieldEmptyL
|
|
647 |
// Returns information if current field is empty
|
|
648 |
// -----------------------------------------------------------------------------
|
|
649 |
//
|
|
650 |
EXPORT_C TBool CVasVPbkHandler::IsFieldEmptyL()
|
|
651 |
{
|
|
652 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::IsFieldEmptyL" );
|
|
653 |
|
|
654 |
__ASSERT_ALWAYS( iField, User::Leave( KErrArgument ) );
|
|
655 |
__ASSERT_ALWAYS( !iOperation, User::Leave( KErrArgument ) );
|
|
656 |
|
|
657 |
return iField->FieldData().IsEmpty();
|
|
658 |
}
|
|
659 |
|
|
660 |
// -----------------------------------------------------------------------------
|
|
661 |
// CVasVPbkHandler::StoreReady
|
|
662 |
// -----------------------------------------------------------------------------
|
|
663 |
//
|
|
664 |
void CVasVPbkHandler::StoreReady( MVPbkContactStore& /*aContactStore*/ )
|
|
665 |
{
|
|
666 |
RUBY_DEBUG0( "CVasVPbkHandler::StoreReady START" );
|
|
667 |
|
|
668 |
iError = KErrNone;
|
|
669 |
|
|
670 |
RUBY_DEBUG0( "CVasVPbkHandler::StoreReady EXIT" );
|
|
671 |
}
|
|
672 |
|
|
673 |
// -----------------------------------------------------------------------------
|
|
674 |
// CVasVPbkHandler::StoreUnavailable
|
|
675 |
// -----------------------------------------------------------------------------
|
|
676 |
//
|
|
677 |
void CVasVPbkHandler::StoreUnavailable( MVPbkContactStore& /*aContactStore*/, TInt aReason )
|
|
678 |
{
|
|
679 |
RUBY_DEBUG0( "CVasVPbkHandler::StoreUnavailable START" );
|
|
680 |
|
|
681 |
iError = aReason;
|
|
682 |
|
|
683 |
RUBY_DEBUG0( "CVasVPbkHandler::StoreUnavailable EXIT" );
|
|
684 |
}
|
|
685 |
|
|
686 |
// -----------------------------------------------------------------------------
|
|
687 |
// CVasVPbkHandler::HandleStoreEventL
|
|
688 |
// -----------------------------------------------------------------------------
|
|
689 |
//
|
|
690 |
void CVasVPbkHandler::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/,
|
|
691 |
TVPbkContactStoreEvent aStoreEvent )
|
|
692 |
{
|
|
693 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::HandleStoreEventL" );
|
|
694 |
|
|
695 |
if ( iObserver )
|
|
696 |
{
|
|
697 |
TPhonebookEvent event;
|
|
698 |
event.iType = ConvertEvent( aStoreEvent );
|
|
699 |
|
|
700 |
if ( aStoreEvent.iContactLink )
|
|
701 |
{
|
|
702 |
event.iContactId = iConverter->LinkToIdentifier( *aStoreEvent.iContactLink );
|
|
703 |
}
|
|
704 |
|
|
705 |
iObserver->HandleEventL( event );
|
|
706 |
}
|
|
707 |
}
|
|
708 |
|
|
709 |
// -----------------------------------------------------------------------------
|
|
710 |
// CVasVPbkHandler::OpenComplete
|
|
711 |
// -----------------------------------------------------------------------------
|
|
712 |
//
|
|
713 |
void CVasVPbkHandler::OpenComplete()
|
|
714 |
{
|
|
715 |
RUBY_DEBUG0( "CVasVPbkHandler::OpenComplete START" );
|
|
716 |
|
|
717 |
if ( iWait.IsStarted() )
|
|
718 |
{
|
|
719 |
iWait.AsyncStop();
|
|
720 |
}
|
|
721 |
|
|
722 |
RUBY_DEBUG0( "CVasVPbkHandler::OpenComplete EXIT" );
|
|
723 |
}
|
|
724 |
|
|
725 |
// -----------------------------------------------------------------------------
|
|
726 |
// CVasVPbkHandler::VPbkSingleContactOperationComplete
|
|
727 |
// -----------------------------------------------------------------------------
|
|
728 |
//
|
|
729 |
void CVasVPbkHandler::VPbkSingleContactOperationComplete( MVPbkContactOperationBase& /*aOperation*/,
|
|
730 |
MVPbkStoreContact* aContact )
|
|
731 |
{
|
|
732 |
RUBY_DEBUG0( "CVasVPbkHandler::VPbkSingleContactOperationComplete START" );
|
|
733 |
|
|
734 |
iError = KErrNone;
|
|
735 |
|
|
736 |
delete iOperation;
|
|
737 |
iOperation = NULL;
|
|
738 |
|
|
739 |
iContact = aContact;
|
|
740 |
|
|
741 |
if ( iWait.IsStarted() )
|
|
742 |
{
|
|
743 |
iWait.AsyncStop();
|
|
744 |
}
|
|
745 |
|
|
746 |
RUBY_DEBUG0( "CVasVPbkHandler::VPbkSingleContactOperationComplete EXIT" );
|
|
747 |
}
|
|
748 |
|
|
749 |
// -----------------------------------------------------------------------------
|
|
750 |
// CVasVPbkHandler::VPbkSingleContactOperationFailed
|
|
751 |
// -----------------------------------------------------------------------------
|
|
752 |
//
|
|
753 |
void CVasVPbkHandler::VPbkSingleContactOperationFailed( MVPbkContactOperationBase& /*aOperation*/,
|
|
754 |
TInt aError )
|
|
755 |
{
|
|
756 |
RUBY_DEBUG0( "CVasVPbkHandler::VPbkSingleContactOperationFailed START" );
|
|
757 |
|
|
758 |
iError = aError;
|
|
759 |
|
|
760 |
delete iOperation;
|
|
761 |
iOperation = NULL;
|
|
762 |
|
|
763 |
if ( iWait.IsStarted() )
|
|
764 |
{
|
|
765 |
iWait.AsyncStop();
|
|
766 |
}
|
|
767 |
|
|
768 |
RUBY_DEBUG0( "CVasVPbkHandler::VPbkSingleContactOperationFailed EXIT" );
|
|
769 |
}
|
|
770 |
|
|
771 |
// -----------------------------------------------------------------------------
|
|
772 |
// CVasVPbkHandler::ContactOperationCompleted
|
|
773 |
// -----------------------------------------------------------------------------
|
|
774 |
//
|
|
775 |
void CVasVPbkHandler::ContactOperationCompleted( TContactOpResult /*aResult*/ )
|
|
776 |
{
|
|
777 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactOperationCompleted START" );
|
|
778 |
|
|
779 |
iError = KErrNone;
|
|
780 |
|
|
781 |
if ( iWait.IsStarted() )
|
|
782 |
{
|
|
783 |
iWait.AsyncStop();
|
|
784 |
}
|
|
785 |
|
|
786 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactOperationCompleted EXIT" );
|
|
787 |
}
|
|
788 |
|
|
789 |
// -----------------------------------------------------------------------------
|
|
790 |
// CVasVPbkHandler::ContactOperationFailed
|
|
791 |
// -----------------------------------------------------------------------------
|
|
792 |
//
|
|
793 |
void CVasVPbkHandler::ContactOperationFailed( TContactOp /*aOpCode*/, TInt aErrorCode,
|
|
794 |
TBool /*aErrorNotified*/ )
|
|
795 |
{
|
|
796 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactOperationFailed START" );
|
|
797 |
|
|
798 |
iError = aErrorCode;
|
|
799 |
|
|
800 |
if ( iWait.IsStarted() )
|
|
801 |
{
|
|
802 |
iWait.AsyncStop();
|
|
803 |
}
|
|
804 |
|
|
805 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactOperationFailed EXIT" );
|
|
806 |
}
|
|
807 |
|
|
808 |
// -----------------------------------------------------------------------------
|
|
809 |
// CVasVPbkHandler::AttributeOperationComplete
|
|
810 |
// -----------------------------------------------------------------------------
|
|
811 |
//
|
|
812 |
void CVasVPbkHandler::AttributeOperationComplete( MVPbkContactOperationBase& /*aOperation*/ )
|
|
813 |
{
|
|
814 |
RUBY_DEBUG0( "CVasVPbkHandler::AttributeOperationComplete START" );
|
|
815 |
|
|
816 |
iError = KErrNone;
|
|
817 |
|
|
818 |
delete iOperation;
|
|
819 |
iOperation = NULL;
|
|
820 |
|
|
821 |
if ( iWait.IsStarted() )
|
|
822 |
{
|
|
823 |
iWait.AsyncStop();
|
|
824 |
}
|
|
825 |
|
|
826 |
RUBY_DEBUG0( "CVasVPbkHandler::AttributeOperationComplete EXIT" );
|
|
827 |
}
|
|
828 |
|
|
829 |
// -----------------------------------------------------------------------------
|
|
830 |
// CVasVPbkHandler::AttributeOperationFailed
|
|
831 |
// -----------------------------------------------------------------------------
|
|
832 |
//
|
|
833 |
void CVasVPbkHandler::AttributeOperationFailed( MVPbkContactOperationBase& /*aOperation*/,
|
|
834 |
TInt aError )
|
|
835 |
{
|
|
836 |
RUBY_DEBUG0( "CVasVPbkHandler::AttributeOperationFailed START" );
|
|
837 |
|
|
838 |
iError = aError;
|
|
839 |
|
|
840 |
delete iOperation;
|
|
841 |
iOperation = NULL;
|
|
842 |
|
|
843 |
if ( iWait.IsStarted() )
|
|
844 |
{
|
|
845 |
iWait.AsyncStop();
|
|
846 |
}
|
|
847 |
|
|
848 |
RUBY_DEBUG0( "CVasVPbkHandler::AttributeOperationFailed EXIT" );
|
|
849 |
}
|
|
850 |
|
|
851 |
// -----------------------------------------------------------------------------
|
|
852 |
// CVasVPbkHandler::StepComplete
|
|
853 |
// -----------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
void CVasVPbkHandler::StepComplete( MVPbkContactOperationBase& /*aOperation*/, TInt /*aStepSize*/ )
|
|
856 |
{
|
|
857 |
RUBY_DEBUG0( "CVasVPbkHandler::StepComplete START" );
|
|
858 |
|
|
859 |
// Do nothing
|
|
860 |
|
|
861 |
RUBY_DEBUG0( "CVasVPbkHandler::StepComplete EXIT" );
|
|
862 |
}
|
|
863 |
|
|
864 |
// -----------------------------------------------------------------------------
|
|
865 |
// CVasVPbkHandler::StepFailed
|
|
866 |
// -----------------------------------------------------------------------------
|
|
867 |
//
|
|
868 |
TBool CVasVPbkHandler::StepFailed( MVPbkContactOperationBase& /*aOperation*/, TInt /*aStepSize*/,
|
|
869 |
TInt /*aError*/ )
|
|
870 |
{
|
|
871 |
RUBY_DEBUG0( "CVasVPbkHandler::StepFailed START" );
|
|
872 |
RUBY_DEBUG0( "CVasVPbkHandler::StepFailed EXIT" );
|
|
873 |
|
|
874 |
return EFalse;
|
|
875 |
}
|
|
876 |
|
|
877 |
// -----------------------------------------------------------------------------
|
|
878 |
// CVasVPbkHandler::OperationComplete
|
|
879 |
// -----------------------------------------------------------------------------
|
|
880 |
//
|
|
881 |
void CVasVPbkHandler::OperationComplete( MVPbkContactOperationBase& /*aOperation*/ )
|
|
882 |
{
|
|
883 |
RUBY_DEBUG0( "CVasVPbkHandler::OperationComplete START" );
|
|
884 |
|
|
885 |
iError = KErrNone;
|
|
886 |
|
|
887 |
delete iOperation;
|
|
888 |
iOperation = NULL;
|
|
889 |
|
|
890 |
if ( iWait.IsStarted() )
|
|
891 |
{
|
|
892 |
iWait.AsyncStop();
|
|
893 |
}
|
|
894 |
|
|
895 |
RUBY_DEBUG0( "CVasVPbkHandler::OperationComplete EXIT" );
|
|
896 |
}
|
|
897 |
|
|
898 |
// -----------------------------------------------------------------------------
|
|
899 |
// CVasVPbkHandler::ContactViewReady
|
|
900 |
// -----------------------------------------------------------------------------
|
|
901 |
//
|
|
902 |
void CVasVPbkHandler::ContactViewReady( MVPbkContactViewBase& /*aView*/ )
|
|
903 |
{
|
|
904 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewReady START" );
|
|
905 |
|
|
906 |
iError = KErrNone;
|
|
907 |
|
|
908 |
if ( iWait.IsStarted() )
|
|
909 |
{
|
|
910 |
iWait.AsyncStop();
|
|
911 |
}
|
|
912 |
|
|
913 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewReady EXIT" );
|
|
914 |
}
|
|
915 |
|
|
916 |
// -----------------------------------------------------------------------------
|
|
917 |
// CVasVPbkHandler::ContactViewUnavailable
|
|
918 |
// -----------------------------------------------------------------------------
|
|
919 |
//
|
|
920 |
void CVasVPbkHandler::ContactViewUnavailable( MVPbkContactViewBase& /*aView*/ )
|
|
921 |
{
|
|
922 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewUnavailable" );
|
|
923 |
// Do nothing
|
|
924 |
}
|
|
925 |
|
|
926 |
// -----------------------------------------------------------------------------
|
|
927 |
// CVasVPbkHandler::ContactAddedToView
|
|
928 |
// -----------------------------------------------------------------------------
|
|
929 |
//
|
|
930 |
void CVasVPbkHandler::ContactAddedToView( MVPbkContactViewBase& /*aView*/, TInt /*aIndex*/,
|
|
931 |
const MVPbkContactLink& /*aContactLink*/ )
|
|
932 |
{
|
|
933 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewUnavailable" );
|
|
934 |
// Do nothing
|
|
935 |
}
|
|
936 |
|
|
937 |
// -----------------------------------------------------------------------------
|
|
938 |
// CVasVPbkHandler::ContactRemovedFromView
|
|
939 |
// -----------------------------------------------------------------------------
|
|
940 |
//
|
|
941 |
void CVasVPbkHandler::ContactRemovedFromView( MVPbkContactViewBase& /*aView*/, TInt /*aIndex*/,
|
|
942 |
const MVPbkContactLink& /*aContactLink*/ )
|
|
943 |
{
|
|
944 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewUnavailable" );
|
|
945 |
// Do nothing
|
|
946 |
}
|
|
947 |
|
|
948 |
// -----------------------------------------------------------------------------
|
|
949 |
// CVasVPbkHandler::ContactViewError
|
|
950 |
// -----------------------------------------------------------------------------
|
|
951 |
//
|
|
952 |
void CVasVPbkHandler::ContactViewError( MVPbkContactViewBase& /*aView*/, TInt aError,
|
|
953 |
TBool /*aErrorNotified*/ )
|
|
954 |
{
|
|
955 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewReady START" );
|
|
956 |
|
|
957 |
iError = aError;
|
|
958 |
|
|
959 |
if ( iWait.IsStarted() )
|
|
960 |
{
|
|
961 |
iWait.AsyncStop();
|
|
962 |
}
|
|
963 |
|
|
964 |
RUBY_DEBUG0( "CVasVPbkHandler::ContactViewReady EXIT" );
|
|
965 |
}
|
|
966 |
|
|
967 |
// -----------------------------------------------------------------------------
|
|
968 |
// CVasVPbkHandler::CVasVPbkHandler
|
|
969 |
// C++ default constructor can NOT contain any code, that
|
|
970 |
// might leave.
|
|
971 |
// -----------------------------------------------------------------------------
|
|
972 |
//
|
|
973 |
CVasVPbkHandler::CVasVPbkHandler()
|
|
974 |
: iError( KErrNone )
|
|
975 |
{
|
|
976 |
}
|
|
977 |
|
|
978 |
// -----------------------------------------------------------------------------
|
|
979 |
// CVasVPbkHandler::ConstructL
|
|
980 |
// Symbian 2nd phase constructor can leave.
|
|
981 |
// -----------------------------------------------------------------------------
|
|
982 |
//
|
|
983 |
void CVasVPbkHandler::ConstructL()
|
|
984 |
{
|
|
985 |
RUBY_DEBUG_BLOCK( "CVasVPbkHandler::ConstructL" );
|
|
986 |
|
|
987 |
}
|
|
988 |
|
|
989 |
// -----------------------------------------------------------------------------
|
|
990 |
// CVasVPbkHandler::SelectDefaultType
|
|
991 |
// Returns default field type for given tag
|
|
992 |
// -----------------------------------------------------------------------------
|
|
993 |
//
|
|
994 |
TVPbkDefaultType CVasVPbkHandler::SelectDefaultType( TInt aCommandType )
|
|
995 |
{
|
|
996 |
RUBY_DEBUG0( "CVasVPbkHandler::SelectDefaultType START" );
|
|
997 |
|
|
998 |
TVPbkDefaultType type = EVPbkDefaultTypeUndefined;
|
|
999 |
|
|
1000 |
switch( aCommandType )
|
|
1001 |
{
|
|
1002 |
case EDefaultCommand:
|
|
1003 |
case EMobileCommand:
|
|
1004 |
case EGeneralCommand:
|
|
1005 |
case EWorkCommand:
|
|
1006 |
case EHomeCommand:
|
|
1007 |
{
|
|
1008 |
type = EVPbkDefaultTypePhoneNumber;
|
|
1009 |
break;
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
case EEmailCommand:
|
|
1013 |
{
|
|
1014 |
type = EVPbkDefaultTypeEmail;
|
|
1015 |
break;
|
|
1016 |
}
|
|
1017 |
|
|
1018 |
case EVideoCommand:
|
|
1019 |
{
|
|
1020 |
type = EVPbkDefaultTypeVideoNumber;
|
|
1021 |
break;
|
|
1022 |
}
|
|
1023 |
|
|
1024 |
case EVoipCommand:
|
|
1025 |
{
|
|
1026 |
type = EVPbkDefaultTypeVoIP;
|
|
1027 |
break;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
case EMessageCommand:
|
|
1031 |
{
|
|
1032 |
if ( iMMSSupported )
|
|
1033 |
{
|
|
1034 |
type = EVPbkDefaultTypeMms;
|
|
1035 |
}
|
|
1036 |
else
|
|
1037 |
{
|
|
1038 |
type = EVPbkDefaultTypeSms;
|
|
1039 |
}
|
|
1040 |
break;
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
}
|
|
1044 |
|
|
1045 |
RUBY_DEBUG0( "CVasVPbkHandler::SelectDefaultType EXIT" );
|
|
1046 |
|
|
1047 |
return type;
|
|
1048 |
}
|
|
1049 |
|
|
1050 |
// -----------------------------------------------------------------------------
|
|
1051 |
// CVasVPbkHandler::AcceptDefaultField
|
|
1052 |
// Accepts or rejects given field based on the given tag
|
|
1053 |
// -----------------------------------------------------------------------------
|
|
1054 |
//
|
|
1055 |
TBool CVasVPbkHandler::AcceptDefaultField( MVPbkStoreContactField& aField, TInt aCommandType )
|
|
1056 |
{
|
|
1057 |
RUBY_DEBUG0( "CVasVPbkHandler::AcceptDefaultField START" );
|
|
1058 |
|
|
1059 |
TBool accept = ETrue;
|
|
1060 |
|
|
1061 |
if ( aCommandType == EMobileCommand &&
|
|
1062 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_MOBILEPHONEHOME &&
|
|
1063 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_MOBILEPHONEWORK &&
|
|
1064 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_MOBILEPHONEGEN )
|
|
1065 |
{
|
|
1066 |
accept = EFalse;
|
|
1067 |
}
|
|
1068 |
else if ( aCommandType == EGeneralCommand &&
|
|
1069 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_LANDPHONEHOME &&
|
|
1070 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_LANDPHONEWORK &&
|
|
1071 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_LANDPHONEGEN )
|
|
1072 |
{
|
|
1073 |
accept = EFalse;
|
|
1074 |
}
|
|
1075 |
else if ( aCommandType == EWorkCommand &&
|
|
1076 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_LANDPHONEWORK )
|
|
1077 |
{
|
|
1078 |
accept = EFalse;
|
|
1079 |
}
|
|
1080 |
else if ( aCommandType == EHomeCommand &&
|
|
1081 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_LANDPHONEHOME )
|
|
1082 |
{
|
|
1083 |
accept = EFalse;
|
|
1084 |
}
|
|
1085 |
else if ( aCommandType == EVoipCommand &&
|
|
1086 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_MOBILEPHONEGEN &&
|
|
1087 |
aField.BestMatchingFieldType()->FieldTypeResId() != R_VPBK_FIELD_TYPE_LANDPHONEGEN )
|
|
1088 |
{
|
|
1089 |
accept = EFalse;
|
|
1090 |
}
|
|
1091 |
|
|
1092 |
RUBY_DEBUG0( "CVasVPbkHandler::AcceptDefaultField EXIT" );
|
|
1093 |
|
|
1094 |
return accept;
|
|
1095 |
}
|
|
1096 |
|
|
1097 |
// -----------------------------------------------------------------------------
|
|
1098 |
// CVasVPbkHandler::ConvertFieldId
|
|
1099 |
// Converts field id to old phonebook id
|
|
1100 |
// -----------------------------------------------------------------------------
|
|
1101 |
//
|
|
1102 |
TInt CVasVPbkHandler::ConvertFieldId( MVPbkStoreContactField& aField )
|
|
1103 |
{
|
|
1104 |
RUBY_DEBUG0( "CVasVPbkHandler::ConvertFieldId START" );
|
|
1105 |
|
|
1106 |
TInt id = KErrNone;
|
|
1107 |
|
|
1108 |
if ( aField.BestMatchingFieldType() )
|
|
1109 |
{
|
|
1110 |
switch( aField.BestMatchingFieldType()->FieldTypeResId() )
|
|
1111 |
{
|
|
1112 |
case R_VPBK_FIELD_TYPE_LANDPHONEGEN:
|
|
1113 |
{
|
|
1114 |
id = EPbkFieldIdPhoneNumberGeneral;
|
|
1115 |
break;
|
|
1116 |
}
|
|
1117 |
|
|
1118 |
case R_VPBK_FIELD_TYPE_LANDPHONEHOME:
|
|
1119 |
{
|
|
1120 |
id = EPbkFieldIdPhoneNumberHome;
|
|
1121 |
break;
|
|
1122 |
}
|
|
1123 |
|
|
1124 |
case R_VPBK_FIELD_TYPE_LANDPHONEWORK:
|
|
1125 |
{
|
|
1126 |
id = EPbkFieldIdPhoneNumberWork;
|
|
1127 |
break;
|
|
1128 |
}
|
|
1129 |
|
|
1130 |
case R_VPBK_FIELD_TYPE_MOBILEPHONEHOME:
|
|
1131 |
case R_VPBK_FIELD_TYPE_MOBILEPHONEWORK:
|
|
1132 |
case R_VPBK_FIELD_TYPE_MOBILEPHONEGEN:
|
|
1133 |
{
|
|
1134 |
id = EPbkFieldIdPhoneNumberMobile;
|
|
1135 |
break;
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
case R_VPBK_FIELD_TYPE_VIDEONUMBERHOME:
|
|
1139 |
case R_VPBK_FIELD_TYPE_VIDEONUMBERWORK:
|
|
1140 |
case R_VPBK_FIELD_TYPE_VIDEONUMBERGEN:
|
|
1141 |
{
|
|
1142 |
id = EPbkFieldIdPhoneNumberVideo;
|
|
1143 |
break;
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
case R_VPBK_FIELD_TYPE_FAXNUMBERHOME:
|
|
1147 |
case R_VPBK_FIELD_TYPE_FAXNUMBERWORK:
|
|
1148 |
case R_VPBK_FIELD_TYPE_FAXNUMBERGEN:
|
|
1149 |
{
|
|
1150 |
id = EPbkFieldIdFaxNumber;
|
|
1151 |
break;
|
|
1152 |
}
|
|
1153 |
|
|
1154 |
case R_VPBK_FIELD_TYPE_VOIPHOME:
|
|
1155 |
case R_VPBK_FIELD_TYPE_VOIPWORK:
|
|
1156 |
case R_VPBK_FIELD_TYPE_VOIPGEN:
|
|
1157 |
{
|
|
1158 |
id = EPbkFieldIdVOIP;
|
|
1159 |
break;
|
|
1160 |
}
|
|
1161 |
|
|
1162 |
case R_VPBK_FIELD_TYPE_IMPP:
|
|
1163 |
{
|
|
1164 |
id = EPbkFieldIdXsp;
|
|
1165 |
break;
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
case R_VPBK_FIELD_TYPE_EMAILHOME:
|
|
1169 |
case R_VPBK_FIELD_TYPE_EMAILWORK:
|
|
1170 |
case R_VPBK_FIELD_TYPE_EMAILGEN:
|
|
1171 |
{
|
|
1172 |
id = EPbkFieldIdEmailAddress;
|
|
1173 |
break;
|
|
1174 |
}
|
|
1175 |
|
|
1176 |
case R_VPBK_FIELD_TYPE_FIRSTNAMEREADING:
|
|
1177 |
{
|
|
1178 |
id = EPbkFieldIdFirstNameReading;
|
|
1179 |
break;
|
|
1180 |
}
|
|
1181 |
|
|
1182 |
case R_VPBK_FIELD_TYPE_FIRSTNAME:
|
|
1183 |
{
|
|
1184 |
id = EPbkFieldIdFirstName;
|
|
1185 |
break;
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
case R_VPBK_FIELD_TYPE_LASTNAMEREADING:
|
|
1189 |
{
|
|
1190 |
id = EPbkFieldIdLastNameReading;
|
|
1191 |
break;
|
|
1192 |
}
|
|
1193 |
|
|
1194 |
case R_VPBK_FIELD_TYPE_LASTNAME:
|
|
1195 |
{
|
|
1196 |
id = EPbkFieldIdLastName;
|
|
1197 |
break;
|
|
1198 |
}
|
|
1199 |
|
|
1200 |
case R_VPBK_FIELD_TYPE_COMPANYNAME:
|
|
1201 |
{
|
|
1202 |
id = EPbkFieldIdCompanyName;
|
|
1203 |
break;
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
case R_VPBK_FIELD_TYPE_SECONDNAME:
|
|
1207 |
{
|
|
1208 |
id = EPbkFieldIdSecondName;
|
|
1209 |
break;
|
|
1210 |
}
|
|
1211 |
}
|
|
1212 |
}
|
|
1213 |
else
|
|
1214 |
{
|
|
1215 |
RUBY_DEBUG0( "aField.BestMatchingFieldType() returned NULL" );
|
|
1216 |
}
|
|
1217 |
|
|
1218 |
RUBY_DEBUG0( "CVasVPbkHandler::ConvertFieldId EXIT" );
|
|
1219 |
|
|
1220 |
return id;
|
|
1221 |
}
|
|
1222 |
|
|
1223 |
// -----------------------------------------------------------------------------
|
|
1224 |
// CVasVPbkHandler::ConvertEvent
|
|
1225 |
// Converts contact event type
|
|
1226 |
// -----------------------------------------------------------------------------
|
|
1227 |
//
|
|
1228 |
TVasContactEvent CVasVPbkHandler::ConvertEvent( const TVPbkContactStoreEvent& aEvent )
|
|
1229 |
{
|
|
1230 |
RUBY_DEBUG0( "CVasVPbkHandler::ConvertEvent START" );
|
|
1231 |
|
|
1232 |
TVasContactEvent event;
|
|
1233 |
|
|
1234 |
switch( aEvent.iEventType )
|
|
1235 |
{
|
|
1236 |
case ENullEvent:
|
|
1237 |
{
|
|
1238 |
event = ENullEvent;
|
|
1239 |
break;
|
|
1240 |
}
|
|
1241 |
|
|
1242 |
case EContactChanged:
|
|
1243 |
{
|
|
1244 |
event = EContactChanged;
|
|
1245 |
break;
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
case EContactDeleted:
|
|
1249 |
{
|
|
1250 |
event = EContactDeleted;
|
|
1251 |
break;
|
|
1252 |
}
|
|
1253 |
|
|
1254 |
case EContactAdded:
|
|
1255 |
{
|
|
1256 |
event = EContactAdded;
|
|
1257 |
break;
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
case EUnknownChanges:
|
|
1261 |
{
|
|
1262 |
event = EUnknownChanges;
|
|
1263 |
break;
|
|
1264 |
}
|
|
1265 |
|
|
1266 |
case EGroupAdded:
|
|
1267 |
{
|
|
1268 |
event = EGroupAdded;
|
|
1269 |
break;
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
case EGroupChanged:
|
|
1273 |
{
|
|
1274 |
event = EGroupChanged;
|
|
1275 |
break;
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
case EGroupDeleted:
|
|
1279 |
{
|
|
1280 |
event = EGroupDeleted;
|
|
1281 |
break;
|
|
1282 |
}
|
|
1283 |
|
|
1284 |
case EStoreBackupBeginning:
|
|
1285 |
{
|
|
1286 |
event = EStoreBackupBeginning;
|
|
1287 |
break;
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
case EStoreRestoreBeginning:
|
|
1291 |
{
|
|
1292 |
event = EStoreRestoreBeginning;
|
|
1293 |
break;
|
|
1294 |
}
|
|
1295 |
|
|
1296 |
case EStoreBackupRestoreCompleted:
|
|
1297 |
{
|
|
1298 |
event = EStoreBackupRestoreCompleted;
|
|
1299 |
break;
|
|
1300 |
}
|
|
1301 |
|
|
1302 |
default:
|
|
1303 |
{
|
|
1304 |
event = ENotSupported;
|
|
1305 |
break;
|
|
1306 |
}
|
|
1307 |
}
|
|
1308 |
RUBY_DEBUG0( "CVasVPbkHandler::ConvertEvent EXIT" );
|
|
1309 |
|
|
1310 |
return event;
|
|
1311 |
}
|
|
1312 |
|
|
1313 |
// -----------------------------------------------------------------------------
|
|
1314 |
// CVasVPbkHandler::FieldPriority
|
|
1315 |
// Gets the priority of the given field
|
|
1316 |
// -----------------------------------------------------------------------------
|
|
1317 |
//
|
|
1318 |
TInt CVasVPbkHandler::FieldPriority( MVPbkStoreContactField& aField )
|
|
1319 |
{
|
|
1320 |
RUBY_DEBUG0( "CVasVPbkHandler::FieldPriority START" );
|
|
1321 |
|
|
1322 |
TInt priority = KFieldPriorityCount;
|
|
1323 |
|
|
1324 |
for ( int i = 0; i < KFieldPriorityCount; ++i )
|
|
1325 |
{
|
|
1326 |
if ( aField.BestMatchingFieldType()->FieldTypeResId() == KFieldPriority[ i ] )
|
|
1327 |
{
|
|
1328 |
priority = i;
|
|
1329 |
break;
|
|
1330 |
}
|
|
1331 |
}
|
|
1332 |
RUBY_DEBUG0( "CVasVPbkHandler::FieldPriority EXIT" );
|
|
1333 |
|
|
1334 |
return priority;
|
|
1335 |
}
|
|
1336 |
|
|
1337 |
// End of File
|
|
1338 |
|