On 07/24/11 19:01, [email protected] wrote:
> I noticed that the unread message count in mailbox-view is not updated
> correctly - most of the time not when new mail arrives and seemingly
> never
> when the flag of a message is changed to isSeen (i.e. by activating the
> item in the
> message listview).

Hi, thanks for your interest in Trojitá -- that's cool. I believe that
what you see is bug #65 [1] (and maybe other issues as well).

> Before I continue: I just started getting to know trojita's source so
> the fix I am
> proposing below might be completely off-place, I just stepped through
> trojita with
> GDB and tried to find the most suitable place in the execution path...

That's pretty impressive. Please feel free to report any errors,
weirdness and similar stuff, or basically anything that makes you raise
an eyebrow; I'd be *very* grateful to have someone review parts of the
code. Anything counts here; I'd love to improve myself.

> I could resolve the first issue by:
> 
> diff --git a/src/Imap/Tasks/ObtainSynchronizedMailboxTask.cpp
> b/src/Imap/Tasks/ObtainSynchronizedMailboxTask.cpp
> index cc68afe..1f07dcd 100644
> --- a/src/Imap/Tasks/ObtainSynchronizedMailboxTask.cpp
> +++ b/src/Imap/Tasks/ObtainSynchronizedMailboxTask.cpp
> @@ -719,6 +719,7 @@ void
> ObtainSynchronizedMailboxTask::notifyInterestingMessages(
> TreeItemMailbox *
>      Q_ASSERT(mailbox);
>      TreeItemMsgList *list =
> dynamic_cast<Imap::Mailbox::TreeItemMsgList*>(
> mailbox->_children[0] );
>      Q_ASSERT(list);
> +    list->recalcUnreadMessageCount();
>      QModelIndex listIndex = model->createIndex( 0, 0, list );
>      Q_ASSERT(listIndex.isValid());
>      QModelIndex firstInterestingMessage = model->index( mailbox-
>> syncState.unSeenOffset(), 0, listIndex );

Looks correct, does not break anything and improves situation in certain
circumstances -> I'm going to commit this. Thanks a lot for the patch!

The function should also emit dataChanged() at the end (I will add
that), so that the GUI picks up the change. Without that call, it isn't
deterministic whether the number gets updated in the GUI or not.

Could I have your real name and a nice e-mail address to put into the
git history?

> For the second issue it seems that in MailboxTree.cpp, method void
> TreeItemMessage::setFlags(TreeItemMsgList *list, const QStringList
> &flags) (line
> 859) the check:
> 
>  if ( list->_numberFetchingStatus == DONE ) {
> 
> fails because _numberFetchingStatus seems to be =LOADING about 99% of
> the
> time when this method is invoked. So either this is a bug or it is OK
> but somehow
> _unreadMessageCount needs to be updated as soon as _numberFetchingStatus
> changes from LOADING to DONE...

Yes, your analysis seems spot-on. Last time I tried to debug this, I got
lost and gave up. It's annoying. If you manage to find out what's the
cause here, it'd be terrific.

Cheers,
Jan

[1] https://projects.flaska.net/issues/65

-- 
Trojita, a fast e-mail client -- http://trojita.flaska.net/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to