ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp
changeset 61 743eb0b9959e
parent 29 2c833fc9e98f
child 62 36d93b4dc635
--- a/ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp	Wed Aug 18 09:48:53 2010 +0300
+++ b/ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp	Thu Sep 02 20:26:45 2010 +0300
@@ -20,10 +20,11 @@
 #include <hbaction.h>
 #include <QEventLoop>
 
-GlxTextInputDialog::GlxTextInputDialog() 
+GlxTextInputDialog::GlxTextInputDialog(bool disableOkForEmptyText) 
     : mDialog ( NULL ),
       mEventLoop ( 0 ),
-      mResult ( false )
+      mResult ( false ),
+      mDisableOkForEmptyText(disableOkForEmptyText)
 {
 }
 
@@ -41,9 +42,10 @@
     mDialog->setPromptText(label);
     mDialog->setInputMode(HbInputDialog::TextInput);
     mDialog->setValue(text);
-    connect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
-            this, SLOT( textChanged (const QString &)));
-    
+    if(mDisableOkForEmptyText){
+        connect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
+                this, SLOT( textChanged (const QString &)));
+    }
     mDialog->open( this, SLOT( dialogClosed( HbAction* ) ) ); 
     eventLoop.exec( );
     mEventLoop = 0 ;
@@ -55,9 +57,10 @@
     if ( mResult ) {
         retText = mDialog->value().toString().trimmed();
     }
-    
-    disconnect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
-                this, SLOT( textChanged (const QString &)));
+    if(mDisableOkForEmptyText){
+        disconnect(mDialog->lineEdit(0), SIGNAL( textChanged (const QString &) ),
+                    this, SLOT( textChanged (const QString &)));
+    }
     delete mDialog;
     mDialog = NULL;
     return retText;