1
/****************************************************************************
3
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
5
** Contact: Nokia Corporation (qt-info@nokia.com)
7
** This file is part of the Qt Mobility Components.
9
** $QT_BEGIN_LICENSE:LGPL$
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Commercial License Agreement provided with
13
** the Software or, alternatively, in accordance with the terms
14
** contained in a written agreement between you and Nokia.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Nokia gives you certain additional
25
** rights. These rights are described in the Nokia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
** GNU General Public License Usage
29
** Alternatively, this file may be used under the terms of the GNU
30
** General Public License version 3.0 as published by the Free Software
31
** Foundation and appearing in the file LICENSE.GPL included in the
32
** packaging of this file. Please review the following information to
33
** ensure the GNU General Public License version 3.0 requirements will be
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** If you are unsure which license is appropriate for your use, please
37
** contact the sales department at qt-sales@nokia.com.
40
****************************************************************************/
42
#ifdef SYMBIAN_BACKEND_USE_SQLITE
44
#include "cnttransformfavorite.h"
46
QList<CContactItemField *> CntTransformFavorite::transformDetailL(const QContactDetail &detail)
48
if(detail.definitionName() != QContactFavorite::DefinitionName) {
49
User::Leave(KErrArgument);
52
QList<CContactItemField *> fieldList;
55
const QContactFavorite &favorite(static_cast<const QContactFavorite&>(detail));
56
if (!favorite.isFavorite()) {
57
//do not add favorite field
61
CContactItemField* itemField = CContactItemField::NewLC(KStorageTypeContactItemId, KUidContactFieldFavourite);
62
itemField->AgentStorage()->SetAgentId(favorite.index());
63
itemField->SetMapping(KUidContactFieldVCardMapFavourite);
64
fieldList.append(itemField);
65
CleanupStack::Pop(itemField);
70
QContactDetail *CntTransformFavorite::transformItemField(const CContactItemField& field, const QContact &contact)
74
CContactAgentField* storage = field.AgentStorage();
75
QContactFavorite *favoriteDetail = new QContactFavorite();
76
favoriteDetail->setFavorite(true);
77
favoriteDetail->setIndex(storage->Value());
78
return favoriteDetail;
81
bool CntTransformFavorite::supportsDetail(QString detailName) const
84
if (detailName == QContactFavorite::DefinitionName) {
90
QList<TUid> CntTransformFavorite::supportedFields() const
92
return QList<TUid>() << KUidContactFieldFavourite;
95
QList<TUid> CntTransformFavorite::supportedSortingFieldTypes(QString detailFieldName) const
98
if (detailFieldName == QContactFavorite::FieldFavorite) {
99
uids << KUidContactFieldFavourite;
105
* Checks whether the subtype is supported
107
* \a subType The subtype to be checked
108
* \return True if this subtype is supported
110
bool CntTransformFavorite::supportsSubType(const QString& subType) const
117
* Returns the filed id corresponding to a field
119
* \a fieldName The name of the supported field
120
* \return fieldId for the fieldName, 0 if not supported
122
quint32 CntTransformFavorite::getIdForField(const QString& fieldName) const
124
if (QContactFavorite::FieldFavorite == fieldName) {
125
return KUidContactFieldFavourite.iUid;
133
* Modifies the detail definitions. The default detail definitions are
134
* queried from QContactManagerEngine::schemaDefinitions and then modified
135
* with this function in the transform leaf classes.
137
* \a definitions The detail definitions to modify.
138
* \a contactType The contact type the definitions apply for.
140
void CntTransformFavorite::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const
142
Q_UNUSED(contactType);
144
if (definitions.contains(QContactFavorite::DefinitionName)) {
145
QContactDetailDefinition d = definitions.value(QContactFavorite::DefinitionName);
146
QMap<QString, QContactDetailFieldDefinition> fields = d.fields();
148
// Context not supported in symbian back-end, remove
149
fields.remove(QContactFavorite::FieldContext);
153
// Replace original definitions
154
definitions.insert(d.name(), d);