mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-21 05:44:29 -05:00
Added to Send RetroShare link as html format for Messages
Added to can download from Messages when clicked on link. Added when start connection attempt then change icon on location. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2056 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e70e995894
commit
84447a6304
@ -75,13 +75,14 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||
connect(ui.replyallmessageButton, SIGNAL(clicked()), this, SLOT(replyallmessage()));
|
||||
connect(ui.forwardmessageButton, SIGNAL(clicked()), this, SLOT(forwardmessage()));
|
||||
|
||||
//connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
|
||||
connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
|
||||
connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
|
||||
|
||||
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
|
||||
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getcurrentrecommended()));
|
||||
|
||||
connect( ui.msgText, SIGNAL( anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &)));
|
||||
|
||||
|
||||
mCurrCertId = "";
|
||||
mCurrMsgId = "";
|
||||
@ -903,3 +904,57 @@ void MessagesDialog::printpreview()
|
||||
preview->show();
|
||||
}
|
||||
|
||||
void MessagesDialog::anchorClicked (const QUrl& link )
|
||||
{
|
||||
#ifdef FORUM_DEBUG
|
||||
std::cerr << "MessagesDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
if (link.scheme() == "retroshare")
|
||||
{
|
||||
QStringList L = link.toString().split("|") ;
|
||||
|
||||
std::string fileName = L.at(1).toStdString() ;
|
||||
uint64_t fileSize = L.at(2).toULongLong();
|
||||
std::string fileHash = L.at(3).toStdString() ;
|
||||
|
||||
#ifdef FORUM_DEBUG
|
||||
std::cerr << "MessagesDialog::anchorClicked FileRequest : fileName : " << fileName << ". fileHash : " << fileHash << ". fileSize : " << fileSize << std::endl;
|
||||
#endif
|
||||
|
||||
if (fileName != "" && fileHash != "")
|
||||
{
|
||||
std::list<std::string> srcIds;
|
||||
|
||||
if(rsFiles->FileRequest(fileName, fileHash, fileSize, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
|
||||
{
|
||||
QMessageBox mb(tr("File Request Confirmation"), tr("The file has been added to your download list."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox mb(tr("File Request canceled"), tr("The file has not been added to your download list, because you already have it."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.exec();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox mb(tr("File Request Error"), tr("The file link is malformed."),QMessageBox::Information,QMessageBox::Ok,0,0);
|
||||
mb.setButtonText( QMessageBox::Ok, "OK" );
|
||||
mb.exec();
|
||||
}
|
||||
}
|
||||
else if (link.scheme() == "http")
|
||||
{
|
||||
QDesktopServices::openUrl(link);
|
||||
}
|
||||
else if (link.scheme() == "")
|
||||
{
|
||||
//it's probably a web adress, let's add http:// at the beginning of the link
|
||||
QString newAddress = link.toString();
|
||||
newAddress.prepend("http://");
|
||||
QDesktopServices::openUrl(QUrl(newAddress));
|
||||
}
|
||||
}
|
@ -60,6 +60,8 @@ private slots:
|
||||
|
||||
void removemessage();
|
||||
|
||||
void anchorClicked (const QUrl &);
|
||||
|
||||
void getcurrentrecommended();
|
||||
// void getallrecommended();
|
||||
|
||||
|
@ -401,6 +401,15 @@ void PeersDialog::insertPeers()
|
||||
/* not displayed, used to find back the item */
|
||||
sslItem -> setText(1, QString::fromStdString(sslDetail.autoconnect));
|
||||
|
||||
if (sslDetail.autoconnect !="Offline")
|
||||
{
|
||||
sslItem -> setIcon(0, (QIcon(":/images/connect_creating.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
sslItem -> setIcon(0, (QIcon(":/images/connect_no.png")));
|
||||
}
|
||||
|
||||
/* change color and icon */
|
||||
int i;
|
||||
if (sslDetail.state & RS_PEER_STATE_CONNECTED) {
|
||||
|
@ -341,6 +341,26 @@ void SharedFilesDialog::sendLinkTo( /*std::string rsid*/ )
|
||||
nMsgDialog->show();
|
||||
}
|
||||
|
||||
void SharedFilesDialog::sendHtmlLinkTo( )
|
||||
{
|
||||
copyLinkLocal ();
|
||||
|
||||
/* create a message */
|
||||
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
|
||||
|
||||
|
||||
/* fill it in
|
||||
* files are receommended already
|
||||
* just need to set peers
|
||||
*/
|
||||
std::cerr << "SharedFilesDialog::sendLinkTo()" << std::endl;
|
||||
nMsgDialog->newMsg();
|
||||
nMsgDialog->insertTitleText("RetroShare Link");
|
||||
nMsgDialog->insertHtmlText(QApplication::clipboard()->text().toStdString());
|
||||
|
||||
nMsgDialog->show();
|
||||
}
|
||||
|
||||
void SharedFilesDialog::sendLinkToCloud()
|
||||
{
|
||||
copyLinkLocal ();
|
||||
@ -615,7 +635,10 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
connect( copylinklocalAct , SIGNAL( triggered() ), this, SLOT( copyLinkLocal() ) );
|
||||
|
||||
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link" ), this );
|
||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( /*std::string rsid*/ ) ) );
|
||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||
|
||||
sendhtmllinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link (html)" ), this );
|
||||
connect( sendhtmllinkAct , SIGNAL( triggered() ), this, SLOT( sendHtmlLinkTo( ) ) );
|
||||
|
||||
sendlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link to Cloud" ), this );
|
||||
connect( sendlinkCloudAct , SIGNAL( triggered() ), this, SLOT( sendLinkToCloud( ) ) );
|
||||
@ -636,6 +659,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
contextMnu2.addSeparator();
|
||||
contextMnu2.addAction( copylinklocalAct);
|
||||
contextMnu2.addAction( sendlinkAct);
|
||||
contextMnu2.addAction( sendhtmllinkAct);
|
||||
contextMnu2.addSeparator();
|
||||
contextMnu2.addAction( sendlinkCloudAct);
|
||||
contextMnu2.addAction( addlinkCloudAct);
|
||||
|
@ -65,6 +65,7 @@ private slots:
|
||||
void copyLinkLocal();
|
||||
void sendLinkTo();
|
||||
void sendremoteLinkTo();
|
||||
void sendHtmlLinkTo();
|
||||
void sendLinkToCloud();
|
||||
void addLinkToCloud();
|
||||
|
||||
@ -109,6 +110,7 @@ private:
|
||||
QAction* copylinklocalAct;
|
||||
QAction* sendremotelinkAct;
|
||||
QAction* sendlinkAct;
|
||||
QAction* sendhtmllinkAct;
|
||||
QAction* sendlinkCloudAct;
|
||||
QAction* addlinkCloudAct;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
<file>images/btn_27_hover.png</file>
|
||||
<file>images/connect_established.png</file>
|
||||
<file>images/connect_creating.png</file>
|
||||
<file>images/connect_no.png</file>
|
||||
<file>images/feedback_arrow.png</file>
|
||||
<file>images/feedback_arrow_hover.png</file>
|
||||
<file>images/feedback-bar-background.png</file>
|
||||
|
@ -215,6 +215,7 @@ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags)
|
||||
_smheader->resizeSection ( 3, 220 );
|
||||
_smheader->resizeSection ( 4, 10 );
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
@ -533,6 +534,11 @@ void ChanMsgDialog::insertMsgText(std::string msg)
|
||||
ui.msgText->setText(QString::fromStdString(msg));
|
||||
}
|
||||
|
||||
void ChanMsgDialog::insertHtmlText(std::string msg)
|
||||
{
|
||||
ui.msgText->setHtml(QString("<a href='") + QString::fromStdString(std::string(msg + "'> ") ) + QString::fromStdString(std::string(msg)) + "</a>") ;
|
||||
}
|
||||
|
||||
|
||||
void ChanMsgDialog::sendMessage()
|
||||
{
|
||||
|
@ -56,6 +56,7 @@ void insertFileList(const std::list<DirDetails>&); /* for Both */
|
||||
void insertTitleText(std::string title);
|
||||
void insertPastedText(std::string msg) ;
|
||||
void insertForwardPastedText(std::string msg);
|
||||
void insertHtmlText(std::string msg);
|
||||
void insertMsgText(std::string msg);
|
||||
void addRecipient(std::string id) ;
|
||||
void Create_New_Image_Tag( const QString urlremoteorlocal );
|
||||
|
Loading…
Reference in New Issue
Block a user