Skip to content

Commit

Permalink
fix: Unable to drag files to disc
Browse files Browse the repository at this point in the history
Determine if there is a drop error

Log: Unable to drag files to disc
Bug: https://pms.uniontech.com/bug-view-260801.html
  • Loading branch information
liyigang1 committed Jun 26, 2024
1 parent 88e8834 commit 07a7588
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dfm-base/interfaces/fileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ bool DFMBASE_NAMESPACE::FileInfoPrivate::canDrop()

if (!q->isAttributes(OptInfoType::kIsSymLink)) {
const bool isDesktop = q->nameOf(NameInfoType::kMimeTypeName) == Global::Mime::kTypeAppXDesktop;
return q->isAttributes(OptInfoType::kIsDir) || isDesktop;
return (q->isAttributes(OptInfoType::kIsDir) && q->isAttributes(OptInfoType::kIsWritable)) || isDesktop;
}

FileInfoPointer info = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool DragDropHelper::dragMove(QDragMoveEvent *event)
return true;

QUrl toUrl = hoverFileInfo->urlOf(UrlInfoType::kUrl);
if (!checkTargetEnable(toUrl) || !hoverFileInfo->isAttributes(OptInfoType::kIsWritable)) {
if (!checkTargetEnable(toUrl) || !hoverFileInfo->canAttributes(CanableInfoType::kCanDrop)) {
event->ignore();
currentHoverIndexUrl = toUrl;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,19 @@ bool MasteredMediaFileInfo::canAttributes(const CanableInfoType type) const

Qt::DropActions MasteredMediaFileInfo::supportedOfAttributes(const SupportedType type) const
{
if (type == SupportType::kDrop)
if (type == SupportType::kDrop) {
if (!OpticalHelper::isBurnEnabled())
return Qt::IgnoreAction;

if (isAttributes(OptInfoType::kIsWritable)) {
return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
}

if (d->canDrop()) {
return Qt::CopyAction | Qt::MoveAction;
}
return Qt::IgnoreAction;
}
return ProxyFileInfo::supportedOfAttributes(type);
}

Expand Down

0 comments on commit 07a7588

Please sign in to comment.