From 9ceed2d90dccdd2706d92c783a6e1e39d251c31d Mon Sep 17 00:00:00 2001 From: Till Adam Date: Mon, 13 Feb 2006 17:38:05 +0000 Subject: [PATCH] Backport patch by Philippe Rigault, which makes it possible to accept invitations if one is not in the invitations To: list, now that the string freeze is lifted somewhat. CCMAIL: 106594@bugs.kde.org svn path=/branches/KDE/3.5/kdepim/; revision=509083 --- callback.cpp | 61 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/callback.cpp b/callback.cpp index 9c32afd11..dd3a2bea9 100644 --- a/callback.cpp +++ b/callback.cpp @@ -112,33 +112,46 @@ QString Callback::receiver() const mReceiverSet = true; QStringList addrs = KPIM::splitEmailAddrList( mMsg->to() ); - if( addrs.count() < 2 ) - // Only one receiver, so that has to be us - mReceiver = mMsg->to(); - else { - int found = 0; - for( QStringList::Iterator it = addrs.begin(); it != addrs.end(); ++it ) { - if( kmkernel->identityManager()->identityForAddress( *it ) != - KPIM::Identity::null() ) { - // Ok, this could be us - ++found; - mReceiver = *it; - } + int found = 0; + for( QStringList::Iterator it = addrs.begin(); it != addrs.end(); ++it ) { + if( kmkernel->identityManager()->identityForAddress( *it ) != + KPIM::Identity::null() ) { + // Ok, this could be us + ++found; + mReceiver = *it; } - - if( found != 1 ) { - bool ok; - mReceiver = - KInputDialog::getItem( i18n( "Select Address" ), - i18n( "None of your identities match the " - "receiver of this message,
please " - "choose which of the following addresses " - "is yours:" ), - addrs, 0, FALSE, &ok, kmkernel->mainWin() ); - if( !ok ) - mReceiver = QString::null; + } + QStringList ccaddrs = KPIM::splitEmailAddrList( mMsg->cc() ); + for( QStringList::Iterator it = ccaddrs.begin(); it != ccaddrs.end(); ++it ) { + if( kmkernel->identityManager()->identityForAddress( *it ) != + KPIM::Identity::null() ) { + // Ok, this could be us + ++found; + mReceiver = *it; } } + if( found != 1 ) { + bool ok; + QString selectMessage; + if (found == 0) { + selectMessage = i18n("None of your identities match the " + "receiver of this message,
please " + "choose which of the following addresses " + "is yours, if any:"); + } else { + selectMessage = i18n("Several of your identities match the " + "receiver of this message,
please " + "choose which of the following addresses " + "is yours:"); + } + + mReceiver = + KInputDialog::getItem( i18n( "Select Address" ), + selectMessage, + addrs, 0, FALSE, &ok, kmkernel->mainWin() ); + if( !ok ) + mReceiver = QString::null; + } return mReceiver; }