src/hbwidgets/popups/hbmessagebox.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
    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 "hbmessagebox_p.h"
    26 #include "hbnamespace_p.h"
    27 #include "hbnamespace_p.h"
    27 #include <hbmessagebox.h>
    28 #include <hbmessagebox.h>
    28 #include "hbmessagebox_p.h"
       
    29 #include <hbstyleoptionmessagebox_p.h>
    29 #include <hbstyleoptionmessagebox_p.h>
    30 #include <hbmainwindow.h>
    30 #include <hbmainwindow.h>
    31 #include <hbaction.h>
    31 #include <hbaction.h>
    32 #include <hblineedit.h>
    32 #include <hblineedit.h>
    33 #include <hbscrollbar.h>
    33 #include <hbscrollbar.h>
    35 #include "hbglobal_p.h"
    35 #include "hbglobal_p.h"
    36 #include <QGraphicsItem>
    36 #include <QGraphicsItem>
    37 #include <QGraphicsSceneMouseEvent>
    37 #include <QGraphicsSceneMouseEvent>
    38 #include <QTimer>
    38 #include <QTimer>
    39 #include <QTextOption>
    39 #include <QTextOption>
       
    40 #ifdef Q_OS_SYMBIAN
       
    41 #include <systemtoneservice.h>
       
    42 #endif
    40 
    43 
    41 class HbStyle;
    44 class HbStyle;
    42 
    45 
    43 class HbMessageBoxEditor : public HbLineEdit
    46 class HbMessageBoxEditor : public HbLineEdit
    44 {
    47 {
    65     }
    68     }
    66 
    69 
    67     void setHtmlText(const QString &text)
    70     void setHtmlText(const QString &text)
    68     {
    71     {
    69         mText = text;
    72         mText = text;
    70         setHtml(text);
    73         if(Qt::mightBeRichText(mText)){
    71     }
    74             setHtml(text);
       
    75         }
       
    76         else {
       
    77              QString htmlString = Qt::convertFromPlainText(mText);
       
    78              setHtml(htmlString);
       
    79         }
       
    80      }
    72 
    81 
    73     QString htmlText() const
    82     QString htmlText() const
    74     {
    83     {
    75         return mText;
    84         return mText;
    76     }
    85     }
   151     case HbMessageBox::MessageTypeQuestion:
   160     case HbMessageBox::MessageTypeQuestion:
   152         break;
   161         break;
   153         
   162         
   154     }
   163     }
   155 
   164 
       
   165 }
       
   166 void HbMessageBoxPrivate::_q_appearEffectEnded(HbEffect::EffectStatus status)
       
   167 {
       
   168 #ifdef Q_OS_SYMBIAN 
       
   169 	
       
   170     	if ( (status.reason == Hb::EffectFinished) ||  ( (status.reason == Hb::EffectCancelled) && (!mStartEffect) ))  {
       
   171 	        CSystemToneService *pSystemTone = systemToneService();
       
   172 			if(!pSystemTone) {
       
   173 				return ;
       
   174 			}
       
   175 			switch(mMessageBoxType) {
       
   176     		case HbMessageBox::MessageTypeInformation:
       
   177     			pSystemTone->PlayTone(CSystemToneService::EInformationBeep); 
       
   178     			break;
       
   179     		case HbMessageBox::MessageTypeWarning:
       
   180     			pSystemTone->PlayTone(CSystemToneService::EWarningBeep); 
       
   181     			break;
       
   182     		case HbMessageBox::MessageTypeQuestion:
       
   183     			pSystemTone->PlayTone(CSystemToneService::EConfirmationBeep); 
       
   184         	break;
       
   185       	default:
       
   186       		break;        
       
   187     	}
       
   188 
       
   189 		}
       
   190 #else
       
   191 	Q_UNUSED(status);
       
   192 #endif // Q_OS_SYMBIAN
   156 }
   193 }
   157 
   194 
   158 /*!
   195 /*!
   159     @beta
   196     @beta
   160     
   197     
   344     }
   381     }
   345    
   382    
   346 }
   383 }
   347 
   384 
   348 /*!
   385 /*!
   349     Sets the descriptive text for the messagebox.
   386     Sets the descriptive text for the messagebox. It can be in plain text format or html format.
   350     \param text Descriptive text for the MessageBox
   387     \param text Descriptive text for the MessageBox
   351     \sa text()
   388     \sa text()
   352 */
   389 */
   353 void HbMessageBox::setText(const QString &text)
   390 void HbMessageBox::setText(const QString &text)
   354 {
   391 {