| 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 "AccountsPlugin.h" |
| 19 | #include <QtQml/QtQml> |
| 20 | #include <QtQml/QQmlContext> |
| 21 | #include <Accounts.h> |
| 22 | #include <AccountConfiguration.h> |
| 23 | #include <AccountValidator.h> |
| 24 | #include <Identities.h> |
| 25 | #include "PresetProviderModel.h" |
| 26 | |
| 27 | class AccountConfiguration; |
| 28 | void AccountsPlugin::registerTypes(const char *uri) |
| 29 | { |
| 30 | Q_ASSERT(uri == QLatin1String("Dekko.Mail.Accounts")); |
| 31 | // @uri Dekko.Accounts |
| 32 | qmlRegisterType<Account>(uri, 1, 0, "Account"); |
| 33 | qmlRegisterType<AccountValidator>(uri, 1, 0, "AccountValidator"); |
| 34 | qmlRegisterType<NewAccount>(uri, 1, 0, "NewAccount"); |
| 35 | qmlRegisterType<AccountConfiguration>(uri, 1, 0, "AccountConfig"); |
| 36 | qmlRegisterType<ImapAccountConfiguration>(uri, 1, 0, "ImapAccountConfig"); |
| 37 | qmlRegisterType<SmtpAccountConfiguration>(uri, 1, 0, "SmtpAccountConfig"); |
| 38 | qmlRegisterType<PopAccountConfiguration>(uri, 1, 0, "PopAccountConfig"); |
| 39 | qmlRegisterType<Accounts>(uri, 1, 0, "Accounts"); |
| 40 | qmlRegisterType<PresetProviderModel>(uri, 1, 0, "PresetProviderModel"); |
| 41 | qmlRegisterType<Identities>(uri, 1, 0, "Identities"); |
| 42 | qmlRegisterUncreatableType<Identity>(uri, 1, 0, "Identity", "Cannot be created in QML. Instances created via PresetProviderModel"); |
| 43 | qmlRegisterUncreatableType<Provider>(uri, 1, 0, "Provider", "Cannot be created in QML. Instances created via PresetProviderModel"); |
| 44 | } |
| 45 | |
| 46 | void AccountsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
| 47 | { |
| 48 | QQmlExtensionPlugin::initializeEngine(engine, uri); |
| 49 | } |