fixed display of message links in composer window and message window. Still takes several attempts to display correctly.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7352 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-05-08 08:39:04 +00:00
parent a946504bb5
commit 3766449bec
4 changed files with 51 additions and 16 deletions

View File

@ -576,8 +576,8 @@ bool RetroShareLink::createMessage(const RsGxsId& peerId, const QString& subject
_hash = QString::fromStdString(peerId.toStdString());
//PeerDefs::rsidFromId(peerId, &_name);
_name = QString::fromStdString("GXS_id("+peerId.toStdString()+")") ;
PeerDefs::rsidFromId(peerId, &_name);
//_name = QString::fromStdString("GXS_id("+peerId.toStdString()+")") ;
// do something better here!!
_subject = subject;
@ -1543,6 +1543,12 @@ static void processList(const QStringList &list, const QString &textSingular, co
if(!gxs_id.isNull() && rsIdentity->getIdDetails(gxs_id,gxs_details))
{
if(gxs_details.mIsOwnId)
{
QMessageBox::warning(NULL,QString("Cannot send message to yourself"),QString("This identity is owned by you. You wouldn't want to send yourself a message right?"));
break ;
}
MessageComposer *msg = MessageComposer::newMsg();
msg->addRecipient(MessageComposer::TO, gxs_id) ;

View File

@ -72,7 +72,7 @@ const QString PeerDefs::rsidFromId(const RsGxsId &id, QString *name /* = NULL*/)
{
QString rsid;
// Check own GXS ids.
// Check own GXS ids first, since they can be obtained faster.
//
std::list<RsGxsId> gxs_ids ;
rsIdentity->getOwnIds(gxs_ids) ;
@ -95,6 +95,18 @@ const QString PeerDefs::rsidFromId(const RsGxsId &id, QString *name /* = NULL*/)
return rsid ;
}
RsIdentityDetails details ;
if(rsIdentity->getIdDetails(id,details))
{
std::string peerName = details.mNickname ;
rsid = PeerDefs::rsid(peerName, id);
if(name)
*name = QString::fromUtf8(peerName.c_str());
return rsid ;
}
rsid = PeerDefs::rsid("", id);
if (name)

View File

@ -104,7 +104,8 @@ MessageWidget *MessageWidget::openMsg(const std::string &msgId, bool window)
}
MessageWidget *msgWidget = new MessageWidget(false, parent);
msgWidget->isWindow = window;
msgWidget->fill(msgId);
msgWidget->fill(msgId);
if (parent) {
parent->addWidget(msgWidget);
}
@ -431,12 +432,19 @@ void MessageWidget::showTagLabels()
}
}
void MessageWidget::refill()
{
//uint32_t msg_id = currMsgId ;
//currMsgId = 0 ;
//fill(msg_id) ;
}
void MessageWidget::fill(const std::string &msgId)
{
if (currMsgId == msgId) {
// message doesn't changed
return;
}
// if (currMsgId == msgId) {
// // message doesn't changed
// return;
// }
ui.decryptFrame->hide();
@ -540,21 +548,29 @@ void MessageWidget::fill(const std::string &msgId)
ui.dateText->setText(DateTime::formatDateTime(msgInfo.ts));
RsPeerId ownId = rsPeers->getOwnId();
QString tooltip_string ;
RsPeerId srcId;
if ((msgInfo.msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX) {
// outgoing message are from me
srcId = ownId;
} else {
srcId = msgInfo.rspeerid_srcId;
if ((msgInfo.msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX) // outgoing message are from me
{
tooltip_string = PeerDefs::rsidFromId(ownId) ;
link.createMessage(ownId, "");
}
else if(msgInfo.msgflags & RS_MSG_DECRYPTED || msgInfo.msgflags & RS_MSG_ENCRYPTED) // distant message
{
tooltip_string = PeerDefs::rsidFromId(msgInfo.rsgxsid_srcId) ;
link.createMessage(msgInfo.rsgxsid_srcId, "");
}
else
{
tooltip_string = PeerDefs::rsidFromId(msgInfo.rspeerid_srcId) ;
link.createMessage(msgInfo.rspeerid_srcId, "");
}
link.createMessage(srcId, "");
if ((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.rspeerid_srcId == ownId) {
ui.fromText->setText("RetroShare");
} else {
ui.fromText->setText(link.toHtml());
ui.fromText->setToolTip(PeerDefs::rsidFromId(srcId));
ui.fromText->setToolTip(tooltip_string) ;
}
if (msgInfo.msgflags & RS_MSG_ENCRYPTED) {

View File

@ -69,6 +69,7 @@ private slots:
void print();
void printPreview();
void saveAs();
void refill();
void msgfilelistWidgetCostumPopupMenu(QPoint);
void messagesTagsChanged();