equal
deleted
inserted
replaced
37 #include <hbmainwindow.h> |
37 #include <hbmainwindow.h> |
38 #include <hbwidgetsequentialshow_p.h> |
38 #include <hbwidgetsequentialshow_p.h> |
39 #include <hbdevicedialogserverstatus_p.h> |
39 #include <hbdevicedialogserverstatus_p.h> |
40 #include <hbtapgesture.h> |
40 #include <hbtapgesture.h> |
41 #include <hbpangesture.h> |
41 #include <hbpangesture.h> |
|
42 #include <hbwidgetfeedback.h> |
42 |
43 |
43 #ifdef HB_EFFECTS |
44 #ifdef HB_EFFECTS |
44 #include "hbeffectinternal_p.h" |
45 #include "hbeffectinternal_p.h" |
45 #endif |
46 #endif |
46 |
47 |
299 */ |
300 */ |
300 void HbNotificationDialog::setText(const QString& text) |
301 void HbNotificationDialog::setText(const QString& text) |
301 { |
302 { |
302 Q_D(HbNotificationDialog); |
303 Q_D(HbNotificationDialog); |
303 d->checkAndCreateContentWidget(); |
304 d->checkAndCreateContentWidget(); |
304 d->content->setText( text ); |
305 d->content->setText(text); |
|
306 if (text.isEmpty()) { |
|
307 d->titleTextWrapping = Hb::TextWordWrap; |
|
308 } else { |
|
309 d->titleTextWrapping = Hb::TextNoWrap; |
|
310 } |
305 d->setNotificationDialogContent(); |
311 d->setNotificationDialogContent(); |
306 } |
312 } |
307 |
313 |
308 /*! |
314 /*! |
309 Returns the icon for the dialog. |
315 Returns the icon for the dialog. |
344 \sa setTitleTextWrapping(), HbNotificationDialog::title, HbNotificationDialog::text |
350 \sa setTitleTextWrapping(), HbNotificationDialog::title, HbNotificationDialog::text |
345 */ |
351 */ |
346 Hb::TextWrapping HbNotificationDialog::titleTextWrapping() const |
352 Hb::TextWrapping HbNotificationDialog::titleTextWrapping() const |
347 { |
353 { |
348 Q_D(const HbNotificationDialog); |
354 Q_D(const HbNotificationDialog); |
349 return d->titleWrapping; |
355 return d->titleTextWrapping; |
350 } |
356 } |
351 |
357 |
352 /*! |
358 /*! |
353 Sets whether the text for the title is wrapped. |
359 Sets whether the text for the title is wrapped. |
354 |
360 |
356 \sa titleTextWrapping() |
362 \sa titleTextWrapping() |
357 */ |
363 */ |
358 void HbNotificationDialog::setTitleTextWrapping(Hb::TextWrapping wrapping) |
364 void HbNotificationDialog::setTitleTextWrapping(Hb::TextWrapping wrapping) |
359 { |
365 { |
360 Q_D(HbNotificationDialog); |
366 Q_D(HbNotificationDialog); |
361 if (d->titleWrapping != wrapping) { |
367 if (d->titleTextWrapping != wrapping) { |
362 d->titleWrapping = wrapping; |
368 d->titleTextWrapping = wrapping; |
363 if (d->content) { |
369 if (d->content) { |
364 d->content->setTitleTextWrapping(d->titleWrapping); |
370 d->content->setTitleTextWrapping(d->titleTextWrapping); |
365 } |
371 } |
366 d->doLayout(); |
372 d->doLayout(); |
367 } |
373 } |
368 } |
374 } |
369 |
375 |
431 void HbNotificationDialog::gestureEvent(QGestureEvent *event) |
437 void HbNotificationDialog::gestureEvent(QGestureEvent *event) |
432 { |
438 { |
433 Q_D(HbNotificationDialog); |
439 Q_D(HbNotificationDialog); |
434 if(HbTapGesture *tap = qobject_cast<HbTapGesture*>(event->gesture(Qt::TapGesture))) { |
440 if(HbTapGesture *tap = qobject_cast<HbTapGesture*>(event->gesture(Qt::TapGesture))) { |
435 if(tap->state() == Qt::GestureStarted) { |
441 if(tap->state() == Qt::GestureStarted) { |
|
442 HbWidgetFeedback::triggered(this, Hb::InstantPressed); |
436 d->stopTimeout(); |
443 d->stopTimeout(); |
437 } else if(tap->state() == Qt::GestureFinished) { |
444 } else if(tap->state() == Qt::GestureFinished) { |
438 if (d->isTouchActivating) { |
445 if (d->isTouchActivating) { |
|
446 HbWidgetFeedback::triggered(this, Hb::InstantReleased); |
439 emit activated(); |
447 emit activated(); |
440 } |
448 } |
441 close(); |
449 close(); |
442 } |
450 } |
443 } else if( HbPanGesture *pan = qobject_cast<HbPanGesture*>(event->gesture(Qt::PanGesture))) { |
451 } else if( HbPanGesture *pan = qobject_cast<HbPanGesture*>(event->gesture(Qt::PanGesture))) { |
505 setPreferredPos(QPointF(hMargin, vMargin)); |
513 setPreferredPos(QPointF(hMargin, vMargin)); |
506 } |
514 } |
507 } |
515 } |
508 |
516 |
509 HbNotificationDialogPrivate::HbNotificationDialogPrivate() : |
517 HbNotificationDialogPrivate::HbNotificationDialogPrivate() : |
510 HbDialogPrivate(), isTouchActivating(false), |
518 HbDialogPrivate(), isTouchActivating(false), titleTextWrapping(Hb::TextWordWrap), |
511 titleWrapping(Hb::TextWordWrap), |
519 content(0), sequentialShow(true) |
512 content(0), sequentialShow(true) |
|
513 { |
520 { |
514 } |
521 } |
515 |
522 |
516 HbNotificationDialogPrivate::~HbNotificationDialogPrivate() |
523 HbNotificationDialogPrivate::~HbNotificationDialogPrivate() |
517 { |
524 { |
525 HbStyle::setItemName(content, "content"); |
532 HbStyle::setItemName(content, "content"); |
526 } |
533 } |
527 } |
534 } |
528 void HbNotificationDialogPrivate::setBackgroundStyle() |
535 void HbNotificationDialogPrivate::setBackgroundStyle() |
529 { |
536 { |
530 Q_Q(HbNotificationDialog); |
537 setBackgroundItem(HbStyle::P_NotificationDialog_frame); |
531 q->setBackgroundItem(HbStyle::P_NotificationDialog_frame); |
|
532 } |
538 } |
533 |
539 |
534 void HbNotificationDialogPrivate::setNotificationDialogContent() |
540 void HbNotificationDialogPrivate::setNotificationDialogContent() |
535 { |
541 { |
536 Q_Q(HbNotificationDialog); |
542 Q_Q(HbNotificationDialog); |
537 content->enableTouchActivation(isTouchActivating); |
543 content->enableTouchActivation(isTouchActivating); |
538 content->setTitleTextWrapping(titleWrapping); |
544 content->setTitleTextWrapping(titleTextWrapping); |
539 if (q->contentWidget() == content) { |
545 if (q->contentWidget() == content) { |
540 doLayout(); |
546 doLayout(); |
541 } else { |
547 } else { |
542 q->setContentWidget( content ); |
548 q->setContentWidget( content ); |
543 } |
549 } |