Add cppcheck-2.2-online-help_q_readonly.patch

- Add patch from merged upstream PR concerning Qt online-help:
  https://github.com/danmar/cppcheck/pull/2890
- Remove workaround for timestamp of online-help.qch
This commit is contained in:
Wolfgang Stöggl 2020-11-09 12:51:55 +01:00
parent 8b7b1c4cbd
commit 60fb113809
2 changed files with 39 additions and 8 deletions

View File

@ -0,0 +1,31 @@
From 4a057c181373626f6e1538a2edf46cc4741fe7bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= <c72578@yahoo.de>
Date: Sun, 8 Nov 2020 15:06:14 +0100
Subject: [PATCH] Set _q_readonly property for online-help (#2890)
- Setting _q_readonly disables the timestamp check of the registered
online-help.qch file
- This enables displaying of Contents and Index of the online help,
even if the timestamp of online-help.qch is slightly different.
Differences in the timestamp can result from packing online-help.qch
in a cab file, when building the installer (1 or 2 seconds) or from
installing the file under a different timezone under Linux etc.
- Remark: Qt 5.14 or newer is required to display Contents or Index,
when the help files are readonly
---
gui/helpdialog.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gui/helpdialog.cpp b/gui/helpdialog.cpp
index c158c8092f..ce24aa1c3a 100644
--- a/gui/helpdialog.cpp
+++ b/gui/helpdialog.cpp
@@ -66,6 +66,8 @@ HelpDialog::HelpDialog(QWidget *parent) :
}
mHelpEngine = new QHelpEngine(helpFile);
+ // Disable the timestamp check of online-help.qhc by setting _q_readonly
+ mHelpEngine->setProperty("_q_readonly", QVariant::fromValue<bool>(true));
mHelpEngine->setupData();
mUi->contents->addWidget(mHelpEngine->contentWidget());

View File

@ -2,7 +2,7 @@
Name: cppcheck Name: cppcheck
Version: 2.2 Version: 2.2
Release: 4%{?dist} Release: 5%{?dist}
Summary: Tool for static C/C++ code analysis Summary: Tool for static C/C++ code analysis
License: GPLv3+ License: GPLv3+
URL: http://cppcheck.wiki.sourceforge.net/ URL: http://cppcheck.wiki.sourceforge.net/
@ -21,6 +21,8 @@ Patch3: cppcheck-2.2-exprengine.patch
Patch4: cppcheck-2.2-online-help.patch Patch4: cppcheck-2.2-online-help.patch
# Fix for missing #include with gcc-11 # Fix for missing #include with gcc-11
Patch5: cppcheck-gcc11.patch Patch5: cppcheck-gcc11.patch
# https://github.com/danmar/cppcheck/pull/2890
Patch6: cppcheck-2.2-online-help_q_readonly.patch
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: pcre-devel BuildRequires: pcre-devel
@ -69,11 +71,12 @@ from xml files first generated using cppcheck.
%patch3 -p1 -b .exprengine %patch3 -p1 -b .exprengine
%patch4 -p1 -b .online-help %patch4 -p1 -b .online-help
%patch5 -p1 -b .gcc11 %patch5 -p1 -b .gcc11
%patch6 -p1 -b .online-help_q_readonly
# Make sure bundled tinyxml is not used # Make sure bundled tinyxml is not used
rm -r externals/tinyxml rm -r externals/tinyxml
# Generate the Qt online-help file # Generate the Qt online-help file
cd gui/help cd gui/help
TZ=UTC qhelpgenerator-qt5 online-help.qhcp -o online-help.qhc qhelpgenerator-qt5 online-help.qhcp -o online-help.qhc
%build %build
# Manuals # Manuals
@ -122,13 +125,10 @@ cd %{_vpath_builddir}/bin
%files htmlreport %files htmlreport
%{_bindir}/cppcheck-htmlreport %{_bindir}/cppcheck-htmlreport
%post
# Adjust the timestamp of online-help.qch to the value expected by online-help.qhc
# The rpm is built on servers using UTC. Get this UTC timestamp and apply it to the file under the local TZ
# https://github.com/danmar/cppcheck/commit/9693940dadfd54bb0bac2549e1b2d6804be9a1a8#commitcomment-43482215
touch -a -m -t $(TZ=UTC date -r /usr/share/Cppcheck/help/online-help.qch +%Y%m%d%H%M.%%S) /usr/share/Cppcheck/help/online-help.qch
%changelog %changelog
* Sun Nov 08 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.2-5
- Add cppcheck-2.2-online-help_q_readonly.patch
* Thu Oct 22 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.2-4 * Thu Oct 22 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.2-4
- Fix missing Contents and Index in Qt online-help file - Fix missing Contents and Index in Qt online-help file