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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/wlm
From:       Roman Jarosz <kedgedev () gmail ! com>
Date:       2009-06-17 20:29:26
Message-ID: 1245270566.288504.12604.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 983252 by rjarosz:

Strip whitespace from passport.
Use the same validation as libmsn so we show user error dialog instead of crash \
dialog :)

BUG: 192846 



 M  +2 -2      ui/wlmaddcontactpage.cpp  
 M  +2 -2      ui/wlmeditaccountwidget.cpp  
 M  +2 -1      wlmprotocol.cpp  


--- trunk/KDE/kdenetwork/kopete/protocols/wlm/ui/wlmaddcontactpage.cpp #983251:983252
@@ -46,14 +46,14 @@
 bool
 WlmAddContactPage::apply (Kopete::Account *account, Kopete::MetaContact * \
metaContact)  {
-   QString contactId = m_wlmAddUI->m_uniqueName->text();
+   QString contactId = m_wlmAddUI->m_uniqueName->text().trimmed();
    return account->addContact( contactId, metaContact, Kopete::Account::ChangeKABC \
);  }
 
 bool
 WlmAddContactPage::validateData ()
 {
-    QString contactId = m_wlmAddUI->m_uniqueName->text();
+    QString contactId = m_wlmAddUI->m_uniqueName->text().trimmed();
     if (WlmProtocol::validContactId(contactId))
         return true;
 
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/ui/wlmeditaccountwidget.cpp \
#983251:983252 @@ -119,7 +119,7 @@
 Kopete::Account * WlmEditAccountWidget::apply ()
 {
     if ( !account() )
-        setAccount( new WlmAccount( WlmProtocol::protocol (), \
m_preferencesWidget->m_passport->text () ) ); +        setAccount( new WlmAccount( \
WlmProtocol::protocol(), m_preferencesWidget->m_passport->text().trimmed() ) );  
     KConfigGroup *config = account()->configGroup();
     WlmAccount* wlmAccount = static_cast<WlmAccount*>(account());
@@ -167,7 +167,7 @@
 
 bool WlmEditAccountWidget::validateData ()
 {
-    QString contactId = m_preferencesWidget->m_passport->text();
+    QString contactId = m_preferencesWidget->m_passport->text().trimmed();
     if ( WlmProtocol::validContactId( contactId ) )
         return true;
 
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmprotocol.cpp #983251:983252
@@ -151,7 +151,8 @@
 
 bool WlmProtocol::validContactId (const QString& contactId)
 {
-    return( contactId.count("@") == 1 && contactId.count(".") >= 1 );
+    QRegExp rx("[^@\\s]+@([^@\\.\\s]+\\.)+[^@\\.\\s]+");
+    return ( rx.exactMatch( contactId ) );
 }
 
 #include "wlmprotocol.moc"


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

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