Skip to content

Commit

Permalink
fix: The top bar of the trash has become a separate window
Browse files Browse the repository at this point in the history
Trash is not an empty event sent in a child thread, causing show to execute in the child thread

Log: The top bar of the trash has become a separate window
Bug: https://pms.uniontech.com/bug-view-263093.html
  • Loading branch information
liyigang1 committed Jul 5, 2024
1 parent 3b50664 commit 9c9ad56
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool TrashDirIterator::hasNext() const

if (d->dEnumerator) {
if (!d->once)
TrashHelper::instance()->onTrashNotEmptyState();
TrashHelper::instance()->trashNotEmpty();

d->once = true;
const QUrl &urlNext = d->dEnumerator->next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ void TrashHelper::onTrashEmptyState() {
}
}

void TrashHelper::trashNotEmpty()
{
emit trashNotEmptyState();
}

void TrashHelper::onTrashNotEmptyState()
{
isTrashEmpty = false;
Expand All @@ -345,4 +350,5 @@ void TrashHelper::initEvent()
bool resutl = dpfSignalDispatcher->subscribe("dfmplugin_trashcore", "signal_TrashCore_TrashStateChanged", this, &TrashHelper::onTrashStateChanged);
if (!resutl)
fmWarning() << "subscribe signal_TrashCore_TrashStateChanged from dfmplugin_trashcore is failed.";
connect(this, &TrashHelper::trashNotEmptyState, this, &TrashHelper::onTrashNotEmptyState, Qt::QueuedConnection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ class TrashHelper final : public QObject
bool customColumnRole(const QUrl &rootUrl, QList<DFMGLOBAL_NAMESPACE::ItemRoles> *roleList);
bool customRoleDisplayName(const QUrl &url, const DFMGLOBAL_NAMESPACE::ItemRoles role, QString *displayName);
void onTrashEmptyState();
void trashNotEmpty();

private Q_SLOTS:
void onTrashNotEmptyState();

Q_SIGNALS:
void trashNotEmptyState();

private:
void onTrashStateChanged();

Expand Down

0 comments on commit 9c9ad56

Please sign in to comment.