mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
feat: 允许锁定任务栏上的图标防止被拖拽删除
需要通过命令设置gsettings set com.deepin.dde.dock.module.app removeable false Log: Task: https://pms.uniontech.com/zentao/task-view-60374.html Issue: Fixes #338 Change-Id: Idb76a8e28bbd4fae7db5870d07d3432fe4029029
This commit is contained in:
parent
7bd1bf6572
commit
1d99b3e5da
@ -122,6 +122,8 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
|||||||
|
|
||||||
connect(GSettingsByApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
connect(GSettingsByApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||||
connect(GSettingsByDockApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
connect(GSettingsByDockApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||||
|
connect(GSettingsByActiveApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||||
|
|
||||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged);
|
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged);
|
||||||
|
|
||||||
connect(m_refershIconTimer, &QTimer::timeout, this, [ = ]() {
|
connect(m_refershIconTimer, &QTimer::timeout, this, [ = ]() {
|
||||||
@ -305,6 +307,11 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e)
|
|||||||
|
|
||||||
m_lastclickTimes = curTimestamp;
|
m_lastclickTimes = curTimestamp;
|
||||||
|
|
||||||
|
// 鼠标在图标外边松开时,没必要响应点击操作
|
||||||
|
const QRect rect { QPoint(0, 0), size()};
|
||||||
|
if (!rect.contains(mapFromGlobal(QCursor::pos())))
|
||||||
|
return;
|
||||||
|
|
||||||
if (e->button() == Qt::MiddleButton) {
|
if (e->button() == Qt::MiddleButton) {
|
||||||
m_itemEntryInter->NewInstance(QX11Info::getTimestamp());
|
m_itemEntryInter->NewInstance(QX11Info::getTimestamp());
|
||||||
|
|
||||||
|
@ -54,6 +54,12 @@ static QGSettings *GSettingsByLaunch()
|
|||||||
return &settings;
|
return &settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QGSettings *GSettingsByApp()
|
||||||
|
{
|
||||||
|
static QGSettings settings("com.deepin.dde.dock.module.app");
|
||||||
|
return &settings;
|
||||||
|
}
|
||||||
|
|
||||||
MainPanelControl::MainPanelControl(QWidget *parent)
|
MainPanelControl::MainPanelControl(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_mainPanelLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
, m_mainPanelLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||||
@ -652,7 +658,8 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
startDrag(item);
|
if (!GSettingsByApp()->keys().contains("removeable") || GSettingsByApp()->get("removeable").toBool())
|
||||||
|
startDrag(item);
|
||||||
|
|
||||||
return QWidget::eventFilter(watched, event);
|
return QWidget::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
@ -724,7 +731,7 @@ void MainPanelControl::startDrag(DockItem *item)
|
|||||||
static_cast<QGraphicsView *>(m_appDragWidget)->viewport()->installEventFilter(this);
|
static_cast<QGraphicsView *>(m_appDragWidget)->viewport()->installEventFilter(this);
|
||||||
} else {
|
} else {
|
||||||
appDrag->QDrag::setPixmap(dragPix);
|
appDrag->QDrag::setPixmap(dragPix);
|
||||||
}
|
}
|
||||||
|
|
||||||
drag = appDrag;
|
drag = appDrag;
|
||||||
drag->setHotSpot(dragPix.rect().center() / dragPix.devicePixelRatioF());
|
drag->setHotSpot(dragPix.rect().center() / dragPix.devicePixelRatioF());
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
<description>
|
<description>
|
||||||
Control Module Enable
|
Control Module Enable
|
||||||
</description>
|
</description>
|
||||||
|
</key>
|
||||||
|
<key type="b" name="removeable">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>App Removeable</summary>
|
||||||
|
<description>
|
||||||
|
Control App Removeable
|
||||||
|
</description>
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
<schema path="/com/deepin/dde/dock/disableplugins/" id="com.deepin.dde.dock.disableplugins" gettext-domain="DDE">
|
<schema path="/com/deepin/dde/dock/disableplugins/" id="com.deepin.dde.dock.disableplugins" gettext-domain="DDE">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user