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

List:       kde-commits
Subject:    kdepim/libkdepim
From:       Till Adam <adam () kde ! org>
Date:       2005-03-16 15:34:50
Message-ID: 20050316153450.3338717D06 () office ! kde ! org
[Download RAW message or body]

CVS commit by tilladam: 

Simplify the adding of pseudo completion items such that completing on
Firstname Lastname as well as Lastname, Firstname works, as does completing
on the email address.


  M +1 -0      Makefile.am   1.95
  M +17 -1     addresseelineedit.cpp   1.41


--- kdepim/libkdepim/Makefile.am  #1.94:1.95
@@ -43,4 +43,5 @@
 libkdepim_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 1:0:0
 libkdepim_la_LIBADD  = $(top_builddir)/libkcal/libkcal.la \
+                       $(top_builddir)/libemailfunctions/libemailfunctions.la \
                        $(LIB_KIO) $(LIB_KABC) $(LIB_KPARTS) $(LIB_KIMPROXY) \
$(LIB_POLL) -lqui  #               \
$top_builddir)/libkdepim/resources/libkpimresources.la

--- kdepim/libkdepim/addresseelineedit.cpp  #1.40:1.41
@@ -29,4 +29,5 @@
 #include <kabc/stdaddressbook.h>
 #include <kabc/resource.h>
+#include <libemailfunctions/email.h>
 
 #include <kcompletionbox.h>
@@ -483,4 +484,17 @@ void AddresseeLineEdit::addContact( cons
   QStringList::ConstIterator it;
   for ( it = emails.begin(); it != emails.end(); ++it ) {
+
+    if ( addr.givenName().isEmpty() && addr.familyName().isEmpty() ) {
+      addCompletionItem( addr.fullEmail( (*it) ), weight ); // use whatever is there
+    } else {
+      const QString byFirstName= KPIM::quoteNameIfNecessary( addr.givenName() + " " \
+ addr.familyName() ) + " <" + (*it) + ">"; +      const QString byLastName= "\"" + \
addr.familyName() + ", " + addr.givenName() + "\" "  + "<" + (*it) + ">"; +      \
const QString byEmail= (*it) + " (" + addr.realName() + ")"; +      \
addCompletionItem( byFirstName, weight ); +      addCompletionItem( byLastName, \
weight ); +      addCompletionItem( byEmail, weight );
+    }
+
+#if 0
     int len = (*it).length();
     if ( len == 0 ) continue;
@@ -531,4 +545,5 @@ void AddresseeLineEdit::addContact( cons
       }
     }
+#endif
   }
 }
@@ -572,6 +587,7 @@ void AddresseeLineEdit::startLoadingLDAP
   if ( n >= 0 ) {
     prevAddr = s.left( n + 1 ) + ' ';
-    s = s.mid( n + 1, 255 ).stripWhiteSpace();
+    s = s.mid( n + 1, 255 );
   }
+  s = s.stripWhiteSpace();
 
   if ( s.isEmpty() )


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

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