Skip to content

Commit

Permalink
fix: [workspace] drag file to weixin failed in some platform.
Browse files Browse the repository at this point in the history
1. If not set the mimeData text, the weixin will ignore the drag event.
2. The weixin not override the drag event, it use the default of qt5.15.
3. So, file manager set the text.

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-248591.html
  • Loading branch information
GongHeng2017 committed Apr 1, 2024
1 parent 522875a commit fb41e0f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ DFMBASE_USE_NAMESPACE
DFMGLOBAL_USE_NAMESPACE
using namespace ddplugin_canvas;

inline constexpr char kCanvaMimeData[] { "CanvaMimeData" };

CanvasProxyModelPrivate::CanvasProxyModelPrivate(CanvasProxyModel *qq)
: QObject(qq), q(qq)
{
Expand Down Expand Up @@ -715,7 +717,7 @@ QMimeData *CanvasProxyModel::mimeData(const QModelIndexList &indexes) const
} else {
mimedt->setUrls(urls);
}

mimedt->setText(kCanvaMimeData);
// set user id
SysInfoUtils::setMimeDataUserId(mimedt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
DFMBASE_USE_NAMESPACE
using namespace ddplugin_organizer;

inline constexpr char kCollectionMimeData[] { "collectionMimeData" };

CollectionModelPrivate::CollectionModelPrivate(CollectionModel *qq)

Check warning on line 27 in src/plugins/desktop/ddplugin-organizer/models/collectionmodel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Member variable 'CollectionModelPrivate::q' is not initialized in the constructor.
: QObject(qq), q(qq)
{
Expand Down Expand Up @@ -482,9 +484,8 @@ QMimeData *CollectionModel::mimeData(const QModelIndexList &indexes) const

for (const QModelIndex &idx : indexes)
urls << fileUrl(idx);

mm->setText(kCollectionMimeData);
mm->setUrls(urls);

// set user id
SysInfoUtils::setMimeDataUserId(mm);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ DFMGLOBAL_USE_NAMESPACE
DFMBASE_USE_NAMESPACE
using namespace dfmplugin_workspace;

inline constexpr char kFileManagerMimeData[] { "fileManagerMimeData" };

FileViewModel::FileViewModel(QAbstractItemView *parent)
: QAbstractItemModel(parent)

Expand Down Expand Up @@ -452,7 +454,7 @@ QMimeData *FileViewModel::mimeData(const QModelIndexList &indexes) const
}

QMimeData *data = new QMimeData();

data->setText(kFileManagerMimeData);
data->setUrls(urls);
SysInfoUtils::setMimeDataUserId(data);

Expand Down

0 comments on commit fb41e0f

Please sign in to comment.