dbustray: add NewMenu signal and emit it when menu changed

This is a signal that is not actually supported by the
StatusNotificationIcon standard, but it comes to be important
for the Qt implementation of it, in fact qt apps might
not have a menu, when exporting the Menu path as /NO_DBUSMENU
or they could add this later in the execution.
So, currently there's no way for the StatusNotificationWatcher
to know when a menu has been added (or changed).

Adding a NewMenu signal won't cause any troubles, but will
allow watchers to be notified properly on menu addition.

Change-Id: I9a8b00213f5023950811af1d62cd91bc51744b78
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Marco Trevisan (Treviño) 2017-12-15 15:47:50 -05:00 committed by Shawn Rutledge
parent 2dc578a8f2
commit ff169e8859
3 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,9 @@
<signal name="NewOverlayIcon">
</signal>
<signal name="NewMenu">
</signal>
<signal name="NewToolTip">
</signal>

View File

@ -126,6 +126,7 @@ QDBusTrayIcon::QDBusTrayIcon()
connect(this, SIGNAL(tooltipChanged()), m_adaptor, SIGNAL(NewToolTip()));
connect(this, SIGNAL(iconChanged()), m_adaptor, SIGNAL(NewIcon()));
connect(this, SIGNAL(attention()), m_adaptor, SIGNAL(NewAttentionIcon()));
connect(this, SIGNAL(menuChanged()), m_adaptor, SIGNAL(NewMenu()));
connect(this, SIGNAL(attention()), m_adaptor, SIGNAL(NewTitle()));
connect(&m_attentionTimer, SIGNAL(timeout()), this, SLOT(attentionTimerExpired()));
m_attentionTimer.setSingleShot(true);
@ -268,6 +269,7 @@ void QDBusTrayIcon::updateMenu(QPlatformMenu * menu)
connect(m_menu, SIGNAL(updated(uint,int)),
m_menuAdaptor, SIGNAL(LayoutUpdated(uint,int)));
dBusConnection()->registerTrayIconMenu(this);
emit menuChanged();
}
}

View File

@ -129,6 +129,7 @@ class QStatusNotifierItemAdaptor: public QDBusAbstractAdaptor
" <signal name=\"NewIcon\"/>\n"
" <signal name=\"NewAttentionIcon\"/>\n"
" <signal name=\"NewOverlayIcon\"/>\n"
" <signal name=\"NewMenu\"/>\n"
" <signal name=\"NewToolTip\"/>\n"
" <signal name=\"NewStatus\">\n"
" <arg type=\"s\" name=\"status\"/>\n"
@ -191,6 +192,7 @@ Q_SIGNALS: // SIGNALS
void NewAttentionIcon();
void NewIcon();
void NewOverlayIcon();
void NewMenu();
void NewStatus(const QString &status);
void NewTitle();
void NewToolTip();