[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kmail
From: Matt Douhan <matt () fruitsalad ! org>
Date: 2004-12-31 18:49:58
Message-ID: 20041231184958.E75521A14E () office ! kde ! org
[Download RAW message or body]
CVS commit by mdouhan:
Refactor the validation code to utilise the isValidEmailAddress
Approved by: Till
M +7 -17 identitydialog.cpp 1.49
--- kdepim/kmail/identitydialog.cpp #1.48:1.49
@@ -80,4 +80,6 @@ using KMail::FolderRequester;
#include <algorithm>
+using namespace KPIM;
+
namespace KMail {
@@ -436,22 +438,10 @@ namespace KMail {
}
- void IdentityDialog::slotOk() {
+void IdentityDialog::slotOk() {
const QString email = mEmailEdit->text().stripWhiteSpace();
- int atCount = email.contains('@');
- if ( KPIM::getEmailAddr( email ).isEmpty() || atCount == 0 ) {
- KMessageBox::sorry( this, "<qt>"+
- i18n("Your email address is not valid because it "
- "does not contain a <emph>@</emph>: "
- "you will not create valid messages if you do not "
- "change your address.") + "</qt>",
- i18n("Invalid Email Address") );
- return;
- } else if ( atCount > 1 ) {
- KMessageBox::sorry( this, "<qt>" +
- i18n("Your email address is not valid because it "
- "contains more than one <emph>@</emph>: "
- "you will not create valid messages if you do not "
- "change your address.") + "</qt>",
- i18n("Invalid Email Address") );
+ emailParseResult errorCode = isValidEmailAddress( email );
+ if ( errorCode != AddressOk ) {
+ QString errorMsg( emailParseResultToString( errorCode ));
+ KMessageBox::sorry( this, errorMsg, i18n("Invalid Email Address") );
return;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic