Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/recentusagemodel.cpp
Show All 39 Lines | |||||
40 | #include <KMimeTypeTrader> | 40 | #include <KMimeTypeTrader> | ||
41 | #include <KRun> | 41 | #include <KRun> | ||
42 | #include <KService> | 42 | #include <KService> | ||
43 | #include <KStartupInfo> | 43 | #include <KStartupInfo> | ||
44 | 44 | | |||
45 | #include <KActivities/Stats/Cleaning> | 45 | #include <KActivities/Stats/Cleaning> | ||
46 | #include <KActivities/Stats/ResultModel> | 46 | #include <KActivities/Stats/ResultModel> | ||
47 | #include <KActivities/Stats/Terms> | 47 | #include <KActivities/Stats/Terms> | ||
48 | #include <Solid/Device> | ||||
49 | #include <Solid/NetworkShare> | ||||
50 | #include <Solid/StorageAccess> | ||||
48 | 51 | | |||
49 | namespace KAStats = KActivities::Stats; | 52 | namespace KAStats = KActivities::Stats; | ||
50 | 53 | | |||
51 | using namespace KAStats; | 54 | using namespace KAStats; | ||
52 | using namespace KAStats::Terms; | 55 | using namespace KAStats::Terms; | ||
53 | 56 | | |||
54 | GroupSortProxy::GroupSortProxy(AbstractModel *parentModel, QAbstractItemModel *sourceModel) : QSortFilterProxyModel(parentModel) | 57 | GroupSortProxy::GroupSortProxy(AbstractModel *parentModel, QAbstractItemModel *sourceModel) : QSortFilterProxyModel(parentModel) | ||
55 | { | 58 | { | ||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Line(s) | |||||
240 | { | 243 | { | ||
241 | QUrl url(resource); | 244 | QUrl url(resource); | ||
242 | 245 | | |||
243 | if (url.scheme().isEmpty()) { | 246 | if (url.scheme().isEmpty()) { | ||
244 | url.setScheme(QStringLiteral("file")); | 247 | url.setScheme(QStringLiteral("file")); | ||
245 | } | 248 | } | ||
246 | 249 | | |||
247 | #if KIO_VERSION >= QT_VERSION_CHECK(5,57,0) | 250 | #if KIO_VERSION >= QT_VERSION_CHECK(5,57,0) | ||
248 | // Avoid calling QT_LSTAT and accessing recent documents | 251 | // Avoid calling QT_LSTAT and accessing recent documents for network shares | ||
249 | const KFileItem fileItem(url, KFileItem::SkipMimeTypeFromContent); | 252 | bool networkFile = false; | ||
253 | const QList<Solid::Device> devices = Solid::Device::listFromType(Solid::DeviceInterface::NetworkShare); | ||||
254 | for (Solid::Device device : devices) { | ||||
broulik: `toLocalFile()` instead of `path()` | |||||
255 | Solid::StorageAccess *storageAccess = device.as<Solid::StorageAccess>(); | ||||
256 | if (url.path().startsWith(storageAccess->filePath())) { | ||||
257 | networkFile = true; | ||||
258 | break; | ||||
259 | } | ||||
260 | } | ||||
261 | KFileItem fileItem; | ||||
262 | if (networkFile) { | ||||
263 | fileItem = KFileItem(url, KFileItem::SkipMimeTypeFromContent); | ||||
264 | } else { | ||||
265 | fileItem = KFileItem(url); | ||||
266 | } | ||||
250 | #else | 267 | #else | ||
251 | const KFileItem fileItem(url); | 268 | const KFileItem fileItem(url); | ||
252 | #endif | 269 | #endif | ||
253 | 270 | | |||
254 | if (!url.isValid()) { | 271 | if (!url.isValid()) { | ||
255 | return QVariant(); | 272 | return QVariant(); | ||
256 | } | 273 | } | ||
257 | 274 | | |||
▲ Show 20 Lines • Show All 234 Lines • Show Last 20 Lines |
toLocalFile() instead of path()