feat: Compatible with URL arguments

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe 2024-01-23 18:34:16 +08:00 committed by Comix
parent 6f2da75d7a
commit b5656472ef

View File

@ -540,10 +540,6 @@ double ApplicationService::scaleFactor() const noexcept
void ApplicationService::setScaleFactor(double value) noexcept void ApplicationService::setScaleFactor(double value) noexcept
{ {
if (value == m_scaleFactor) {
return;
}
auto storagePtr = m_storage.lock(); auto storagePtr = m_storage.lock();
if (!storagePtr) { if (!storagePtr) {
qCritical() << "broken storage."; qCritical() << "broken storage.";
@ -940,8 +936,21 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis
execList.insert(location, fields.first()); execList.insert(location, fields.first());
task.command.append(execList); task.command.append(execList);
} break; } break;
case 'F': case 'F': {
[[fallthrough]]; execList.remove(location);
auto it = execList.begin() + location;
for (const auto &field : fields) {
auto tmp = QUrl{field};
if (auto scheme = tmp.scheme(); scheme.startsWith("file") or scheme.isEmpty()) {
it = execList.insert(it, tmp.toLocalFile());
} else {
qWarning() << "shouldn't replace %F with an URL:" << field;
it = execList.insert(it, field);
}
++it;
}
task.command.append(std::move(execList));
} break;
case 'U': { case 'U': {
execList.removeAt(location); execList.removeAt(location);
auto it = execList.begin() + location; auto it = execList.begin() + location;