Commit 9dcb5bc3 authored by Albert Astals Cid's avatar 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
......@@ -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);
}
......
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