Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
9dcb5bc3
Commit
9dcb5bc3
authored
Jul 19, 2020
by
Albert Astals Cid
Browse files
Use KXMLGUIClient::findVersionNumber if using new enough xmlgui
instead of the code we copied from there
parent
5432541d
Pipeline
#28013
passed with stage
in 25 minutes and 41 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
xmlgui_helper.cpp
View file @
9dcb5bc3
...
...
@@ -9,9 +9,17 @@
#include "xmlgui_helper.h"
#include "kxmlgui_version.h"
#if KXMLGUI_VERSION >= QT_VERSION_CHECK(5, 73, 0)
#include <KXMLGUIClient>
#endif
#include <QDebug>
#include <QFile>
#if KXMLGUI_VERSION < QT_VERSION_CHECK(5, 73, 0)
// Copied from KXmlGuiVersionHandler::findVersionNumber :/
static
QString
findVersionNumber
(
const
QString
&
xml
)
{
...
...
@@ -85,6 +93,8 @@ static QString findVersionNumber(const QString &xml)
return
QString
();
}
#endif
namespace
Okular
{
void
removeRCFileIfVersionSmallerThan
(
const
QString
&
filePath
,
int
version
)
...
...
@@ -93,7 +103,11 @@ void removeRCFileIfVersionSmallerThan(const QString &filePath, int version)
if
(
f
.
open
(
QIODevice
::
ReadOnly
))
{
const
QByteArray
contents
=
f
.
readAll
();
f
.
close
();
#if KXMLGUI_VERSION < QT_VERSION_CHECK(5, 73, 0)
const
QString
fileVersion
=
findVersionNumber
(
contents
);
#else
const
QString
fileVersion
=
KXMLGUIClient
::
findVersionNumber
(
contents
);
#endif
if
(
fileVersion
.
toInt
()
<
version
)
{
QFile
::
remove
(
filePath
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment