Page MenuHome GnuPG

No OneTemporary

diff --git a/examples/qml/main.cpp b/examples/qml/main.cpp
index 9a03bff..08c73ea 100644
--- a/examples/qml/main.cpp
+++ b/examples/qml/main.cpp
@@ -1,52 +1,54 @@
// SPDX-FileCopyrightText: 2023 Carl Schwan <carl.schwan@gnupg.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#include <KLocalizedContext>
#include <KLocalizedString>
#include <QApplication>
#include <QCommandLineParser>
+#include <QDebug>
#include <QDir>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickWindow>
#include "messagehandler.h"
#include <MimeTreeParserCore/FileOpener>
#include <MimeTreeParserCore/MessageParser>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription(i18n("View mbox file"));
parser.addPositionalArgument(QStringLiteral("file"), i18n("mbox file"));
QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
QObject::connect(&engine, &QQmlApplicationEngine::quit, &app, &QCoreApplication::quit);
constexpr auto uri = "org.kde.mimetreeparser";
qmlRegisterType<MessageParser>(uri, 1, 0, "MessageParser");
qmlRegisterType<MessageHandler>(uri, 1, 0, "MessageHandler");
engine.load(QUrl(QStringLiteral("qrc:/content/main.qml")));
const auto rootObjects = engine.rootObjects();
if (rootObjects.isEmpty()) {
+ qWarning() << "Impossible to load main.qml. Please verify installation";
return -1;
}
parser.process(app);
const QStringList args = parser.positionalArguments();
if (!args.isEmpty()) {
for (auto obj : rootObjects) {
auto view = qobject_cast<QQuickWindow *>(obj);
auto messageHandler = view->findChild<MessageHandler *>(QStringLiteral("MessageHandler"));
const auto file = QUrl::fromUserInput(args.at(args.count() - 1), QDir::currentPath());
messageHandler->open(file);
}
}
return QCoreApplication::exec();
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Feb 23, 7:59 PM (51 m, 52 s)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b6/16/b2a8214a56fff59585d2f93dd551

Event Timeline