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; ChannelInfo ci;
if (rsChannels->getChannelInfo(mChannelId, ci)) { if (rsChannels->getChannelInfo(mChannelId, ci)) {
RetroShareLink link(RetroShareLink::TYPE_CHANNEL, QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), ""); RetroShareLink link;
if (link.valid() && link.type() == RetroShareLink::TYPE_CHANNEL) { if (link.createChannel(QString::fromStdWString(ci.channelName), QString::fromStdString(ci.channelId), "")) {
std::vector<RetroShareLink> urls; std::vector<RetroShareLink> urls;
urls.push_back(link); urls.push_back(link);
RSLinkClipboard::copyLinks(urls); RSLinkClipboard::copyLinks(urls);

View File

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

View File

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

View File

@ -32,6 +32,7 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "ForumsDialog.h" #include "ForumsDialog.h"
#include "ChannelFeed.h" #include "ChannelFeed.h"
#include "SearchDialog.h"
#include "util/misc.h" #include "util/misc.h"
#include "common/PeerDefs.h" #include "common/PeerDefs.h"
@ -46,7 +47,7 @@
#define HOST_PERSON "person" #define HOST_PERSON "person"
#define HOST_FORUM "forum" #define HOST_FORUM "forum"
#define HOST_CHANNEL "channel" #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_NAME "name"
#define FILE_SIZE "size" #define FILE_SIZE "size"
@ -63,6 +64,9 @@
#define CHANNEL_ID "id" #define CHANNEL_ID "id"
#define CHANNEL_MSGID "msgid" #define CHANNEL_MSGID "msgid"
#define HOST_SEARCH "search"
#define SEARCH_KEYWORDS "keywords"
RetroShareLink::RetroShareLink(const QUrl& url) RetroShareLink::RetroShareLink(const QUrl& url)
{ {
fromUrl(url); fromUrl(url);
@ -161,7 +165,6 @@ void RetroShareLink::fromUrl(const QUrl& url)
_type = TYPE_PERSON; _type = TYPE_PERSON;
_name = url.queryItemValue(PERSON_NAME); _name = url.queryItemValue(PERSON_NAME);
_hash = url.queryItemValue(PERSON_HASH).left(40); // normally not necessary, but it's a security. _hash = url.queryItemValue(PERSON_HASH).left(40); // normally not necessary, but it's a security.
_size = 0;
check(); check();
return; return;
} }
@ -171,7 +174,6 @@ void RetroShareLink::fromUrl(const QUrl& url)
_name = url.queryItemValue(FORUM_NAME); _name = url.queryItemValue(FORUM_NAME);
_hash = url.queryItemValue(FORUM_ID); _hash = url.queryItemValue(FORUM_ID);
_msgId = url.queryItemValue(FORUM_MSGID); _msgId = url.queryItemValue(FORUM_MSGID);
_size = 0;
check(); check();
return; return;
} }
@ -181,7 +183,13 @@ void RetroShareLink::fromUrl(const QUrl& url)
_name = url.queryItemValue(CHANNEL_NAME); _name = url.queryItemValue(CHANNEL_NAME);
_hash = url.queryItemValue(CHANNEL_ID); _hash = url.queryItemValue(CHANNEL_ID);
_msgId = url.queryItemValue(CHANNEL_MSGID); _msgId = url.queryItemValue(CHANNEL_MSGID);
_size = 0; check();
return;
}
if (url.host() == HOST_SEARCH) {
_type = TYPE_SEARCH;
_name = url.queryItemValue(SEARCH_KEYWORDS);
check(); check();
return; return;
} }
@ -194,44 +202,82 @@ void RetroShareLink::fromUrl(const QUrl& url)
clear(); clear();
} }
// file RetroShareLink::RetroShareLink()
RetroShareLink::RetroShareLink(const QString & name, uint64_t size, const QString & hash)
: _name(name),_size(size),_hash(hash)
{ {
_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; _type = TYPE_FILE;
check() ;
check();
return valid();
} }
// person bool RetroShareLink::createPerson(const QString& name, const QString& hash)
RetroShareLink::RetroShareLink(const QString & name, const QString & hash)
: _name(name),_size(0),_hash(hash)
{ {
_valid = false; clear();
_name = name;
_hash = hash;
_type = TYPE_PERSON; _type = TYPE_PERSON;
check() ;
check();
return valid();
} }
// forum, channel bool RetroShareLink::createForum(const QString& name, const QString& id, const QString& msgId)
RetroShareLink::RetroShareLink(enumType type, const QString& name, const QString& id, const QString& msgId)
: _name(name),_size(0),_hash(id),_msgId(msgId)
{ {
_valid = false; clear();
_type = TYPE_UNKNOWN;
switch (type) { _name = name;
case TYPE_UNKNOWN: _hash = id;
case TYPE_FILE: _msgId = msgId;
case TYPE_PERSON:
// wrong type
break;
case TYPE_FORUM:
case TYPE_CHANNEL:
_type = type;
break;
}
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() void RetroShareLink::clear()
@ -291,6 +337,16 @@ void RetroShareLink::check()
if(_hash.isEmpty()) if(_hash.isEmpty())
_valid = false; _valid = false;
break; 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 ??? 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_PERSON:
case TYPE_FORUM: case TYPE_FORUM:
case TYPE_CHANNEL: case TYPE_CHANNEL:
case TYPE_SEARCH:
break; break;
} }
@ -388,6 +445,19 @@ QString RetroShareLink::toString(bool encoded /*= true*/) const
return url.toEncoded(); 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(); return url.toString();
} }
} }
@ -641,6 +711,22 @@ bool RetroShareLink::process(int flag)
return channelFeed->navigate(ci.channelId, msg.msgId); 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; std::cerr << " RetroShareLink::process unknown type: " << type() << std::endl;

View File

@ -47,17 +47,18 @@
class RetroShareLink class RetroShareLink
{ {
public: 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: public:
RetroShareLink();
RetroShareLink(const QUrl& url); RetroShareLink(const QUrl& url);
RetroShareLink(const QString& url); RetroShareLink(const QString& url);
// file
RetroShareLink(const QString& name, uint64_t size, const QString& hash); bool createFile(const QString& name, uint64_t size, const QString& hash);
// person bool createPerson(const QString& name, const QString& hash);
RetroShareLink(const QString& name, const QString& hash); bool createForum(const QString& name, const QString& id, const QString& msgId);
// forum, channel bool createChannel(const QString& name, const QString& id, const QString& msgId);
RetroShareLink(enumType type, const QString& name, const QString& id, const QString& msgId); bool createSearch(const QString& keywords);
enumType type() const {return _type; } enumType type() const {return _type; }
uint64_t size() const { return _size ; } uint64_t size() const { return _size ; }

View File

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

View File

@ -41,6 +41,8 @@ class SearchDialog : public MainPage
/** Default Destructor */ /** Default Destructor */
~SearchDialog(); ~SearchDialog();
void searchKeywords(const QString& keywords);
public slots: public slots:
void updateFiles(qulonglong request_id,FileDetail file) ; void updateFiles(qulonglong request_id,FileDetail file) ;
@ -59,13 +61,11 @@ private slots:
void recommendtofriends(); void recommendtofriends();
void checkText(const QString&) ; void checkText(const QString&) ;
void copysearchLink(); void copyResultLink();
void copySearchLink();
void searchRemove(); void searchRemove();
void searchRemoveAll(); void searchRemoveAll();
void searchKeywords(); void searchKeywords();
/** management of the adv search dialog object when switching search modes */ /** 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) if (!rsFiles->RequestDirDetails(dirStub.ref, details, flags) || details.type != DIR_TYPE_FILE)
continue; continue;
RetroShareLink link(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str()); RetroShareLink link;
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str())) {
if(link.valid() && link.type() == RetroShareLink::TYPE_FILE) urls.push_back(link) ;
urls.push_back(link) ; }
} }
} }
else else
{ {
RetroShareLink link(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str()); RetroShareLink link;
if (link.createFile(QString::fromUtf8(details.name.c_str()), details.count, details.hash.c_str())) {
if(link.valid() && link.type() == RetroShareLink::TYPE_FILE) urls.push_back(link) ;
urls.push_back(link) ; }
} }
} }
RSLinkClipboard::copyLinks(urls) ; RSLinkClipboard::copyLinks(urls) ;
} }
void SharedFilesDialog::copyLinkRemote() void SharedFilesDialog::copyLinkRemote()

View File

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

View File

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

View File

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

View File

@ -69,7 +69,8 @@ void ChanNewItem::updateItemStatic()
ChannelInfo ci; ChannelInfo ci;
if (rsChannels->getChannelInfo(mChanId, 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()); nameLabel->setText(link.toHtml());
descLabel->setText(QString::fromStdWString(ci.channelDesc)); descLabel->setText(QString::fromStdWString(ci.channelDesc));

View File

@ -86,7 +86,8 @@ void ForumMsgItem::updateItemStatic()
ForumInfo fi; ForumInfo fi;
if (rsForums->getForumInfo(mForumId, 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") + ": "; QString title = tr("Forum Post") + ": ";
title += link.toHtml(); title += link.toHtml();
@ -134,7 +135,8 @@ void ForumMsgItem::updateItemStatic()
mIsTop = true; 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) if (mIsTop)
{ {
@ -187,7 +189,8 @@ void ForumMsgItem::updateItemStatic()
{ {
mGpgIdPrev = msgParent.srcId; 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()); prevSubLabel->setText(linkParent.toHtml());
prevMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msgParent.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); 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; ForumInfo fi;
if (rsForums->getForumInfo(mForumId, 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()); nameLabel->setText(link.toHtml());
descLabel->setText(QString::fromStdWString(fi.forumDesc)); descLabel->setText(QString::fromStdWString(fi.forumDesc));

View File

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

View File

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

View File

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