Added "Send Message" functionality to NetworkDialog, to send a distant message to a known peer.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6633 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2013-08-28 15:37:11 +00:00
parent 6b768c64cf
commit a7af0516e7
3 changed files with 38 additions and 4 deletions

View File

@ -33,6 +33,7 @@
#include "common/vmessagebox.h"
#include "common/RSTreeWidgetItem.h"
#include <gui/common/FriendSelectionDialog.h>
#include "gui/msgs/MessageComposer.h"
#include "NetworkDialog.h"
//#include "TrustView.h"
#include "NetworkView.h"
@ -45,12 +46,13 @@
/* Images for context menu icons */
#define IMAGE_LOADCERT ":/images/loadcert16.png"
#define IMAGE_PEERDETAILS ":/images/peerdetails_16x16.png"
#define IMAGE_PEERDETAILS ":/images/info16.png"
#define IMAGE_AUTH ":/images/encrypted16.png"
#define IMAGE_CLEAN_UNUSED ":/images/deletemail24.png"
#define IMAGE_MAKEFRIEND ":/images/user/add_user16.png"
#define IMAGE_EXPORT ":/images/exportpeers_16x16.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_MESSAGE ":/images/mail_new.png"
/* Images for Status icons */
#define IMAGE_AUTHED ":/images/accepted16.png"
@ -199,6 +201,7 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
contextMnu->addAction(QIcon(IMAGE_EXPORT), tr("Export my certificate..."), this, SLOT(on_actionExportKey_activated()));
contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Peer details..."), this, SLOT(peerdetails()));
contextMnu->addAction(QIcon(IMAGE_MESSAGE), tr("Send Message"), this, SLOT(sendDistantMessage()));
contextMnu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyLink()));
contextMnu->addSeparator() ;
contextMnu->addAction(QIcon(IMAGE_CLEAN_UNUSED), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys()));
@ -328,6 +331,31 @@ void NetworkDialog::copyLink()
RSLinkClipboard::copyLinks(urls);
}
void NetworkDialog::sendDistantMessage()
{
QTreeWidgetItem *wi = getCurrentNeighbour();
if (wi == NULL) {
return;
}
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
std::string hash ;
std::string mGpgId = wi->text(COLUMN_PEERID).toStdString() ;
if(rsMsgs->getDistantMessageHash(mGpgId,hash))
{
nMsgDialog->addRecipient(MessageComposer::TO, hash, mGpgId);
nMsgDialog->show();
nMsgDialog->activateWindow();
}
/* window will destroy itself! */
}
void NetworkDialog::updateDisplay()
{
insertConnect() ;

View File

@ -72,6 +72,7 @@ private slots:
void deleteCert() ;
void peerdetails();
void copyLink();
void sendDistantMessage();
/** Create the context popup menu and it's submenus */
void connectTreeWidgetCostumPopupMenu( QPoint point );
//void unvalidGPGKeyWidgetCostumPopupMenu( QPoint point );

View File

@ -10,8 +10,8 @@
<height>567</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="titleBarLabel">
@ -43,7 +43,7 @@
</item>
</layout>
</item>
<item>
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -102,6 +102,11 @@
<string/>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
</column>
<column>
<property name="text">
<string>Name</string>