|
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: This widget holds the message details and silde contents. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "univiewslidewidget.h" |
|
19 |
|
20 // SYSTEM INCLUDES |
|
21 #include <QGraphicsLinearLayout> |
|
22 |
|
23 // USER INCLUDES |
|
24 #include "univiewerbodywidget.h" |
|
25 #include "univiewerfeeder.h" |
|
26 #include "univiewerheadercontainer.h" |
|
27 #include "nativemessageconsts.h" |
|
28 |
|
29 #define LOC_SLIDE_COUNTER hbTrId("txt_messaging_formlabel_slide_l1l2") |
|
30 |
|
31 //--------------------------------------------------------------- |
|
32 // UniViewSlideWidget :: UniViewSlideWidget |
|
33 // @see header file |
|
34 //--------------------------------------------------------------- |
|
35 UniViewSlideWidget::UniViewSlideWidget(UniViewerFeeder* feeder, int slideNumber, |
|
36 QGraphicsItem * parent) : |
|
37 HbWidget(parent), mInsideLayout(false), mSlideNumber(slideNumber), mViewFeeder(feeder), |
|
38 mHeaderContainer(0) |
|
39 |
|
40 { |
|
41 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this); |
|
42 mMainLayout->setSpacing(0); |
|
43 mMainLayout->setContentsMargins(0, 0, 0, 0); |
|
44 |
|
45 mBody = new UniViewerBodyWidget(this); |
|
46 |
|
47 connect(mBody, SIGNAL(sendMessage(const QString&)), this, SIGNAL(sendMessage(const QString&))); |
|
48 |
|
49 /** |
|
50 * If its a first slide create the headers and attach to the main layout |
|
51 */ |
|
52 if (mSlideNumber == 0) { |
|
53 mHeaderContainer = new UniViewerHeaderContainer(mViewFeeder, this); |
|
54 |
|
55 // Always connect to populate sms content |
|
56 connect(mViewFeeder, SIGNAL(msgBody(QString)), mBody, SLOT(setTextContent(QString))); |
|
57 |
|
58 connect(mHeaderContainer,SIGNAL(sendMessage(const QString&,const QString&)), |
|
59 this, SIGNAL(sendMessage(const QString&,const QString&))); |
|
60 |
|
61 |
|
62 |
|
63 mMainLayout->addItem(mHeaderContainer); |
|
64 } |
|
65 |
|
66 mMainLayout->addItem(mBody); |
|
67 |
|
68 setLayout(mMainLayout); |
|
69 } |
|
70 |
|
71 //--------------------------------------------------------------- |
|
72 // UniViewSlideWidget::~UniViewSlideWidget |
|
73 // @see header file |
|
74 //--------------------------------------------------------------- |
|
75 UniViewSlideWidget::~UniViewSlideWidget() |
|
76 { |
|
77 |
|
78 } |
|
79 |
|
80 //--------------------------------------------------------------- |
|
81 //UniViewSlideWidget::clearContent |
|
82 // @see header file |
|
83 //--------------------------------------------------------------- |
|
84 void UniViewSlideWidget::clearContent() |
|
85 { |
|
86 if (mHeaderContainer) { |
|
87 mHeaderContainer->clearContent(); |
|
88 } |
|
89 if (mBody) { |
|
90 mBody->clearContent(); |
|
91 } |
|
92 } |
|
93 |
|
94 //--------------------------------------------------------------- |
|
95 // UniViewSlideWidget::populateContent |
|
96 // @see header file |
|
97 //--------------------------------------------------------------- |
|
98 void UniViewSlideWidget::populateContent() |
|
99 { |
|
100 if (mSlideNumber == 0) { |
|
101 mViewFeeder->fetchDetails(); |
|
102 populateFirstSlide(); |
|
103 } |
|
104 |
|
105 if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) { |
|
106 QString slideString; |
|
107 if (mViewFeeder->slideCount() > 1) { |
|
108 slideString = QString(LOC_SLIDE_COUNTER).arg(mSlideNumber + 1).arg( |
|
109 mViewFeeder->slideCount()); |
|
110 } |
|
111 mBody->setSlideContents(mViewFeeder->slideContent(mSlideNumber), slideString); |
|
112 } |
|
113 } |
|
114 |
|
115 //--------------------------------------------------------------- |
|
116 // UniViewSlideWidget::populateFirstSlide |
|
117 // @see header file |
|
118 //--------------------------------------------------------------- |
|
119 void UniViewSlideWidget::populateFirstSlide() |
|
120 { |
|
121 mHeaderContainer->populateContent(); |
|
122 } |
|
123 |
|
124 //--------------------------------------------------------------- |
|
125 // UniViewSlideWidget::insideLayout |
|
126 // @see header file |
|
127 //--------------------------------------------------------------- |
|
128 bool UniViewSlideWidget::insideLayout() |
|
129 { |
|
130 return mInsideLayout; |
|
131 } |
|
132 |
|
133 //--------------------------------------------------------------- |
|
134 // UniViewSlideWidget::setInsideLayout |
|
135 // @see header file |
|
136 //--------------------------------------------------------------- |
|
137 void UniViewSlideWidget::setInsideLayout(bool inside) |
|
138 { |
|
139 mInsideLayout = inside; |
|
140 } |
|
141 |
|
142 // EOF |