Summary: | Can't add invitation to calendar if not in To: list | ||
---|---|---|---|
Product: | [Unmaintained] kmail | Reporter: | Nick Thompson <nickthompson> |
Component: | general | Assignee: | Till Adam <adam> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | prigault |
Priority: | NOR | ||
Version: | 1.8 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch for bug 106594
Better patch |
Description
Nick Thompson
2005-06-01 11:52:11 UTC
The same problem applies to the development version. Hm, I'll have a look. I can verify this issue still appears with: Version: Kmail 1.8.91 (kde 3.5 beta1) Installed from: Gentoo portage Compiler: gcc (GCC) 3.4.4 (Gentoo 3.4.4, ssp-3.4.4-1.0, pie-8.7.8) OS: Linux Created attachment 14152 [details] Patch for bug 106594 Here is a proposed patch to apply to KDE-3.5, where the problem still persists. It fixes two things: 1. This very bug, by looking into the CC: addresses as well as in the TO: addresses 2. The message informs the user about two different cases: - no address found that matches an identity - several addresses found that match an identity (new message) This patch applies readily to konstruct. Please apply to HEAD and 3.5-branch. Cheers, Philippe Created attachment 14160 [details] Better patch Improved patch. The upfront testing of a sole address in the to: list is removed, so it is now correct to rely on the fact that there is only one recipient in the combined to: and cc: lists to add the invite to that person's calendar. Without this fix, if the user (say foo@example.com) is on the cc: list and the to: list happens to contain only one address (say bar@example.com), then the reciever of the invite would wrongly be set to the latter one (bar@example.com) instead of the user (foo@example.com). I also believe the logic is now clearer in the code. Cheers, Philippe Thanks, the patch looks correct to me. I'll apply it to head and ask the translators for permission to add it to 3.5 as well. If they deny it, I'll commit a version which doesn't change strings. Contribution much appreciated. :) Committed to trunk, branch commit pending ok by the translators. I guess we can close it, then. For information, the commit did not make it to KDE-3.5.1. Patch still necessary there. Yeah, the translators refused it, too late in the game, it'll go in now that the branch is unfrozen again. SVN commit 509083 by tilladam: 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 M +37 -24 callback.cpp --- branches/KDE/3.5/kdepim/kmail/callback.cpp #509082:509083 @@ -112,34 +112,47 @@ 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( "<qt>None of your identities match the " - "receiver of this message,<br>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("<qt>None of your identities match the " + "receiver of this message,<br>please " + "choose which of the following addresses " + "is yours, if any:"); + } else { + selectMessage = i18n("<qt>Several of your identities match the " + "receiver of this message,<br>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; } |