From 1cbe55b97c3b8fd9265ad6b40ce6cc169d4451c1 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 24 Mar 2012 23:46:44 +0100 Subject: Cleanup and minor fixes for column-handling --- src/views/dolphinview.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/views/dolphinview.cpp') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 241f24fd4..8672b531b 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -830,18 +830,16 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) QAction* action = menu->exec(pos.toPoint()); if (menu && action) { + KItemListHeader* header = view->header(); + if (action == autoAdjustWidthsAction) { // Clear the column-widths from the viewproperties and turn on // the automatic resizing of the columns props.setHeaderColumnWidths(QList()); - KItemListHeader* header = m_container->controller()->view()->header(); header->setAutomaticColumnResizing(true); } else if (action == customWidthsAction) { // Apply the current column-widths as custom column-widths and turn // off the automatic resizing of the columns - const KItemListView* view = m_container->controller()->view(); - KItemListHeader* header = view->header(); - QList columnWidths; foreach (const QByteArray& role, view->visibleRoles()) { columnWidths.append(header->columnWidth(role)); @@ -862,6 +860,11 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) view->setVisibleRoles(visibleRoles); props.setVisibleRoles(visibleRoles); + + // Reset the stored column-widths, so that automatic resizing is + // used again. + props.setHeaderColumnWidths(QList()); + header->setAutomaticColumnResizing(true); } } -- cgit v1.3