[KDE/Mac] Review Request 126369: [OS X] adaptation(s) to platform limitations (WIP)
René J.V. Bertin
rjvbertin at gmail.com
Thu Dec 17 11:40:04 UTC 2015
This is an automatically generated e-mail. To reply, visit:
(Updated Dec. 17, 2015, 12:40 p.m.)
Review request for KDE Software on Mac OS X and KDE Frameworks.
This is how things look when I patch the test application to set the `--active-icon` icon as the application (window) icon. After Martin's remark that "it looks a little strange", I thought I'd try to resize the menu icon to match the font height. But contrary to Qt4/KDE4 the menu icon appears to be resized automagically in Qt5/KF5.
- is it to be expected (in kstatusnotifieritemtest.cpp) that `tray->iconPixmap()` returns a null QIcon immediately after calling `tray->setIconByName()`?
- how exactly is the NeedsAttention mechanism supposed to work? If I call `tray->setAttentionIconByName()` explicitly that icon appears in the menubar when I set the NeedsAttention state. But it doesn't flash. The test application appears to use/call for the legacy attention mode; how is it supposed to carry on after the initial icon change, i.e. via what code path is the swapping achieved on Linux? If possible I'd like to find a acceptable initial fix (adaptation) to the NeedsAttention feature. I do not particularly care for flickering icons and that would be too "alien" anyway. If Qt provides an easy way to take the current icon shown in the menubar (or the attentionIconPixmap if not empty) and badge it that would be a good solution.
There is `QtMac::setBadgeLabelText()`; calling it with `QStringLiteral("!")` provides a nice exclamation mark badge on the application icon, but sadly that badged icon cannot be retrieved through `qApp->windowIcon()` (or any "internal" Cocoa method I could find).
OS X has a number of limitations in features used by KNotifications, notably concerning the status notifier item (aka system tray icon).
This RR will likely evolve to address multiple limitations (at least also the NeedsAttention state); at the moment it only proposes an emulation of `QMenu::addSection`.
`QMenu::addSection` works by adding a QAction with a "texted separator" at the insertion location. Texted separators do not exist in menu items in the OS X "global" menubar (they become regular separators), and Qt will not provide a platform-specific implementation. Loss of the section title text is maybe not always an issue, but I think it is in the system tray menu. I therefore propose to emulate `QMenu::addSection` by replacing the texted separator with an inactive (disabled) menu item that shows the text, followed by a standard separator. Menus in the notification area are much less subject to interface guidelines, so the presence of an item icon is acceptable and IMO useful for the `titleAction`.
Testing the NeedsAttention state with the tests/kstatusnotifieritemtest application leads to disappearance of the menubar icon, i.e. the access to the notifier menu becomes invisible rather than blinking (which is what I get on Linux using the same packaging). Adding a few qDebug statements shows that the `attentionIcon` is empty.
I'd appreciate a crash course how this feature is supposed to work, so I can see if an OS X implementation might be feasible.
On OS X 10.9.5 with Qt 5.5.1 and frameworks 5.17.0 .
File Attachments (updated)
the systray icon & menu created by kstatusnotifieritemtest . This application has no icon to show.
The systray icon and menu created by the KDE4 kwalletmanager (code has an equivalent patch)
An Apple systray icon+menu that shows icons (which cannot be hidden)
kstatusnotifieritemtest with added appIcon
René J.V. Bertin
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the kde-mac