mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-26 07:55:44 -04:00
show last contact and IP on closed profiles to be the data of the most recent node
This commit is contained in:
parent
0855c05ad6
commit
1a5a99f076
1 changed files with 40 additions and 13 deletions
|
@ -672,6 +672,33 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
|
||||||
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(profile->profile_info.name.c_str()));
|
case COLUMN_THREAD_NAME: return QVariant(QString::fromUtf8(profile->profile_info.name.c_str()));
|
||||||
case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(profile->profile_info.gpg_id.toStdString()) );
|
case COLUMN_THREAD_ID: return QVariant(QString::fromStdString(profile->profile_info.gpg_id.toStdString()) );
|
||||||
|
|
||||||
|
case COLUMN_THREAD_IP:
|
||||||
|
case COLUMN_THREAD_LAST_CONTACT:
|
||||||
|
{
|
||||||
|
if(!isProfileExpanded(e))
|
||||||
|
{
|
||||||
|
const HierarchicalProfileInformation *hn = getProfileInfo(e);
|
||||||
|
|
||||||
|
QDateTime most_recent_time = QDateTime::fromTime_t(0);
|
||||||
|
QString most_recent_ip("---");
|
||||||
|
|
||||||
|
for(uint32_t i=0;i<hn->child_node_indices.size();++i)
|
||||||
|
{
|
||||||
|
const HierarchicalNodeInformation& node = mLocations[hn->child_node_indices[i]];
|
||||||
|
auto node_time = QDateTime::fromTime_t(node.node_info.lastConnect);
|
||||||
|
|
||||||
|
if(most_recent_time < node_time)
|
||||||
|
{
|
||||||
|
most_recent_time = node_time;
|
||||||
|
most_recent_ip = (node.node_info.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(node.node_info) : QString("---");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(col == COLUMN_THREAD_LAST_CONTACT) return QVariant(most_recent_time);
|
||||||
|
if(col == COLUMN_THREAD_IP) return QVariant(most_recent_ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue