On Tuesday 10 September 2013 10:41:41 Jan Kundrát wrote: > On Tuesday, 10 September 2013 10:20:24 CEST, Pali Rohár wrote: > > Yes, for this I prepared setting "gui/msgList.sortOrder". > > But IMAP function > > ThreadingMsgListModel::setUserWantsThreading(bool) is buggy > > when when is called, it change sorting to ascending. So now > > it is not easy to store/restore ascending/descending order > > when server supports threading. > > Ah, you're right, it looks that this is actually not saved to > disk. It could be that the sorting/threading backend has a > bug -- patches welcome. > > Cheers, > Jan
I tried to fix this bug, but it looks like it not easy for me.
I tried it with this patch, but it broke sorting order completly.
diff --git a/src/Imap/Model/ThreadingMsgListModel.cpp
b/src/Imap/Model/ThreadingMsgListModel.cpp
index 7c7c14a..c69f6e4 100644
--- a/src/Imap/Model/ThreadingMsgListModel.cpp
+++ b/src/Imap/Model/ThreadingMsgListModel.cpp
@@ -472,15 +472,16 @@ void ThreadingMsgListModel::updateNoThreading()
Q_ASSERT(list);
for (int i = 0; i < upstreamMessages; ++i) {
+ int offset = m_sortReverse ? upstreamMessages - 1 - i : i;
TreeItemMessage *ptr =
static_cast<TreeItemMessage*>(list->m_children[i]);
Q_ASSERT(ptr);
ThreadNodeInfo node;
node.internalId = i + 1;
node.uid = ptr->uid();
node.ptr = ptr;
- node.offset = i;
+ node.offset = offset;
newThreading[node.internalId] = node;
- allIds.append(node.internalId);
+ allIds.append(offset+1);
newPtrToInternal[node.ptr] = node.internalId;
if (!node.uid) {
unknownUids << ptr;
Second I used this patch which seems to fixed this problem, but everytime when
threading is disabled it calling sort function.
@@ -498,6 +498,8 @@ void ThreadingMsgListModel::updateNoThreading()
}
updatePersistentIndexesPhase2();
emit layoutChanged();
+
+ searchSortPreferenceImplementation(m_currentSearchConditions,
m_currentSortingCriteria, m_sortReverse ?
Qt::DescendingOrder : Qt::AscendingOrder);
}
void ThreadingMsgListModel::wantThreading(const SkipSortSearch skipSortSearch)
This second patch is now in my pali-gsoc branch.
--
Pali Rohár
[email protected]
signature.asc
Description: This is a digitally signed message part.
