Unverified Commit 3203921a authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Fix sorting in KeyRearrangeColumnsProxyModel

We need to map the sort column to source. Otherwise
the wrong column is sorted.

GnuPG-Bug-Id: 3603
parent 19ce80f2
......@@ -81,3 +81,15 @@ QList<QModelIndex> KeyRearrangeColumnsProxyModel::indexes(const std::vector<GpgM
}
return myIdxs;
}
void KeyRearrangeColumnsProxyModel::sort(int column, Qt::SortOrder order)
{
const auto fakeIdx = createIndex(0, column);
if (!fakeIdx.isValid()) {
// Empty model?
KRearrangeColumnsProxyModel::sort(column, order);
return;
}
const auto remappedIdx = mapToSource(fakeIdx);
KRearrangeColumnsProxyModel::sort(remappedIdx.column(), order);
}
......@@ -54,6 +54,8 @@ public:
QModelIndex index(const GpgME::Key &key) const override;
QList<QModelIndex> indexes(const std::vector<GpgME::Key> &keys) const override;
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
private:
KeyListModelInterface *klm() const;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment