fix: incorrect behavior when parse and launch
Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
parent
3988e0c526
commit
ce2148e5cd
@ -377,6 +377,7 @@ LaunchTask ApplicationService::unescapeExec(const QString &str, const QStringLis
|
|||||||
auto matcher = re.match(str);
|
auto matcher = re.match(str);
|
||||||
if (!matcher.hasMatch()) {
|
if (!matcher.hasMatch()) {
|
||||||
task.command.append(std::move(execList));
|
task.command.append(std::move(execList));
|
||||||
|
task.Resources.emplace_back(QString{""}); // mapReduce should run once at least
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ bool isInvalidLocaleString(const QString &str) noexcept
|
|||||||
constexpr auto Language = R"((?:[a-z]+))"; // language of locale postfix. eg.(en, zh)
|
constexpr auto Language = R"((?:[a-z]+))"; // language of locale postfix. eg.(en, zh)
|
||||||
constexpr auto Country = R"((?:_[A-Z]+))"; // country of locale postfix. eg.(US, CN)
|
constexpr auto Country = R"((?:_[A-Z]+))"; // country of locale postfix. eg.(US, CN)
|
||||||
constexpr auto Encoding = R"((?:\.[0-9A-Z-]+))"; // encoding of locale postfix. eg.(UFT-8)
|
constexpr auto Encoding = R"((?:\.[0-9A-Z-]+))"; // encoding of locale postfix. eg.(UFT-8)
|
||||||
constexpr auto Modifier = R"((?:@[a-z=;]+))"; // modifier of locale postfix. eg.(euro;collation=traditional)
|
constexpr auto Modifier = R"((?:@[a-zA-Z=;]+))"; // modifier of locale postfix. eg.(euro;collation=traditional)
|
||||||
const static auto validKey = QString(R"(^%1%2?%3?%4?$)").arg(Language, Country, Encoding, Modifier);
|
const static auto validKey = QString(R"(^%1%2?%3?%4?$)").arg(Language, Country, Encoding, Modifier);
|
||||||
// example: https://regex101.com/r/hylOay/2
|
// example: https://regex101.com/r/hylOay/2
|
||||||
static const QRegularExpression _re = []() -> QRegularExpression {
|
static const QRegularExpression _re = []() -> QRegularExpression {
|
||||||
@ -75,7 +75,7 @@ private:
|
|||||||
void Parser::skip() noexcept
|
void Parser::skip() noexcept
|
||||||
{
|
{
|
||||||
while (!m_stream.atEnd() and (m_line.startsWith('#') or m_line.isEmpty())) {
|
while (!m_stream.atEnd() and (m_line.startsWith('#') or m_line.isEmpty())) {
|
||||||
m_line = m_stream.readLine();
|
m_line = m_stream.readLine().trimmed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +137,9 @@ DesktopErrorCode Parser::addGroup(Groups &ret) noexcept
|
|||||||
m_line.clear();
|
m_line.clear();
|
||||||
while (!m_stream.atEnd() && !m_line.startsWith('[')) {
|
while (!m_stream.atEnd() && !m_line.startsWith('[')) {
|
||||||
skip();
|
skip();
|
||||||
|
if (m_line.startsWith('[')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
auto err = addEntry(group);
|
auto err = addEntry(group);
|
||||||
if (err != DesktopErrorCode::NoError) {
|
if (err != DesktopErrorCode::NoError) {
|
||||||
return err;
|
return err;
|
||||||
@ -198,8 +201,13 @@ DesktopErrorCode Parser::addEntry(Groups::iterator &group) noexcept
|
|||||||
return DesktopErrorCode::NoError;
|
return DesktopErrorCode::NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keyIt == group->end()) {
|
||||||
group->insert(key, {{localeStr, valueStr}});
|
group->insert(key, {{localeStr, valueStr}});
|
||||||
return DesktopErrorCode::NoError;
|
return DesktopErrorCode::NoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyIt->insert(localeStr, valueStr);
|
||||||
|
return DesktopErrorCode::NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -482,7 +490,9 @@ QString DesktopEntry::Value::toString(bool &ok) const noexcept
|
|||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
auto str = this->find(defaultKeyStr);
|
auto str = this->find(defaultKeyStr);
|
||||||
|
|
||||||
if (str == this->end()) {
|
if (str == this->end()) {
|
||||||
|
qWarning() << "value not found.";
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,10 +69,8 @@ void applyIteratively(QList<QDir> dirs, T &&func)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &infoList =
|
const auto &infoList = dir.entryInfoList(
|
||||||
dir.entryInfoList({"*.desktop"},
|
{"*.desktop"}, QDir::Readable | QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::DirsLast);
|
||||||
QDir::Readable | QDir::AllDirs | QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot,
|
|
||||||
QDir::Name | QDir::DirsLast);
|
|
||||||
|
|
||||||
for (const auto &info : infoList) {
|
for (const auto &info : infoList) {
|
||||||
if (info.isFile() and func(info)) {
|
if (info.isFile() and func(info)) {
|
||||||
|
@ -55,7 +55,7 @@ GenericName[es]=Editor de texto
|
|||||||
GenericName[et]=Tekstiredaktor
|
GenericName[et]=Tekstiredaktor
|
||||||
GenericName[fi]=Tekstieditori
|
GenericName[fi]=Tekstieditori
|
||||||
GenericName[fr]=Éditeur de texte
|
GenericName[fr]=Éditeur de texte
|
||||||
GenericName[en_US.UTF-8@euro;collation=traditional]=just for test\;teststing=abab\;
|
GenericName[en_US.UTF-8@euro]=just for test\;teststing=abab\;
|
||||||
GenericName[gl_ES]=Editor de texto
|
GenericName[gl_ES]=Editor de texto
|
||||||
GenericName[hr]=Uređivač teksta
|
GenericName[hr]=Uređivač teksta
|
||||||
GenericName[hu]=Szövegszerkesztő
|
GenericName[hu]=Szövegszerkesztő
|
||||||
|
Loading…
Reference in New Issue
Block a user