29 const TInt KCachedPrepareTimeOut = 1000000; //1 second |
29 const TInt KCachedPrepareTimeOut = 1000000; //1 second |
30 |
30 |
31 /** |
31 /** |
32 Object factory method. |
32 Object factory method. |
33 */ |
33 */ |
34 CCntPplViewSession* CCntPplViewSession::NewL(CPplContactsFile& aContactsFile, const CContactTemplate& aSystemTemplate, CCntSqlStatement& aSelectAllFields, TInt aViewId, const CContactTextDef& aTextDef, const TContactViewPreferences aViewPrefs) |
34 CCntPplViewSession* CCntPplViewSession::NewL(CPplContactsFile& aContactsFile, const CLplContactProperties& aContactProperties, CCntSqlStatement& aSelectAllFields, TInt aViewId, const CContactTextDef& aTextDef, const TContactViewPreferences aViewPrefs) |
35 { |
35 { |
36 CCntPplViewSession* viewSession = new (ELeave) CCntPplViewSession(aContactsFile, aSystemTemplate, aSelectAllFields, aViewId, aViewPrefs); |
36 CCntPplViewSession* viewSession = new (ELeave) CCntPplViewSession(aContactsFile, aContactProperties, aSelectAllFields, aViewId, aViewPrefs); |
37 CleanupStack::PushL(viewSession); |
37 CleanupStack::PushL(viewSession); |
38 viewSession->ConstructL(aTextDef); |
38 viewSession->ConstructL(aTextDef); |
39 CleanupStack::Pop(viewSession); |
39 CleanupStack::Pop(viewSession); |
40 return viewSession; |
40 return viewSession; |
41 } |
41 } |
42 |
42 |
43 |
43 |
44 /** |
44 /** |
45 CCntPplViewSession first phase constructor. |
45 CCntPplViewSession first phase constructor. |
46 */ |
46 */ |
47 CCntPplViewSession::CCntPplViewSession(CPplContactsFile& aContactsFile, const CContactTemplate& aSystemTemplate, CCntSqlStatement& aSelectAllFields, TInt aViewId, TContactViewPreferences aViewPrefs) |
47 CCntPplViewSession::CCntPplViewSession(CPplContactsFile& aContactsFile, const CLplContactProperties& aContactProperties, CCntSqlStatement& aSelectAllFields, TInt aViewId, TContactViewPreferences aViewPrefs) |
48 : CTimer(CActive::EPriorityIdle), |
48 : CTimer(CActive::EPriorityIdle), |
49 iViewId(aViewId), |
49 iViewId(aViewId), |
50 iSystemTemplate(aSystemTemplate), |
50 iContactProperties(aContactProperties), |
51 iContactsFile(aContactsFile), |
51 iContactsFile(aContactsFile), |
52 iSqlSmtSelectAllFieldsById(aSelectAllFields), |
52 iSqlSmtSelectAllFieldsById(aSelectAllFields), |
53 iViewPrefs(aViewPrefs) |
53 iViewPrefs(aViewPrefs) |
54 { |
54 { |
55 CActiveScheduler::Add(this); |
55 CActiveScheduler::Add(this); |
347 |
347 |
348 User::LeaveIfError(err); |
348 User::LeaveIfError(err); |
349 |
349 |
350 /* set first field with possible content for group or unsorted contact */ |
350 /* set first field with possible content for group or unsorted contact */ |
351 CContactDatabase::TTextFieldMinimal buf; |
351 CContactDatabase::TTextFieldMinimal buf; |
352 TextFieldL(contactSqlStmt, iSqlSmtSelectAllFieldsById, iSystemTemplate, typeUid, buf); |
352 TextFieldL(contactSqlStmt, iSqlSmtSelectAllFieldsById, iContactProperties.SystemTemplateL(), typeUid, buf); |
353 viewContact->SetFirstFieldForBlankContactL(buf); |
353 viewContact->SetFirstFieldForBlankContactL(buf); |
354 CleanupStack::PopAndDestroy(&contactSqlStmt); |
354 CleanupStack::PopAndDestroy(&contactSqlStmt); |
355 } //if(typeUid != 0) |
355 } //if(typeUid != 0) |
356 |
356 |
357 CleanupStack::Pop(viewContact); |
357 CleanupStack::Pop(viewContact); |
400 textHeaderStoreStream.OpenLC(*textHeaderStore,textHeaderStore->Root()); |
400 textHeaderStoreStream.OpenLC(*textHeaderStore,textHeaderStore->Root()); |
401 |
401 |
402 TPtrC textFieldPtrC = aSqlStmt.ColumnTextL(iCntSqlStatement->ParameterIndex(KContactTextFields())); |
402 TPtrC textFieldPtrC = aSqlStmt.ColumnTextL(iCntSqlStatement->ParameterIndex(KContactTextFields())); |
403 HBufC* textFieldsBuf = textFieldPtrC.AllocLC(); |
403 HBufC* textFieldsBuf = textFieldPtrC.AllocLC(); |
404 |
404 |
405 TCntPersistenceUtility::ReadTextBlobL(textHeaderStoreStream, textFieldsBuf, *iTextDef, iSystemTemplate, fields, searchFastAccessFields); |
405 TCntPersistenceUtility::ReadTextBlobL(textHeaderStoreStream, textFieldsBuf, *iTextDef, iContactProperties.SystemTemplateL(), fields, searchFastAccessFields); |
406 CleanupStack::PopAndDestroy(4, &textHeaderStream); //textHeaderStore, textHeaderStream, textHeaderStoreStream, textFieldsBuf |
406 CleanupStack::PopAndDestroy(4, &textHeaderStream); //textHeaderStore, textHeaderStream, textHeaderStoreStream, textFieldsBuf |
407 |
407 |
408 // Loop through fields, checking for fields from fast access fields, and add |
408 // Loop through fields, checking for fields from fast access fields, and add |
409 // the fields to the view contact object. |
409 // the fields to the view contact object. |
410 const TInt KFieldsNumMax = fields.Count(); |
410 const TInt KFieldsNumMax = fields.Count(); |