summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex <qt-info@nokia.com>2010-03-18 17:25:24 +1000
committerAlex <qt-info@nokia.com>2010-03-18 17:25:24 +1000
commitae2e77ba91a4f4b6011cbb40c97723db38f17a01 (patch)
tree1a834e16721360d8b2a90094e6f74581475fa36b
parentae959b4bbbec51bc514edb674c156ae2af3f74d5 (diff)
convert contacts files CRLF->LF
-rw-r--r--plugins/contacts/symbian/tsrc/ut_symbian/main.cpp184
-rw-r--r--plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.cpp838
-rw-r--r--plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.h156
-rw-r--r--plugins/contacts/symbiansim/inc/cntabstractsimrequest.h186
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimcontactfetchrequest.h128
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimcontactlocalidfetchrequest.h128
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimcontactremoverequest.h146
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimcontactsaverequest.h140
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimdetaildefinitionfetchrequest.h122
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimstore.h202
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimstoreeventlistener.h138
-rw-r--r--plugins/contacts/symbiansim/inc/cntsimstoreprivate.h236
-rw-r--r--plugins/contacts/symbiansim/inc/cntsymbiansimtransformerror.h108
-rw-r--r--plugins/contacts/symbiansim/src/cntabstractsimrequest.cpp228
-rw-r--r--plugins/contacts/symbiansim/src/cntsimcontactfetchrequest.cpp234
-rw-r--r--plugins/contacts/symbiansim/src/cntsimcontactlocalidfetchrequest.cpp220
-rw-r--r--plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp328
-rw-r--r--plugins/contacts/symbiansim/src/cntsimcontactsaverequest.cpp246
-rw-r--r--plugins/contacts/symbiansim/src/cntsimdetaildefinitionfetchrequest.cpp214
-rw-r--r--plugins/contacts/symbiansim/src/cntsimstore.cpp222
-rw-r--r--plugins/contacts/symbiansim/src/cntsimstoreeventlistener.cpp256
-rw-r--r--plugins/contacts/symbiansim/src/cntsimstoreprivate.cpp1336
-rw-r--r--plugins/contacts/symbiansim/src/cntsymbiansimtransformerror.cpp200
23 files changed, 3098 insertions, 3098 deletions
diff --git a/plugins/contacts/symbian/tsrc/ut_symbian/main.cpp b/plugins/contacts/symbian/tsrc/ut_symbian/main.cpp
index 0d914ae2e2..3e7cebe6d6 100644
--- a/plugins/contacts/symbian/tsrc/ut_symbian/main.cpp
+++ b/plugins/contacts/symbian/tsrc/ut_symbian/main.cpp
@@ -1,92 +1,92 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "testrunner.h"
-#include "ut_cntsymbianengine.h"
-#include "ut_cntfiltering.h"
-#include "ut_cntrelationship.h"
-//#include "ut_cntsymbiandatabase.h"
-#include "ut_transformcontactdata.h"
-#include "ut_cntsqlsearch.h"
-
-#include <QtTest/QtTest>
-
-int main(int argc, char *argv[])
-{
- bool promptOnExit(true);
- for (int i=0; i<argc; i++) {
- if (QString(argv[i]) == "-noprompt")
- promptOnExit = false;
- }
- printf("Running tests...\n");
-
- QApplication app(argc, argv);
-
- TestRunner testRunner("ut_symbian");
-
- TestSymbianEngine ut_symbainEngine;
- testRunner.runTests(ut_symbainEngine);
-
- TestFiltering ut_filtering;
- testRunner.runTests(ut_filtering);
-
- TestCntRelationship ut_relationship;
- testRunner.runTests(ut_relationship);
-
- //TODO: fix
- //TestCntSymbianDatabase ut_symbianDatabase;
- //testRunner.runTests(ut_symbianDatabase);
-
- TestCntTransformContactData ut_transformContactData;
- testRunner.runTests(ut_transformContactData);
-
- UT_CntSqlSearch ut_sqlSearch;
- testRunner.runTests(ut_sqlSearch);
-
- testRunner.printResults();
-
- /*if (promptOnExit) {
- printf("Press any key...\n");
- getchar();
- }*/
- return 0;
-}
-
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testrunner.h"
+#include "ut_cntsymbianengine.h"
+#include "ut_cntfiltering.h"
+#include "ut_cntrelationship.h"
+//#include "ut_cntsymbiandatabase.h"
+#include "ut_transformcontactdata.h"
+#include "ut_cntsqlsearch.h"
+
+#include <QtTest/QtTest>
+
+int main(int argc, char *argv[])
+{
+ bool promptOnExit(true);
+ for (int i=0; i<argc; i++) {
+ if (QString(argv[i]) == "-noprompt")
+ promptOnExit = false;
+ }
+ printf("Running tests...\n");
+
+ QApplication app(argc, argv);
+
+ TestRunner testRunner("ut_symbian");
+
+ TestSymbianEngine ut_symbainEngine;
+ testRunner.runTests(ut_symbainEngine);
+
+ TestFiltering ut_filtering;
+ testRunner.runTests(ut_filtering);
+
+ TestCntRelationship ut_relationship;
+ testRunner.runTests(ut_relationship);
+
+ //TODO: fix
+ //TestCntSymbianDatabase ut_symbianDatabase;
+ //testRunner.runTests(ut_symbianDatabase);
+
+ TestCntTransformContactData ut_transformContactData;
+ testRunner.runTests(ut_transformContactData);
+
+ UT_CntSqlSearch ut_sqlSearch;
+ testRunner.runTests(ut_sqlSearch);
+
+ testRunner.printResults();
+
+ /*if (promptOnExit) {
+ printf("Press any key...\n");
+ getchar();
+ }*/
+ return 0;
+}
+
diff --git a/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.cpp b/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.cpp
index e89406f9cf..8967665d3b 100644
--- a/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.cpp
+++ b/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.cpp
@@ -1,419 +1,419 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "ut_cntrelationship.h"
-#include "cntrelationship.h"
-
-
-
-//Symbian database
-#include <cntdb.h>
-#include <cntitem.h>
-#include <cntdb.h>
-#include <cntdef.h>
-
-#include <QtTest/QtTest>
-
-#define QTRY_COMPARE(__expr, __expected) \
- do { \
- const int __step = 50; \
- const int __timeout = 1000; \
- QTest::qWait(10); \
- for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
- } while(0)
-
-
-/*
- * Done once before all tests
- */
-void TestCntRelationship::initTestCase()
-{
- qRegisterMetaType<QContactLocalId>("QContactLocalId");
- qRegisterMetaType<QList<QContactLocalId> >("QList<QContactLocalId>");
-
- //create manager
- QContactManager::Error err;
- m_manager = new CntSymbianEngine(QMap<QString, QString>(), err);
-
- //open symbian database
- TRAPD(error, m_database = CContactDatabase::OpenL());
- QVERIFY(error == KErrNone);
-
- // create relationship
- m_relationship = new CntRelationship(m_database, m_manager->m_managerUri);
-}
-
-
-/*
- * Cleanup after all test
- */
-void TestCntRelationship::cleanupTestCase()
-{
- delete m_manager;
- delete m_database;
- delete m_relationship;
-}
-
-/*
- * Initialization done before each test
- */
-void TestCntRelationship::init()
-{
- //delete all contacts from the database
- QContactManager::Error err;
- QList<QContactLocalId> contacts = m_manager->contactIds(QContactFilter(), QList<QContactSortOrder>(), err);
-
- QMap<int, QContactManager::Error> errorMap;
- m_manager->removeContacts(&contacts, &errorMap, err);
-}
-
-void TestCntRelationship::cleanup()
-{}
-
-/*
- * Test relatioship that doesn't exist
- */
-void TestCntRelationship::invalidRelationship()
-{
- QContactRelationship relationship;
- relationship.setRelationshipType(QLatin1String("invalid relationship") );
-
- //save & remove relationship
- QContactManager::Error error;
- QSet<QContactLocalId> affectedContactIds;
- bool returnValue(false);
-
- //save & remove relationships
- QList<QContactRelationship> relationships;
- relationships.append(relationship);
- QList <QContactManager::Error> errors;
-
- //save relationship
- returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error == QContactManager::NotSupportedError);
-
- //remove relationship
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error == QContactManager::NotSupportedError);
-
- //save relationships
- errors = m_relationship->saveRelationships(&affectedContactIds, &relationships, error);
- QVERIFY(affectedContactIds.count() == 0);
- for(int i = 0; i < errors.count(); i++){
- QVERIFY(errors.at(i) == QContactManager::NotSupportedError);
- }
-
- //remove relationships
- errors = m_relationship->removeRelationships(&affectedContactIds, relationships, error);
- QVERIFY(affectedContactIds.count() == 0);
- for(int i = 0; i < errors.count(); i++){
- QVERIFY(errors.at(i) == QContactManager::NotSupportedError);
- }
-
- //relationships
- QList<QContactRelationship> relationshipList;
- QContactId id;
-
- relationshipList = m_relationship->relationships(QLatin1String("invalid relationship"), id, QContactRelationshipFilter::Either, error);
- QVERIFY(relationshipList.count() == 0);
- QVERIFY(error == QContactManager::NotSupportedError);
-}
-
-/*
- * Test valid group relationship functionality
- */
-void TestCntRelationship::validGroupRelationship()
-{
- //create a group
- QContact groupContact;
- groupContact.setType(QContactType::TypeGroup);
- QContactManager::Error err;
- m_manager->saveContact(&groupContact, err);
-
- //create a contact
- QContact contact;
- contact.setType(QContactType::TypeContact);
- m_manager->saveContact(&contact, err);
-
- //create relationship
- QContactRelationship relationship;
- relationship.setRelationshipType(QContactRelationship::HasMember);
- relationship.setFirst(groupContact.id());
- relationship.setSecond(contact.id());
-
- //save relationship
- bool returnValue(false);
- QContactManager::Error error;
- QSet<QContactLocalId> affectedContactIds;
- returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
- QVERIFY2(returnValue == true, "save");
- QVERIFY2(affectedContactIds.count() == 2, "save");
- QVERIFY2(affectedContactIds.toList().contains(groupContact.localId()), "save");
- QVERIFY2(affectedContactIds.toList().contains(contact.localId()), "save");
- QVERIFY2(error == QContactManager::NoError, "save");
-
- //retrieve the relationships
- QList<QContactRelationship> relationshipList;
-
- //Retrive group
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact.id(), QContactRelationshipFilter::First, error);
- QVERIFY2(relationshipList.count() == 1, "group - First");
- QVERIFY2(error == QContactManager::NoError, "group - First");
-
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact.id(), QContactRelationshipFilter::Second, error);
- QVERIFY2(relationshipList.count() == 0, "group - Second");
- QVERIFY2(error == QContactManager::DoesNotExistError, "group - Second");
-
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact.id(), QContactRelationshipFilter::Either, error);
- QVERIFY2(relationshipList.count() == 1, "group - Either");
- QVERIFY2(error == QContactManager::NoError, "group - Either");
-
- //Retrive contact
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), contact.id(), QContactRelationshipFilter::First, error);
- QVERIFY2(relationshipList.count() == 0, "contact - First");
- QVERIFY2(error == QContactManager::DoesNotExistError, "contact - First");
-
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), contact.id(), QContactRelationshipFilter::Second, error);
- QVERIFY2(relationshipList.count() == 1, "contact - Second");
- QVERIFY2(error == QContactManager::NoError, "contact - Second");
-
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), contact.id(), QContactRelationshipFilter::Either, error);
- QVERIFY2(relationshipList.count() == 1, "contact - Either");
- QVERIFY2(error == QContactManager::NoError, "contact - Either");
-
- //Relationship for empty contact -> all relationships are returned
- relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), QContactId(),
- QContactRelationshipFilter::First, error);
- QVERIFY2(relationshipList.count() == 1, "All relationships");
- QVERIFY2(error == QContactManager::NoError, "All relatiosnships");
-
-
- //Validate Filter
- QList<QContactLocalId> expectedContacts;
- expectedContacts += contact.localId();
- QVERIFY(true == validateRelationshipFilter(QContactRelationshipFilter::First, groupContact.id(), expectedContacts));
-
- //remove relationship
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
- QVERIFY2(returnValue == true, "remove");
- QVERIFY2(affectedContactIds.count() == 2, "remove");
- QVERIFY2(affectedContactIds.toList().contains(groupContact.localId()), "remove");
- QVERIFY2(affectedContactIds.toList().contains(contact.localId()), "remove");
- QVERIFY2(error == QContactManager::NoError, "remove");
-}
-
-/*
- * Test valid group relationships
- */
-void TestCntRelationship::validGroupRelationships()
-{
-}
-
-/*
- * Test invalid group relationships
- */
-void TestCntRelationship::invalidGroupRelationship()
-{
-}
-
-/*
- * Test invalid group passed to grouprelationship functions
- */
-void TestCntRelationship::invalidFirstContactGroupRelationship()
-{
- //create a contact
- QContact contact;
- contact.setType(QContactType::TypeContact);
- QContactManager::Error err;
- m_manager->saveContact(&contact, err);
-
- //create relationship
- QContactId invalidId;
- QContactRelationship relationship;
- relationship.setRelationshipType(QContactRelationship::HasMember);
- relationship.setFirst(invalidId);
- relationship.setSecond(contact.id());
-
- //save relationship
- bool returnValue(false);
- QContactManager::Error error;
- QSet<QContactLocalId> affectedContactIds;
- returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error != QContactManager::NoError);
-
- //remove relationship
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error != QContactManager::NoError);
-}
-
-/*
- * Test invalid group memeber, passed to group relationship functions
- */
-void TestCntRelationship::invalidSecondContactGroupRelationship()
-{
- //create a group
- QContact groupContact;
- groupContact.setType(QContactType::TypeGroup);
- QContactManager::Error err;
- m_manager->saveContact(&groupContact, err);
-
- //create relationship
- QContactId invalidId;
- QContactRelationship relationship;
- relationship.setRelationshipType(QContactRelationship::HasMember);
- relationship.setFirst(groupContact.id());
- relationship.setSecond(invalidId);
-
- //save relationship
- bool returnValue(false);
- QContactManager::Error error;
- QSet<QContactLocalId> affectedContactIds;
- returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
- QVERIFY2(returnValue == false, "save");
- QVERIFY2(affectedContactIds.count() == 0, "save");
- QVERIFY2(error != QContactManager::NoError, "save");
-
- //remove relationship
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
- QVERIFY2(returnValue == false, "remove");
- QVERIFY2(affectedContactIds.count() == 0, "remove");
- QVERIFY2(error != QContactManager::NoError, "remove");
-
- //remove relationship: cyclic relantionship
- relationship.setRelationshipType(QContactRelationship::HasMember);
- relationship.setFirst(groupContact.id());
- relationship.setSecond(groupContact.id());
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
- QVERIFY2(returnValue == false, "remove");
- QVERIFY2(affectedContactIds.count() == 0, "remove");
- QVERIFY2(error != QContactManager::NoError, "remove");
-}
-
-/*
- * Test invalid group and group member, passed to group relationship functions
- */
-void TestCntRelationship::invalidFirstAndSecondContactGroupRelationship()
-{
- //create relationship
- QContactId invalidId;
- QContactRelationship relationship;
- relationship.setRelationshipType(QContactRelationship::HasMember);
- relationship.setFirst(invalidId);
- relationship.setSecond(invalidId);
-
- //save relationship
- bool returnValue(false);
- QContactManager::Error error;
- QSet<QContactLocalId> affectedContactIds;
- returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error != QContactManager::NoError);
-
- //remove relationship
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error != QContactManager::NoError);
-
- //remove relationship: first contact's manager is not the same as cntrelationship's
- QContactRelationship relationshipDifManagers;
- QContactId id1;
- id1.setLocalId(10);
- id1.setManagerUri("manager1");
- QContactId id2;
- id2.setLocalId(15);
- id2.setManagerUri("manager2");
- relationshipDifManagers.setRelationshipType(QContactRelationship::HasMember);
- relationshipDifManagers.setFirst(id1);
- relationshipDifManagers.setSecond(id2);
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationshipDifManagers, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error != QContactManager::NoError);
-
- //remove relationship: second contact's manager is not the same as cntrelationship's
- QContact contact;
- contact.setType(QContactType::TypeContact);
- QContactManager::Error err;
- m_manager->saveContact(&contact, err);
- QContactRelationship relationshipDifManagers2;
- id2.setLocalId(15);
- id2.setManagerUri("manager2");
- relationshipDifManagers2.setRelationshipType(QContactRelationship::HasMember);
- relationshipDifManagers2.setFirst(contact.id());
- relationshipDifManagers2.setSecond(id2);
- returnValue = m_relationship->removeRelationship(&affectedContactIds, relationshipDifManagers2, error);
- QVERIFY(returnValue == false);
- QVERIFY(affectedContactIds.count() == 0);
- QVERIFY(error != QContactManager::NoError);
-}
-
-bool TestCntRelationship::validateRelationshipFilter(const QContactRelationshipFilter::Role role, const QContactId contactId, const QList<QContactLocalId> expectedContacts)
- {
- QContactRelationshipFilter filter;
- filter.setRelationshipType(QContactRelationship::HasMember);
- filter.setRelatedContactRole(role);
- filter.setRelatedContactId(contactId);
-
- QContactManager::Error err;
- QList<QContactLocalId> result = m_manager->contactIds(filter, QList<QContactSortOrder>(), err);
-
- for(int i = 0; i < result.count(); i++)
- qDebug() << "result: " << result.at(i);
-
- for(int i = 0; i < expectedContacts.count(); i++)
- qDebug() << "expectedContacts: " << expectedContacts.at(i);
-
- return (result == expectedContacts);
- }
-
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "ut_cntrelationship.h"
+#include "cntrelationship.h"
+
+
+
+//Symbian database
+#include <cntdb.h>
+#include <cntitem.h>
+#include <cntdb.h>
+#include <cntdef.h>
+
+#include <QtTest/QtTest>
+
+#define QTRY_COMPARE(__expr, __expected) \
+ do { \
+ const int __step = 50; \
+ const int __timeout = 1000; \
+ QTest::qWait(10); \
+ for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
+ QTest::qWait(__step); \
+ } \
+ QCOMPARE(__expr, __expected); \
+ } while(0)
+
+
+/*
+ * Done once before all tests
+ */
+void TestCntRelationship::initTestCase()
+{
+ qRegisterMetaType<QContactLocalId>("QContactLocalId");
+ qRegisterMetaType<QList<QContactLocalId> >("QList<QContactLocalId>");
+
+ //create manager
+ QContactManager::Error err;
+ m_manager = new CntSymbianEngine(QMap<QString, QString>(), err);
+
+ //open symbian database
+ TRAPD(error, m_database = CContactDatabase::OpenL());
+ QVERIFY(error == KErrNone);
+
+ // create relationship
+ m_relationship = new CntRelationship(m_database, m_manager->m_managerUri);
+}
+
+
+/*
+ * Cleanup after all test
+ */
+void TestCntRelationship::cleanupTestCase()
+{
+ delete m_manager;
+ delete m_database;
+ delete m_relationship;
+}
+
+/*
+ * Initialization done before each test
+ */
+void TestCntRelationship::init()
+{
+ //delete all contacts from the database
+ QContactManager::Error err;
+ QList<QContactLocalId> contacts = m_manager->contactIds(QContactFilter(), QList<QContactSortOrder>(), err);
+
+ QMap<int, QContactManager::Error> errorMap;
+ m_manager->removeContacts(&contacts, &errorMap, err);
+}
+
+void TestCntRelationship::cleanup()
+{}
+
+/*
+ * Test relatioship that doesn't exist
+ */
+void TestCntRelationship::invalidRelationship()
+{
+ QContactRelationship relationship;
+ relationship.setRelationshipType(QLatin1String("invalid relationship") );
+
+ //save & remove relationship
+ QContactManager::Error error;
+ QSet<QContactLocalId> affectedContactIds;
+ bool returnValue(false);
+
+ //save & remove relationships
+ QList<QContactRelationship> relationships;
+ relationships.append(relationship);
+ QList <QContactManager::Error> errors;
+
+ //save relationship
+ returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error == QContactManager::NotSupportedError);
+
+ //remove relationship
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error == QContactManager::NotSupportedError);
+
+ //save relationships
+ errors = m_relationship->saveRelationships(&affectedContactIds, &relationships, error);
+ QVERIFY(affectedContactIds.count() == 0);
+ for(int i = 0; i < errors.count(); i++){
+ QVERIFY(errors.at(i) == QContactManager::NotSupportedError);
+ }
+
+ //remove relationships
+ errors = m_relationship->removeRelationships(&affectedContactIds, relationships, error);
+ QVERIFY(affectedContactIds.count() == 0);
+ for(int i = 0; i < errors.count(); i++){
+ QVERIFY(errors.at(i) == QContactManager::NotSupportedError);
+ }
+
+ //relationships
+ QList<QContactRelationship> relationshipList;
+ QContactId id;
+
+ relationshipList = m_relationship->relationships(QLatin1String("invalid relationship"), id, QContactRelationshipFilter::Either, error);
+ QVERIFY(relationshipList.count() == 0);
+ QVERIFY(error == QContactManager::NotSupportedError);
+}
+
+/*
+ * Test valid group relationship functionality
+ */
+void TestCntRelationship::validGroupRelationship()
+{
+ //create a group
+ QContact groupContact;
+ groupContact.setType(QContactType::TypeGroup);
+ QContactManager::Error err;
+ m_manager->saveContact(&groupContact, err);
+
+ //create a contact
+ QContact contact;
+ contact.setType(QContactType::TypeContact);
+ m_manager->saveContact(&contact, err);
+
+ //create relationship
+ QContactRelationship relationship;
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(groupContact.id());
+ relationship.setSecond(contact.id());
+
+ //save relationship
+ bool returnValue(false);
+ QContactManager::Error error;
+ QSet<QContactLocalId> affectedContactIds;
+ returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
+ QVERIFY2(returnValue == true, "save");
+ QVERIFY2(affectedContactIds.count() == 2, "save");
+ QVERIFY2(affectedContactIds.toList().contains(groupContact.localId()), "save");
+ QVERIFY2(affectedContactIds.toList().contains(contact.localId()), "save");
+ QVERIFY2(error == QContactManager::NoError, "save");
+
+ //retrieve the relationships
+ QList<QContactRelationship> relationshipList;
+
+ //Retrive group
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact.id(), QContactRelationshipFilter::First, error);
+ QVERIFY2(relationshipList.count() == 1, "group - First");
+ QVERIFY2(error == QContactManager::NoError, "group - First");
+
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact.id(), QContactRelationshipFilter::Second, error);
+ QVERIFY2(relationshipList.count() == 0, "group - Second");
+ QVERIFY2(error == QContactManager::DoesNotExistError, "group - Second");
+
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact.id(), QContactRelationshipFilter::Either, error);
+ QVERIFY2(relationshipList.count() == 1, "group - Either");
+ QVERIFY2(error == QContactManager::NoError, "group - Either");
+
+ //Retrive contact
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), contact.id(), QContactRelationshipFilter::First, error);
+ QVERIFY2(relationshipList.count() == 0, "contact - First");
+ QVERIFY2(error == QContactManager::DoesNotExistError, "contact - First");
+
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), contact.id(), QContactRelationshipFilter::Second, error);
+ QVERIFY2(relationshipList.count() == 1, "contact - Second");
+ QVERIFY2(error == QContactManager::NoError, "contact - Second");
+
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), contact.id(), QContactRelationshipFilter::Either, error);
+ QVERIFY2(relationshipList.count() == 1, "contact - Either");
+ QVERIFY2(error == QContactManager::NoError, "contact - Either");
+
+ //Relationship for empty contact -> all relationships are returned
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), QContactId(),
+ QContactRelationshipFilter::First, error);
+ QVERIFY2(relationshipList.count() == 1, "All relationships");
+ QVERIFY2(error == QContactManager::NoError, "All relatiosnships");
+
+
+ //Validate Filter
+ QList<QContactLocalId> expectedContacts;
+ expectedContacts += contact.localId();
+ QVERIFY(true == validateRelationshipFilter(QContactRelationshipFilter::First, groupContact.id(), expectedContacts));
+
+ //remove relationship
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
+ QVERIFY2(returnValue == true, "remove");
+ QVERIFY2(affectedContactIds.count() == 2, "remove");
+ QVERIFY2(affectedContactIds.toList().contains(groupContact.localId()), "remove");
+ QVERIFY2(affectedContactIds.toList().contains(contact.localId()), "remove");
+ QVERIFY2(error == QContactManager::NoError, "remove");
+}
+
+/*
+ * Test valid group relationships
+ */
+void TestCntRelationship::validGroupRelationships()
+{
+}
+
+/*
+ * Test invalid group relationships
+ */
+void TestCntRelationship::invalidGroupRelationship()
+{
+}
+
+/*
+ * Test invalid group passed to grouprelationship functions
+ */
+void TestCntRelationship::invalidFirstContactGroupRelationship()
+{
+ //create a contact
+ QContact contact;
+ contact.setType(QContactType::TypeContact);
+ QContactManager::Error err;
+ m_manager->saveContact(&contact, err);
+
+ //create relationship
+ QContactId invalidId;
+ QContactRelationship relationship;
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(invalidId);
+ relationship.setSecond(contact.id());
+
+ //save relationship
+ bool returnValue(false);
+ QContactManager::Error error;
+ QSet<QContactLocalId> affectedContactIds;
+ returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error != QContactManager::NoError);
+
+ //remove relationship
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error != QContactManager::NoError);
+}
+
+/*
+ * Test invalid group memeber, passed to group relationship functions
+ */
+void TestCntRelationship::invalidSecondContactGroupRelationship()
+{
+ //create a group
+ QContact groupContact;
+ groupContact.setType(QContactType::TypeGroup);
+ QContactManager::Error err;
+ m_manager->saveContact(&groupContact, err);
+
+ //create relationship
+ QContactId invalidId;
+ QContactRelationship relationship;
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(groupContact.id());
+ relationship.setSecond(invalidId);
+
+ //save relationship
+ bool returnValue(false);
+ QContactManager::Error error;
+ QSet<QContactLocalId> affectedContactIds;
+ returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
+ QVERIFY2(returnValue == false, "save");
+ QVERIFY2(affectedContactIds.count() == 0, "save");
+ QVERIFY2(error != QContactManager::NoError, "save");
+
+ //remove relationship
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
+ QVERIFY2(returnValue == false, "remove");
+ QVERIFY2(affectedContactIds.count() == 0, "remove");
+ QVERIFY2(error != QContactManager::NoError, "remove");
+
+ //remove relationship: cyclic relantionship
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(groupContact.id());
+ relationship.setSecond(groupContact.id());
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
+ QVERIFY2(returnValue == false, "remove");
+ QVERIFY2(affectedContactIds.count() == 0, "remove");
+ QVERIFY2(error != QContactManager::NoError, "remove");
+}
+
+/*
+ * Test invalid group and group member, passed to group relationship functions
+ */
+void TestCntRelationship::invalidFirstAndSecondContactGroupRelationship()
+{
+ //create relationship
+ QContactId invalidId;
+ QContactRelationship relationship;
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(invalidId);
+ relationship.setSecond(invalidId);
+
+ //save relationship
+ bool returnValue(false);
+ QContactManager::Error error;
+ QSet<QContactLocalId> affectedContactIds;
+ returnValue = m_relationship->saveRelationship(&affectedContactIds, &relationship, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error != QContactManager::NoError);
+
+ //remove relationship
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationship, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error != QContactManager::NoError);
+
+ //remove relationship: first contact's manager is not the same as cntrelationship's
+ QContactRelationship relationshipDifManagers;
+ QContactId id1;
+ id1.setLocalId(10);
+ id1.setManagerUri("manager1");
+ QContactId id2;
+ id2.setLocalId(15);
+ id2.setManagerUri("manager2");
+ relationshipDifManagers.setRelationshipType(QContactRelationship::HasMember);
+ relationshipDifManagers.setFirst(id1);
+ relationshipDifManagers.setSecond(id2);
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationshipDifManagers, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error != QContactManager::NoError);
+
+ //remove relationship: second contact's manager is not the same as cntrelationship's
+ QContact contact;
+ contact.setType(QContactType::TypeContact);
+ QContactManager::Error err;
+ m_manager->saveContact(&contact, err);
+ QContactRelationship relationshipDifManagers2;
+ id2.setLocalId(15);
+ id2.setManagerUri("manager2");
+ relationshipDifManagers2.setRelationshipType(QContactRelationship::HasMember);
+ relationshipDifManagers2.setFirst(contact.id());
+ relationshipDifManagers2.setSecond(id2);
+ returnValue = m_relationship->removeRelationship(&affectedContactIds, relationshipDifManagers2, error);
+ QVERIFY(returnValue == false);
+ QVERIFY(affectedContactIds.count() == 0);
+ QVERIFY(error != QContactManager::NoError);
+}
+
+bool TestCntRelationship::validateRelationshipFilter(const QContactRelationshipFilter::Role role, const QContactId contactId, const QList<QContactLocalId> expectedContacts)
+ {
+ QContactRelationshipFilter filter;
+ filter.setRelationshipType(QContactRelationship::HasMember);
+ filter.setRelatedContactRole(role);
+ filter.setRelatedContactId(contactId);
+
+ QContactManager::Error err;
+ QList<QContactLocalId> result = m_manager->contactIds(filter, QList<QContactSortOrder>(), err);
+
+ for(int i = 0; i < result.count(); i++)
+ qDebug() << "result: " << result.at(i);
+
+ for(int i = 0; i < expectedContacts.count(); i++)
+ qDebug() << "expectedContacts: " << expectedContacts.at(i);
+
+ return (result == expectedContacts);
+ }
+
diff --git a/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.h b/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.h
index f6b25799fb..014f6c04d9 100644
--- a/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.h
+++ b/plugins/contacts/symbian/tsrc/ut_symbian/ut_cntrelationship.h
@@ -1,78 +1,78 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TESTRELATIONSHIP_H
-#define TESTRELATIONSHIP_H
-
-#include <QObject>
-#include "cntsymbianengine.h"
-
-class CContactDatabase;
-class CntRelationship;
-
-class TestCntRelationship : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void cleanupTestCase();
-
- void init();
- void cleanup();
-
- void invalidRelationship();
- void validGroupRelationship();
- void validGroupRelationships();
- void invalidGroupRelationship();
- void invalidFirstContactGroupRelationship();
- void invalidSecondContactGroupRelationship();
- void invalidFirstAndSecondContactGroupRelationship();
-
-private:
- bool TestCntRelationship::validateRelationshipFilter(const QContactRelationshipFilter::Role role, const QContactId contactId, const QList<QContactLocalId> expectedContacts);
-
-private:
- CntSymbianEngine *m_manager;
- CContactDatabase *m_database;
- CntRelationship *m_relationship;
-};
-
-#endif
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTRELATIONSHIP_H
+#define TESTRELATIONSHIP_H
+
+#include <QObject>
+#include "cntsymbianengine.h"
+
+class CContactDatabase;
+class CntRelationship;
+
+class TestCntRelationship : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void init();
+ void cleanup();
+
+ void invalidRelationship();
+ void validGroupRelationship();
+ void validGroupRelationships();
+ void invalidGroupRelationship();
+ void invalidFirstContactGroupRelationship();
+ void invalidSecondContactGroupRelationship();
+ void invalidFirstAndSecondContactGroupRelationship();
+
+private:
+ bool TestCntRelationship::validateRelationshipFilter(const QContactRelationshipFilter::Role role, const QContactId contactId, const QList<QContactLocalId> expectedContacts);
+
+private:
+ CntSymbianEngine *m_manager;
+ CContactDatabase *m_database;
+ CntRelationship *m_relationship;
+};
+
+#endif
diff --git a/plugins/contacts/symbiansim/inc/cntabstractsimrequest.h b/plugins/contacts/symbiansim/inc/cntabstractsimrequest.h
index 339375def8..0f53e8fc8a 100644
--- a/plugins/contacts/symbiansim/inc/cntabstractsimrequest.h
+++ b/plugins/contacts/symbiansim/inc/cntabstractsimrequest.h
@@ -1,93 +1,93 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTABSTRACTSIMREQUEST_H_
-#define CNTABSTRACTSIMREQUEST_H_
-
-#include <QObject>
-#include <qtcontacts.h>
-
-QTM_BEGIN_NAMESPACE
-class QContactAbstractRequest;
-QTM_END_NAMESPACE
-QTM_USE_NAMESPACE
-
-class CntSymbianSimEngine;
-class CntSimStore;
-class QTimer;
-
-#ifdef SYMBIANSIM_BACKEND_USE_DELAY
-const int KRequestDelay = 10; // in ms
-#else
-const int KRequestDelay = 0;
-#endif
-const int KMaxRetryCount = 10;
-
-class CntAbstractSimRequest : public QObject
-{
-Q_OBJECT
-public:
- CntAbstractSimRequest(CntSymbianSimEngine *engine, QContactAbstractRequest *req);
-
- bool start();
-
-public Q_SLOTS:
- virtual void run() = 0;
- virtual bool cancel();
-
-protected:
- bool waitAndRetry();
- void singleShotTimer(int msec, QObject *receiver, const char *member);
- void cancelTimer();
- CntSymbianSimEngine *engine();
- CntSimStore *simStore();
- QContactAbstractRequest *req() { return m_request; }
-
- template<class T>
- T *req() { return static_cast<T*>(m_request); }
-
-private:
- QContactAbstractRequest *m_request;
- QTimer *m_timer;
- int m_retryCount;
-};
-
-#endif // CNTABSTRACTSIMREQUEST_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTABSTRACTSIMREQUEST_H_
+#define CNTABSTRACTSIMREQUEST_H_
+
+#include <QObject>
+#include <qtcontacts.h>
+
+QTM_BEGIN_NAMESPACE
+class QContactAbstractRequest;
+QTM_END_NAMESPACE
+QTM_USE_NAMESPACE
+
+class CntSymbianSimEngine;
+class CntSimStore;
+class QTimer;
+
+#ifdef SYMBIANSIM_BACKEND_USE_DELAY
+const int KRequestDelay = 10; // in ms
+#else
+const int KRequestDelay = 0;
+#endif
+const int KMaxRetryCount = 10;
+
+class CntAbstractSimRequest : public QObject
+{
+Q_OBJECT
+public:
+ CntAbstractSimRequest(CntSymbianSimEngine *engine, QContactAbstractRequest *req);
+
+ bool start();
+
+public Q_SLOTS:
+ virtual void run() = 0;
+ virtual bool cancel();
+
+protected:
+ bool waitAndRetry();
+ void singleShotTimer(int msec, QObject *receiver, const char *member);
+ void cancelTimer();
+ CntSymbianSimEngine *engine();
+ CntSimStore *simStore();
+ QContactAbstractRequest *req() { return m_request; }
+
+ template<class T>
+ T *req() { return static_cast<T*>(m_request); }
+
+private:
+ QContactAbstractRequest *m_request;
+ QTimer *m_timer;
+ int m_retryCount;
+};
+
+#endif // CNTABSTRACTSIMREQUEST_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimcontactfetchrequest.h b/plugins/contacts/symbiansim/inc/cntsimcontactfetchrequest.h
index 4790548ada..95ce2109e1 100644
--- a/plugins/contacts/symbiansim/inc/cntsimcontactfetchrequest.h
+++ b/plugins/contacts/symbiansim/inc/cntsimcontactfetchrequest.h
@@ -1,64 +1,64 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMCONTACTFETCHREQUEST_H_
-#define CNTSIMCONTACTFETCHREQUEST_H_
-
-#include "cntabstractsimrequest.h"
-
-QTM_USE_NAMESPACE
-
-class CntSimContactFetchRequest : public CntAbstractSimRequest
-{
-Q_OBJECT
-public:
- CntSimContactFetchRequest(CntSymbianSimEngine *engine, QContactFetchRequest *req);
- ~CntSimContactFetchRequest();
-
-public Q_SLOTS:
- // from CntAbstractSimRequest
- void run();
-
-private Q_SLOTS:
- void readComplete(QList<QContact> contacts, QContactManager::Error error);
-};
-
-#endif // CNTSIMCONTACTFETCHREQUEST_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMCONTACTFETCHREQUEST_H_
+#define CNTSIMCONTACTFETCHREQUEST_H_
+
+#include "cntabstractsimrequest.h"
+
+QTM_USE_NAMESPACE
+
+class CntSimContactFetchRequest : public CntAbstractSimRequest
+{
+Q_OBJECT
+public:
+ CntSimContactFetchRequest(CntSymbianSimEngine *engine, QContactFetchRequest *req);
+ ~CntSimContactFetchRequest();
+
+public Q_SLOTS:
+ // from CntAbstractSimRequest
+ void run();
+
+private Q_SLOTS:
+ void readComplete(QList<QContact> contacts, QContactManager::Error error);
+};
+
+#endif // CNTSIMCONTACTFETCHREQUEST_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimcontactlocalidfetchrequest.h b/plugins/contacts/symbiansim/inc/cntsimcontactlocalidfetchrequest.h
index 949082bc88..10de7a8134 100644
--- a/plugins/contacts/symbiansim/inc/cntsimcontactlocalidfetchrequest.h
+++ b/plugins/contacts/symbiansim/inc/cntsimcontactlocalidfetchrequest.h
@@ -1,64 +1,64 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMCONTACTLOCALIDFETCHREQUEST_H_
-#define CNTSIMCONTACTLOCALIDFETCHREQUEST_H_
-
-#include "cntabstractsimrequest.h"
-
-QTM_USE_NAMESPACE
-
-class CntSimContactLocalIdFetchRequest : public CntAbstractSimRequest
-{
-Q_OBJECT
-public:
- CntSimContactLocalIdFetchRequest(CntSymbianSimEngine *engine, QContactLocalIdFetchRequest *req);
- virtual ~CntSimContactLocalIdFetchRequest();
-
-public Q_SLOTS:
- // from CntAbstractSimRequest
- void run();
-
-private Q_SLOTS:
- void readComplete(QList<QContact> contacts, QContactManager::Error error);
-};
-
-#endif // CNTSIMCONTACTLOCALIDFETCHREQUEST_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMCONTACTLOCALIDFETCHREQUEST_H_
+#define CNTSIMCONTACTLOCALIDFETCHREQUEST_H_
+
+#include "cntabstractsimrequest.h"
+
+QTM_USE_NAMESPACE
+
+class CntSimContactLocalIdFetchRequest : public CntAbstractSimRequest
+{
+Q_OBJECT
+public:
+ CntSimContactLocalIdFetchRequest(CntSymbianSimEngine *engine, QContactLocalIdFetchRequest *req);
+ virtual ~CntSimContactLocalIdFetchRequest();
+
+public Q_SLOTS:
+ // from CntAbstractSimRequest
+ void run();
+
+private Q_SLOTS:
+ void readComplete(QList<QContact> contacts, QContactManager::Error error);
+};
+
+#endif // CNTSIMCONTACTLOCALIDFETCHREQUEST_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimcontactremoverequest.h b/plugins/contacts/symbiansim/inc/cntsimcontactremoverequest.h
index e7bdf28544..dbffd5f019 100644
--- a/plugins/contacts/symbiansim/inc/cntsimcontactremoverequest.h
+++ b/plugins/contacts/symbiansim/inc/cntsimcontactremoverequest.h
@@ -1,73 +1,73 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMCONTACTREMOVEREQUEST_H_
-#define CNTSIMCONTACTREMOVEREQUEST_H_
-
-#include "cntabstractsimrequest.h"
-
-QTM_USE_NAMESPACE
-
-class CntSimContactRemoveRequest : public CntAbstractSimRequest
-{
-Q_OBJECT
-public:
- CntSimContactRemoveRequest(CntSymbianSimEngine *engine, QContactRemoveRequest *req);
- virtual ~CntSimContactRemoveRequest();
-
-public Q_SLOTS:
- // from CntAbstractSimRequest
- void run();
-
-private Q_SLOTS:
- void removeComplete(QContactManager::Error error);
- void removeNext();
- void getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error);
- void getReservedSlots();
-
-private:
- QList<QContactLocalId> m_contactIds;
- int m_index;
- QMap<int, QContactManager::Error> m_errorMap;
- QList<int> m_reservedSlots;
-};
-
-#endif // CNTSIMCONTACTREMOVEREQUEST_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMCONTACTREMOVEREQUEST_H_
+#define CNTSIMCONTACTREMOVEREQUEST_H_
+
+#include "cntabstractsimrequest.h"
+
+QTM_USE_NAMESPACE
+
+class CntSimContactRemoveRequest : public CntAbstractSimRequest
+{
+Q_OBJECT
+public:
+ CntSimContactRemoveRequest(CntSymbianSimEngine *engine, QContactRemoveRequest *req);
+ virtual ~CntSimContactRemoveRequest();
+
+public Q_SLOTS:
+ // from CntAbstractSimRequest
+ void run();
+
+private Q_SLOTS:
+ void removeComplete(QContactManager::Error error);
+ void removeNext();
+ void getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error);
+ void getReservedSlots();
+
+private:
+ QList<QContactLocalId> m_contactIds;
+ int m_index;
+ QMap<int, QContactManager::Error> m_errorMap;
+ QList<int> m_reservedSlots;
+};
+
+#endif // CNTSIMCONTACTREMOVEREQUEST_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimcontactsaverequest.h b/plugins/contacts/symbiansim/inc/cntsimcontactsaverequest.h
index 05b8192d89..1ad22d0aed 100644
--- a/plugins/contacts/symbiansim/inc/cntsimcontactsaverequest.h
+++ b/plugins/contacts/symbiansim/inc/cntsimcontactsaverequest.h
@@ -1,70 +1,70 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMCONTACTSAVEREQUEST_H_
-#define CNTSIMCONTACTSAVEREQUEST_H_
-
-#include "cntabstractsimrequest.h"
-
-QTM_USE_NAMESPACE
-
-class CntSimContactSaveRequest : public CntAbstractSimRequest
-{
-Q_OBJECT
-public:
- CntSimContactSaveRequest(CntSymbianSimEngine *engine, QContactSaveRequest *req);
- virtual ~CntSimContactSaveRequest();
-
-public Q_SLOTS:
- // from CntAbstractSimRequest
- void run();
-
-private Q_SLOTS:
- void writeComplete(QContact contact, QContactManager::Error error);
- void writeNext();
-
-private:
- QList<QContact> m_contacts;
- int m_index;
- QMap<int, QContactManager::Error> m_errorMap;
-};
-
-#endif // CNTSIMCONTACTSAVEREQUEST_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMCONTACTSAVEREQUEST_H_
+#define CNTSIMCONTACTSAVEREQUEST_H_
+
+#include "cntabstractsimrequest.h"
+
+QTM_USE_NAMESPACE
+
+class CntSimContactSaveRequest : public CntAbstractSimRequest
+{
+Q_OBJECT
+public:
+ CntSimContactSaveRequest(CntSymbianSimEngine *engine, QContactSaveRequest *req);
+ virtual ~CntSimContactSaveRequest();
+
+public Q_SLOTS:
+ // from CntAbstractSimRequest
+ void run();
+
+private Q_SLOTS:
+ void writeComplete(QContact contact, QContactManager::Error error);
+ void writeNext();
+
+private:
+ QList<QContact> m_contacts;
+ int m_index;
+ QMap<int, QContactManager::Error> m_errorMap;
+};
+
+#endif // CNTSIMCONTACTSAVEREQUEST_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimdetaildefinitionfetchrequest.h b/plugins/contacts/symbiansim/inc/cntsimdetaildefinitionfetchrequest.h
index 391ad0ac0a..848dee20f1 100644
--- a/plugins/contacts/symbiansim/inc/cntsimdetaildefinitionfetchrequest.h
+++ b/plugins/contacts/symbiansim/inc/cntsimdetaildefinitionfetchrequest.h
@@ -1,61 +1,61 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMDETAILDEFINITIONFETCHREQUEST_H_
-#define CNTSIMDETAILDEFINITIONFETCHREQUEST_H_
-
-#include "cntabstractsimrequest.h"
-
-QTM_USE_NAMESPACE
-
-class CntSimDetailDefinitionFetchRequest : public CntAbstractSimRequest
-{
-Q_OBJECT
-public:
- CntSimDetailDefinitionFetchRequest(CntSymbianSimEngine *engine, QContactDetailDefinitionFetchRequest *req);
- virtual ~CntSimDetailDefinitionFetchRequest();
-
-public Q_SLOTS:
- // from CntAbstractSimRequest
- void run();
-};
-
-#endif // CNTSIMDETAILDEFINITIONFETCHREQUEST_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMDETAILDEFINITIONFETCHREQUEST_H_
+#define CNTSIMDETAILDEFINITIONFETCHREQUEST_H_
+
+#include "cntabstractsimrequest.h"
+
+QTM_USE_NAMESPACE
+
+class CntSimDetailDefinitionFetchRequest : public CntAbstractSimRequest
+{
+Q_OBJECT
+public:
+ CntSimDetailDefinitionFetchRequest(CntSymbianSimEngine *engine, QContactDetailDefinitionFetchRequest *req);
+ virtual ~CntSimDetailDefinitionFetchRequest();
+
+public Q_SLOTS:
+ // from CntAbstractSimRequest
+ void run();
+};
+
+#endif // CNTSIMDETAILDEFINITIONFETCHREQUEST_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimstore.h b/plugins/contacts/symbiansim/inc/cntsimstore.h
index d8d3ccd4cd..45a1e57167 100644
--- a/plugins/contacts/symbiansim/inc/cntsimstore.h
+++ b/plugins/contacts/symbiansim/inc/cntsimstore.h
@@ -1,101 +1,101 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMSTORE_H_
-#define CNTSIMSTORE_H_
-
-#include <e32base.h>
-#ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER
-#include <mpbutil_etel_test_server.h>
-#else
-#include <mpbutil.h>
-#endif
-#include <QObject>
-#include <qcontactmanager.h>
-
-QTM_USE_NAMESPACE
-
-#ifdef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
-typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV1 TSimStoreInfo;
-typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg TSimStoreInfoPckg;
-#else
-typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV5 TSimStoreInfo;
-typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg TSimStoreInfoPckg;
-#endif
-
-class CntSimStorePrivate;
-class CntSymbianSimEngine;
-
-class CntSimStore : public QObject
-{
-Q_OBJECT
-public:
- CntSimStore(CntSymbianSimEngine* engine, QString storeName, QContactManager::Error &error);
- ~CntSimStore();
-
- QString storeName();
- TSimStoreInfo storeInfo();
-
- bool read(int index, int numSlots, QContactManager::Error &error);
- bool write(const QContact &contact, QContactManager::Error &error);
- bool remove(int index, QContactManager::Error &error);
- bool getReservedSlots(QContactManager::Error &error);
-
- void cancel();
- bool isBusy();
-
- TInt lastAsyncError();
-
-signals:
- // NOTE: Use Qt::QueuedConnection as connection type to make signals asynchronous.
- // CntSimStorePrivate emitting these signals is an active object and emitting
- // signals synchronously will corrupt the AO state.
- void readComplete(QList<QContact> contacts, QContactManager::Error error);
- void writeComplete(QContact contacts, QContactManager::Error error);
- void removeComplete(QContactManager::Error error);
- void getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error);
-
-private:
- CntSimStorePrivate *d_ptr;
- friend class CntSimStorePrivate;
-};
-
-#endif // CNTSIMSTORE_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMSTORE_H_
+#define CNTSIMSTORE_H_
+
+#include <e32base.h>
+#ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER
+#include <mpbutil_etel_test_server.h>
+#else
+#include <mpbutil.h>
+#endif
+#include <QObject>
+#include <qcontactmanager.h>
+
+QTM_USE_NAMESPACE
+
+#ifdef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
+typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV1 TSimStoreInfo;
+typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg TSimStoreInfoPckg;
+#else
+typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV5 TSimStoreInfo;
+typedef RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg TSimStoreInfoPckg;
+#endif
+
+class CntSimStorePrivate;
+class CntSymbianSimEngine;
+
+class CntSimStore : public QObject
+{
+Q_OBJECT
+public:
+ CntSimStore(CntSymbianSimEngine* engine, QString storeName, QContactManager::Error &error);
+ ~CntSimStore();
+
+ QString storeName();
+ TSimStoreInfo storeInfo();
+
+ bool read(int index, int numSlots, QContactManager::Error &error);
+ bool write(const QContact &contact, QContactManager::Error &error);
+ bool remove(int index, QContactManager::Error &error);
+ bool getReservedSlots(QContactManager::Error &error);
+
+ void cancel();
+ bool isBusy();
+
+ TInt lastAsyncError();
+
+signals:
+ // NOTE: Use Qt::QueuedConnection as connection type to make signals asynchronous.
+ // CntSimStorePrivate emitting these signals is an active object and emitting
+ // signals synchronously will corrupt the AO state.
+ void readComplete(QList<QContact> contacts, QContactManager::Error error);
+ void writeComplete(QContact contacts, QContactManager::Error error);
+ void removeComplete(QContactManager::Error error);
+ void getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error);
+
+private:
+ CntSimStorePrivate *d_ptr;
+ friend class CntSimStorePrivate;
+};
+
+#endif // CNTSIMSTORE_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimstoreeventlistener.h b/plugins/contacts/symbiansim/inc/cntsimstoreeventlistener.h
index 61bf257be8..e8dc745a22 100644
--- a/plugins/contacts/symbiansim/inc/cntsimstoreeventlistener.h
+++ b/plugins/contacts/symbiansim/inc/cntsimstoreeventlistener.h
@@ -1,69 +1,69 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMSTOREEVENTLISTENER_H_
-#define CNTSIMSTOREEVENTLISTENER_H_
-
-#include <e32base.h>
-
-class CntSymbianSimEngine;
-class RMobilePhoneBookStore;
-
-class CntSimStoreEventListener : public CActive
-{
-public:
- CntSimStoreEventListener(CntSymbianSimEngine &engine, RMobilePhoneBookStore& store);
- ~CntSimStoreEventListener();
-
- void start();
-
- // from CActive
- void DoCancel();
- void RunL();
-
-private:
- CntSymbianSimEngine &m_engine;
- RMobilePhoneBookStore &m_store;
- TUint32 m_event;
- TInt m_index;
-};
-
-#endif // CNTSIMSTOREEVENTLISTENER_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMSTOREEVENTLISTENER_H_
+#define CNTSIMSTOREEVENTLISTENER_H_
+
+#include <e32base.h>
+
+class CntSymbianSimEngine;
+class RMobilePhoneBookStore;
+
+class CntSimStoreEventListener : public CActive
+{
+public:
+ CntSimStoreEventListener(CntSymbianSimEngine &engine, RMobilePhoneBookStore& store);
+ ~CntSimStoreEventListener();
+
+ void start();
+
+ // from CActive
+ void DoCancel();
+ void RunL();
+
+private:
+ CntSymbianSimEngine &m_engine;
+ RMobilePhoneBookStore &m_store;
+ TUint32 m_event;
+ TInt m_index;
+};
+
+#endif // CNTSIMSTOREEVENTLISTENER_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsimstoreprivate.h b/plugins/contacts/symbiansim/inc/cntsimstoreprivate.h
index f31cb937b5..742a1d07d3 100644
--- a/plugins/contacts/symbiansim/inc/cntsimstoreprivate.h
+++ b/plugins/contacts/symbiansim/inc/cntsimstoreprivate.h
@@ -1,118 +1,118 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CNTSIMSTOREPRIVATE_H_
-#define CNTSIMSTOREPRIVATE_H_
-
-#include <e32base.h>
-#ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER
-#include <etelmm_etel_test_server.h>
-#else
-#include <etelmm.h>
-#endif
-#include <qcontact.h>
-
-#include "cntsymbiansimengine.h"
-#include "cntsimstore.h"
-
-QTM_USE_NAMESPACE
-
-class CntSimStore;
-class CntSymbianSimEngine;
-class CntSimStoreEventListener;
-
-class CntSimStorePrivate : public CActive
-{
-public:
- enum State {
- InactiveState,
- ReadState,
- WriteState,
- DeleteState,
- ReadReservedSlotsState
- };
- static CntSimStorePrivate* NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName);
- ~CntSimStorePrivate();
-
- QString storeName() { return m_storeName; }
- TSimStoreInfo storeInfo() { return m_storeInfo; }
-
- bool read(int index, int numSlots, QContactManager::Error &error);
- bool write(const QContact &contact, QContactManager::Error &error);
- bool remove(int index, QContactManager::Error &error);
- bool getReservedSlots(QContactManager::Error &error);
-
- TInt lastAsyncError() { return m_asyncError; }
-
-private:
- // from CActive
- void RunL();
- void DoCancel();
- TInt RunError(TInt aError);
-
-private:
- CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName);
- void ConstructL();
- void convertStoreNameL(TDes &storeName);
- QList<QContact> decodeSimContactsL(TDes8& rawData) const;
- QContact encodeSimContactL(const QContact* contact, TDes8& rawData) const;
- QList<int> decodeReservedSlotsL(TDes8& rawData) const;
-
-private:
- State m_state;
- CntSymbianSimEngine &m_engine;
- QString m_managerUri;
- CntSimStore &m_simStore;
- RTelServer m_etelServer;
- RMobilePhone m_etelPhone;
- RMobilePhoneBookStore m_etelStore;
- QString m_storeName;
- bool m_readOnlyAccess;
- TSimStoreInfo m_storeInfo;
- TSimStoreInfoPckg m_storeInfoPckg;
- RBuf8 m_buffer;
- QContact m_convertedContact;
- int m_writeIndex;
- CntSimStoreEventListener* m_listener;
- TInt m_asyncError;
-};
-
-#endif // CNTSIMSTOREPRIVATE_H_
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CNTSIMSTOREPRIVATE_H_
+#define CNTSIMSTOREPRIVATE_H_
+
+#include <e32base.h>
+#ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER
+#include <etelmm_etel_test_server.h>
+#else
+#include <etelmm.h>
+#endif
+#include <qcontact.h>
+
+#include "cntsymbiansimengine.h"
+#include "cntsimstore.h"
+
+QTM_USE_NAMESPACE
+
+class CntSimStore;
+class CntSymbianSimEngine;
+class CntSimStoreEventListener;
+
+class CntSimStorePrivate : public CActive
+{
+public:
+ enum State {
+ InactiveState,
+ ReadState,
+ WriteState,
+ DeleteState,
+ ReadReservedSlotsState
+ };
+ static CntSimStorePrivate* NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName);
+ ~CntSimStorePrivate();
+
+ QString storeName() { return m_storeName; }
+ TSimStoreInfo storeInfo() { return m_storeInfo; }
+
+ bool read(int index, int numSlots, QContactManager::Error &error);
+ bool write(const QContact &contact, QContactManager::Error &error);
+ bool remove(int index, QContactManager::Error &error);
+ bool getReservedSlots(QContactManager::Error &error);
+
+ TInt lastAsyncError() { return m_asyncError; }
+
+private:
+ // from CActive
+ void RunL();
+ void DoCancel();
+ TInt RunError(TInt aError);
+
+private:
+ CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName);
+ void ConstructL();
+ void convertStoreNameL(TDes &storeName);
+ QList<QContact> decodeSimContactsL(TDes8& rawData) const;
+ QContact encodeSimContactL(const QContact* contact, TDes8& rawData) const;
+ QList<int> decodeReservedSlotsL(TDes8& rawData) const;
+
+private:
+ State m_state;
+ CntSymbianSimEngine &m_engine;
+ QString m_managerUri;
+ CntSimStore &m_simStore;
+ RTelServer m_etelServer;
+ RMobilePhone m_etelPhone;
+ RMobilePhoneBookStore m_etelStore;
+ QString m_storeName;
+ bool m_readOnlyAccess;
+ TSimStoreInfo m_storeInfo;
+ TSimStoreInfoPckg m_storeInfoPckg;
+ RBuf8 m_buffer;
+ QContact m_convertedContact;
+ int m_writeIndex;
+ CntSimStoreEventListener* m_listener;
+ TInt m_asyncError;
+};
+
+#endif // CNTSIMSTOREPRIVATE_H_
diff --git a/plugins/contacts/symbiansim/inc/cntsymbiansimtransformerror.h b/plugins/contacts/symbiansim/inc/cntsymbiansimtransformerror.h
index 5e439294a8..789ec369f2 100644
--- a/plugins/contacts/symbiansim/inc/cntsymbiansimtransformerror.h
+++ b/plugins/contacts/symbiansim/inc/cntsymbiansimtransformerror.h
@@ -1,54 +1,54 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef CNTSYMBIANSIMTRANSFORMERROR_H
-#define CNTSYMBIANSIMTRANSFORMERROR_H
-
-#include <e32err.h>
-#include <qcontactmanager.h>
-
-QTM_USE_NAMESPACE
-class CntSymbianSimTransformError
-{
-public:
- static void transformError(TInt symbianError, QContactManager::Error& qtError);
-};
-
-#endif // CNTSYMBIANSIMTRANSFORMERROR_H
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef CNTSYMBIANSIMTRANSFORMERROR_H
+#define CNTSYMBIANSIMTRANSFORMERROR_H
+
+#include <e32err.h>
+#include <qcontactmanager.h>
+
+QTM_USE_NAMESPACE
+class CntSymbianSimTransformError
+{
+public:
+ static void transformError(TInt symbianError, QContactManager::Error& qtError);
+};
+
+#endif // CNTSYMBIANSIMTRANSFORMERROR_H
diff --git a/plugins/contacts/symbiansim/src/cntabstractsimrequest.cpp b/plugins/contacts/symbiansim/src/cntabstractsimrequest.cpp
index 6a99e76ad6..ece379c833 100644
--- a/plugins/contacts/symbiansim/src/cntabstractsimrequest.cpp
+++ b/plugins/contacts/symbiansim/src/cntabstractsimrequest.cpp
@@ -1,114 +1,114 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntabstractsimrequest.h"
-#include "cntsymbiansimengine.h"
-#include "cntsimstore.h"
-#include <QTimer>
-
-CntAbstractSimRequest::CntAbstractSimRequest(CntSymbianSimEngine *engine, QContactAbstractRequest *req)
- :QObject(engine),
- m_request(req),
- m_timer(0),
- m_retryCount(0)
-{
-
-}
-
-bool CntAbstractSimRequest::start()
-{
- if (m_request->isActive())
- return false;
-
- m_retryCount = 0;
-
- singleShotTimer(KRequestDelay, this, SLOT(run()));
- QContactManagerEngine::updateRequestState(m_request, QContactAbstractRequest::ActiveState);
- return true;
-}
-
-bool CntAbstractSimRequest::cancel()
-{
- if (m_request->isActive()) {
- cancelTimer();
- simStore()->cancel();
- QContactManagerEngine::updateRequestState(m_request, QContactAbstractRequest::CanceledState);
- return true;
- }
- return false;
-}
-
-bool CntAbstractSimRequest::waitAndRetry()
-{
- if (m_retryCount < KMaxRetryCount)
- {
- singleShotTimer(KRequestDelay, this, SLOT(run()));
- m_retryCount++;
- return true;
- }
- return false;
-}
-
-void CntAbstractSimRequest::singleShotTimer(int msec, QObject *receiver, const char *member)
-{
- // We could use QTimer::singleShot but there is no way to cancel it...
- delete m_timer;
- m_timer = new QTimer(this);
- m_timer->setSingleShot(true);
- connect(m_timer, SIGNAL(timeout()), receiver, member);
- m_timer->start(msec);
-}
-
-void CntAbstractSimRequest::cancelTimer()
-{
- delete m_timer;
- m_timer = 0;
-}
-
-CntSymbianSimEngine *CntAbstractSimRequest::engine()
-{
- return static_cast<CntSymbianSimEngine*>(parent());
-}
-
-CntSimStore *CntAbstractSimRequest::simStore()
-{
- return engine()->simStore();
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntabstractsimrequest.h"
+#include "cntsymbiansimengine.h"
+#include "cntsimstore.h"
+#include <QTimer>
+
+CntAbstractSimRequest::CntAbstractSimRequest(CntSymbianSimEngine *engine, QContactAbstractRequest *req)
+ :QObject(engine),
+ m_request(req),
+ m_timer(0),
+ m_retryCount(0)
+{
+
+}
+
+bool CntAbstractSimRequest::start()
+{
+ if (m_request->isActive())
+ return false;
+
+ m_retryCount = 0;
+
+ singleShotTimer(KRequestDelay, this, SLOT(run()));
+ QContactManagerEngine::updateRequestState(m_request, QContactAbstractRequest::ActiveState);
+ return true;
+}
+
+bool CntAbstractSimRequest::cancel()
+{
+ if (m_request->isActive()) {
+ cancelTimer();
+ simStore()->cancel();
+ QContactManagerEngine::updateRequestState(m_request, QContactAbstractRequest::CanceledState);
+ return true;
+ }
+ return false;
+}
+
+bool CntAbstractSimRequest::waitAndRetry()
+{
+ if (m_retryCount < KMaxRetryCount)
+ {
+ singleShotTimer(KRequestDelay, this, SLOT(run()));
+ m_retryCount++;
+ return true;
+ }
+ return false;
+}
+
+void CntAbstractSimRequest::singleShotTimer(int msec, QObject *receiver, const char *member)
+{
+ // We could use QTimer::singleShot but there is no way to cancel it...
+ delete m_timer;
+ m_timer = new QTimer(this);
+ m_timer->setSingleShot(true);
+ connect(m_timer, SIGNAL(timeout()), receiver, member);
+ m_timer->start(msec);
+}
+
+void CntAbstractSimRequest::cancelTimer()
+{
+ delete m_timer;
+ m_timer = 0;
+}
+
+CntSymbianSimEngine *CntAbstractSimRequest::engine()
+{
+ return static_cast<CntSymbianSimEngine*>(parent());
+}
+
+CntSimStore *CntAbstractSimRequest::simStore()
+{
+ return engine()->simStore();
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimcontactfetchrequest.cpp b/plugins/contacts/symbiansim/src/cntsimcontactfetchrequest.cpp
index 7a5da93b3b..421a944775 100644
--- a/plugins/contacts/symbiansim/src/cntsimcontactfetchrequest.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimcontactfetchrequest.cpp
@@ -1,117 +1,117 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimcontactfetchrequest.h"
-#include "cntsymbiansimengine.h"
-#include "cntsimstore.h"
-#include <qcontactfetchrequest.h>
-#include <qcontactlocalidfilter.h>
-
-CntSimContactFetchRequest::CntSimContactFetchRequest(CntSymbianSimEngine *engine, QContactFetchRequest *req)
- :CntAbstractSimRequest(engine, req)
-{
- connect( simStore(), SIGNAL(readComplete(QList<QContact>, QContactManager::Error)),
- this, SLOT(readComplete(QList<QContact>, QContactManager::Error)), Qt::QueuedConnection );
-}
-
-CntSimContactFetchRequest::~CntSimContactFetchRequest()
-{
- cancel();
-}
-
-void CntSimContactFetchRequest::run()
-{
- QContactFetchRequest *r = req<QContactFetchRequest>();
-
- if (!r->isActive())
- return;
-
- // Get filter
- QContactLocalIdFilter lidFilter;
- if (r->filter().type() == QContactFilter::LocalIdFilter) {
- lidFilter = static_cast<QContactLocalIdFilter>(r->filter());
- }
-
- // Fetch all contacts and filter the results.
- // Contacts are fetched starting from index 1, all slots are read
- // since slots may be not filled in a sequence.
- int index = 1;
- int numSlots = simStore()->storeInfo().iTotalEntries;
-
- if (lidFilter.ids().count() == 1) {
- // Optimization for performance. Fetch a single contact from store.
- // This is mainly for CntSymbianSimEngine::contact().
- index = lidFilter.ids().at(0);
- numSlots = 1;
- }
-
- QContactManager::Error error = QContactManager::NoError;
- if (!simStore()->read(index, numSlots, error)) {
- QContactManagerEngine::updateContactFetchRequest(r, QList<QContact>(), error, QContactAbstractRequest::FinishedState);
- }
-}
-
-void CntSimContactFetchRequest::readComplete(QList<QContact> contacts, QContactManager::Error error)
-{
- QContactFetchRequest *r = req<QContactFetchRequest>();
-
- if (!r->isActive())
- return;
-
- // Sometimes the sim store will return server busy error. All we can do is
- // wait and try again. The error seems to occur if we try to read from the
- // store right after writing some contacts to it.
- // This was observed with S60 5.0 HW (Tube).
- if (simStore()->lastAsyncError() == KErrServerBusy) {
- if (waitAndRetry())
- return;
- }
-
- // Filter & sort results
- QList<QContact> filteredAndSorted;
- for (int i=0; i<contacts.count(); i++) {
- if (QContactManagerEngine::testFilter(r->filter(), contacts.at(i)))
- QContactManagerEngine::addSorted(&filteredAndSorted, contacts.at(i), r->sorting());
- }
-
- // Complete the request
- QContactManagerEngine::updateContactFetchRequest(r, filteredAndSorted, error, QContactAbstractRequest::FinishedState);
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimcontactfetchrequest.h"
+#include "cntsymbiansimengine.h"
+#include "cntsimstore.h"
+#include <qcontactfetchrequest.h>
+#include <qcontactlocalidfilter.h>
+
+CntSimContactFetchRequest::CntSimContactFetchRequest(CntSymbianSimEngine *engine, QContactFetchRequest *req)
+ :CntAbstractSimRequest(engine, req)
+{
+ connect( simStore(), SIGNAL(readComplete(QList<QContact>, QContactManager::Error)),
+ this, SLOT(readComplete(QList<QContact>, QContactManager::Error)), Qt::QueuedConnection );
+}
+
+CntSimContactFetchRequest::~CntSimContactFetchRequest()
+{
+ cancel();
+}
+
+void CntSimContactFetchRequest::run()
+{
+ QContactFetchRequest *r = req<QContactFetchRequest>();
+
+ if (!r->isActive())
+ return;
+
+ // Get filter
+ QContactLocalIdFilter lidFilter;
+ if (r->filter().type() == QContactFilter::LocalIdFilter) {
+ lidFilter = static_cast<QContactLocalIdFilter>(r->filter());
+ }
+
+ // Fetch all contacts and filter the results.
+ // Contacts are fetched starting from index 1, all slots are read
+ // since slots may be not filled in a sequence.
+ int index = 1;
+ int numSlots = simStore()->storeInfo().iTotalEntries;
+
+ if (lidFilter.ids().count() == 1) {
+ // Optimization for performance. Fetch a single contact from store.
+ // This is mainly for CntSymbianSimEngine::contact().
+ index = lidFilter.ids().at(0);
+ numSlots = 1;
+ }
+
+ QContactManager::Error error = QContactManager::NoError;
+ if (!simStore()->read(index, numSlots, error)) {
+ QContactManagerEngine::updateContactFetchRequest(r, QList<QContact>(), error, QContactAbstractRequest::FinishedState);
+ }
+}
+
+void CntSimContactFetchRequest::readComplete(QList<QContact> contacts, QContactManager::Error error)
+{
+ QContactFetchRequest *r = req<QContactFetchRequest>();
+
+ if (!r->isActive())
+ return;
+
+ // Sometimes the sim store will return server busy error. All we can do is
+ // wait and try again. The error seems to occur if we try to read from the
+ // store right after writing some contacts to it.
+ // This was observed with S60 5.0 HW (Tube).
+ if (simStore()->lastAsyncError() == KErrServerBusy) {
+ if (waitAndRetry())
+ return;
+ }
+
+ // Filter & sort results
+ QList<QContact> filteredAndSorted;
+ for (int i=0; i<contacts.count(); i++) {
+ if (QContactManagerEngine::testFilter(r->filter(), contacts.at(i)))
+ QContactManagerEngine::addSorted(&filteredAndSorted, contacts.at(i), r->sorting());
+ }
+
+ // Complete the request
+ QContactManagerEngine::updateContactFetchRequest(r, filteredAndSorted, error, QContactAbstractRequest::FinishedState);
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimcontactlocalidfetchrequest.cpp b/plugins/contacts/symbiansim/src/cntsimcontactlocalidfetchrequest.cpp
index 1376f67826..267e210a3e 100644
--- a/plugins/contacts/symbiansim/src/cntsimcontactlocalidfetchrequest.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimcontactlocalidfetchrequest.cpp
@@ -1,110 +1,110 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimcontactlocalidfetchrequest.h"
-#include "cntsymbiansimengine.h"
-#include "cntsimstore.h"
-#include <qcontactfetchrequest.h>
-
-CntSimContactLocalIdFetchRequest::CntSimContactLocalIdFetchRequest(CntSymbianSimEngine *engine, QContactLocalIdFetchRequest *req)
- :CntAbstractSimRequest(engine, req)
-{
- connect( simStore(), SIGNAL(readComplete(QList<QContact>, QContactManager::Error)),
- this, SLOT(readComplete(QList<QContact>, QContactManager::Error)), Qt::QueuedConnection );
-}
-
-CntSimContactLocalIdFetchRequest::~CntSimContactLocalIdFetchRequest()
-{
- cancel();
-}
-
-void CntSimContactLocalIdFetchRequest::run()
-{
- QContactLocalIdFetchRequest *r = req<QContactLocalIdFetchRequest>();
-
- if (!r->isActive())
- return;
-
- // Contacts are fetched starting from index 1, all slots are read
- // since slots may be not filled in a sequence.
- int index = 1;
- int numSlots = simStore()->storeInfo().iTotalEntries;
-
- QContactManager::Error error = QContactManager::NoError;
- if (!simStore()->read(index, numSlots, error)) {
- QContactManagerEngine::updateContactLocalIdFetchRequest(r, QList<QContactLocalId>(), error, QContactAbstractRequest::FinishedState);
- }
-}
-
-void CntSimContactLocalIdFetchRequest::readComplete(QList<QContact> contacts, QContactManager::Error error)
-{
- QContactLocalIdFetchRequest *r = req<QContactLocalIdFetchRequest>();
-
- if (!r->isActive())
- return;
-
- // Sometimes the sim store will return server busy error. All we can do is
- // wait and try again. The error seems to occur if we try to read from the
- // store right after writing some contacts to it.
- // This was observed with S60 5.0 HW (Tube).
- if (error == QContactManager::UnspecifiedError &&
- simStore()->lastAsyncError() == KErrServerBusy)
- {
- if (waitAndRetry())
- return;
- }
-
- // Filter & sort results
- QList<QContact> filteredAndSorted;
- for (int i=0; i<contacts.count(); i++) {
- if (QContactManagerEngine::testFilter(r->filter(), contacts.at(i)))
- QContactManagerEngine::addSorted(&filteredAndSorted, contacts.at(i), r->sorting());
- }
-
- // Convert to QContactLocalId-list
- QList<QContactLocalId> filteredAndSortedIds;
- for (int i=0; i<filteredAndSorted.count(); i++) {
- filteredAndSortedIds << filteredAndSorted.at(i).localId();
- }
-
- // Complete the request
- QContactManagerEngine::updateContactLocalIdFetchRequest(r, filteredAndSortedIds, error, QContactAbstractRequest::FinishedState);
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimcontactlocalidfetchrequest.h"
+#include "cntsymbiansimengine.h"
+#include "cntsimstore.h"
+#include <qcontactfetchrequest.h>
+
+CntSimContactLocalIdFetchRequest::CntSimContactLocalIdFetchRequest(CntSymbianSimEngine *engine, QContactLocalIdFetchRequest *req)
+ :CntAbstractSimRequest(engine, req)
+{
+ connect( simStore(), SIGNAL(readComplete(QList<QContact>, QContactManager::Error)),
+ this, SLOT(readComplete(QList<QContact>, QContactManager::Error)), Qt::QueuedConnection );
+}
+
+CntSimContactLocalIdFetchRequest::~CntSimContactLocalIdFetchRequest()
+{
+ cancel();
+}
+
+void CntSimContactLocalIdFetchRequest::run()
+{
+ QContactLocalIdFetchRequest *r = req<QContactLocalIdFetchRequest>();
+
+ if (!r->isActive())
+ return;
+
+ // Contacts are fetched starting from index 1, all slots are read
+ // since slots may be not filled in a sequence.
+ int index = 1;
+ int numSlots = simStore()->storeInfo().iTotalEntries;
+
+ QContactManager::Error error = QContactManager::NoError;
+ if (!simStore()->read(index, numSlots, error)) {
+ QContactManagerEngine::updateContactLocalIdFetchRequest(r, QList<QContactLocalId>(), error, QContactAbstractRequest::FinishedState);
+ }
+}
+
+void CntSimContactLocalIdFetchRequest::readComplete(QList<QContact> contacts, QContactManager::Error error)
+{
+ QContactLocalIdFetchRequest *r = req<QContactLocalIdFetchRequest>();
+
+ if (!r->isActive())
+ return;
+
+ // Sometimes the sim store will return server busy error. All we can do is
+ // wait and try again. The error seems to occur if we try to read from the
+ // store right after writing some contacts to it.
+ // This was observed with S60 5.0 HW (Tube).
+ if (error == QContactManager::UnspecifiedError &&
+ simStore()->lastAsyncError() == KErrServerBusy)
+ {
+ if (waitAndRetry())
+ return;
+ }
+
+ // Filter & sort results
+ QList<QContact> filteredAndSorted;
+ for (int i=0; i<contacts.count(); i++) {
+ if (QContactManagerEngine::testFilter(r->filter(), contacts.at(i)))
+ QContactManagerEngine::addSorted(&filteredAndSorted, contacts.at(i), r->sorting());
+ }
+
+ // Convert to QContactLocalId-list
+ QList<QContactLocalId> filteredAndSortedIds;
+ for (int i=0; i<filteredAndSorted.count(); i++) {
+ filteredAndSortedIds << filteredAndSorted.at(i).localId();
+ }
+
+ // Complete the request
+ QContactManagerEngine::updateContactLocalIdFetchRequest(r, filteredAndSortedIds, error, QContactAbstractRequest::FinishedState);
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp b/plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp
index 60279c1e11..ab35c66f63 100644
--- a/plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimcontactremoverequest.cpp
@@ -1,164 +1,164 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimcontactremoverequest.h"
-#include "cntsymbiansimengine.h"
-#include "cntsimstore.h"
-#include <qcontactremoverequest.h>
-#include <QDebug>
-
-CntSimContactRemoveRequest::CntSimContactRemoveRequest(CntSymbianSimEngine *engine, QContactRemoveRequest *req)
- :CntAbstractSimRequest(engine, req)
-{
- connect( simStore(), SIGNAL(removeComplete(QContactManager::Error)),
- this, SLOT(removeComplete(QContactManager::Error)), Qt::QueuedConnection );
-
- connect( simStore(), SIGNAL(getReservedSlotsComplete(QList<int>, QContactManager::Error)),
- this, SLOT(getReservedSlotsComplete(QList<int>, QContactManager::Error)), Qt::QueuedConnection );
-}
-
-CntSimContactRemoveRequest::~CntSimContactRemoveRequest()
-{
- cancel();
-}
-
-void CntSimContactRemoveRequest::run()
-{
- QContactRemoveRequest *r = req<QContactRemoveRequest>();
-
- if (!r->isActive())
- return;
-
- m_contactIds = r->contactIds();
- m_errorMap.clear();
- m_index = 0;
-#ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE
- m_reservedSlots.clear();
- getReservedSlots();
-#else
- removeNext();
-#endif
-}
-
-void CntSimContactRemoveRequest::removeComplete(QContactManager::Error error)
-{
- if (!req()->isActive())
- return;
-
- if (error)
- m_errorMap.insert(m_index, error);
-
- m_index++;
- singleShotTimer(KRequestDelay, this, SLOT(removeNext()));
-}
-
-void CntSimContactRemoveRequest::removeNext()
-{
- QContactRemoveRequest *r = req<QContactRemoveRequest>();
-
- if (!r->isActive())
- return;
-
- if (r->contactIds().count() == 0) {
- QContactManagerEngine::updateContactRemoveRequest(r, QContactManager::BadArgumentError, m_errorMap, QContactAbstractRequest::FinishedState);
- return;
- }
-
- // All contacts removed?
- if (m_index >= m_contactIds.count())
- {
- // Take first error from errormap (if any)
- QContactManager::Error error = QContactManager::NoError;
- if (m_errorMap.count())
- error = m_errorMap.begin().value();
-
- QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState);
- return;
- }
-
- // Remove next contact
- QContactLocalId contactId = m_contactIds.at(m_index);
- QContactManager::Error error = QContactManager::NoError;
-
-#ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE
- if (m_reservedSlots.contains(contactId))
- simStore()->remove(contactId, error);
- else
- error = QContactManager::DoesNotExistError;
-#else
- simStore()->remove(contactId, error);
-#endif
-
- if (error) {
- m_errorMap.insert(m_index, error);
- m_index++;
- singleShotTimer(KRequestDelay, this, SLOT(removeNext()));
- }
-}
-
-void CntSimContactRemoveRequest::getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error)
-{
- QContactRemoveRequest *r = req<QContactRemoveRequest>();
-
- if (!r->isActive())
- return;
-
- if (error != QContactManager::NoError && error != QContactManager::DoesNotExistError) {
- QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState);
- return;
- }
-
- m_reservedSlots = reservedSlots;
- singleShotTimer(KRequestDelay, this, SLOT(removeNext()));
-}
-
-void CntSimContactRemoveRequest::getReservedSlots()
-{
- QContactRemoveRequest *r = req<QContactRemoveRequest>();
-
- if (!r->isActive())
- return;
-
- QContactManager::Error error = QContactManager::NoError;
- if (!simStore()->getReservedSlots(error)) {
- QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState);
- }
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimcontactremoverequest.h"
+#include "cntsymbiansimengine.h"
+#include "cntsimstore.h"
+#include <qcontactremoverequest.h>
+#include <QDebug>
+
+CntSimContactRemoveRequest::CntSimContactRemoveRequest(CntSymbianSimEngine *engine, QContactRemoveRequest *req)
+ :CntAbstractSimRequest(engine, req)
+{
+ connect( simStore(), SIGNAL(removeComplete(QContactManager::Error)),
+ this, SLOT(removeComplete(QContactManager::Error)), Qt::QueuedConnection );
+
+ connect( simStore(), SIGNAL(getReservedSlotsComplete(QList<int>, QContactManager::Error)),
+ this, SLOT(getReservedSlotsComplete(QList<int>, QContactManager::Error)), Qt::QueuedConnection );
+}
+
+CntSimContactRemoveRequest::~CntSimContactRemoveRequest()
+{
+ cancel();
+}
+
+void CntSimContactRemoveRequest::run()
+{
+ QContactRemoveRequest *r = req<QContactRemoveRequest>();
+
+ if (!r->isActive())
+ return;
+
+ m_contactIds = r->contactIds();
+ m_errorMap.clear();
+ m_index = 0;
+#ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE
+ m_reservedSlots.clear();
+ getReservedSlots();
+#else
+ removeNext();
+#endif
+}
+
+void CntSimContactRemoveRequest::removeComplete(QContactManager::Error error)
+{
+ if (!req()->isActive())
+ return;
+
+ if (error)
+ m_errorMap.insert(m_index, error);
+
+ m_index++;
+ singleShotTimer(KRequestDelay, this, SLOT(removeNext()));
+}
+
+void CntSimContactRemoveRequest::removeNext()
+{
+ QContactRemoveRequest *r = req<QContactRemoveRequest>();
+
+ if (!r->isActive())
+ return;
+
+ if (r->contactIds().count() == 0) {
+ QContactManagerEngine::updateContactRemoveRequest(r, QContactManager::BadArgumentError, m_errorMap, QContactAbstractRequest::FinishedState);
+ return;
+ }
+
+ // All contacts removed?
+ if (m_index >= m_contactIds.count())
+ {
+ // Take first error from errormap (if any)
+ QContactManager::Error error = QContactManager::NoError;
+ if (m_errorMap.count())
+ error = m_errorMap.begin().value();
+
+ QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState);
+ return;
+ }
+
+ // Remove next contact
+ QContactLocalId contactId = m_contactIds.at(m_index);
+ QContactManager::Error error = QContactManager::NoError;
+
+#ifdef SYMBIANSIM_BACKEND_CHECK_BEFORE_REMOVE
+ if (m_reservedSlots.contains(contactId))
+ simStore()->remove(contactId, error);
+ else
+ error = QContactManager::DoesNotExistError;
+#else
+ simStore()->remove(contactId, error);
+#endif
+
+ if (error) {
+ m_errorMap.insert(m_index, error);
+ m_index++;
+ singleShotTimer(KRequestDelay, this, SLOT(removeNext()));
+ }
+}
+
+void CntSimContactRemoveRequest::getReservedSlotsComplete(QList<int> reservedSlots, QContactManager::Error error)
+{
+ QContactRemoveRequest *r = req<QContactRemoveRequest>();
+
+ if (!r->isActive())
+ return;
+
+ if (error != QContactManager::NoError && error != QContactManager::DoesNotExistError) {
+ QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState);
+ return;
+ }
+
+ m_reservedSlots = reservedSlots;
+ singleShotTimer(KRequestDelay, this, SLOT(removeNext()));
+}
+
+void CntSimContactRemoveRequest::getReservedSlots()
+{
+ QContactRemoveRequest *r = req<QContactRemoveRequest>();
+
+ if (!r->isActive())
+ return;
+
+ QContactManager::Error error = QContactManager::NoError;
+ if (!simStore()->getReservedSlots(error)) {
+ QContactManagerEngine::updateContactRemoveRequest(r, error, m_errorMap, QContactAbstractRequest::FinishedState);
+ }
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimcontactsaverequest.cpp b/plugins/contacts/symbiansim/src/cntsimcontactsaverequest.cpp
index b3e59ac52b..3187a5ee67 100644
--- a/plugins/contacts/symbiansim/src/cntsimcontactsaverequest.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimcontactsaverequest.cpp
@@ -1,123 +1,123 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimcontactsaverequest.h"
-#include "cntsymbiansimengine.h"
-#include "cntsimstore.h"
-#include <qcontactsaverequest.h>
-
-CntSimContactSaveRequest::CntSimContactSaveRequest(CntSymbianSimEngine *engine, QContactSaveRequest *req)
- :CntAbstractSimRequest(engine, req)
-{
- connect( simStore(), SIGNAL(writeComplete(QContact, QContactManager::Error)),
- this, SLOT(writeComplete(QContact, QContactManager::Error)), Qt::QueuedConnection );
-}
-
-CntSimContactSaveRequest::~CntSimContactSaveRequest()
-{
- cancel();
-}
-
-void CntSimContactSaveRequest::run()
-{
- QContactSaveRequest *r = req<QContactSaveRequest>();
-
- if (!r->isActive())
- return;
-
- m_contacts = r->contacts();
- m_errorMap.clear();
- m_index = 0;
-
- writeNext();
-}
-
-void CntSimContactSaveRequest::writeComplete(QContact contact, QContactManager::Error error)
-{
- if (!req()->isActive())
- return;
-
- if (error)
- m_errorMap.insert(m_index, error);
- engine()->updateDisplayLabel(contact);
- m_contacts[m_index] = contact;
- m_index++;
- singleShotTimer(KRequestDelay, this, SLOT(writeNext()));
-}
-
-void CntSimContactSaveRequest::writeNext()
-{
- QContactSaveRequest *r = req<QContactSaveRequest>();
-
- if (!r->isActive())
- return;
-
- if (r->contacts().count() == 0) {
- QContactManagerEngine::updateContactSaveRequest(r, QList<QContact>(), QContactManager::BadArgumentError, m_errorMap, QContactAbstractRequest::FinishedState);
- return;
- }
-
- // All contacts written?
- if (m_index >= m_contacts.count())
- {
- // Take first error from errormap (if any)
- QContactManager::Error error = QContactManager::NoError;
- if (m_errorMap.count())
- error = m_errorMap.begin().value();
-
- QContactManagerEngine::updateContactSaveRequest(r, m_contacts, error, m_errorMap, QContactAbstractRequest::FinishedState);
- return;
- }
-
- // Get next contact
- QContact contact = m_contacts.at(m_index);
-
- // Validate & write contact
- QContactManager::Error error = QContactManager::NoError;
- if (engine()->validateContact(contact, error))
- simStore()->write(contact, error);
-
- if (error) {
- m_errorMap.insert(m_index, error);
- m_index++;
- singleShotTimer(KRequestDelay, this, SLOT(writeNext()));
- }
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimcontactsaverequest.h"
+#include "cntsymbiansimengine.h"
+#include "cntsimstore.h"
+#include <qcontactsaverequest.h>
+
+CntSimContactSaveRequest::CntSimContactSaveRequest(CntSymbianSimEngine *engine, QContactSaveRequest *req)
+ :CntAbstractSimRequest(engine, req)
+{
+ connect( simStore(), SIGNAL(writeComplete(QContact, QContactManager::Error)),
+ this, SLOT(writeComplete(QContact, QContactManager::Error)), Qt::QueuedConnection );
+}
+
+CntSimContactSaveRequest::~CntSimContactSaveRequest()
+{
+ cancel();
+}
+
+void CntSimContactSaveRequest::run()
+{
+ QContactSaveRequest *r = req<QContactSaveRequest>();
+
+ if (!r->isActive())
+ return;
+
+ m_contacts = r->contacts();
+ m_errorMap.clear();
+ m_index = 0;
+
+ writeNext();
+}
+
+void CntSimContactSaveRequest::writeComplete(QContact contact, QContactManager::Error error)
+{
+ if (!req()->isActive())
+ return;
+
+ if (error)
+ m_errorMap.insert(m_index, error);
+ engine()->updateDisplayLabel(contact);
+ m_contacts[m_index] = contact;
+ m_index++;
+ singleShotTimer(KRequestDelay, this, SLOT(writeNext()));
+}
+
+void CntSimContactSaveRequest::writeNext()
+{
+ QContactSaveRequest *r = req<QContactSaveRequest>();
+
+ if (!r->isActive())
+ return;
+
+ if (r->contacts().count() == 0) {
+ QContactManagerEngine::updateContactSaveRequest(r, QList<QContact>(), QContactManager::BadArgumentError, m_errorMap, QContactAbstractRequest::FinishedState);
+ return;
+ }
+
+ // All contacts written?
+ if (m_index >= m_contacts.count())
+ {
+ // Take first error from errormap (if any)
+ QContactManager::Error error = QContactManager::NoError;
+ if (m_errorMap.count())
+ error = m_errorMap.begin().value();
+
+ QContactManagerEngine::updateContactSaveRequest(r, m_contacts, error, m_errorMap, QContactAbstractRequest::FinishedState);
+ return;
+ }
+
+ // Get next contact
+ QContact contact = m_contacts.at(m_index);
+
+ // Validate & write contact
+ QContactManager::Error error = QContactManager::NoError;
+ if (engine()->validateContact(contact, error))
+ simStore()->write(contact, error);
+
+ if (error) {
+ m_errorMap.insert(m_index, error);
+ m_index++;
+ singleShotTimer(KRequestDelay, this, SLOT(writeNext()));
+ }
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimdetaildefinitionfetchrequest.cpp b/plugins/contacts/symbiansim/src/cntsimdetaildefinitionfetchrequest.cpp
index 4ded390bf0..1b755623ae 100644
--- a/plugins/contacts/symbiansim/src/cntsimdetaildefinitionfetchrequest.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimdetaildefinitionfetchrequest.cpp
@@ -1,107 +1,107 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimdetaildefinitionfetchrequest.h"
-#include "cntsymbiansimengine.h"
-#include <qcontactdetaildefinitionfetchrequest.h>
-
-CntSimDetailDefinitionFetchRequest::CntSimDetailDefinitionFetchRequest(CntSymbianSimEngine *engine, QContactDetailDefinitionFetchRequest *req)
- :CntAbstractSimRequest(engine, req)
-{
-
-}
-
-CntSimDetailDefinitionFetchRequest::~CntSimDetailDefinitionFetchRequest()
-{
- cancel();
-}
-
-void CntSimDetailDefinitionFetchRequest::run()
-{
- QContactDetailDefinitionFetchRequest *r = req<QContactDetailDefinitionFetchRequest>();
-
- if (!r->isActive())
- return;
-
- QContactManager::Error error = QContactManager::NoError;
- QMap<QString, QContactDetailDefinition> result;
- QMap<int, QContactManager::Error> errorMap;
-
- // Get all detail definitions
- QMap<QString, QContactDetailDefinition> allDefs = engine()->detailDefinitions(r->contactType(), error);
-
- QStringList defNames = r->definitionNames();
-
- // Check for error
- if (error != QContactManager::NoError)
- {
- for (int i=0; i<defNames.count(); i++)
- errorMap.insert(i, error);
-
- // Complete the request
- QContactManagerEngine::updateDefinitionFetchRequest(r, result, error, errorMap, QContactAbstractRequest::FinishedState);
- return;
- }
-
- // Filter results
- if (r->definitionNames().count() == 0)
- {
- result = allDefs;
- }
- else
- {
- for (int i=0; i<defNames.count(); i++)
- {
- QString defName = defNames.at(i);
- if (allDefs.contains(defName))
- result.insert(defName, allDefs.value(defName));
- else
- errorMap.insert(i, QContactManager::DoesNotExistError);
- }
-
- // Set first error as the general error
- if (errorMap.count())
- error = errorMap.begin().value();
- }
-
- // Complete the request
- QContactManagerEngine::updateDefinitionFetchRequest(r, result, error, errorMap, QContactAbstractRequest::FinishedState);
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimdetaildefinitionfetchrequest.h"
+#include "cntsymbiansimengine.h"
+#include <qcontactdetaildefinitionfetchrequest.h>
+
+CntSimDetailDefinitionFetchRequest::CntSimDetailDefinitionFetchRequest(CntSymbianSimEngine *engine, QContactDetailDefinitionFetchRequest *req)
+ :CntAbstractSimRequest(engine, req)
+{
+
+}
+
+CntSimDetailDefinitionFetchRequest::~CntSimDetailDefinitionFetchRequest()
+{
+ cancel();
+}
+
+void CntSimDetailDefinitionFetchRequest::run()
+{
+ QContactDetailDefinitionFetchRequest *r = req<QContactDetailDefinitionFetchRequest>();
+
+ if (!r->isActive())
+ return;
+
+ QContactManager::Error error = QContactManager::NoError;
+ QMap<QString, QContactDetailDefinition> result;
+ QMap<int, QContactManager::Error> errorMap;
+
+ // Get all detail definitions
+ QMap<QString, QContactDetailDefinition> allDefs = engine()->detailDefinitions(r->contactType(), error);
+
+ QStringList defNames = r->definitionNames();
+
+ // Check for error
+ if (error != QContactManager::NoError)
+ {
+ for (int i=0; i<defNames.count(); i++)
+ errorMap.insert(i, error);
+
+ // Complete the request
+ QContactManagerEngine::updateDefinitionFetchRequest(r, result, error, errorMap, QContactAbstractRequest::FinishedState);
+ return;
+ }
+
+ // Filter results
+ if (r->definitionNames().count() == 0)
+ {
+ result = allDefs;
+ }
+ else
+ {
+ for (int i=0; i<defNames.count(); i++)
+ {
+ QString defName = defNames.at(i);
+ if (allDefs.contains(defName))
+ result.insert(defName, allDefs.value(defName));
+ else
+ errorMap.insert(i, QContactManager::DoesNotExistError);
+ }
+
+ // Set first error as the general error
+ if (errorMap.count())
+ error = errorMap.begin().value();
+ }
+
+ // Complete the request
+ QContactManagerEngine::updateDefinitionFetchRequest(r, result, error, errorMap, QContactAbstractRequest::FinishedState);
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimstore.cpp b/plugins/contacts/symbiansim/src/cntsimstore.cpp
index 539273a5dd..117e062faf 100644
--- a/plugins/contacts/symbiansim/src/cntsimstore.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimstore.cpp
@@ -1,111 +1,111 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimstore.h"
-#include "cntsimstoreprivate.h"
-#include "cntsymbiansimtransformerror.h"
-
-CntSimStore::CntSimStore(CntSymbianSimEngine* engine, QString storeName, QContactManager::Error &error)
- :QObject((QObject *)engine),
- d_ptr(0)
-{
- error = QContactManager::NoError;
-
- // We need to register these meta types for signals because connect() with
- // Qt::QueuedConnection it is required.
- qRegisterMetaType<QContact>("QContact");
- qRegisterMetaType<QList<QContact> >("QList<QContact>");
- qRegisterMetaType<QContactManager::Error>("QContactManager::Error");
- qRegisterMetaType<QList<int> >("QList<int>");
-
- TRAPD(err, d_ptr = CntSimStorePrivate::NewL(*engine, *this, storeName));
- CntSymbianSimTransformError::transformError(err, error);
-}
-
-CntSimStore::~CntSimStore()
-{
- delete d_ptr;
-}
-
-QString CntSimStore::storeName()
-{
- return d_ptr->storeName();
-}
-
-TSimStoreInfo CntSimStore::storeInfo()
-{
- return d_ptr->storeInfo();
-}
-
-bool CntSimStore::read(int index, int numSlots, QContactManager::Error &error)
-{
- return d_ptr->read(index, numSlots, error);
-}
-
-bool CntSimStore::write(const QContact &contact, QContactManager::Error &error)
-{
- return d_ptr->write(contact, error);
-}
-
-bool CntSimStore::remove(int index, QContactManager::Error &error)
-{
- return d_ptr->remove(index, error);
-}
-
-bool CntSimStore::getReservedSlots(QContactManager::Error &error)
-{
- return d_ptr->getReservedSlots(error);
-}
-
-void CntSimStore::cancel()
-{
- d_ptr->Cancel();
-}
-
-bool CntSimStore::isBusy()
-{
- return d_ptr->IsActive();
-}
-
-TInt CntSimStore::lastAsyncError()
-{
- return d_ptr->lastAsyncError();
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimstore.h"
+#include "cntsimstoreprivate.h"
+#include "cntsymbiansimtransformerror.h"
+
+CntSimStore::CntSimStore(CntSymbianSimEngine* engine, QString storeName, QContactManager::Error &error)
+ :QObject((QObject *)engine),
+ d_ptr(0)
+{
+ error = QContactManager::NoError;
+
+ // We need to register these meta types for signals because connect() with
+ // Qt::QueuedConnection it is required.
+ qRegisterMetaType<QContact>("QContact");
+ qRegisterMetaType<QList<QContact> >("QList<QContact>");
+ qRegisterMetaType<QContactManager::Error>("QContactManager::Error");
+ qRegisterMetaType<QList<int> >("QList<int>");
+
+ TRAPD(err, d_ptr = CntSimStorePrivate::NewL(*engine, *this, storeName));
+ CntSymbianSimTransformError::transformError(err, error);
+}
+
+CntSimStore::~CntSimStore()
+{
+ delete d_ptr;
+}
+
+QString CntSimStore::storeName()
+{
+ return d_ptr->storeName();
+}
+
+TSimStoreInfo CntSimStore::storeInfo()
+{
+ return d_ptr->storeInfo();
+}
+
+bool CntSimStore::read(int index, int numSlots, QContactManager::Error &error)
+{
+ return d_ptr->read(index, numSlots, error);
+}
+
+bool CntSimStore::write(const QContact &contact, QContactManager::Error &error)
+{
+ return d_ptr->write(contact, error);
+}
+
+bool CntSimStore::remove(int index, QContactManager::Error &error)
+{
+ return d_ptr->remove(index, error);
+}
+
+bool CntSimStore::getReservedSlots(QContactManager::Error &error)
+{
+ return d_ptr->getReservedSlots(error);
+}
+
+void CntSimStore::cancel()
+{
+ d_ptr->Cancel();
+}
+
+bool CntSimStore::isBusy()
+{
+ return d_ptr->IsActive();
+}
+
+TInt CntSimStore::lastAsyncError()
+{
+ return d_ptr->lastAsyncError();
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimstoreeventlistener.cpp b/plugins/contacts/symbiansim/src/cntsimstoreeventlistener.cpp
index af3cd13e65..f0238eba68 100644
--- a/plugins/contacts/symbiansim/src/cntsimstoreeventlistener.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimstoreeventlistener.cpp
@@ -1,128 +1,128 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimstoreeventlistener.h"
-#include "cntsymbiansimengine.h"
-#include <qcontactchangeset.h>
-#ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER
-#include <etelmm_etel_test_server.h>
-#else
-#include <etelmm.h>
-#endif
-#include <QDebug>
-
-QTM_USE_NAMESPACE
-
-CntSimStoreEventListener::CntSimStoreEventListener(CntSymbianSimEngine &engine, RMobilePhoneBookStore& store)
- :CActive(CActive::EPriorityUserInput),
- m_engine(engine),
- m_store(store)
-{
- // NOTE:
- // The AO priority must be higher than CntSimStorePrivate's priority.
- // Otherwise we might not receive all store events. This is because a new
- // store request might be issued before the listener has had the chance to
- // issue a new notify request.
- CActiveScheduler::Add(this);
-}
-
-CntSimStoreEventListener::~CntSimStoreEventListener()
-{
- Cancel();
-}
-
-void CntSimStoreEventListener::start()
-{
- if (IsActive())
- return;
-
- m_store.NotifyStoreEvent(iStatus, m_event, m_index);
- SetActive();
-}
-
-void CntSimStoreEventListener::DoCancel()
-{
- if (IsActive())
- m_store.CancelAsyncRequest(EMobilePhoneStoreNotifyStoreEvent);
-}
-
-void CntSimStoreEventListener::RunL()
-{
- if (iStatus.Int()) {
- qWarning() << "Failed to listen store events!" << iStatus.Int();
- return;
- }
-
- // The store may report several events at the same time.
-
- QContactChangeSet changeSet;
-
- if (m_event & RMobilePhoneStore::KStoreFull) {
- //qDebug() << "SIM store event: full";
- }
- if (m_event & RMobilePhoneStore::KStoreHasSpace) {
- //qDebug() << "SIM store event: has space";
- }
- if (m_event & RMobilePhoneStore::KStoreEmpty ) {
- //qDebug() << "SIM store event: empty" << m_index;
- changeSet.removedContacts() << m_index;
- }
- if (m_event & RMobilePhoneStore::KStoreEntryAdded) {
- //qDebug() << "SIM store event: added" << m_index;
- changeSet.addedContacts() << m_index;
- }
- if (m_event & RMobilePhoneStore::KStoreEntryDeleted) {
- //qDebug() << "SIM store event: deleted" << m_index;
- changeSet.removedContacts() << m_index;
- }
- if (m_event & RMobilePhoneStore::KStoreEntryChanged) {
- //qDebug() << "SIM store event: changed" << m_index;
- changeSet.changedContacts() << m_index;
- }
- if (m_event & RMobilePhoneStore::KStoreDoRefresh) {
- //qDebug() << "SIM store event: do refresh";
- changeSet.setDataChanged(true);
- }
-
- changeSet.emitSignals(&m_engine);
-
- start();
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimstoreeventlistener.h"
+#include "cntsymbiansimengine.h"
+#include <qcontactchangeset.h>
+#ifdef SYMBIANSIM_BACKEND_USE_ETEL_TESTSERVER
+#include <etelmm_etel_test_server.h>
+#else
+#include <etelmm.h>
+#endif
+#include <QDebug>
+
+QTM_USE_NAMESPACE
+
+CntSimStoreEventListener::CntSimStoreEventListener(CntSymbianSimEngine &engine, RMobilePhoneBookStore& store)
+ :CActive(CActive::EPriorityUserInput),
+ m_engine(engine),
+ m_store(store)
+{
+ // NOTE:
+ // The AO priority must be higher than CntSimStorePrivate's priority.
+ // Otherwise we might not receive all store events. This is because a new
+ // store request might be issued before the listener has had the chance to
+ // issue a new notify request.
+ CActiveScheduler::Add(this);
+}
+
+CntSimStoreEventListener::~CntSimStoreEventListener()
+{
+ Cancel();
+}
+
+void CntSimStoreEventListener::start()
+{
+ if (IsActive())
+ return;
+
+ m_store.NotifyStoreEvent(iStatus, m_event, m_index);
+ SetActive();
+}
+
+void CntSimStoreEventListener::DoCancel()
+{
+ if (IsActive())
+ m_store.CancelAsyncRequest(EMobilePhoneStoreNotifyStoreEvent);
+}
+
+void CntSimStoreEventListener::RunL()
+{
+ if (iStatus.Int()) {
+ qWarning() << "Failed to listen store events!" << iStatus.Int();
+ return;
+ }
+
+ // The store may report several events at the same time.
+
+ QContactChangeSet changeSet;
+
+ if (m_event & RMobilePhoneStore::KStoreFull) {
+ //qDebug() << "SIM store event: full";
+ }
+ if (m_event & RMobilePhoneStore::KStoreHasSpace) {
+ //qDebug() << "SIM store event: has space";
+ }
+ if (m_event & RMobilePhoneStore::KStoreEmpty ) {
+ //qDebug() << "SIM store event: empty" << m_index;
+ changeSet.removedContacts() << m_index;
+ }
+ if (m_event & RMobilePhoneStore::KStoreEntryAdded) {
+ //qDebug() << "SIM store event: added" << m_index;
+ changeSet.addedContacts() << m_index;
+ }
+ if (m_event & RMobilePhoneStore::KStoreEntryDeleted) {
+ //qDebug() << "SIM store event: deleted" << m_index;
+ changeSet.removedContacts() << m_index;
+ }
+ if (m_event & RMobilePhoneStore::KStoreEntryChanged) {
+ //qDebug() << "SIM store event: changed" << m_index;
+ changeSet.changedContacts() << m_index;
+ }
+ if (m_event & RMobilePhoneStore::KStoreDoRefresh) {
+ //qDebug() << "SIM store event: do refresh";
+ changeSet.setDataChanged(true);
+ }
+
+ changeSet.emitSignals(&m_engine);
+
+ start();
+}
diff --git a/plugins/contacts/symbiansim/src/cntsimstoreprivate.cpp b/plugins/contacts/symbiansim/src/cntsimstoreprivate.cpp
index 7014033ba1..55fae2dd77 100644
--- a/plugins/contacts/symbiansim/src/cntsimstoreprivate.cpp
+++ b/plugins/contacts/symbiansim/src/cntsimstoreprivate.cpp
@@ -1,668 +1,668 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsimstoreprivate.h"
-#include "cntsymbiansimtransformerror.h"
-#include "cntsimstore.h"
-#include "cntsimstoreeventlistener.h"
-
-#include <mmtsy_names.h>
-#include <qtcontacts.h>
-#include <qcontactchangeset.h>
-#include <QDebug>
-
-const TInt KOneSimContactBufferSize = 512;
-const TInt KDataClientBuf = 128;
-const TInt KEtsiTonPosition = 0x70;
-
-CntSimStorePrivate* CntSimStorePrivate::NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName)
-{
- CntSimStorePrivate* self = new (ELeave) CntSimStorePrivate(engine, simStore, storeName);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
-}
-
-CntSimStorePrivate::CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName)
- :CActive(CActive::EPriorityStandard),
- m_state(InactiveState),
- m_engine(engine),
- m_simStore(simStore),
- m_storeName(storeName),
- m_readOnlyAccess(false),
- m_storeInfoPckg(m_storeInfo),
- m_listener(0)
-{
- CActiveScheduler::Add(this);
- m_managerUri = engine.managerUri();
-}
-
-void CntSimStorePrivate::ConstructL()
-{
- TBuf<RMobilePhoneBookStore::KMaxPBIDSize> storeName;
- convertStoreNameL(storeName);
-
- // SDN store is allways read only
- if (m_storeName == KParameterValueSimStoreNameSdn)
- m_readOnlyAccess = true;
-
- // Open etel server
- User::LeaveIfError(m_etelServer.Connect());
- User::LeaveIfError(m_etelServer.LoadPhoneModule(KMmTsyModuleName));
-
- // Open etel phone
- RTelServer::TPhoneInfo info;
- User::LeaveIfError(m_etelServer.GetPhoneInfo(0, info));
- User::LeaveIfError(m_etelPhone.Open(m_etelServer, info.iName));
-
- // open Etel store
- User::LeaveIfError(m_etelStore.Open(m_etelPhone, storeName));
-
- //check what information can be saved to the Etel store
- TRequestStatus requestStatus;
- m_etelStore.GetInfo(requestStatus, (TDes8&)m_storeInfoPckg);
- User::WaitForRequest(requestStatus);
- PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - GetInfo err = %d"),
- requestStatus.Int());
- User::LeaveIfError(requestStatus.Int());
-
- PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - TotalEntries = %d"),
- m_storeInfo.iTotalEntries);
- PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - UsedEntries = %d"),
- m_storeInfo.iUsedEntries);
- PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - MaxNumLength = %d"),
- m_storeInfo.iMaxNumLength);
- PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - MaxTextLength = %d"),
- m_storeInfo.iMaxTextLength);
-
- m_listener = new (ELeave) CntSimStoreEventListener(m_engine, m_etelStore);
- m_listener->start();
-}
-
-CntSimStorePrivate::~CntSimStorePrivate()
-{
- Cancel();
- delete m_listener;
- m_etelStore.Close();
- m_etelPhone.Close();
- m_etelServer.Close();
-}
-
-void CntSimStorePrivate::convertStoreNameL(TDes &storeName)
-{
- if(storeName.MaxLength() < RMobilePhoneBookStore::KMaxPBIDSize) {
- User::Leave(KErrArgument);
- }
-
- if (m_storeName.isEmpty()) {
- // Default to ADN store
- m_storeName = (QLatin1String) KParameterValueSimStoreNameAdn;
- storeName.Copy(KETelIccAdnPhoneBook);
- } else if (m_storeName == KParameterValueSimStoreNameFdn) {
- storeName.Copy(KETelIccFdnPhoneBook);
- } else if (m_storeName == KParameterValueSimStoreNameAdn) {
- storeName.Copy(KETelIccAdnPhoneBook);
- } else if (m_storeName == KParameterValueSimStoreNameSdn) {
- storeName.Copy(KETelIccSdnPhoneBook);
- }
-
- // Check that we got a valid store name
- if(storeName.Length() == 0) {
- User::Leave(KErrArgument);
- }
-}
-
-bool CntSimStorePrivate::read(int index, int numSlots, QContactManager::Error &error)
-{
- if (IsActive()) {
- error = QContactManager::LockedError;
- return false;
- }
-
- // start reading
- m_buffer.Zero();
- m_buffer.ReAlloc(KOneSimContactBufferSize*numSlots);
- m_etelStore.Read(iStatus, index, numSlots, m_buffer);
- SetActive();
- m_state = ReadState;
-
- error = QContactManager::NoError;
- return true;
-}
-
-bool CntSimStorePrivate::write(const QContact &contact, QContactManager::Error &error)
-{
- if (IsActive()) {
- error = QContactManager::LockedError;
- return false;
- }
-
- // get index
- m_writeIndex = KErrNotFound;
- if (contact.id().managerUri() == m_managerUri &&
- contact.localId() > 0) {
- m_writeIndex = contact.localId();
- }
-
- // encode
- m_buffer.Zero();
- m_buffer.ReAlloc(KOneSimContactBufferSize);
- TRAPD(err, m_convertedContact = encodeSimContactL(&contact, m_buffer));
- if (err != KErrNone) {
- CntSymbianSimTransformError::transformError(err, error);
- return false;
- }
-
- // start writing
- m_etelStore.Write(iStatus, m_buffer, m_writeIndex);
- SetActive();
- m_state = WriteState;
-
- error = QContactManager::NoError;
- return true;
-}
-
-bool CntSimStorePrivate::remove(int index, QContactManager::Error &error)
-{
- if (IsActive()) {
- error = QContactManager::LockedError;
- return false;
- }
-
- // NOTE:
- // If index points to an empty slot and running in hardware the
- // delete operation will not return any error.
-
- m_etelStore.Delete(iStatus, index);
- SetActive();
- m_state = DeleteState;
-
- error = QContactManager::NoError;
- return true;
-}
-
-bool CntSimStorePrivate::getReservedSlots(QContactManager::Error &error)
-{
- if (IsActive()) {
- error = QContactManager::LockedError;
- return false;
- }
-
- // start reading
- m_buffer.Zero();
- m_buffer.ReAlloc(KOneSimContactBufferSize*m_storeInfo.iTotalEntries);
- m_etelStore.Read(iStatus, 1, m_storeInfo.iTotalEntries, m_buffer);
- SetActive();
- m_state = ReadReservedSlotsState;
-
- error = QContactManager::NoError;
- return true;
-}
-
-void CntSimStorePrivate::DoCancel()
-{
- if (m_state == ReadState)
- m_etelStore.CancelAsyncRequest(EMobilePhoneStoreRead);
- if (m_state == WriteState)
- m_etelStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
- if (m_state == DeleteState)
- m_etelStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
- if (m_state == ReadReservedSlotsState)
- m_etelStore.CancelAsyncRequest(EMobilePhoneStoreRead);
-
- m_state = InactiveState;
-}
-
-void CntSimStorePrivate::RunL()
-{
- //qDebug() << "CntSimStorePrivate::RunL()" << m_state << iStatus.Int();
-
- m_asyncError = iStatus.Int();
- User::LeaveIfError(iStatus.Int());
-
- // NOTE: It is assumed that emitting signals is queued
-
- switch (m_state)
- {
- case ReadState:
- {
- QList<QContact> contacts = decodeSimContactsL(m_buffer);
- emit m_simStore.readComplete(contacts, QContactManager::NoError);
- }
- break;
-
- case WriteState:
- {
- // save id
- QContactId contactId;
- contactId.setLocalId(m_writeIndex);
- contactId.setManagerUri(m_managerUri);
- m_convertedContact.setId(contactId);
-
- // set sync target
- QContactSyncTarget syncTarget;
- syncTarget.setSyncTarget(KSimSyncTarget);
- m_convertedContact.saveDetail(&syncTarget);
-
- emit m_simStore.writeComplete(m_convertedContact, QContactManager::NoError);
- }
- break;
-
- case DeleteState:
- {
- emit m_simStore.removeComplete(QContactManager::NoError);
- }
- break;
-
- case ReadReservedSlotsState:
- {
- QList<int> reservedSlots = decodeReservedSlotsL(m_buffer);
- emit m_simStore.getReservedSlotsComplete(reservedSlots, QContactManager::NoError);
- }
- break;
-
- default:
- {
- User::Leave(KErrUnknown);
- }
- break;
- }
- m_state = InactiveState;
-}
-
-TInt CntSimStorePrivate::RunError(TInt aError)
-{
- QContactManager::Error qtError = QContactManager::NoError;
- CntSymbianSimTransformError::transformError(aError, qtError);
-
- // NOTE: It is assumed that emitting signals is queued
-
- if (m_state == ReadState)
- emit m_simStore.readComplete(QList<QContact>(), qtError);
- else if (m_state == WriteState)
- emit m_simStore.writeComplete(m_convertedContact, qtError);
- else if (m_state == DeleteState)
- emit m_simStore.removeComplete(qtError);
- else if (m_state == ReadReservedSlotsState)
- emit m_simStore.getReservedSlotsComplete(QList<int>(), qtError);
-
- m_state = InactiveState;
-
- return KErrNone;
-}
-
-/*! Parses SIM contacts in TLV format.
- *
- * \param rawData SIM contacts in TLV format.
- * \return List of contacts.
-*/
-QList<QContact> CntSimStorePrivate::decodeSimContactsL(TDes8& rawData) const
-{
- PbkPrintToLog(_L("CntSymbianSimEngine::decodeSimContactsL() - IN"));
- QList<QContact> fetchedContacts;
- QContact currentContact;
-
- TBuf16<KDataClientBuf> buffer;
- TPtrC16 bufPtr(buffer);
-
- TUint8 tagValue(0);
- CPhoneBookBuffer::TPhBkTagType dataType;
-
- bool isAdditionalNumber = false;
-
- CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
- CleanupStack::PushL(pbBuffer);
- pbBuffer->Set(&rawData);
- pbBuffer->StartRead();
-
- while (pbBuffer->GetTagAndType(tagValue, dataType) == KErrNone) {
- switch (tagValue)
- {
- case RMobilePhoneBookStore::ETagPBAdnIndex:
- {
- //save contact's id (SIM card index) and manager's name
- TUint16 index;
- if (pbBuffer->GetValue(index) == KErrNone) {
- QScopedPointer<QContactId> contactId(new QContactId());
- contactId->setLocalId(index);
- contactId->setManagerUri(m_managerUri);
- currentContact.setId(*contactId);
- }
- isAdditionalNumber = false;
- break;
- }
- case RMobilePhoneBookStore::ETagPBTonNpi:
- {
- // Note, that TON info can be incorporated into the phone number by Etel
- // implementation (TSY). E.g. this is the case with Nokia TSY.
- // Here general case is implemented.
-
- // Check number type, we are only interested if it's international or not.
- // We assume here that ETagPBTonNpi always comes after ETagPBNumber, not before.
- TUint8 tonNpi;
- if (pbBuffer->GetValue(tonNpi) == KErrNone) {
- TUint8 intFlag = (tonNpi & KEtsiTonPosition) >> 4;
- if (intFlag == 1) {
- //international number format, append "+" to the last
- //saved number
- QList<QContactDetail> phoneNumbers = currentContact.details(
- QContactPhoneNumber::DefinitionName);
- if (phoneNumbers.count() > 0) {
- QContactPhoneNumber lastNumber = static_cast<QContactPhoneNumber>(
- phoneNumbers.at(phoneNumbers.count() - 1));
- QString number = lastNumber.number();
- number.insert(0, "+");
- lastNumber.setNumber(number);
- if (m_readOnlyAccess)
- m_engine.setReadOnlyAccessConstraint(&lastNumber);
- currentContact.saveDetail(&lastNumber);
- }
- }
- }
-
- // We have rearched to the end of the number,
- // invalidate additional number flag.
- isAdditionalNumber = false;
- break;
- }
- case RMobilePhoneBookStore::ETagPBText:
- {
- if (pbBuffer->GetValue(bufPtr) == KErrNone) {
- if (isAdditionalNumber) {
- // For additional number bufPtr contains number alpha string,
- // this is ignored currently
- }
- else {
- // Contact name otherwise
- QContactName name;
- QString nameString = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
- name.setCustomLabel(nameString);
- if (m_readOnlyAccess)
- m_engine.setReadOnlyAccessConstraint(&name);
- currentContact.saveDetail(&name);
- QContactManager::Error error(QContactManager::NoError);
- currentContact = m_engine.setContactDisplayLabel(m_engine.synthesizedDisplayLabel(currentContact, error), currentContact);
- }
- }
- break;
- }
- case RMobilePhoneBookStore::ETagPBSecondName:
- {
- if (pbBuffer->GetValue(bufPtr) == KErrNone) {
- QContactNickname nickName;
- QString name = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
- nickName.setNickname(name);
- if (m_readOnlyAccess)
- m_engine.setReadOnlyAccessConstraint(&nickName);
- currentContact.saveDetail(&nickName);
- }
- break;
- }
- case RMobilePhoneBookStore::ETagPBNumber:
- {
- if (pbBuffer->GetValue(bufPtr) == KErrNone) {
- QContactPhoneNumber phoneNumber;
- phoneNumber.setSubTypes( QContactPhoneNumber::SubTypeMobile );
- QString number = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
- phoneNumber.setNumber(number);
- if (m_readOnlyAccess)
- m_engine.setReadOnlyAccessConstraint(&phoneNumber);
- currentContact.saveDetail(&phoneNumber);
- }
- break;
- }
- case RMobilePhoneBookStore::ETagPBAnrStart:
- {
- // This tag should precede every additional number entry
- isAdditionalNumber = true;
- break;
- }
- case RMobilePhoneBookStore::ETagPBEmailAddress:
- {
- if (pbBuffer->GetValue(bufPtr) == KErrNone) {
- QContactEmailAddress email;
- QString emailAddress = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
- email.setEmailAddress(emailAddress);
- if (m_readOnlyAccess)
- m_engine.setReadOnlyAccessConstraint(&email);
- currentContact.saveDetail(&email);
- }
- break;
- }
- case RMobilePhoneBookStore::ETagPBNewEntry:
- {
- // This signals the end of the entry and is a special case
- // which will be handled below.
- break;
- }
- default:
- {
- // An unsupported field type - just skip this value
- pbBuffer->SkipValue(dataType);
- break;
- }
- } //switch
-
- // save contact to the array of contact to be returned if the whole entry was extracted
- if ((tagValue == RMobilePhoneBookStore::ETagPBNewEntry && currentContact.localId() > 0) ||
- (pbBuffer->RemainingReadLength() == 0 && currentContact.localId() > 0)) {
- //QContactSyncTarget syncTarget;
- //syncTarget.setSyncTarget(KSimSyncTarget);
- //currentContact.saveDetail(&syncTarget);
- fetchedContacts.append(currentContact);
- //clear current contact
- currentContact.clearDetails();
- QScopedPointer<QContactId> contactId(new QContactId());
- contactId->setLocalId(0);
- contactId->setManagerUri(QString());
- currentContact.setId(*contactId);
- }
- } //while
-
- CleanupStack::PopAndDestroy(pbBuffer);
- PbkPrintToLog(_L("CntSymbianSimEngine::decodeSimContactsL() - OUT"));
- return fetchedContacts;
-}
-
-/*! Converts QContact to the TLV format which is used to save it to the Etel store.
- *
- * \param contact QContact to be converted
- * \param rawData Contact in TLV format on return.
- * \return QContact containing actually saved information.
-*/
-QContact CntSimStorePrivate::encodeSimContactL(const QContact* contact, TDes8& rawData) const
-{
- PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - IN"));
- QContact convertedContact;
- CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
- CleanupStack::PushL(pbBuffer);
- pbBuffer->Set(&rawData);
-
- //add new enty tag
- User::LeaveIfError(pbBuffer->AddNewEntryTag());
-
- //add name
- QString name;
- QList<QContactDetail> nameDetails = contact->details(QContactName::DefinitionName);
- if (nameDetails.count() == 0) {
- // TODO: should we leave name empty?
- name.append("Unnamed");
- }
- else {
- QContactName nameDetail = static_cast<QContactName>(nameDetails.at(0));
- name.append(nameDetail.customLabel());
- if (name.isNull()) {
- // TODO: should we leave name empty?
- name.append("Unnamed)");
- }
- }
- name = name.left(m_storeInfo.iMaxTextLength); //trim to the max possible length
- TPtrC nameValue(reinterpret_cast<const TUint16*>(name.utf16()));
- User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBText, nameValue));
-
- QContactName convertedNameDetail;
- convertedNameDetail.setCustomLabel(name);
- convertedContact.saveDetail(&convertedNameDetail);
-
- //add nickname
-#ifndef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
- if (m_storeInfo.iMaxSecondNames > 0) {
- QString nickname;
- QList<QContactDetail> nicknameDetails = contact->details(QContactNickname::DefinitionName);
- if (nicknameDetails.count() > 0) {
- QContactNickname nicknameDetail = static_cast<QContactNickname>(nicknameDetails.at(0));
- nickname = nicknameDetail.nickname();
- nickname = nickname.left(m_storeInfo.iMaxTextLengthSecondName); //trim to the max possible length
- TPtrC nicknameValue(reinterpret_cast<const TUint16*>(nickname.utf16()));
- User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBSecondName, nicknameValue));
-
- QContactNickname convertedNicknameDetail;
- convertedNicknameDetail.setNickname(nickname);
- convertedContact.saveDetail(&convertedNicknameDetail);
- }
- }
-#endif
-
- //add phone number
- QList<QContactDetail> phoneNumberDetails = contact->details(QContactPhoneNumber::DefinitionName);
- if (phoneNumberDetails.count() > 0) {
- PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - add phone number"));
- QContactPhoneNumber phoneNumberDetail = static_cast<QContactPhoneNumber>(phoneNumberDetails.at(0));
- QString number = phoneNumberDetail.number();
- foreach (const QChar character, number) {
- if(!character.isDigit()) {
- if(character != QChar('+')
- && character != QChar('*')
- && character != QChar('#')
- && character != QChar('p')
- && character != QChar('w')) {
- User::Leave(KErrArgument);
- }
- }
- }
- PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - phone number length = %d"),
- phoneNumberDetail.number().length());
- if (phoneNumberDetail.number().length() > m_storeInfo.iMaxNumLength) {
- User::Leave(KErrTooBig);
- }
- TPtrC phoneNumberValue(reinterpret_cast<const TUint16*>(phoneNumberDetail.number().utf16()));
- PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - number = %S"), &phoneNumberValue);
- User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, phoneNumberValue));
-
- QContactPhoneNumber convertedPhoneNumberDetail;
- convertedPhoneNumberDetail.setNumber(phoneNumberDetail.number());
- convertedContact.saveDetail(&convertedPhoneNumberDetail);
- }
-
- //add additional numbers
-#ifndef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
- if (m_storeInfo.iMaxAdditionalNumbers > 0) {
- //one number is saved already
- for (int i = 1; i < phoneNumberDetails.count() && i-1 < m_storeInfo.iMaxAdditionalNumbers; ++i) {
- QContactPhoneNumber phoneNumberDetail = static_cast<QContactPhoneNumber>(phoneNumberDetails.at(i));
- if (phoneNumberDetail.number().length() > m_storeInfo.iMaxNumLengthAdditionalNumber) {
- User::Leave(KErrTooBig);
- }
- //mark the beginning of an additional number
- User::LeaveIfError(pbBuffer->AddNewNumberTag());
- //add number itself
- TPtrC phoneNumberValue(reinterpret_cast<const TUint16*>(phoneNumberDetail.number().utf16()));
- User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, phoneNumberValue));
-
- QContactPhoneNumber convertedPhoneNumberDetail;
- convertedPhoneNumberDetail.setNumber(phoneNumberDetail.number());
- convertedContact.saveDetail(&convertedPhoneNumberDetail);
- }
- }
-#endif
-
- //add e-mails
-#ifndef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
- if (m_storeInfo.iMaxEmailAddr > 0) {
- QList<QContactDetail> emailDetails = contact->details(QContactEmailAddress::DefinitionName);
- for (int i = 0; i < emailDetails.count() && i < m_storeInfo.iMaxEmailAddr; ++i) {
- QContactEmailAddress emailDetail = static_cast<QContactEmailAddress>(emailDetails.at(i));
- TPtrC emailValue(reinterpret_cast<const TUint16*>(emailDetail.emailAddress().utf16()));
- if (emailValue.Length() > m_storeInfo.iMaxTextLengthEmailAddr) {
- User::Leave(KErrTooBig);
- }
- User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBEmailAddress, emailValue));
-
- QContactEmailAddress convertedEmailDetail;
- convertedEmailDetail.setEmailAddress(emailDetail.emailAddress());
- convertedContact.saveDetail(&convertedEmailDetail);
- }
- }
-#endif
-
- CleanupStack::PopAndDestroy(pbBuffer);
- PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - OUT"));
- return convertedContact;
-}
-
-QList<int> CntSimStorePrivate::decodeReservedSlotsL(TDes8& rawData) const
-{
- QList<int> reservedSlots;
-
- TUint8 tagValue(0);
- CPhoneBookBuffer::TPhBkTagType dataType;
-
- CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer();
- CleanupStack::PushL(pbBuffer);
- pbBuffer->Set(&rawData);
- pbBuffer->StartRead();
-
- while (pbBuffer->GetTagAndType(tagValue, dataType) == KErrNone)
- {
- if (tagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
- {
- TUint16 index;
- if (pbBuffer->GetValue(index) == KErrNone)
- reservedSlots.append(index);
- } else
- pbBuffer->SkipValue(dataType);
- } //while
-
- CleanupStack::PopAndDestroy(pbBuffer);
- return reservedSlots;
-}
-
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsimstoreprivate.h"
+#include "cntsymbiansimtransformerror.h"
+#include "cntsimstore.h"
+#include "cntsimstoreeventlistener.h"
+
+#include <mmtsy_names.h>
+#include <qtcontacts.h>
+#include <qcontactchangeset.h>
+#include <QDebug>
+
+const TInt KOneSimContactBufferSize = 512;
+const TInt KDataClientBuf = 128;
+const TInt KEtsiTonPosition = 0x70;
+
+CntSimStorePrivate* CntSimStorePrivate::NewL(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName)
+{
+ CntSimStorePrivate* self = new (ELeave) CntSimStorePrivate(engine, simStore, storeName);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+CntSimStorePrivate::CntSimStorePrivate(CntSymbianSimEngine &engine, CntSimStore &simStore, const QString &storeName)
+ :CActive(CActive::EPriorityStandard),
+ m_state(InactiveState),
+ m_engine(engine),
+ m_simStore(simStore),
+ m_storeName(storeName),
+ m_readOnlyAccess(false),
+ m_storeInfoPckg(m_storeInfo),
+ m_listener(0)
+{
+ CActiveScheduler::Add(this);
+ m_managerUri = engine.managerUri();
+}
+
+void CntSimStorePrivate::ConstructL()
+{
+ TBuf<RMobilePhoneBookStore::KMaxPBIDSize> storeName;
+ convertStoreNameL(storeName);
+
+ // SDN store is allways read only
+ if (m_storeName == KParameterValueSimStoreNameSdn)
+ m_readOnlyAccess = true;
+
+ // Open etel server
+ User::LeaveIfError(m_etelServer.Connect());
+ User::LeaveIfError(m_etelServer.LoadPhoneModule(KMmTsyModuleName));
+
+ // Open etel phone
+ RTelServer::TPhoneInfo info;
+ User::LeaveIfError(m_etelServer.GetPhoneInfo(0, info));
+ User::LeaveIfError(m_etelPhone.Open(m_etelServer, info.iName));
+
+ // open Etel store
+ User::LeaveIfError(m_etelStore.Open(m_etelPhone, storeName));
+
+ //check what information can be saved to the Etel store
+ TRequestStatus requestStatus;
+ m_etelStore.GetInfo(requestStatus, (TDes8&)m_storeInfoPckg);
+ User::WaitForRequest(requestStatus);
+ PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - GetInfo err = %d"),
+ requestStatus.Int());
+ User::LeaveIfError(requestStatus.Int());
+
+ PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - TotalEntries = %d"),
+ m_storeInfo.iTotalEntries);
+ PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - UsedEntries = %d"),
+ m_storeInfo.iUsedEntries);
+ PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - MaxNumLength = %d"),
+ m_storeInfo.iMaxNumLength);
+ PbkPrintToLog(_L("CntSymbianSimEngine::getEtelStoreInfoL() - MaxTextLength = %d"),
+ m_storeInfo.iMaxTextLength);
+
+ m_listener = new (ELeave) CntSimStoreEventListener(m_engine, m_etelStore);
+ m_listener->start();
+}
+
+CntSimStorePrivate::~CntSimStorePrivate()
+{
+ Cancel();
+ delete m_listener;
+ m_etelStore.Close();
+ m_etelPhone.Close();
+ m_etelServer.Close();
+}
+
+void CntSimStorePrivate::convertStoreNameL(TDes &storeName)
+{
+ if(storeName.MaxLength() < RMobilePhoneBookStore::KMaxPBIDSize) {
+ User::Leave(KErrArgument);
+ }
+
+ if (m_storeName.isEmpty()) {
+ // Default to ADN store
+ m_storeName = (QLatin1String) KParameterValueSimStoreNameAdn;
+ storeName.Copy(KETelIccAdnPhoneBook);
+ } else if (m_storeName == KParameterValueSimStoreNameFdn) {
+ storeName.Copy(KETelIccFdnPhoneBook);
+ } else if (m_storeName == KParameterValueSimStoreNameAdn) {
+ storeName.Copy(KETelIccAdnPhoneBook);
+ } else if (m_storeName == KParameterValueSimStoreNameSdn) {
+ storeName.Copy(KETelIccSdnPhoneBook);
+ }
+
+ // Check that we got a valid store name
+ if(storeName.Length() == 0) {
+ User::Leave(KErrArgument);
+ }
+}
+
+bool CntSimStorePrivate::read(int index, int numSlots, QContactManager::Error &error)
+{
+ if (IsActive()) {
+ error = QContactManager::LockedError;
+ return false;
+ }
+
+ // start reading
+ m_buffer.Zero();
+ m_buffer.ReAlloc(KOneSimContactBufferSize*numSlots);
+ m_etelStore.Read(iStatus, index, numSlots, m_buffer);
+ SetActive();
+ m_state = ReadState;
+
+ error = QContactManager::NoError;
+ return true;
+}
+
+bool CntSimStorePrivate::write(const QContact &contact, QContactManager::Error &error)
+{
+ if (IsActive()) {
+ error = QContactManager::LockedError;
+ return false;
+ }
+
+ // get index
+ m_writeIndex = KErrNotFound;
+ if (contact.id().managerUri() == m_managerUri &&
+ contact.localId() > 0) {
+ m_writeIndex = contact.localId();
+ }
+
+ // encode
+ m_buffer.Zero();
+ m_buffer.ReAlloc(KOneSimContactBufferSize);
+ TRAPD(err, m_convertedContact = encodeSimContactL(&contact, m_buffer));
+ if (err != KErrNone) {
+ CntSymbianSimTransformError::transformError(err, error);
+ return false;
+ }
+
+ // start writing
+ m_etelStore.Write(iStatus, m_buffer, m_writeIndex);
+ SetActive();
+ m_state = WriteState;
+
+ error = QContactManager::NoError;
+ return true;
+}
+
+bool CntSimStorePrivate::remove(int index, QContactManager::Error &error)
+{
+ if (IsActive()) {
+ error = QContactManager::LockedError;
+ return false;
+ }
+
+ // NOTE:
+ // If index points to an empty slot and running in hardware the
+ // delete operation will not return any error.
+
+ m_etelStore.Delete(iStatus, index);
+ SetActive();
+ m_state = DeleteState;
+
+ error = QContactManager::NoError;
+ return true;
+}
+
+bool CntSimStorePrivate::getReservedSlots(QContactManager::Error &error)
+{
+ if (IsActive()) {
+ error = QContactManager::LockedError;
+ return false;
+ }
+
+ // start reading
+ m_buffer.Zero();
+ m_buffer.ReAlloc(KOneSimContactBufferSize*m_storeInfo.iTotalEntries);
+ m_etelStore.Read(iStatus, 1, m_storeInfo.iTotalEntries, m_buffer);
+ SetActive();
+ m_state = ReadReservedSlotsState;
+
+ error = QContactManager::NoError;
+ return true;
+}
+
+void CntSimStorePrivate::DoCancel()
+{
+ if (m_state == ReadState)
+ m_etelStore.CancelAsyncRequest(EMobilePhoneStoreRead);
+ if (m_state == WriteState)
+ m_etelStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
+ if (m_state == DeleteState)
+ m_etelStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
+ if (m_state == ReadReservedSlotsState)
+ m_etelStore.CancelAsyncRequest(EMobilePhoneStoreRead);
+
+ m_state = InactiveState;
+}
+
+void CntSimStorePrivate::RunL()
+{
+ //qDebug() << "CntSimStorePrivate::RunL()" << m_state << iStatus.Int();
+
+ m_asyncError = iStatus.Int();
+ User::LeaveIfError(iStatus.Int());
+
+ // NOTE: It is assumed that emitting signals is queued
+
+ switch (m_state)
+ {
+ case ReadState:
+ {
+ QList<QContact> contacts = decodeSimContactsL(m_buffer);
+ emit m_simStore.readComplete(contacts, QContactManager::NoError);
+ }
+ break;
+
+ case WriteState:
+ {
+ // save id
+ QContactId contactId;
+ contactId.setLocalId(m_writeIndex);
+ contactId.setManagerUri(m_managerUri);
+ m_convertedContact.setId(contactId);
+
+ // set sync target
+ QContactSyncTarget syncTarget;
+ syncTarget.setSyncTarget(KSimSyncTarget);
+ m_convertedContact.saveDetail(&syncTarget);
+
+ emit m_simStore.writeComplete(m_convertedContact, QContactManager::NoError);
+ }
+ break;
+
+ case DeleteState:
+ {
+ emit m_simStore.removeComplete(QContactManager::NoError);
+ }
+ break;
+
+ case ReadReservedSlotsState:
+ {
+ QList<int> reservedSlots = decodeReservedSlotsL(m_buffer);
+ emit m_simStore.getReservedSlotsComplete(reservedSlots, QContactManager::NoError);
+ }
+ break;
+
+ default:
+ {
+ User::Leave(KErrUnknown);
+ }
+ break;
+ }
+ m_state = InactiveState;
+}
+
+TInt CntSimStorePrivate::RunError(TInt aError)
+{
+ QContactManager::Error qtError = QContactManager::NoError;
+ CntSymbianSimTransformError::transformError(aError, qtError);
+
+ // NOTE: It is assumed that emitting signals is queued
+
+ if (m_state == ReadState)
+ emit m_simStore.readComplete(QList<QContact>(), qtError);
+ else if (m_state == WriteState)
+ emit m_simStore.writeComplete(m_convertedContact, qtError);
+ else if (m_state == DeleteState)
+ emit m_simStore.removeComplete(qtError);
+ else if (m_state == ReadReservedSlotsState)
+ emit m_simStore.getReservedSlotsComplete(QList<int>(), qtError);
+
+ m_state = InactiveState;
+
+ return KErrNone;
+}
+
+/*! Parses SIM contacts in TLV format.
+ *
+ * \param rawData SIM contacts in TLV format.
+ * \return List of contacts.
+*/
+QList<QContact> CntSimStorePrivate::decodeSimContactsL(TDes8& rawData) const
+{
+ PbkPrintToLog(_L("CntSymbianSimEngine::decodeSimContactsL() - IN"));
+ QList<QContact> fetchedContacts;
+ QContact currentContact;
+
+ TBuf16<KDataClientBuf> buffer;
+ TPtrC16 bufPtr(buffer);
+
+ TUint8 tagValue(0);
+ CPhoneBookBuffer::TPhBkTagType dataType;
+
+ bool isAdditionalNumber = false;
+
+ CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
+ CleanupStack::PushL(pbBuffer);
+ pbBuffer->Set(&rawData);
+ pbBuffer->StartRead();
+
+ while (pbBuffer->GetTagAndType(tagValue, dataType) == KErrNone) {
+ switch (tagValue)
+ {
+ case RMobilePhoneBookStore::ETagPBAdnIndex:
+ {
+ //save contact's id (SIM card index) and manager's name
+ TUint16 index;
+ if (pbBuffer->GetValue(index) == KErrNone) {
+ QScopedPointer<QContactId> contactId(new QContactId());
+ contactId->setLocalId(index);
+ contactId->setManagerUri(m_managerUri);
+ currentContact.setId(*contactId);
+ }
+ isAdditionalNumber = false;
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBTonNpi:
+ {
+ // Note, that TON info can be incorporated into the phone number by Etel
+ // implementation (TSY). E.g. this is the case with Nokia TSY.
+ // Here general case is implemented.
+
+ // Check number type, we are only interested if it's international or not.
+ // We assume here that ETagPBTonNpi always comes after ETagPBNumber, not before.
+ TUint8 tonNpi;
+ if (pbBuffer->GetValue(tonNpi) == KErrNone) {
+ TUint8 intFlag = (tonNpi & KEtsiTonPosition) >> 4;
+ if (intFlag == 1) {
+ //international number format, append "+" to the last
+ //saved number
+ QList<QContactDetail> phoneNumbers = currentContact.details(
+ QContactPhoneNumber::DefinitionName);
+ if (phoneNumbers.count() > 0) {
+ QContactPhoneNumber lastNumber = static_cast<QContactPhoneNumber>(
+ phoneNumbers.at(phoneNumbers.count() - 1));
+ QString number = lastNumber.number();
+ number.insert(0, "+");
+ lastNumber.setNumber(number);
+ if (m_readOnlyAccess)
+ m_engine.setReadOnlyAccessConstraint(&lastNumber);
+ currentContact.saveDetail(&lastNumber);
+ }
+ }
+ }
+
+ // We have rearched to the end of the number,
+ // invalidate additional number flag.
+ isAdditionalNumber = false;
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBText:
+ {
+ if (pbBuffer->GetValue(bufPtr) == KErrNone) {
+ if (isAdditionalNumber) {
+ // For additional number bufPtr contains number alpha string,
+ // this is ignored currently
+ }
+ else {
+ // Contact name otherwise
+ QContactName name;
+ QString nameString = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
+ name.setCustomLabel(nameString);
+ if (m_readOnlyAccess)
+ m_engine.setReadOnlyAccessConstraint(&name);
+ currentContact.saveDetail(&name);
+ QContactManager::Error error(QContactManager::NoError);
+ currentContact = m_engine.setContactDisplayLabel(m_engine.synthesizedDisplayLabel(currentContact, error), currentContact);
+ }
+ }
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBSecondName:
+ {
+ if (pbBuffer->GetValue(bufPtr) == KErrNone) {
+ QContactNickname nickName;
+ QString name = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
+ nickName.setNickname(name);
+ if (m_readOnlyAccess)
+ m_engine.setReadOnlyAccessConstraint(&nickName);
+ currentContact.saveDetail(&nickName);
+ }
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBNumber:
+ {
+ if (pbBuffer->GetValue(bufPtr) == KErrNone) {
+ QContactPhoneNumber phoneNumber;
+ phoneNumber.setSubTypes( QContactPhoneNumber::SubTypeMobile );
+ QString number = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
+ phoneNumber.setNumber(number);
+ if (m_readOnlyAccess)
+ m_engine.setReadOnlyAccessConstraint(&phoneNumber);
+ currentContact.saveDetail(&phoneNumber);
+ }
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBAnrStart:
+ {
+ // This tag should precede every additional number entry
+ isAdditionalNumber = true;
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBEmailAddress:
+ {
+ if (pbBuffer->GetValue(bufPtr) == KErrNone) {
+ QContactEmailAddress email;
+ QString emailAddress = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length());
+ email.setEmailAddress(emailAddress);
+ if (m_readOnlyAccess)
+ m_engine.setReadOnlyAccessConstraint(&email);
+ currentContact.saveDetail(&email);
+ }
+ break;
+ }
+ case RMobilePhoneBookStore::ETagPBNewEntry:
+ {
+ // This signals the end of the entry and is a special case
+ // which will be handled below.
+ break;
+ }
+ default:
+ {
+ // An unsupported field type - just skip this value
+ pbBuffer->SkipValue(dataType);
+ break;
+ }
+ } //switch
+
+ // save contact to the array of contact to be returned if the whole entry was extracted
+ if ((tagValue == RMobilePhoneBookStore::ETagPBNewEntry && currentContact.localId() > 0) ||
+ (pbBuffer->RemainingReadLength() == 0 && currentContact.localId() > 0)) {
+ //QContactSyncTarget syncTarget;
+ //syncTarget.setSyncTarget(KSimSyncTarget);
+ //currentContact.saveDetail(&syncTarget);
+ fetchedContacts.append(currentContact);
+ //clear current contact
+ currentContact.clearDetails();
+ QScopedPointer<QContactId> contactId(new QContactId());
+ contactId->setLocalId(0);
+ contactId->setManagerUri(QString());
+ currentContact.setId(*contactId);
+ }
+ } //while
+
+ CleanupStack::PopAndDestroy(pbBuffer);
+ PbkPrintToLog(_L("CntSymbianSimEngine::decodeSimContactsL() - OUT"));
+ return fetchedContacts;
+}
+
+/*! Converts QContact to the TLV format which is used to save it to the Etel store.
+ *
+ * \param contact QContact to be converted
+ * \param rawData Contact in TLV format on return.
+ * \return QContact containing actually saved information.
+*/
+QContact CntSimStorePrivate::encodeSimContactL(const QContact* contact, TDes8& rawData) const
+{
+ PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - IN"));
+ QContact convertedContact;
+ CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
+ CleanupStack::PushL(pbBuffer);
+ pbBuffer->Set(&rawData);
+
+ //add new enty tag
+ User::LeaveIfError(pbBuffer->AddNewEntryTag());
+
+ //add name
+ QString name;
+ QList<QContactDetail> nameDetails = contact->details(QContactName::DefinitionName);
+ if (nameDetails.count() == 0) {
+ // TODO: should we leave name empty?
+ name.append("Unnamed");
+ }
+ else {
+ QContactName nameDetail = static_cast<QContactName>(nameDetails.at(0));
+ name.append(nameDetail.customLabel());
+ if (name.isNull()) {
+ // TODO: should we leave name empty?
+ name.append("Unnamed)");
+ }
+ }
+ name = name.left(m_storeInfo.iMaxTextLength); //trim to the max possible length
+ TPtrC nameValue(reinterpret_cast<const TUint16*>(name.utf16()));
+ User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBText, nameValue));
+
+ QContactName convertedNameDetail;
+ convertedNameDetail.setCustomLabel(name);
+ convertedContact.saveDetail(&convertedNameDetail);
+
+ //add nickname
+#ifndef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
+ if (m_storeInfo.iMaxSecondNames > 0) {
+ QString nickname;
+ QList<QContactDetail> nicknameDetails = contact->details(QContactNickname::DefinitionName);
+ if (nicknameDetails.count() > 0) {
+ QContactNickname nicknameDetail = static_cast<QContactNickname>(nicknameDetails.at(0));
+ nickname = nicknameDetail.nickname();
+ nickname = nickname.left(m_storeInfo.iMaxTextLengthSecondName); //trim to the max possible length
+ TPtrC nicknameValue(reinterpret_cast<const TUint16*>(nickname.utf16()));
+ User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBSecondName, nicknameValue));
+
+ QContactNickname convertedNicknameDetail;
+ convertedNicknameDetail.setNickname(nickname);
+ convertedContact.saveDetail(&convertedNicknameDetail);
+ }
+ }
+#endif
+
+ //add phone number
+ QList<QContactDetail> phoneNumberDetails = contact->details(QContactPhoneNumber::DefinitionName);
+ if (phoneNumberDetails.count() > 0) {
+ PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - add phone number"));
+ QContactPhoneNumber phoneNumberDetail = static_cast<QContactPhoneNumber>(phoneNumberDetails.at(0));
+ QString number = phoneNumberDetail.number();
+ foreach (const QChar character, number) {
+ if(!character.isDigit()) {
+ if(character != QChar('+')
+ && character != QChar('*')
+ && character != QChar('#')
+ && character != QChar('p')
+ && character != QChar('w')) {
+ User::Leave(KErrArgument);
+ }
+ }
+ }
+ PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - phone number length = %d"),
+ phoneNumberDetail.number().length());
+ if (phoneNumberDetail.number().length() > m_storeInfo.iMaxNumLength) {
+ User::Leave(KErrTooBig);
+ }
+ TPtrC phoneNumberValue(reinterpret_cast<const TUint16*>(phoneNumberDetail.number().utf16()));
+ PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - number = %S"), &phoneNumberValue);
+ User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, phoneNumberValue));
+
+ QContactPhoneNumber convertedPhoneNumberDetail;
+ convertedPhoneNumberDetail.setNumber(phoneNumberDetail.number());
+ convertedContact.saveDetail(&convertedPhoneNumberDetail);
+ }
+
+ //add additional numbers
+#ifndef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
+ if (m_storeInfo.iMaxAdditionalNumbers > 0) {
+ //one number is saved already
+ for (int i = 1; i < phoneNumberDetails.count() && i-1 < m_storeInfo.iMaxAdditionalNumbers; ++i) {
+ QContactPhoneNumber phoneNumberDetail = static_cast<QContactPhoneNumber>(phoneNumberDetails.at(i));
+ if (phoneNumberDetail.number().length() > m_storeInfo.iMaxNumLengthAdditionalNumber) {
+ User::Leave(KErrTooBig);
+ }
+ //mark the beginning of an additional number
+ User::LeaveIfError(pbBuffer->AddNewNumberTag());
+ //add number itself
+ TPtrC phoneNumberValue(reinterpret_cast<const TUint16*>(phoneNumberDetail.number().utf16()));
+ User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, phoneNumberValue));
+
+ QContactPhoneNumber convertedPhoneNumberDetail;
+ convertedPhoneNumberDetail.setNumber(phoneNumberDetail.number());
+ convertedContact.saveDetail(&convertedPhoneNumberDetail);
+ }
+ }
+#endif
+
+ //add e-mails
+#ifndef SYMBIANSIM_BACKEND_PHONEBOOKINFOV1
+ if (m_storeInfo.iMaxEmailAddr > 0) {
+ QList<QContactDetail> emailDetails = contact->details(QContactEmailAddress::DefinitionName);
+ for (int i = 0; i < emailDetails.count() && i < m_storeInfo.iMaxEmailAddr; ++i) {
+ QContactEmailAddress emailDetail = static_cast<QContactEmailAddress>(emailDetails.at(i));
+ TPtrC emailValue(reinterpret_cast<const TUint16*>(emailDetail.emailAddress().utf16()));
+ if (emailValue.Length() > m_storeInfo.iMaxTextLengthEmailAddr) {
+ User::Leave(KErrTooBig);
+ }
+ User::LeaveIfError(pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBEmailAddress, emailValue));
+
+ QContactEmailAddress convertedEmailDetail;
+ convertedEmailDetail.setEmailAddress(emailDetail.emailAddress());
+ convertedContact.saveDetail(&convertedEmailDetail);
+ }
+ }
+#endif
+
+ CleanupStack::PopAndDestroy(pbBuffer);
+ PbkPrintToLog(_L("CntSymbianSimEngine::encodeSimContactL() - OUT"));
+ return convertedContact;
+}
+
+QList<int> CntSimStorePrivate::decodeReservedSlotsL(TDes8& rawData) const
+{
+ QList<int> reservedSlots;
+
+ TUint8 tagValue(0);
+ CPhoneBookBuffer::TPhBkTagType dataType;
+
+ CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer();
+ CleanupStack::PushL(pbBuffer);
+ pbBuffer->Set(&rawData);
+ pbBuffer->StartRead();
+
+ while (pbBuffer->GetTagAndType(tagValue, dataType) == KErrNone)
+ {
+ if (tagValue == RMobilePhoneBookStore::ETagPBAdnIndex)
+ {
+ TUint16 index;
+ if (pbBuffer->GetValue(index) == KErrNone)
+ reservedSlots.append(index);
+ } else
+ pbBuffer->SkipValue(dataType);
+ } //while
+
+ CleanupStack::PopAndDestroy(pbBuffer);
+ return reservedSlots;
+}
+
diff --git a/plugins/contacts/symbiansim/src/cntsymbiansimtransformerror.cpp b/plugins/contacts/symbiansim/src/cntsymbiansimtransformerror.cpp
index 95dab9cae2..ac29ddc4ef 100644
--- a/plugins/contacts/symbiansim/src/cntsymbiansimtransformerror.cpp
+++ b/plugins/contacts/symbiansim/src/cntsymbiansimtransformerror.cpp
@@ -1,100 +1,100 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cntsymbiansimtransformerror.h"
-
-/*! Transform a Symbian contact error id to QContactManager::Error.
- *
- * \param symbianError Symbian error.
- * \param QtError Qt error.
-*/
-void CntSymbianSimTransformError::transformError(TInt symbianError, QContactManager::Error& qtError)
-{
- switch(symbianError)
- {
- case KErrNone:
- {
- qtError = QContactManager::NoError;
- break;
- }
- case KErrNotFound:
- {
- qtError = QContactManager::DoesNotExistError;
- break;
- }
- case KErrAlreadyExists:
- {
- qtError = QContactManager::AlreadyExistsError;
- break;
- }
- case KErrLocked:
- {
- qtError = QContactManager::LockedError;
- break;
- }
- case KErrAccessDenied:
- case KErrPermissionDenied:
- {
- qtError = QContactManager::PermissionsError;
- break;
- }
- case KErrNoMemory:
- {
- qtError = QContactManager::OutOfMemoryError;
- break;
- }
- case KErrNotSupported:
- {
- qtError = QContactManager::NotSupportedError;
- break;
- }
- case KErrArgument:
- {
- qtError = QContactManager::BadArgumentError;
- break;
- }
- default:
- {
- qtError = QContactManager::UnspecifiedError;
- break;
- }
- }
-}
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cntsymbiansimtransformerror.h"
+
+/*! Transform a Symbian contact error id to QContactManager::Error.
+ *
+ * \param symbianError Symbian error.
+ * \param QtError Qt error.
+*/
+void CntSymbianSimTransformError::transformError(TInt symbianError, QContactManager::Error& qtError)
+{
+ switch(symbianError)
+ {
+ case KErrNone:
+ {
+ qtError = QContactManager::NoError;
+ break;
+ }
+ case KErrNotFound:
+ {
+ qtError = QContactManager::DoesNotExistError;
+ break;
+ }
+ case KErrAlreadyExists:
+ {
+ qtError = QContactManager::AlreadyExistsError;
+ break;
+ }
+ case KErrLocked:
+ {
+ qtError = QContactManager::LockedError;
+ break;
+ }
+ case KErrAccessDenied:
+ case KErrPermissionDenied:
+ {
+ qtError = QContactManager::PermissionsError;
+ break;
+ }
+ case KErrNoMemory:
+ {
+ qtError = QContactManager::OutOfMemoryError;
+ break;
+ }
+ case KErrNotSupported:
+ {
+ qtError = QContactManager::NotSupportedError;
+ break;
+ }
+ case KErrArgument:
+ {
+ qtError = QContactManager::BadArgumentError;
+ break;
+ }
+ default:
+ {
+ qtError = QContactManager::UnspecifiedError;
+ break;
+ }
+ }
+}