Warning, file /plasma/plasma-mobile/containments/homescreens/folio/homescreen.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0002 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 #include "homescreen.h"
0006 
0007 #include <KWindowSystem>
0008 
0009 #include <QDebug>
0010 #include <QQuickItem>
0011 #include <QtQml>
0012 
0013 HomeScreen::HomeScreen(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
0014     : Plasma::Containment{parent, data, args}
0015 {
0016     setHasConfigurationInterface(true);
0017 
0018     ApplicationListModel *applicationListModel = new ApplicationListModel{this};
0019     DesktopModel *desktopModel = new DesktopModel{this, this};
0020     qmlRegisterSingletonType<ApplicationListModel>("org.kde.phone.homescreen.default",
0021                                                    1,
0022                                                    0,
0023                                                    "ApplicationListModel",
0024                                                    [applicationListModel](QQmlEngine *, QJSEngine *) -> QObject * {
0025                                                        return applicationListModel;
0026                                                    });
0027     qmlRegisterSingletonType<DesktopModel>("org.kde.phone.homescreen.default", 1, 0, "DesktopModel", [desktopModel](QQmlEngine *, QJSEngine *) -> QObject * {
0028         return desktopModel;
0029     });
0030 
0031     connect(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged, this, &HomeScreen::showingDesktopChanged);
0032 }
0033 
0034 HomeScreen::~HomeScreen() = default;
0035 
0036 void HomeScreen::configChanged()
0037 {
0038     Plasma::Containment::configChanged();
0039 }
0040 
0041 bool HomeScreen::showingDesktop() const
0042 {
0043     return KWindowSystem::showingDesktop();
0044 }
0045 
0046 void HomeScreen::setShowingDesktop(bool showingDesktop)
0047 {
0048     KWindowSystem::setShowingDesktop(showingDesktop);
0049 }
0050 
0051 K_PLUGIN_CLASS_WITH_JSON(HomeScreen, "package/metadata.json")
0052 
0053 #include "homescreen.moc"