From b715a577b0431f261573cb6641e04e3c47ef8a18 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 11 Jun 2010 23:28:05 +0000 Subject: [PATCH] changed sort to case insensitive in peers tree git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3113 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/PeersDialog.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 89f60b927..8ec7ceec1 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -101,12 +101,22 @@ public: bool operator<(const QTreeWidgetItem &other) const { + int role = Qt::DisplayRole; int column = m_pWidget ? m_pWidget->sortColumn() : 0; - if (column == COLUMN_STATE) { - // sort by state set in user role - const QVariant v1 = data(column, Qt::UserRole); - const QVariant v2 = other.data(column, Qt::UserRole); - return v1.toString() < v2.toString(); + + switch (column) { + case COLUMN_STATE: + // sort by state set in user role + role = Qt::UserRole; + + // no break; + + case COLUMN_NAME: + { + const QVariant v1 = data(column, role); + const QVariant v2 = other.data(column, role); + return (v1.toString().compare (v2.toString(), Qt::CaseInsensitive) < 0); + } } // let the standard do the sort