[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim] patch for KABC email storage
From:       Matt Douhan <matt () fruitsalad ! org>
Date:       2005-03-25 12:59:05
Message-ID: 200503251359.05998.matt () fruitsalad ! org
[Download RAW message or body]

Hello

Currently the email storage in kabc allows for email addresses in the form of 
m@@@@@@@t@@@@@@@@jongel.c@m

I added the simple validator from libemailfunctions to the email address 
editor widget locally and that fixes the issue instantly.

But for the life of me I cannot figure out how to validate the LineEdit if the 
user does not click the "edit email addresses" button, the same validation 
should happen when the user clicks ok or apply in the main dialog.

Comments and advice as always highly appreciated

rgds

Matt

-- 
Matt Douhan
www.fruitsalad.org
kolab2 + kontact + toltec == success
Now lets get Horde into shape mmkay

["patch_kaddressbook_emaileditwidget_cpp" (text/x-diff)]

Index: emaileditwidget.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/emaileditwidget.cpp,v
retrieving revision 1.28
diff -u -3 -p -r1.28 emaileditwidget.cpp
--- emaileditwidget.cpp	31 Jan 2005 21:40:26 -0000	1.28
+++ emaileditwidget.cpp	25 Mar 2005 09:45:05 -0000
@@ -41,6 +41,7 @@
 #include <klineedit.h>
 #include <klocale.h>
 #include <kmessagebox.h>
+#include <libemailfunctions/email.h>
 
 #include "emaileditwidget.h"
 
@@ -257,6 +258,15 @@ void EmailEditDialog::add()
                                          QString::null, &ok, this, "EmailEditDialog",
                                          validator );
 
+  // Validate email address
+  if ( !email.isEmpty() ) {
+    if ( !KPIM::isValidSimpleEmailAddress( email )) {
+      QString errorMsg( KPIM::simpleEmailAddressErrorMsg());
+      KMessageBox::sorry( this, errorMsg, i18n("Invalid Email Address") );
+      return;
+    }
+  }
+
   if ( !ok )
     return;
 
@@ -282,6 +292,16 @@ void EmailEditDialog::edit()
                                          mEmailListBox->text( editPos ), &ok, this,
                                          "EmailEditDialog", validator );
 
+
+  // Validate email address
+  if ( !email.isEmpty() ) {
+    if ( !KPIM::isValidSimpleEmailAddress( email )) {
+      QString errorMsg( KPIM::simpleEmailAddressErrorMsg());
+      KMessageBox::sorry( this, errorMsg, i18n("Invalid Email Address") );
+      return;
+    }
+  }
+
   if ( !ok )
     return;
 


_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic