1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org> |
4 | SPDX-FileCopyrightText: 2007 David Faure <faure@kde.org> |
5 | SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org> |
6 | SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <kde@broulik.de> |
7 | |
8 | SPDX-License-Identifier: LGPL-2.0-only |
9 | */ |
10 | |
11 | #ifndef KFILEPLACESMODEL_P_H |
12 | #define KFILEPLACESMODEL_P_H |
13 | |
14 | #include <solid/predicate.h> |
15 | #include <solid/solidnamespace.h> |
16 | |
17 | #include <QList> |
18 | #include <QMap> |
19 | #include <QPersistentModelIndex> |
20 | #include <QStringList> |
21 | |
22 | class KBookmarkManager; |
23 | class KCoreDirLister; |
24 | class KFilePlacesItem; |
25 | class KFilePlacesModel; |
26 | |
27 | class QUrl; |
28 | |
29 | namespace Solid |
30 | { |
31 | class StorageAccess; |
32 | } |
33 | |
34 | class KFilePlacesModelPrivate |
35 | { |
36 | public: |
37 | explicit KFilePlacesModelPrivate(KFilePlacesModel *qq); |
38 | |
39 | KFilePlacesModel *const q; |
40 | |
41 | static QString ignoreMimeType(); |
42 | static QString internalMimeType(const KFilePlacesModel *model); |
43 | |
44 | QList<KFilePlacesItem *> items; |
45 | QList<Solid::Device> availableDevices; |
46 | QMap<QObject *, QPersistentModelIndex> setupInProgress; |
47 | QMap<QObject *, QPersistentModelIndex> teardownInProgress; |
48 | QStringList supportedSchemes; |
49 | |
50 | Solid::Predicate predicate; |
51 | KBookmarkManager *bookmarkManager; |
52 | |
53 | const bool fileIndexingEnabled; |
54 | |
55 | void reloadAndSignal(); |
56 | QList<KFilePlacesItem *> loadBookmarkList(); |
57 | int findNearestPosition(int source, int target); |
58 | |
59 | QList<QString> tags; |
60 | const QString tagsUrlBase = QStringLiteral("tags:/" ); |
61 | KCoreDirLister *tagsLister = nullptr; |
62 | |
63 | void initDeviceList(); |
64 | void deviceAdded(const QString &udi); |
65 | void deviceRemoved(const QString &udi); |
66 | void itemChanged(const QString &udi, const QList<int> &roles); |
67 | void reloadBookmarks(); |
68 | void storageSetupDone(Solid::ErrorType error, const QVariant &errorData, Solid::StorageAccess *sender); |
69 | void storageTeardownDone(const QString &filePath, Solid::ErrorType error, const QVariant &errorData, QObject *sender); |
70 | |
71 | private: |
72 | bool isBalooUrl(const QUrl &url) const; |
73 | }; |
74 | |
75 | #endif // KFILEPLACESMODEL_P_H |
76 | |