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
;
30 QVariant
data(const QModelIndex
&index
, int role
= Qt::DisplayRole
) const override
;
33 void slotTrashEmptinessChanged(bool isEmpty
);
36 bool isTrash(const QModelIndex
&index
) const;
38 bool m_isEmpty
= false;
42 * @brief Provides a global KFilePlacesModel instance.
44 class DolphinPlacesModelSingleton
48 static DolphinPlacesModelSingleton
& instance();
50 KFilePlacesModel
*placesModel() const;
51 /** A suffix to the application-name of the stored bookmarks is
52 added, which is only read by PlacesItemModel. */
53 static QString
applicationNameSuffix();
55 DolphinPlacesModelSingleton(const DolphinPlacesModelSingleton
&) = delete;
56 DolphinPlacesModelSingleton
& operator=(const DolphinPlacesModelSingleton
&) = delete;
59 DolphinPlacesModelSingleton();
61 QScopedPointer
<KFilePlacesModel
> m_placesModel
;
64 #endif // DOLPHINPLACESMODELSINGLETON_H