if (mode != m_mode) {
ViewProperties props(viewPropertiesUrl());
props.setViewMode(mode);
- props.save();
- applyViewProperties();
+ // We pass the new ViewProperties to applyViewProperties, rather than
+ // storing them on disk and letting applyViewProperties() read them
+ // from there, to prevent that changing the view mode fails if the
+ // .directory file is not writable (see bug 318534).
+ applyViewProperties(props);
}
}
void DolphinView::applyViewProperties()
{
- m_view->beginTransaction();
-
const ViewProperties props(viewPropertiesUrl());
+ applyViewProperties(props);
+}
+
+void DolphinView::applyViewProperties(const ViewProperties& props)
+{
+ m_view->beginTransaction();
const Mode mode = props.viewMode();
if (m_mode != mode) {
/**
* Applies the view properties which are defined by the current URL
- * to the DolphinView properties.
+ * to the DolphinView properties. The view properties are read from a
+ * .directory file either in the current directory, or in the
+ * share/apps/dolphin/view_properties/ subfolder of the user's .kde folder.
*/
void applyViewProperties();
+ /**
+ * Applies the given view properties to the DolphinView.
+ */
+ void applyViewProperties(const ViewProperties& props);
+
/**
* Applies the m_mode property to the corresponding
* itemlayout-property of the KItemListView.