shift-shell/containments/homescreens/folio/homescreen.h
Marco Allegretti 6d79f8ed05 Add trash button to convergence dock
Show a trash icon to the left of the Overview button in convergence
mode. The icon toggles between user-trash and user-trash-full by
watching ~/.local/share/Trash/files via FolderListModel.

Left-click opens the trash in the default file manager via
Qt.openUrlExternally("trash:/"), making the feature file-manager-
agnostic. Right-click offers "Open Trash" and "Empty Trash"; the
latter shows a confirmation dialog before invoking KIO.Trash via
D-Bus.

The right wing of the virtual-desktop pager shifts left to make
room for the trash button.
2026-05-04 11:43:41 +02:00

79 lines
2.6 KiB
C++

// SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <Plasma/Containment>
#include <QSortFilterProxyModel>
#include <QVariant>
#include "applicationlistmodel.h"
#include "delegatetoucharea.h"
#include "favouritesmodel.h"
#include "folioapplication.h"
#include "folioapplicationfolder.h"
#include "foliodelegate.h"
#include "foliosettings.h"
#include "foliowidget.h"
#include "homescreenstate.h"
#include "pagelistmodel.h"
#include "pagemodel.h"
#include "widgetcontainer.h"
#include "widgetsmanager.h"
class FolioSettings;
class PageListModel;
class WidgetsManager;
class HomeScreenState;
class FavouritesModel;
class ApplicationListModel;
class ApplicationListSearchModel;
class HomeScreen : public Plasma::Containment
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(FolioSettings *FolioSettings READ folioSettings CONSTANT)
Q_PROPERTY(HomeScreenState *HomeScreenState READ homeScreenState CONSTANT)
Q_PROPERTY(WidgetsManager *WidgetsManager READ widgetsManager CONSTANT)
Q_PROPERTY(ApplicationListModel *ApplicationListModel READ applicationListModel CONSTANT)
Q_PROPERTY(ApplicationListSearchModel *ApplicationListSearchModel READ applicationListSearchModel CONSTANT)
Q_PROPERTY(FavouritesModel *FavouritesModel READ favouritesModel CONSTANT)
Q_PROPERTY(PageListModel *PageListModel READ pageListModel CONSTANT)
public:
HomeScreen(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
~HomeScreen() override;
void configChanged() override;
Q_INVOKABLE void triggerOverview() const;
Q_INVOKABLE void activateVirtualDesktop(const QVariant &desktop) const;
Q_INVOKABLE void emptyTrash() const;
FolioSettings *folioSettings();
HomeScreenState *homeScreenState();
WidgetsManager *widgetsManager();
ApplicationListModel *applicationListModel();
ApplicationListSearchModel *applicationListSearchModel();
FavouritesModel *favouritesModel();
PageListModel *pageListModel();
Q_SIGNALS:
void showingDesktopChanged(bool showingDesktop);
private Q_SLOTS:
void onAppletAdded(Plasma::Applet *applet, const QRectF &geometryHint);
void onAppletAboutToBeRemoved(Plasma::Applet *applet);
private:
FolioSettings *m_folioSettings{nullptr};
HomeScreenState *m_homeScreenState{nullptr};
WidgetsManager *m_widgetsManager{nullptr};
ApplicationListModel *m_applicationListModel{nullptr};
ApplicationListSearchModel *m_applicationListSearchModel{nullptr};
FavouritesModel *m_favouritesModel{nullptr};
PageListModel *m_pageListModel{nullptr};
};