File indexing completed on 2024-11-03 03:41:06
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org> 0004 SPDX-FileCopyrightText: 2007 David Faure <faure@kde.org> 0005 SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org> 0006 SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <kde@broulik.de> 0007 0008 SPDX-License-Identifier: LGPL-2.0-only 0009 */ 0010 0011 #ifndef KFILEPLACESMODEL_P_H 0012 #define KFILEPLACESMODEL_P_H 0013 0014 #include <solid/predicate.h> 0015 #include <solid/solidnamespace.h> 0016 0017 #include <QList> 0018 #include <QMap> 0019 #include <QPersistentModelIndex> 0020 #include <QStringList> 0021 0022 class KBookmarkManager; 0023 class KCoreDirLister; 0024 class KFilePlacesItem; 0025 class KFilePlacesModel; 0026 0027 class QUrl; 0028 0029 namespace Solid 0030 { 0031 class StorageAccess; 0032 } 0033 0034 class KFilePlacesModelPrivate 0035 { 0036 public: 0037 explicit KFilePlacesModelPrivate(KFilePlacesModel *qq); 0038 0039 KFilePlacesModel *const q; 0040 0041 static QString ignoreMimeType(); 0042 static QString internalMimeType(const KFilePlacesModel *model); 0043 0044 QList<KFilePlacesItem *> items; 0045 QList<Solid::Device> availableDevices; 0046 QMap<QObject *, QPersistentModelIndex> setupInProgress; 0047 QMap<QObject *, QPersistentModelIndex> teardownInProgress; 0048 QStringList supportedSchemes; 0049 0050 Solid::Predicate predicate; 0051 KBookmarkManager *bookmarkManager; 0052 0053 const bool fileIndexingEnabled; 0054 0055 void reloadAndSignal(); 0056 QList<KFilePlacesItem *> loadBookmarkList(); 0057 int findNearestPosition(int source, int target); 0058 0059 QList<QString> tags; 0060 const QString tagsUrlBase = QStringLiteral("tags:/"); 0061 KCoreDirLister *tagsLister = nullptr; 0062 0063 void initDeviceList(); 0064 void deviceAdded(const QString &udi); 0065 void deviceRemoved(const QString &udi); 0066 void itemChanged(const QString &udi, const QList<int> &roles); 0067 void reloadBookmarks(); 0068 void storageSetupDone(Solid::ErrorType error, const QVariant &errorData, Solid::StorageAccess *sender); 0069 void storageTeardownDone(const QString &filePath, Solid::ErrorType error, const QVariant &errorData, QObject *sender); 0070 0071 private: 0072 bool isBalooUrl(const QUrl &url) const; 0073 }; 0074 0075 #endif // KFILEPLACESMODEL_P_H