Commit b9f9f8f7 authored by Volker Krause's avatar Volker Krause
Browse files

Signal pass removal

parent 9ee19ffc
......@@ -42,11 +42,14 @@ private slots:
{
PkPassManager mgr;
clearPasses(&mgr);
QVERIFY(mgr.passes().isEmpty());
QSignalSpy addSpy(&mgr, &PkPassManager::passAdded);
QVERIFY(addSpy.isValid());
QSignalSpy updateSpy(&mgr, &PkPassManager::passUpdated);
QVERIFY(updateSpy.isValid());
QSignalSpy rmSpy(&mgr, &PkPassManager::passRemoved);
QVERIFY(rmSpy.isValid());
QVERIFY(mgr.passes().isEmpty());
mgr.importPass(QUrl::fromLocalFile(QLatin1String(SOURCE_DIR "/data/boardingpass-v1.pkpass")));
......@@ -65,6 +68,13 @@ private slots:
QCOMPARE(updateSpy.at(0).at(0).toString(), QLatin1String("pass.booking.kde.org/MTIzNA=="));
QCOMPARE(updateSpy.at(0).at(1).toStringList().size(), 1);
QCOMPARE(updateSpy.at(0).at(1).toStringList().at(0), QStringLiteral("Gate changed to G30."));
clearPasses(&mgr);
QCOMPARE(addSpy.size(), 1);
QCOMPARE(updateSpy.size(), 1);
QCOMPARE(rmSpy.size(), 1);
QCOMPARE(rmSpy.at(0).at(0).toString(), QLatin1String("pass.booking.kde.org/MTIzNA=="));
QVERIFY(mgr.passes().isEmpty());
}
};
......
......@@ -143,7 +143,7 @@ void PkPassManager::removePass(const QString& passId)
{
const auto basePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/passes/");
QFile::remove(basePath + QLatin1Char('/') + passId + QLatin1String(".pkpass"));
// TODO change signal
emit passRemoved(passId);
}
void PkPassManager::updatePass(const QString& passId)
......
......@@ -50,6 +50,7 @@ public:
signals:
void passAdded(const QString &passId);
void passUpdated(const QString &passId, const QStringList &changes);
void passRemoved(const QString &passId);
private:
enum ImportMode { Copy, Move };
......
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