diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 44459ea08..c4201b451 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -146,6 +146,7 @@ HEADERS += rshare.h \ gui/RemoteDirModel.h \ gui/RetroShareLinkAnalyzer.h \ gui/SearchTreeWidget.h \ + gui/SendLinkDialog.h \ gui/SearchDialog.h \ gui/SharedFilesDialog.h \ gui/ShareManager.h \ @@ -260,6 +261,7 @@ FORMS += gui/StartDialog.ui \ gui/MessengerWindow.ui \ gui/PeersDialog.ui \ gui/SearchDialog.ui \ + gui/SendLinkDialog.ui \ gui/SharedFilesDialog.ui \ gui/ShareManager.ui \ gui/MessagesDialog.ui \ @@ -331,6 +333,7 @@ SOURCES += main.cpp \ gui/RetroShareLinkAnalyzer.cpp \ gui/SearchTreeWidget.cpp \ gui/SearchDialog.cpp \ + gui/SendLinkDialog.cpp \ gui/AddLinksDialog.cpp \ gui/SharedFilesDialog.cpp \ gui/ShareManager.cpp \ diff --git a/retroshare-gui/src/gui/SendLinkDialog.cpp b/retroshare-gui/src/gui/SendLinkDialog.cpp new file mode 100644 index 000000000..d13614fbc --- /dev/null +++ b/retroshare-gui/src/gui/SendLinkDialog.cpp @@ -0,0 +1,76 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2006 - 2009, RetroShre Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ +#include "SendLinkDialog.h" + +#include "rsiface/rsiface.h" +#include "rsiface/rspeers.h" +#include "rsiface/rsdisc.h" +#include "rsiface/rsmsgs.h" + + +#include + +#include +#include + + +/** Default constructor */ +SendLinkDialog::SendLinkDialog(QWidget *parent, Qt::WFlags flags) + : QDialog(parent, flags) +{ + /* Invoke Qt Designer generated QObject setup routine */ + ui.setupUi(this); + + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(ui.sendButton, SIGNAL(clicked()), this, SLOT(sendLinktoChat())); + + +} + +/** Destructor. */ +SendLinkDialog::~SendLinkDialog() +{ + +} + +void SendLinkDialog::closeEvent (QCloseEvent * event) +{ + QDialog::closeEvent(event); +} + + +void SendLinkDialog::insertHtmlText(std::string msg) +{ + ui.linkText->setHtml(QString(" ") ) + QString::fromStdString(std::string(msg)) + "") ; + +} + +void SendLinkDialog::sendLinktoChat() +{ + ChatInfo ci; + ci.msg = ui.linkText->toHtml().toStdWString(); + ci.chatflags = RS_CHAT_PUBLIC; + + rsMsgs -> ChatSend(ci); + close(); +} + + diff --git a/retroshare-gui/src/gui/SendLinkDialog.h b/retroshare-gui/src/gui/SendLinkDialog.h new file mode 100644 index 000000000..a45aa8d18 --- /dev/null +++ b/retroshare-gui/src/gui/SendLinkDialog.h @@ -0,0 +1,63 @@ +/**************************************************************** + * RetroShare is distributed under the following license: + * + * Copyright (C) 2006 - 2010, RetroShare Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + ****************************************************************/ + + +#ifndef _SENDLINKDIALOG_H +#define _SENDLINKDIALOG_H + +#include + +#include + +#include "ui_SendLinkDialog.h" + +class SendLinkDialog : public QDialog +{ + Q_OBJECT + + public: + /** Default constructor */ + SendLinkDialog(QWidget *parent = 0, Qt::WFlags flags = 0); + /** Default destructor */ + ~SendLinkDialog(); + + void insertHtmlText(std::string msg); + +protected: + void closeEvent (QCloseEvent * event); + +private slots: + + void sendLinktoChat(); + + +private: + /** A RshareSettings object used for saving/loading settings */ + //RshareSettings* _settings; + + + /** Qt Designer generated object */ + Ui::SendLinkDialog ui; + +}; + +#endif + diff --git a/retroshare-gui/src/gui/SendLinkDialog.ui b/retroshare-gui/src/gui/SendLinkDialog.ui new file mode 100644 index 000000000..fdfb4d81e --- /dev/null +++ b/retroshare-gui/src/gui/SendLinkDialog.ui @@ -0,0 +1,136 @@ + + + SendLinkDialog + + + + 0 + 0 + 477 + 212 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 1000 + 1000 + + + + Send RetroShare link + + + + :/images/rstray3.png:/images/rstray3.png + + + + 0 + + + 0 + + + + + QFrame#frame_2{ +background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, +stop:0 #FEFEFE, stop:1 #E8E8E8); + +border: 1px solid #CCCCCC;} + + + + QFrame::NoFrame + + + QFrame::Raised + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel + + + + + + + Send + + + + + + + + + + QFrame#frame{background-image: url(:/images/connect/connectFriendBanner.png);} + + + + + + + + + 32 + 32 + + + + + + + :/images/ktorrent.png + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:22pt; color:#ffffff;">Send RetroShare Link</span></p></body></html> + + + + + + + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index be11c14a4..493ef20a9 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -19,18 +19,20 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ - #include "rshare.h" #include "SharedFilesDialog.h" #include "settings/AddFileAssociationDialog.h" #include "rsiface/rsiface.h" +#include "rsiface/rsmsgs.h" #include "rsiface/rspeers.h" #include "rsiface/rsfiles.h" + #include "util/RsAction.h" #include "msgs/ChanMsgDialog.h" #include "settings/rsharesettings.h" #include "AddLinksDialog.h" +#include "SendLinkDialog.h" #ifndef RETROSHARE_LINK_ANALYZER #include "RetroShareLinkAnalyzer.h" @@ -363,6 +365,18 @@ void SharedFilesDialog::sendHtmlLinkTo( ) nMsgDialog->show(); } +void SharedFilesDialog::sendLinktoChat() +{ + copyLinkLocal (); + + static SendLinkDialog *slinkDialog = new SendLinkDialog(this); + + slinkDialog->insertHtmlText(QApplication::clipboard()->text().toStdString()); + + slinkDialog->show(); + +} + void SharedFilesDialog::sendLinkToCloud() { copyLinkLocal (); @@ -647,6 +661,9 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point ) sendhtmllinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link (html)" ), this ); connect( sendhtmllinkAct , SIGNAL( triggered() ), this, SLOT( sendHtmlLinkTo( ) ) ); + + sendchatlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link to Chat" ), this ); + connect( sendchatlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinktoChat( ) ) ); sendlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link to Cloud" ), this ); connect( sendlinkCloudAct , SIGNAL( triggered() ), this, SLOT( sendLinkToCloud( ) ) ); @@ -676,6 +693,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point ) contextMnu2.addAction( copylinklocalAct); contextMnu2.addAction( sendlinkAct); contextMnu2.addAction( sendhtmllinkAct); + contextMnu2.addAction( sendchatlinkAct); contextMnu2.addSeparator(); contextMnu2.addAction( sendlinkCloudAct); contextMnu2.addAction( addlinkCloudAct); diff --git a/retroshare-gui/src/gui/SharedFilesDialog.h b/retroshare-gui/src/gui/SharedFilesDialog.h index 0f48a5b17..b7933f298 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.h +++ b/retroshare-gui/src/gui/SharedFilesDialog.h @@ -69,6 +69,7 @@ private slots: void sendHtmlLinkTo(); void sendLinkToCloud(); void addLinkToCloud(); + void sendLinktoChat(); void showFrame(bool show); void showFrameRemote(bool show); @@ -114,6 +115,7 @@ private: QAction* sendhtmllinkAct; QAction* sendlinkCloudAct; QAction* addlinkCloudAct; + QAction* sendchatlinkAct; QTreeView *shareddirtreeview; QMovie *movie;