fixed trick for own Ids in GxsIdTreeWidgetItem

This commit is contained in:
csoler 2022-11-27 20:37:05 +01:00
parent 6a2886da40
commit 7b0d501c1e
2 changed files with 11 additions and 4 deletions

@ -1 +1 @@
Subproject commit 8f3a3070519322a66b0e83ecb2035e0ac7e67e58 Subproject commit d2651109f8d71659197b2d5315e36cf7d47ba034

View File

@ -109,7 +109,9 @@ public:
QList<QIcon> icons; QList<QIcon> icons;
QString comment; QString comment;
if(rsPeers->isFriend(RsPeerId(id))) // horrible trick because some widgets still use locations as IDs (e.g. messages) if(id.isNull())
name = QObject::tr("[System]");
else if(RsPeerId(id)==rsPeers->getOwnId() || rsPeers->isFriend(RsPeerId(id))) // horrible trick because some widgets still use locations as IDs (e.g. messages)
name = QString::fromUtf8(rsPeers->getPeerName(RsPeerId(id)).c_str()) ; name = QString::fromUtf8(rsPeers->getPeerName(RsPeerId(id)).c_str()) ;
else if(!GxsIdDetails::MakeIdDesc(id, false, name, icons, comment,GxsIdDetails::ICON_TYPE_NONE)) else if(!GxsIdDetails::MakeIdDesc(id, false, name, icons, comment,GxsIdDetails::ICON_TYPE_NONE))
return false; return false;
@ -123,8 +125,13 @@ public:
bool exist = false; bool exist = false;
if(rsPeers->isFriend(RsPeerId(id))) // horrible trick because some widgets still use locations as IDs (e.g. messages) if(id.isNull())
{ {
name = QObject::tr("[System]");
icon = QIcon();
}
else if(RsPeerId(id)==rsPeers->getOwnId() || rsPeers->isFriend(RsPeerId(id))) // horrible trick because some widgets still use locations as IDs (e.g. messages)
{
name = QString::fromUtf8(rsPeers->getPeerName(RsPeerId(id)).c_str()) ; name = QString::fromUtf8(rsPeers->getPeerName(RsPeerId(id)).c_str()) ;
icon = FilesDefs::getIconFromQtResourcePath(":/icons/avatar_128.png"); icon = FilesDefs::getIconFromQtResourcePath(":/icons/avatar_128.png");
} }