Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F34572480
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
View Options
diff --git a/examples/qml/main.cpp b/examples/qml/main.cpp
index 7525403..9a03bff 100644
--- a/examples/qml/main.cpp
+++ b/examples/qml/main.cpp
@@ -1,52 +1,52 @@
// 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 <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()) {
return -1;
}
parser.process(app);
const QStringList args = parser.positionalArguments();
- if (args.length() > 0) {
+ 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
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jan 17, 2:45 AM (1 d, 8 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
cc/5d/c2e6c45d5e0a02c80bad66893089
Attached To
rMTP MIME Tree Parser
Event Timeline
Log In to Comment