Skip to content

Commit 3005b7a

Browse files
committed
defer dnd move operations while the thumbviewer is busy
also remove dead code and handle idempotent dir moves correctly mention in #28
1 parent afc9c2c commit 3005b7a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Phototonic.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -2029,8 +2029,6 @@ void Phototonic::deleteFromViewer(bool trash) {
20292029
return;
20302030
}
20312031
}
2032-
while (thumbsViewer->isBusy())
2033-
QThread::sleep(30);
20342032

20352033
QString trashError;
20362034
if (trash ? (Trash::moveToTrash(fullPath, trashError) == Trash::Success) :
@@ -2979,11 +2977,16 @@ void Phototonic::dropOp(Qt::KeyboardModifiers keyMods, bool dirOp, QString copyM
29792977
return;
29802978
}
29812979

2982-
if (destDir == Settings::currentDirectory) {
2980+
if (destDir == (dirOp ? QFileInfo(copyMoveDirPath).absolutePath() : Settings::currentDirectory)) {
29832981
msgBox.critical(tr("Error"), tr("Destination directory is the same as the source directory."));
29842982
return;
29852983
}
29862984

2985+
if (!Settings::isCopyOperation && thumbsViewer->isBusy()) { // defer, don't alter while the thumbsviewer is loading stuff
2986+
QTimer::singleShot(100, this, [=](){dropOp(keyMods, dirOp, copyMoveDirPath);});
2987+
return;
2988+
}
2989+
29872990
if (dirOp) {
29882991
QString baseName = copyMoveDirPath.section(QDir::separator(), -1);
29892992

0 commit comments

Comments
 (0)