43 |
43 |
44 \param parent Pointer to QGraphicsItem. |
44 \param parent Pointer to QGraphicsItem. |
45 */ |
45 */ |
46 AgendaEventViewerItem::AgendaEventViewerItem(QGraphicsItem *parent) : |
46 AgendaEventViewerItem::AgendaEventViewerItem(QGraphicsItem *parent) : |
47 HbWidget(parent), mPrimaryText(NULL), mSecondaryText(NULL), |
47 HbWidget(parent), mPrimaryText(NULL), mSecondaryText(NULL), |
48 mPrimaryIcon(NULL), mSecondaryIcon(NULL),mPrimaryRightIcon(NULL), |
48 mPrimaryLeftIcon(NULL),mPrimaryRightIcon(NULL), |
49 mPrimaryLeftIcon(NULL) |
49 mSecondaryLeftIcon(NULL),mSecondaryRightIcon(NULL) |
50 { |
50 { |
51 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_ENTRY ); |
51 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_ENTRY ); |
52 |
52 |
53 // Path for widgetml and css files. |
53 // Path for widgetml and css files. |
54 HbStyleLoader::registerFilePath(":/"); |
54 HbStyleLoader::registerFilePath(":/agendaeventvieweritem.css"); |
|
55 HbStyleLoader::registerFilePath(":/agendaeventvieweritem.widgetml"); |
|
56 HbStyleLoader::registerFilePath(":/agendaeventvieweritem_color.css"); |
55 |
57 |
56 OstTraceFunctionExit0( AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_EXIT ); |
58 OstTraceFunctionExit0( AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_EXIT ); |
57 } |
59 } |
58 |
60 |
59 /*! |
61 /*! |
60 Destructor. |
62 Destructor. |
61 */ |
63 */ |
62 AgendaEventViewerItem::~AgendaEventViewerItem() |
64 AgendaEventViewerItem::~AgendaEventViewerItem() |
63 { |
65 { |
64 OstTraceFunctionEntry0( DUP1_AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_ENTRY ); |
66 OstTraceFunctionEntry0( DUP1_AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_ENTRY ); |
65 HbStyleLoader::unregisterFilePath(":/"); |
67 HbStyleLoader::unregisterFilePath(":/agendaeventvieweritem.css"); |
|
68 HbStyleLoader::unregisterFilePath(":/agendaeventvieweritem.widgetml"); |
|
69 HbStyleLoader::unregisterFilePath(":/agendaeventvieweritem_color.css"); |
66 |
70 |
67 OstTraceFunctionExit0( DUP1_AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_EXIT ); |
71 OstTraceFunctionExit0( DUP1_AGENDAEVENTVIEWERITEM_AGENDAEVENTVIEWERITEM_EXIT ); |
68 } |
72 } |
69 |
73 |
70 /*! |
74 /*! |
77 void AgendaEventViewerItem::setEventViewerItemData(const QStringList &itemData, |
81 void AgendaEventViewerItem::setEventViewerItemData(const QStringList &itemData, |
78 int role) |
82 int role) |
79 { |
83 { |
80 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_SETEVENTVIEWERITEMDATA_ENTRY ); |
84 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_SETEVENTVIEWERITEMDATA_ENTRY ); |
81 if (!itemData.isEmpty()) { |
85 if (!itemData.isEmpty()) { |
82 QString firstItemData(QString::null); |
86 |
83 QString secondItemData(QString::null); |
87 if (role == Qt::DisplayRole) { |
84 QString thirdItemData(QString::null); |
88 for (int index=0; index < itemData.count(); index++) |
85 if (itemData.count() == 2) { |
89 setTextItemData(index, itemData.at(index)); |
86 firstItemData = itemData.at(0); |
90 |
87 secondItemData = itemData.at(1); |
|
88 } |
|
89 else if (itemData.count() == 3) { |
|
90 firstItemData = itemData.at(0); |
|
91 secondItemData = itemData.at(1); |
|
92 thirdItemData = itemData.at(2); |
|
93 } else { |
91 } else { |
94 firstItemData = itemData.at(0); |
92 if (role == Qt::DecorationRole) { |
95 } |
93 for (int index=0; index < itemData.count(); index++) |
96 |
94 setIconItemData(index, itemData.at(index)); |
97 if (role == Qt::DisplayRole) { |
95 |
98 if (!firstItemData.isEmpty()) { |
96 } |
|
97 } |
|
98 repolish(); |
|
99 OstTraceFunctionExit0( AGENDAEVENTVIEWERITEM_SETEVENTVIEWERITEMDATA_EXIT ); |
|
100 } |
|
101 } |
|
102 |
|
103 /*! |
|
104 Sets the text data for EventViewer items |
|
105 |
|
106 \param index item index |
|
107 \param itenmData To set the given value to item |
|
108 */ |
|
109 void AgendaEventViewerItem::setTextItemData(int index, const QString &itemData) |
|
110 { |
|
111 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_SETTEXTITEMDATA_ENTRY ); |
|
112 switch(index) { |
|
113 case 0: { |
|
114 if (!itemData.isEmpty()) { |
99 if (!mPrimaryText) { |
115 if (!mPrimaryText) { |
100 mPrimaryText = new HbTextItem(this); |
116 mPrimaryText = new HbTextItem(this); |
101 HbStyle::setItemName(mPrimaryText, "primaryTextItem"); |
117 HbStyle::setItemName(mPrimaryText, "primaryTextItem"); |
102 mPrimaryText->setElideMode(Qt::ElideNone); |
118 mPrimaryText->setElideMode(Qt::ElideNone); |
103 } |
119 } |
104 mPrimaryText->setText(firstItemData); |
120 mPrimaryText->setText(itemData); |
105 } else { |
121 } else { |
106 if (mPrimaryText) { |
122 if (mPrimaryText) { |
107 delete mPrimaryText; |
123 delete mPrimaryText; |
108 mPrimaryText = NULL; |
124 mPrimaryText = NULL; |
109 } |
125 } |
110 } |
126 } |
111 |
127 break; |
|
128 } |
|
129 case 1: { |
112 if (!mSecondaryText) { |
130 if (!mSecondaryText) { |
113 mSecondaryText = new HbTextItem(this); |
131 mSecondaryText = new HbTextItem(this); |
114 HbStyle::setItemName(mSecondaryText, "secondaryTextItem"); |
132 HbStyle::setItemName(mSecondaryText, "secondaryTextItem"); |
115 mSecondaryText->setTextWrapping(Hb::TextWordWrap); |
133 mSecondaryText->setTextWrapping(Hb::TextWordWrap); |
116 } |
134 } |
117 |
135 |
118 if (!secondItemData.isEmpty()) { |
136 if (!itemData.isEmpty()) { |
119 |
137 |
120 mSecondaryText->setText(secondItemData); |
138 mSecondaryText->setText(itemData); |
121 } else { |
139 } else { |
122 mSecondaryText->setText(""); |
140 mSecondaryText->setText(""); |
123 } |
141 } |
124 } else { |
142 break; |
125 if (role == Qt::DecorationRole) { |
143 } |
126 if (!firstItemData.isEmpty()) { |
144 } |
127 if (!mPrimaryLeftIcon) { |
145 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_SETTEXTITEMDATA_EXIT ); |
128 mPrimaryLeftIcon = new HbIconItem(this); |
146 } |
129 } |
147 |
130 HbStyle::setItemName(mPrimaryLeftIcon, "primaryLeftIconItem"); |
148 /*! |
131 mPrimaryLeftIcon->setVisible(true); |
149 Sets the icon data for EventViewer items |
132 mPrimaryLeftIcon->setIconName(firstItemData); |
150 |
133 |
151 \param index item index |
134 } else { |
152 \param itenmData To set the given value to item |
135 if (mPrimaryLeftIcon) { |
153 */ |
136 HbStyle::setItemName(mPrimaryLeftIcon,""); |
154 |
137 mPrimaryLeftIcon->setVisible(false); |
155 void AgendaEventViewerItem::setIconItemData(int index, const QString &itemData) |
138 } |
156 { |
139 |
157 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_SETICONITEMDATA_ENTRY ); |
140 } |
158 switch (index) { |
141 if (!secondItemData.isEmpty()) { |
159 case 0: { |
142 if (!mPrimaryRightIcon) { |
160 if (!itemData.isEmpty()) { |
|
161 if (!mPrimaryLeftIcon) { |
|
162 mPrimaryLeftIcon = new HbIconItem(this); |
|
163 } |
|
164 HbStyle::setItemName(mPrimaryLeftIcon, "primaryLeftIconItem"); |
|
165 mPrimaryLeftIcon->setIconName(itemData); |
|
166 |
|
167 } else { |
|
168 if (mPrimaryLeftIcon) { |
|
169 delete mPrimaryLeftIcon; |
|
170 mPrimaryLeftIcon = NULL; |
|
171 } |
|
172 |
|
173 } |
|
174 break; |
|
175 } |
|
176 case 1: { |
|
177 if (!itemData.isEmpty()) { |
|
178 if (!mPrimaryRightIcon) { |
143 mPrimaryRightIcon = new HbIconItem(this); |
179 mPrimaryRightIcon = new HbIconItem(this); |
144 } |
180 } |
145 HbStyle::setItemName(mPrimaryRightIcon, "primaryRightIconItem"); |
181 HbStyle::setItemName(mPrimaryRightIcon, "primaryRightIconItem"); |
146 mPrimaryRightIcon->setVisible(true); |
182 mPrimaryRightIcon->setVisible(true); |
147 mPrimaryRightIcon->setIconName(secondItemData); |
183 mPrimaryRightIcon->setIconName(itemData); |
148 |
184 |
149 } else { |
185 } else { |
150 if (mPrimaryRightIcon) { |
186 if (mPrimaryRightIcon) { |
151 HbStyle::setItemName(mPrimaryRightIcon,""); |
187 HbStyle::setItemName(mPrimaryRightIcon, ""); |
152 mPrimaryRightIcon->setVisible(false); |
188 mPrimaryRightIcon->setVisible(false); |
153 } |
189 } |
154 |
190 |
155 } |
191 } |
156 if (!thirdItemData.isEmpty()) { |
192 break; |
157 if (!mSecondaryIcon) { |
193 } |
158 mSecondaryIcon = new HbIconItem(this); |
194 case 2: { |
159 HbStyle::setItemName(mSecondaryIcon, |
195 if (!itemData.isEmpty()) { |
160 "secondaryIconItem"); |
196 if (!mSecondaryLeftIcon) { |
161 } |
197 mSecondaryLeftIcon = new HbIconItem(this); |
162 mSecondaryIcon->setIconName(thirdItemData); |
198 HbStyle::setItemName(mSecondaryLeftIcon, |
163 |
199 "secondaryLeftIconItem"); |
164 } else { |
200 } |
165 if (mSecondaryIcon) { |
201 mSecondaryLeftIcon->setIconName(itemData); |
166 delete mSecondaryIcon; |
202 |
167 mSecondaryIcon = NULL; |
203 } else { |
168 } |
204 if (mSecondaryLeftIcon) { |
169 |
205 delete mSecondaryLeftIcon; |
170 } |
206 mSecondaryLeftIcon = NULL; |
171 |
207 } |
172 } |
208 |
173 } |
209 } |
174 } |
210 break; |
175 repolish(); |
211 } |
176 OstTraceFunctionExit0( AGENDAEVENTVIEWERITEM_SETEVENTVIEWERITEMDATA_EXIT ); |
212 case 3: { |
|
213 |
|
214 if (!itemData.isEmpty()) { |
|
215 if (!mSecondaryRightIcon) { |
|
216 mSecondaryRightIcon = new HbIconItem(this); |
|
217 HbStyle::setItemName(mSecondaryRightIcon, |
|
218 "secondaryRightIconItem"); |
|
219 } |
|
220 mSecondaryRightIcon->setIconName(itemData); |
|
221 |
|
222 } else { |
|
223 if (mSecondaryRightIcon) { |
|
224 delete mSecondaryRightIcon; |
|
225 mSecondaryRightIcon = NULL; |
|
226 } |
|
227 |
|
228 } |
|
229 break; |
|
230 |
|
231 } |
|
232 |
|
233 } |
|
234 OstTraceFunctionEntry0( AGENDAEVENTVIEWERITEM_SETICONITEMDATA_EXIT ); |
177 } |
235 } |
178 |
236 |
179 // End of file --Don't remove this. |
237 // End of file --Don't remove this. |
|
238 |