src/hbwidgets/popups/hbmessagebox.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 7 923ff622b8b9
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    40 
    40 
    41 class HbStyle;
    41 class HbStyle;
    42 
    42 
    43 class HbMessageBoxEditor : public HbLineEdit
    43 class HbMessageBoxEditor : public HbLineEdit
    44 {
    44 {
       
    45 	Q_OBJECT
    45 public:
    46 public:
    46     HbMessageBoxEditor(QGraphicsItem* parent =0) : HbLineEdit(parent),mText()
    47     HbMessageBoxEditor(QGraphicsItem* parent =0) : HbLineEdit(parent),mText()
    47     {
    48     {
    48         setReadOnly(true);
    49         setReadOnly(true);
    49         setCursorVisibility(Hb::TextCursorHidden);
    50         setCursorVisibility(Hb::TextCursorHidden);
    50         HbScrollArea *scroll = scrollArea();
    51         HbScrollArea *scroll = scrollArea();
    51         scroll->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
    52         scroll->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
    52         clearContextMenuFlag(Hb::ShowTextContextMenuOnLongPress);
    53         clearContextMenuFlag(Hb::ShowTextContextMenuOnLongPress);
    53         clearContextMenuFlag(Hb::ShowTextContextMenuOnSelectionClicked);  
    54         clearContextMenuFlag(Hb::ShowTextContextMenuOnSelectionClicked);
    54         setBackgroundItem(0,0);
    55         setBackgroundItem(0,0);     
    55     }
    56     }
    56 
    57 
    57     void focusInEvent(QFocusEvent * event)
    58     void focusInEvent(QFocusEvent * event)
    58     {
    59     {
    59         Q_UNUSED(event);         
    60         Q_UNUSED(event);         
   107 
   108 
   108 HbMessageBoxPrivate::HbMessageBoxPrivate() :
   109 HbMessageBoxPrivate::HbMessageBoxPrivate() :
   109     HbDialogPrivate(),
   110     HbDialogPrivate(),
   110     mIcon(),
   111     mIcon(),
   111     mMessageBoxContentWidget(0),
   112     mMessageBoxContentWidget(0),
   112     mMessageBoxType(HbMessageBox::MessageTypeInformation),
   113     mMessageBoxType(HbMessageBox::MessageTypeNone),
   113     mIconVisible(true)
   114     mIconVisible(true)
   114 {
   115 {
   115 }
   116 }
   116 
   117 
   117 void HbMessageBoxPrivate::_q_closeOnGesture()
   118 void HbMessageBoxPrivate::_q_buttonClicked()
   118 {
   119 {
   119 }
   120     Q_Q(HbMessageBox);    
   120 
   121     HbAction *action = static_cast<HbAction*>(q->sender());
       
   122     q->done(mActionList.value(action));
       
   123 }
   121 /*
   124 /*
   122     destructor
   125     destructor
   123 */
   126 */
   124 HbMessageBoxPrivate::~HbMessageBoxPrivate()
   127 HbMessageBoxPrivate::~HbMessageBoxPrivate()
   125 {
   128 {
   129     init()
   132     init()
   130 */
   133 */
   131 void HbMessageBoxPrivate::init()
   134 void HbMessageBoxPrivate::init()
   132 {
   135 {
   133     Q_Q(HbMessageBox);
   136     Q_Q(HbMessageBox);
   134 
   137        
       
   138     mMessageBoxContentWidget = new HbMessageBoxContentWidget( this );
       
   139     q->setContentWidget( mMessageBoxContentWidget );
       
   140     q->setDismissPolicy(HbPopup::NoDismiss);
       
   141     q->setTimeout(HbPopup::NoTimeout);      
       
   142     q->setStandardButtons(HbMessageBox::Ok);
       
   143     
   135     switch(mMessageBoxType) {
   144     switch(mMessageBoxType) {
       
   145     case HbMessageBox::MessageTypeNone:
       
   146         mMessageBoxContentWidget->mIconItem->hide();
       
   147         mMessageBoxContentWidget->setProperty("hasIcon",false);
       
   148         break;
   136     case HbMessageBox::MessageTypeInformation:
   149     case HbMessageBox::MessageTypeInformation:
   137     case HbMessageBox::MessageTypeWarning:
   150     case HbMessageBox::MessageTypeWarning:
   138         mMessageBoxContentWidget = new HbMessageBoxContentWidget( this );
   151     case HbMessageBox::MessageTypeQuestion:
   139         q->setContentWidget( mMessageBoxContentWidget );
       
   140         q->setDismissPolicy(HbPopup::NoDismiss);
       
   141         q->setTimeout(HbPopup::NoTimeout);      
       
   142         q->addAction(new HbAction(q->tr("OK"),q));
       
   143         break;
   152         break;
   144 
   153         
   145     case HbMessageBox::MessageTypeQuestion:
   154     }
   146         mMessageBoxContentWidget = new HbMessageBoxContentWidget( this );
   155 
   147         q->setContentWidget( mMessageBoxContentWidget );
       
   148         q->setDismissPolicy(HbPopup::NoDismiss);
       
   149         q->setTimeout(HbPopup::NoTimeout);       
       
   150         q->addAction(new HbAction(q->tr("Yes"),q));
       
   151         q->addAction(new HbAction(q->tr("No"),q));
       
   152         break;
       
   153     }
       
   154 }
   156 }
   155 
   157 
   156 /*!
   158 /*!
   157     @beta
   159     @beta
   158     
   160     
   159     \class HbMessageBox
   161     \class HbMessageBox
   160     \brief The HbMessageBox class provides a modal dialog for informing the user or for asking the user a question and receiving an answer.
   162     \brief HbMessageBox is a convenience modal dialog class. HbMessageBox can be used to launch a information,question,warning or any other 
   161 
   163     general messages.
   162     \image html information.PNG  "An information MessageBox"
   164 
   163     \image html question.PNG  "A question MessageBox"
   165 	\image html information.PNG  "An information MessageBox"
   164     \image html warning.PNG  "A warning MessageBox"
   166 	\image html question.PNG  "A question MessageBox"
       
   167 	\image html warning.PNG  "A warning MessageBox"
   165 
   168 
   166     Using HbMessageBox, the following dialogs can be created:
   169     Using HbMessageBox, the following dialogs can be created:
   167 
   170 
   168     <b>Information:</b> a statement to the user to which dismissed after acknowledging the information ('OK').<br>
   171     <b>Information:</b> a statement to the user to which they may respond by acknowledging the information ('Ok').<br>
   169     <b>Question:</b> a query to the user requiring a response. User needs to select between two alternatives, the positive or negative (For example: 'Delete Mailbox?' 'Yes'/'No').<br>
   172     <b>Question:</b> a query to the user requiring a response. User needs to select between two alternatives, the positive or negative (For example: 'Delete Mailbox?' 'Yes'/'No').<br>
   170     <b>Warning:</b> a statement to the user to which they may respond by acknowledging the warning ('OK').<br>
   173     <b>Warning:</b> a statement to the user to which they may respond by acknowledging the warning ('OK').<br>
   171     
   174     <b>None:</b> Any general messages to which user responds. 
   172     By default, Message box launches an information dialog which contains a description text and user actions visualized as command buttons.
   175     
       
   176     By default, Message box launches a None dialog which can contain a text, an icon and action buttons
   173 
   177 
   174     Default properties for the MessageBox (warning, information and question dialogs) are:
   178     Default properties for the MessageBox (warning, information and question dialogs) are:
   175 
   179 
   176     Description text: Text shown to the user as information. The amount of text rows is not limited, but after five rows the text starts scrolling.
   180     Description text: Text shown to the user as information. The amount of text rows is not limited, but after five rows the text starts scrolling.
   177     Icon: Default icons are available for each dialog type using the MessageBox template.
   181     Icon: Default icons are available for each dialog type using the MessageBox template. Changing the default icons is not recommended.
   178     Action buttons (one or two): one button for information and warning MessageBox, two buttons for question MessageBox.
   182     Action button : One action button ("Ok") for all the types.
   179     
   183     
   180     All the three dialogs(information, warning, question) supported by MessageBox are by default modal in nature, with
   184     All the four dialogs(information, warning, question and none) supported by MessageBox are by default modal in nature, with
   181     a dismiss policy of NoDismiss, timeout policy of NoTimeout, and with a BackgroundFade property on.
   185     a dismiss policy of NoDismiss, timeout policy of NoTimeout, and with a BackgroundFade property on.
   182     The user must click the OK/Yes/No buttons to dismiss the Message Box.
       
   183 
   186 
   184     Example code for launching MessageBox using static convenience functions:
   187     Example code for launching MessageBox using static convenience functions:
   185 
   188 
   186     \code
   189     \code
   187     //Information MessageBox
   190     //Information MessageBox
   188     HbMessageBox::information(informationText, this, SLOT(onDialogClose(HbAction*)), headWidget, scene, parent);
   191     HbMessageBox::information("The file is deleted",0,0,HbMessageBox::Ok);
   189 
   192 
   190     //Warning MessageBox
   193     //Warning MessageBox
   191     HbMessageBox::warning(warningText, this, SLOT(onDialogClose(HbAction*)), headWidget, scene, parent);
   194     HbMessageBox::warning("This will change the name",0,0,HbMessageBox::Ok);
   192 
   195 
   193     //Question MessageBox
   196     //Question MessageBox
   194     HbMessageBox::question(questionText, this, SLOT(onDialogClose(HbAction*)), primaryButtonText, secondaryButtonText, headWidget, scene, parent);
   197      HbMessageBox::question("Do you want to delete the file ?", this, SLOT(onDialogClose(int)),HbMessageBox::Yes |HbMessageBox::No );
       
   198     \endcode
       
   199 
       
   200     Example code to show an information messagebox:
       
   201     \code
       
   202     HbMessageBox *box = new HbMessageBox("This is a general note.");
       
   203     box->setAttribute(Qt::WA_DeleteOnClose);
       
   204     box->open();
   195     \endcode
   205     \endcode
   196 
   206 
   197     Example code to show a question messagebox with a return value based action
   207     Example code to show a question messagebox with a return value based action
   198     \code
   208     \code
   199     HbMessageBox *box = new HbMessageBox(" Delete file IC0002 ? ",HbMessageBox::MessageTypeQuestion);
   209     HbMessageBox *box = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
       
   210     box->setText("Delete file IC0002 ? ");
   200     box->setAttribute(Qt::WA_DeleteOnClose);
   211     box->setAttribute(Qt::WA_DeleteOnClose);
   201     box->open(this,SLOT(dialogClosed(HbAction*)));
   212     box->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No);
   202 
   213     box->open(this,SLOT(onDialogClosed(int)));
       
   214     
   203     //Slot implementation
   215     //Slot implementation
   204     void dialogClosed(HbAction *action)
   216     void MessageBoxView::onDialogClosed(int action)
   205     {
   217     {
   206         HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
   218          if (action == HbMessageBox::Yes) {
   207         if(action == dlg->actions().at(0)) 
   219           //User Clicked Yes//
   208         {
   220           //Delete the file//
   209             // Delete file 
   221          }
   210         }
   222          else if (action == HbMessageBox::No) {
   211         else
   223           //User Clicked No//
   212         {
   224           //do not delete the file//
   213            // Cancellation is done.Dont delete the file
   225          }
   214         }
   226         
   215      }
   227     }
       
   228     \endcode     
       
   229 
       
   230     Example code to show a question messagebox using static API
       
   231      \code
       
   232      HbMessageBox::question("Delete file IC0002 ? ",this,SLOT(onDialogClosed(int)),HbMessageBox::Yes | HbMessageBox::No);  
       
   233      // Here the SLOT implementation is same as above
   216      \endcode     
   234      \endcode     
   217 
   235 
       
   236 
   218     \enum HbMessageBox::MessageBoxType
   237     \enum HbMessageBox::MessageBoxType
   219 
   238 
   220     \value \b MessageTypeInformation creates a modal information dialog, which by default will have one OK button 
   239     \value \b MessageTypeNone creates a modal dialog, which by default will have one OK button 
   221         for the user to dismiss the dialog.
   240         for the user to dismiss the dialog.
   222 
   241 
   223     \value \b MessageTypeWarning creates a simple modal dialog with a warning icon and a description text. 
   242     \value \b MessageTypeWarning creates a simple modal dialog with a warning icon and a description text. 
   224         Dialog by default will have one OK button, for the user to dismiss the dialog. 
   243         This Dialog by default will have one Ok button, for the user to dismiss the dialog. 
   225 
   244 
   226     \value \b MessageTypeQuestion Shows a modal dialog with question icon and a description text. The user can either confirm or
   245     \value \b MessageTypeWarning creates a simple modal dialog with a information icon and a description text. 
   227         reject the dialog. By default dialog supports two buttons, using which user can dismiss the dialog. 
   246         This Dialog by default will have one Ok button, for the user to dismiss the dialog. 
   228 
   247 
       
   248      \value \b MessageTypeQuestion creates a simple modal dialog with a question icon and a description text. 
       
   249         This Dialog by default will have one Ok button, for the user to dismiss the dialog.  
   229 */
   250 */
   230 
   251 
   231 /*!
   252 /*!
   232     Constructs a MessageBox with \a type and a \a parent.
   253     Constructs a MessageBox with \a type and a \a parent.
   233     \param type User can create information/warning/question dialogs by passing appropriate MessageBoxType.
   254     \param type User can create information/warning/question dialogs by passing appropriate MessageBoxType.
   359         d->mIcon = icon;
   380         d->mIcon = icon;
   360         if (d->mMessageBoxContentWidget->mIconItem) {
   381         if (d->mMessageBoxContentWidget->mIconItem) {
   361             HbStyleOptionMessageBox option;
   382             HbStyleOptionMessageBox option;
   362             initStyleOption(&option);
   383             initStyleOption(&option);
   363             style()->updatePrimitive(d->mMessageBoxContentWidget->mIconItem, HbStyle::P_MessageBox_icon, &option);
   384             style()->updatePrimitive(d->mMessageBoxContentWidget->mIconItem, HbStyle::P_MessageBox_icon, &option);
       
   385         }
       
   386         if(iconVisible() ) {
       
   387             d->mMessageBoxContentWidget->mIconItem->show();
       
   388             d->mMessageBoxContentWidget->setProperty("hasIcon",true);
   364         }
   389         }
   365     }
   390     }
   366 }
   391 }
   367 
   392 
   368 /*!
   393 /*!
   410 {
   435 {
   411     Q_D(const HbMessageBox);
   436     Q_D(const HbMessageBox);
   412     return d->mIconVisible;
   437     return d->mIconVisible;
   413 
   438 
   414 }
   439 }
   415 
   440 /*!
   416 
   441     sets the buttons for the dialog. If the Application wants "Yes" and "No" buttons 
   417 /*!
   442     can set it like setStandardButtons(HbMessageBox::Yes | HbMessageBox::No).
   418     This is a convenience function for showing a question dialog with \a questionText and buttons with specified \a primaryButtonText and
   443     If only yes Button then setStandardButtons(HbMessageBox::Yes).
   419     \a secondaryButtonText. 
   444    
       
   445    \param buttons the button set
       
   446     \sa standardButtons()
       
   447 
       
   448 */
       
   449 void HbMessageBox::setStandardButtons(HbMessageBox::StandardButtons buttons)
       
   450 {
       
   451     Q_D(HbMessageBox); 
       
   452     if(d->mStandardButtons == buttons ) {
       
   453         return;
       
   454     }
       
   455     clearActions();
       
   456     d->mStandardButtons = buttons;
       
   457     uint i = HbMessageBox::Ok;        
       
   458     int count =0;
       
   459     while (i <= HbMessageBox::Reset) {
       
   460          HbAction *action=0;
       
   461          if (i & buttons) {
       
   462              StandardButton button = HbMessageBox::StandardButton(i);
       
   463              switch(button){
       
   464                     case Ok:
       
   465                           action = new HbAction(hbTrId("txt_common_button_ok"),this); 
       
   466                           d->mActionList.insert(action,Ok);
       
   467                           break;
       
   468                     case Save:
       
   469                           action = new HbAction(hbTrId("txt_common_button_save"),this); 
       
   470                           d->mActionList.insert(action,Save);
       
   471                           break;
       
   472                     case Open:
       
   473                           action = new HbAction(hbTrId("txt_common_button_open"),this); 
       
   474                           d->mActionList.insert(action,Open);
       
   475                           break;
       
   476                      case Yes:
       
   477                           action = new HbAction(hbTrId("txt_common_button_yes"),this); 
       
   478                           d->mActionList.insert(action,Yes);
       
   479                           break;
       
   480                       case No:
       
   481                           action = new HbAction(hbTrId("txt_common_button_no"),this);                         
       
   482                           d->mActionList.insert(action,No);
       
   483                           break;
       
   484                       case Retry:
       
   485                           action = new HbAction(hbTrId("txt_common_button_retry"),this);  
       
   486                           d->mActionList.insert(action,Retry);
       
   487                           break;                      
       
   488                       case Continue:
       
   489                           action = new HbAction(hbTrId("txt_common_button_continue"),this);  
       
   490                           d->mActionList.insert(action,Continue);
       
   491                           break;
       
   492                       case Close:
       
   493                           action = new HbAction(hbTrId("txt_common_button_close"),this);
       
   494                           d->mActionList.insert(action,Close);
       
   495                           break;
       
   496                        case Cancel:
       
   497                           action = new HbAction(hbTrId("txt_common_button_cancel"),this); 
       
   498                           d->mActionList.insert(action,Cancel);
       
   499                           break;
       
   500                        case Help:
       
   501                           action = new HbAction(hbTrId("txt_common_button_help"),this); 
       
   502                           d->mActionList.insert(action,Help);
       
   503                           break;
       
   504                        case Reset:
       
   505                           action = new HbAction(hbTrId("txt_common_button_reset"),this);    
       
   506                           d->mActionList.insert(action,Reset);
       
   507                           break;
       
   508                        case Delete:
       
   509                           action = new HbAction(hbTrId("txt_common_button_delete"),this);
       
   510                           d->mActionList.insert(action,Delete);
       
   511                           break;
       
   512                        default :
       
   513                            break;
       
   514 
       
   515                 };
       
   516             
       
   517             }
       
   518             i = i << 1;
       
   519 
       
   520             if(action) {
       
   521                 connect(action,SIGNAL(triggered()),this,SLOT(_q_buttonClicked()));
       
   522                 addAction(action);                
       
   523                 count++;
       
   524             }
       
   525             
       
   526         }
       
   527 }
       
   528 /*!
       
   529    Returns the standared button list
       
   530    
       
   531    \sa setStandardButtons()
       
   532 
       
   533 */
       
   534 HbMessageBox::StandardButtons HbMessageBox::standardButtons() const
       
   535 {
       
   536     Q_D(const HbMessageBox);
       
   537     return d->mStandardButtons;
       
   538 
       
   539 }
       
   540 
       
   541 /*!
       
   542 
       
   543     \deprecated HbMessageBox::question(const QString&,QObject*,const char*,const QString&,const QString&,QGraphicsWidget*,QGraphicsScene*,QGraphicsItem*)
       
   544         is deprecated.
       
   545 
       
   546     Please use 
       
   547     
       
   548     question(const QString &questionText,
       
   549                                             QObject *receiver,
       
   550                                             const char *member,
       
   551                                             HbMessageBox::StandardButtons buttons,
       
   552                                             QGraphicsWidget *headWidget,
       
   553                                             QGraphicsScene *scene,
       
   554                                             QGraphicsItem *parent)
       
   555 
       
   556     This is a convenience function for showing a question dialog with \a questionText with provided buttons.
   420     \param questionText descriptive text for the messagebox
   557     \param questionText descriptive text for the messagebox
   421     \param receiver Object which has the slot, which acts as a handler once the dialog closes.
   558     \param receiver Object which has the slot, which acts as a handler once the dialog closes.
   422     \param member the slot, where the control will come, once the dialog is closed.
   559     \param member the slot, where the control will come, once the dialog is closed.
   423     \param primaryButtonText text for the primary button.
   560     \param primaryButtonText text for the primary button.
   424     \param secondaryButtonText text for the secondary button.
   561     \param secondaryButtonText text for the secondary button.
   455     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   592     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   456     messageBox->open(receiver,member);
   593     messageBox->open(receiver,member);
   457 }
   594 }
   458      
   595      
   459 /*!
   596 /*!
       
   597     \deprecated HbMessageBox::information(const QString&,QObject*,const char*,QGraphicsWidget*,QGraphicsScene*,QGraphicsItem*)
       
   598         is deprecated.
       
   599 
       
   600     Please use 
       
   601     
       
   602     information(const QString &questionText,
       
   603                                             QObject *receiver,
       
   604                                             const char *member,
       
   605                                             HbMessageBox::StandardButtons buttons,
       
   606                                             QGraphicsWidget *headWidget,
       
   607                                             QGraphicsScene *scene,
       
   608                                             QGraphicsItem *parent)
   460     This is a convenience function for showing an information dialog with a descriptive text and a default OK button.
   609     This is a convenience function for showing an information dialog with a descriptive text and a default OK button.
   461     \param informationText Descriptive text for the information dialog.
   610     \param informationText Descriptive text for the information dialog.
   462     \param receiver Which has the slot, which acts as a handler once the dialog closes.
   611     \param receiver Which has the slot, which acts as a handler once the dialog closes.
   463     \param member the slot, where the control will come, once the dialog is closed.
   612     \param member the slot, where the control will come, once the dialog is closed.
   464     \param headWidget This can used by the user to set a title widget. Null by default.
   613     \param headWidget This can used by the user to set a title widget. Null by default.
   483     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   632     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   484     messageBox->open(receiver,member);
   633     messageBox->open(receiver,member);
   485 }
   634 }
   486                                                                                               
   635                                                                                               
   487 /*!
   636 /*!
       
   637     \deprecated HbMessageBox::warning(const QString&,QObject*,const char*,QGraphicsWidget*,QGraphicsScene*,QGraphicsItem*)
       
   638         is deprecated.
       
   639 
       
   640     Please use 
       
   641     
       
   642     warning(const QString &questionText,
       
   643                                             QObject *receiver,
       
   644                                             const char *member,
       
   645                                             HbMessageBox::StandardButtons buttons,
       
   646                                             QGraphicsWidget *headWidget,
       
   647                                             QGraphicsScene *scene,
       
   648                                             QGraphicsItem *parent)
       
   649 
   488     This is a convenience function for showing a warning dialog with a descriptive text and an OK button.
   650     This is a convenience function for showing a warning dialog with a descriptive text and an OK button.
   489     \param warningText Descriptive text for the warning dialog.
   651     \param warningText Descriptive text for the warning dialog.
   490     \param receiver Which has the slot, which acts as a handler once the dialog closes.
   652     \param receiver Which has the slot, which acts as a handler once the dialog closes.
   491     \param member the slot, where the control will come, once the dialog is closed.
   653     \param member the slot, where the control will come, once the dialog is closed.
   492     \param headWidget This can used by the user to set a title widget, Null by default.
   654     \param headWidget This can used by the user to set a title widget, Null by default.
   509         messageBox->setHeadingWidget(headWidget);
   671         messageBox->setHeadingWidget(headWidget);
   510     }
   672     }
   511     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   673     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   512     messageBox->open(receiver,member);
   674     messageBox->open(receiver,member);
   513 }
   675 }
       
   676 
       
   677 /*!
       
   678     This is a convenience function for showing a question dialog with \a questionText and a default OK button.
       
   679     \param questionText descriptive text for the messagebox
       
   680     \param receiver Object which has the slot, which acts as a handler once the dialog closes.
       
   681     \param member the slot, where the control will come, once the dialog is closed.The signature of member is void dialogClosed(int val);
       
   682     \param buttons The action buttons of the dialog.
       
   683     \param headWidget the heading widget, where the user can set a title, Null by default.
       
   684     \param scene the scene for the MessageBox. Null by default.
       
   685     \param parent the parent widget. Null by default.
       
   686 */
       
   687 void HbMessageBox::question(const QString &questionText,
       
   688                                             QObject *receiver,
       
   689                                             const char *member,
       
   690                                             HbMessageBox::StandardButtons buttons,
       
   691                                             QGraphicsWidget *headingWidget,
       
   692                                             QGraphicsScene *scene,
       
   693                                             QGraphicsItem *parent)
       
   694 {    
       
   695     HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion, parent);
       
   696     if (scene && !parent) {
       
   697         scene->addItem(messageBox);
       
   698     }
       
   699     messageBox->setText(questionText);
       
   700 
       
   701     messageBox->setStandardButtons(buttons);   
       
   702     
       
   703     if(headingWidget) {
       
   704         messageBox->setHeadingWidget(headingWidget);
       
   705     }
       
   706     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
   707     messageBox->open(receiver,member);
       
   708 }
       
   709      
       
   710 /*!
       
   711     This is a convenience function for showing an information dialog with a descriptive text and a default OK button.
       
   712     \param informationText Descriptive text for the information dialog.
       
   713     \param receiver Which has the slot, which acts as a handler once the dialog closes.
       
   714     \param member the slot, where the control will come, once the dialog is closed.The signature of member is void dialogClosed(int val);
       
   715     \param buttons The action buttons of the dialog.
       
   716     \param headWidget This can used by the user to set a title widget. Null by default.
       
   717     \param scene the scene for the MessageBox, Null by default.
       
   718     \param parent the parent widget. Null by default
       
   719 */
       
   720 void HbMessageBox::information(const QString &informationText,
       
   721                                                QObject *receiver,
       
   722                                                const char *member,
       
   723                                                HbMessageBox::StandardButtons buttons,
       
   724                                                QGraphicsWidget *headingWidget,
       
   725                                                QGraphicsScene *scene,
       
   726                                                QGraphicsItem *parent)
       
   727 {
       
   728     HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation, parent);
       
   729     if (scene && !parent) {
       
   730         scene->addItem(messageBox);
       
   731     }
       
   732     messageBox->setText(informationText);
       
   733 
       
   734     messageBox->setStandardButtons(buttons);   
       
   735 
       
   736     if(headingWidget) {
       
   737         messageBox->setHeadingWidget(headingWidget);
       
   738     }
       
   739     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
   740     messageBox->open(receiver,member);
       
   741 }
       
   742                                                                                               
       
   743 /*!
       
   744     This is a convenience function for showing a warning dialog with a descriptive text and an OK button.
       
   745     \param warningText Descriptive text for the warning dialog.
       
   746     \param receiver Which has the slot, which acts as a handler once the dialog closes.
       
   747     \param member the slot, where the control will come, once the dialog is closed.The signature of member is void dialogClosed(int val);
       
   748     \param buttons The action buttons of the dialog.
       
   749     \param headWidget This can used by the user to set a title widget, Null by default.
       
   750     \param scene the scene for the messagebox, Null by default.
       
   751     \param parent the parent widget, Null by default.
       
   752 */
       
   753 void HbMessageBox::warning(const QString &warningText,
       
   754                                            QObject *receiver,
       
   755                                            const char *member,
       
   756                                            HbMessageBox::StandardButtons buttons,
       
   757                                            QGraphicsWidget *headingWidget,
       
   758                                            QGraphicsScene *scene,
       
   759                                            QGraphicsItem *parent)
       
   760 {
       
   761     HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning, parent);
       
   762     if (scene && !parent) {
       
   763         scene->addItem(messageBox);
       
   764     }
       
   765     messageBox->setText(warningText);
       
   766 
       
   767     messageBox->setStandardButtons(buttons);   
       
   768 
       
   769     if(headingWidget) {
       
   770         messageBox->setHeadingWidget(headingWidget);
       
   771     }
       
   772     messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
   773     messageBox->open(receiver,member);
       
   774 }
   514 #include "moc_hbmessagebox.cpp"
   775 #include "moc_hbmessagebox.cpp"
   515 #include "hbmessagebox.moc"
   776 #include "hbmessagebox.moc"
   516 
   777