forked from qt-creator/qt-creator
Fix OS X file drops from Finder
This is a workaround for QTBUG-40449. Change-Id: I24a3bfb78d49e94dcafb99ee6d6b36ef4c4299c5 Task-number: QTBUG-40449 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
@@ -57,6 +57,15 @@ QDebug operator<<(QDebug dbg, const Utils::FileName &c)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#ifdef Q_OS_OSX
|
||||
// for file drops from Finder, working around QTBUG-40449
|
||||
namespace Utils {
|
||||
namespace Internal {
|
||||
extern QUrl filePathUrl(const QUrl &url);
|
||||
} // Internal
|
||||
} // Utils
|
||||
#endif
|
||||
|
||||
namespace Utils {
|
||||
|
||||
/*! \class Utils::FileUtils
|
||||
@@ -743,7 +752,12 @@ static bool isFileDrop(const QMimeData *d, QList<FileDropSupport::FileSpec> *fil
|
||||
bool hasFiles = false;
|
||||
const QList<QUrl>::const_iterator cend = urls.constEnd();
|
||||
for (QList<QUrl>::const_iterator it = urls.constBegin(); it != cend; ++it) {
|
||||
const QString fileName = it->toLocalFile();
|
||||
QUrl url = *it;
|
||||
#ifdef Q_OS_OSX
|
||||
// for file drops from Finder, working around QTBUG-40449
|
||||
url = Internal::filePathUrl(url);
|
||||
#endif
|
||||
const QString fileName = url.toLocalFile();
|
||||
if (!fileName.isEmpty()) {
|
||||
hasFiles = true;
|
||||
if (files)
|
||||
|
||||
Reference in New Issue
Block a user