diff --git a/plugins/power/powerplugin.cpp b/plugins/power/powerplugin.cpp index 1a93de74e..473ab772c 100644 --- a/plugins/power/powerplugin.cpp +++ b/plugins/power/powerplugin.cpp @@ -153,11 +153,11 @@ QIcon PowerPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorTy PluginFlags PowerPlugin::flags() const { - // 电池插件只在任务栏上面展示,不在快捷面板展示,并且可以拖动,可以在其前面插入其他插件,可以在控制中心设置是否显示隐藏 + // 电池插件只在任务栏上面展示,不在快捷面板展示,并且可以拖动,可以在其前面插入其他插件,不能在控制中心设置是否显示隐藏 return PluginFlag::Type_Common | PluginFlag::Attribute_CanDrag | PluginFlag::Attribute_CanInsert - | PluginFlag::Attribute_CanSetting; + | PluginFlag::Attribute_ForceDock; } void PowerPlugin::updateBatteryVisible() diff --git a/plugins/shutdown/shutdownplugin.cpp b/plugins/shutdown/shutdownplugin.cpp index 1bd30f47c..f0c3256ed 100644 --- a/plugins/shutdown/shutdownplugin.cpp +++ b/plugins/shutdown/shutdownplugin.cpp @@ -63,7 +63,7 @@ const QString ShutdownPlugin::pluginName() const const QString ShutdownPlugin::pluginDisplayName() const { - return tr("Plugged In"); + return tr("Power"); } QWidget *ShutdownPlugin::itemWidget(const QString &itemKey) @@ -79,7 +79,7 @@ QWidget *ShutdownPlugin::itemTipsWidget(const QString &itemKey) // reset text every time to avoid size of LabelWidget not change after // font size be changed in ControlCenter - m_tipsLabel->setText(tr("Plugged In")); + m_tipsLabel->setText(tr("Power")); return m_tipsLabel.data(); } @@ -102,8 +102,6 @@ void ShutdownPlugin::init(PluginProxyInterface *proxyInter) void ShutdownPlugin::pluginStateSwitched() { m_proxyInter->saveValue(this, PLUGIN_STATE_KEY, !m_proxyInter->getValue(this, PLUGIN_STATE_KEY, true).toBool()); - - refreshPluginItemsVisible(); } bool ShutdownPlugin::pluginIsDisable() @@ -290,11 +288,6 @@ void ShutdownPlugin::setSortKey(const QString &itemKey, const int order) m_proxyInter->saveValue(this, key, order); } -void ShutdownPlugin::pluginSettingsChanged() -{ - refreshPluginItemsVisible(); -} - QIcon ShutdownPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) { if (dockPart == DockPart::DCCSetting) { @@ -402,16 +395,3 @@ bool ShutdownPlugin::checkSwap() return hasSwap; } - -void ShutdownPlugin::refreshPluginItemsVisible() -{ - if (pluginIsDisable()) { - m_proxyInter->itemRemoved(this, pluginName()); - } else { - if (!m_pluginLoaded) { - loadPlugin(); - return; - } - m_proxyInter->itemAdded(this, pluginName()); - } -} diff --git a/plugins/shutdown/shutdownplugin.h b/plugins/shutdown/shutdownplugin.h index bbc7ecdb4..5ea1a1e80 100644 --- a/plugins/shutdown/shutdownplugin.h +++ b/plugins/shutdown/shutdownplugin.h @@ -60,7 +60,6 @@ public: int itemSortKey(const QString &itemKey) override; void setSortKey(const QString &itemKey, const int order) override; - void pluginSettingsChanged() override; QIcon icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) override; PluginFlags flags() const override; @@ -108,7 +107,6 @@ public: private: void loadPlugin(); bool checkSwap(); - void refreshPluginItemsVisible(); private: bool m_pluginLoaded;