change tray manegr dbus interface

Change-Id: I7be5d1113f576e780bd37c21808ee70f5fae7ed2
This commit is contained in:
石博文 2016-08-09 10:33:42 +08:00
parent 933fcf671f
commit e3e3d768ad
Notes: Deepin Code Review 2016-08-09 02:37:26 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Tue, 09 Aug 2016 02:37:25 +0000
Reviewed-on: https://cr.deepin.io/15003
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 18 additions and 3 deletions

View File

@ -24,8 +24,7 @@ void SystemTrayPlugin::init(PluginProxyInterface *proxyInter)
{
m_proxyInter = proxyInter;
connect(m_trayInter, &DBusTrayManager::Added, this, &SystemTrayPlugin::trayAdded);
connect(m_trayInter, &DBusTrayManager::Removed, this, &SystemTrayPlugin::trayRemoved);
connect(m_trayInter, &DBusTrayManager::TrayIconsChanged, this, &SystemTrayPlugin::trayListChanged);
connect(m_trayInter, &DBusTrayManager::Changed, this, &SystemTrayPlugin::trayChanged);
m_trayInter->RetryManager();
@ -72,6 +71,18 @@ void SystemTrayPlugin::updateTipsContent()
m_tipsWidget->addWidgets(trayList);
}
void SystemTrayPlugin::trayListChanged()
{
QList<quint32> trayList = m_trayInter->trayIcons();
for (auto tray : m_trayList.keys())
if (!trayList.contains(tray))
trayRemoved(tray);
for (auto tray : trayList)
trayAdded(tray);
}
void SystemTrayPlugin::trayAdded(const quint32 winId)
{
if (m_trayList.contains(winId))
@ -128,7 +139,10 @@ void SystemTrayPlugin::switchToMode(const Dock::DisplayMode mode)
{
for (auto winId : m_trayList.keys())
m_proxyInter->itemRemoved(this, QString::number(winId));
m_proxyInter->itemAdded(this, FASHION_MODE_ITEM);
if (m_trayList.isEmpty())
m_proxyInter->itemRemoved(this, FASHION_MODE_ITEM);
else
m_proxyInter->itemAdded(this, FASHION_MODE_ITEM);
}
else
{

View File

@ -27,6 +27,7 @@ private:
void updateTipsContent();
private slots:
void trayListChanged();
void trayAdded(const quint32 winId);
void trayRemoved(const quint32 winId);
void trayChanged(const quint32 winId);