williamr@2
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __CNTVIEWFINDCONFIG_H__
|
williamr@2
|
17 |
#define __CNTVIEWFINDCONFIG_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32base.h>
|
williamr@2
|
20 |
#include "ecom/ecom.h" // For REComSession
|
williamr@2
|
21 |
|
williamr@2
|
22 |
class CContactViewFindConfigInterface : public CBase
|
williamr@2
|
23 |
/** An interface class that enables implementers to configure the way in which
|
williamr@2
|
24 |
words are matched in CContactViewBase::ContactsMatchingCriteriaL() and CContactViewBase::ContactsMatchingPrefixL().
|
williamr@2
|
25 |
|
williamr@2
|
26 |
By default these two functions use TDesC16::MatchC() to do the matching, but
|
williamr@2
|
27 |
where this is not appropriate, for instance in Chinese locales, a plug-in
|
williamr@2
|
28 |
that implements this interface should be supplied. The plug-in's UID should
|
williamr@2
|
29 |
be passed to CContactViewBase::SetViewFindConfigPlugin(), then the plug-in
|
williamr@2
|
30 |
will be loaded when ContactsMatchingCriteriaL() or ContactsMatchingPrefixL()
|
williamr@2
|
31 |
is called. Note that the plug-in is only loaded once per view, not each time
|
williamr@2
|
32 |
a find is requested. Note also that the plug-in is optional. If no plug-in
|
williamr@2
|
33 |
is supplied, TDesC16::MatchC() is used instead.
|
williamr@2
|
34 |
@publishedPartner
|
williamr@2
|
35 |
@released
|
williamr@2
|
36 |
*/
|
williamr@2
|
37 |
{
|
williamr@2
|
38 |
public:
|
williamr@2
|
39 |
static CContactViewFindConfigInterface* NewL(TUid aImplementationUid);
|
williamr@2
|
40 |
inline virtual ~CContactViewFindConfigInterface();
|
williamr@2
|
41 |
//pure virtual methods to be implemented by the plugin.
|
williamr@2
|
42 |
/** May be used by the implementor of the interface to provide construction-like
|
williamr@2
|
43 |
behaviour.
|
williamr@2
|
44 |
|
williamr@2
|
45 |
For example, it might be used to open a connection to a predictive text input
|
williamr@2
|
46 |
database, or might be used for reference counting of shared objects (using
|
williamr@2
|
47 |
TLS to store the data). */
|
williamr@2
|
48 |
virtual void OpenL() = 0;
|
williamr@2
|
49 |
/** May be used by the implementor of the interface to provide destruction-like
|
williamr@2
|
50 |
behaviour.
|
williamr@2
|
51 |
|
williamr@2
|
52 |
For example, it might be used to close a connection to a predictive text input
|
williamr@2
|
53 |
database, or might be used for reference counting of shared objects (using
|
williamr@2
|
54 |
TLS to store the data). */
|
williamr@2
|
55 |
virtual void Close() = 0;
|
williamr@2
|
56 |
/** Searches for a string with wildcards in a single field in a contact item.
|
williamr@2
|
57 |
|
williamr@2
|
58 |
@param aContactsField The contents of the contact item field to search.
|
williamr@2
|
59 |
@param aWord The string to search for in aContactsField. Note that it contains
|
williamr@2
|
60 |
a '*' wildcard character at the end and optionally one at the beginning, depending
|
williamr@2
|
61 |
on whether ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() was called.
|
williamr@2
|
62 |
@return ETrue if aWord is found in aContactsField. EFalse if not. */
|
williamr@2
|
63 |
virtual TBool Match(const TDesC& aContactsField, const TDesC& aWord) = 0;
|
williamr@2
|
64 |
/** Tests whether a specified word is valid to be matched by the plug-in's implementation
|
williamr@2
|
65 |
of Match().
|
williamr@2
|
66 |
|
williamr@2
|
67 |
For instance, in an implementation for a Chinese locale, this function would
|
williamr@2
|
68 |
return EFalse for non-Chinese words.
|
williamr@2
|
69 |
|
williamr@2
|
70 |
Any words that are not valid to be matched by the plug-in will be matched
|
williamr@2
|
71 |
using TDesC16::MatchC() instead.
|
williamr@2
|
72 |
|
williamr@2
|
73 |
@param aWord The word to be checked. Note that it contains a '*' wildcard
|
williamr@2
|
74 |
character at the end and optionally one at the beginning, depending on whether
|
williamr@2
|
75 |
ContactsMatchingCriteriaL() or ContactsMatchingPrefixL() was called.
|
williamr@2
|
76 |
@return ETrue if the word is valid for matching by the plug-in, EFalse if not. */
|
williamr@2
|
77 |
virtual TBool IsWordValidForMatching(const TDesC& aWord) = 0;
|
williamr@2
|
78 |
/** An optimisation function that may be used to implement incremental find, i.e.
|
williamr@2
|
79 |
involving only the results of a previous search, rather than the entire view.
|
williamr@2
|
80 |
|
williamr@2
|
81 |
This function is not called in v7.0s, but is provided for possible future use.
|
williamr@2
|
82 |
|
williamr@2
|
83 |
@param aItemString The string that is being searched.
|
williamr@2
|
84 |
@param aSearchText The string to search for.
|
williamr@2
|
85 |
@return ETrue if aSearchText is found in aItemString. EFalse if not. */
|
williamr@2
|
86 |
virtual TBool MatchRefineL( const TDesC& aItemString, const TDesC &aSearchText) = 0;
|
williamr@2
|
87 |
private:
|
williamr@2
|
88 |
//The uid is stored here,so that it can be used during destruction of the instance.
|
williamr@2
|
89 |
TUid iDtor_ID_Key;
|
williamr@2
|
90 |
};
|
williamr@2
|
91 |
|
williamr@2
|
92 |
#include <cntviewfindconfig.inl>
|
williamr@2
|
93 |
|
williamr@2
|
94 |
#endif
|