Commit 6271b908 authored by Volker Krause's avatar Volker Krause
Browse files

Add a method to retrieve the full raw data of a pass again

parent ed9f9e42
Pipeline #164988 passed with stages
in 2 minutes and 38 seconds
......@@ -3,7 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.20.40")
set(PIM_VERSION "5.20.41")
project(KPkPass VERSION ${PIM_VERSION})
set(KF5_MIN_VERSION "5.93.0")
......
......@@ -79,6 +79,10 @@ private Q_SLOTS:
QVERIFY(!img.isNull());
img = pass->image(QStringLiteral("I don't exist"));
QVERIFY(img.isNull());
auto sourceFile = QFile(QStringLiteral(SOURCE_DIR "/data/boardingpass-v1.pkpass"));
QVERIFY(sourceFile.open(QFile::ReadOnly));
QCOMPARE(pass->rawData(), sourceFile.readAll());
}
};
......
......@@ -558,4 +558,13 @@ QVariantMap Pass::fieldsVariantMap() const
return m;
}
QByteArray Pass::rawData() const
{
const auto prevPos = d->buffer->pos();
d->buffer->seek(0);
const auto data = d->buffer->readAll();
d->buffer->seek(prevPos);
return data;
}
#include "moc_pass.cpp"
......@@ -138,6 +138,13 @@ public:
/** Create a appropriate sub-class based on the pkpass file type. */
static Pass *fromFile(const QString &fileName, QObject *parent = nullptr);
/** The raw data of this pass.
* That is the binary representation of the ZIP archive which contains
* all the pass data.
* @since 5.20.41
*/
QByteArray rawData() const;
protected:
///@cond internal
friend class Barcode;
......
Supports Markdown
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