m_showPreview = show;
m_iconManager->setShowPreview(show);
+
+ const int oldZoomLevel = m_controller->zoomLevel();
emit showPreviewChanged();
+
+ // Enabling or disabling the preview might change the icon size of the view.
+ // As the view does not emit a signal when the icon size has been changed,
+ // the used zoom level of the controller must be adjusted manually:
+ updateZoomLevel(oldZoomLevel);
loadDirectory(viewPropsUrl);
}
}
}
+void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+{
+ if (oldUrl == m_controller->url()) {
+ m_controller->setUrl(newUrl);
+ }
+}
+
+void DolphinView::slotRequestUrlChange(const KUrl& url)
+{
+ emit requestUrlChange(url);
+ m_controller->setUrl(url);
+}
void DolphinView::restoreCurrentItem()
{
if (showPreview != m_showPreview) {
m_showPreview = showPreview;
m_iconManager->setShowPreview(showPreview);
+
+ const int oldZoomLevel = m_controller->zoomLevel();
emit showPreviewChanged();
+
+ // Enabling or disabling the preview might change the icon size of the view.
+ // As the view does not emit a signal when the icon size has been changed,
+ // the used zoom level of the controller must be adjusted manually:
+ updateZoomLevel(oldZoomLevel);
}
}
}
}
-void DolphinView::slotRequestUrlChange(const KUrl& url)
-{
- emit requestUrlChange(url);
- m_controller->setUrl(url);
-}
-
-void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
-{
- if (oldUrl == m_controller->url()) {
- m_controller->setUrl(newUrl);
+void DolphinView::updateZoomLevel(int oldZoomLevel)
+{
+ const int newZoomLevel = DolphinController::zoomLevelForIconSize(itemView()->iconSize());
+ if (oldZoomLevel != newZoomLevel) {
+ m_controller->setZoomLevel(newZoomLevel);
+ emit zoomLevelChanged(newZoomLevel);
}
}