Skip to content

Commit

Permalink
Merge branch 'release/eagle' into release/eagle
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnson-zs authored Sep 20, 2024
2 parents 3d29dbc + af1625d commit 490543e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
35 changes: 25 additions & 10 deletions src/apps/dde-file-manager/commandparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <dfm-base/utils/fileutils.h>

#include <dfm-framework/event/event.h>
#include <dfm-framework/lifecycle/lifecycle.h>

#include <QCoreApplication>
#include <QCommandLineParser>
Expand Down Expand Up @@ -310,20 +311,34 @@ void CommandParser::openInUrls()
void CommandParser::openWindowWithUrl(const QUrl &url)
{
// Some args must require the plugin to be started in advance
static const QMap<QString, QString> kSchemeMap {
{ Global::Scheme::kSmb, "dfmplugin-smbbrowser" },
{ Global::Scheme::kTrash, "dfmplugin-trash" }
};
if (Q_UNLIKELY(kSchemeMap.keys().contains(url.scheme()))) {
QMap<QString, QString> schemeMap {};
QMap<QString, dpf::PluginMetaObjectPointer> schemePlugins;
dpf::LifeCycle::pluginMetaObjs([&schemeMap, &schemePlugins](dpf::PluginMetaObjectPointer ptr) {
Q_ASSERT(ptr);
const auto &data { ptr->customData() };
if (data.isEmpty())
return false;
auto schemes = ptr->customData().value("PluginSchemes").toStringList();
if (schemes.isEmpty())
return false;
for (auto scheme : schemes) {
schemeMap.insert(scheme, ptr->name());
schemePlugins.insert(scheme, ptr);
}
return true;
});

if (Q_UNLIKELY(schemeMap.keys().contains(url.scheme())
&& schemePlugins.value(url.scheme())->pluginState()!= dpf::PluginMetaObject::State::kLoaded)) {
static std::once_flag flag;
std::call_once(flag, [url]() {
const QString &name { kSchemeMap.value(url.scheme()) };
std::call_once(flag, [url, schemeMap]() {
const QString &name { schemeMap.value(url.scheme()) };
dpfSignalDispatcher->publish(GlobalEventType::kLoadPlugins, QStringList() << name);
});
}
auto flag = !DConfigManager::instance()->
value(kViewDConfName,
kOpenFolderWindowsInASeparateProcess, true).toBool();
auto flag = !DConfigManager::instance()->value(kViewDConfName,
kOpenFolderWindowsInASeparateProcess, true)
.toBool();
flag = flag ? false : isSet("n") || isSet("s") || isSet("sessionfile") || isSet("show-item");
dpfSignalDispatcher->publish(GlobalEventType::kOpenNewWindow, url, flag);
}
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/filemanager/core/dfmplugin-trash/trash.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"VisiableControl" : "trash",
"ReportName" : "Trash"
}
}]
}],
"PluginSchemes": ["trash"]
}
}
3 changes: 2 additions & 1 deletion src/plugins/filemanager/dfmplugin-smbbrowser/smbbrowser.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"ReportName" : "Network",
"Pos": 0
}]
}
},
"PluginSchemes": ["network", "smb", "ftp", "sftp"]
}

0 comments on commit 490543e

Please sign in to comment.