ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp
changeset 58 383b67fbdb11
parent 40 112f0ac2d1f0
child 62 36d93b4dc635
equal deleted inserted replaced
54:0f0f3f26f787 58:383b67fbdb11
    18 #include <glxcommondialogs.h>
    18 #include <glxcommondialogs.h>
    19 
    19 
    20 #include <hbaction.h>
    20 #include <hbaction.h>
    21 #include <QEventLoop>
    21 #include <QEventLoop>
    22 
    22 
    23 GlxTextInputDialog::GlxTextInputDialog() 
    23 GlxTextInputDialog::GlxTextInputDialog(bool disableOkForEmptyText) 
    24     : mDialog ( NULL ),
    24     : mDialog ( NULL ),
    25       mEventLoop ( 0 ),
    25       mEventLoop ( 0 ),
    26       mResult ( false )
    26       mResult ( false ),
       
    27       mDisableOkForEmptyText(disableOkForEmptyText)
    27 {
    28 {
    28 }
    29 }
    29 
    30 
    30 GlxTextInputDialog::~GlxTextInputDialog()
    31 GlxTextInputDialog::~GlxTextInputDialog()
    31 {
    32 {
    39     
    40     
    40     mDialog = new HbInputDialog();
    41     mDialog = new HbInputDialog();
    41     mDialog->setPromptText(label);
    42     mDialog->setPromptText(label);
    42     mDialog->setInputMode(HbInputDialog::TextInput);
    43     mDialog->setInputMode(HbInputDialog::TextInput);
    43     mDialog->setValue(text);
    44     mDialog->setValue(text);
    44     connect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
    45     if(mDisableOkForEmptyText){
    45             this, SLOT( textChanged (const QString &)));
    46         connect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
    46     
    47                 this, SLOT( textChanged (const QString &)));
       
    48     }
    47     mDialog->open( this, SLOT( dialogClosed( HbAction* ) ) ); 
    49     mDialog->open( this, SLOT( dialogClosed( HbAction* ) ) ); 
    48     eventLoop.exec( );
    50     eventLoop.exec( );
    49     mEventLoop = 0 ;
    51     mEventLoop = 0 ;
    50     
    52     
    51     if ( ok ) {
    53     if ( ok ) {
    53     }
    55     }
    54     QString retText = NULL;
    56     QString retText = NULL;
    55     if ( mResult ) {
    57     if ( mResult ) {
    56         retText = mDialog->value().toString().trimmed();
    58         retText = mDialog->value().toString().trimmed();
    57     }
    59     }
    58     
    60     if(mDisableOkForEmptyText){
    59     disconnect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
    61         disconnect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
    60                 this, SLOT( textChanged (const QString &)));
    62                     this, SLOT( textChanged (const QString &)));
       
    63     }
    61     delete mDialog;
    64     delete mDialog;
    62     mDialog = NULL;
    65     mDialog = NULL;
    63     return retText;
    66     return retText;
    64 }
    67 }
    65 
    68