ports/sysutils/plasma5-kinfocenter/files/patch-Modules_about-distro_src_OSRelease.cpp
Tobias C. Berner ef944cd353 Import the KDE Plasma5 ports
This is an import of the Plasma5 ports that we have had in the development
repository for quite some time now.

Please note:
 * Plasma5 cannot be installed at the same time as KDE SC4.
 * Qt5 assumes /etc/localtime to be a symlink to a tz file, not a regular file.
 * To start plasma5, it is recommended to use something like
       exec ck-launch-session startkde
 * Powermanagement and such is not working :-)

I would like to thank all the people that have helped test it in the past years.

Reviewed by:	adridg
Differential Revision:	https://reviews.freebsd.org/D15096
2018-04-27 20:29:36 +00:00

87 lines
3.1 KiB
C++

Dirtily patch in FreeBSD Name/Information. This should be done
in a better way down the line.
--- Modules/about-distro/src/OSRelease.cpp.orig 2018-02-01 13:18:11 UTC
+++ Modules/about-distro/src/OSRelease.cpp
@@ -63,73 +63,10 @@ static void setVar(QStringList *var, const QString &va
OSRelease::OSRelease()
{
- // Set default values for non-optional fields.
- name = QStringLiteral("Linux");
- id = QStringLiteral("linux");
- prettyName = QStringLiteral("Linux");
-
- QString fileName;
-
- if (QFile::exists(QStringLiteral("/etc/os-release"))) {
- fileName = QStringLiteral("/etc/os-release");
- } else if (QFile::exists(QStringLiteral("/usr/lib/os-release"))) {
- fileName = QStringLiteral("/usr/lib/os-release");
- } else {
- return;
- }
-
-
- QFile file(fileName);
- // NOTE: The os-release specification defines default values for specific
- // fields which means that even if we can not read the os-release file
- // we have sort of expected default values to use.
- // TODO: it might still be handy to indicate to the outside whether
- // fallback values are being used or not.
- file.open(QIODevice::ReadOnly | QIODevice::Text);
- QString line;
- QStringList comps;
- while (!file.atEnd()) {
- line = file.readLine();
-
- if (line.startsWith(QLatin1Char('#'))) {
- // Comment line
- continue;
- }
-
- comps = line.split(QLatin1Char('='));
-
- if (comps.size() != 2) {
- // Invalid line.
- continue;
- }
-
- QString key = comps.at(0);
- QString value = comps.at(1).trimmed();
- if (key == QLatin1String("NAME"))
- setVar(&name, value);
- else if (key == QLatin1String("VERSION"))
- setVar(&version, value);
- else if (key == QLatin1String("ID"))
- setVar(&id, value);
- else if (key == QLatin1String("ID_LIKE"))
- setVar(&idLike, value);
- else if (key == QLatin1String("VERSION_ID"))
- setVar(&versionId, value);
- else if (key == QLatin1String("PRETTY_NAME"))
- setVar(&prettyName, value);
- else if (key == QLatin1String("ANSI_COLOR"))
- setVar(&ansiColor, value);
- else if (key == QLatin1String("CPE_NAME"))
- setVar(&cpeName, value);
- else if (key == QLatin1String("HOME_URL"))
- setVar(&homeUrl, value);
- else if (key == QLatin1String("SUPPORT_URL"))
- setVar(&supportUrl, value);
- else if (key == QLatin1String("BUG_REPORT_URL"))
- setVar(&bugReportUrl, value);
- else if (key == QLatin1String("BUILD_ID"))
- setVar(&buildId, value);
- // os-release explicitly allows for vendor specific aditions. We have no
- // interest in those right now.
- }
-}
+ name = QLatin1String("FreeBSD");
+ id = QLatin1String("FreeBSD");
+ prettyName = QLatin1String("FreeBSD");
+ homeUrl = QLatin1String("https://freebsd.org");
+ supportUrl = QLatin1String("https://www.freebsd.org/support.html");
+ bugReportUrl = QLatin1String("https://bugs.freebsd.org/bugzilla");
+}