ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp
changeset 58 383b67fbdb11
parent 40 112f0ac2d1f0
child 62 36d93b4dc635
--- a/ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp	Fri Aug 06 20:44:25 2010 +0530
+++ b/ui/commandhandlers/commoncommandhandlers/src/glxcommondialogs.cpp	Mon Aug 23 18:06:16 2010 +0530
@@ -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;