Commit 4b75dd4e authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Show version information in about screen

It can be useful to know what version of host you're using.
For older hosts, this information just isn't displayed as the getVersion call
will never be answered and the <p> is hidden by default.

Differential Revision: https://phabricator.kde.org/D24692
parent eeb54683
......@@ -98,6 +98,15 @@
"message": "This may interfere with the appearance of websites that already apply a custom styling to their scroll bars."
},
"options_about_host_version": {
"description": "Version of extension native host",
"message": "Host version: $1"
},
"options_about_extension_version": {
"description": "Version of browser extension",
"message": "Extension version: $1"
},
"options_about_copyright": {
"message": "© 2017-2019 Kai Uwe Broulik and David Edmundson"
},
......
......@@ -222,6 +222,10 @@ addRuntimeCallback("settings", "getSubsystemStatus", (message, sender, action) =
return sendPortMessageWithReply("settings", "getSubsystemStatus");
});
addRuntimeCallback("settings", "getVersion", () => {
return sendPortMessageWithReply("settings", "getVersion");
});
addRuntimeCallback("browserAction", "getStatus", (message) => {
let info = {
portStatus,
......
......@@ -92,6 +92,12 @@
</div>
<div class="tab" data-tab-id="about">
<p id="version-info" class="not-supported">
<span id="version-info-host" data-i18n="options_about_host_version">I18N</span><br>
<span id="version-info-extension" data-i18n="options_about_extension_version">I18N</span>
</p>
<p>
<span data-i18n="options_about_copyright">I18N</span><br>
<span data-i18n="options_about_license, https://www.gnu.org/licenses/gpl-3.0.de.html" data-i18n-html="true">I18N</span><br>
......
......@@ -241,6 +241,20 @@ document.addEventListener("DOMContentLoaded", function () {
console.warn("Failed to determine subsystem status", e);
document.body.classList.add("startup-failure");
});
Promise.all([
sendMessage("settings", "getVersion"),
chrome.runtime.getManifest()
]).then((results) => {
const versionInfo = results[0];
const manifest = results[1];
document.getElementById("version-info-host").innerText = chrome.i18n.getMessage("options_about_host_version",
versionInfo.host);
document.getElementById("version-info-extension").innerText = chrome.i18n.getMessage("options_about_extension_version", manifest.version);
document.getElementById("version-info").classList.remove("not-supported");
});
});
document.getElementById("open-krunner-settings").addEventListener("click", function (event) {
......
add_definitions(-DTRANSLATION_DOMAIN=\"plasma-browser-integration-host\")
configure_file(config-host.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-host.h)
set(HOST_SOURCES main.cpp
connection.cpp
pluginmanager.cpp
......
#define HOST_VERSION_STRING "${PROJECT_VERSION}"
......@@ -30,6 +30,8 @@
#include "pluginmanager.h"
#include "settingsadaptor.h"
#include <config-host.h>
const QMap<Settings::Environment, QString> Settings::environmentNames = {
{Settings::Environment::Chrome, QStringLiteral("chrome")},
{Settings::Environment::Chromium, QStringLiteral("chromium")},
......@@ -154,6 +156,8 @@ QJsonObject Settings::handleData(int serial, const QString &event, const QJsonOb
};
ret.insert(subsystem, details);
}
} else if (event == QLatin1String("getVersion")) {
ret.insert(QStringLiteral("host"), QStringLiteral(HOST_VERSION_STRING));
}
return ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment