Changeset View
Changeset View
Standalone View
Standalone View
src/views/viewproperties.cpp
Show All 20 Lines | |||||
21 | #include "viewproperties.h" | 21 | #include "viewproperties.h" | ||
22 | 22 | | |||
23 | #include "dolphin_directoryviewpropertysettings.h" | 23 | #include "dolphin_directoryviewpropertysettings.h" | ||
24 | #include "dolphin_generalsettings.h" | 24 | #include "dolphin_generalsettings.h" | ||
25 | #include "dolphindebug.h" | 25 | #include "dolphindebug.h" | ||
26 | 26 | | |||
27 | #include <QCryptographicHash> | 27 | #include <QCryptographicHash> | ||
28 | 28 | | |||
29 | #include <Solid/Device> | ||||
30 | #include <Solid/NetworkShare> | ||||
31 | #include <Solid/StorageAccess> | ||||
32 | | ||||
29 | namespace { | 33 | namespace { | ||
30 | const int AdditionalInfoViewPropertiesVersion = 1; | 34 | const int AdditionalInfoViewPropertiesVersion = 1; | ||
31 | const int NameRolePropertiesVersion = 2; | 35 | const int NameRolePropertiesVersion = 2; | ||
32 | const int DateRolePropertiesVersion = 4; | 36 | const int DateRolePropertiesVersion = 4; | ||
33 | const int CurrentViewPropertiesVersion = 4; | 37 | const int CurrentViewPropertiesVersion = 4; | ||
34 | 38 | | |||
35 | // String representation to mark the additional properties of | 39 | // String representation to mark the additional properties of | ||
36 | // the details view as customized by the user. See | 40 | // the details view as customized by the user. See | ||
Show All 29 Lines | 52 | { | |||
66 | } else if (url.scheme() == QLatin1String("recentdocuments")) { | 70 | } else if (url.scheme() == QLatin1String("recentdocuments")) { | ||
67 | m_filePath = destinationDir(QStringLiteral("recentdocuments")); | 71 | m_filePath = destinationDir(QStringLiteral("recentdocuments")); | ||
68 | useRecentDocumentsView = true; | 72 | useRecentDocumentsView = true; | ||
69 | } else if (url.isLocalFile()) { | 73 | } else if (url.isLocalFile()) { | ||
70 | m_filePath = url.toLocalFile(); | 74 | m_filePath = url.toLocalFile(); | ||
71 | 75 | | |||
72 | bool useDestinationDir = !isPartOfHome(m_filePath); | 76 | bool useDestinationDir = !isPartOfHome(m_filePath); | ||
73 | if (!useDestinationDir) { | 77 | if (!useDestinationDir) { | ||
78 | // Don't store view settings on potentially slow network shares | ||||
79 | const QList<Solid::Device> devices = Solid::Device::listFromType(Solid::DeviceInterface::NetworkShare); | ||||
80 | for (Solid::Device device : devices) { | ||||
81 | Solid::StorageAccess *storageAccess = device.as<Solid::StorageAccess>(); | ||||
meven: You can add a const here. | |||||
82 | if (m_filePath.startsWith(storageAccess->filePath())) { | ||||
83 | useDestinationDir = true; | ||||
84 | break; | ||||
85 | } | ||||
86 | } | ||||
87 | } | ||||
88 | | ||||
89 | if (!useDestinationDir) { | ||||
74 | const QFileInfo dirInfo(m_filePath); | 90 | const QFileInfo dirInfo(m_filePath); | ||
75 | const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName); | 91 | const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName); | ||
76 | useDestinationDir = !dirInfo.isWritable() || (dirInfo.size() > 0 && fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable())); | 92 | useDestinationDir = !dirInfo.isWritable() || (dirInfo.size() > 0 && fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable())); | ||
77 | } | 93 | } | ||
78 | 94 | | |||
79 | if (useDestinationDir) { | 95 | if (useDestinationDir) { | ||
80 | #ifdef Q_OS_WIN | 96 | #ifdef Q_OS_WIN | ||
81 | // m_filePath probably begins with C:/ - the colon is not a valid character for paths though | 97 | // m_filePath probably begins with C:/ - the colon is not a valid character for paths though | ||
▲ Show 20 Lines • Show All 432 Lines • Show Last 20 Lines |
You can add a const here.