[Kde-pim] KMail System Tray Idea

Abner Silva abner.silva at kdemail.net
Thu Apr 16 04:57:12 BST 2009


On Wednesday 15 April 2009 23:24:08 ComputerDruid wrote:
> Hi, this is my first list post, and my first real foray into KDE
> contribution.

Welcome onboard =)

> I was wondering about a feature for kmail's system tray Icon:
> I use gmail with IMAP, which has an "All Mail" folder as well as an "Inbox"
> folder, and when a new mail arrives, 2 unread messages show up, one in
> each. In the main kmail window there is the "favorite folders" section
> which shows the important bits (but allows me to move the messages to other
> folders, etc.). But in the system tray, it just shows up as a number. So in
> this case, the number shown is generally 2x the number of unread mails. So
> I was wondering if it would be a good idea to have an option where only
> favorite folders are counted towards this number. It isn't that hard to
> implement (I have a basic patch without configuration and stuff) would this
> be useful in other situations outside the gmail usecase? Is this worth
> including or is a feature that would only be useful to me?

Actually you can already do something similar to it just editing the folder's 
properties and using the option "Act on new/unread mail". So that way you can 
choose which folder will reflect its new mails on tray.

The "All Mail" issue (I consider it as an issue when using gmail with imap) 
you can solve, again, editing the 'Local Subscription" of you gmail account. 
There you can choose which folder you wanna subscribe/watch to. So just unmark 
All Mail's folder and you'll avoid downloading duplicated mails from your 
gmail account.

I don't know if it's exactly what you wanna do, but I hope it helps. =)

Anyways, I think your suggestion is not bad, cos when you have a lot of 
folders you must configure one by one.

Cheers,
-Abner

> My first attempt at coding this up (this works, but isn't as configurable
> as I'd like):
>
> diff --git a/kmsystemtray.cpp b/kmsystemtray.cpp
> index 57888e3..a87d09f 100644
> --- a/kmsystemtray.cpp
> +++ b/kmsystemtray.cpp
> @@ -481,16 +481,22 @@ void KMSystemTray::updateNewMessages()
>      QMap<QPointer<KMFolder>, int>::Iterator it = mFoldersWithUnread.find(
> fldr ); bool unmapped = ( it == mFoldersWithUnread.end() );
>
> -    // If the folder is not mapped yet, increment count by numUnread
> -    // in folder
> -    if ( unmapped )
> -      mCount += unread;
> -
> -    //Otherwise, get the difference between the numUnread in the folder
> and -    // our last known version, and adjust mCount with that difference
> -    else {
> -      int diff = unread - it.value();
> -      mCount += diff;
> +    int idx = GlobalSettings::self()->favoriteFolderIds().indexOf(
> fldr->id() ); +    if ( idx >= 0 ) {
> +      // In favorites. Only count it since we don't want the non-favorite
> +      // folders in the count
> +
> +      // If the folder is not mapped yet, increment count by numUnread
> +      // in folder
> +      if ( unmapped )
> +        mCount += unread;
> +
> +      //Otherwise, get the difference between the numUnread in the folder
> and +      // our last known version, and adjust mCount with that
> difference +      else {
> +        int diff = unread - it.value();
> +        mCount += diff;
> +      }
>      }
>
>      if ( unread > 0 ) {
>
>
> Thanks,

-- 
Abner José de Faria Silva
INdT - Instituto Nokia de Tecnologia
PGP: 0x627A4C8C @ wwwkeys.pgp.net

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list