Fixed sort by name and sort by state in PeersDialog.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3940 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-12-27 14:00:13 +00:00
parent 9d2fa1bcb5
commit 2a2912cabf

View File

@ -972,6 +972,7 @@ void PeersDialog::insertPeers()
} }
} }
int bestPeerState = 0; // for gpg item
int i = 0; int i = 0;
QIcon gpgIcon; QIcon gpgIcon;
if (gpg_connected) { if (gpg_connected) {
@ -979,7 +980,6 @@ void PeersDialog::insertPeers()
onlineCount++; onlineCount++;
int bestPeerState = 0; // for gpg item
std::string bestSslId; // for gpg item std::string bestSslId; // for gpg item
unsigned int bestRSState = 0; // for gpg item unsigned int bestRSState = 0; // for gpg item
@ -1052,8 +1052,6 @@ void PeersDialog::insertPeers()
} }
// gpgItem->setToolTip(COLUMN_NAME, StatusDefs::tooltip(bestRSState)); // gpgItem->setToolTip(COLUMN_NAME, StatusDefs::tooltip(bestRSState));
gpgItem->setData(COLUMN_NAME, ROLE_SORT, BuildStateSortString(true, gpgItemText, bestPeerState));
gpgItem->setData(COLUMN_STATE, ROLE_SORT, BuildStateSortString(true, gpgItem->text(COLUMN_NAME), bestPeerState));
} else if (gpg_online) { } else if (gpg_online) {
if (useStatusColumn) { if (useStatusColumn) {
gpgItem->setText(COLUMN_STATE, tr("Available")); gpgItem->setText(COLUMN_STATE, tr("Available"));
@ -1061,10 +1059,10 @@ void PeersDialog::insertPeers()
gpgItemText += " [" + tr("Available") + "]"; gpgItemText += " [" + tr("Available") + "]";
} }
bestPeerState = PEER_STATE_AVAILABLE;
onlineCount++; onlineCount++;
gpgItem->setHidden(hideUnconnected); gpgItem->setHidden(hideUnconnected);
gpgIcon = QIcon(IMAGE_AVAILABLE); gpgIcon = QIcon(IMAGE_AVAILABLE);
gpgItem->setData(COLUMN_NAME, ROLE_SORT, BuildStateSortString(true, gpgItemText, PEER_STATE_AVAILABLE));
QFont font; QFont font;
font.setBold(true); font.setBold(true);
@ -1079,9 +1077,9 @@ void PeersDialog::insertPeers()
gpgItemText += " [" + StatusDefs::name(RS_STATUS_OFFLINE) + "]"; gpgItemText += " [" + StatusDefs::name(RS_STATUS_OFFLINE) + "]";
} }
bestPeerState = PEER_STATE_OFFLINE;
gpgItem->setHidden(hideUnconnected); gpgItem->setHidden(hideUnconnected);
gpgIcon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE)); gpgIcon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE));
gpgItem->setData(COLUMN_NAME, ROLE_SORT, BuildStateSortString(true, gpgItemText, PEER_STATE_OFFLINE));
QColor textColor = StatusDefs::textColor(RS_STATUS_OFFLINE); QColor textColor = StatusDefs::textColor(RS_STATUS_OFFLINE);
QFont font = StatusDefs::font(RS_STATUS_OFFLINE); QFont font = StatusDefs::font(RS_STATUS_OFFLINE);
@ -1097,6 +1095,7 @@ void PeersDialog::insertPeers()
gpgItem->setText(COLUMN_NAME, gpgItemText); gpgItem->setText(COLUMN_NAME, gpgItemText);
gpgItem->setData(COLUMN_NAME, ROLE_SORT, "2 " + gpgItemText); gpgItem->setData(COLUMN_NAME, ROLE_SORT, "2 " + gpgItemText);
gpgItem->setData(COLUMN_STATE, ROLE_SORT, "2 " + BuildStateSortString(true, gpgItemText, bestPeerState));
gpgItem->setIcon(COLUMN_NAME, gpgIcon); gpgItem->setIcon(COLUMN_NAME, gpgIcon);
} }