mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #2364 from PhenomRetroShare/Fix_ChatHistoryBrowser
Fix Chat History Browser
This commit is contained in:
commit
f0a2fa95ec
@ -403,7 +403,7 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
if (chatId.isLobbyId() || chatId.isDistantChatId())
|
if (chatId.isLobbyId() || chatId.isDistantChatId() || chatId.isPeerId())
|
||||||
{
|
{
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
|
|
||||||
|
@ -44,12 +44,8 @@
|
|||||||
#define ROLE_PLAINTEXT Qt::UserRole + 1
|
#define ROLE_PLAINTEXT Qt::UserRole + 1
|
||||||
|
|
||||||
ImHistoryBrowserCreateItemsThread::ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const ChatId& peerId)
|
ImHistoryBrowserCreateItemsThread::ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const ChatId& peerId)
|
||||||
: QThread(parent)
|
: QThread(parent), m_historyBrowser(parent), m_chatId(peerId), stopped(false)
|
||||||
{
|
{}
|
||||||
m_chatId = peerId;
|
|
||||||
m_historyBrowser = parent;
|
|
||||||
stopped = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImHistoryBrowserCreateItemsThread::~ImHistoryBrowserCreateItemsThread()
|
ImHistoryBrowserCreateItemsThread::~ImHistoryBrowserCreateItemsThread()
|
||||||
{
|
{
|
||||||
@ -285,10 +281,12 @@ void ImHistoryBrowser::fillItem(QListWidgetItem *itemWidget, HistoryMsg& msg)
|
|||||||
QString name;
|
QString name;
|
||||||
if (m_chatId.isLobbyId() || m_chatId.isDistantChatId()) {
|
if (m_chatId.isLobbyId() || m_chatId.isDistantChatId()) {
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
if (rsIdentity->getIdDetails(RsGxsId(msg.peerName), details))
|
if (rsIdentity->getIdDetails(RsGxsId(msg.peerId), details))
|
||||||
name = QString::fromUtf8(details.mNickname.c_str());
|
name = QString::fromUtf8(details.mNickname.c_str());
|
||||||
else
|
else if(!msg.peerName.empty())
|
||||||
name = QString::fromUtf8(msg.peerName.c_str());
|
name = QString::fromUtf8(msg.peerName.c_str());
|
||||||
|
else
|
||||||
|
name = QString::fromUtf8(msg.peerId.toStdString().c_str());
|
||||||
} else {
|
} else {
|
||||||
name = QString::fromUtf8(msg.peerName.c_str());
|
name = QString::fromUtf8(msg.peerName.c_str());
|
||||||
}
|
}
|
||||||
|
@ -618,13 +618,13 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo
|
|||||||
|
|
||||||
QString errorMsg; int errorLine; int errorColumn;
|
QString errorMsg; int errorLine; int errorColumn;
|
||||||
|
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
if (doc.setContent(formattedText, &errorMsg, &errorLine, &errorColumn) == false) {
|
if (doc.setContent(formattedText, &errorMsg, &errorLine, &errorColumn) == false) {
|
||||||
|
|
||||||
// convert text with QTextBrowser
|
// convert text with QTextDocument
|
||||||
QTextBrowser textBrowser;
|
QTextDocument textDoc;
|
||||||
textBrowser.setText(text);
|
textDoc.setPlainText(text);
|
||||||
formattedText=textBrowser.toHtml();
|
formattedText=textDoc.toHtml();
|
||||||
formattedText.remove(0,formattedText.indexOf("<"));
|
formattedText.remove(0,formattedText.indexOf("<"));
|
||||||
formattedText=saveSpace(formattedText);
|
formattedText=saveSpace(formattedText);
|
||||||
doc.setContent(formattedText, &errorMsg, &errorLine, &errorColumn);
|
doc.setContent(formattedText, &errorMsg, &errorLine, &errorColumn);
|
||||||
|
Loading…
Reference in New Issue
Block a user