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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/libkdepim
From:       Allen Winter <winter () kde ! org>
Date:       2010-06-02 16:38:47
Message-ID: 20100602163847.82F81AC8C8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1133844 by winterz:

handle drops of plain old email addresses, perhaps separated by a comma.
kolab/issue3411
MERGE: trunk,4.4


 M  +23 -2     addresseelineedit.cpp  


--- branches/kdepim/enterprise/kdepim/libkdepim/addresseelineedit.cpp #1133843:1133844
@@ -357,8 +357,8 @@
 void AddresseeLineEdit::dropEvent( QDropEvent *e )
 {
   KURL::List uriList;
-  if ( !isReadOnly()
-       && KURLDrag::canDecode(e) && KURLDrag::decode( e, uriList ) ) {
+  if ( !isReadOnly() ) {
+    if ( KURLDrag::canDecode(e) && KURLDrag::decode( e, uriList ) ) {
     QString contents = text();
     // remove trailing white space and comma
     int eot = contents.length();
@@ -387,7 +387,28 @@
       setEdited( true );
       return;
     }
+    } else {
+      // Let's see if this drop contains a comma separated list of emails
+      QStringList addrs = splitEmailAddrList( QString::fromUtf8( e->encodedData( "text/plain" ) ) );
+      if ( addrs.count() > 0 ) {
+        QStringList::ConstIterator it;
+        QStringList emails;
+        for ( it = addrs.begin(); it != addrs.end(); ++it ) {
+          QString name, mail;
+          if ( getNameAndMail( (*it), name, mail ) ) {
+            emails.append( mail );
+          } else {
+            continue;
   }
+        }
+        if ( emails.count() > 0 ) {
+          setText( emails.join( "," ) );
+          setEdited( true );
+          return;
+        }
+      }
+    }
+  }
 
   if ( m_useCompletion )
     m_smartPaste = true;
[prev in list] [next in list] [prev in thread] [next in thread] 

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