Changeset View
Changeset View
Standalone View
Standalone View
src/declarative/peopleqmlplugin.cpp
Show All 19 Lines | |||||
20 | #include "peopleqmlplugin.h" | 20 | #include "peopleqmlplugin.h" | ||
21 | 21 | | |||
22 | #include <personsmodel.h> | 22 | #include <personsmodel.h> | ||
23 | #include <personactionsmodel_p.h> | 23 | #include <personactionsmodel_p.h> | ||
24 | #include <persondata.h> | 24 | #include <persondata.h> | ||
25 | #include <personssortfilterproxymodel.h> | 25 | #include <personssortfilterproxymodel.h> | ||
26 | #include <personpluginmanager.h> | 26 | #include <personpluginmanager.h> | ||
27 | #include <actions.h> | 27 | #include <actions.h> | ||
28 | #include <datasourcemodel.h> | ||||
28 | 29 | | |||
29 | #include "declarativepersondata.h" | 30 | #include "declarativepersondata.h" | ||
30 | #include <qqml.h> | 31 | #include <qqml.h> | ||
31 | 32 | | |||
32 | class ActionTypeWrapper : public QObject { | 33 | class ActionTypeWrapper : public QObject { | ||
33 | Q_OBJECT | 34 | Q_OBJECT | ||
34 | 35 | | |||
35 | public: | 36 | public: | ||
Show All 10 Lines | |||||
46 | 47 | | |||
47 | class DeclarativePersonPluginManager : public QObject | 48 | class DeclarativePersonPluginManager : public QObject | ||
48 | { | 49 | { | ||
49 | Q_OBJECT | 50 | Q_OBJECT | ||
50 | public: | 51 | public: | ||
51 | Q_SCRIPTABLE bool addContact(const QVariantMap &properties) { | 52 | Q_SCRIPTABLE bool addContact(const QVariantMap &properties) { | ||
52 | return KPeople::PersonPluginManager::addContact(properties); | 53 | return KPeople::PersonPluginManager::addContact(properties); | ||
53 | } | 54 | } | ||
55 | Q_SCRIPTABLE bool addContact(const QString &pluginId, const QVariantMap &properties) { | ||||
56 | return KPeople::PersonPluginManager::addContact(pluginId, properties); | ||||
57 | } | ||||
54 | Q_SCRIPTABLE bool deleteContact(const QString &uri) { | 58 | Q_SCRIPTABLE bool deleteContact(const QString &uri) { | ||
55 | return KPeople::PersonPluginManager::deleteContact(uri); | 59 | return KPeople::PersonPluginManager::deleteContact(uri); | ||
56 | } | 60 | } | ||
57 | }; | 61 | }; | ||
58 | 62 | | |||
59 | void PeopleQMLPlugin::registerTypes(const char *uri) | 63 | void PeopleQMLPlugin::registerTypes(const char *uri) | ||
60 | { | 64 | { | ||
61 | qmlRegisterType<KPeople::PersonsModel>(uri, 1, 0, "PersonsModel"); | 65 | qmlRegisterType<KPeople::PersonsModel>(uri, 1, 0, "PersonsModel"); | ||
62 | qmlRegisterType<KPeople::PersonsSortFilterProxyModel>(uri, 1, 0, "PersonsSortFilterProxyModel"); | 66 | qmlRegisterType<KPeople::PersonsSortFilterProxyModel>(uri, 1, 0, "PersonsSortFilterProxyModel"); | ||
63 | qmlRegisterType<KPeople::PersonActionsModel>(uri, 1, 0, "PersonActions"); | 67 | qmlRegisterType<KPeople::PersonActionsModel>(uri, 1, 0, "PersonActions"); | ||
68 | qmlRegisterType<KPeople::DataSourceModel>(uri, 1, 0, "DataSourceModel"); | ||||
64 | qmlRegisterType<DeclarativePersonData>(uri, 1, 0, "PersonData"); | 69 | qmlRegisterType<DeclarativePersonData>(uri, 1, 0, "PersonData"); | ||
65 | qmlRegisterType<KPeople::PersonData>(); | 70 | qmlRegisterType<KPeople::PersonData>(); | ||
66 | qmlRegisterUncreatableType<ActionTypeWrapper>(uri, 1, 0, "ActionType", QStringLiteral("You cannot create ActionType")); | 71 | qmlRegisterUncreatableType<ActionTypeWrapper>(uri, 1, 0, "ActionType", QStringLiteral("You cannot create ActionType")); | ||
67 | qmlRegisterSingletonType<DeclarativePersonPluginManager>(uri, 1, 0, "PersonPluginManager", [] (QQmlEngine*, QJSEngine*) -> QObject* { return new DeclarativePersonPluginManager; }); | 72 | qmlRegisterSingletonType<DeclarativePersonPluginManager>(uri, 1, 0, "PersonPluginManager", [] (QQmlEngine*, QJSEngine*) -> QObject* { return new DeclarativePersonPluginManager; }); | ||
68 | } | 73 | } | ||
69 | 74 | | |||
70 | #include "peopleqmlplugin.moc" | 75 | #include "peopleqmlplugin.moc" |