| 1 | /* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]> |
| 2 | |
| 3 | This file is part of Dekko email client for Ubuntu devices |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU General Public License as |
| 7 | published by the Free Software Foundation; either version 2 of |
| 8 | the License or (at your option) version 3 |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | #include "MailPlugin.h" |
| 19 | |
| 20 | #include <QtQml/QtQml> |
| 21 | #include <QtQml/QQmlContext> |
| 22 | #include <MailServiceClient.h> |
| 23 | #include <FolderList.h> |
| 24 | #include <Folder.h> |
| 25 | #include <MessageFilterCollection.h> |
| 26 | #include <MessageSet.h> |
| 27 | #include <MessageList.h> |
| 28 | #include <MailboxSearch.h> |
| 29 | #include <MailAddress.h> |
| 30 | #include <SenderIdentities.h> |
| 31 | #include <MessageBuilder.h> |
| 32 | #include <SubmissionManager.h> |
| 33 | #include "qmlenums.h" |
| 34 | |
| 35 | void MailPlugin::registerTypes(const char *uri) |
| 36 | { |
| 37 | Q_ASSERT(uri == QLatin1String("Dekko.Mail")); |
| 38 | // @uri Dekko.Mail |
| 39 | qmlRegisterType<Folder>(uri, 1, 0, "Folder"); |
| 40 | qmlRegisterType<FolderList>(uri, 1, 0, "FolderList"); |
| 41 | qmlRegisterType<MessageFilterCollection>(uri, 1, 0, "MessageFilterCollection"); |
| 42 | qmlRegisterType<MessageList>(uri, 1, 0, "MessageList"); |
| 43 | qmlRegisterType<MinimalMessage>(uri, 1, 0, "MinimalMessage"); |
| 44 | qmlRegisterType<MailAddress>(uri, 1, 0, "MailAddress"); |
| 45 | qmlRegisterType<Message>(uri, 1, 0, "Message"); |
| 46 | qmlRegisterType<MailboxSearch>(uri, 1, 0, "MailboxSearch"); |
| 47 | qmlRegisterType<SenderIdentities>(uri, 1, 0, "SenderIdentities"); |
| 48 | qmlRegisterType<MessageBuilder>(uri, 1, 0, "MessageBuilder"); |
| 49 | qmlRegisterType<SubmissionManager>(uri, 1, 0, "SubmissionManager"); |
| 50 | |
| 51 | qmlRegisterUncreatableType<MessageSet>(uri, 1, 0, "MessageSet", "Cannot create MessageSet from QML, c++ only chap!"); |
| 52 | qmlRegisterUncreatableType<StandardFolderSet>(uri, 1, 0, "StandardFolderSet", "Cannot create MessageSet from QML, c++ only chap!"); |
| 53 | qmlRegisterUncreatableType<SmartFolderSet>(uri, 1, 0, "SmartFolderSet", "Cannot create SmartFolderSet from QML, c++ only chap!"); |
| 54 | qmlRegisterUncreatableType<SearchService>(uri, 1, 0, "SearchService", "Cannot create SearchService from QML, c++ only chap!"); |
| 55 | qmlRegisterSingletonType<Client>(uri, 1, 0, "Client", Client::factory); |
| 56 | qmlRegisterUncreatableType<RecipientType>(uri, 1, 0, "RecipientType", "Cannot create an instance in QML"); |
| 57 | } |
| 58 | |
| 59 | void MailPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
| 60 | { |
| 61 | QQmlExtensionPlugin::initializeEngine(engine, uri); |
| 62 | } |
| 63 |