fix: 将多个文件拖动到回收站动作,没有一次性将所有文件移动到回收站问题

在TrashWidget中dropEvent中将movetotrash的参数改成qlist,然后一次性调用m_fileManagerInter->Trash将文件移动到回收站

Log: 修复将多个文件拖动到回收站后,再从回收站撤销只能恢复一个文件的问题
Bug: https://pms.uniontech.com/bug-view-113634.html
Influence: 拖动文件至回收站
Change-Id: I83d8b7863a08589462a60f9f51764286eb21e7db
This commit is contained in:
ut003441 2022-03-24 17:04:20 +08:00
parent 59b3628ba2
commit 0cab90e76d
2 changed files with 8 additions and 7 deletions

View File

@ -177,8 +177,8 @@ void TrashWidget::dropEvent(QDropEvent *e)
qApp->postEvent(this->parent(), new QEvent(QEvent::Leave));
const QMimeData *mime = e->mimeData();
for (auto url : mime->urls())
moveToTrash(url);
// 这里需要取到所有url然后一次性移动到回收站。
moveToTrash(mime->urls());
}
void TrashWidget::paintEvent(QPaintEvent *e)
@ -248,12 +248,13 @@ void TrashWidget::removeApp(const QString &appKey)
proc->deleteLater();
}
void TrashWidget::moveToTrash(const QUrl &url)
void TrashWidget::moveToTrash(const QList<QUrl> &urlList)
{
const QFileInfo info = url.toLocalFile();
QStringList argumentList;
argumentList << info.absoluteFilePath();
for (const QUrl &url : urlList) {
const QFileInfo& info = url.toLocalFile();
argumentList << info.absoluteFilePath();
}
m_fileManagerInter->Trash(argumentList);
}

View File

@ -67,7 +67,7 @@ protected:
private slots:
void removeApp(const QString &appKey);
void moveToTrash(const QUrl &url);
void moveToTrash(const QList<QUrl> &urlList);
private:
PopupControlWidget *m_popupApplet;