Simplify code

This commit is contained in:
Chocobo1 2022-04-04 16:42:38 +08:00
parent 39c34078d6
commit 16bc0531f4
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
2 changed files with 5 additions and 6 deletions

View file

@ -308,8 +308,7 @@ namespace
friend bool operator==(const TriStateBoolOption &option, const QString &arg)
{
const QStringList parts = arg.split(u'=');
return parts[0] == option.fullParameter();
return arg.section(u'=', 0, 0) == option.fullParameter();
}
bool m_defaultValue;

View file

@ -142,10 +142,10 @@ QPoint Utils::Gui::screenCenter(const QWidget *w)
void Utils::Gui::openPath(const Path &path)
{
// Hack to access samba shares with QDesktopServices::openUrl
if (path.data().startsWith(u"//"))
QDesktopServices::openUrl(QUrl(u"file:" + path.toString()));
else
QDesktopServices::openUrl(QUrl::fromLocalFile(path.data()));
const QUrl url = path.data().startsWith(u"//")
? QUrl(u"file:" + path.data())
: QUrl::fromLocalFile(path.data());
QDesktopServices::openUrl(url);
}
// Open the parent directory of the given path with a file manager and select