From 9dc9273afd578da0e1718a2a5de8c80abc22f5f1 Mon Sep 17 00:00:00 2001 From: weizhixiang Date: Fri, 19 Feb 2021 11:13:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=92=E4=BB=B6=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=92=8C=E6=89=98=E7=9B=98=E5=8C=BA=E5=9F=9F=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加gsettings配置作为插件区域应用和托盘区域系统应用右键菜单的启用、禁用开关,修改配置立即生效 Log: 插件区域和托盘区域系统应用右键菜单启用开关,修改配置立即生效 Change-Id: I7f767bc86cdd5d14e02807858bc82cb57a543174 --- frame/item/pluginsitem.cpp | 14 ++++- .../com.deepin.dde.dock.module.gschema.xml | 56 +++++++++++++++++++ plugins/tray/system-trays/systemtrayitem.cpp | 2 +- 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/frame/item/pluginsitem.cpp b/frame/item/pluginsitem.cpp index d0b4fd790..796764c6d 100644 --- a/frame/item/pluginsitem.cpp +++ b/frame/item/pluginsitem.cpp @@ -161,8 +161,18 @@ void PluginsItem::mousePressEvent(QMouseEvent *e) if (e->button() == Qt::LeftButton) MousePressPoint = e->pos(); - // context menu will handle in DockItem - DockItem::mousePressEvent(e); + //handle context menu + m_popupTipsDelayTimer->stop(); + hideNonModel(); + + if (e->button() == Qt::RightButton) { + if (perfectIconRect().contains(e->pos())) { + return (m_gsettings && m_gsettings->get("menuEnable").toBool()) ? showContextMenu() : void(); + } + } + + // same as e->ignore above + QWidget::mousePressEvent(e); } void PluginsItem::mouseMoveEvent(QMouseEvent *e) diff --git a/gschema/com.deepin.dde.dock.module.gschema.xml b/gschema/com.deepin.dde.dock.module.gschema.xml index acc0ccf65..068ae11f5 100644 --- a/gschema/com.deepin.dde.dock.module.gschema.xml +++ b/gschema/com.deepin.dde.dock.module.gschema.xml @@ -105,6 +105,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + @@ -121,6 +128,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + @@ -137,6 +151,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + @@ -153,6 +174,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + @@ -176,6 +204,13 @@ Show TimeToFull + + true + Menu Enable + + Control Menu Enable + + @@ -192,6 +227,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + @@ -208,6 +250,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + @@ -224,6 +273,13 @@ Control Module Enable + + true + Menu Enable + + Control Menu Enable + + diff --git a/plugins/tray/system-trays/systemtrayitem.cpp b/plugins/tray/system-trays/systemtrayitem.cpp index 907c54fe1..8870d799c 100644 --- a/plugins/tray/system-trays/systemtrayitem.cpp +++ b/plugins/tray/system-trays/systemtrayitem.cpp @@ -239,7 +239,7 @@ void SystemTrayItem::mousePressEvent(QMouseEvent *event) if (event->button() == Qt::RightButton) { if (perfectIconRect().contains(event->pos(), true)) { - return showContextMenu(); + return (m_gsettings && m_gsettings->get("menuEnable").toBool()) ? showContextMenu() : void(); } }