messagingapp/msgui/appengine/src/conversationsengineutility.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:35:48 +0300
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 47 5b14749788d7
child 52 12db4185673b
permissions -rw-r--r--
Revision: 201021 Kit: 2010123
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
 * Contributors:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
 *
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
 * Description: Utility class for conersationengine.
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
 */
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
#include <QFile>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
#include <qversitcontactimporter.h>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
#include <qversitdocument.h>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include <qversitreader.h>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include <qtcontacts.h>
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <qmobilityglobal.h>
34
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
    22
#include <SendUiConsts.h>
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "conversationsengineutility.h"
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include "convergedmessage.h"
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
QTM_USE_NAMESPACE
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
//---------------------------------------------------------------
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
// ConversationsEngineUtility::messageType
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
// @see header
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
//---------------------------------------------------------------
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
int ConversationsEngineUtility::messageType(TCsType value)
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
{
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
    int mMessageType;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
    switch (value) {
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
    case ECsSMS:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
        mMessageType = ConvergedMessage::Sms;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
    case ECsMMS:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
    case ECsAudio:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
        mMessageType = ConvergedMessage::Mms;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
    case ECsBioMsg:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
    case ECsRingingTone:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
    case ECsProvisioning:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
    case ECsBioMsg_VCard:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
    case ECsBioMsg_VCal:
34
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
    50
    case ECsBioMgs_NokiaService:
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
        mMessageType = ConvergedMessage::BioMsg;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
    case ECsBlueTooth:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
        mMessageType = ConvergedMessage::BT;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
    case ECsMmsNotification:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
        mMessageType = ConvergedMessage::MmsNotification;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
    default:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
        mMessageType = ConvergedMessage::None;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
    }
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
    return mMessageType;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
}
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
//---------------------------------------------------------------
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
// ConversationsEngineUtility::mapMsgType
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
// @see header
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
//---------------------------------------------------------------
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
int ConversationsEngineUtility::messageType(TInt32 value)
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
{
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
    int type;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
    switch (value) {
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
    case KSenduiMtmSmsUidValue:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
        type = ConvergedMessage::Sms;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
    case KSenduiMtmBtUidValue:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
        type = ConvergedMessage::BT;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
    case KSenduiMtmMmsUidValue:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
        type = ConvergedMessage::Mms;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
    case KSenduiMtmBioUidValue:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
        type = ConvergedMessage::BioMsg;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
    default:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
        type = ConvergedMessage::None;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
    }
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    return type;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
}
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
//---------------------------------------------------------------
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
// ConversationsEngineUtility::messageSubType
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
// @see header
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
//---------------------------------------------------------------
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
int ConversationsEngineUtility::messageSubType(TCsType value)
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
{
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
    int messageSubType;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
    switch (value) {
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
    case ECsRingingTone:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
        messageSubType = ConvergedMessage::RingingTone;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
    case ECsProvisioning:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
        messageSubType = ConvergedMessage::Provisioning;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
    case ECsBioMsg_VCard:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
        messageSubType = ConvergedMessage::VCard;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
    case ECsBioMsg_VCal:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
        messageSubType = ConvergedMessage::VCal;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
    case ECsAudio:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
        messageSubType = ConvergedMessage::Audio;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
        break;
34
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   116
    case ECsBioMgs_NokiaService:
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   117
        messageSubType = ConvergedMessage::NokiaService;
84197e66a4bd Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 31
diff changeset
   118
        break;
31
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
    default:
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
        messageSubType = ConvergedMessage::None;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
        break;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
    }
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
    return messageSubType;
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
}
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
ebfee66fde93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
// End of file