[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - desktop/source include/LibreOfficeKit
Pranav Kant
pranavk at collabora.com
Wed Jun 22 08:21:32 UTC 2016
desktop/source/lib/init.cxx | 20 ++++++++++++++++++++
include/LibreOfficeKit/LibreOfficeKit.h | 3 +++
include/LibreOfficeKit/LibreOfficeKit.hxx | 16 ++++++++++++++++
3 files changed, 39 insertions(+)
New commits:
commit 3f1c126f9f4da7113061565218f36ed878010ccd
Author: Pranav Kant <pranavk at collabora.com>
Date: Tue Jun 21 20:23:13 2016 +0530
lok: Change version string to JSON format
(cherry-picked from d7b45c97b30f109aff0be6602a8fc8103af71e7f)
Leaving out the lokdocview changes intentionally, because we
don't need it, and too many merge conflicts.
Change-Id: Ie1264fed9964b09006980df2e151e170b48b4082
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 06d1e4d..e88dce8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1861,7 +1861,15 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis,
static char* lo_getVersionInfo(LibreOfficeKit* /*pThis*/)
{
- const OString sVersionStr = OUStringToOString(ReplaceStringHookProc("%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION %BUILDID"), RTL_TEXTENCODING_UTF8);
+ const OUString sVersionStrTemplate(
+ "{ "
+ "\"ProductName\": \"%PRODUCTNAME\", "
+ "\"ProductVersion\": \"%PRODUCTVERSION\", "
+ "\"ProductExtension\": \"%PRODUCTEXTENSION\", "
+ "\"BuildId\": \"%BUILDID\" "
+ "}"
+ );
+ const OString sVersionStr = OUStringToOString(ReplaceStringHookProc(sVersionStrTemplate), RTL_TEXTENCODING_UTF8);
char* pVersion = static_cast<char*>(malloc(sVersionStr.getLength() + 1));
strcpy(pVersion, sVersionStr.getStr());
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 27f3b35..c9e0873 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -543,10 +543,13 @@ public:
/**
* Get version information of the LOKit process
*
- * @returns string containing version information in format:
- * PRODUCT_NAME PRODUCT_VERSION PRODUCT_EXTENSION BUILD_ID
+ * @returns JSON string containing version information in format:
+ * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
*
- * Eg: LibreOffice 5.3 .0.0 alpha0 <commit hash>
+ * Eg: {"ProductName": "LibreOffice",
+ * "ProductVersion": "5.3",
+ * "ProductExtension": ".0.0.alpha0",
+ * "BuildId": "<full 40 char git hash>"}
*/
inline char* getVersionInfo()
{
commit 45c41f548500d794e925db062d527ee38e66557f
Author: Pranav Kant <pranavk at collabora.com>
Date: Tue Jun 21 00:15:38 2016 +0530
lok: Expose LO version information
(cherry-picked from 90c75f775b6d1ca68389782a3768ee554b528e5d)
Leaving out lokdocview changes as we don't need it, and it
results in too many merge conflicts anyways.
Change-Id: Ided924e928c04385457c7a2e231fdf57e7e38970
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8caa011..06d1e4d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -82,6 +82,7 @@
#include <vcl/sysdata.hxx>
#include <vcl/virdev.hxx>
#include <vcl/ITiledRenderable.hxx>
+#include <unotools/configmgr.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <unotools/mediadescriptor.hxx>
#include <osl/module.hxx>
@@ -467,6 +468,7 @@ static void lo_setOptionalFeatures(LibreOfficeKit* pThis, uint64_t features);
static void lo_setDocumentPassword(LibreOfficeKit* pThis,
const char* pURL,
const char* pPassword);
+static char* lo_getVersionInfo(LibreOfficeKit* pThis);
LibLibreOffice_Impl::LibLibreOffice_Impl()
: maThread(0)
@@ -487,6 +489,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
m_pOfficeClass->getFilterTypes = lo_getFilterTypes;
m_pOfficeClass->setOptionalFeatures = lo_setOptionalFeatures;
m_pOfficeClass->setDocumentPassword = lo_setDocumentPassword;
+ m_pOfficeClass->getVersionInfo = lo_getVersionInfo;
gOfficeClass = m_pOfficeClass;
}
@@ -1856,6 +1859,15 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis,
pLib->mInteractionMap.find(OString(pURL))->second->SetPassword(pPassword);
}
+static char* lo_getVersionInfo(LibreOfficeKit* /*pThis*/)
+{
+ const OString sVersionStr = OUStringToOString(ReplaceStringHookProc("%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION %BUILDID"), RTL_TEXTENCODING_UTF8);
+
+ char* pVersion = static_cast<char*>(malloc(sVersionStr.getLength() + 1));
+ strcpy(pVersion, sVersionStr.getStr());
+ return pVersion;
+}
+
static void force_c_locale()
{
// force locale (and resource files loaded) to en-US
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 68ae432..63e475c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -73,6 +73,9 @@ struct _LibreOfficeKitClass
void (*setDocumentPassword) (LibreOfficeKit* pThis,
char const* pURL,
char const* pPassword);
+
+ /// @see lok::Office::getVersionInfo().
+ char* (*getVersionInfo) (LibreOfficeKit* pThis);
#endif
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 82d4fc0..27f3b35 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -539,6 +539,19 @@ public:
{
mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword);
}
+
+ /**
+ * Get version information of the LOKit process
+ *
+ * @returns string containing version information in format:
+ * PRODUCT_NAME PRODUCT_VERSION PRODUCT_EXTENSION BUILD_ID
+ *
+ * Eg: LibreOffice 5.3 .0.0 alpha0 <commit hash>
+ */
+ inline char* getVersionInfo()
+ {
+ return mpThis->pClass->getVersionInfo(mpThis);
+ }
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
More information about the Libreoffice-commits
mailing list