messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp
author hgs
Tue, 29 Jun 2010 23:42:47 +0530
changeset 38 4e4b6adb1024
parent 37 518b245aa84c
child 48 4f501b74aeb1
permissions -rw-r--r--
201025_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
 * Contributors:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
 * Description:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 *
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
 */
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include "msgconversationviewitem.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
// SYSTEM INCLUDES
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <QDateTime>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include "debugtraces.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <QDir>
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    24
#include <QChar>
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <HbTextItem>
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <HbIconItem>
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    27
#include <HbIconAnimationManager>
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    28
#include <HbIconAnimator>
37
hgs
parents: 25
diff changeset
    29
#include <ccsdefs.h>
hgs
parents: 25
diff changeset
    30
#include <HbInstance>
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
// USER INCLUDES
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "msgconversationwidget.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "msgviewdefines.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "msgviewutils.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include "convergedmessage.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "conversationsenginedefines.h"
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
// LOCAL CONSTANTS
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    40
const QString MSG_OUTBOX_ICON("qtg_small_outbox");
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    41
const QString MSG_FAIL_ICON("qtg_small_fail");
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    42
const QString ANIMATION_FILE(":/qtg_anim_loading.axml");
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    43
const QString ANIMATION_ICON_NAME("qtg_anim_loading");
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    44
const QString VCARD_ICON("qtg_large_mycard");
37
hgs
parents: 25
diff changeset
    45
const QString IMAGE_ICON("qtg_small_image");
hgs
parents: 25
diff changeset
    46
const QString CORRUPTED_ICON("qtg_small_corrupted");
hgs
parents: 25
diff changeset
    47
const QString MSG_VIDEO_ICON("qtg_small_video");
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    49
// LOCALIZATION
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone")
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
#define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card")
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    52
#define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    53
#define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_listview_unsupported_message_type")
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    54
#define LOC_RESEND_AT hbTrId("Resend at ")
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
// MsgConversationViewItem::MsgConversationViewItem
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
// Constructor
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
MsgConversationViewItem::MsgConversationViewItem(QGraphicsItem* parent) :
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    HbListViewItem(parent), mIncoming(false), mConversation(0),
37
hgs
parents: 25
diff changeset
    62
            mIncomingMsgStateIconItem(0), mOutgoingMsgStateIconItem(0)
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
// MsgConversationViewItem::MsgConversationViewItem
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// Destructor
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
MsgConversationViewItem::~MsgConversationViewItem()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
// MsgConversationViewItem::createItem
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
// Create a new decorator item.
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
MsgConversationViewItem* MsgConversationViewItem::createItem()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
{
37
hgs
parents: 25
diff changeset
    80
    MsgConversationViewItem *item = new MsgConversationViewItem(*this);
hgs
parents: 25
diff changeset
    81
    item->init();
hgs
parents: 25
diff changeset
    82
    return item;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
// MsgConversationViewItem::updateChildItems
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
//
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
void MsgConversationViewItem::updateChildItems()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    QModelIndex index = modelIndex();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
#ifdef _DEBUG_TRACES_
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    qCritical() << "START MsgConversationViewItem::updateChildItems: "
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
            << index.data(ConvergedMsgId).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
#endif
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    98
    int messageType = index.data(MessageType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    99
    int messageSubType = index.data(MessageSubType).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   100
37
hgs
parents: 25
diff changeset
   101
    
hgs
parents: 25
diff changeset
   102
    if (messageType == ConvergedMessage::Sms)
hgs
parents: 25
diff changeset
   103
        {
hgs
parents: 25
diff changeset
   104
        	updateSmsTypeItem(index);
hgs
parents: 25
diff changeset
   105
        }
hgs
parents: 25
diff changeset
   106
    else if (messageType == ConvergedMessage::Mms || messageType
hgs
parents: 25
diff changeset
   107
            == ConvergedMessage::MmsNotification || messageType
hgs
parents: 25
diff changeset
   108
            == ConvergedMessage::BT)
hgs
parents: 25
diff changeset
   109
        {
hgs
parents: 25
diff changeset
   110
        updateMmsTypeItem(index, messageType, messageSubType);
hgs
parents: 25
diff changeset
   111
        }
hgs
parents: 25
diff changeset
   112
    else if (messageType == ConvergedMessage::BioMsg)
hgs
parents: 25
diff changeset
   113
        {
hgs
parents: 25
diff changeset
   114
        if (messageSubType == ConvergedMessage::VCard || messageSubType
hgs
parents: 25
diff changeset
   115
                == ConvergedMessage::RingingTone)
hgs
parents: 25
diff changeset
   116
            {
hgs
parents: 25
diff changeset
   117
            updateMmsTypeItem(index, messageType, messageSubType);
hgs
parents: 25
diff changeset
   118
            }
hgs
parents: 25
diff changeset
   119
        else
hgs
parents: 25
diff changeset
   120
            {
hgs
parents: 25
diff changeset
   121
            updateSmsTypeItem(index, messageSubType);
hgs
parents: 25
diff changeset
   122
            }
hgs
parents: 25
diff changeset
   123
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
37
hgs
parents: 25
diff changeset
   125
#ifdef _DEBUG_TRACES_
hgs
parents: 25
diff changeset
   126
    qCritical() << "END MsgConversationViewItem::updateChildItems: "
hgs
parents: 25
diff changeset
   127
            << index.data(ConvergedMsgId).toInt();
hgs
parents: 25
diff changeset
   128
#endif
hgs
parents: 25
diff changeset
   129
hgs
parents: 25
diff changeset
   130
    repolish();
hgs
parents: 25
diff changeset
   131
    HbListViewItem::updateChildItems();
hgs
parents: 25
diff changeset
   132
    }
hgs
parents: 25
diff changeset
   133
hgs
parents: 25
diff changeset
   134
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   135
// MsgConversationViewItem::updateSmsTypeItem
hgs
parents: 25
diff changeset
   136
// @see header file
hgs
parents: 25
diff changeset
   137
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   138
void MsgConversationViewItem::updateSmsTypeItem(const QModelIndex& index,
hgs
parents: 25
diff changeset
   139
    int messageSubType)
hgs
parents: 25
diff changeset
   140
{
hgs
parents: 25
diff changeset
   141
hgs
parents: 25
diff changeset
   142
    mIncoming = false;
hgs
parents: 25
diff changeset
   143
    mConversation->resetProperties();
hgs
parents: 25
diff changeset
   144
    
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    int direction = index.data(Direction).toInt();
37
hgs
parents: 25
diff changeset
   146
    
hgs
parents: 25
diff changeset
   147
    if (direction == ConvergedMessage::Incoming)
hgs
parents: 25
diff changeset
   148
        {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
        setIncoming(true);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
        mConversation->setIncoming(true);
37
hgs
parents: 25
diff changeset
   151
hgs
parents: 25
diff changeset
   152
        mIncomingMsgStateIconItem->setVisible(false);
hgs
parents: 25
diff changeset
   153
    }
hgs
parents: 25
diff changeset
   154
    else if (direction == ConvergedMessage::Outgoing)
hgs
parents: 25
diff changeset
   155
        {
hgs
parents: 25
diff changeset
   156
        setIncoming(false);
hgs
parents: 25
diff changeset
   157
        mConversation->setIncoming(false);
hgs
parents: 25
diff changeset
   158
hgs
parents: 25
diff changeset
   159
        int sendingState = index.data(SendingState).toInt();
hgs
parents: 25
diff changeset
   160
        mConversation->setSendingState(sendingState);
hgs
parents: 25
diff changeset
   161
        setMessageStateIcon(sendingState);
hgs
parents: 25
diff changeset
   162
        }
hgs
parents: 25
diff changeset
   163
hgs
parents: 25
diff changeset
   164
    bool unreadStatus = index.data(UnReadStatus).toBool();
hgs
parents: 25
diff changeset
   165
    mConversation->setUnread(unreadStatus);
hgs
parents: 25
diff changeset
   166
hgs
parents: 25
diff changeset
   167
    mConversation->drawBubbleFrame();
hgs
parents: 25
diff changeset
   168
    mConversation->drawNewItemFrame();
hgs
parents: 25
diff changeset
   169
hgs
parents: 25
diff changeset
   170
    QDateTime dateTime;
hgs
parents: 25
diff changeset
   171
    dateTime.setTime_t(index.data(TimeStamp).toUInt());
hgs
parents: 25
diff changeset
   172
    QString resendStateNote((index.data(SendingState).toInt()
hgs
parents: 25
diff changeset
   173
                    == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
hgs
parents: 25
diff changeset
   174
    if (dateTime.date() == QDateTime::currentDateTime().date())
hgs
parents: 25
diff changeset
   175
        {
hgs
parents: 25
diff changeset
   176
hgs
parents: 25
diff changeset
   177
        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
hgs
parents: 25
diff changeset
   178
                        TIME_FORMAT));
hgs
parents: 25
diff changeset
   179
        }
hgs
parents: 25
diff changeset
   180
    else
hgs
parents: 25
diff changeset
   181
        {
hgs
parents: 25
diff changeset
   182
        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
hgs
parents: 25
diff changeset
   183
                        DATE_FORMAT));
hgs
parents: 25
diff changeset
   184
        }
hgs
parents: 25
diff changeset
   185
hgs
parents: 25
diff changeset
   186
    if (messageSubType == ConvergedMessage::VCal)
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   187
        {
37
hgs
parents: 25
diff changeset
   188
         mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE);
hgs
parents: 25
diff changeset
   189
        }
hgs
parents: 25
diff changeset
   190
    else
hgs
parents: 25
diff changeset
   191
        {
hgs
parents: 25
diff changeset
   192
        QString bodyText = index.data(BodyText).toString();
hgs
parents: 25
diff changeset
   193
        bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
hgs
parents: 25
diff changeset
   194
        bodyText.replace('\r', QChar::LineSeparator);
hgs
parents: 25
diff changeset
   195
        mConversation->setSubject(bodyText);
hgs
parents: 25
diff changeset
   196
        }
hgs
parents: 25
diff changeset
   197
    
hgs
parents: 25
diff changeset
   198
    //repolish
hgs
parents: 25
diff changeset
   199
    mConversation->repolishWidget();
hgs
parents: 25
diff changeset
   200
    }
hgs
parents: 25
diff changeset
   201
hgs
parents: 25
diff changeset
   202
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   203
// MsgConversationViewItem::updateMmsTypeItem
hgs
parents: 25
diff changeset
   204
// @see header file
hgs
parents: 25
diff changeset
   205
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   206
void MsgConversationViewItem::updateMmsTypeItem(const QModelIndex& index,
hgs
parents: 25
diff changeset
   207
        int messageType, int messageSubType)
hgs
parents: 25
diff changeset
   208
    {
hgs
parents: 25
diff changeset
   209
    // create widget
hgs
parents: 25
diff changeset
   210
    if (!mConversation)
hgs
parents: 25
diff changeset
   211
        {
hgs
parents: 25
diff changeset
   212
        mConversation = new MsgConversationWidget(this);
hgs
parents: 25
diff changeset
   213
        HbStyle::setItemName(mConversation, "msgconvwidget");
hgs
parents: 25
diff changeset
   214
        }
hgs
parents: 25
diff changeset
   215
    mIncoming = false;
hgs
parents: 25
diff changeset
   216
    mConversation->resetProperties();
hgs
parents: 25
diff changeset
   217
    
hgs
parents: 25
diff changeset
   218
    mConversation->setMMS(true);
hgs
parents: 25
diff changeset
   219
    int direction = index.data(Direction).toInt();
hgs
parents: 25
diff changeset
   220
    QString bodyText = index.data(BodyText).toString();
hgs
parents: 25
diff changeset
   221
hgs
parents: 25
diff changeset
   222
    if (direction == ConvergedMessage::Incoming)
hgs
parents: 25
diff changeset
   223
        {
hgs
parents: 25
diff changeset
   224
        setIncoming(true);
hgs
parents: 25
diff changeset
   225
        mConversation->setIncoming(true);
hgs
parents: 25
diff changeset
   226
hgs
parents: 25
diff changeset
   227
        if (messageType == ConvergedMessage::MmsNotification)
hgs
parents: 25
diff changeset
   228
            {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   229
            mConversation->setMMSNotification(true);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   230
            int notificationState = index.data(NotificationStatus).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   231
            mConversation->setNotificationState(notificationState);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   232
            setNotificationStateIcon(notificationState);
37
hgs
parents: 25
diff changeset
   233
            }
hgs
parents: 25
diff changeset
   234
        else
hgs
parents: 25
diff changeset
   235
            {
hgs
parents: 25
diff changeset
   236
            mIncomingMsgStateIconItem->setVisible(false);
hgs
parents: 25
diff changeset
   237
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   238
        }
37
hgs
parents: 25
diff changeset
   239
    else if (direction == ConvergedMessage::Outgoing)
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   240
        {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
        setIncoming(false);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
        mConversation->setIncoming(false);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
        int sendingState = index.data(SendingState).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
        mConversation->setSendingState(sendingState);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
        setMessageStateIcon(sendingState);
37
hgs
parents: 25
diff changeset
   247
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
    bool unreadStatus = index.data(UnReadStatus).toBool();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    mConversation->setUnread(unreadStatus);
37
hgs
parents: 25
diff changeset
   251
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    mConversation->drawBubbleFrame();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    mConversation->drawNewItemFrame();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    QDateTime dateTime;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    dateTime.setTime_t(index.data(TimeStamp).toUInt());
37
hgs
parents: 25
diff changeset
   257
    QString resendStateNote((index.data(SendingState).toInt()
hgs
parents: 25
diff changeset
   258
            == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
    if (dateTime.date() == QDateTime::currentDateTime().date())
37
hgs
parents: 25
diff changeset
   260
        {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
37
hgs
parents: 25
diff changeset
   262
        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
hgs
parents: 25
diff changeset
   263
                TIME_FORMAT));
hgs
parents: 25
diff changeset
   264
        }
hgs
parents: 25
diff changeset
   265
    else
hgs
parents: 25
diff changeset
   266
        {
hgs
parents: 25
diff changeset
   267
        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
hgs
parents: 25
diff changeset
   268
                DATE_FORMAT));
hgs
parents: 25
diff changeset
   269
        }
hgs
parents: 25
diff changeset
   270
hgs
parents: 25
diff changeset
   271
    if (messageType == ConvergedMessage::Mms)
hgs
parents: 25
diff changeset
   272
        {
hgs
parents: 25
diff changeset
   273
        //preview path
hgs
parents: 25
diff changeset
   274
        QString previewPath = index.data(Attachments).toString();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
        QString subject = index.data(Subject).toString();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
37
hgs
parents: 25
diff changeset
   277
        int msgProperty = index.data(MessageProperty).toInt();
hgs
parents: 25
diff changeset
   278
        bool hasAttachments = (msgProperty & EPreviewAttachment) ? true : false;
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
        if (hasAttachments)
37
hgs
parents: 25
diff changeset
   281
            {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
            mConversation->setAttachment();
37
hgs
parents: 25
diff changeset
   283
            }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
        else
37
hgs
parents: 25
diff changeset
   285
            {
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
            mConversation->setAttachment(false);
37
hgs
parents: 25
diff changeset
   287
            }
hgs
parents: 25
diff changeset
   288
        
hgs
parents: 25
diff changeset
   289
        // Now set the media contents
hgs
parents: 25
diff changeset
   290
        
hgs
parents: 25
diff changeset
   291
        //preview image
hgs
parents: 25
diff changeset
   292
        bool hasImage = (msgProperty & EPreviewImage) ? true : false;
hgs
parents: 25
diff changeset
   293
        if (hasImage)
hgs
parents: 25
diff changeset
   294
          {
hgs
parents: 25
diff changeset
   295
            mConversation->setImage(true);
hgs
parents: 25
diff changeset
   296
            HbIcon previewIcon;
hgs
parents: 25
diff changeset
   297
            if (msgProperty & EPreviewProtectedImage)
hgs
parents: 25
diff changeset
   298
              {
hgs
parents: 25
diff changeset
   299
                previewIcon = HbIcon(IMAGE_ICON);
hgs
parents: 25
diff changeset
   300
              }
hgs
parents: 25
diff changeset
   301
            else if (msgProperty & EPreviewCorruptedImage)
hgs
parents: 25
diff changeset
   302
              {
hgs
parents: 25
diff changeset
   303
                // TODO: Change to official icon.
hgs
parents: 25
diff changeset
   304
                previewIcon = HbIcon(CORRUPTED_ICON);
hgs
parents: 25
diff changeset
   305
              }
hgs
parents: 25
diff changeset
   306
            else
hgs
parents: 25
diff changeset
   307
              {
hgs
parents: 25
diff changeset
   308
                QVariant previewData = index.data(PreviewIcon);
hgs
parents: 25
diff changeset
   309
                previewIcon = qvariant_cast<HbIcon> (previewData);
hgs
parents: 25
diff changeset
   310
              }
hgs
parents: 25
diff changeset
   311
            mConversation->setPreviewIcon(previewIcon);
hgs
parents: 25
diff changeset
   312
          }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
37
hgs
parents: 25
diff changeset
   314
        bool hasVideo = (msgProperty & EPreviewVideo) ? true : false;
hgs
parents: 25
diff changeset
   315
        if (hasVideo)
hgs
parents: 25
diff changeset
   316
          {
hgs
parents: 25
diff changeset
   317
            mConversation->setVideo(true);
hgs
parents: 25
diff changeset
   318
            HbIcon videoPreviewIcon;
hgs
parents: 25
diff changeset
   319
            if (msgProperty & EPreviewProtectedVideo)
hgs
parents: 25
diff changeset
   320
              {
hgs
parents: 25
diff changeset
   321
                videoPreviewIcon = HbIcon(MSG_VIDEO_ICON);
hgs
parents: 25
diff changeset
   322
              }
hgs
parents: 25
diff changeset
   323
            else if (msgProperty & EPreviewCorruptedVideo)
hgs
parents: 25
diff changeset
   324
              {
hgs
parents: 25
diff changeset
   325
                videoPreviewIcon = HbIcon(CORRUPTED_ICON);
hgs
parents: 25
diff changeset
   326
              }
hgs
parents: 25
diff changeset
   327
            else
hgs
parents: 25
diff changeset
   328
              {
hgs
parents: 25
diff changeset
   329
                videoPreviewIcon = HbIcon(MSG_VIDEO_ICON);
hgs
parents: 25
diff changeset
   330
              }
hgs
parents: 25
diff changeset
   331
            mConversation->setPreviewIcon(videoPreviewIcon);
hgs
parents: 25
diff changeset
   332
          }
hgs
parents: 25
diff changeset
   333
        bool hasAudio = (msgProperty & EPreviewAudio) ? true : false;              
hgs
parents: 25
diff changeset
   334
        if (hasAudio)
hgs
parents: 25
diff changeset
   335
          {
hgs
parents: 25
diff changeset
   336
            mConversation->setAudio(true);
hgs
parents: 25
diff changeset
   337
            if (msgProperty & EPreviewProtectedAudio)
hgs
parents: 25
diff changeset
   338
              {
hgs
parents: 25
diff changeset
   339
                mConversation->displayAudioIcon();
hgs
parents: 25
diff changeset
   340
              }
hgs
parents: 25
diff changeset
   341
            else if (msgProperty & EPreviewCorruptedAudio)
hgs
parents: 25
diff changeset
   342
              {
hgs
parents: 25
diff changeset
   343
				mConversation->displayAudioIcon(CORRUPTED_ICON);
hgs
parents: 25
diff changeset
   344
              }
hgs
parents: 25
diff changeset
   345
            else
hgs
parents: 25
diff changeset
   346
              {
hgs
parents: 25
diff changeset
   347
                mConversation->displayAudioIcon();
hgs
parents: 25
diff changeset
   348
              }
hgs
parents: 25
diff changeset
   349
          }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   351
        int priority = index.data(MessagePriority).toInt();
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
        mConversation->setPriority(priority);
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
        mConversation->setSubject(subject);
37
hgs
parents: 25
diff changeset
   354
        mConversation->setBodyText(bodyText);
hgs
parents: 25
diff changeset
   355
        }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   356
    else if (messageType == ConvergedMessage::BioMsg)
37
hgs
parents: 25
diff changeset
   357
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   358
        if (messageSubType == ConvergedMessage::RingingTone)
37
hgs
parents: 25
diff changeset
   359
            {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   360
            mConversation->setImage(false);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   361
            mConversation->setAudio(true);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   362
            mConversation->displayAudioIcon();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   363
            mConversation->setSubject(LOC_RINGING_TONE);
37
hgs
parents: 25
diff changeset
   364
            mConversation->setBodyText(bodyText);
hgs
parents: 25
diff changeset
   365
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   366
        else if (messageSubType == ConvergedMessage::VCard)
37
hgs
parents: 25
diff changeset
   367
            {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   368
            mConversation->setImage(false);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   369
            mConversation->setAudio(true);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   370
            mConversation->displayAudioIcon(VCARD_ICON);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   371
            mConversation->setSubject(LOC_BUSINESS_CARD);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   372
            mConversation->setBodyText(bodyText);
37
hgs
parents: 25
diff changeset
   373
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   374
        }
37
hgs
parents: 25
diff changeset
   375
    else if (messageType == ConvergedMessage::BT)
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   376
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   377
        QString deviceName = index.data(ConversationAddress).toString();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   378
        mConversation->setSubject(deviceName);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   379
        QString blueToothBody;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   380
        if (messageSubType == ConvergedMessage::VCard)
37
hgs
parents: 25
diff changeset
   381
            {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   382
            mConversation->setImage(false);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   383
            mConversation->setAudio(true);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   384
            mConversation->displayAudioIcon(VCARD_ICON);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   385
            blueToothBody.append(LOC_BUSINESS_CARD);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   386
            blueToothBody.append(QChar::LineSeparator);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   387
            blueToothBody.append(bodyText);
37
hgs
parents: 25
diff changeset
   388
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   389
        else
37
hgs
parents: 25
diff changeset
   390
            {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   391
            blueToothBody.append(bodyText);
37
hgs
parents: 25
diff changeset
   392
            }
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   393
        mConversation->setBodyText(blueToothBody);
37
hgs
parents: 25
diff changeset
   394
        }
hgs
parents: 25
diff changeset
   395
    else if (messageType == ConvergedMessage::MmsNotification)
hgs
parents: 25
diff changeset
   396
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   397
        QString subject = index.data(Subject).toString();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   398
        int priority = index.data(MessagePriority).toInt();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   399
        mConversation->setPriority(priority);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   400
        mConversation->setSubject(subject);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   401
        mConversation->setBodyText(bodyText);
37
hgs
parents: 25
diff changeset
   402
        }
hgs
parents: 25
diff changeset
   403
    
hgs
parents: 25
diff changeset
   404
    //repolish widget
hgs
parents: 25
diff changeset
   405
    mConversation->repolishWidget();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
// MsgConversationViewItem::containsPoint
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
//
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
bool MsgConversationViewItem::containsPoint(const QPointF& point)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
{
37
hgs
parents: 25
diff changeset
   414
    return mConversation->boundingRect(). contains(mConversation->mapFromScene(
hgs
parents: 25
diff changeset
   415
        point));
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
// MsgConversationViewItem::setIncoming
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
void MsgConversationViewItem::setIncoming(bool incoming)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
    mIncoming = incoming;
37
hgs
parents: 25
diff changeset
   425
hgs
parents: 25
diff changeset
   426
    if (mIncoming)
hgs
parents: 25
diff changeset
   427
    {
hgs
parents: 25
diff changeset
   428
        HbStyle::setItemName(mOutgoingMsgStateIconItem, "");
hgs
parents: 25
diff changeset
   429
        mOutgoingMsgStateIconItem->setVisible(false);
hgs
parents: 25
diff changeset
   430
        HbStyle::setItemName(mIncomingMsgStateIconItem, "msgStateIconIncoming");
hgs
parents: 25
diff changeset
   431
        mIncomingMsgStateIconItem->setIcon(HbIcon());
hgs
parents: 25
diff changeset
   432
        mIncomingMsgStateIconItem->setVisible(false);
hgs
parents: 25
diff changeset
   433
    }
hgs
parents: 25
diff changeset
   434
    else
hgs
parents: 25
diff changeset
   435
    {
hgs
parents: 25
diff changeset
   436
        HbStyle::setItemName(mIncomingMsgStateIconItem, "");
hgs
parents: 25
diff changeset
   437
        mIncomingMsgStateIconItem->setVisible(false);
hgs
parents: 25
diff changeset
   438
        HbStyle::setItemName(mOutgoingMsgStateIconItem, "msgStateIconOutgoing");
hgs
parents: 25
diff changeset
   439
        mOutgoingMsgStateIconItem->setIcon(HbIcon());
hgs
parents: 25
diff changeset
   440
        mOutgoingMsgStateIconItem->setVisible(false);
hgs
parents: 25
diff changeset
   441
    }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
// MsgConversationViewItem::isIncoming
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
bool MsgConversationViewItem::isIncoming()
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
{
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
    return mIncoming;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
//---------------------------------------------------------------
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   454
// MsgConversationViewItem::setMessageStateIcon
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
// @see header file
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
//---------------------------------------------------------------
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
void MsgConversationViewItem::setMessageStateIcon(int messageState)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
{
37
hgs
parents: 25
diff changeset
   459
    HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator();
hgs
parents: 25
diff changeset
   460
    HbIconAnimationManager* iconAnimationManager =
hgs
parents: 25
diff changeset
   461
            HbIconAnimationManager::global();
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
    switch (messageState)
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
    {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   464
        case ConvergedMessage::Waiting:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   465
        case ConvergedMessage::Scheduled:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   466
        case ConvergedMessage::Sending:
37
hgs
parents: 25
diff changeset
   467
        {
hgs
parents: 25
diff changeset
   468
            bool defined = iconAnimationManager->addDefinitionFile(
hgs
parents: 25
diff changeset
   469
                ANIMATION_FILE);
hgs
parents: 25
diff changeset
   470
            HbIcon animIcon;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   471
            animIcon.setIconName(ANIMATION_ICON_NAME);
37
hgs
parents: 25
diff changeset
   472
            QSizeF size = mOutgoingMsgStateIconItem->size();
hgs
parents: 25
diff changeset
   473
            mOutgoingMsgStateIconItem->setIcon(animIcon);
hgs
parents: 25
diff changeset
   474
            mOutgoingMsgStateIconItem->setVisible(true);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   475
            iconAnimator.startAnimation();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   476
            break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   477
        }     
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
        case ConvergedMessage::Suspended:
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   479
        {
37
hgs
parents: 25
diff changeset
   480
            iconAnimator.stopAnimation();
hgs
parents: 25
diff changeset
   481
            mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON);
hgs
parents: 25
diff changeset
   482
            mOutgoingMsgStateIconItem->setVisible(true);
hgs
parents: 25
diff changeset
   483
            break;
hgs
parents: 25
diff changeset
   484
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   485
        }
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
        case ConvergedMessage::Resend:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   488
            iconAnimator.stopAnimation();
37
hgs
parents: 25
diff changeset
   489
            mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON);
hgs
parents: 25
diff changeset
   490
            mOutgoingMsgStateIconItem->setVisible(true);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
            break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
        case ConvergedMessage::Failed:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   495
            iconAnimator.stopAnimation();
37
hgs
parents: 25
diff changeset
   496
            mOutgoingMsgStateIconItem->setIcon(MSG_FAIL_ICON);
hgs
parents: 25
diff changeset
   497
            mOutgoingMsgStateIconItem->setVisible(true);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
            break;
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   499
        }   
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   500
        case ConvergedMessage::Unknown:
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
        default:
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
        {
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   503
            iconAnimator.stopAnimation();
37
hgs
parents: 25
diff changeset
   504
            mOutgoingMsgStateIconItem->setVisible(false);
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
            break;
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
        }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
    }
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
}
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   510
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   511
// MsgConversationViewItem::setNotificationStateIcon
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   512
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   513
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   514
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   515
void MsgConversationViewItem::setNotificationStateIcon(int notificationState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   516
{
37
hgs
parents: 25
diff changeset
   517
    HbIconAnimator& iconAnimator = mIncomingMsgStateIconItem->animator();
hgs
parents: 25
diff changeset
   518
    HbIconAnimationManager* iconAnimationManager =
hgs
parents: 25
diff changeset
   519
            HbIconAnimationManager::global();
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   520
    switch (notificationState)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   521
    {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   522
        case ConvergedMessage::NotifRetrieving:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   523
        case ConvergedMessage::NotifWaiting:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   524
        { 
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   525
            //TODO: Temp icon until official icons are received
37
hgs
parents: 25
diff changeset
   526
            bool defined = iconAnimationManager->addDefinitionFile(
hgs
parents: 25
diff changeset
   527
                ANIMATION_FILE);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   528
            HbIcon animIcon;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   529
            animIcon.setIconName(ANIMATION_ICON_NAME);
37
hgs
parents: 25
diff changeset
   530
            QSizeF size = mIncomingMsgStateIconItem->size();
hgs
parents: 25
diff changeset
   531
            mIncomingMsgStateIconItem->setIcon(animIcon);
hgs
parents: 25
diff changeset
   532
            mIncomingMsgStateIconItem->setVisible(true);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   533
            iconAnimator.startAnimation();
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   534
            break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   535
        }     
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   536
        default:
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   537
        {
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   538
            iconAnimator.stopAnimation();
37
hgs
parents: 25
diff changeset
   539
            mIncomingMsgStateIconItem->setVisible(false);
25
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   540
            break;
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   541
        }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   542
    }
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   543
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   544
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   545
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   546
// MsgConversationViewItem::pressStateChanged
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   547
// @see header file
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   548
//---------------------------------------------------------------
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   549
void MsgConversationViewItem::pressStateChanged (bool pressed, bool animate)
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   550
{
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   551
    mConversation->pressStateChanged(pressed, animate);
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   552
}
84d9eb65b26f Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   553
37
hgs
parents: 25
diff changeset
   554
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   555
// MsgConversationViewItem::init
hgs
parents: 25
diff changeset
   556
// @see header file
hgs
parents: 25
diff changeset
   557
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   558
void MsgConversationViewItem::init()
hgs
parents: 25
diff changeset
   559
{
hgs
parents: 25
diff changeset
   560
    mConversation = new MsgConversationWidget(this);
hgs
parents: 25
diff changeset
   561
    HbStyle::setItemName(mConversation, "msgconvwidget");
hgs
parents: 25
diff changeset
   562
hgs
parents: 25
diff changeset
   563
    mIncomingMsgStateIconItem = new HbIconItem(this);
hgs
parents: 25
diff changeset
   564
    HbStyle::setItemName(mIncomingMsgStateIconItem, "msgStateIconIncoming");
hgs
parents: 25
diff changeset
   565
hgs
parents: 25
diff changeset
   566
    mOutgoingMsgStateIconItem = new HbIconItem(this);
hgs
parents: 25
diff changeset
   567
    HbStyle::setItemName(mOutgoingMsgStateIconItem, "msgStateIconOutgoing");
hgs
parents: 25
diff changeset
   568
hgs
parents: 25
diff changeset
   569
    HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
hgs
parents: 25
diff changeset
   570
hgs
parents: 25
diff changeset
   571
    connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
hgs
parents: 25
diff changeset
   572
        SLOT(orientationchanged(Qt::Orientation)), Qt::UniqueConnection);
hgs
parents: 25
diff changeset
   573
hgs
parents: 25
diff changeset
   574
    // Force polish to get all the sub-item properties right.
hgs
parents: 25
diff changeset
   575
    polishEvent();
hgs
parents: 25
diff changeset
   576
}
hgs
parents: 25
diff changeset
   577
hgs
parents: 25
diff changeset
   578
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   579
// MsgConversationViewItem::orientationchanged
hgs
parents: 25
diff changeset
   580
// @see header file
hgs
parents: 25
diff changeset
   581
//---------------------------------------------------------------
hgs
parents: 25
diff changeset
   582
void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
hgs
parents: 25
diff changeset
   583
{
hgs
parents: 25
diff changeset
   584
    QDEBUG_WRITE("MsgConversationViewItem:orientationchanged start.")
hgs
parents: 25
diff changeset
   585
hgs
parents: 25
diff changeset
   586
    repolish();
hgs
parents: 25
diff changeset
   587
hgs
parents: 25
diff changeset
   588
    QDEBUG_WRITE("MsgConversationViewItem:orientationchanged end.")
hgs
parents: 25
diff changeset
   589
}
hgs
parents: 25
diff changeset
   590
23
238255e8b033 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
// EOF