Bug 74938 - [PATCH] Clicking kmail notification in tray should always bring kmail window to top
Summary: [PATCH] Clicking kmail notification in tray should always bring kmail window ...
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.10.90
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: junior-jobs
: 84919 121673 217397 242328 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-11 12:30 UTC by Marcin Kasperski
Modified: 2010-11-24 15:49 UTC (History)
16 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to kmsytemtray (836 bytes, patch)
2004-07-18 17:22 UTC, Lothar Braun
Details
Patch to kmsytemtray (4.43 KB, patch)
2005-08-23 13:01 UTC, Kåre Särs
Details
System tray behaviour patch for KMail in KDE 3.5.x (5.55 KB, patch)
2006-06-20 17:49 UTC, Kåre Särs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Kasperski 2004-02-11 12:30:35 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    Debian stable Packages

Look at the following scenario:
a) I have kmail main window running, *not* minimized, but hidden below some other windows - so invisible
b) I see new mail indicator on the kmail notification icon in the desktop tray.
c) So I click this indicator.
d) And ... nothing happens
(in fact, one can finally find that the kmail window just happened to be minimized, next click will bring it to the top)

I get this very frequently and it is irritating, in fact it gives illusion that one need to use double-click to bring kmail window in contrary to the standard KDE behaviour.

In my opinion clicking kmail notification icon in tray should do just one simple thing - bring the kmail window to the top on the current desk -  whatever was it previous state. I see no reason for notification icon to be working as minimize button and this behaviour causes problems as described above.
Comment 1 Marcin Kasperski 2004-02-11 13:06:22 UTC
And additional, related note: when I minimize kmail normally (using minimize icon), the program bar is visible on the panel. When I minimize it clicking dock icon, it is NOT. This is very confusing and innatural. And this is one more reason to resign from using dock icon as minimize button.
Comment 2 Ingo Klöcker 2004-02-11 14:31:43 UTC
That's actually a bug.
Comment 3 Matthias Wurm 2004-06-17 18:29:17 UTC
To fix this, a tiny fix in kmail/kmsystray.cpp is required:
In method
void KMSystemTray::mousePressEvent(QMouseEvent *e)

ignore the following case:

 if( mParentVisible && mainWindowIsOnCurrentDesktop() )
       hideKMail();

(What remains in the left mouse button case is actually only showKMail() )
This results in exactly the behaviour Kasperski wants. I don't know if this helped. Since that report is already 4 months old I feel a little bit silly to post this ridiculous patch. But I wonder why this little annoying topic is still unresolved.
Comment 4 Lothar Braun 2004-07-18 17:22:19 UTC
Created attachment 6720 [details]
Patch to kmsytemtray

I don't think ignoring
if( mParentVisible && mainWindowIsOnCurrentDesktop() ) 
       hideKMail();
is the right way to solve this problem because the mainwindow isn't minimzed
any more than.
In my opinion it's better to check if the window is active (has the focus). If
not than it's hidden so it can brought to front (even if it isn't hidden the
changes do no harm).
The patch also checks if the window is minimized and brings it to front when
clicking on the systray icon (this didn't work when the window isn't minimized
to a systray icon, but to a disabled window on the systray)
Comment 5 Mathieu Jobin 2004-07-22 17:12:23 UTC
also, if kmail use the systray icon, the regular minizime window should hide the application just like the icon do.
so _ and X would do the same on icon mode.

Comment 6 mail 2004-10-01 18:01:59 UTC
My problem is this:
KMail is on desktop #2 (minimized or not). When I click the mail notification on desktop #1, the icon disappears and reappears, that's it. I guess I should be taken to the right desktop (#2 in this case) and have KMail as active window? The only thing that changes is that KMail in the panel becomes light blue.

So now I switch to #2 where KMail is minimized. I click the systray icon and KMail disappears from the panel! I click it again and KMail is the active window. I click it again, KMail disappears completely. I click it again, KMail is active window and the icon disappears!

Now when I don't take a look at the new mail and another mail comes in, there will not be an icon in the systray to show it.

My setting is to only show the systray icon on unread mails, and each virtual desktop panel only shows the windows of its desktop.

So what I expect is:
1) If there is unread mail, there is always a systray icon to show it.
2) Wherever I am, clicking the systray icon takes me to an active KMail window
2a) on my desktop if KMail was "closed"=not in any panel
2b) or on another desktop if KMail is somewhere in the panel.
Comment 7 S. Burmeister 2004-10-16 16:27:55 UTC
Can one not simply copy the code from e.g. kopete? Kopete brings to front when in beackground and minimizes when already in front.
Comment 8 Tom Albers 2004-12-28 17:35:25 UTC
*** Bug 84919 has been marked as a duplicate of this bug. ***
Comment 9 Marcin Kasperski 2004-12-29 13:14:44 UTC
Extra note: it seems to me that kopete behaves well (tested on KDE 3.2.3): if I click kopete tray icon:
- if kopete window is minimized, it is restored and bringed to top
- if kopete window is restored but partially or completely hidden, it is bringed to top
- if kopete window is completely visible, it is minimized

So please just handle this click in kmail EXACTLY THE SAME WAY as it is handled in kopete.
Comment 10 Mathieu Jobin 2004-12-29 16:55:05 UTC
i think code should not be copied from kopete to kmail, but be generalized to systray+window application.

anyone tried noatun ? same problem... only few applications manualy fixed it.. like kopete.

fixing it in kmail would not fix the real problem IMHO

this should go further/lower

just my two cents

Comment 11 Jure Repinc 2005-02-05 22:25:01 UTC
The bug is still here in KMail from today CVS. KMail should work in the same way as Akregator does for example.

Now it even happens that if you are quickly double or triple or more clicking on KMail icon in the system tray the icon just dissapears from the tray, but the application is still runing.
Comment 12 Kåre Särs 2005-08-23 13:01:29 UTC
Created attachment 12342 [details]
Patch to kmsytemtray

I agree that the system tray behaviour should be generalized to systray+window
application, but until that is done here is a patch that copies code from
ksystemtray.cpp to implement the same behaviour. The patch is against Kmail
1.8.2 (KDE 3.4.2). I think Bug 105139
(http://bugs.kde.org/show_bug.cgi?id=105139) is a duplicate of this bug but
with a better tittle.

  Kåre
Comment 13 Thiago Macieira 2005-08-23 13:19:47 UTC
*** Bug 105139 has been marked as a duplicate of this bug. ***
Comment 14 Emmanuel Engelhart 2006-03-06 19:40:31 UTC
Other test case:
* I use Akregator & Kmail in Kontact
* I'm reading my news with Akregator
* I see the new mail indicator on the kmail notification icon in the desktop tray
* I click on it..... the window goes away :-(

... I just wanted to pen kontact in ¨kmail¨ mode
Comment 15 Kåre Särs 2006-03-07 09:24:14 UTC
Hi!

The last comment is probably more a Kontact problem but is I think it is still important to get a intuitive and standardized behavior.

I have used my patch above since 3.4.2 and it works for me. This is the behavior after the patch when the tray icon is clicked:

1) If KMail is behind any other window, KMail is set on top.
2) If KMail is on top, the KMail window is hidden.
3) If KMail is on another desktop, the view is switched to that desktop and KMail is set on top.
4) If the KMail window is hidden, the window is restored on the current desktop not necessarily the same as it was hidden on.

Number 4 in the list is the reason I made the patch. If KMail was hidden it would always force me back to the desktop I had hidden KMail on.

Why hasn't this patch been applied? Is it because its "ugly" in duplicating code and a clean solution is wanted? 
Anyway I had to modify the patch somewhat for >= 3.5.0, so if there is interest I can post the new patch also.

Kåre

Comment 16 S. Burmeister 2006-03-07 10:27:59 UTC
I would really like to see 1-3, yet 4 IMO should not be implemented. I want kmail or kontact to stay on the desktop it was started, even if hidden, and the tray-icon to get me there.

If people want to have kmail/kontact on all windows, set the window-properties to "show on all desktops".
Comment 17 Kåre Särs 2006-03-07 11:30:54 UTC
This is not only my preference it's also about standard behavior. A quick check gave me this result: 
- JuK, Akregator, KMPlayer, AmaroK and KMix* follow my described 1-4 behavior (*KMix uses middle click).
- KOrganizer breaks 3 by moving the window to the current desktop.
- Noatune's behavior depends on what skin is in use.
- KMail breaks 4

Shouldn't all applications behave the same and if different behavior is desired, it should be configurable either globally or per application?
Comment 18 Kåre Särs 2006-06-01 08:57:07 UTC
I just installed the Kubuntu debs of kde 3.5.3 (and KMail). I thought I would give the "show on all desktops" a chance. Unfortunately when the KMail window is hidden and then restored the "show on all desktops" flag is cleared, so that is not an option.
Comment 19 Non_E 2006-06-20 14:10:44 UTC
Bug 89847 is probably duplicate of this one.
Desktop swithing bug is still present in kmail 1.9.3 (KDE 3.5.3). From what I read there are four similar bugs/complaints:

1) Kmail & Kontact integration issues.
2) Kmail swithng to desktop where it was last minimized (quite an unconfortable behaviour).
3) Clicking tray first minimizes hidden but not minimized window, next click pops it up (clearly a Kmail bug, Amarok and Akregator do not suffer from this).
4) Clicking minimize button does not send kmail into tray (neither does Amarok and others, I do not thinks it is actually a bug).

I wonder why all these usability bugs are so long unresolved.
Comment 20 Jakub Schmidtke 2006-06-20 15:35:10 UTC
"Kmail swithng to desktop where it was last minimized (quite an unconfortable behaviour)" - This is really uncomfortable for me too! Could it be changed, or, at least, an option added to control the way it behaves?
Comment 21 Kåre Särs 2006-06-20 15:54:41 UTC
Maybe it would be possible to add a third option to the "System Tray Mode" that would say "Use Standard System Tray behaviour" that would make KMail use the systemtrays standard show/hide behaviour. 

(If anybody is interested I have patched my KMail to behave like the systemtrays default behaviour. I copied the code from the systemtray implementation.)

  
Comment 22 Non_E 2006-06-20 17:03:49 UTC
Kåre Särs: Sure I am interested, could you please attach the patch? What version of Kmail is it for? If it works there will be at least a chance distribution maintainers will accept it.
Comment 23 Kåre Särs 2006-06-20 17:49:37 UTC
Created attachment 16717 [details]
System tray behaviour patch for KMail in KDE 3.5.x

Here's the patch for the interested. This patch makes KMail behave as I
described in comment#15. I copied most of the code from ksystemtray.cpp (kde
3.4.2) I'v been using this patch since 3.4.2 (needed some modifications going
to 3.5.x)
Comment 24 Non_E 2006-06-20 18:41:07 UTC
Kåre Särs: Thank you, works perfectly
Comment 25 Jakub Schmidtke 2006-06-20 19:52:46 UTC
Another one here - it works GREAT with 3.5.3! :)
So I have another customized ebuild... ;)
Comment 26 Mike Williams 2007-01-12 20:04:05 UTC
Is there a reason this hasn't been imported into svn?
Comment 27 dukat 2007-06-26 18:49:55 UTC
Wow, still the same irritating behavior on Kubunty 7.04 ... Any chance this will get applied someday?

Comment 28 Thomas McGuire 2007-06-28 22:26:22 UTC
See also bug 121673.
Comment 29 Thomas McGuire 2007-06-29 11:53:55 UTC
This is fixed in KDE4, it now works exactly like comment 9 describes it.
Comment 30 Thomas McGuire 2007-06-29 11:54:31 UTC
*** Bug 121673 has been marked as a duplicate of this bug. ***
Comment 31 Thomas McGuire 2007-08-30 18:37:51 UTC
*** Bug 89847 has been marked as a duplicate of this bug. ***
Comment 32 Tobias Niwi 2007-12-04 18:02:54 UTC
Are the problems 1+2* mentioned in comment 19 (but NOT in comment 9) fixed in KDE 4 too? If not, this bug should be reopened.

This is especially important because two bug reports (89847 and 105139) regarding problem 2 were closed because they were taken as duplicates of this bug report. 89847 had been confirmed by popular vote. There is also a still related bug report open (118262).

* Here is a short discription of 'problem 2' (quoted from 89847):
After minimizing kmail to the systray, if I switch to another desktop and open kmail it forces a change to the desktop that kmail was minized on rather than opening on the current desktop.

 
Comment 33 Thomas McGuire 2007-12-04 18:14:53 UTC
>Are the problems 1+2* mentioned in comment 19 (but NOT in comment 9) fixed in KDE 4 too? If not, this bug should be reopened. 
Problem 2 is fixed, the KMail window opens on the desktop you are currently on.
Problem 1 is not fixed, but there are other bug reports about unifing the system trays in Kontact, that should not belong to this bug report.
Comment 34 Marcin Kasperski 2007-12-04 18:31:14 UTC
Could you take a look at the subject of this bug and the initial description?

This bug was not about the behaviour in multi-desktop configuration, but about invalid behaviour when system trays are considered.

So, as this problem is not solved, the bug should be reopened.

If there is a better bug about this matter, mark it as duplicate, so it is clear where those votes should be moved.
Comment 35 Marcin Kasperski 2007-12-04 18:32:09 UTC
.
Comment 36 info 2008-07-16 00:36:11 UTC
I'd like to switch between kmail and akregator via system tray (see comment #14).
In KDE 3/4, if Kmail is open a click on akregator in the system tray closes kmail, instead of opening akregator. Another click is needed.
Comment 37 Jakub Schmidtke 2008-07-29 13:27:56 UTC
I'm not sure what was the correct behaviour and why this was "resovled", but kmail from KDE 4.1 when opened from tray brings you to the desktop it was previously opened on. Since the bug http://bugs.kde.org/show_bug.cgi?id=89847 is marked as a duplicate of this one, this behaviour should be fixed as a part of resolving this one, right? Current behaviour is really really irritating :/
Comment 38 Jure Repinc 2008-11-09 19:50:25 UTC
I've checked this with KMail from KDE SVN r881890 (to be in KDE 4.2). Clicking the tray icon still doesn't respond as expected.
Comment 39 Björn Ruberg 2009-12-20 13:49:18 UTC
Works for me in KDE 4.3
Comment 40 Kåre Särs 2009-12-20 18:14:42 UTC
I'm not going to reopen the bug, but it definitely does not work as I would expect it should. The original description still describes the behavior I see in 4.3.x and 4.4 beta. (Kubuntu 9.10)

Are there plans to move to the new systemtray API (or whatever it is called :)
Comment 41 Alexandre Pereira 2009-12-21 16:20:55 UTC
well , i have a bug report that was marked as duplicate of this one.

if this one isnt fixed , i will reopen my own bug report.

when i click on the kmail system tray icon, it opens kmail in the last virtual desktop kmail was on. all other kde apps dont do this. they open in the virtual desktop *i am currently on* !!!!

either change all other kde apps, make it a global option, or change kmail. but diferent systray icon clicking functionality from kmail to all other kde apps is not a solution.

i will wait a day or two, if this continues to be marked fixed , i will reopen my bug.

thanks :) merry xmas to all :)
Comment 42 Björn Ruberg 2009-12-21 16:27:53 UTC
Yes, reopen your original bug then. The original bug is surely fixed.
Comment 43 Alexandre Pereira 2009-12-21 16:38:50 UTC
ok , just did.

my original bug about kmail and systray clicking and virtual desktops just reopened. also i removed the duplicate setting.
Comment 44 Kåre Särs 2009-12-21 21:41:15 UTC
(In reply to comment #42)
> Yes, reopen your original bug then. The original bug is surely fixed.

I beg to differ about the bug being fixed. I'm using KMail Version 1.13.0 (KDE 4.4 beta) in Kubuntu 9.10. I have "Always show KMail in systemtray" enabled and when I click the system tray icon I get the exact same behavior as the original bug reporter describes.

If the behavior is not seen as a bug please set it to WONTFIX.
Comment 45 Björn Ruberg 2009-12-21 21:47:45 UTC
Ah, okay. I see. That bug is still there - must be very easy to fix. Setting as a junior-job.
Comment 46 Jakub Schmidtke 2009-12-22 00:46:13 UTC
Iori: What's that bug's number?
I submitted a similar one: https://bugs.kde.org/show_bug.cgi?id=123532 and I guess it is a duplicate of yours, not of this one.
Comment 47 Alexandre Pereira 2009-12-22 00:53:00 UTC
(In reply to comment #46)
> Iori: What's that bug's number?
> I submitted a similar one: https://bugs.kde.org/show_bug.cgi?id=123532 and I
> guess it is a duplicate of yours, not of this one.

mine is : https://bugs.kde.org/show_bug.cgi?id=105139
Comment 48 Björn Ruberg 2010-03-07 23:53:18 UTC
*** Bug 217397 has been marked as a duplicate of this bug. ***
Comment 49 Björn Ruberg 2010-08-08 16:32:45 UTC
*** Bug 242328 has been marked as a duplicate of this bug. ***
Comment 50 Torgny Nyblom 2010-11-24 15:49:37 UTC
SVN commit 1200286 by tnyblom:

Patch from George Metaxas, Thanks!

This patch fixes bug 74938, which is related to the way in which the
systray icon of KMail behaves. Currently, clicking on the systray icon
has the effect of minimizing the KMail window, irrespective of its
position in the window stack, and maximizing it if it was previously
minimized. In the latter case, the current virtual desktop is changed to
the virtual desktop where the KMail window was minimized. As noted in
the corresponding bug entry, this behavior is different than the
corresponding behavior of other KDE applications (e.g. Akregator).

The patch modifies the behavior of the KMail systray clicking handling,
by making it identical to other applications (e.g. Akregator). When
the KMail window is the top level window in the virtual desktop, it
is minimized. If it is visible in the desktop, but not at the top,
it is brought to the top. If the window is minimized, then it is
maximized to the current virtual desktop.

BUG: 74938


 M  +26 -58    kmsystemtray.cpp  
 M  +0 -2      kmsystemtray.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1200286