Allow drop action only on transfer list

Now drop action is only allowed on transfer list, previously it was on main window.
Having drop action on the whole main window is not preferred because it could allow drop action
on other unrelated widgets, such as execution log or RSS widget which is unexpected behavior.

PR #21332.
This commit is contained in:
Chocobo1
2024-09-30 16:59:57 +08:00
committed by GitHub
parent 8b2d8f3afd
commit 10eb921d70
6 changed files with 104 additions and 91 deletions

View File

@@ -47,6 +47,7 @@
#include <QStringView>
#include <QSysInfo>
#include "base/net/downloadmanager.h"
#include "base/path.h"
#include "base/unicodestrings.h"
#include "base/utils/string.h"
@@ -212,6 +213,14 @@ bool Utils::Misc::isPreviewable(const Path &filePath)
return multimediaExtensions.contains(filePath.extension().toUpper());
}
bool Utils::Misc::isTorrentLink(const QString &str)
{
return str.startsWith(u"magnet:", Qt::CaseInsensitive)
|| str.endsWith(TORRENT_FILE_EXTENSION, Qt::CaseInsensitive)
|| (!str.startsWith(u"file:", Qt::CaseInsensitive)
&& Net::DownloadManager::hasSupportedScheme(str));
}
QString Utils::Misc::userFriendlyDuration(const qlonglong seconds, const qlonglong maxCap, const TimeResolution resolution)
{
if (seconds < 0)

View File

@@ -78,6 +78,7 @@ namespace Utils::Misc
qint64 sizeInBytes(qreal size, SizeUnit unit);
bool isPreviewable(const Path &filePath);
bool isTorrentLink(const QString &str);
// Take a number of seconds and return a user-friendly
// time duration like "1d 2h 10m".