diff --git a/debian/changelog b/debian/changelog index 6c4f04e..be07e57 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libfm-qt (0.14.1-9ubuntu3) eoan; urgency=medium + + * Fixed DND not working for mtp:// mounted folders + + -- Raman Sarda Sat, 17 Aug 2019 10:11:52 +0530 + libfm-qt (0.14.1-9ubuntu2) eoan; urgency=medium * Rebuild against Qt 5.12.4. diff --git a/debian/patches/fix-dnd-mtp.patch b/debian/patches/fix-dnd-mtp.patch new file mode 100644 index 0000000..277ead9 --- /dev/null +++ b/debian/patches/fix-dnd-mtp.patch @@ -0,0 +1,48 @@ +Description: Fix DND for MTP mounted folders +Author: Tsu Jan +Bug-Upstream: https://github.com/lxqt/pcmanfm-qt/issues/301 +Applied-Upstream: https://github.com/lxqt/libfm-qt/commit/7de18bc89b9b47f66de54a7e347bf8d391d44a48 +Last-Update: 2019-08-17 +--- a/src/foldermodel.cpp ++++ b/src/foldermodel.cpp +@@ -384,7 +384,7 @@ QStringList FolderModel::mimeTypes() con + // the real implementation is in FolderView::childDropEvent(). + types << "XdndDirectSave0"; + types << "text/uri-list"; +- // types << "x-special/gnome-copied-files"; ++ types << QStringLiteral("libfm/files"); // see FolderModel::mimeData() below + return types; + } + +@@ -407,6 +407,9 @@ QMimeData* FolderModel::mimeData(const Q + } + } + data->setData("text/uri-list", urilist); ++ // NOTE: The mimetype "text/uri-list" changes the list in QMimeData::setData() to get URLs ++ // but some protocols (like MTP) may need the original list to query file info. ++ data->setData(QStringLiteral("libfm/files"), urilist); + + return data; + } +@@ -442,10 +445,19 @@ bool FolderModel::dropMimeData(const QMi + destPath = path(); + } + ++ Fm::FilePathList srcPaths; ++ // try to get paths from the original data ++ if(data->hasFormat(QStringLiteral("libfm/files"))) { ++ QByteArray _data = data->data(QStringLiteral("libfm/files")); ++ srcPaths = pathListFromUriList(_data.data()); ++ } ++ if(srcPaths.empty() && data->hasUrls()) { ++ srcPaths = Fm::pathListFromQUrls(data->urls()); ++ } ++ + // FIXME: should we put this in dropEvent handler of FolderView instead? +- if(data->hasUrls()) { ++ if(!srcPaths.empty()) { + //qDebug("drop action: %d", action); +- auto srcPaths = pathListFromQUrls(data->urls()); + switch(action) { + case Qt::CopyAction: + FileOperation::copyFiles(srcPaths, destPath); \ No newline at end of file diff --git a/debian/patches/series b/debian/patches/series index dbe41e9..b8ec5d7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ fix-license-headers.patch dont-ignore-crea-del-sequences.patch workaround-glib-recursive-moving-error.patch workaround-missed-file-monitoring.patch +fix-dnd-mtp.patch