mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-07 05:42:19 -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
|
@ -658,24 +658,51 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENTRY_TYPE_PROFILE:
|
case ENTRY_TYPE_PROFILE:
|
||||||
{
|
{
|
||||||
const HierarchicalProfileInformation *profile = getProfileInfo(e);
|
const HierarchicalProfileInformation *profile = getProfileInfo(e);
|
||||||
|
|
||||||
if(!profile)
|
if(!profile)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
#ifdef DEBUG_MODEL_INDEX
|
#ifdef DEBUG_MODEL_INDEX
|
||||||
std::cerr << profile->profile_info.name.c_str() ;
|
std::cerr << profile->profile_info.name.c_str() ;
|
||||||
#endif
|
#endif
|
||||||
switch(col)
|
switch(col)
|
||||||
{
|
{
|
||||||
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()) );
|
||||||
|
|
||||||
default:
|
case COLUMN_THREAD_IP:
|
||||||
return QVariant();
|
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:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENTRY_TYPE_NODE:
|
case ENTRY_TYPE_NODE:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue