Version: (using KDE KDE 3.5.1) Installed from: RedHat RPMs OS: Linux When I open a new email and then I use select button to select recipient. It appear a select recipient windows. I type a key word in search field in select recipient windows and then I get 4 recipients. I select these 4 recipients and then I press Add as To button. A magical thing happen, ther are 36 recipients in kmail to field. It meas after I press send mail button, 36 people will receive this mail.
Confirmed on r504793. The problem is that Shift-click to select a range includes those items that are hidden by the search. An example: Address book contains: aPhil Bill zPhil Enter 'phil' in the search bar. Only "aPhil" and "zPhil" appear. Shift-click to select both, then "Add as to". All *three* names are added. I suspect this is a problem with the widget rather than KMail.
...and is almost certainly a manifestation of the same thing as bug 122158
The ksysguard bug #122158 was easily fixable by using QListViewItemIterator::Visible as flag when iterating over the items.
Created attachment 14975 [details] Uses visible | selected iterators Wow, thanks for the pointer Lubos. Please review the attached patch which solves the problem. It applies to recipientspicker.cpp tagged as 3.5.1.
Patch looks correct, please commit.
SVN commit 516198 by onurf: Fix bug #122218 where a shift-select in a filtered recipients picker results in non-visible contacts to be added as recipients as well. BUG: 122218 M +13 -16 recipientspicker.cpp --- branches/KDE/3.5/kdepim/kmail/recipientspicker.cpp #516197:516198 @@ -613,13 +613,11 @@ kdDebug() << "RecipientsPicker::pick " << int( type ) << endl; int count = 0; - QListViewItem *viewItem; - for( viewItem = mRecipientList->firstChild(); viewItem; - viewItem = viewItem->nextSibling() ) { - if ( viewItem->isSelected() ) { + QListViewItemIterator it( mRecipientList , + QListViewItemIterator::Visible | QListViewItemIterator::Selected ); + for ( ; it.current(); ++it ) ++count; - } - } + if ( count > GlobalSettings::self()->maximumRecipients() ) { KMessageBox::sorry( this, i18n("You selected 1 recipient. The maximum supported number of " @@ -630,16 +628,15 @@ return; } - for( viewItem = mRecipientList->firstChild(); viewItem; - viewItem = viewItem->nextSibling() ) { - if ( viewItem->isSelected() ) { - RecipientViewItem *item = static_cast<RecipientViewItem *>( viewItem ); - if ( item ) { - RecipientItem *i = item->recipientItem(); - Recipient r = i->recipient(); - r.setType( type ); - emit pickedRecipient( r ); - } + it = QListViewItemIterator( mRecipientList , + QListViewItemIterator::Visible | QListViewItemIterator::Selected ); + for ( ; it.current(); ++it ) { + RecipientViewItem *item = static_cast<RecipientViewItem *>( it.current() ); + if ( item ) { + RecipientItem *i = item->recipientItem(); + Recipient r = i->recipient(); + r.setType( type ); + emit pickedRecipient( r ); } } close();
Thanks. After applying the patch, the recipient problem had bee fixed. But there is no way to select some address books in "address book field" in Select Recipient windows. For example : I can't select family address book when I just want to send email to my family and there are some records in my family address book.
Could you file a new wish for that, if that doesn't exist already? Thanks.