Added new RetroShare link format to start a search

retroshare://search?keywords=...
Enabled key "delete" to remove search results.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4185 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-05-04 10:22:49 +00:00
parent 73daae5992
commit cd8188bf09
18 changed files with 276 additions and 156 deletions

View File

@ -231,8 +231,8 @@ void ChannelFeed::copyChannelLink()
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChannelId, ci)) {
RetroShareLink link(RetroShareLink::TYPE_CHANNEL, QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "");
if (link.valid() && link.type() == RetroShareLink::TYPE_CHANNEL) {
RetroShareLink link;
if (link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "")) {
std::vector<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);

View File

@ -1424,8 +1424,8 @@ void ForumsDialog::copyForumLink()
ForumInfo fi;
if (rsForums->getForumInfo(mCurrForumId, fi)) {
RetroShareLink link(RetroShareLink::TYPE_FORUM, QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "");
if (link.valid() && link.type() == RetroShareLink::TYPE_FORUM) {
RetroShareLink link;
if (link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "")) {
std::vector<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
@ -1441,8 +1441,8 @@ void ForumsDialog::copyMessageLink()
ForumInfo fi;
if (rsForums->getForumInfo(mCurrForumId, fi)) {
RetroShareLink link(RetroShareLink::TYPE_FORUM, QString::fromStdWString(fi.forumName), QString::fromStdString(mCurrForumId), QString::fromStdString(mCurrThreadId));
if (link.valid() && link.type() == RetroShareLink::TYPE_FORUM) {
RetroShareLink link;
if (link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(mCurrForumId), QString::fromStdString(mCurrThreadId))) {
std::vector<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);

View File

@ -1897,9 +1897,11 @@ void PeersDialog::fileHashingFinished(AttachFileItem* file)
// sprintf(fileSizeChar, "%lld", file->FileSize());
// std::string fileSize = *(&fileSizeChar);
QString mesgString = RetroShareLink(QString::fromUtf8(file->FileName().c_str()),
file->FileSize(),
QString::fromStdString(file->FileHash())).toHtmlSize();
RetroShareLink link;
if (!link.createFile(QString::fromUtf8(file->FileName().c_str()), file->FileSize(), QString::fromStdString(file->FileHash()))) {
return;
}
QString mesgString = link.toHtmlSize();
// std::string mesgString = "<a href='retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "'>"
// + "retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "</a>";

View File

@ -32,6 +32,7 @@
#include "MainWindow.h"
#include "ForumsDialog.h"
#include "ChannelFeed.h"
#include "SearchDialog.h"
#include "util/misc.h"
#include "common/PeerDefs.h"
@ -46,7 +47,7 @@
#define HOST_PERSON "person"
#define HOST_FORUM "forum"
#define HOST_CHANNEL "channel"
#define HOST_REGEXP "file|person|forum|channel"
#define HOST_REGEXP "file|person|forum|channel|search"
#define FILE_NAME "name"
#define FILE_SIZE "size"
@ -63,6 +64,9 @@
#define CHANNEL_ID "id"
#define CHANNEL_MSGID "msgid"
#define HOST_SEARCH "search"
#define SEARCH_KEYWORDS "keywords"
RetroShareLink::RetroShareLink(const QUrl& url)
{
fromUrl(url);
@ -161,7 +165,6 @@ void RetroShareLink::fromUrl(const QUrl& url)
_type = TYPE_PERSON;
_name = url.queryItemValue(PERSON_NAME);
_hash = url.queryItemValue(PERSON_HASH).left(40); // normally not necessary, but it's a security.
_size = 0;
check();
return;
}
@ -171,7 +174,6 @@ void RetroShareLink::fromUrl(const QUrl& url)
_name = url.queryItemValue(FORUM_NAME);
_hash = url.queryItemValue(FORUM_ID);
_msgId = url.queryItemValue(FORUM_MSGID);
_size = 0;
check();
return;
}
@ -181,7 +183,13 @@ void RetroShareLink::fromUrl(const QUrl& url)
_name = url.queryItemValue(CHANNEL_NAME);
_hash = url.queryItemValue(CHANNEL_ID);
_msgId = url.queryItemValue(CHANNEL_MSGID);
_size = 0;
check();
return;
}
if (url.host() == HOST_SEARCH) {
_type = TYPE_SEARCH;
_name = url.queryItemValue(SEARCH_KEYWORDS);
check();
return;
}
@ -194,44 +202,82 @@ void RetroShareLink::fromUrl(const QUrl& url)
clear();
}
// file
RetroShareLink::RetroShareLink(const QString & name, uint64_t size, const QString & hash)
: _name(name),_size(size),_hash(hash)
RetroShareLink::RetroShareLink()
{
_valid = false;
clear();
}
bool RetroShareLink::createFile(const QString& name, uint64_t size, const QString& hash)
{
clear();
_name = name;
_size = size;
_hash = hash;
_type = TYPE_FILE;
check() ;
check();
return valid();
}
// person
RetroShareLink::RetroShareLink(const QString & name, const QString & hash)
: _name(name),_size(0),_hash(hash)
bool RetroShareLink::createPerson(const QString& name, const QString& hash)
{
_valid = false;
clear();
_name = name;
_hash = hash;
_type = TYPE_PERSON;
check() ;
check();
return valid();
}
// forum, channel
RetroShareLink::RetroShareLink(enumType type, const QString& name, const QString& id, const QString& msgId)
: _name(name),_size(0),_hash(id),_msgId(msgId)
bool RetroShareLink::createForum(const QString& name, const QString& id, const QString& msgId)
{
_valid = false;
_type = TYPE_UNKNOWN;
clear();
switch (type) {
case TYPE_UNKNOWN:
case TYPE_FILE:
case TYPE_PERSON:
// wrong type
break;
case TYPE_FORUM:
case TYPE_CHANNEL:
_type = type;
break;
}
_name = name;
_hash = id;
_msgId = msgId;
check() ;
_type = TYPE_FORUM;
check();
return valid();
}
bool RetroShareLink::createChannel(const QString& name, const QString& id, const QString& msgId)
{
clear();
_name = name;
_size = 0;
_hash = id;
_msgId = msgId;
_type = TYPE_CHANNEL;
check();
return valid();
}
bool RetroShareLink::createSearch(const QString& keywords)
{
clear();
_name = keywords;
_type = TYPE_SEARCH;
check();
return valid();
}
void RetroShareLink::clear()
@ -291,6 +337,16 @@ void RetroShareLink::check()
if(_hash.isEmpty())
_valid = false;
break;
case TYPE_SEARCH:
if(_size != 0)
_valid = false;
if(_name.isEmpty())
_valid = false;
if(!_hash.isEmpty())
_valid = false;
break;
}
if(!_valid) // we should throw an exception instead of this crap, but drbob doesn't like exceptions. Why ???
@ -316,6 +372,7 @@ QString RetroShareLink::title() const
case TYPE_PERSON:
case TYPE_FORUM:
case TYPE_CHANNEL:
case TYPE_SEARCH:
break;
}
@ -388,6 +445,19 @@ QString RetroShareLink::toString(bool encoded /*= true*/) const
return url.toEncoded();
}
return url.toString();
}
case TYPE_SEARCH:
{
QUrl url;
url.setScheme(RSLINK_SCHEME);
url.setHost(HOST_SEARCH);
url.addQueryItem(SEARCH_KEYWORDS, _name);
if (encoded) {
return url.toEncoded();
}
return url.toString();
}
}
@ -641,6 +711,22 @@ bool RetroShareLink::process(int flag)
return channelFeed->navigate(ci.channelId, msg.msgId);
}
case TYPE_SEARCH:
{
#ifdef DEBUG_RSLINK
std::cerr << " RetroShareLink::process SearchRequest : string : " << name().toStdString() << std::endl;
#endif
MainWindow::showWindow(MainWindow::Search);
SearchDialog *searchDialog = dynamic_cast<SearchDialog*>(MainWindow::getPage(MainWindow::Search));
if (!searchDialog) {
return false;
}
searchDialog->searchKeywords(name());
return true;
}
}
std::cerr << " RetroShareLink::process unknown type: " << type() << std::endl;

View File

@ -47,17 +47,18 @@
class RetroShareLink
{
public:
enum enumType { TYPE_UNKNOWN, TYPE_FILE, TYPE_PERSON, TYPE_FORUM, TYPE_CHANNEL };
enum enumType { TYPE_UNKNOWN, TYPE_FILE, TYPE_PERSON, TYPE_FORUM, TYPE_CHANNEL, TYPE_SEARCH };
public:
RetroShareLink();
RetroShareLink(const QUrl& url);
RetroShareLink(const QString& url);
// file
RetroShareLink(const QString& name, uint64_t size, const QString& hash);
// person
RetroShareLink(const QString& name, const QString& hash);
// forum, channel
RetroShareLink(enumType type, const QString& name, const QString& id, const QString& msgId);
bool createFile(const QString& name, uint64_t size, const QString& hash);
bool createPerson(const QString& name, const QString& hash);
bool createForum(const QString& name, const QString& id, const QString& msgId);
bool createChannel(const QString& name, const QString& id, const QString& msgId);
bool createSearch(const QString& keywords);
enumType type() const {return _type; }
uint64_t size() const { return _size ; }

View File

@ -22,6 +22,7 @@
#include <QMessageBox>
#include <QDir>
#include <QTimer>
#include <QShortcut>
#include "SearchDialog.h"
#include "RetroShareLink.h"
@ -192,6 +193,11 @@ SearchDialog::SearchDialog(QWidget *parent)
ui._anonF2Fsearch_CB->setMinimumWidth(20);
ui.label->setMinimumWidth(20);
// workaround for Qt bug, should be solved in next Qt release 4.7.0
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
QShortcut *Shortcut = new QShortcut(QKeySequence (Qt::Key_Delete), ui.searchSummaryWidget, 0, 0, Qt::WidgetShortcut);
connect(Shortcut, SIGNAL(activated()), this, SLOT(searchRemove()));
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -278,26 +284,13 @@ void SearchDialog::searchtableWidgetCostumPopupMenu( QPoint point )
QMenu contextMnu(this);
QAction* downloadAct = new QAction(QIcon(IMAGE_START), tr( "Download" ), &contextMnu );
connect( downloadAct , SIGNAL( triggered() ), this, SLOT( download() ) );
QAction* copysearchlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), &contextMnu );
connect( copysearchlinkAct , SIGNAL( triggered() ), this, SLOT( copysearchLink() ) );
QAction* sendrslinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link" ), &contextMnu );
connect( sendrslinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
QAction* broadcastonchannelAct = new QAction( tr( "Broadcast on Channel" ), &contextMnu );
connect( broadcastonchannelAct , SIGNAL( triggered() ), this, SLOT( broadcastonchannel() ) );
QAction* recommendtofriendsAct = new QAction( tr( "Recommend to Friends" ), &contextMnu );
connect( recommendtofriendsAct , SIGNAL( triggered() ), this, SLOT( recommendtofriends() ) );
contextMnu.addAction( downloadAct);
contextMnu.addAction(QIcon(IMAGE_START), tr("Download"), this, SLOT(download()));
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyResultLink()));
contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Send RetroShare Link"), this, SLOT(sendLinkTo()));
contextMnu.addAction( copysearchlinkAct);
contextMnu.addAction( sendrslinkAct);
// contextMnu.addAction(tr("Broadcast on Channel"), this, SLOT(broadcastonchannel()));
// contextMnu.addAction(tr("Recommend to Friends"), this, SLOT(recommendtofriends()));
contextMnu.exec(QCursor::pos());
}
@ -429,15 +422,10 @@ void SearchDialog::searchtableWidget2CostumPopupMenu( QPoint point )
QMenu contextMnu(this);
// create the menu as required
QAction* searchRemoveAct = new QAction(QIcon(IMAGE_REMOVE), tr( "Remove" ), &contextMnu );
connect( searchRemoveAct , SIGNAL( triggered() ), this, SLOT( searchRemove() ) );
QAction* searchRemoveAllAct = new QAction(QIcon(IMAGE_REMOVEALL), tr( "Remove All" ), &contextMnu );
connect( searchRemoveAllAct , SIGNAL( triggered() ), this, SLOT( searchRemoveAll() ) );
contextMnu.addAction( searchRemoveAct);
contextMnu.addAction( searchRemoveAllAct);
contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove"), this, SLOT(searchRemove()));
contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove All"), this, SLOT(searchRemoveAll()));
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copySearchLink()));
contextMnu.exec(QCursor::pos());
}
@ -500,6 +488,26 @@ void SearchDialog::clearKeyword()
ui.lineEdit->setFocus();
}
void SearchDialog::copySearchLink()
{
/* get the current search id from the summary window */
QTreeWidgetItem *ci = ui.searchSummaryWidget->currentItem();
if (!ci)
return;
/* get the keywords */
QString keywords = ci->text(SS_TEXT_COL);
std::cerr << "SearchDialog::copySearchLink(): keywords: " << keywords.toStdString();
std::cerr << std::endl;
RetroShareLink link;
if (link.createSearch(keywords)) {
std::vector<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}
/* *****************************************************************
Advanced search implementation
@ -583,11 +591,14 @@ void SearchDialog::advancedSearch(Expression* expression)
}
void SearchDialog::searchKeywords()
{
QString qTxt = ui.lineEdit->text();
std::string txt = qTxt.toStdString();
searchKeywords(ui.lineEdit->text());
}
void SearchDialog::searchKeywords(const QString& keywords)
{
std::string txt = keywords.toStdString();
if(txt.length() < 3)
return ;
@ -606,7 +617,7 @@ void SearchDialog::searchKeywords()
if(ui._friendListsearch_SB->isChecked() || ui._ownFiles_CB->isChecked())
{
/* extract keywords from lineEdit */
QStringList qWords = qTxt.split(" ", QString::SkipEmptyParts);
QStringList qWords = keywords.split(" ", QString::SkipEmptyParts);
std::list<std::string> words;
QStringListIterator qWordsIter(qWords);
while (qWordsIter.hasNext())
@ -1275,7 +1286,7 @@ void SearchDialog::setIconAndType(QTreeWidgetItem *item, QString ext)
}
}
void SearchDialog::copysearchLink()
void SearchDialog::copyResultLink()
{
/* should also be able to handle multi-selection */
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
@ -1291,18 +1302,18 @@ void SearchDialog::copysearchLink()
if (!item->childCount())
{
std::cerr << "SearchDialog::copysearchLink() Calling set retroshare link";
std::cerr << "SearchDialog::copyResultLink() Calling set retroshare link";
std::cerr << std::endl;
QString fhash = item->text(SR_HASH_COL);
qulonglong fsize = item->text(SR_SIZE_COL).toULongLong();
QString fname = item->text(SR_NAME_COL);
RetroShareLink link(fname, fsize, fhash);
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
if(link.valid() && link.type() == RetroShareLink::TYPE_FILE)
RetroShareLink link;
if (link.createFile(fname, fsize, fhash)) {
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
urls.push_back(link) ;
}
}
}
RSLinkClipboard::copyLinks(urls) ;
@ -1310,7 +1321,7 @@ void SearchDialog::copysearchLink()
void SearchDialog::sendLinkTo( )
{
copysearchLink();
copyResultLink();
/* create a message */
MessageComposer *nMsgDialog = MessageComposer::newMsg();

View File

@ -41,6 +41,8 @@ class SearchDialog : public MainPage
/** Default Destructor */
~SearchDialog();
void searchKeywords(const QString& keywords);
public slots:
void updateFiles(qulonglong request_id,FileDetail file) ;
@ -59,13 +61,11 @@ private slots:
void recommendtofriends();
void checkText(const QString&) ;
void copysearchLink();
void copyResultLink();
void copySearchLink();
void searchRemove();
void searchRemoveAll();
void searchKeywords();
/** management of the adv search dialog object when switching search modes */

View File

@ -469,21 +469,21 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
if (!rsFiles->RequestDirDetails(dirStub.ref, details, flags) || details.type != DIR_TYPE_FILE)
continue;
RetroShareLink link(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str());
if(link.valid() && link.type() == RetroShareLink::TYPE_FILE)
urls.push_back(link) ;
RetroShareLink link;
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str())) {
urls.push_back(link) ;
}
}
}
else
{
RetroShareLink link(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str());
if(link.valid() && link.type() == RetroShareLink::TYPE_FILE)
urls.push_back(link) ;
}
{
RetroShareLink link;
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str())) {
urls.push_back(link) ;
}
}
}
RSLinkClipboard::copyLinks(urls) ;
RSLinkClipboard::copyLinks(urls) ;
}
void SharedFilesDialog::copyLinkRemote()

View File

@ -1115,8 +1115,10 @@ void TransfersDialog::copyLink ()
continue;
}
RetroShareLink link(QString::fromStdString(info.fname), info.size, QString::fromStdString(info.hash));
links.push_back(link) ;
RetroShareLink link;
if (link.createFile(QString::fromStdString(info.fname), info.size, QString::fromStdString(info.hash))) {
links.push_back(link) ;
}
}
RSLinkClipboard::copyLinks(links) ;
@ -1224,8 +1226,12 @@ void TransfersDialog::updateDetailsDialog()
if (fname.isEmpty()) {
detailsdlg->setLink("");
} else {
RetroShareLink link(fname, filesize, fhash);
detailsdlg->setLink(link.toString());
RetroShareLink link;
if (link.createFile(fname, filesize, fhash)) {
detailsdlg->setLink(link.toString());
} else {
detailsdlg->setLink("");
}
}
FileChunksInfo info ;

View File

@ -1002,10 +1002,10 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
message+="\" width=\"48\" height=\"48\">";
message+="<br>";
}
message += RetroShareLink(QString::fromUtf8(file->FileName().c_str()),file->FileSize(),QString::fromStdString(file->FileHash())).toHtmlSize();
RetroShareLink link;
link.createFile(QString::fromUtf8(file->FileName().c_str()),file->FileSize(),QString::fromStdString(file->FileHash()));
message += link.toHtmlSize();
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::fileHashingFinished message : " << message.toStdString() << std::endl;

View File

@ -104,10 +104,12 @@ void ChanMsgItem::updateItemStatic()
if (!mIsHome)
{
title = tr("Channel Feed") + ": ";
RetroShareLink link(RetroShareLink::TYPE_CHANNEL, QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "");
RetroShareLink link;
link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "");
title += link.toHtml();
titleLabel->setText(title);
RetroShareLink msgLink(RetroShareLink::TYPE_CHANNEL, QString::fromStdWString(cmi.subject), QString::fromStdString(cmi.channelId), QString::fromStdString(cmi.msgId));
RetroShareLink msgLink;
msgLink.createChannel(QString::fromStdWString(cmi.subject), QString::fromStdString(cmi.channelId), QString::fromStdString(cmi.msgId));
subjectLabel->setText(msgLink.toHtml());
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
@ -403,8 +405,8 @@ void ChanMsgItem::copyLink()
ChannelMsgInfo cmi;
if (rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) {
RetroShareLink link(RetroShareLink::TYPE_CHANNEL, QString::fromStdWString(cmi.subject), QString::fromStdString(cmi.channelId), QString::fromStdString(cmi.msgId));
if (link.valid() && link.type() == RetroShareLink::TYPE_CHANNEL) {
RetroShareLink link;
if (link.createChannel(QString::fromStdWString(cmi.subject), QString::fromStdString(cmi.channelId), QString::fromStdString(cmi.msgId))) {
std::vector<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);

View File

@ -69,7 +69,8 @@ void ChanNewItem::updateItemStatic()
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChanId, ci))
{
RetroShareLink link(RetroShareLink::TYPE_CHANNEL, QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "");
RetroShareLink link;
link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "");
nameLabel->setText(link.toHtml());
descLabel->setText(QString::fromStdWString(ci.channelDesc));

View File

@ -86,7 +86,8 @@ void ForumMsgItem::updateItemStatic()
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
RetroShareLink link(RetroShareLink::TYPE_FORUM, QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "");
RetroShareLink link;
link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "");
QString title = tr("Forum Post") + ": ";
title += link.toHtml();
@ -134,7 +135,8 @@ void ForumMsgItem::updateItemStatic()
mIsTop = true;
}
RetroShareLink link(RetroShareLink::TYPE_FORUM, QString::fromStdWString(msg.title), QString::fromStdString(msg.forumId), QString::fromStdString(msg.msgId));
RetroShareLink link;
link.createForum(QString::fromStdWString(msg.title), QString::fromStdString(msg.forumId), QString::fromStdString(msg.msgId));
if (mIsTop)
{
@ -187,7 +189,8 @@ void ForumMsgItem::updateItemStatic()
{
mGpgIdPrev = msgParent.srcId;
RetroShareLink linkParent(RetroShareLink::TYPE_FORUM, QString::fromStdWString(msgParent.title), QString::fromStdString(msgParent.forumId), QString::fromStdString(msgParent.msgId));
RetroShareLink linkParent;
linkParent.createForum(QString::fromStdWString(msgParent.title), QString::fromStdString(msgParent.forumId), QString::fromStdString(msgParent.msgId));
prevSubLabel->setText(linkParent.toHtml());
prevMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msgParent.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));

View File

@ -70,7 +70,8 @@ void ForumNewItem::updateItemStatic()
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
RetroShareLink link(RetroShareLink::TYPE_FORUM, QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "");
RetroShareLink link;
link.createForum(QString::fromStdWString(fi.forumName), QString::fromStdString(fi.forumId), "");
nameLabel->setText(link.toHtml());
descLabel->setText(QString::fromStdWString(fi.forumDesc));

View File

@ -237,8 +237,8 @@ void CreateForumMsg::fileHashingFinished(AttachFileItem* file) {
return;
}
RetroShareLink link(QString::fromUtf8(file->FileName().c_str()), file->FileSize(), QString::fromStdString(file->FileHash()));
if (link.valid()) {
RetroShareLink link;
if (link.createFile(QString::fromUtf8(file->FileName().c_str()), file->FileSize(), QString::fromStdString(file->FileHash()))) {
QString mesgString = link.toHtmlSize() + "<br>";
#ifdef CHAT_DEBUG

View File

@ -383,8 +383,8 @@ static QString BuildRecommendHtml(std::list<std::string> &peerids)
continue;
}
RetroShareLink link(QString::fromUtf8(detail.name.c_str()), QString::fromStdString(detail.id));
if (link.valid() == false || link.type() != RetroShareLink::TYPE_PERSON) {
RetroShareLink link;
if (link.createPerson(QString::fromUtf8(detail.name.c_str()), QString::fromStdString(detail.id))) {
continue;
}
text += link.toHtmlFull() + "<br>";

View File

@ -853,13 +853,13 @@ p, li { white-space: pre-wrap; }
<context>
<name>ChanMsgItem</name>
<message>
<location filename="../gui/feeds/ChanMsgItem.ui" line="+373"/>
<location filename="../gui/feeds/ChanMsgItem.ui" line="+376"/>
<source>Remove Item</source>
<translation>Eintrag entfernen</translation>
</message>
<message>
<location line="+26"/>
<location filename="../gui/feeds/ChanMsgItem.cpp" line="+317"/>
<location filename="../gui/feeds/ChanMsgItem.cpp" line="+319"/>
<source>Expand</source>
<translation>Erweitern</translation>
</message>
@ -906,12 +906,12 @@ p, li { white-space: pre-wrap; }
<translation>Kopiere RetroShare Link</translation>
</message>
<message>
<location filename="../gui/feeds/ChanMsgItem.cpp" line="-211"/>
<location filename="../gui/feeds/ChanMsgItem.cpp" line="-213"/>
<source>Channel Feed</source>
<translation>Kanal</translation>
</message>
<message>
<location line="+110"/>
<location line="+112"/>
<source>Warning! You have less than %1 hours and %2 minute before this file is delted Consider saving it.</source>
<translation type="unfinished"></translation>
</message>
@ -938,7 +938,7 @@ p, li { white-space: pre-wrap; }
<translation type="obsolete">Gehe zum Kanal</translation>
</message>
<message>
<location filename="../gui/feeds/ChanNewItem.cpp" line="+103"/>
<location filename="../gui/feeds/ChanNewItem.cpp" line="+104"/>
<source>Unknown Channel</source>
<translation>Unbekannter Kanal</translation>
</message>
@ -3592,7 +3592,7 @@ p, li { white-space: pre-wrap; }
<translation>Unterzeichnen</translation>
</message>
<message>
<location filename="../gui/feeds/ForumMsgItem.cpp" line="+90"/>
<location filename="../gui/feeds/ForumMsgItem.cpp" line="+91"/>
<source>Forum Post</source>
<translation>Beitrag</translation>
</message>
@ -3602,19 +3602,19 @@ p, li { white-space: pre-wrap; }
<translation>Unbekannter Forumbeitrag</translation>
</message>
<message>
<location line="+34"/>
<location line="+35"/>
<location line="+23"/>
<location line="+28"/>
<location line="+29"/>
<source>Anonymous</source>
<translation>Anonym</translation>
</message>
<message>
<location line="-17"/>
<location line="-18"/>
<source>In Reply to</source>
<translation>Als Antwort auf</translation>
</message>
<message>
<location line="+165"/>
<location line="+166"/>
<source>Please give a Text Message</source>
<translation>Bitte Nachricht eingeben</translation>
</message>
@ -7654,7 +7654,7 @@ p, li { white-space: pre-wrap; }
<translation>Zusätzliche Datei hinzufügen</translation>
</message>
<message>
<location line="+95"/>
<location line="+97"/>
<location line="+6"/>
<source>Drop file error.</source>
<translation>Dateifehler bei Drag&apos;n&apos;Drop.</translation>
@ -7810,7 +7810,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="-162"/>
<location filename="../gui/PeersDialog.cpp" line="-1513"/>
<location filename="../gui/PeersDialog.cpp" line="-1515"/>
<source>Add Friend</source>
<translation>Freund hinzufügen</translation>
</message>
@ -7871,7 +7871,7 @@ p, li { white-space: pre-wrap; }
<translation>Willst du diesen Freund entfernen?</translation>
</message>
<message>
<location line="+734"/>
<location line="+736"/>
<source>Save as...</source>
<translation>Speichern unter...</translation>
</message>
@ -7891,7 +7891,7 @@ p, li { white-space: pre-wrap; }
<translation>Status Spalte ausblenden</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-649"/>
<location filename="../gui/PeersDialog.cpp" line="-651"/>
<source>is typing...</source>
<translation>tippt...</translation>
</message>
@ -8958,7 +8958,7 @@ Lockdatei:
<translation>Vielleicht ist das Passwort falsch</translation>
</message>
<message>
<location filename="../gui/RetroShareLink.cpp" line="+508"/>
<location filename="../gui/RetroShareLink.cpp" line="+578"/>
<source>File Request Confirmation</source>
<translation>Bestätigung der Dateianforderung</translation>
</message>
@ -9054,7 +9054,7 @@ Lockdatei:
<translation>Der Kanal &quot;%1&quot; konnte nicht gefunden werden.</translation>
</message>
<message>
<location line="+32"/>
<location line="+48"/>
<source>File Request Error</source>
<translation>Fehler bei der Dateianforderung</translation>
</message>
@ -9681,37 +9681,44 @@ p, li { white-space: pre-wrap; }
<translation>Gib einen Suchbegriff ein (min. 3 Zeichen)</translation>
</message>
<message>
<location line="+181"/>
<source>Copy retroshare Link</source>
<translation type="obsolete">Kopiere RetroShare Link</translation>
</message>
<message>
<source>Send retroshare Link</source>
<translation type="obsolete">Sende RetroShare Link</translation>
</message>
<message>
<source>Broadcast on Channel</source>
<translation type="obsolete">Im Kanal bekanntgeben</translation>
</message>
<message>
<source>Recommend to Friends</source>
<translation type="obsolete">Freunden empfehlen</translation>
</message>
<message>
<location line="+180"/>
<location line="+139"/>
<source>Copy RetroShare Link</source>
<translation>Kopiere RetroShare Link</translation>
</message>
<message>
<location line="+3"/>
<source>Send retroshare Link</source>
<location line="-138"/>
<source>Send RetroShare Link</source>
<translation>Sende RetroShare Link</translation>
</message>
<message>
<location line="+3"/>
<source>Broadcast on Channel</source>
<translation>Im Kanal bekanntgeben</translation>
</message>
<message>
<location line="+3"/>
<source>Recommend to Friends</source>
<translation>Freunden empfehlen</translation>
</message>
<message>
<location line="+140"/>
<location line="+135"/>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<location line="+3"/>
<location line="+1"/>
<source>Remove All</source>
<translation>Alle entfernen</translation>
</message>
<message>
<location line="+351"/>
<location line="+372"/>
<location line="+68"/>
<source>Folder</source>
<translation>Ordner</translation>
@ -9772,7 +9779,7 @@ p, li { white-space: pre-wrap; }
<translation>Such ID</translation>
</message>
<message>
<location filename="../gui/SearchDialog.cpp" line="-966"/>
<location filename="../gui/SearchDialog.cpp" line="-984"/>
<source>Download Notice</source>
<translation>Download</translation>
</message>
@ -11739,12 +11746,12 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location line="+124"/>
<location line="+126"/>
<source>Details:</source>
<translation>Details:</translation>
</message>
<message>
<location line="+186"/>
<location line="+190"/>
<source>File preview</source>
<translation type="unfinished"></translation>
</message>
@ -11764,7 +11771,7 @@ p, li { white-space: pre-wrap; }
<translation>Datei %1 ist nicht komplett. Wenn es eine Media Datei ist dann versuche &quot;Vorschau&quot;.</translation>
</message>
<message>
<location line="-375"/>
<location line="-381"/>
<source>Are you sure that you want to cancel and delete these files?</source>
<translation>Soll dieser Download wirklich abgebrochen und gelöscht werden?</translation>
</message>