63
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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: An ECOM interface for the virtual phonebook contact attributes.
|
|
15 |
* Contact attributes are e.g speed dial and defaults.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CVPBKCONTACTATTRIBUTEPLUGIN_H
|
|
21 |
#define CVPBKCONTACTATTRIBUTEPLUGIN_H
|
|
22 |
|
|
23 |
// INCLUDES FILES
|
|
24 |
#include <ecom/ecom.h>
|
|
25 |
#include <MVPbkContactAttributeManager.h>
|
|
26 |
|
|
27 |
// FORWARD DECLARATIONS
|
|
28 |
class CVPbkContactManager;
|
|
29 |
class MVPbkContactOperation;
|
|
30 |
class MVPbkContactFindObserver;
|
|
31 |
class MVPbkContactAttribute;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* ECom plugin interface for contact attribute plugins.
|
|
35 |
*/
|
|
36 |
class CVPbkContactAttributePlugin :
|
|
37 |
public CBase,
|
|
38 |
public MVPbkContactAttributeManager
|
|
39 |
{
|
|
40 |
public: // Construction and destruction
|
|
41 |
class TParam
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
/**
|
|
45 |
* Constructor.
|
|
46 |
*
|
|
47 |
* @param aContactManager Reference to the contact manager.
|
|
48 |
*/
|
|
49 |
TParam(CVPbkContactManager& aContactManager);
|
|
50 |
public:
|
|
51 |
///Ref: Contact manager
|
|
52 |
CVPbkContactManager& iContactManager;
|
|
53 |
///Own: Spare for future extension
|
|
54 |
TAny* iSpare;
|
|
55 |
};
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Two-phase constructor for the plugin.
|
|
59 |
*
|
|
60 |
* @param aUid Plugin attribute type.
|
|
61 |
* @param aParam Plugin parameters, see
|
|
62 |
* CVPbkContactAttributePlugin::TParam.
|
|
63 |
* @return Plugin instance.
|
|
64 |
*/
|
|
65 |
static CVPbkContactAttributePlugin* NewL(TUid aUid, TParam& aParam);
|
|
66 |
~CVPbkContactAttributePlugin();
|
|
67 |
|
|
68 |
public: // Interface
|
|
69 |
/**
|
|
70 |
* @return The attirbute type of this plugin.
|
|
71 |
*/
|
|
72 |
TUid AttributeType() const;
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Creates an operation object instance for listing contacts.
|
|
76 |
*
|
|
77 |
* @param aAttributeType Attribute type for the operation.
|
|
78 |
* @param aObserver Operation observer.
|
|
79 |
* @return Operation object.
|
|
80 |
*/
|
|
81 |
virtual MVPbkContactOperation* CreateListContactsOperationL(
|
|
82 |
TUid aAttributeType,
|
|
83 |
MVPbkContactFindObserver& aObserver) =0;
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Creates an operation object instance for listing contacts.
|
|
87 |
*
|
|
88 |
* @param aAttributeType Attribute for the operation.
|
|
89 |
* @param aObserver Operation observer.
|
|
90 |
* @return Operation object.
|
|
91 |
*/
|
|
92 |
virtual MVPbkContactOperation* CreateListContactsOperationL(
|
|
93 |
const MVPbkContactAttribute& aAttribute,
|
|
94 |
MVPbkContactFindObserver& aObserver) =0;
|
|
95 |
|
|
96 |
public: // From MVPbkContactAttributeManager
|
|
97 |
|
|
98 |
/**
|
|
99 |
* This functionality has been implemented in terms of
|
|
100 |
* HasFieldAttributeL so plugins don't need to implement
|
|
101 |
* it by their own.
|
|
102 |
*
|
|
103 |
* @param aAttr Contact attributes to search for.
|
|
104 |
* @param aContact Contact from which to look for a field.
|
|
105 |
* @return Pointer to a field matcing the given attribute.
|
|
106 |
* @exception KErrNotSupported The default implementation always
|
|
107 |
* leaves with KErrNotSupported.
|
|
108 |
*/
|
|
109 |
inline MVPbkStoreContactField* FindFieldWithAttributeL(
|
|
110 |
const MVPbkContactAttribute& aAttr,
|
|
111 |
MVPbkStoreContact& aContact) const;
|
|
112 |
|
|
113 |
private: // Data
|
|
114 |
///Own: destructor id key
|
|
115 |
TUid iDtorIDKey;
|
|
116 |
///Own: attribute type
|
|
117 |
TUid iAttributeType;
|
|
118 |
};
|
|
119 |
|
|
120 |
inline CVPbkContactAttributePlugin::TParam::TParam(
|
|
121 |
CVPbkContactManager& aContactManager) :
|
|
122 |
iContactManager(aContactManager)
|
|
123 |
{
|
|
124 |
}
|
|
125 |
|
|
126 |
inline CVPbkContactAttributePlugin* CVPbkContactAttributePlugin::NewL(
|
|
127 |
TUid aUid, TParam& aParam)
|
|
128 |
{
|
|
129 |
TAny* ptr = NULL;
|
|
130 |
ptr = REComSession::CreateImplementationL(
|
|
131 |
aUid,
|
|
132 |
_FOFF(CVPbkContactAttributePlugin, iDtorIDKey),
|
|
133 |
static_cast<TAny*>(&aParam));
|
|
134 |
|
|
135 |
CVPbkContactAttributePlugin* plugin =
|
|
136 |
reinterpret_cast<CVPbkContactAttributePlugin*>(ptr);
|
|
137 |
if (plugin)
|
|
138 |
{
|
|
139 |
plugin->iAttributeType = aUid;
|
|
140 |
}
|
|
141 |
|
|
142 |
return plugin;
|
|
143 |
}
|
|
144 |
|
|
145 |
inline CVPbkContactAttributePlugin::~CVPbkContactAttributePlugin()
|
|
146 |
{
|
|
147 |
REComSession::DestroyedImplementation(iDtorIDKey);
|
|
148 |
}
|
|
149 |
|
|
150 |
inline TUid CVPbkContactAttributePlugin::AttributeType() const
|
|
151 |
{
|
|
152 |
return iAttributeType;
|
|
153 |
}
|
|
154 |
|
|
155 |
inline MVPbkStoreContactField*
|
|
156 |
CVPbkContactAttributePlugin::FindFieldWithAttributeL(
|
|
157 |
const MVPbkContactAttribute& /*aAttr*/,
|
|
158 |
MVPbkStoreContact& /*aContact*/) const
|
|
159 |
{
|
|
160 |
// This functionality has been implemented in terms of
|
|
161 |
// HasFieldAttributeL so plugins don't need to implement
|
|
162 |
// it by their own.
|
|
163 |
User::Leave( KErrNotSupported );
|
|
164 |
return NULL;
|
|
165 |
}
|
|
166 |
#endif // CVPBKCONTACTATTRIBUTEPLUGIN_H
|
|
167 |
|
|
168 |
// End of File
|