mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 21:34:10 -05:00
Use a RetroShareLink to create a link rather than duplicate code, also removes
an awkward conversion from uint64_t to string. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3086 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4072113805
commit
b5ce0fc56b
@ -26,6 +26,7 @@
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include <gui/settings/rsharesettings.h>
|
||||
#include "gui/feeds/AttachFileItem.h"
|
||||
#include "textformat.h"
|
||||
@ -1235,19 +1236,13 @@ void MessageComposer::fileHashingFinished(AttachFileItem* file) {
|
||||
return;
|
||||
}
|
||||
|
||||
//convert fileSize from uint_64 to string for html link
|
||||
char fileSizeChar [100];
|
||||
sprintf(fileSizeChar, "%lld", file->FileSize());
|
||||
std::string fileSize = *(&fileSizeChar);
|
||||
|
||||
std::string mesgString = "<a href='retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "'>"
|
||||
+ "retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "</a>" + "<br>";
|
||||
RetroShareLink message(QString::fromStdString(file->FileName()), file->FileSize(), QString::fromStdString(file->FileHash()));
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "MessageComposer::anchorClicked mesgString : " << mesgString << std::endl;
|
||||
std::cerr << "MessageComposer::anchorClicked message : " << message.toHtmlFull().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
ui.msgText->textCursor().insertHtml(QString::fromStdString(mesgString));
|
||||
ui.msgText->setFocus( Qt::OtherFocusReason );
|
||||
ui.msgText->textCursor().insertHtml(message.toHtmlFull() + QString("<br>"));
|
||||
ui.msgText->setFocus( Qt::OtherFocusReason );
|
||||
}
|
||||
|
||||
void MessageComposer::checkAttachmentReady()
|
||||
@ -1339,4 +1334,4 @@ bool MessageComposer::FilterItem(QTreeWidgetItem *pItem, QString &sPattern)
|
||||
}
|
||||
|
||||
return (bVisible || nVisibleChildCount);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user