messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp
changeset 31 ebfee66fde93
child 34 84197e66a4bd
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 
       
    18 #include "univieweraddresscontainer.h"
       
    19 
       
    20 // SYSTEM INCLUDES
       
    21 #include <QGraphicsLinearLayout>
       
    22 
       
    23 // USER INCLUDES
       
    24 #include "univieweraddresswidget.h"
       
    25 
       
    26 // LOCAL CONSTANTS
       
    27 #define LOC_FROM hbTrId("txt_messaging_formlabel_from")
       
    28 #define LOC_TO hbTrId("txt_messaging_viewer_formlabel_to")
       
    29 #define LOC_CC hbTrId("txt_messaging_viewer_formlabel_cc")
       
    30 #define LOC_BCC hbTrId("txt_messaging_viewer_formlabel_bcc")
       
    31 
       
    32 //---------------------------------------------------------------
       
    33 // UniViewerAddressContainer::UniViewerAddressContainer
       
    34 // @see header file
       
    35 //---------------------------------------------------------------
       
    36 UniViewerAddressContainer::UniViewerAddressContainer(QGraphicsItem* parent) :
       
    37     HbWidget(parent)
       
    38 {
       
    39     mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
       
    40     mMainLayout->setContentsMargins(0, 0, 0, 0);
       
    41     mMainLayout->setSpacing(0);
       
    42     setLayout(mMainLayout);
       
    43 }
       
    44 
       
    45 //---------------------------------------------------------------
       
    46 // UniViewerAddressContainer::~UniViewerAddressContainer
       
    47 // @see header file
       
    48 //---------------------------------------------------------------
       
    49 UniViewerAddressContainer::~UniViewerAddressContainer()
       
    50 {
       
    51 }
       
    52 
       
    53 //---------------------------------------------------------------
       
    54 // UniViewerAddressContainer::setFromField
       
    55 // @see header file
       
    56 //---------------------------------------------------------------
       
    57 void UniViewerAddressContainer::setFromField(const QString& fromRecipient, const QString& alias)
       
    58 {
       
    59     UniViewerAddressWidget* fromWidget = new UniViewerAddressWidget(this);
       
    60 
       
    61     connect(fromWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
       
    62         SIGNAL(sendMessage(const QString&,const QString&)));
       
    63 
       
    64     mMainLayout->addItem(fromWidget);
       
    65 
       
    66     fromWidget->populate(LOC_FROM, fromRecipient, alias);
       
    67 }
       
    68 
       
    69 //---------------------------------------------------------------
       
    70 // UniViewerAddressContainer::setToField
       
    71 // @see header file
       
    72 //---------------------------------------------------------------
       
    73 void UniViewerAddressContainer::setToField(ConvergedMessageAddressList toRecipients)
       
    74 {
       
    75     UniViewerAddressWidget* toWidget = new UniViewerAddressWidget();
       
    76 
       
    77     connect(toWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
       
    78         SIGNAL(sendMessage(const QString&,const QString&)));
       
    79 
       
    80     mMainLayout->addItem(toWidget);
       
    81 
       
    82     toWidget->populate(LOC_TO, toRecipients);
       
    83 
       
    84 }
       
    85 
       
    86 //---------------------------------------------------------------
       
    87 // UniViewerAddressContainer::setCcField
       
    88 // @see header file
       
    89 //---------------------------------------------------------------
       
    90 void UniViewerAddressContainer::setCcField(ConvergedMessageAddressList ccRecipients)
       
    91 {
       
    92     UniViewerAddressWidget* ccWidget = new UniViewerAddressWidget();
       
    93 
       
    94     connect(ccWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
       
    95         SIGNAL(sendMessage(const QString&,const QString&)));
       
    96 
       
    97     mMainLayout->addItem(ccWidget);
       
    98 
       
    99     ccWidget->populate(LOC_CC, ccRecipients);
       
   100 }
       
   101 
       
   102 // EOF