mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix:The app is not added to the taskbar. A blank area appears in the taskbar.
拖拽应用偶尔会没有添加到任务栏,任务栏出现空白区域。(bug:12044)
This commit is contained in:
parent
36376dfbd1
commit
07a53d1c16
@ -334,40 +334,6 @@ void MainPanelControl::moveItem(DockItem *sourceItem, DockItem *targetItem)
|
||||
|
||||
void MainPanelControl::dragEnterEvent(QDragEnterEvent *e)
|
||||
{
|
||||
DockItem *sourceItem = qobject_cast<DockItem *>(e->source());
|
||||
if (sourceItem) {
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
// 拖app到dock上
|
||||
const char *RequestDockKey = "RequestDock";
|
||||
const char *RequestDockKeyFallback = "text/plain";
|
||||
const char *DesktopMimeType = "application/x-desktop";
|
||||
|
||||
m_draggingMimeKey = e->mimeData()->formats().contains(RequestDockKey) ? RequestDockKey : RequestDockKeyFallback;
|
||||
|
||||
// dragging item is NOT a desktop file
|
||||
if (QMimeDatabase().mimeTypeForFile(e->mimeData()->data(m_draggingMimeKey)).name() != DesktopMimeType) {
|
||||
m_draggingMimeKey.clear();
|
||||
qDebug() << "dragging item is NOT a desktop file";
|
||||
return;
|
||||
}
|
||||
|
||||
//如果当前从桌面拖拽的的app是trash,则不能放入app任务栏中
|
||||
QString str = "file://";
|
||||
//启动器
|
||||
QString str_t = "";
|
||||
|
||||
str.append(QStandardPaths::locate(QStandardPaths::DesktopLocation, "dde-trash.desktop"));
|
||||
str_t.append(QStandardPaths::locate(QStandardPaths::ApplicationsLocation, "dde-trash.desktop"));
|
||||
|
||||
if ((str == e->mimeData()->data(m_draggingMimeKey)) || (str_t == e->mimeData()->data(m_draggingMimeKey)))
|
||||
return;
|
||||
|
||||
if (m_delegate && m_delegate->appIsOnDock(e->mimeData()->data(m_draggingMimeKey)))
|
||||
return;
|
||||
|
||||
e->accept();
|
||||
}
|
||||
|
||||
@ -473,6 +439,46 @@ void MainPanelControl::handleDragMove(QDragMoveEvent *e, bool isFilter)
|
||||
|
||||
void MainPanelControl::dragMoveEvent(QDragMoveEvent *e)
|
||||
{
|
||||
DockItem *sourceItem = qobject_cast<DockItem *>(e->source());
|
||||
if (sourceItem) {
|
||||
handleDragMove(e, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// 拖app到dock上
|
||||
const char *RequestDockKey = "RequestDock";
|
||||
const char *RequestDockKeyFallback = "text/plain";
|
||||
const char *DesktopMimeType = "application/x-desktop";
|
||||
auto DragmineData=e->mimeData();
|
||||
|
||||
m_draggingMimeKey = DragmineData->formats().contains(RequestDockKey) ? RequestDockKey : RequestDockKeyFallback;
|
||||
|
||||
// dragging item is NOT a desktop file
|
||||
if (QMimeDatabase().mimeTypeForFile(DragmineData->data(m_draggingMimeKey)).name() != DesktopMimeType) {
|
||||
m_draggingMimeKey.clear();
|
||||
e->setAccepted(false);
|
||||
qDebug() << "dragging item is NOT a desktop file";
|
||||
return;
|
||||
}
|
||||
|
||||
//如果当前从桌面拖拽的的app是trash,则不能放入app任务栏中
|
||||
QString str = "file://";
|
||||
//启动器
|
||||
QString str_t = "";
|
||||
|
||||
str.append(QStandardPaths::locate(QStandardPaths::DesktopLocation, "dde-trash.desktop"));
|
||||
str_t.append(QStandardPaths::locate(QStandardPaths::ApplicationsLocation, "dde-trash.desktop"));
|
||||
|
||||
if ((str == DragmineData->data(m_draggingMimeKey)) || (str_t == DragmineData->data(m_draggingMimeKey))) {
|
||||
e->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_delegate && m_delegate->appIsOnDock(DragmineData->data(m_draggingMimeKey))) {
|
||||
e->setAccepted(false);
|
||||
return;
|
||||
}
|
||||
|
||||
handleDragMove(e, false);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user