MauiKit Calendar

plugin.cpp
1#include "plugin.h"
2
3#include <QQmlEngine>
4
5#include "infinitecalendarviewmodel.h"
6#include "hourlyincidencemodel.h"
7#include "incidenceoccurrencemodel.h"
8#include "timezonelistmodel.h"
9#include "monthmodel.h"
10
11#include "calendarmanager.h"
12#include "incidencewrapper.h"
13#include "filter.h"
14
15#include "collection.h"
16#include "collectioncomboboxmodel.h"
17#include "mimetypes.h"
18
19//#include <KCalendarCore/MemoryCalendar>
20//#include <KCalendarCore/VCalFormat>
21#include <akonadi_version.h>
22#include <Akonadi/Collection>
23#include <Akonadi/AgentFilterProxyModel>
24
25void MauiCalendarPlugin::registerTypes(const char *uri)
26{
27 Q_ASSERT(uri == QByteArray("org.mauikit.calendar"));
28
29 qmlRegisterType<IncidenceWrapper>(uri, 1, 0, "IncidenceWrapper");
30 // qmlRegisterType<AttendeesModel>(uri, 1, 0, "AttendeesModel");
31 qmlRegisterType<MultiDayIncidenceModel>(uri, 1, 0, "MultiDayIncidenceModel");
32 qmlRegisterType<IncidenceOccurrenceModel>(uri, 1, 0, "IncidenceOccurrenceModel");
33 // qmlRegisterType<TodoSortFilterProxyModel>(uri, 1, 0, "TodoSortFilterProxyModel");
34 // qmlRegisterType<ItemTagsModel>(uri, 1, 0, "ItemTagsModel");
35 qmlRegisterType<HourlyIncidenceModel>(uri, 1, 0, "HourlyIncidenceModel");
36 qmlRegisterType<TimeZoneListModel>(uri, 1, 0, "TimeZoneListModel");
37 qmlRegisterType<MonthModel>(uri, 1, 0, "MonthModel");
38 qmlRegisterType<InfiniteCalendarViewModel>(uri, 1, 0, "InfiniteCalendarViewModel");
39
40 qmlRegisterSingletonType<CalendarManager>(uri, 1, 0, "CalendarManager", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
41 Q_UNUSED(scriptEngine)
42 auto cal = CalendarManager::instance();
44 return cal;
45 });
46
47 qmlRegisterSingletonType<Filter>(uri, 1, 0, "Filter", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
48 Q_UNUSED(engine)
49 Q_UNUSED(scriptEngine)
50 return new Filter;
51 });
52
53 //Taken from Kalendar Akonadi plugin
54 qmlRegisterSingletonType<Akonadi::Quick::MimeTypes>(uri, 1, 0, "MimeTypes", [](QQmlEngine *engine, QJSEngine *scriptEngine) {
55 Q_UNUSED(engine)
56 Q_UNUSED(scriptEngine)
57 return new Akonadi::Quick::MimeTypes;
58 });
59
60 qmlRegisterType<Akonadi::Quick::CollectionComboBoxModel>(uri, 1, 0, "CollectionComboBoxModel");
61 // qmlRegisterType<Akonadi::Quick::CollectionPickerModel>(uri, 1, 0, "CollectionPickerModel");
62 qmlRegisterUncreatableType<Akonadi::Quick::Collection>(uri, 1, 0, "Collection", QStringLiteral("It's just an enum"));
63 qRegisterMetaType<Akonadi::ETMCalendar::Ptr>();
64 qRegisterMetaType<QAbstractProxyModel *>("QAbstractProxyModel*");
65 qRegisterMetaType<Akonadi::AgentFilterProxyModel *>();
66
67 //QML STUFF
68 qmlRegisterSingletonType(resolveFileUrl(QStringLiteral("KalendarUiUtils.qml")), uri, 1, 0, "KalendarUiUtils");
69
70 qmlRegisterType(resolveFileUrl(QStringLiteral("DayLabelsBar.qml")), uri, 1, 0, "DayLabelsBar");
71 qmlRegisterType(resolveFileUrl(QStringLiteral("MonthView.qml")), uri, 1, 0, "MonthView");
72 qmlRegisterType(resolveFileUrl(QStringLiteral("YearView.qml")), uri, 1, 0, "YearView");
73
74 qmlRegisterType(resolveFileUrl(QStringLiteral("EventPage.qml")), uri, 1, 0, "EventPage");
75
76 qmlRegisterType(resolveFileUrl(QStringLiteral("DayGridView.qml")), uri, 1, 0, "DayGridView");
77 qmlRegisterType(resolveFileUrl(QStringLiteral("HourlyView.qml")), uri, 1, 0, "HourlyView");
78
79 qmlRegisterType(resolveFileUrl(QStringLiteral("DateComboBox.qml")), uri, 1, 0, "DateComboBox");
80 qmlRegisterType(resolveFileUrl(QStringLiteral("TimeComboBox.qml")), uri, 1, 0, "TimeComboBox");
81
82 qmlRegisterType(resolveFileUrl(QStringLiteral("TimePicker.qml")), uri, 1, 0, "TimePicker");
83 qmlRegisterType(resolveFileUrl(QStringLiteral("DatePicker.qml")), uri, 1, 0, "DatePicker");
84
85 qmlRegisterType(resolveFileUrl(QStringLiteral("MonthsGrid.qml")), uri, 1, 0, "MonthsGrid");
86 qmlRegisterType(resolveFileUrl(QStringLiteral("DaysGrid.qml")), uri, 1, 0, "DaysGrid");
87 qmlRegisterType(resolveFileUrl(QStringLiteral("YearsGrid.qml")), uri, 1, 0, "YearsGrid");
88}
89
90#include "plugin.moc"
91#include "moc_plugin.cpp"
void setObjectOwnership(QObject *object, ObjectOwnership ownership)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:35:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.