22 #include <HbGroupBox> |
22 #include <HbGroupBox> |
23 #include <HbFrameItem> |
23 #include <HbFrameItem> |
24 |
24 |
25 // USER INCLUDES |
25 // USER INCLUDES |
26 #include "univieweraddresscontainer.h" |
26 #include "univieweraddresscontainer.h" |
27 #include "univiewerattachmentcontainer.h" |
|
28 #include "univiewerdetailswidget.h" |
27 #include "univiewerdetailswidget.h" |
29 #include "univiewerfeeder.h" |
28 #include "univiewerfeeder.h" |
|
29 #include "univiewerattachmentwidget.h" |
30 |
30 |
31 #include "nativemessageconsts.h" |
31 #include "nativemessageconsts.h" |
32 |
32 |
33 // LOCALIZATION |
33 // LOCALIZATION |
34 #define LOC_SEND_FAILED hbTrId("txt_messaging_formlabel_sending_failed") |
34 #define LOC_SEND_FAILED hbTrId("txt_messaging_formlabel_sending_failed") |
42 // UniViewerHeaderContainer :: UniViewerHeaderContainer |
42 // UniViewerHeaderContainer :: UniViewerHeaderContainer |
43 // @see header file |
43 // @see header file |
44 //--------------------------------------------------------------- |
44 //--------------------------------------------------------------- |
45 UniViewerHeaderContainer::UniViewerHeaderContainer(UniViewerFeeder* feeder, QGraphicsItem *parent) : |
45 UniViewerHeaderContainer::UniViewerHeaderContainer(UniViewerFeeder* feeder, QGraphicsItem *parent) : |
46 HbWidget(parent), mViewFeeder(feeder), mViewerDetails(0), mHeaderGroupBox(0), mSeparator(0), |
46 HbWidget(parent), mViewFeeder(feeder), mViewerDetails(0), mHeaderGroupBox(0), mSeparator(0), |
47 mAddressContainer(0), mAttachmentContainer(0) |
47 mAddressContainer(0) |
48 { |
48 { |
49 this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
49 this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
50 |
50 |
51 HbFrameItem *bgItem = new HbFrameItem(BG_FRAME_GRAPHICS, HbFrameDrawer::NinePieces, this); |
51 HbFrameItem *bgItem = new HbFrameItem(BG_FRAME_GRAPHICS, HbFrameDrawer::NinePieces, this); |
52 this->setBackgroundItem(bgItem); |
52 this->setBackgroundItem(bgItem, -2.0); |
53 |
53 |
54 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this); |
54 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this); |
55 mMainLayout->setSpacing(0); |
55 mMainLayout->setSpacing(0); |
56 mMainLayout->setContentsMargins(0, 0, 0, 0); |
56 mMainLayout->setContentsMargins(0, 0, 0, 0); |
57 |
57 |
130 void UniViewerHeaderContainer::clearContent() |
130 void UniViewerHeaderContainer::clearContent() |
131 { |
131 { |
132 if (mViewerDetails) { |
132 if (mViewerDetails) { |
133 mViewerDetails->clearContent(); |
133 mViewerDetails->clearContent(); |
134 } |
134 } |
135 if (mAttachmentContainer) { |
135 |
136 mAttachmentContainer->clearContent(); |
136 // Clear the attachments. |
137 } |
137 for (int i = 0; i < mUniViewerAttachmentstList.count(); ++i) { |
|
138 mMainLayout->removeItem(mUniViewerAttachmentstList[i]); |
|
139 mUniViewerAttachmentstList[i]->setParent(NULL); |
|
140 delete mUniViewerAttachmentstList[i]; |
|
141 mUniViewerAttachmentstList[i] = NULL; |
|
142 } |
|
143 mUniViewerAttachmentstList.clear(); |
|
144 |
|
145 resize(rect().width(), -1); |
138 } |
146 } |
139 |
147 |
140 //--------------------------------------------------------------- |
148 //--------------------------------------------------------------- |
141 // UniViewerHeaderContainer :: populateSubject |
149 // UniViewerHeaderContainer :: populateSubject |
142 // @see header file |
150 // @see header file |
165 // UniViewerHeaderContainer :: populateAttachments |
173 // UniViewerHeaderContainer :: populateAttachments |
166 // @see header file |
174 // @see header file |
167 //--------------------------------------------------------------- |
175 //--------------------------------------------------------------- |
168 void UniViewerHeaderContainer::populateAttachments() |
176 void UniViewerHeaderContainer::populateAttachments() |
169 { |
177 { |
170 if (!mAttachmentContainer) { |
|
171 // Attachment Container |
|
172 mAttachmentContainer = new UniViewerAttachmentContainer(this); |
|
173 mMainLayout->addItem(mAttachmentContainer); |
|
174 } |
|
175 |
|
176 UniMessageInfoList attachList = mViewFeeder->attachmentsList(); |
178 UniMessageInfoList attachList = mViewFeeder->attachmentsList(); |
177 for (int a = 0; a < attachList.count(); ++a) { |
179 for (int a = 0; a < attachList.count(); ++a) { |
178 UniMessageInfo* info = attachList.at(a); |
180 UniMessageInfo* info = attachList.at(a); |
179 mAttachmentContainer->addAttachmentWidget(info->mimetype(), info->path()); |
181 UniViewerAttachmentWidget *attachmentWidget = new UniViewerAttachmentWidget(this); |
|
182 mUniViewerAttachmentstList.append(attachmentWidget); |
|
183 attachmentWidget->populate(info->mimetype(), info->path()); |
180 delete info; |
184 delete info; |
|
185 mMainLayout->addItem(attachmentWidget); |
181 } |
186 } |
182 } |
187 } |
183 |
188 |
184 //--------------------------------------------------------------- |
189 //--------------------------------------------------------------- |
185 // UniViewerHeaderContainer :: populateAttachments |
190 // UniViewerHeaderContainer :: populateAttachments |
206 mAddressContainer->setToField(toList); |
211 mAddressContainer->setToField(toList); |
207 } |
212 } |
208 ConvergedMessageAddressList ccList = mViewFeeder->ccAddressList(); |
213 ConvergedMessageAddressList ccList = mViewFeeder->ccAddressList(); |
209 if (!ccList.isEmpty()) { |
214 if (!ccList.isEmpty()) { |
210 mAddressContainer->setCcField(ccList); |
215 mAddressContainer->setCcField(ccList); |
|
216 } |
|
217 ConvergedMessageAddressList bccList = mViewFeeder->bccAddressList(); |
|
218 if (!bccList.isEmpty()) { |
|
219 mAddressContainer->setBccField(bccList); |
211 } |
220 } |
212 } |
221 } |
213 |
222 |
214 } |
223 } |
215 //--------------------------------------------------------------- |
224 //--------------------------------------------------------------- |