Changeset View
Changeset View
Standalone View
Standalone View
src/declarative/peopleqmlplugin.cpp
Show All 17 Lines | |||||
18 | */ | 18 | */ | ||
19 | 19 | | |||
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 <actions.h> | 27 | #include <actions.h> | ||
27 | 28 | | |||
28 | #include "declarativepersondata.h" | 29 | #include "declarativepersondata.h" | ||
29 | #include <qqml.h> | 30 | #include <qqml.h> | ||
30 | 31 | | |||
31 | class ActionTypeWrapper : public QObject { | 32 | class ActionTypeWrapper : public QObject { | ||
32 | Q_OBJECT | 33 | Q_OBJECT | ||
33 | 34 | | |||
34 | public: | 35 | public: | ||
35 | enum ActionType { | 36 | enum ActionType { | ||
36 | TextChatAction = KPeople::TextChatAction, | 37 | TextChatAction = KPeople::TextChatAction, | ||
37 | AudioCallAction = KPeople::AudioCallAction, | 38 | AudioCallAction = KPeople::AudioCallAction, | ||
38 | VideoCallAction = KPeople::VideoCallAction, | 39 | VideoCallAction = KPeople::VideoCallAction, | ||
39 | SendEmailAction = KPeople::SendEmailAction, | 40 | SendEmailAction = KPeople::SendEmailAction, | ||
40 | SendFileAction = KPeople::SendFileAction, | 41 | SendFileAction = KPeople::SendFileAction, | ||
41 | OtherAction = KPeople::OtherAction | 42 | OtherAction = KPeople::OtherAction | ||
42 | }; | 43 | }; | ||
43 | Q_ENUM(ActionType) | 44 | Q_ENUM(ActionType) | ||
44 | }; | 45 | }; | ||
45 | 46 | | |||
47 | class DeclarativePersonPluginManager : public QObject | ||||
48 | { | ||||
49 | Q_OBJECT | ||||
50 | public: | ||||
51 | Q_SCRIPTABLE bool addContact(const QVariantMap &properties) { | ||||
52 | return KPeople::PersonPluginManager::addContact(properties); | ||||
53 | } | ||||
54 | }; | ||||
55 | | ||||
46 | void PeopleQMLPlugin::registerTypes(const char *uri) | 56 | void PeopleQMLPlugin::registerTypes(const char *uri) | ||
47 | { | 57 | { | ||
48 | qmlRegisterType<KPeople::PersonsModel>(uri, 1, 0, "PersonsModel"); | 58 | qmlRegisterType<KPeople::PersonsModel>(uri, 1, 0, "PersonsModel"); | ||
49 | qmlRegisterType<KPeople::PersonsSortFilterProxyModel>(uri, 1, 0, "PersonsSortFilterProxyModel"); | 59 | qmlRegisterType<KPeople::PersonsSortFilterProxyModel>(uri, 1, 0, "PersonsSortFilterProxyModel"); | ||
50 | qmlRegisterType<KPeople::PersonActionsModel>(uri, 1, 0, "PersonActions"); | 60 | qmlRegisterType<KPeople::PersonActionsModel>(uri, 1, 0, "PersonActions"); | ||
51 | qmlRegisterType<DeclarativePersonData>(uri, 1, 0, "PersonData"); | 61 | qmlRegisterType<DeclarativePersonData>(uri, 1, 0, "PersonData"); | ||
52 | qmlRegisterType<KPeople::PersonData>(); | 62 | qmlRegisterType<KPeople::PersonData>(); | ||
53 | qmlRegisterUncreatableType<ActionTypeWrapper>(uri, 1, 0, "ActionType", QStringLiteral("You cannot create ActionType")); | 63 | qmlRegisterUncreatableType<ActionTypeWrapper>(uri, 1, 0, "ActionType", QStringLiteral("You cannot create ActionType")); | ||
64 | qmlRegisterSingletonType<DeclarativePersonPluginManager>(uri, 1, 0, "PersonPluginManager", [] (QQmlEngine*, QJSEngine*) -> QObject* { return new DeclarativePersonPluginManager; }); | ||||
jbbgameich: Not sure whether this should follow the Person(s) naming scheme as well.. | |||||
54 | } | 65 | } | ||
55 | 66 | | |||
56 | #include "peopleqmlplugin.moc" | 67 | #include "peopleqmlplugin.moc" |
Not sure whether this should follow the Person(s) naming scheme as well..