- int apps = homescreenHandler->getRunnablesCount();
- engine.rootContext()->setContextProperty(QStringLiteral("homescreenHandler"), homescreenHandler);
- engine.rootContext()->setContextProperty(QStringLiteral("apps_len"), apps);
+
+ AppLauncherClient* applauncher = new AppLauncherClient();
+ QList<QMap<QString, QString>> apps;
+ if (applauncher) {
+ applauncher->listApplications(apps);
+ engine.rootContext()->setContextProperty(QStringLiteral("applauncher"), applauncher);
+ engine.rootContext()->setContextProperty(QStringLiteral("apps_len"), apps.size());
+ } else {
+ qFatal("Could not create AppLauncherClient");
+ }
+
+ ApplicationModel *appmodel = new ApplicationModel();
+ if (appmodel) {
+ appmodel->initAppList(apps);
+ qmlRegisterSingletonType<ApplicationModel>("AppModel", 1, 0, "ApplicationModel",
+ [appmodel](QQmlEngine *, QJSEngine *) -> QObject * { return appmodel; });
+ } else {
+ qFatal("Could not create ApplicationModel");
+ }