Show the RetroShare id of the peer and the signers of the key in ConfCertDialog as clickable links.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4212 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-05-18 21:23:26 +00:00
parent c3f2f788c4
commit 4c13280fed
4 changed files with 45 additions and 38 deletions

View File

@ -36,6 +36,7 @@
#include "msgs/MessageComposer.h"
#include "util/misc.h"
#include "common/PeerDefs.h"
#include "gui/connect/ConfCertDialog.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h>
@ -431,6 +432,7 @@ QString RetroShareLink::title() const
case TYPE_FILE:
return QString("%1 (%2)").arg(hash()).arg(misc::friendlyUnit(size()));
case TYPE_PERSON:
return PeerDefs::rsidFromId(hash().toStdString());
case TYPE_FORUM:
case TYPE_CHANNEL:
case TYPE_SEARCH:
@ -693,6 +695,7 @@ bool RetroShareLink::process(int flag)
}
if (rsPeers->setAcceptToConnectGPGCertificate(hash().toStdString(), true)) {
ConfCertDialog::loadAll();
if (flag & RSLINK_PROCESS_NOTIFY_SUCCESS) {
QMessageBox mb(QObject::tr("Friend Request Confirmation"), QObject::tr("The friend has been added to your list."),QMessageBox::Information,QMessageBox::Ok,0,0);
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
@ -814,7 +817,7 @@ bool RetroShareLink::process(int flag)
#endif
RsPeerDetails detail;
if (rsPeers->getPeerDetails(hash().toStdString(), detail)) {
if (detail.accept_connection || detail.id == rsPeers->getOwnId()) {
if (detail.accept_connection || detail.id == rsPeers->getOwnId() || detail.id == rsPeers->getGPGOwnId()) {
MessageComposer *msg = MessageComposer::newMsg();
msg->addRecipient(MessageComposer::TO, detail.id, false);
if (subject().isEmpty() == false) {

View File

@ -36,6 +36,7 @@
#include "gui/help/browser/helpbrowser.h"
#include "gui/common/PeerDefs.h"
#include "gui/common/StatusDefs.h"
#include "gui/RetroShareLink.h"
#ifndef MINIMAL_RSGUI
#include "gui/MainWindow.h"
@ -74,7 +75,6 @@ ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlag
connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
connect(ui.signers_listWidget, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( listWidgetContextMenuPopup( QPoint ) ) );
#ifndef MINIMAL_RSGUI
MainWindow *w = MainWindow::getInstance();
@ -138,7 +138,12 @@ void ConfCertDialog::load()
ui.name->setText(QString::fromStdString(detail.name));
ui.peerid->setText(QString::fromStdString(detail.id));
ui.rsid->setText(PeerDefs::rsid(detail));
RetroShareLink link;
link.createPerson(detail.id);
ui.rsid->setText(link.toHtml());
ui.rsid->setToolTip(link.title());
if (!detail.isOnlyGPGdetail) {
@ -302,13 +307,14 @@ void ConfCertDialog::load()
}
}
ui.signers_listWidget->clear() ;
QString text;
for(std::list<std::string>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) {
RsPeerDetails signerDetail;
if (rsPeers->getGPGDetails(*it, signerDetail)) {
ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name) + " (" + QString::fromStdString(signerDetail.id) +")");
link.createPerson(*it);
if (link.valid()) {
text += link.toHtml() + "<BR>";
}
}
ui.signers->setHtml(text);
std::string invite = rsPeers->GetRetroshareInvite(detail.id) ; // this needs to be a SSL id
@ -434,25 +440,3 @@ void ConfCertDialog::showHelpDialog(const QString &topic)
helpBrowser = new HelpBrowser(this);
helpBrowser->showWindow(topic);
}
void ConfCertDialog::listWidgetContextMenuPopup(const QPoint &pos)
{
QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem();
if (!CurrentItem)
return;
QMenu menu(this);
menu.addAction(tr("Copy Peer"), this, SLOT(copyToClipboard()));
menu.exec(QCursor::pos());
}
void ConfCertDialog::copyToClipboard( )
{
QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem();
if (!CurrentItem)
return;
QClipboard *cb = QApplication::clipboard();
QString text = CurrentItem->text();
cb->setText(text, QClipboard::Clipboard);
}

View File

@ -35,6 +35,7 @@ public:
enum enumPage { PageDetails, PageTrust, PageCertificate };
static void showIt(const std::string& id, enumPage page);
static void loadAll();
signals:
void configChanged();
@ -47,12 +48,9 @@ private:
static ConfCertDialog *instance(const std::string& peer_id);
static void loadAll();
void load();
private slots:
void listWidgetContextMenuPopup(const QPoint &pos);
void applyDialog();
void makeFriend();
void denyFriend();
@ -62,8 +60,6 @@ private slots:
/** Called when a child window requests the given help <b>topic</b>. */
void showHelpDialog(const QString &topic);
void copyToClipboard();
private:
std::string mId;

View File

@ -116,10 +116,34 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="rsid">
<widget class="QTextBrowser" name="rsid">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
@ -468,9 +492,9 @@
</property>
<layout class="QVBoxLayout" name="_11">
<item>
<widget class="QListWidget" name="signers_listWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<widget class="QTextBrowser" name="signers">
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>