From f1d1a18a7169e9ad7ad4fd9cd21261d76e1c2bf0 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 6 Nov 2007 07:16:23 +0000 Subject: When switching from e. g. the icons view to the details view, additional information properties like 'Size' and 'Date' are added as default (showing a details-view without details does not make sense as default setting...). This fix assures that the additional information properties are removed again when switching back to the icons view. Only if the user modified the additional information properties by a GUI-interaction (e. g. by adding a 'Type'), this information is persistet also when switching back to the icon-view. BUG: 151891 svn path=/trunk/KDE/kdebase/apps/; revision=733313 --- src/dolphinview.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 004b158ed..fabda169e 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -194,6 +194,11 @@ void DolphinView::setMode(Mode mode) m_controller->setUrl(root); } + deleteView(); + + // It is important to read the view properties _after_ deleting the view, + // as e. g. the detail view might adjust the additional information properties + // after getting closed: const KUrl viewPropsUrl = viewPropertiesUrl(); ViewProperties props(viewPropsUrl); props.setViewMode(m_mode); @@ -770,6 +775,7 @@ void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList& { ViewProperties props(viewPropertiesUrl()); props.setAdditionalInfo(info); + props.save(); m_fileItemDelegate->setShowInformation(info); @@ -826,24 +832,12 @@ void DolphinView::clearHoverInformation() void DolphinView::createView() { - // delete current view - QAbstractItemView* view = itemView(); - if (view != 0) { - m_topLayout->removeWidget(view); - view->close(); - view->deleteLater(); - view = 0; - m_iconsView = 0; - m_detailsView = 0; - m_columnView = 0; - m_fileItemDelegate = 0; - } - + deleteView(); Q_ASSERT(m_iconsView == 0); Q_ASSERT(m_detailsView == 0); Q_ASSERT(m_columnView == 0); - // ... and recreate it representing the current mode + QAbstractItemView* view = 0; switch (m_mode) { case IconsView: { m_iconsView = new DolphinIconsView(this, m_controller); @@ -881,6 +875,21 @@ void DolphinView::createView() this, SLOT(emitContentsMoved())); } +void DolphinView::deleteView() +{ + QAbstractItemView* view = itemView(); + if (view != 0) { + m_topLayout->removeWidget(view); + view->close(); + view->deleteLater(); + view = 0; + m_iconsView = 0; + m_detailsView = 0; + m_columnView = 0; + m_fileItemDelegate = 0; + } +} + QAbstractItemView* DolphinView::itemView() const { if (m_detailsView != 0) { -- cgit v1.3