@@ -68,34 +68,32 @@ void MonitorPlugin::init(PluginProxyInterface *proxyInter)
68
68
69
69
QWidget *MonitorPlugin::itemWidget (const QString &itemKey)
70
70
{
71
- if (! common::systemInfo (). isOldVersion ()) {
71
+ # ifdef DDE_DOCK_NEW_VERSION
72
72
// if (itemKey == "system-monitor")
73
73
// return m_itemWidget;
74
- } else {
74
+ # else
75
75
if (itemKey == " system-monitor" )
76
76
return m_itemWidget;
77
- }
77
+ # endif
78
78
return nullptr ;
79
79
}
80
80
81
81
void MonitorPlugin::pluginStateSwitched ()
82
82
{
83
- if ( common::systemInfo (). isOldVersion ()) {
84
- bool pluginState = !m_proxyInter->getValue (this , constantVal::PLUGIN_STATE_KEY, false ).toBool ();
85
- m_proxyInter->saveValue (this , constantVal::PLUGIN_STATE_KEY, pluginState);
83
+ # ifndef DDE_DOCK_NEW_VERSION
84
+ bool pluginState = !m_proxyInter->getValue (this , constantVal::PLUGIN_STATE_KEY, false ).toBool ();
85
+ m_proxyInter->saveValue (this , constantVal::PLUGIN_STATE_KEY, pluginState);
86
86
87
- refreshPluginItemsVisible ();
88
- }
87
+ refreshPluginItemsVisible ();
88
+ # endif
89
89
}
90
90
91
+ #ifndef DDE_DOCK_NEW_VERSION
91
92
bool MonitorPlugin::pluginIsDisable ()
92
93
{
93
- if (!common::systemInfo ().isOldVersion ()) {
94
- return PluginsItemInterface::pluginIsDisable ();
95
- } else {
96
- return !m_proxyInter->getValue (this , constantVal::PLUGIN_STATE_KEY, false ).toBool ();
97
- }
94
+ return !m_proxyInter->getValue (this , constantVal::PLUGIN_STATE_KEY, false ).toBool ();
98
95
}
96
+ #endif
99
97
100
98
QWidget *MonitorPlugin::itemTipsWidget (const QString &itemKey)
101
99
{
@@ -264,26 +262,28 @@ void MonitorPlugin::loadPlugin()
264
262
265
263
m_itemWidget = new MonitorPluginButtonWidget;
266
264
265
+ #ifdef DDE_DOCK_NEW_VERSION
266
+ // 新版本dde-dock不需要应用自己判断是否显示插件,只添加即可
267
+ m_proxyInter->itemAdded (this , pluginName ());
268
+ #else
267
269
if (!m_isFirstInstall) {
268
- if (!common::systemInfo ().isOldVersion ()) {
270
+ // 非初始状态
271
+ if (m_proxyInter->getValue (this , constantVal::PLUGIN_STATE_KEY, true ).toBool ()) {
269
272
m_proxyInter->itemAdded (this , pluginName ());
270
273
} else {
271
- // 非初始状态
272
- if (m_proxyInter->getValue (this , constantVal::PLUGIN_STATE_KEY, true ).toBool ()) {
273
- m_proxyInter->itemAdded (this , pluginName ());
274
- } else {
275
- m_proxyInter->saveValue (this , constantVal::PLUGIN_STATE_KEY, false );
276
- m_proxyInter->itemRemoved (this , pluginName ());
277
- }
274
+ m_proxyInter->saveValue (this , constantVal::PLUGIN_STATE_KEY, false );
275
+ m_proxyInter->itemRemoved (this , pluginName ());
278
276
}
279
277
} else {
280
278
m_proxyInter->saveValue (this , constantVal::PLUGIN_STATE_KEY, false );
281
279
m_proxyInter->itemRemoved (this , pluginName ());
282
280
}
281
+ #endif
283
282
284
283
displayModeChanged (displayMode ());
285
284
}
286
285
286
+ #ifndef DDE_DOCK_NEW_VERSION
287
287
void MonitorPlugin::refreshPluginItemsVisible ()
288
288
{
289
289
if (pluginIsDisable ()) {
@@ -296,6 +296,7 @@ void MonitorPlugin::refreshPluginItemsVisible()
296
296
m_proxyInter->itemAdded (this , pluginName ());
297
297
}
298
298
}
299
+ #endif
299
300
300
301
void MonitorPlugin::initPluginState ()
301
302
{
0 commit comments