mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Use more suitable default view mode for recent documents and Downloads folder
Sort them descending by date as well as: * for Recent Documents: switch to details view * for Downloads enable grouping and disable sorting folders first Differential Revision: https://phabricator.kde.org/D18697
This commit is contained in:
parent
fb4b4465f9
commit
b2b913c844
|
@ -49,6 +49,8 @@ ViewProperties::ViewProperties(const QUrl& url) :
|
||||||
GeneralSettings* settings = GeneralSettings::self();
|
GeneralSettings* settings = GeneralSettings::self();
|
||||||
const bool useGlobalViewProps = settings->globalViewProps() || url.isEmpty();
|
const bool useGlobalViewProps = settings->globalViewProps() || url.isEmpty();
|
||||||
bool useDetailsViewWithPath = false;
|
bool useDetailsViewWithPath = false;
|
||||||
|
bool useRecentDocumentsView = false;
|
||||||
|
bool useDownloadsView = false;
|
||||||
|
|
||||||
// We try and save it to the file .directory in the directory being viewed.
|
// We try and save it to the file .directory in the directory being viewed.
|
||||||
// If the directory is not writable by the user or the directory is not local,
|
// If the directory is not writable by the user or the directory is not local,
|
||||||
|
@ -61,6 +63,9 @@ ViewProperties::ViewProperties(const QUrl& url) :
|
||||||
} else if (url.scheme() == QLatin1String("trash")) {
|
} else if (url.scheme() == QLatin1String("trash")) {
|
||||||
m_filePath = destinationDir(QStringLiteral("trash"));
|
m_filePath = destinationDir(QStringLiteral("trash"));
|
||||||
useDetailsViewWithPath = true;
|
useDetailsViewWithPath = true;
|
||||||
|
} else if (url.scheme() == QLatin1String("recentdocuments")) {
|
||||||
|
m_filePath = destinationDir(QStringLiteral("recentdocuments"));
|
||||||
|
useRecentDocumentsView = true;
|
||||||
} else if (url.isLocalFile()) {
|
} else if (url.isLocalFile()) {
|
||||||
m_filePath = url.toLocalFile();
|
m_filePath = url.toLocalFile();
|
||||||
|
|
||||||
|
@ -78,6 +83,10 @@ ViewProperties::ViewProperties(const QUrl& url) :
|
||||||
#endif
|
#endif
|
||||||
m_filePath = destinationDir(QStringLiteral("local")) + m_filePath;
|
m_filePath = destinationDir(QStringLiteral("local")) + m_filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_filePath == QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)) {
|
||||||
|
useDownloadsView = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_filePath = destinationDir(QStringLiteral("remote")) + m_filePath;
|
m_filePath = destinationDir(QStringLiteral("remote")) + m_filePath;
|
||||||
}
|
}
|
||||||
|
@ -94,6 +103,17 @@ ViewProperties::ViewProperties(const QUrl& url) :
|
||||||
if (useDetailsViewWithPath) {
|
if (useDetailsViewWithPath) {
|
||||||
setViewMode(DolphinView::DetailsView);
|
setViewMode(DolphinView::DetailsView);
|
||||||
setVisibleRoles({"path"});
|
setVisibleRoles({"path"});
|
||||||
|
} else if (useRecentDocumentsView || useDownloadsView) {
|
||||||
|
setSortRole(QByteArrayLiteral("modificationtime"));
|
||||||
|
setSortOrder(Qt::DescendingOrder);
|
||||||
|
|
||||||
|
if (useRecentDocumentsView) {
|
||||||
|
setViewMode(DolphinView::DetailsView);
|
||||||
|
setVisibleRoles({QByteArrayLiteral("path")});
|
||||||
|
} else if (useDownloadsView) {
|
||||||
|
setSortFoldersFirst(false);
|
||||||
|
setGroupedSorting(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// The global view-properties act as default for directories without
|
// The global view-properties act as default for directories without
|
||||||
// any view-property configuration. Constructing a ViewProperties
|
// any view-property configuration. Constructing a ViewProperties
|
||||||
|
|
Loading…
Reference in a new issue