[Bug 85539] secrets of address completion
Christian Schaarschmidt <[email protected]>
| Newsgroups | gmane.comp.kde.devel.kmail |
|---|---|
| Message-ID | <[email protected]> |
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=85539
schaarsc gmx de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From schaarsc gmx de 2007-06-05 21:20 -------
SVN commit 671909 by schaarsc:
port r663553
- place latest address at beginning of recent address list
- handle multiple addresses properly
BUG: 85539
M +24 -14 recentaddresses.cpp
--- branches/KDE/3.5/kdepim/libkdepim/recentaddresses.cpp #671908:671909
@ -28,6 +28,7 @
* your version.
*/
#include "recentaddresses.h"
+#include "libemailfunctions/email.h"
#include <kstaticdeleter.h>
#include <kconfig.h>
@ -98,24 +99,33 @
void RecentAddresses::add( const QString& entry )
{
- if ( !entry.isEmpty() && m_maxCount > 0 ) {
- QString email;
- QString fullName;
- KABC::Addressee addr;
+ if ( !entry.isEmpty() && m_maxCount > 0 ) {
+ QStringList list = KPIM::splitEmailAddrList( entry );
+ for( QStringList::const_iterator e_it = list.begin(); e_it != list.end(); ++e_it ) {
+ KPIM::EmailParseResult errorCode = KPIM::isValidEmailAddress( *e_it );
+ if ( errorCode != KPIM::AddressOk )
+ continue;
+ QString email;
+ QString fullName;
+ KABC::Addressee addr;
- KABC::Addressee::parseEmailAddress( entry, fullName, email );
+ KABC::Addressee::parseEmailAddress( *e_it, fullName, email );
- for ( KABC::Addressee::List::Iterator it = m_addresseeList.begin();
- it != m_addresseeList.end(); ++it )
- {
- if ( email == (*it).preferredEmail() )
- return;//already inside
+ for ( KABC::Addressee::List::Iterator it = m_addresseeList.begin();
+ it != m_addresseeList.end(); ++it )
+ {
+ if ( email == (*it).preferredEmail() ) {
+ //already inside, remove it here and add it later at pos==1
+ m_addresseeList.remove( it );
+ break;
}
- addr.setNameFromString( fullName );
- addr.insertEmail( email, true );
- m_addresseeList.prepend( addr );
- adjustSize();
+ }
+ addr.setNameFromString( fullName );
+ addr.insertEmail( email, true );
+ m_addresseeList.prepend( addr );
+ adjustSize();
}
+ }
}
void RecentAddresses::setMaxCount( int count )