src/hbwidgets/popups/hbnotificationdialogcontent.cpp
changeset 2 06ff229162e9
parent 0 16d8024aca5e
child 6 c3690ec91ef8
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 #include <hbstyleoptionnotificationdialog.h>
    26 #include <hbstyleoptionnotificationdialog_p.h>
    27 #include <hbdeviceprofile.h>
    27 #include <hbdeviceprofile.h>
    28 
    28 
    29 #include "hbnotificationdialogcontent_p.h"
    29 #include "hbnotificationdialogcontent_p.h"
    30 
    30 
    31 HbNotificationDialogContent::HbNotificationDialogContent(QGraphicsWidget *parent) :
    31 HbNotificationDialogContent::HbNotificationDialogContent(QGraphicsWidget *parent) :
    41                 HbStyle::P_NotificationDialog_icon, this);
    41                 HbStyle::P_NotificationDialog_icon, this);
    42         Q_CHECK_PTR(mIconItem);
    42         Q_CHECK_PTR(mIconItem);
    43     }
    43     }
    44     mIcon = icon;
    44     mIcon = icon;
    45     updatePrimitives();
    45     updatePrimitives();
    46     polishEvent();
    46     if (isVisible()) {
       
    47         polishEvent();
       
    48     }
    47 }
    49 }
    48 
    50 
    49 void HbNotificationDialogContent::setText(const QString &text)
    51 void HbNotificationDialogContent::setText(const QString &text)
    50 {
    52 {
    51     if(!mTextItem) {
    53     if(!mTextItem) {
    53                 HbStyle::P_NotificationDialog_text, this);
    55                 HbStyle::P_NotificationDialog_text, this);
    54         Q_CHECK_PTR(mTextItem);
    56         Q_CHECK_PTR(mTextItem);
    55     }
    57     }
    56     mText = text;
    58     mText = text;
    57     updatePrimitives();
    59     updatePrimitives();
    58     polishEvent();
    60     if (isVisible()) {
       
    61         polishEvent();
       
    62     }
    59 }
    63 }
    60 
    64 
    61 void HbNotificationDialogContent::setTitle(const QString &title)
    65 void HbNotificationDialogContent::setTitle(const QString &title)
    62 {
    66 {
    63     if(!mTitleItem) {
    67     if(!mTitleItem) {
    66         Q_CHECK_PTR(mTitleItem);
    70         Q_CHECK_PTR(mTitleItem);
    67     }
    71     }
    68 
    72 
    69     mTitle = title;
    73     mTitle = title;
    70     updatePrimitives();
    74     updatePrimitives();
    71     polishEvent();
    75     if (isVisible()) {
       
    76         polishEvent();
       
    77     }
    72 }
    78 }
    73 
    79 
    74 void HbNotificationDialogContent::setTitleTextWrapping(Hb::TextWrapping wrapping)
    80 void HbNotificationDialogContent::setTitleTextWrapping(Hb::TextWrapping wrapping)
    75 {
    81 {
    76     if (mTitleWrapping != wrapping) {
    82     if (mTitleWrapping != wrapping) {
    77         mTitleWrapping = wrapping;
    83         mTitleWrapping = wrapping;
    78         updatePrimitives();
    84         updatePrimitives();
    79         polishEvent();
    85         if (isVisible()) {
       
    86             polishEvent();
       
    87         }
    80     }
    88     }
    81 }
    89 }
    82 
    90 
    83 Hb::TextWrapping HbNotificationDialogContent::titleTextWrapping() const
    91 Hb::TextWrapping HbNotificationDialogContent::titleTextWrapping() const
    84 {
    92 {
   179     if (!mIcon.isNull()) {
   187     if (!mIcon.isNull()) {
   180         style()->updatePrimitive(mIconItem,
   188         style()->updatePrimitive(mIconItem,
   181             HbStyle::P_NotificationDialog_icon, &option);
   189             HbStyle::P_NotificationDialog_icon, &option);
   182     }
   190     }
   183 }
   191 }
       
   192 
       
   193 /*!
       
   194     \reimp
       
   195 */
       
   196 QGraphicsItem *HbNotificationDialogContent::primitive(const QString &itemName) const
       
   197 {
       
   198     if (itemName == "") {
       
   199         return 0;
       
   200     } else {
       
   201         if (itemName == "text") {
       
   202             return mTextItem;
       
   203         }
       
   204         else if (itemName == "title") {
       
   205             return mTitleItem;
       
   206         }
       
   207         else if (itemName == "icon") {
       
   208             return mIconItem;
       
   209         } else {
       
   210             return 0;
       
   211         }
       
   212     }
       
   213 }