Fixed add attachment per drag and drop.

Added the size after the link in group chat too.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3833 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-20 01:40:24 +00:00
parent 8f9a54544d
commit 7bcebc8e2b
3 changed files with 16 additions and 8 deletions

View File

@ -1850,9 +1850,9 @@ void PeersDialog::fileHashingFinished(AttachFileItem* file)
// sprintf(fileSizeChar, "%lld", file->FileSize());
// std::string fileSize = *(&fileSizeChar);
std::string mesgString = RetroShareLink(QString::fromUtf8(file->FileName().c_str()),
file->FileSize(),
QString::fromStdString(file->FileHash())).toHtml().toStdString() ;
QString mesgString = RetroShareLink(QString::fromUtf8(file->FileName().c_str()),
file->FileSize(),
QString::fromStdString(file->FileHash())).toHtmlSize();
// std::string mesgString = "<a href='retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "'>"
// + "retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "</a>";
@ -1860,7 +1860,12 @@ void PeersDialog::fileHashingFinished(AttachFileItem* file)
std::cerr << "PeersDialog::fileHashingFinished mesgString : " << mesgString << std::endl;
#endif
rsMsgs->sendPublicChat(QString::fromStdString(mesgString).toStdWString());
/* convert to real html document */
QTextBrowser textBrowser;
textBrowser.setHtml(mesgString);
std::wstring msg = textBrowser.toHtml().toStdWString();
rsMsgs->sendPublicChat(msg);
setFont();
}

View File

@ -274,7 +274,7 @@ QString RetroShareLink::toHtmlFull() const
QString RetroShareLink::toHtmlSize() const
{
return QString("<a href='") + toString() + "'>" + name() +"</a>" + " " + "<HTML><font color=\"blue\">" + "(" + misc::friendlyUnit(_size) + ")" +"</font></HTML>";
return QString("<a href='") + toString() + "'>" + name() +"</a>" + " " + "<font color=\"blue\">" + "(" + misc::friendlyUnit(_size) + ")" +"</font>";
}
bool RetroShareLink::checkName(const QString& name)

View File

@ -898,7 +898,7 @@ void PopupChatDialog::addExtraFile()
std::string filePath = qfile.toStdString();
if (filePath != "")
{
PopupChatDialog::addAttachment(filePath,0);
addAttachment(filePath,0);
}
}
@ -994,13 +994,16 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
message+= RetroShareLink(QString::fromUtf8(file->FileName().c_str()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtmlSize();
message += RetroShareLink(QString::fromUtf8(file->FileName().c_str()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtmlSize();
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::fileHashingFinished message : " << message.toStdString() << std::endl;
#endif
std::wstring msg = message.toStdWString();
/* convert to real html document */
QTextBrowser textBrowser;
textBrowser.setHtml(message);
std::wstring msg = textBrowser.toHtml().toStdWString();
if (rsMsgs->sendPrivateChat(dialogId, msg)) {
QDateTime currentTime = QDateTime::currentDateTime();