src/hbwidgets/popups/hbinputdialog.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
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 
       
    27 #include <hbinputdialog.h>
    26 #include <hbinputdialog.h>
    28 #include "hbinputdialog_p.h"
    27 #include "hbinputdialog_p.h"
    29 #include "hbglobal_p.h"
    28 #include "hbglobal_p.h"
    30 #include <hblineedit.h>
    29 #include <hblineedit.h>
    31 #include <hbaction.h>
    30 #include <hbaction.h>
    32 #include "hbinputdialogcontent_p.h"
    31 #include "hbinputdialogcontent_p.h"
    33 #include <hbstyleoptioninputdialog.h>
    32 #include <hbstyleoptioninputdialog_p.h>
    34 #include <hbvalidator.h>
    33 #include <hbvalidator.h>
    35 
    34 
    36 #include <QGraphicsScene>
    35 #include <QGraphicsScene>
    37 
    36 
    38 #ifdef HBINPUTDIALOG_DEBUG
    37 #ifdef HBINPUTDIALOG_DEBUG
    43 /*!
    42 /*!
    44     @beta
    43     @beta
    45     @hbwidgets
    44     @hbwidgets
    46 
    45 
    47     \class HbInputDialog
    46     \class HbInputDialog
    48     \brief A class used to get information from the user.
    47     \brief HbInputDialog creates a modal dialog for the user to get some information in the form of text or numbers.
    49 
    48 
    50     the input value can be a text, int, double or ip address.
    49     Based on the \InputMode user can enter text, int, double or an IP address. InputDialog can have one or two line edit input fields.
       
    50 
       
    51     HbInputDialog by default will have a label to display a descriptive text for the line edit input field and,
       
    52         OK and Cancel buttons.
    51 
    53 
    52     example code example:
    54     example code example:
    53     \code
    55     \code
    54     HbInputDialog *object = new HbInputDialog(parent);
    56     HbInputDialog *object = new HbInputDialog(parent);
    55     object->show();
    57     object->show();
    56     \endcode
    58     \endcode
    57     
    59     
    58     Four static convenience API's are provided: getText(), getInteger(), getDouble(), and getIp()
    60     Four static convenience API's are provided: getText(), getInteger(), getDouble(), and getIp()
    59     static API's can be used to quickly get an input from user.
    61     static API's can be used to quickly get an input from user.
       
    62 
       
    63      \enum HbInputDialog::InputMode
       
    64 
       
    65     \value \b TextInput When this value is set as Input mode, input dialog accepts text input in its 
       
    66         correspoinding line edit field.
       
    67 
       
    68     \value \b IntInput When this value is set as Input mode, input dialog accepts Integer input in its 
       
    69         correspoinding line edit field.
       
    70 
       
    71     \value \b RealInput When this value is set as Input mode, input dialog accepts double or float input in its 
       
    72         correspoinding line edit field.
       
    73 
       
    74     \value \b IpInput When this value is set as Input mode, input dialog accepts Ip address as input in its 
       
    75         correspoinding line edit field.
       
    76 
    60  */
    77  */
    61 
    78 
    62 
    79 
    63 /*!
    80 /*!
    64     Constructor of HbInputDialog
    81     Constructor of HbInputDialog with a \a parent.
    65     \param parent. Parent widget
    82     \param parent. Parent widget
    66 */
    83 */
    67 HbInputDialog::HbInputDialog(QGraphicsItem* parent) :
    84 HbInputDialog::HbInputDialog(QGraphicsItem* parent) :
    68                                 HbDialog(*new HbInputDialogPrivate, parent)
    85                                 HbDialog(*new HbInputDialogPrivate, parent)
    69 {
    86 {
    87  */
   104  */
    88 HbInputDialog::~HbInputDialog()
   105 HbInputDialog::~HbInputDialog()
    89 {
   106 {
    90 }
   107 }
    91 
   108 
    92 
   109 /*!
    93 /*!
       
    94     @beta
       
    95     Sets the input mode of the primary(Top/default)line edit in the query widget.
   110     Sets the input mode of the primary(Top/default)line edit in the query widget.
       
   111 
       
   112     The default InputMode is TextInput
    96     
   113     
    97     \param mode. InputMode can be TextMode, IntMode, RealMode and Ip address mode.
   114     \param mode. InputMode can be TextMode, IntMode, RealMode and Ip address mode.
    98     each mode will affect how the line edit filters its input.
   115         each mode will affect how the line edit filters its input.
    99     
   116     
   100     \param row. value 0 or 1
   117     \param row. value 0 or 1
   101     
   118     
   102     \sa inputMode() 
   119     \sa inputMode() 
   103 */	
   120 */    
   104 void HbInputDialog::setInputMode(InputMode mode ,int row)
   121 void HbInputDialog::setInputMode(InputMode mode ,int row)
   105 {
   122 {
   106     Q_D(HbInputDialog);
   123     Q_D(HbInputDialog);
   107     d->setInputMode(mode,row);
   124     d->setInputMode(mode,row);
   108 }
   125 }
   109 
   126 
   110 
   127 /*!
   111 /*!
       
   112     @beta
       
   113     Returns input mode for top/default line edit.
   128     Returns input mode for top/default line edit.
       
   129 
   114     The default InputMode is TextInput
   130     The default InputMode is TextInput
       
   131 
   115     \param row. value 0 or 1
   132     \param row. value 0 or 1
   116 
   133 
   117     \sa setInputMode()
   134     \sa setInputMode()
   118 */
   135 */
   119 HbInputDialog::InputMode HbInputDialog::inputMode(int row) const
   136 HbInputDialog::InputMode HbInputDialog::inputMode(int row) const
   128             return (HbInputDialog::InputMode)0;
   145             return (HbInputDialog::InputMode)0;
   129         }
   146         }
   130     }
   147     }
   131 }
   148 }
   132 
   149 
   133 
   150 /*!
   134 /*!
       
   135     @beta
       
   136     Sets the prompt \a text for top/default line edit.
   151     Sets the prompt \a text for top/default line edit.
   137 
   152 
   138     \param text. user defined text
   153     \param text. Text for the label which describes the purpose of the corresponding input line edit field.
   139     \param row. value 0 or 1
   154     \param row. value 0 or 1
   140 
   155 
   141     \sa promtText()
   156     \sa promtText()
   142 */
   157 */
   143 void HbInputDialog::setPromptText(const QString &text, int row)
   158 void HbInputDialog::setPromptText(const QString &text, int row)
   144 {
   159 {
   145     Q_D(HbInputDialog);
   160     Q_D(HbInputDialog);
   146     d->setPromptText(text, row);
   161     d->setPromptText(text, row);
   147 }
   162 }
   148 
   163 
   149 
   164 /*!
   150 /*!
       
   151     @beta
       
   152     Returns prompt text for top/default line edit.
   165     Returns prompt text for top/default line edit.
   153     the default is null string.
   166     the default is null string.
   154     \param row. value 0 or 1
   167     \param row. value 0 or 1
   155 
   168 
   156     \sa setPromptText()
   169     \sa setPromptText()
   160     Q_D(const HbInputDialog);
   173     Q_D(const HbInputDialog);
   161     return d->promptText(row);
   174     return d->promptText(row);
   162 }
   175 }
   163 
   176 
   164 /*!
   177 /*!
   165     @beta
       
   166     Sets the top/default line edit value in \a text format.
   178     Sets the top/default line edit value in \a text format.
   167 
   179 
   168     \param value. user defined value
   180     \param value. user defined value for the default line edit.
   169     \param row. value 0 or 1
   181     \param row. value 0 or 1
   170 
   182 
   171     \sa value()
   183     \sa value()
   172 */
   184 */
   173 void HbInputDialog::setValue(const QVariant &value,int row)
   185 void HbInputDialog::setValue(const QVariant &value,int row)
   175     Q_D(HbInputDialog);
   187     Q_D(HbInputDialog);
   176     d->setText(value.toString(),row);
   188     d->setText(value.toString(),row);
   177 }
   189 }
   178 
   190 
   179 /*!
   191 /*!
   180     @beta
       
   181     Returns top/default line edit value as QVariant object.
   192     Returns top/default line edit value as QVariant object.
   182 
   193 
   183     \param row. value 0 or 1
   194     \param row. value 0 or 1
   184 
   195 
   185     \sa setValue()
   196     \sa setValue()
   189     Q_D(const HbInputDialog);
   200     Q_D(const HbInputDialog);
   190     return QVariant(d->text(row));
   201     return QVariant(d->text(row));
   191 }
   202 }
   192 
   203 
   193 /*!
   204 /*!
   194     @beta
       
   195     Sets the visibility of bottom line edit and prompt text.
   205     Sets the visibility of bottom line edit and prompt text.
   196 
   206 
   197     \param visible true or false.
   207     \param visible true or false.
   198 
   208 
   199     \sa isAdditionalRowVisible()
   209     \sa isAdditionalRowVisible()
   203     Q_D(HbInputDialog);
   213     Q_D(HbInputDialog);
   204     d->setAdditionalRowVisible(visible);
   214     d->setAdditionalRowVisible(visible);
   205 }
   215 }
   206 
   216 
   207 /*!
   217 /*!
   208     @beta
       
   209     Returns the visibility of secondary row(bottom line edit and prompt text).
   218     Returns the visibility of secondary row(bottom line edit and prompt text).
   210     the default is false
   219     the default is false
   211     \sa setAdditionalRowVisible()
   220     \sa setAdditionalRowVisible()
   212 */
   221 */
   213 bool HbInputDialog::isAdditionalRowVisible()
   222 bool HbInputDialog::isAdditionalRowVisible()
   214 {
   223 {
   215     Q_D(HbInputDialog);
   224     Q_D(HbInputDialog);
   216     return d->isAdditionalRowVisible();
   225     return d->isAdditionalRowVisible();
   217 }
   226 }
   218 
   227 
   219 
   228 /*!
   220 /*!
       
   221     @beta
       
   222     Validator is used to validate the content and cursor movements.
   229     Validator is used to validate the content and cursor movements.
   223 
   230 
   224     \param validator. Validator uses undo stack to back out invalid changes. Therefore undo
   231     \param validator. Validator uses undo stack to back out invalid changes. Therefore undo
   225     is enabled when validator is set.
   232     is enabled when validator is set.
   226 
   233 
   234     } else if( (row == 1) && (d->mContentWidget->mEdit2) ) {
   241     } else if( (row == 1) && (d->mContentWidget->mEdit2) ) {
   235         d->mContentWidget->mEdit2->setValidator(validator);
   242         d->mContentWidget->mEdit2->setValidator(validator);
   236     }
   243     }
   237 }
   244 }
   238 
   245 
   239 
   246 /*!
   240 /*!
   247     Returns the validator of the inputDialog's line edit.
   241     @beta
       
   242     returns the validator of the inputDialog's line edit.
       
   243 
   248 
   244     \param row. A value 0 or 1
   249     \param row. A value 0 or 1
   245 
   250 
   246     \sa setValidator()
   251     \sa setValidator()
   247 */
   252 */
   254         return d->mContentWidget->mEdit2->validator();
   259         return d->mContentWidget->mEdit2->validator();
   255     }
   260     }
   256     return NULL;
   261     return NULL;
   257 }
   262 }
   258 
   263 
   259 
   264 /*!
   260 /*!
       
   261     @beta
       
   262     returns the lineEdit pointer. will return NULL if row is greater than 2.
   265     returns the lineEdit pointer. will return NULL if row is greater than 2.
   263 
   266 
   264     \param row. A value 0 or 1
   267     \param row. A value 0 or 1
   265 */
   268 */
   266 HbLineEdit* HbInputDialog::lineEdit(int row) const
   269 HbLineEdit* HbInputDialog::lineEdit(int row) const
   273     }
   276     }
   274     return NULL;
   277     return NULL;
   275 }
   278 }
   276 
   279 
   277 /*!
   280 /*!
   278     @beta
       
   279     sets the echo mode for the given row.
   281     sets the echo mode for the given row.
   280 
   282 
   281     \param echoMode
   283     \param echoMode
   282     \param row. A value 0 or 1
   284     \param row. A value 0 or 1
   283 
   285 
   294         }
   296         }
   295         d->mEchoMode = echoMode;
   297         d->mEchoMode = echoMode;
   296     }
   298     }
   297 };
   299 };
   298 
   300 
   299 
   301 /*!
   300 /*!
       
   301 
       
   302     \deprecated HbInputDialog::primitive(HbStyle::Primitive)
   302     \deprecated HbInputDialog::primitive(HbStyle::Primitive)
   303         is deprecated.
   303         is deprecated.
   304     
   304     
   305     Provides access to primitives of HbInputDialog. 
   305     Provides access to primitives of HbInputDialog. 
   306     \param primitive is the type of the requested primitive. The available 
   306     \param primitive is the type of the requested primitive. The available 
   319         return 0;
   319         return 0;
   320     }
   320     }
   321 }
   321 }
   322 
   322 
   323 /*!
   323 /*!
   324     @beta
       
   325     \reimp
   324     \reimp
   326     Initializes \a option with the values from this HbInputDialog.
   325     Initializes \a option with the values from this HbInputDialog.
   327 */
   326 */
   328 void HbInputDialog::initStyleOption(HbStyleOptionInputDialog *option) const
   327 void HbInputDialog::initStyleOption(HbStyleOptionInputDialog *option) const
   329 {
   328 {
   331     HbDialog::initStyleOption(option);
   330     HbDialog::initStyleOption(option);
   332     option->text = d->mPromptText;
   331     option->text = d->mPromptText;
   333     option->additionalText = d->mPromptAdditionalText;
   332     option->additionalText = d->mPromptAdditionalText;
   334 }
   333 }
   335 
   334 
   336 
   335 /*!
   337 /*!
   336     \reimp
   338     @beta
       
   339     updatePrimitives.
   337     updatePrimitives.
   340 */
   338 */
   341 void HbInputDialog::updatePrimitives()
   339 void HbInputDialog::updatePrimitives()
   342 {
   340 {
   343     Q_D(HbInputDialog); 
   341     Q_D(HbInputDialog); 
   351     if (d->mContentWidget->mLabel2 && d->mContentWidget->mAdditionalRowVisible) {
   349     if (d->mContentWidget->mLabel2 && d->mContentWidget->mAdditionalRowVisible) {
   352         style()->updatePrimitive(d->mContentWidget->mLabel2, HbStyle::P_InputDialog_additionaltext, &option);
   350         style()->updatePrimitive(d->mContentWidget->mLabel2, HbStyle::P_InputDialog_additionaltext, &option);
   353     }
   351     }
   354 }
   352 }
   355 
   353 
   356 
   354 /*!
   357 /*!
   355     Returns the echoMode of line edit. returns -1 if row is more than 2.
   358     @beta
       
   359     returns the echoMode of line edit. returns -1 if row is more than 2.
       
   360 
   356 
   361     \param row. A value 0 or 1
   357     \param row. A value 0 or 1
   362 
   358 
   363     \sa setEchoMode()
   359     \sa setEchoMode()
   364   */
   360   */
   371         return d->mEchoMode;
   367         return d->mEchoMode;
   372     }
   368     }
   373     return HbLineEdit::EchoMode(-1);//
   369     return HbLineEdit::EchoMode(-1);//
   374 }
   370 }
   375 
   371 
   376 
   372 /*!
   377 /*!
   373     Static convenience function for creating an input dialog to get a string from the user. 
   378     @beta
   374     \a label is the text which is shown to the user (it should
   379     Static convenience function to get a string from the user. \a
       
   380     label is the text which is shown to the user (it should
       
   381     say what should be entered). \a text is the default text which is
   375     say what should be entered). \a text is the default text which is
   382     placed in the line edit. If \a ok is non-null \e *\a ok will be 
   376     placed in the line edit. If \a ok is non-null \e *\a ok will be 
   383     set to true if the user pressed \gui OK and to false if the user pressed
   377     set to true if the user pressed \gui OK and to false if the user pressed
   384     \gui Cancel. The dialog's parent is \a parent. The dialog will be
   378     \gui Cancel. The dialog's parent is \a parent. The dialog will be
   385     modal.
   379     modal.
   399     if (scene && !parent) {
   393     if (scene && !parent) {
   400         scene->addItem(dlg);
   394         scene->addItem(dlg);
   401     }
   395     }
   402     dlg->setPromptText(label);
   396     dlg->setPromptText(label);
   403     dlg->setInputMode(TextInput);
   397     dlg->setInputMode(TextInput);
   404     dlg->setValue(text);	
   398     dlg->setValue(text);    
   405     dlg->setAttribute(Qt::WA_DeleteOnClose);
   399     dlg->setAttribute(Qt::WA_DeleteOnClose);
   406     dlg->open(receiver,member);
   400     dlg->open(receiver,member);
   407 }
   401 }
   408 
   402 
   409 /*!
   403 
   410     \deprecated HbInputDialog::getText(const QString&,const QString&,bool*,QGraphicsScene*,QGraphicsItem*)
   404 /*!
   411         is deprecated. Please use the other available getText API.
       
   412 
       
   413     Static convenience function to get a string from the user. \a
       
   414     label is the text which is shown to the user (it should
       
   415     say what should be entered). \a text is the default text which is
       
   416     placed in the line edit. If \a ok is non-null \e *\a ok will be 
       
   417     set to true if the user pressed \gui OK and to false if the user pressed
       
   418     \gui Cancel. The dialog's parent is \a parent. The dialog will be
       
   419     modal.
       
   420 
       
   421     This function returns the text which has been entered in the line
       
   422     edit. It will not return an empty string.
       
   423 
       
   424     \sa getInteger(), getDouble(), getIp()
       
   425 */
       
   426 QString HbInputDialog::getText(const QString &label,const QString &text,
       
   427                                 bool *ok, QGraphicsScene *scene, QGraphicsItem *parent)
       
   428 {
       
   429     HB_DEPRECATED("HbInputDialog::getText is deprecated. Please use HbInputDialog::getText((const QString&, QObject*, const char*, const QString&, QGraphicsScene*, QGraphicsItem*) instead.");
       
   430     Q_UNUSED(parent);//this is a bug in popup framework, cannot set parent will affect fading
       
   431 
       
   432     HbInputDialog *dlg = new HbInputDialog();
       
   433     if (scene) {
       
   434         scene->addItem(dlg);
       
   435     }
       
   436     QString result;
       
   437     dlg->setPromptText(label);
       
   438     dlg->setInputMode(TextInput);
       
   439     dlg->setValue(text);	
       
   440     HbAction* action = dlg->exec();
       
   441     if(action == dlg->secondaryAction()) { //Cancel was pressed
       
   442         if(ok) {
       
   443 			*ok = false;
       
   444         }
       
   445     } else { //OK was pressed
       
   446         if(ok) {
       
   447 			*ok = true;
       
   448         }
       
   449         result = dlg->value().toString();
       
   450     }
       
   451     delete dlg;
       
   452     return result;	
       
   453 }
       
   454 
       
   455 
       
   456 /*!
       
   457     @beta
       
   458     Static convenience function to get an integer input from the
   405     Static convenience function to get an integer input from the
   459     user.\a label is the text which is shown to the user
   406     user.\a label is the text which is shown to the user
   460     (it should say what should be entered). \a value is the default
   407     (it should say what should be entered). \a value is the default
   461     integer which the spinbox will be set to.  
   408     integer which the spinbox will be set to.  
   462     If \a ok is non-null *\a ok will be set to true if the user
   409     If \a ok is non-null *\a ok will be set to true if the user
   483     dlg->setValue(QString::number(value));
   430     dlg->setValue(QString::number(value));
   484     dlg->setAttribute(Qt::WA_DeleteOnClose);
   431     dlg->setAttribute(Qt::WA_DeleteOnClose);
   485     dlg->open(receiver,member);
   432     dlg->open(receiver,member);
   486 }
   433 }
   487 /*!
   434 /*!
   488      \deprecated HbInputDialog::getInteger(const QString&,int,bool*,QGraphicsScene*,QGraphicsItem*)
       
   489         is deprecated. Please use the other available HbInputDialog::getInteger API.
       
   490 
       
   491     Static convenience function to get an integer input from the
       
   492     user.\a label is the text which is shown to the user
       
   493     (it should say what should be entered). \a value is the default
       
   494     integer which the spinbox will be set to.  
       
   495     If \a ok is non-null *\a ok will be set to true if the user
       
   496     pressed \gui OK and to false if the user pressed \gui Cancel. The
       
   497     dialog's parent is \a parent. The dialog will be modal.
       
   498 
       
   499     This function returns the integer which has been entered by the user.
       
   500 
       
   501     \sa getText(), getDouble(), getIp()
       
   502 */
       
   503 int HbInputDialog::getInteger(const QString &label, int value,
       
   504                             bool *ok,QGraphicsScene *scene,QGraphicsItem *parent)
       
   505 {
       
   506     HB_DEPRECATED("HbInputDialog::getInteger is deprecated. Please use HbInputDialog::getInteger(const QString&, QObject*, const char*,int,QGraphicsScene*,QGraphicsItem *) instead.");
       
   507 
       
   508     Q_UNUSED(parent)
       
   509 
       
   510     HbInputDialog *dlg = new HbInputDialog();
       
   511     QString result;
       
   512     dlg->setPromptText(label);
       
   513     dlg->setInputMode(IntInput);
       
   514     dlg->setValue(QString::number(value));
       
   515     if(scene) {
       
   516         scene->addItem(dlg);
       
   517     }
       
   518     HbAction* action = dlg->exec();
       
   519     if(action == dlg->secondaryAction()) { //Cancel was pressed
       
   520         if(ok) {
       
   521             *ok = false;
       
   522         }
       
   523     } else { //OK was pressed
       
   524         if(ok) {
       
   525 			*ok = true;
       
   526         }
       
   527 	    result = dlg->value().toString();
       
   528     }
       
   529     delete dlg;
       
   530 #ifdef HBINPUTDIALOG_DEBUG
       
   531     qDebug()<<"Value:"<<result;
       
   532 #endif
       
   533     return result.toInt();
       
   534 }
       
   535 
       
   536 
       
   537 /*!
       
   538     Static convenience function to get a floating point number from
   435     Static convenience function to get a floating point number from
   539     the user.\a label is the text which is shown to the user
   436     the user.\a label is the text which is shown to the user
   540     (it should say what should be entered). \a value is the default
   437     (it should say what should be entered). \a value is the default
   541     floating point number that the line edit will be set to.
   438     floating point number that the line edit will be set to.
   542 
   439 
   555                                 QGraphicsScene *scene, 
   452                                 QGraphicsScene *scene, 
   556                                 QGraphicsItem *parent)
   453                                 QGraphicsItem *parent)
   557 {
   454 {
   558     HbInputDialog *dlg = new HbInputDialog(parent);
   455     HbInputDialog *dlg = new HbInputDialog(parent);
   559     if(scene && !parent) {
   456     if(scene && !parent) {
   560         scene->addItem(dlg);	
   457         scene->addItem(dlg);    
   561     }
   458     }
   562     dlg->setPromptText(label);
   459     dlg->setPromptText(label);
   563     dlg->setInputMode(RealInput);
   460     dlg->setInputMode(RealInput);
   564     dlg->setValue(QString::number(value));
   461     dlg->setValue(QString::number(value));
   565     dlg->open(receiver,member);
   462     dlg->open(receiver,member);
   566 }
   463 }
   567 
   464 
   568 
   465 
   569 /*!
   466 /*!
   570     \deprecated HbInputDialog::getDouble(const QString &,double,bool*,QGraphicsScene*,QGraphicsItem*)
   467     Static convenience function to get an ip address from
   571         is deprecated. Please use the other available HbInputDialog::getDouble(...) API.
       
   572 
       
   573     Static convenience function to get a floating point number from
       
   574     the user.\a label is the text which is shown to the user
       
   575     (it should say what should be entered). \a value is the default
       
   576     floating point number that the line edit will be set to.
       
   577 
       
   578     If \a ok is non-null, *\a ok will be set to true if the user
       
   579     pressed \gui OK and to false if the user pressed \gui Cancel. The
       
   580     dialog's parent is \a parent. The dialog will be modal.
       
   581 
       
   582     This function returns the floating point number which has been
       
   583     entered by the user.
       
   584 
       
   585     \sa getText(), getInteger(), getIp()
       
   586 */
       
   587 double HbInputDialog::getDouble(const QString &label, double value, 
       
   588                                 bool *ok, QGraphicsScene *scene, QGraphicsItem *parent)
       
   589 {
       
   590     HB_DEPRECATED("HbInputDialog::getDouble is deprecated.Please use HbInputDialog::getDouble(const QString&, QObject*,const char*,double, QGraphicsItem*) instead.");
       
   591 
       
   592     Q_UNUSED(parent)
       
   593 
       
   594     HbInputDialog *dlg = new HbInputDialog();
       
   595     QString result;
       
   596     dlg->setPromptText(label);
       
   597     dlg->setInputMode(RealInput);
       
   598     dlg->setValue(QString::number(value));
       
   599     if(scene) {
       
   600         scene->addItem(dlg);	
       
   601     }
       
   602     HbAction* action = dlg->exec();
       
   603     if(action == dlg->secondaryAction()){ //Cancel was pressed
       
   604         if(ok) {
       
   605 			*ok = false;
       
   606         }
       
   607     } else { //OK was pressed
       
   608         if(ok) {
       
   609             *ok = true;
       
   610         }
       
   611         result = dlg->value().toString();
       
   612     }
       
   613     delete dlg;
       
   614 #ifdef HBINPUTDIALOG_DEBUG
       
   615     qDebug()<<"Value:"<<result;
       
   616 #endif
       
   617     return result.toDouble();
       
   618 }
       
   619 
       
   620 /*!
       
   621     @beta
       
   622     Static convenience function to get a ip address from
       
   623     the user.\a label is the text which is shown to the user
   468     the user.\a label is the text which is shown to the user
   624     (it should say what should be entered). \a address is the default
   469     (it should say what should be entered). \a address is the default
   625     QHostAddress that the line edit will be set to.
   470     QHostAddress that the line edit will be set to.
   626 
   471 
   627     If \a ok is non-null, *\a ok will be set to true if the user
   472     If \a ok is non-null, *\a ok will be set to true if the user
   639                             QGraphicsScene *scene, 
   484                             QGraphicsScene *scene, 
   640                             QGraphicsItem *parent)
   485                             QGraphicsItem *parent)
   641 {
   486 {
   642     HbInputDialog *dlg = new HbInputDialog(parent);
   487     HbInputDialog *dlg = new HbInputDialog(parent);
   643     if(scene && !parent) {
   488     if(scene && !parent) {
   644         scene->addItem(dlg);	
   489         scene->addItem(dlg);    
   645     }
   490     }
   646     dlg->setPromptText(label);
   491     dlg->setPromptText(label);
   647     dlg->setInputMode(IpInput);
   492 	dlg->setValue(ipaddress);
   648     dlg->setValue(ipaddress);
   493     dlg->setInputMode(IpInput);    
   649     dlg->open(receiver,member);
   494     dlg->open(receiver,member);
   650 }
   495 }
   651 
   496 
   652 
       
   653 /*!
       
   654     \deprecated HbInputDialog::getIp(const QString &,const QString&, bool *,QGraphicsScene*,QGraphicsItem*)
       
   655         is deprecated. Please use the other available HbInputDialog::getIp API.
       
   656 
       
   657     Static convenience function to get a ip address from
       
   658     the user.\a label is the text which is shown to the user
       
   659     (it should say what should be entered). \a address is the default
       
   660     QHostAddress that the line edit will be set to.
       
   661 
       
   662     If \a ok is non-null, *\a ok will be set to true if the user
       
   663     pressed \gui OK and to false if the user pressed \gui Cancel. The
       
   664     dialog's parent is \a parent. The dialog will be modal.
       
   665 
       
   666     This function returns the ip address number which has been
       
   667     entered by the user.
       
   668 
       
   669     \sa getText(), getInteger(), getDouble()
       
   670 */
       
   671 QString HbInputDialog::getIp(const QString &label, const QString &ipaddress, bool *ok, QGraphicsScene *scene, 
       
   672                                     QGraphicsItem *parent)
       
   673 {
       
   674     HB_DEPRECATED("HbInputDialog::getIp is deprecated. Please use HbInputDialog::getIp(const QString &,QObject *,const char *,const QString &, QGraphicsScene *, QGraphicsItem *)");
       
   675 
       
   676     Q_UNUSED(parent)
       
   677 
       
   678     HbInputDialog *dlg = new HbInputDialog();
       
   679     QString result;
       
   680     dlg->setPromptText(label);
       
   681     dlg->setInputMode(IpInput);
       
   682     dlg->setValue(ipaddress);
       
   683     if(scene) {
       
   684         scene->addItem(dlg);	
       
   685     }
       
   686     HbAction* action = dlg->exec();
       
   687     if(action == dlg->secondaryAction()){ //Cancel was pressed
       
   688         if(ok) {
       
   689             *ok = false;
       
   690         }
       
   691     } else { //OK was pressed
       
   692         if(ok) {
       
   693             *ok = true;
       
   694         }
       
   695         result = dlg->value().toString();
       
   696     }
       
   697     delete dlg;
       
   698 #ifdef HBINPUTDIALOG_DEBUG
       
   699     qDebug()<<"Value:"<<result;
       
   700 #endif
       
   701     return result;
       
   702 }
       
   703 #include "moc_hbinputdialog.cpp"
   497 #include "moc_hbinputdialog.cpp"
   704