author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:15:33 +0300 | |
branch | RCL_3 |
changeset 85 | 38bb213f60ba |
parent 68 | 9da50d567e3c |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 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: Supports initial search feature. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDES |
|
19 |
#include "CPcsAlgorithm2Utils.h" |
|
20 |
#include "CPsData.h" |
|
21 |
#include "CPcsDefs.h" |
|
22 |
#include "CPcsCache.h" |
|
23 |
#include <collate.h> |
|
24 |
// CONSTANTS |
|
25 |
_LIT(KSpace, ' '); |
|
26 |
// Search contacts in a group URI template |
|
27 |
_LIT(KGroupIdUri, "cntdb://c:contacts.gdb?id="); |
|
28 |
||
29 |
// ============================== MEMBER FUNCTIONS ============================ |
|
30 |
||
31 |
// ---------------------------------------------------------------------------- |
|
32 |
// CPcsAlgorithm2Utils::FormCompleteSearchResultsL() |
|
33 |
// Merges all the respective data store result sets to single set in sorted order. |
|
34 |
// ---------------------------------------------------------------------------- |
|
35 |
void CPcsAlgorithm2Utils::FormCompleteSearchResultsL(RPointerArray<CPSDATA_R_PTR_ARRAY>& aSearchResultsArr, |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
36 |
RPointerArray<CPsData>& SearchResults) |
63 | 37 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
38 |
CleanupClosePushL( SearchResults ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
39 |
|
63 | 40 |
TInt maxIndex = 0; |
41 |
TInt maxValue = aSearchResultsArr[maxIndex]->Count(); |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
42 |
TLinearOrder<CPsData> rule(CPcsAlgorithm2Utils::CompareDataBySortOrder); |
63 | 43 |
|
44 |
// Find the largest array in aSearchResultsArr |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
45 |
for (TInt i = 1; i < aSearchResultsArr.Count(); i++) |
63 | 46 |
{ |
47 |
if (aSearchResultsArr[i]->Count() > maxValue) |
|
48 |
{ |
|
49 |
maxIndex = i; |
|
50 |
maxValue = aSearchResultsArr[i]->Count(); |
|
51 |
} |
|
52 |
} |
|
53 |
||
54 |
// Assign the largets array to searchresults |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
55 |
for (TInt i = 0; i < aSearchResultsArr[maxIndex]->Count(); i++) |
63 | 56 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
57 |
SearchResults.Append((*(aSearchResultsArr[maxIndex]))[i]); |
63 | 58 |
} |
59 |
||
60 |
// Merge the remaining result arrays to the largest array in sequential order |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
61 |
for (TInt i = 0; i < aSearchResultsArr.Count(); i++) |
63 | 62 |
{ |
63 |
// Check if we are not copying again the largest array |
|
64 |
if ((i != maxIndex) && ((aSearchResultsArr[i])->Count() != 0)) |
|
65 |
{ |
|
66 |
TInt numElements = (aSearchResultsArr[i])->Count(); |
|
67 |
for (TInt j = 0; j < numElements; j++) |
|
68 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
69 |
SearchResults.InsertInOrderAllowRepeatsL((*(aSearchResultsArr[i]))[j], rule); |
63 | 70 |
} |
71 |
} |
|
72 |
} |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
73 |
CleanupStack::Pop(); |
63 | 74 |
} |
75 |
||
76 |
// ---------------------------------------------------------------------------- |
|
77 |
// CPcsAlgorithm2Utils::MyCompareC() |
|
78 |
// Lang specific MyCompareC |
|
79 |
// ---------------------------------------------------------------------------- |
|
80 |
TInt CPcsAlgorithm2Utils::MyCompareC(const TDesC& aLeft, const TDesC& aRight) |
|
81 |
{ |
|
82 |
// Get the current language |
|
83 |
TLanguage lang = User::Language(); |
|
84 |
||
85 |
// Get the standard method |
|
86 |
TCollationMethod meth = *Mem::CollationMethodByIndex(0); |
|
87 |
meth.iFlags |= TCollationMethod::EIgnoreNone; |
|
88 |
meth.iFlags |= TCollationMethod::EFoldCase; |
|
89 |
||
90 |
if (lang == ELangHindi || lang == ELangMarathi) |
|
91 |
{ |
|
92 |
meth.iFlags |= TCollationMethod::EIgnoreCombining; |
|
93 |
} |
|
94 |
||
95 |
// Collation level 3 is used |
|
96 |
TInt comparison(aLeft.CompareC(aRight, 3, &meth)); |
|
97 |
return comparison; |
|
98 |
} |
|
99 |
||
100 |
// ---------------------------------------------------------------------------- |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
101 |
// CPcsAlgorithm2Utils::CompareDataBySortOrder() |
63 | 102 |
// TLinearOrder rule for comparison of data objects |
103 |
// ---------------------------------------------------------------------------- |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
104 |
TInt CPcsAlgorithm2Utils::CompareDataBySortOrder(const CPsData& aObject1, |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
105 |
const CPsData& aObject2) |
63 | 106 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
107 |
_LIT(KSpace, " "); |
63 | 108 |
|
109 |
// Fetch the cache list stored in TLS to recover the sort order |
|
110 |
typedef RPointerArray<CPcsCache> PTR; |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
111 |
PTR* pcsCache = static_cast<PTR*> (Dll::Tls()); |
63 | 112 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
113 |
// Data1 |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
114 |
TBuf<255> data1(KNullDesC); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
115 |
TInt uriId1 = aObject1.UriId(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
116 |
CPcsCache* cache = (*pcsCache)[uriId1]; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
117 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
118 |
RArray<TInt> indexOrder; |
63 | 119 |
|
120 |
// Get the index order based on sort order from the cache |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
121 |
cache->GetIndexOrder(indexOrder); |
63 | 122 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
123 |
// Append sort order elements first |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
124 |
for (int i = 0; i < indexOrder.Count(); i++) |
63 | 125 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
126 |
TInt index = indexOrder[i]; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
127 |
if (index < aObject1.DataElementCount() && aObject1.Data(index)) |
63 | 128 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
129 |
// Trim the unnecessary white spaces/special chars before we compare |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
130 |
TBuf<255> str(KNullDesC); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
131 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
132 |
str = aObject1.Data(index)->Des(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
133 |
CPcsAlgorithm2Utils::MyTrim(str); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
134 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
135 |
data1 += str; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
136 |
data1 += KSpace; |
63 | 137 |
} |
138 |
} |
|
139 |
||
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
140 |
/* --- NOT SURE IF THIS BEHAVIOR IS REQUIRED --- |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
141 |
// Append remaining elements in order |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
142 |
for ( int i = 0; i < aObject1.DataElementCount(); i++ ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
143 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
144 |
if ( indexOrder.Find(i) == KErrNone && aObject1.Data(i) ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
145 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
146 |
data1 += aObject1.Data(i)->Des(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
147 |
data1 += KSpace; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
148 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
149 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
150 |
*/ |
63 | 151 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
152 |
// Data2 |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
153 |
TBuf<255> data2(KNullDesC); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
154 |
TInt uriId2 = aObject2.UriId(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
155 |
cache = (*pcsCache)[uriId2]; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
156 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
157 |
indexOrder.Reset(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
158 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
159 |
// Get the index order based on sort order from the cache |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
160 |
cache->GetIndexOrder(indexOrder); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
161 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
162 |
// Append sort order elements first |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
163 |
for (int i = 0; i < indexOrder.Count(); i++) |
68
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
164 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
165 |
TInt index = indexOrder[i]; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
166 |
if (index < aObject2.DataElementCount() && aObject2.Data(index)) |
68
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
167 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
168 |
// Trim the unnecessary white spaces/special chars before we compare |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
169 |
TBuf<255> str(KNullDesC); |
68
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
63
diff
changeset
|
170 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
171 |
str = aObject2.Data(index)->Des(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
172 |
CPcsAlgorithm2Utils::MyTrim(str); |
63 | 173 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
174 |
data2 += str; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
175 |
data2 += KSpace; |
63 | 176 |
} |
177 |
} |
|
178 |
||
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
179 |
/* --- NOT SURE IF THIS BEHAVIOR IS REQUIRED --- |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
180 |
// Append remaining elements in order |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
181 |
for ( int i = 0; i < aObject2.DataElementCount(); i++ ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
182 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
183 |
if ( indexOrder.Find(i) == KErrNone && aObject2.Data(i) ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
184 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
185 |
data2 += aObject2.Data(i)->Des(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
186 |
data2 += KSpace; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
187 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
188 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
189 |
*/ |
63 | 190 |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
191 |
indexOrder.Reset(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
192 |
data1.TrimAll(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
193 |
data2.TrimAll(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
194 |
return (CPcsAlgorithm2Utils::MyCompareC(data1, data2)); |
63 | 195 |
} |
196 |
||
197 |
// ---------------------------------------------------------------------------- |
|
198 |
// CPcsAlgorithm2Utils::MyTrim() |
|
199 |
// Trim off all white spaces and special characters |
|
200 |
// This behavior is required to mimic the current phonebook sort sequence |
|
201 |
// ---------------------------------------------------------------------------- |
|
202 |
void CPcsAlgorithm2Utils::MyTrim(TDes& aString) |
|
203 |
{ |
|
204 |
for (TInt i = aString.Length(); --i >= 0;) |
|
205 |
{ |
|
206 |
TChar c = (TChar) aString[i]; |
|
207 |
||
208 |
if (!c.IsAlphaDigit()) |
|
209 |
{ |
|
210 |
aString.Replace(i, 1, KSpace); |
|
211 |
} |
|
212 |
} |
|
213 |
||
214 |
aString.TrimAll(); |
|
215 |
} |
|
216 |
||
217 |
// ---------------------------------------------------------------------------- |
|
218 |
// CPcsAlgorithm2Utils::IsGroupUri() |
|
219 |
// Check if the input URI is of contact search in a group template form |
|
220 |
// ---------------------------------------------------------------------------- |
|
221 |
TBool CPcsAlgorithm2Utils::IsGroupUri(TDesC& aURI) |
|
222 |
{ |
|
223 |
TBuf<255> uri(aURI); |
|
224 |
uri.LowerCase(); |
|
225 |
||
226 |
TInt index = uri.FindF(KGroupIdUri); |
|
227 |
||
228 |
if (index == KErrNotFound) |
|
229 |
{ |
|
230 |
return EFalse; |
|
231 |
} |
|
232 |
||
233 |
return ETrue; |
|
234 |
} |
|
235 |
||
236 |
// End of File |
|
237 |