Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: After enabling the long file name function, delete files to the trash. Right click on the attribute window and there is marked information that can be edited #2028

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/plugins/filemanager/core/dfmplugin-trash/trash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ void Trash::followEvents()
dpfHookSequence->follow("dfmplugin_fileoperations", "hook_Operation_OpenFileInPlugin", TrashFileHelper::instance(), &TrashFileHelper::openFileInPlugin);

dpfHookSequence->follow("dfmplugin_utils", "hook_OpenWith_DisabledOpenWithWidget", TrashFileHelper::instance(), &TrashFileHelper::disableOpenWidgetWidget);

// register to tag
auto searchPlugin { DPF_NAMESPACE::LifeCycle::pluginMetaObj("dfmplugin-tag") };
if (searchPlugin && searchPlugin->pluginState() == DPF_NAMESPACE::PluginMetaObject::kStarted) {
dpfHookSequence->follow("dfmplugin_tag", "hook_CanTaged", TrashFileHelper::instance(), &TrashFileHelper::handleCanTag);
} else {
connect(
DPF_NAMESPACE::Listener::instance(), &DPF_NAMESPACE::Listener::pluginStarted, this, [](const QString &iid, const QString &name) {
Q_UNUSED(iid)
if (name == "dfmplugin-tag")
dpfHookSequence->follow("dfmplugin_tag", "hook_CanTaged", TrashFileHelper::instance(), &TrashFileHelper::handleCanTag);
},
Qt::DirectConnection);
}
}

void Trash::bindWindows()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,14 @@

return true;
}

bool TrashFileHelper::handleCanTag(const QUrl &url, bool *canTag)

Check warning on line 145 in src/plugins/filemanager/core/dfmplugin-trash/utils/trashfilehelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'handleCanTag' is never used.
{
if (url.scheme() == scheme() || FileUtils::isTrashFile(url)) {
if (canTag)
*canTag = false;
return true;
}

return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TrashFileHelper : public QObject
bool openFileInPlugin(quint64 windowId, const QList<QUrl> urls);
bool blockPaste(quint64 winId, const QList<QUrl> &fromUrls, const QUrl &to);
bool disableOpenWidgetWidget(const QUrl &url, bool *result);
bool handleCanTag(const QUrl &url, bool *canTag);

private:
explicit TrashFileHelper(QObject *parent = nullptr);
Expand Down
Loading