mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added Copy and Send retroshare links for Search
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2109 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
79d95fdc63
commit
633300c5cc
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include "SearchDialog.h"
|
#include "SearchDialog.h"
|
||||||
|
#include "RetroShareLinkAnalyzer.h"
|
||||||
|
#include "msgs/ChanMsgDialog.h"
|
||||||
|
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rsexpr.h"
|
#include "rsiface/rsexpr.h"
|
||||||
#include "rsiface/rsfiles.h"
|
#include "rsiface/rsfiles.h"
|
||||||
@ -69,6 +72,8 @@
|
|||||||
#define SS_COUNT_COL 1
|
#define SS_COUNT_COL 1
|
||||||
#define SS_SEARCH_ID_COL 2
|
#define SS_SEARCH_ID_COL 2
|
||||||
|
|
||||||
|
#define IMAGE_COPYLINK ":/images/copyrslink.png"
|
||||||
|
|
||||||
/* static members */
|
/* static members */
|
||||||
/* These indices MUST be identical to their equivalent indices in the combobox */
|
/* These indices MUST be identical to their equivalent indices in the combobox */
|
||||||
const int SearchDialog::FILETYPE_IDX_ANY = 0;
|
const int SearchDialog::FILETYPE_IDX_ANY = 0;
|
||||||
@ -211,6 +216,12 @@ void SearchDialog::searchtableWidgetCostumPopupMenu( QPoint point )
|
|||||||
downloadAct = new QAction(QIcon(IMAGE_START), tr( "Download" ), this );
|
downloadAct = new QAction(QIcon(IMAGE_START), tr( "Download" ), this );
|
||||||
connect( downloadAct , SIGNAL( triggered() ), this, SLOT( download() ) );
|
connect( downloadAct , SIGNAL( triggered() ), this, SLOT( download() ) );
|
||||||
|
|
||||||
|
copysearchlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), this );
|
||||||
|
connect( copysearchlinkAct , SIGNAL( triggered() ), this, SLOT( copysearchLink() ) );
|
||||||
|
|
||||||
|
sendrslinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link" ), this );
|
||||||
|
connect( sendrslinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||||
|
|
||||||
broadcastonchannelAct = new QAction( tr( "Broadcast on Channel" ), this );
|
broadcastonchannelAct = new QAction( tr( "Broadcast on Channel" ), this );
|
||||||
connect( broadcastonchannelAct , SIGNAL( triggered() ), this, SLOT( broadcastonchannel() ) );
|
connect( broadcastonchannelAct , SIGNAL( triggered() ), this, SLOT( broadcastonchannel() ) );
|
||||||
|
|
||||||
@ -220,9 +231,9 @@ void SearchDialog::searchtableWidgetCostumPopupMenu( QPoint point )
|
|||||||
|
|
||||||
contextMnu->clear();
|
contextMnu->clear();
|
||||||
contextMnu->addAction( downloadAct);
|
contextMnu->addAction( downloadAct);
|
||||||
//contextMnu->addSeparator();
|
contextMnu->addSeparator();
|
||||||
//contextMnu->addAction( broadcastonchannelAct);
|
contextMnu->addAction( copysearchlinkAct);
|
||||||
//contextMnu->addAction( recommendtofriendsAct);
|
contextMnu->addAction( sendrslinkAct);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point,
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point,
|
||||||
@ -936,3 +947,52 @@ void SearchDialog::setIconAndType(QTreeWidgetItem *item, QString &ext)
|
|||||||
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAny.png"));
|
item->setIcon(SR_ICON_COL, QIcon(":/images/FileTypeAny.png"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchDialog::copysearchLink()
|
||||||
|
{
|
||||||
|
RetroShareLinkAnalyzer analyzer;
|
||||||
|
|
||||||
|
/* should also be able to handle multi-selection */
|
||||||
|
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
|
||||||
|
int numdls = itemsForCopy.size();
|
||||||
|
QTreeWidgetItem * item;
|
||||||
|
|
||||||
|
for (int i = 0; i < numdls; ++i)
|
||||||
|
{
|
||||||
|
item = itemsForCopy.at(i);
|
||||||
|
// call copy
|
||||||
|
|
||||||
|
if (!item->childCount())
|
||||||
|
{
|
||||||
|
std::cerr << "SearchDialog::copysearchLink() Calling set retroshare link";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::list<std::string> srcIds;
|
||||||
|
srcIds.push_back(item->text(SR_UID_COL).toStdString()) ;
|
||||||
|
|
||||||
|
QString fhash = item->text(SR_HASH_COL);
|
||||||
|
QString fsize = item->text(SR_REALSIZE_COL);
|
||||||
|
QString fname = item->text(SR_NAME_COL);
|
||||||
|
|
||||||
|
analyzer.setRetroShareLink (fname, fsize, fhash);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
clipboard->setText(analyzer.getRetroShareLink ());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SearchDialog::sendLinkTo( )
|
||||||
|
{
|
||||||
|
copysearchLink();
|
||||||
|
|
||||||
|
/* create a message */
|
||||||
|
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
|
||||||
|
|
||||||
|
nMsgDialog->newMsg();
|
||||||
|
nMsgDialog->insertTitleText("New RetroShare Link(s)");
|
||||||
|
nMsgDialog->insertHtmlText(QApplication::clipboard()->text().toStdString());
|
||||||
|
|
||||||
|
nMsgDialog->show();
|
||||||
|
}
|
||||||
|
@ -60,7 +60,8 @@ private slots:
|
|||||||
void broadcastonchannel();
|
void broadcastonchannel();
|
||||||
|
|
||||||
void recommendtofriends();
|
void recommendtofriends();
|
||||||
|
|
||||||
|
void copysearchLink();
|
||||||
|
|
||||||
|
|
||||||
void searchRemove();
|
void searchRemove();
|
||||||
@ -82,12 +83,14 @@ private slots:
|
|||||||
void selectSearchResults();
|
void selectSearchResults();
|
||||||
|
|
||||||
void clearKeyword();
|
void clearKeyword();
|
||||||
|
|
||||||
|
void sendLinkTo();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** render the results to the tree widget display */
|
/** render the results to the tree widget display */
|
||||||
void initSearchResult(const std::string& txt,qulonglong searchId) ;
|
void initSearchResult(const std::string& txt,qulonglong searchId) ;
|
||||||
void resultsToTree(std::string,qulonglong searchId, const std::list<DirDetails>&);
|
void resultsToTree(std::string,qulonglong searchId, const std::list<DirDetails>&);
|
||||||
void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file) ;
|
void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file) ;
|
||||||
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
|
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
|
||||||
void setIconAndType(QTreeWidgetItem *item, QString &ext);
|
void setIconAndType(QTreeWidgetItem *item, QString &ext);
|
||||||
@ -104,6 +107,8 @@ private:
|
|||||||
|
|
||||||
/** Defines the actions for the context menu */
|
/** Defines the actions for the context menu */
|
||||||
QAction* downloadAct;
|
QAction* downloadAct;
|
||||||
|
QAction* copysearchlinkAct;
|
||||||
|
QAction* sendrslinkAct;
|
||||||
QAction* broadcastonchannelAct;
|
QAction* broadcastonchannelAct;
|
||||||
QAction* recommendtofriendsAct;
|
QAction* recommendtofriendsAct;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user