2022-06-17 04:48:53 +00:00
|
|
|
// SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
|
2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2022-2023 Devin Lin <devin@kde.org>
|
2022-06-17 04:48:53 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-05-14 16:05:01 +00:00
|
|
|
|
|
|
|
|
#include "homescreen.h"
|
|
|
|
|
|
2021-10-16 03:17:32 +00:00
|
|
|
#include <KWindowSystem>
|
2022-06-17 04:48:53 +00:00
|
|
|
|
2015-05-14 16:05:01 +00:00
|
|
|
#include <QDebug>
|
2023-10-22 03:59:27 +00:00
|
|
|
#include <QQmlEngine>
|
|
|
|
|
#include <QQmlExtensionPlugin>
|
2019-09-04 16:39:31 +00:00
|
|
|
#include <QQuickItem>
|
2015-05-14 16:05:01 +00:00
|
|
|
|
2025-07-16 17:02:18 +00:00
|
|
|
K_PLUGIN_CLASS_WITH_JSON(HomeScreen, "metadata.json")
|
|
|
|
|
|
2022-04-24 11:44:41 +00:00
|
|
|
HomeScreen::HomeScreen(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
2022-06-17 04:48:53 +00:00
|
|
|
: Plasma::Containment{parent, data, args}
|
2024-06-21 04:42:14 +00:00
|
|
|
, m_folioSettings{new FolioSettings{this}}
|
|
|
|
|
, m_homeScreenState{new HomeScreenState{this}}
|
|
|
|
|
, m_widgetsManager{new WidgetsManager{this}}
|
|
|
|
|
, m_applicationListModel{new ApplicationListModel{this}}
|
2024-07-01 16:04:32 +00:00
|
|
|
, m_applicationListSearchModel{new ApplicationListSearchModel{this, m_applicationListModel}}
|
2024-06-21 04:42:14 +00:00
|
|
|
, m_favouritesModel{new FavouritesModel{this}}
|
|
|
|
|
, m_pageListModel{new PageListModel{this}}
|
2015-05-14 16:05:01 +00:00
|
|
|
{
|
2024-06-21 04:42:14 +00:00
|
|
|
// HomeScreenState init() has dependencies on other objects
|
|
|
|
|
m_homeScreenState->init();
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
setHasConfigurationInterface(true);
|
|
|
|
|
|
2021-10-16 03:17:32 +00:00
|
|
|
connect(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged, this, &HomeScreen::showingDesktopChanged);
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
connect(this, &Plasma::Containment::appletAdded, this, &HomeScreen::onAppletAdded);
|
|
|
|
|
connect(this, &Plasma::Containment::appletAboutToBeRemoved, this, &HomeScreen::onAppletAboutToBeRemoved);
|
2015-05-14 16:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 00:08:59 +00:00
|
|
|
HomeScreen::~HomeScreen() = default;
|
2015-05-14 16:05:01 +00:00
|
|
|
|
2019-09-16 17:13:52 +00:00
|
|
|
void HomeScreen::configChanged()
|
|
|
|
|
{
|
|
|
|
|
Plasma::Containment::configChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
void HomeScreen::onAppletAdded(Plasma::Applet *applet, const QRectF &geometryHint)
|
|
|
|
|
{
|
2024-06-21 04:42:14 +00:00
|
|
|
Q_UNUSED(geometryHint)
|
|
|
|
|
widgetsManager()->addWidget(applet);
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HomeScreen::onAppletAboutToBeRemoved(Plasma::Applet *applet)
|
|
|
|
|
{
|
2024-06-21 04:42:14 +00:00
|
|
|
widgetsManager()->removeWidget(applet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FolioSettings *HomeScreen::folioSettings()
|
|
|
|
|
{
|
|
|
|
|
return m_folioSettings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HomeScreenState *HomeScreen::homeScreenState()
|
|
|
|
|
{
|
|
|
|
|
return m_homeScreenState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WidgetsManager *HomeScreen::widgetsManager()
|
|
|
|
|
{
|
|
|
|
|
return m_widgetsManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApplicationListModel *HomeScreen::applicationListModel()
|
|
|
|
|
{
|
|
|
|
|
return m_applicationListModel;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-01 16:04:32 +00:00
|
|
|
ApplicationListSearchModel *HomeScreen::applicationListSearchModel()
|
|
|
|
|
{
|
|
|
|
|
return m_applicationListSearchModel;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
FavouritesModel *HomeScreen::favouritesModel()
|
|
|
|
|
{
|
|
|
|
|
return m_favouritesModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageListModel *HomeScreen::pageListModel()
|
|
|
|
|
{
|
|
|
|
|
return m_pageListModel;
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-14 16:05:01 +00:00
|
|
|
#include "homescreen.moc"
|