mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Dive list: invert default sort order for sort by date / number
Commit 6dc1d239f8 introduced a
well-defined sort order in the case of equal contents. It changed
the code for sorting by date to simply use the order of the
source model.
BUT: The source-model was already sorted in descending order
on date. Thus setting the default order on descening by date,
the data was then presented as *ascending* by date.
Change this back to descending by always using default-ascending
in the filter model.
Ultimately, the source model should simply reflect the ordering
of the core-data (ascending on date), but such a change is
too invasive shortly before release.
Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
			
			
This commit is contained in:
		
							parent
							
								
									1ba15a91ae
								
							
						
					
					
						commit
						76f38ff33b
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		|  | @ -27,7 +27,7 @@ | ||||||
| #include "core/subsurface-qt/DiveListNotifier.h" | #include "core/subsurface-qt/DiveListNotifier.h" | ||||||
| 
 | 
 | ||||||
| DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), sortColumn(DiveTripModel::NR), | DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), sortColumn(DiveTripModel::NR), | ||||||
| 	currentOrder(Qt::DescendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false), | 	currentOrder(Qt::AscendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false), | ||||||
| 	initialColumnWidths(DiveTripModel::COLUMNS, 50)	// Set up with default length 50
 | 	initialColumnWidths(DiveTripModel::COLUMNS, 50)	// Set up with default length 50
 | ||||||
| { | { | ||||||
| 	setItemDelegate(new DiveListDelegate(this)); | 	setItemDelegate(new DiveListDelegate(this)); | ||||||
|  | @ -465,11 +465,9 @@ void DiveListView::headerClicked(int i) | ||||||
| 	/* No layout change? Just re-sort, and scroll to first selection, making sure all selections are expanded */ | 	/* No layout change? Just re-sort, and scroll to first selection, making sure all selections are expanded */ | ||||||
| 	if (currentLayout == newLayout) { | 	if (currentLayout == newLayout) { | ||||||
| 		// If this is the same column as before, change sort order. Otherwise, choose a default
 | 		// If this is the same column as before, change sort order. Otherwise, choose a default
 | ||||||
| 		// sort order (descending for NR and DATE, ascending elsewise).
 | 		// sort order (ascending).
 | ||||||
| 		if (sortColumn == i) | 		if (sortColumn == i) | ||||||
| 			currentOrder = (currentOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder; | 			currentOrder = (currentOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder; | ||||||
| 		else if (i == DiveTripModel::NR || i == DiveTripModel::DATE) |  | ||||||
| 			currentOrder = Qt::DescendingOrder; |  | ||||||
| 		else | 		else | ||||||
| 			currentOrder = Qt::AscendingOrder; | 			currentOrder = Qt::AscendingOrder; | ||||||
| 		sortByColumn(i, currentOrder); | 		sortByColumn(i, currentOrder); | ||||||
|  | @ -480,7 +478,7 @@ void DiveListView::headerClicked(int i) | ||||||
| 		if (currentLayout == DiveTripModel::TREE) | 		if (currentLayout == DiveTripModel::TREE) | ||||||
| 			backupExpandedRows(); | 			backupExpandedRows(); | ||||||
| 		currentLayout = newLayout; | 		currentLayout = newLayout; | ||||||
| 		currentOrder = Qt::DescendingOrder; | 		currentOrder = Qt::AscendingOrder; | ||||||
| 		MultiFilterSortModel::instance()->setLayout(newLayout); | 		MultiFilterSortModel::instance()->setLayout(newLayout); | ||||||
| 		sortByColumn(i, currentOrder); | 		sortByColumn(i, currentOrder); | ||||||
| 		if (newLayout == DiveTripModel::TREE) | 		if (newLayout == DiveTripModel::TREE) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue