18 #include "univieweraddresscontainer.h" |
18 #include "univieweraddresscontainer.h" |
19 |
19 |
20 // SYSTEM INCLUDES |
20 // SYSTEM INCLUDES |
21 #include <QString> |
21 #include <QString> |
22 #include <QGraphicsLinearLayout> |
22 #include <QGraphicsLinearLayout> |
|
23 #include <HbIconItem> |
23 |
24 |
24 // USER INCLUDES |
25 // USER INCLUDES |
25 #include "univieweraddresswidget.h" |
26 #include "univieweraddresswidget.h" |
26 |
27 |
27 // LOCAL CONSTANTS |
28 // LOCAL CONSTANTS |
28 #define LOC_FROM hbTrId("txt_messaging_formlabel_from ") |
29 #define LOC_FROM hbTrId("txt_messaging_formlabel_from") |
29 #define LOC_TO hbTrId("txt_messaging_viewer_formlabel_to ") |
30 #define LOC_TO hbTrId("txt_messaging_viewer_formlabel_to") |
30 #define LOC_CC hbTrId("txt_messaging_viewer_formlabel_cc ") |
31 #define LOC_CC hbTrId("txt_messaging_viewer_formlabel_cc") |
|
32 |
|
33 // LOCAL CONSTANTS |
|
34 const QString DIVIDER_ICON("qtg_graf_divider_h_thin"); |
31 |
35 |
32 //--------------------------------------------------------------- |
36 //--------------------------------------------------------------- |
33 // UniViewerAddressContainer :: UniViewerAddressContainer |
37 // UniViewerAddressContainer :: UniViewerAddressContainer |
34 // @see header file |
38 // @see header file |
35 //--------------------------------------------------------------- |
39 //--------------------------------------------------------------- |
36 UniViewerAddressContainer::UniViewerAddressContainer(QGraphicsItem *parent) : |
40 UniViewerAddressContainer::UniViewerAddressContainer(QGraphicsItem *parent) : |
37 HbWidget(parent), mMainLayout(NULL), |
41 HbWidget(parent), mMainLayout(0), mFromWidget(0), mToWidget(0), mCcWidget(0), mDivider(0) |
38 mFromWidget(NULL), |
|
39 mToWidget(NULL), |
|
40 mCcWidget(NULL) |
|
41 { |
42 { |
42 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); |
43 mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); |
43 mMainLayout->setContentsMargins(0, 0, 0, 0); |
44 mMainLayout->setContentsMargins(0, 0, 0, 0); |
44 mMainLayout->setSpacing(0); |
45 mMainLayout->setSpacing(0); |
45 setLayout(mMainLayout); |
46 setLayout(mMainLayout); |
56 |
57 |
57 //--------------------------------------------------------------- |
58 //--------------------------------------------------------------- |
58 // UniViewerAddressContainer :: setFromField |
59 // UniViewerAddressContainer :: setFromField |
59 // @see header file |
60 // @see header file |
60 //--------------------------------------------------------------- |
61 //--------------------------------------------------------------- |
61 void UniViewerAddressContainer::setFromField(const QString& fromRecipient, |
62 void UniViewerAddressContainer::setFromField(const QString& fromRecipient, const QString& alias) |
62 const QString& alias) |
|
63 { |
63 { |
64 if (!mFromWidget) |
64 if (!mFromWidget) { |
65 { |
|
66 mFromWidget = new UniViewerAddressWidget(); |
65 mFromWidget = new UniViewerAddressWidget(); |
67 } |
66 } |
68 |
67 |
69 mMainLayout->addItem(mFromWidget); |
68 mMainLayout->addItem(mFromWidget); |
70 mFromWidget->populate(LOC_FROM, fromRecipient, alias); |
69 mFromWidget->populate(LOC_FROM, fromRecipient, alias); |
72 |
71 |
73 //--------------------------------------------------------------- |
72 //--------------------------------------------------------------- |
74 // UniViewerAddressContainer :: setToField |
73 // UniViewerAddressContainer :: setToField |
75 // @see header file |
74 // @see header file |
76 //--------------------------------------------------------------- |
75 //--------------------------------------------------------------- |
77 void UniViewerAddressContainer::setToField( |
76 void UniViewerAddressContainer::setToField(ConvergedMessageAddressList toRecipients) |
78 ConvergedMessageAddressList toRecipients) |
|
79 { |
77 { |
80 if (!mToWidget) |
78 if (!mToWidget) { |
81 { |
|
82 mToWidget = new UniViewerAddressWidget(); |
79 mToWidget = new UniViewerAddressWidget(); |
83 } |
80 } |
84 |
81 |
85 mMainLayout->addItem(mToWidget); |
82 mMainLayout->addItem(mToWidget); |
86 mToWidget->populate(LOC_TO, toRecipients); |
83 mToWidget->populate(LOC_TO, toRecipients); |
88 |
85 |
89 //--------------------------------------------------------------- |
86 //--------------------------------------------------------------- |
90 //UniViewerAddressContainer :: setCcField |
87 //UniViewerAddressContainer :: setCcField |
91 // @see header file |
88 // @see header file |
92 //--------------------------------------------------------------- |
89 //--------------------------------------------------------------- |
93 void UniViewerAddressContainer::setCcField( |
90 void UniViewerAddressContainer::setCcField(ConvergedMessageAddressList ccRecipients) |
94 ConvergedMessageAddressList ccRecipients) |
|
95 { |
91 { |
96 if (!mCcWidget) |
92 if (!mCcWidget) { |
97 { |
|
98 mCcWidget = new UniViewerAddressWidget(); |
93 mCcWidget = new UniViewerAddressWidget(); |
99 } |
94 } |
100 |
95 |
101 mMainLayout->addItem(mCcWidget); |
96 mMainLayout->addItem(mCcWidget); |
102 mCcWidget->populate(LOC_CC, ccRecipients); |
97 mCcWidget->populate(LOC_CC, ccRecipients); |
106 // UniViewerAddressContainer :: clearContent |
101 // UniViewerAddressContainer :: clearContent |
107 // @see header file |
102 // @see header file |
108 //--------------------------------------------------------------- |
103 //--------------------------------------------------------------- |
109 void UniViewerAddressContainer::clearContent() |
104 void UniViewerAddressContainer::clearContent() |
110 { |
105 { |
111 if (mFromWidget) |
106 if (mFromWidget) { |
112 { |
|
113 mMainLayout->removeItem(mFromWidget); |
107 mMainLayout->removeItem(mFromWidget); |
114 mFromWidget->setParent(NULL); |
108 mFromWidget->setParent(NULL); |
115 delete mFromWidget; |
109 delete mFromWidget; |
116 mFromWidget = NULL; |
110 mFromWidget = NULL; |
117 } |
111 } |
118 if (mToWidget) |
112 if (mToWidget) { |
119 { |
|
120 mMainLayout->removeItem(mToWidget); |
113 mMainLayout->removeItem(mToWidget); |
121 mToWidget->setParent(NULL); |
114 mToWidget->setParent(NULL); |
122 delete mToWidget; |
115 delete mToWidget; |
123 mToWidget = NULL; |
116 mToWidget = NULL; |
124 } |
117 } |
125 if (mCcWidget) |
118 if (mCcWidget) { |
126 { |
|
127 mMainLayout->removeItem(mCcWidget); |
119 mMainLayout->removeItem(mCcWidget); |
128 mCcWidget->setParent(NULL); |
120 mCcWidget->setParent(NULL); |
129 delete mCcWidget; |
121 delete mCcWidget; |
130 mCcWidget = NULL; |
122 mCcWidget = NULL; |
131 } |
123 } |
|
124 if (mDivider) { |
|
125 mMainLayout->removeItem(mDivider); |
|
126 mDivider->setParent(NULL); |
|
127 delete mDivider; |
|
128 mDivider = NULL; |
|
129 } |
132 |
130 |
133 resize(rect().width(), -1); |
131 resize(rect().width(), -1); |
134 } |
132 } |
135 |
133 |
|
134 //--------------------------------------------------------------- |
|
135 // UniViewerAddressContainer :: insertDivider |
|
136 // @see header file |
|
137 //--------------------------------------------------------------- |
|
138 void UniViewerAddressContainer::insertDivider() |
|
139 { |
|
140 if (!mDivider) { |
|
141 mDivider = new HbIconItem(this); |
|
142 } |
|
143 |
|
144 mDivider->sizePolicy().setHorizontalPolicy(QSizePolicy::Expanding); |
|
145 mDivider->sizePolicy().setVerticalPolicy(QSizePolicy::Fixed); |
|
146 mDivider->setIconName(DIVIDER_ICON); |
|
147 mMainLayout->addItem(mDivider); |
|
148 } |
|
149 |
136 // EOF |
150 // EOF |