mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
network plugin support hide
Change-Id: I99dc55704052d050c96c25256017fe2f167ea0f4
This commit is contained in:
parent
ae785f6f9a
commit
dcc2da1130
Notes:
Deepin Code Review
2017-10-23 10:28:20 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Mon, 23 Oct 2017 10:28:19 +0800 Reviewed-on: https://cr.deepin.io/27286 Project: dde/dde-dock Branch: refs/heads/master
@ -253,7 +253,7 @@ void DockSettings::showDockSettingsMenu()
|
||||
|
||||
QAction *act = new QAction(display, this);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(enable);
|
||||
act->setChecked(!enable);
|
||||
act->setData(name);
|
||||
|
||||
m_hideSubMenu->addAction(act);
|
||||
|
@ -80,9 +80,16 @@ void NetworkPlugin::refershIcon(const QString &itemKey)
|
||||
item->refreshIcon();
|
||||
}
|
||||
|
||||
void NetworkPlugin::pluginStateSwitched()
|
||||
{
|
||||
m_pluginEnabled = !m_pluginEnabled;
|
||||
|
||||
m_refershTimer->start();
|
||||
}
|
||||
|
||||
bool NetworkPlugin::pluginIsDisable()
|
||||
{
|
||||
return true;
|
||||
return !m_pluginEnabled;
|
||||
}
|
||||
|
||||
const QString NetworkPlugin::itemCommand(const QString &itemKey)
|
||||
@ -187,24 +194,30 @@ void NetworkPlugin::refershDeviceItemVisible()
|
||||
|
||||
// qDebug() << hasWiredDevice << hasWirelessDevice;
|
||||
|
||||
for (auto item : m_deviceItemList)
|
||||
if (m_pluginEnabled)
|
||||
{
|
||||
switch (item->type())
|
||||
for (auto item : m_deviceItemList)
|
||||
{
|
||||
case NetworkDevice::Wireless:
|
||||
m_proxyInter->itemAdded(this, item->path());
|
||||
break;
|
||||
|
||||
case NetworkDevice::Wired:
|
||||
if (hasWiredDevice && (item->state() == NetworkDevice::Activated || !hasWirelessDevice))
|
||||
switch (item->type())
|
||||
{
|
||||
case NetworkDevice::Wireless:
|
||||
m_proxyInter->itemAdded(this, item->path());
|
||||
else
|
||||
m_proxyInter->itemRemoved(this, item->path());
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
case NetworkDevice::Wired:
|
||||
if (hasWiredDevice && (item->state() == NetworkDevice::Activated || !hasWirelessDevice))
|
||||
m_proxyInter->itemAdded(this, item->path());
|
||||
else
|
||||
m_proxyInter->itemRemoved(this, item->path());
|
||||
break;
|
||||
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto item : m_deviceItemList)
|
||||
m_proxyInter->itemRemoved(this, item->path());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
void init(PluginProxyInterface *proxyInter);
|
||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked);
|
||||
void refershIcon(const QString &itemKey);
|
||||
void pluginStateSwitched();
|
||||
bool pluginIsAllowDisable() { return true; }
|
||||
bool pluginIsDisable();
|
||||
const QString itemCommand(const QString &itemKey);
|
||||
@ -57,6 +58,7 @@ private slots:
|
||||
void contextMenuRequested();
|
||||
|
||||
private:
|
||||
bool m_pluginEnabled;
|
||||
NetworkManager *m_networkManager;
|
||||
QTimer *m_refershTimer;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user