Skip to content

Commit

Permalink
[systemsettings] Allow quotations and escaping on version string.
Browse files Browse the repository at this point in the history
  • Loading branch information
pvuorela committed Nov 4, 2013
1 parent b4ae070 commit 51cbc78
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/aboutsettings.cpp
Expand Up @@ -38,6 +38,7 @@
#include <QDeviceInfo>
#include <QFile>
#include <QByteArray>
#include <QRegularExpression>

AboutSettings::AboutSettings(QObject *parent)
: QObject(parent),
Expand Down Expand Up @@ -91,6 +92,12 @@ QString AboutSettings::softwareVersion() const

if (line.startsWith(versionTag)) {
version = line.mid(versionTag.length()).simplified();
// remove start and end quotes if exist
if (version.length() > 0 && (version.at(0) == '"' || version.at(0) == '\'')) {
version = version.mid(1, version.length() - 2);
}
// unescape rest
version.replace(QRegularExpression("\\\\(.)"), "\\1");
break;
}
}
Expand Down

0 comments on commit 51cbc78

Please sign in to comment.