File indexing completed on 2024-11-24 04:50:44
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #include "mailplugin.h" 0005 #include "merkuro_mail_debug.h" 0006 0007 #include <QLoggingCategory> 0008 #include <QQmlEngine> 0009 0010 #include <MailCommon/EntityCollectionOrderProxyModel> 0011 #include <MimeTreeParserCore/FileOpener> 0012 #include <MimeTreeParserCore/MessageParser> 0013 0014 #include "contactimageprovider.h" 0015 #include "helper.h" 0016 #include "mailapplication.h" 0017 #include "mailclient.h" 0018 #include "mailheadermodel.h" 0019 #include "mailmanager.h" 0020 #include "mailmodel.h" 0021 #include "messagehandler.h" 0022 #include "messageloader.h" 0023 0024 #include "identity/identitycryptographyeditorbackendfactory.h" 0025 0026 void CalendarPlugin::registerTypes(const char *uri) 0027 { 0028 Q_ASSERT(uri == QByteArray("org.kde.merkuro.mail")); 0029 0030 qmlRegisterSingletonType<MailApplication>(uri, 1, 0, "IdentityCryptographyEditorBackendFactory", [](QQmlEngine *engine, QJSEngine *scriptEngine) { 0031 Q_UNUSED(engine) 0032 Q_UNUSED(scriptEngine) 0033 return new IdentityCryptographyEditorBackendFactory; 0034 }); 0035 0036 qmlRegisterSingletonType<MailApplication>(uri, 1, 0, "MailApplication", [](QQmlEngine *engine, QJSEngine *scriptEngine) { 0037 Q_UNUSED(engine) 0038 Q_UNUSED(scriptEngine) 0039 return new MailApplication; 0040 }); 0041 0042 qmlRegisterSingletonType<MailManager>("org.kde.merkuro.mail", 1, 0, "MailManager", [](QQmlEngine *engine, QJSEngine *scriptEngine) { 0043 Q_UNUSED(engine) 0044 Q_UNUSED(scriptEngine) 0045 return new MailManager; 0046 }); 0047 0048 qmlRegisterSingletonType<MailCollectionHelper>("org.kde.merkuro.mail", 1, 0, "MailCollectionHelper", [](QQmlEngine *engine, QJSEngine *scriptEngine) { 0049 Q_UNUSED(engine) 0050 Q_UNUSED(scriptEngine) 0051 return new MailCollectionHelper; 0052 }); 0053 0054 qmlRegisterSingletonType<Akonadi::MailClient>("org.kde.merkuro.mail", 1, 0, "MailClient", [](QQmlEngine *engine, QJSEngine *scriptEngine) { 0055 Q_UNUSED(engine) 0056 Q_UNUSED(scriptEngine) 0057 return new Akonadi::MailClient; 0058 }); 0059 0060 qmlRegisterType<MailHeaderModel>("org.kde.merkuro.mail", 1, 0, "MailHeaderModel"); 0061 qmlRegisterType<MessageLoader>(uri, 1, 0, "MessageLoader"); 0062 qmlRegisterType<MessageParser>(uri, 1, 0, "MessageParser"); 0063 0064 qRegisterMetaType<MailModel *>("MailModel*"); 0065 qRegisterMetaType<MailCommon::EntityCollectionOrderProxyModel *>("MailCommon::EntityCollectionOrderProxyModel*"); 0066 } 0067 0068 void CalendarPlugin::initializeEngine(QQmlEngine *engine, const char *uri) 0069 { 0070 Q_UNUSED(uri); 0071 engine->addImageProvider(QLatin1StringView("contact"), new ContactImageProvider); 0072 } 0073 0074 #include "moc_mailplugin.cpp"