Merge branch 'zhaolong/uos_newFeatNetwork' into 'uos'

feat(network): 点击插件图标唤起控制中心

See merge request dde-v20/dde-dock!541
This commit is contained in:
范朋程 2020-06-03 18:39:55 +08:00
commit c8b5e15bf6
3 changed files with 44 additions and 6 deletions

View File

@ -1225,3 +1225,38 @@ void NetworkItem::refreshTips()
break;
}
}
bool NetworkItem::isShowControlCenter()
{
bool onlyOneTypeDevice = false;
if ((m_wiredItems.size() == 0 && m_wirelessItems.size() > 0)
|| (m_wiredItems.size() > 0 && m_wirelessItems.size() == 0))
onlyOneTypeDevice = true;
if (onlyOneTypeDevice) {
switch (m_pluginState) {
case Unknow:
case Nocable:
case Bfailed:
case AconnectNoInternet:
case BconnectNoInternet:
case Adisconnected:
case Bdisconnected:
case Adisabled:
case Bdisabled:
return true;
}
} else {
switch (m_pluginState) {
case Unknow:
case Nocable:
case Bfailed:
case ConnectNoInternet:
case Disconnected:
case Disabled:
return true;
}
}
return false;
}

View File

@ -59,6 +59,7 @@ public:
const QString contextMenu() const;
void invokeMenuItem(const QString &menuId, const bool checked);
void refreshTips();
bool isShowControlCenter();
public slots:
void updateSelf();

View File

@ -92,11 +92,13 @@ bool NetworkPlugin::pluginIsDisable()
const QString NetworkPlugin::itemCommand(const QString &itemKey)
{
Q_UNUSED(itemKey)
return m_hasDevice ? QString() : QString("dbus-send --print-reply "
"--dest=com.deepin.dde.ControlCenter "
"/com/deepin/dde/ControlCenter "
"com.deepin.dde.ControlCenter.ShowModule "
"\"string:network\"");
return (m_hasDevice && !m_networkItem->isShowControlCenter())
? QString()
: QString("dbus-send --print-reply "
"--dest=com.deepin.dde.ControlCenter "
"/com/deepin/dde/ControlCenter "
"com.deepin.dde.ControlCenter.ShowModule "
"\"string:network\"");
}
const QString NetworkPlugin::itemContextMenu(const QString &itemKey)
@ -128,7 +130,7 @@ QWidget *NetworkPlugin::itemTipsWidget(const QString &itemKey)
QWidget *NetworkPlugin::itemPopupApplet(const QString &itemKey)
{
if (itemKey == NETWORK_KEY && m_hasDevice) {
if (itemKey == NETWORK_KEY && m_hasDevice && !m_networkItem->isShowControlCenter()) {
return m_networkItem->itemApplet();
}