File indexing completed on 2025-01-26 05:06:21

0001 /*
0002     SPDX-FileCopyrightText: 2014 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "folderplugin.h"
0008 #include "applauncher.h"
0009 #include "directorypicker.h"
0010 #include "eventgenerator.h"
0011 #include "foldermodel.h"
0012 #include "itemviewadapter.h"
0013 #include "labelgenerator.h"
0014 #include "menuhelper.h"
0015 #include "mimetypesmodel.h"
0016 #include "placesmodel.h"
0017 #include "positioner.h"
0018 #include "previewpluginsmodel.h"
0019 #include "rubberband.h"
0020 #include "shortcut.h"
0021 #include "subdialog.h"
0022 #include "viewpropertiesmenu.h"
0023 #include "wheelinterceptor.h"
0024 
0025 #include <QQmlContext>
0026 #include <QQmlEngine>
0027 
0028 static QObject *menuHelperSingletonProvider(QQmlEngine *engine, QJSEngine *jsEngine)
0029 {
0030     Q_UNUSED(engine);
0031     Q_UNUSED(jsEngine);
0032     return new MenuHelper();
0033 }
0034 
0035 static QObject *appLauncherSingletonProvider(QQmlEngine *engine, QJSEngine *jsEngine)
0036 {
0037     Q_UNUSED(engine);
0038     Q_UNUSED(jsEngine);
0039     return new AppLauncher();
0040 }
0041 
0042 void FolderPlugin::registerTypes(const char *uri)
0043 {
0044     Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.private.desktopcontainment.folder"));
0045     qmlRegisterType<DirectoryPicker>(uri, 0, 1, "DirectoryPicker");
0046     qmlRegisterType<FolderModel>(uri, 0, 1, "FolderModel");
0047     qmlRegisterType<ItemViewAdapter>(uri, 0, 1, "ItemViewAdapter");
0048     qmlRegisterType<LabelGenerator>(uri, 0, 1, "LabelGenerator");
0049     qmlRegisterSingletonType<MenuHelper>(uri, 0, 1, "MenuHelper", menuHelperSingletonProvider);
0050     qmlRegisterType<MimeTypesModel>(uri, 0, 1, "MimeTypesModel");
0051     qmlRegisterType<PlacesModel>(uri, 0, 1, "PlacesModel");
0052     qmlRegisterType<Positioner>(uri, 0, 1, "Positioner");
0053     qmlRegisterType<PreviewPluginsModel>(uri, 0, 1, "PreviewPluginsModel");
0054     qmlRegisterType<RubberBand>(uri, 0, 1, "RubberBand");
0055     qmlRegisterType<SubDialog>(uri, 0, 1, "SubDialog");
0056     qmlRegisterType<ViewPropertiesMenu>(uri, 0, 1, "ViewPropertiesMenu");
0057     qmlRegisterType<WheelInterceptor>(uri, 0, 1, "WheelInterceptor");
0058     qmlRegisterType<ShortCut>(uri, 0, 1, "ShortCut");
0059     qmlRegisterType<EventGenerator>(uri, 0, 1, "EventGenerator");
0060     qmlRegisterSingletonType<AppLauncher>(uri, 0, 1, "AppLauncher", appLauncherSingletonProvider);
0061 }