Skip to content

Commit

Permalink
Announce user's decision about DND (#870)
Browse files Browse the repository at this point in the history
This will be used in `pcmanfm-qt` to fix a small regression that was caused by showing DND menu after finishing DND (for Wayland).
  • Loading branch information
tsujan authored Jan 1, 2023
1 parent 2fd35a5 commit 3838d3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/folderview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,8 @@ void FolderView::childDropEvent(QDropEvent* e) {
break;
}

Q_EMIT dropIsDecided(action != Qt::IgnoreAction);

switch(action) {
case Qt::CopyAction:
FileOperation::copyFiles(srcPaths, destPath);
Expand All @@ -1670,8 +1672,13 @@ void FolderView::childDropEvent(QDropEvent* e) {
}
});
e->accept(); // prevent further event propagation
return;
}
}

QTimer::singleShot(0, view, [this] {
Q_EMIT dropIsDecided(true); // after finishing drop
});
}

bool FolderView::eventFilter(QObject* watched, QEvent* event) {
Expand Down
2 changes: 2 additions & 0 deletions src/folderview.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ private Q_SLOTS:

void inlineRenamed(const QString& oldName, const QString& newName);

void dropIsDecided(bool accepted);

private:

QAbstractItemView* view;
Expand Down

0 comments on commit 3838d3b

Please sign in to comment.