Added for Private Chat Attachments to display for each rs link with file size

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3346 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-08-06 15:31:30 +00:00
parent 0abfbbb911
commit bbd3902bbe
3 changed files with 13 additions and 1 deletions

View File

@ -29,6 +29,7 @@
#include <QObject> #include <QObject>
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "util/misc.h"
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
@ -187,6 +188,11 @@ QString RetroShareLink::toHtmlFull() const
return QString("<a href='") + toString() + "'>" + toString() + "</a>" ; return QString("<a href='") + toString() + "'>" + toString() + "</a>" ;
} }
QString RetroShareLink::toHtmlSize() const
{
return QString("<a href='") + toString() + "'>" + name() +"</a>" + " " + "<HTML><font color=\"blue\">" + "(" + misc::friendlyUnit(_size) + ")" +"</font></HTML>";
}
bool RetroShareLink::checkName(const QString& name) bool RetroShareLink::checkName(const QString& name)
{ {
if(name == "") if(name == "")

View File

@ -72,6 +72,8 @@ class RetroShareLink
/// returns the string <a href="retroshare://file|name|size|hash">retroshare://file|name|size|hash</a> /// returns the string <a href="retroshare://file|name|size|hash">retroshare://file|name|size|hash</a>
/// <a href="retroshare://person|name|hash">retroshare://person|name|hash</a> /// <a href="retroshare://person|name|hash">retroshare://person|name|hash</a>
QString toHtmlFull() const ; QString toHtmlFull() const ;
QString toHtmlSize() const ;
QUrl toUrl() const ; QUrl toUrl() const ;
@ -125,6 +127,10 @@ class RSLinkClipboard
// produces a list of html links that displays the full links // produces a list of html links that displays the full links
// //
static QString toHtmlFull(); static QString toHtmlFull();
// produces a list of html links that displays with the file name + filesize
//
static QString toHtmlSize();
// Returns true is no links are found to paste. // Returns true is no links are found to paste.
// Useful for menus. // Useful for menus.

View File

@ -1004,7 +1004,7 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
message+="<br>"; message+="<br>";
} }
message+= RetroShareLink(QString::fromStdString(file->FileName()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtml(); message+= RetroShareLink(QString::fromStdString(file->FileName()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtmlSize();
#ifdef CHAT_DEBUG #ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::anchorClicked message : " << message.toStdString() << std::endl; std::cerr << "PopupChatDialog::anchorClicked message : " << message.toStdString() << std::endl;