- // If the .directory file does not exist or the timestamp is too old,
- // use the values from the global .directory file instead, which acts
- // as default view for new folders in this case.
- settings->setGlobalViewProps(true);
+ if (useDetailsViewWithPath) {
+ setViewMode(DolphinView::DetailsView);
+ 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 {
+ // The global view-properties act as default for directories without
+ // any view-property configuration. Constructing a ViewProperties
+ // instance for an empty QUrl ensures that the global view-properties
+ // are loaded.
+ QUrl emptyUrl;
+ ViewProperties defaultProps(emptyUrl);
+ setDirProperties(defaultProps);
+
+ m_changedProps = false;
+ }
+ }
+
+ if (m_node->version() < CurrentViewPropertiesVersion) {
+ // The view-properties have an outdated version. Convert the properties
+ // to the changes of the current version.
+ if (m_node->version() < AdditionalInfoViewPropertiesVersion) {
+ convertAdditionalInfo();
+ Q_ASSERT(m_node->version() == AdditionalInfoViewPropertiesVersion);
+ }
+
+ if (m_node->version() < NameRolePropertiesVersion) {
+ convertNameRoleToTextRole();
+ Q_ASSERT(m_node->version() == NameRolePropertiesVersion);
+ }