100 |
98 |
101 void CntEditViewDetailItem::longPressed(const QPointF &coords) |
99 void CntEditViewDetailItem::longPressed(const QPointF &coords) |
102 { |
100 { |
103 Q_UNUSED( coords ); |
101 Q_UNUSED( coords ); |
104 } |
102 } |
105 // |
103 |
106 //void CntEditViewDetailItem::createPrimitives() |
|
107 //{ |
|
108 //// if (!icon.isNull()) |
|
109 //// { |
|
110 //// if (!mIcon) |
|
111 //// { |
|
112 //// mIcon = new HbIconItem(this); |
|
113 //// mIcon->setIcon(icon); |
|
114 //// //style()->setItemName(mIcon, "icon"); |
|
115 //// } |
|
116 //// } |
|
117 //// else |
|
118 //// { |
|
119 //// if (mIcon) |
|
120 //// { |
|
121 //// delete mIcon; |
|
122 //// } |
|
123 //// mIcon = 0; |
|
124 //// } |
|
125 //// |
|
126 //// if (!text.isNull()) |
|
127 //// { |
|
128 //// if (!mLabel) |
|
129 //// { |
|
130 //// mLabel = new HbTextItem(this); |
|
131 //// mLabel->setText(text); |
|
132 //// //style()->setItemName(mLabel, "text"); |
|
133 //// } |
|
134 //// } |
|
135 //// else |
|
136 //// { |
|
137 //// if (mLabel) |
|
138 //// { |
|
139 //// delete mLabel; |
|
140 //// } |
|
141 //// mLabel = 0; |
|
142 //// } |
|
143 //// |
|
144 //// if (!valueText.isNull()) |
|
145 //// { |
|
146 //// if (!mContent) |
|
147 //// { |
|
148 //// mContent = new HbTextItem(this); |
|
149 //// mContent->setText(valueText); |
|
150 //// mContent->setTextWrapping(Hb::TextNoWrap); |
|
151 //// // style()->setItemName(mContent, "valueText"); |
|
152 //// |
|
153 //// // make sure phone number truncation characters are placed |
|
154 //// // on left side of the phone number. |
|
155 //// if ( mDetail.definitionName() == QContactPhoneNumber::DefinitionName ) |
|
156 //// { |
|
157 //// mContent->setElideMode( Qt::ElideLeft ); |
|
158 //// } |
|
159 //// } |
|
160 //// } |
|
161 //// else |
|
162 //// { |
|
163 //// if (mContent) |
|
164 //// { |
|
165 //// delete mContent; |
|
166 //// } |
|
167 //// mContent = 0; |
|
168 //// } |
|
169 //// |
|
170 //// if (!mFrameItem) |
|
171 //// { |
|
172 //// mFrameItem = new HbFrameItem(this); |
|
173 //// mFrameItem->frameDrawer().setFrameGraphicsName("qtg_fr_list_normal"); |
|
174 //// mFrameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
175 //// mFrameItem->setZValue(-2); |
|
176 //// //style()->setItemName(mFrameItem, "background"); |
|
177 //// } |
|
178 //// |
|
179 //// if (!mFocusItem) |
|
180 //// { |
|
181 //// mFocusItem = new HbFrameItem(this); |
|
182 //// mFocusItem->frameDrawer().setFrameGraphicsName("qtg_fr_list_pressed"); |
|
183 //// mFocusItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
184 //// mFocusItem->setZValue(-1); |
|
185 //// mFocusItem->setVisible(false); |
|
186 //// //style()->setItemName(mFocusItem, "highlight"); |
|
187 //// } |
|
188 //} |
|
189 // |
|
190 //void CntEditViewDetailItem::recreatePrimitives() |
|
191 //{ |
|
192 //// HbWidget::recreatePrimitives(); |
|
193 //// |
|
194 //// delete mIcon; |
|
195 //// mIcon = 0; |
|
196 //// |
|
197 //// delete mLabel; |
|
198 //// mLabel = 0; |
|
199 //// |
|
200 //// delete mContent; |
|
201 //// mContent = 0; |
|
202 //// |
|
203 //// delete mFrameItem; |
|
204 //// mFrameItem = 0; |
|
205 //// |
|
206 //// delete mFocusItem; |
|
207 //// mFocusItem = 0; |
|
208 //// |
|
209 //// createPrimitives(); |
|
210 //} |
|
211 // |
|
212 //void CntEditViewDetailItem::initGesture() |
|
213 //{ |
|
214 //// mGestureFilter = new HbGestureSceneFilter(Qt::LeftButton, this); |
|
215 //// mGestureLongpressed = new HbGesture(HbGesture::longpress, 5); |
|
216 //// mGestureFilter->addGesture(mGestureLongpressed); |
|
217 //// mGestureFilter->setLongpressAnimation(true); |
|
218 //// installSceneEventFilter(mGestureFilter); |
|
219 //// |
|
220 //// connect(mGestureLongpressed, SIGNAL(longPress(QPointF)), this, SLOT(onLongPress(QPointF))); |
|
221 //} |
|
222 // |
|
223 //void CntEditViewDetailItem::onLongPress(const QPointF &point) |
|
224 //{ |
|
225 // mHasFocus = false; |
|
226 // updatePrimitives(); |
|
227 // emit longPressed(point); |
|
228 //} |
|
229 // |
|
230 //void CntEditViewDetailItem::setDetail(const QContactDetail &detail, const QString &type) |
|
231 //{ |
|
232 //// bool doPolish = false; |
|
233 //// if (!mDetail.isEmpty() && detail != mDetail) |
|
234 //// { |
|
235 //// text.clear(); |
|
236 //// valueText.clear(); |
|
237 //// icon.clear(); |
|
238 //// doPolish = true; |
|
239 //// } |
|
240 //// mDetail = detail; |
|
241 //// mType = type; |
|
242 //// |
|
243 //// QString context; |
|
244 //// if (mDetail.contexts().count()) |
|
245 //// { |
|
246 //// context = mStringMapper.getMappedDetail(detail.contexts().at(0)); |
|
247 //// } |
|
248 //// |
|
249 //// // phone number |
|
250 //// if (mDetail.definitionName() == QContactPhoneNumber::DefinitionName) |
|
251 //// { |
|
252 //// QContactPhoneNumber number = mDetail; |
|
253 //// if (number.isEmpty()) |
|
254 //// { |
|
255 //// text = hbTrId("txt_phob_list_add_phone_number"); |
|
256 //// icon = HbIcon(mStringMapper.getMappedIcon(number.definitionName())); |
|
257 //// } |
|
258 //// else if ( !number.subTypes().isEmpty() ) |
|
259 //// { |
|
260 //// QStringList list; |
|
261 //// list << mStringMapper.getMappedDetail(number.subTypes().at(0)) << context; |
|
262 //// text = list.join(" "); |
|
263 //// valueText = number.number(); |
|
264 //// icon = HbIcon(mStringMapper.getMappedIcon(number.subTypes().at(0))); |
|
265 //// } |
|
266 //// } |
|
267 //// |
|
268 //// // email address |
|
269 //// if (mDetail.definitionName() == QContactEmailAddress::DefinitionName) |
|
270 //// { |
|
271 //// QContactEmailAddress email = mDetail; |
|
272 //// if (email.isEmpty()) |
|
273 //// { |
|
274 //// text = hbTrId("txt_phob_list_add_email_address"); |
|
275 //// icon = HbIcon(mStringMapper.getMappedIcon(email.definitionName())); |
|
276 //// } |
|
277 //// else |
|
278 //// { |
|
279 //// QStringList list; |
|
280 //// list << mStringMapper.getMappedDetail(email.definitionName()) << context; |
|
281 //// text = list.join(" "); |
|
282 //// valueText = email.emailAddress(); |
|
283 //// icon = HbIcon(mStringMapper.getMappedIcon(email.definitionName())); |
|
284 //// } |
|
285 //// } |
|
286 //// |
|
287 //// // postal address |
|
288 //// if (mDetail.definitionName() == QContactAddress::DefinitionName) |
|
289 //// { |
|
290 //// QContactAddress address = mDetail; |
|
291 //// if (address.isEmpty()) |
|
292 //// { |
|
293 //// text = qtTrId("Add postal address"); |
|
294 //// icon = HbIcon(mStringMapper.getMappedIcon(address.definitionName())); |
|
295 //// } |
|
296 //// else |
|
297 //// { |
|
298 //// QStringList nameList; |
|
299 //// nameList << mStringMapper.getMappedDetail(address.definitionName()) << context; |
|
300 //// text = nameList.join(" "); |
|
301 //// QStringList list; |
|
302 //// if (!address.street().isEmpty()) |
|
303 //// list << address.street(); |
|
304 //// if (!address.postcode().isEmpty()) |
|
305 //// list << address.postcode(); |
|
306 //// if (!address.postOfficeBox().isEmpty()) |
|
307 //// list << address.postOfficeBox(); |
|
308 //// if (!address.locality().isEmpty()) |
|
309 //// list << address.locality(); |
|
310 //// if (!address.region().isEmpty()) |
|
311 //// list << address.region(); |
|
312 //// if (!address.country().isEmpty()) |
|
313 //// list << address.country(); |
|
314 //// |
|
315 //// QString data = list.join(", "); |
|
316 //// valueText = data; |
|
317 //// } |
|
318 //// } |
|
319 //// |
|
320 //// // online account |
|
321 //// if (mDetail.definitionName() == QContactOnlineAccount::DefinitionName) |
|
322 //// { |
|
323 //// QContactOnlineAccount account = mDetail; |
|
324 //// if (account.isEmpty()) |
|
325 //// { |
|
326 //// text = hbTrId("Add IM address"); |
|
327 //// icon = HbIcon(mStringMapper.getMappedIcon(account.definitionName())); |
|
328 //// } |
|
329 //// else if ( !account.subTypes().isEmpty() ) |
|
330 //// { |
|
331 //// QStringList list; |
|
332 //// list << mStringMapper.getMappedDetail(account.subTypes().at(0)) << context; |
|
333 //// text = list.join(" "); |
|
334 //// valueText = account.accountUri(); |
|
335 //// icon = HbIcon(mStringMapper.getMappedIcon(account.subTypes().at(0))); |
|
336 //// } |
|
337 //// } |
|
338 //// |
|
339 //// // url address |
|
340 //// if (mDetail.definitionName() == QContactUrl::DefinitionName) |
|
341 //// { |
|
342 //// QContactUrl url = mDetail; |
|
343 //// if (url.isEmpty()) |
|
344 //// { |
|
345 //// text = hbTrId("txt_phob_list_add_url_address"); |
|
346 //// icon = HbIcon(mStringMapper.getMappedIcon(url.definitionName())); |
|
347 //// } |
|
348 //// else |
|
349 //// { |
|
350 //// QStringList list; |
|
351 //// list << mStringMapper.getMappedDetail(url.definitionName()) << context; |
|
352 //// text = list.join(" "); |
|
353 //// valueText = url.url(); |
|
354 //// icon = HbIcon(mStringMapper.getMappedIcon(url.definitionName())); |
|
355 //// } |
|
356 //// } |
|
357 //// |
|
358 //// // company details |
|
359 //// if (mDetail.definitionName() == QContactOrganization::DefinitionName) |
|
360 //// { |
|
361 //// QContactOrganization org = mDetail; |
|
362 //// |
|
363 //// // general details |
|
364 //// if (mType == QContactOrganization::DefinitionName) |
|
365 //// { |
|
366 //// text = mStringMapper.getMappedDetail(org.definitionName()); |
|
367 //// QStringList list; |
|
368 //// if(!org.title().isEmpty()) |
|
369 //// list << org.title(); |
|
370 //// if(!org.name().isEmpty()) |
|
371 //// list << org.name(); |
|
372 //// if(!org.department().isEmpty()) |
|
373 //// list << org.department().join(" "); |
|
374 //// valueText = list.join(", "); |
|
375 //// |
|
376 //// } |
|
377 //// // assistant name |
|
378 //// else if (mType == QContactOrganization::FieldAssistantName) |
|
379 //// { |
|
380 //// text = mStringMapper.getMappedDetail(QContactOrganization::FieldAssistantName); |
|
381 //// valueText = org.assistantName(); |
|
382 //// } |
|
383 //// } |
|
384 //// |
|
385 //// // birthday |
|
386 //// if (mDetail.definitionName() == QContactBirthday::DefinitionName) |
|
387 //// { |
|
388 //// QContactBirthday bDay = mDetail; |
|
389 //// |
|
390 //// text = mStringMapper.getMappedDetail(bDay.definitionName()); |
|
391 //// valueText = bDay.date().toString("dd MMMM yyyy"); |
|
392 //// } |
|
393 //// |
|
394 //// // anniversary |
|
395 //// if (mDetail.definitionName() == QContactAnniversary::DefinitionName) |
|
396 //// { |
|
397 //// QContactAnniversary anniversary = mDetail; |
|
398 //// |
|
399 //// text = mStringMapper.getMappedDetail(anniversary.definitionName()); |
|
400 //// valueText = anniversary.originalDate().toString("dd MMMM yyyy"); |
|
401 //// } |
|
402 //// |
|
403 //// // ringing tone |
|
404 //// if (mDetail.definitionName() == QContactAvatar::DefinitionName) |
|
405 //// { |
|
406 //// QContactAvatar avatar = mDetail; |
|
407 //// |
|
408 //// text = mStringMapper.getMappedDetail(QContactAvatar::SubTypeAudioRingtone); |
|
409 //// valueText = avatar.avatar(); |
|
410 //// } |
|
411 //// |
|
412 //// // note |
|
413 //// if (mDetail.definitionName() == QContactNote::DefinitionName) |
|
414 //// { |
|
415 //// QContactNote note = mDetail; |
|
416 //// |
|
417 //// text = mStringMapper.getMappedDetail(note.definitionName()); |
|
418 //// valueText = note.note(); |
|
419 //// } |
|
420 //// |
|
421 //// // family details |
|
422 //// if (mDetail.definitionName() == QContactFamily::DefinitionName) |
|
423 //// { |
|
424 //// QContactFamily family = mDetail; |
|
425 //// |
|
426 //// // spouse |
|
427 //// if (mType == QContactFamily::FieldSpouse) |
|
428 //// { |
|
429 //// text = mStringMapper.getMappedDetail(QContactFamily::FieldSpouse); |
|
430 //// valueText = family.spouse(); |
|
431 //// |
|
432 //// } |
|
433 //// // children |
|
434 //// else if (mType == QContactFamily::FieldChildren) |
|
435 //// { |
|
436 //// text = mStringMapper.getMappedDetail(QContactFamily::FieldChildren); |
|
437 //// valueText = family.children().join(", "); |
|
438 //// } |
|
439 //// } |
|
440 //// |
|
441 //// recreatePrimitives(); |
|
442 //// if (doPolish) |
|
443 //// { |
|
444 //// repolish(); |
|
445 //// } |
|
446 //} |
|
447 // |
|
448 //QContactDetail CntEditViewDetailItem::detail() |
|
449 //{ |
|
450 // return mDetail; |
|
451 //} |
|
452 // |
|
453 //QString CntEditViewDetailItem::fieldType() |
|
454 //{ |
|
455 // return mType; |
|
456 //} |
|
457 // |
|
458 //void CntEditViewDetailItem::updatePrimitives() |
|
459 //{ |
|
460 // //HbWidget::updatePrimitives(); |
|
461 // if (mHasFocus) |
|
462 // { |
|
463 // mFocusItem->setVisible(true); |
|
464 // HbEffect::start(mFocusItem, QString("frameitem"), QString("pressed")); |
|
465 // } |
|
466 // else |
|
467 // { |
|
468 // HbEffect::start(mFocusItem, QString("frameitem"), QString("released")); |
|
469 // } |
|
470 //} |
|
471 // |
|
472 //void CntEditViewDetailItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
473 //{ |
|
474 // HbInstantFeedback::play(HbFeedback::Basic); |
|
475 // event->accept(); |
|
476 // mHasFocus = true; |
|
477 // updatePrimitives(); |
|
478 //} |
|
479 // |
|
480 //void CntEditViewDetailItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
481 //{ |
|
482 //// if (!rect().contains(event->pos()) && mHasFocus) |
|
483 //// { |
|
484 //// mHasFocus = false; |
|
485 //// updatePrimitives(); |
|
486 //// } |
|
487 //// event->accept(); |
|
488 //} |
|
489 // |
|
490 // |
|
491 //void CntEditViewDetailItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
492 //{ |
|
493 // bool hadFocus = mHasFocus; |
|
494 // mHasFocus = false; |
|
495 //// if (rect().contains(event->pos()) && hadFocus) |
|
496 //// { |
|
497 //// updatePrimitives(); |
|
498 //// emit clicked(); |
|
499 //// } |
|
500 //// event->accept(); |
|
501 //} |
|