src/hbwidgets/popups/hbinputdialog_p.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbwidgets/popups/hbinputdialog_p.cpp	Wed Jun 23 18:33:25 2010 +0300
+++ b/src/hbwidgets/popups/hbinputdialog_p.cpp	Tue Jul 06 14:36:53 2010 +0300
@@ -107,7 +107,6 @@
 {
 }
 
-
 void HbInputDialogPrivate::init()
 {
 #ifdef HBINPUTDIALOG_DEBUG
@@ -171,12 +170,10 @@
         {
             //set the validator
             if(mValid) {
-                // NOTE:This validation is for readability. mValid is being deleted 
-                // when setValidator is called on editor.
-                mValid = 0;
+                delete mValid;
             }
-            mValid = new HbValidator();
-            QValidator *intValidator = new QIntValidator(q);
+            mValid = new HbValidator(q);
+            QValidator *intValidator = new QIntValidator;
             mValid->addField(intValidator, "0");
             pEdit->setValidator(mValid);
 
@@ -188,11 +185,11 @@
         {
             //set the validator
             if(mValid) {
-                mValid = 0;
+                delete mValid;
             }
 
-            mValid = new HbValidator();
-            QValidator *doubleValidator = new QDoubleValidator(q);
+            mValid = new HbValidator(q);
+            QValidator *doubleValidator = new QDoubleValidator(mValid);
             mValid->addField(doubleValidator, "0");
             pEdit->setValidator(mValid);
 
@@ -203,9 +200,12 @@
     case HbInputDialog::IpInput:
         {
             QString text = pEdit->text();
-            mValid = new HbValidator;
+            if(mValid){
+                delete mValid;
+            }
+            mValid = new HbValidator(q);
             mValid->setDefaultSeparator(".");
-            QStringList list = text.split(".");
+            QStringList list = text.split('.');
             if (list.count() != 4 ) {
                     mValid->setDefaultSeparator(".");
                     mValid->addField(new QIntValidator(0, 255, 0), "127");