2 * SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef DOLPHINPLACESMODELSINGLETON_H
8 #define DOLPHINPLACESMODELSINGLETON_H
11 #include <QScopedPointer>
13 #include <KFilePlacesModel>
16 * @brief Dolphin's special-cased KFilePlacesModel
18 * It returns the trash's icon based on whether
21 class DolphinPlacesModel
: public KFilePlacesModel
26 explicit DolphinPlacesModel(const QString
&alternativeApplicationName
, QObject
*parent
= nullptr);
27 ~DolphinPlacesModel() override
;
29 bool panelsLocked() const;
30 void setPanelsLocked(bool locked
);
33 QVariant
data(const QModelIndex
&index
, int role
= Qt::DisplayRole
) const override
;
36 void slotTrashEmptinessChanged(bool isEmpty
);
39 bool isTrash(const QModelIndex
&index
) const;
41 bool m_isEmpty
= false;
42 bool m_panelsLocked
= true; // common-case, panels are locked
46 * @brief Provides a global KFilePlacesModel instance.
48 class DolphinPlacesModelSingleton
52 static DolphinPlacesModelSingleton
& instance();
54 DolphinPlacesModel
*placesModel() const;
55 /** A suffix to the application-name of the stored bookmarks is
56 added, which is only read by PlacesItemModel. */
57 static QString
applicationNameSuffix();
59 DolphinPlacesModelSingleton(const DolphinPlacesModelSingleton
&) = delete;
60 DolphinPlacesModelSingleton
& operator=(const DolphinPlacesModelSingleton
&) = delete;
63 DolphinPlacesModelSingleton();
65 QScopedPointer
<DolphinPlacesModel
> m_placesModel
;
68 #endif // DOLPHINPLACESMODELSINGLETON_H