diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 4f074d6ae..9447a2bb9 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -274,21 +274,6 @@ void NetworkDialog::makeFriend() /** Shows Peer Information/Auth Dialog */ void NetworkDialog::peerdetails() { -#if 0 -#ifdef NET_DEBUG - std::cerr << "ConnectionsDialog::peerdetails()" << std::endl; -#endif - - QTreeWidgetItem *wi = - if (!wi) - return; - - RsCertId id = getNeighRsCertId(wi); - std::ostringstream out; - out << id; - - showpeerdetails(out.str()); -#endif ConfCertDialog::show(getCurrentNeighbour()->text(9).toStdString()); } diff --git a/retroshare-gui/src/gui/elastic/graphwidget.cpp b/retroshare-gui/src/gui/elastic/graphwidget.cpp index 465cc8ae2..066132078 100644 --- a/retroshare-gui/src/gui/elastic/graphwidget.cpp +++ b/retroshare-gui/src/gui/elastic/graphwidget.cpp @@ -39,6 +39,8 @@ #include "arrow.h" #include "node.h" +#include "rsiface/rspeers.h" + #include #include #include @@ -73,8 +75,6 @@ GraphWidget::GraphWidget(QWidget *parent) setWindowTitle(tr("Elastic Nodes")); clearGraph(); - - clearGraph(); } bool GraphWidget::clearGraph() @@ -88,7 +88,7 @@ bool GraphWidget::clearGraph() scene->setSceneRect(-200, -200, 1000, 1000); setScene(scene); - centerNode = new Node(this, 1, "OwnId", "You"); + centerNode = new Node(this, 1, rsPeers->getPGPOwnId(), "You"); scene->addItem(centerNode); centerNode->setPos(0, 0); @@ -183,7 +183,7 @@ void GraphWidget::addArrow(std::string id1, std::string id2) void GraphWidget::itemMoved() { if (!timerId) - timerId = startTimer(1000 / 10); + timerId = startTimer(1000 / 1); } void GraphWidget::keyPressEvent(QKeyEvent *event) diff --git a/retroshare-gui/src/gui/elastic/node.cpp b/retroshare-gui/src/gui/elastic/node.cpp index 14d3b09a8..ae29f5224 100644 --- a/retroshare-gui/src/gui/elastic/node.cpp +++ b/retroshare-gui/src/gui/elastic/node.cpp @@ -34,11 +34,18 @@ ** ****************************************************************************/ +#include +#include + #include #include #include #include +#include #include +#include +#include +#include #include "edge.h" #include "arrow.h" @@ -47,6 +54,10 @@ #include #include "rsiface/rspeers.h" +#include + +#include "../connect/ConfCertDialog.h" + Node::Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n) : graph(graphWidget), ntype(t), id(id_in), name(n), mDeterminedBB(false) @@ -137,7 +148,9 @@ void Node::calculateForces() if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1) xvel = yvel = 0; - newPos = pos() + QPointF(xvel, yvel); + //newPos = pos() + QPointF(xvel, yvel); + // Increased the velocity for faster settling period. + newPos = pos() + QPointF(5 * xvel, 5 * yvel); newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10)); newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10)); @@ -284,18 +297,122 @@ void Node::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) } /* no events for self */ +#if 0 if (ntype == ELASTIC_NODE_TYPE_OWN) { event->accept(); return; } +#endif - QString menuTitle = "Menu for "; - menuTitle += QString::fromStdString(details.name); + QString menuTitle = QString::fromStdString(details.name); + menuTitle += " : "; + + std::cerr << "Node Menu for " << details.name << std::endl; QMenu menu; + + switch(ntype) + { + case ELASTIC_NODE_TYPE_OWN: + { + menuTitle += "Ourselves"; + break; + } + case ELASTIC_NODE_TYPE_FRIEND: + { + menuTitle += "Friend"; + break; + } + case ELASTIC_NODE_TYPE_AUTHED: + { + menuTitle += "Authenticated"; + break; + } + case ELASTIC_NODE_TYPE_MARGINALAUTH: + { + menuTitle += "Friend of a Friend"; + break; + } + default: + case ELASTIC_NODE_TYPE_FOF: + { + menuTitle += " Unknown"; + break; + } + } + QAction *titleAction = menu.addAction(menuTitle); titleAction->setEnabled(false); + menu.addSeparator(); + + /* find all the peers which have this pgp peer as issuer */ + std::list ids; + std::list::iterator it; + bool haveSSLcerts = false; + + if ((ntype == ELASTIC_NODE_TYPE_AUTHED) || + (ntype == ELASTIC_NODE_TYPE_FRIEND) || + (ntype == ELASTIC_NODE_TYPE_OWN)) + { + rsPeers->getOthersList(ids); + + QAction *addAction = menu.addAction("Add All as Friends"); + QAction *rmAction = menu.addAction("Remove All as Friends"); + + std::cerr << "OthersList looking for ::Issuer " << id << std::endl; + int nssl = 0; + for(it = ids.begin(); it != ids.end(); it++) + { + RsPeerDetails d2; + if (!rsPeers->getPeerDetails(*it, d2)) + continue; + + std::cerr << "OthersList::Id " << d2.id; + std::cerr << " ::Issuer " << d2.issuer << std::endl; + if (d2.issuer == id) + { + QString sslTitle = " SSL ID: "; + sslTitle += QString::fromStdString(d2.location); + + if (RS_PEER_STATE_FRIEND & d2.state) + { + sslTitle += " Allowed"; + } + else + { + sslTitle += " Denied"; + } + + QMenu *sslMenu = menu.addMenu (sslTitle); + if (RS_PEER_STATE_FRIEND & d2.state) + { + QAction *sslAction = sslMenu->addAction("Deny"); + } + else + { + QAction *sslAction = sslMenu->addAction("Allow"); + } + nssl++; + } + } + + if (nssl > 0) + { + menu.addSeparator(); + haveSSLcerts = true; + } + else + { + addAction->setVisible(false); + rmAction->setVisible(false); + + QAction *noAction = menu.addAction("No SSL Certificates for Peer"); + noAction->setEnabled(false); + menu.addSeparator(); + } + } + switch(ntype) { @@ -305,29 +422,59 @@ void Node::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) } case ELASTIC_NODE_TYPE_FRIEND: { - - //QAction *rmAction = menu.addAction("Remove Friend"); - //QAction *chatAction = menu.addAction("Chat"); - //QAction *msgAction = menu.addAction("Msg"); + QAction *chatAction = menu.addAction("Chat"); + QAction *msgAction = menu.addAction("Msg"); + menu.addSeparator(); + QAction *connction = menu.addAction("Connect"); + menu.addSeparator(); break; } case ELASTIC_NODE_TYPE_AUTHED: { - //QAction *addAction = menu.addAction("Add Friend"); break; } case ELASTIC_NODE_TYPE_MARGINALAUTH: { - //QAction *makeAction = menu.addAction("Make Friend"); + if (haveSSLcerts) + { + QAction *makeAction = menu.addAction("Sign Peer and Add Friend"); + menu.addSeparator(); + } + else + { + QAction *makeAction = menu.addAction("Sign Peer to Authenticate"); + menu.addSeparator(); + } break; } default: case ELASTIC_NODE_TYPE_FOF: { - //QAction *makeAction = menu.addAction("Make Friend"); + if (haveSSLcerts) + { + QAction *makeAction = menu.addAction("Sign Peer and Add Friend"); + menu.addSeparator(); + } + else + { + QAction *makeAction = menu.addAction("Sign Peer to Authenticate"); + menu.addSeparator(); + } break; } } + + QAction *detailAction = menu.addAction("Peer Details"); + QObject::connect( detailAction , SIGNAL( triggered() ), this, SLOT( peerdetails() ) ); + connect( detailAction , SIGNAL( triggered() ), this, SLOT( peerdetails() ) ); + + QAction *expAction = menu.addAction("Export Certificate"); + QAction *selectedAction = menu.exec(event->screenPos()); } +void Node::peerdetails() +{ + ConfCertDialog::show(id); +} + diff --git a/retroshare-gui/src/gui/elastic/node.h b/retroshare-gui/src/gui/elastic/node.h index e5ab2f58b..782057171 100644 --- a/retroshare-gui/src/gui/elastic/node.h +++ b/retroshare-gui/src/gui/elastic/node.h @@ -54,8 +54,11 @@ class Arrow; class GraphWidget; class QGraphicsSceneMouseEvent; -class Node : public QGraphicsItem +class Node : public QObject, public QGraphicsItem { + Q_OBJECT + + public: Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n); @@ -75,6 +78,9 @@ public: //QPainterPath shape() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); +public slots: + void peerdetails(); + protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value); diff --git a/retroshare-gui/src/gui/help/version.html b/retroshare-gui/src/gui/help/version.html index 00f540c91..0f5dc86b8 100644 --- a/retroshare-gui/src/gui/help/version.html +++ b/retroshare-gui/src/gui/help/version.html @@ -1,7 +1,5 @@ -jeu. juil. 23 00:09:56 CEST 2009 -Git version : -# On branch master -commit 5810b1df6ef9cf29c6bd0bea3dc1236943961429 - git-svn-id: https://retroshare.svn.sourceforge.net/svnroot/retroshare/trunk@1409 56268a12-702b-0410-a8f4-c53eb35c22f6 +Retroshare Gui version : +Svn version : Revision: 1498 +Tue Aug 4 10:34:44 BST 2009 diff --git a/retroshare-gui/src/rsiface/rspeers.h b/retroshare-gui/src/rsiface/rspeers.h index d8a9dd58c..ca7d5cf12 100644 --- a/retroshare-gui/src/rsiface/rspeers.h +++ b/retroshare-gui/src/rsiface/rspeers.h @@ -78,6 +78,8 @@ class RsPeerDetails std::string location; std::string org; + std::string issuer; + std::string fpr; /* pgp fingerprint */ std::string authcode; std::list signers; diff --git a/retroshare-gui/src/util/rsversion.h b/retroshare-gui/src/util/rsversion.h index 5c5691f02..725855cd1 100644 --- a/retroshare-gui/src/util/rsversion.h +++ b/retroshare-gui/src/util/rsversion.h @@ -20,7 +20,7 @@ ****************************************************************/ -#define GUI_VERSION "0.5.x" +#define GUI_VERSION "Revision: 1498 date : 10:34:44 08.04.09" #include