From 66f3c7fee8b56edea50e1c229e1a40bc81dc251c Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sat, 28 Aug 2010 19:50:38 +0000 Subject: [PATCH] The connection attempt to all ssl id's of one gpg id can be started from the context menu in PeersDialog and MessengerWindow. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3401 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MessengerWindow.cpp | 44 ++++++++++++++-------- retroshare-gui/src/gui/PeersDialog.cpp | 41 ++++++++++++-------- retroshare-gui/src/gui/PeersDialog.h | 4 +- retroshare-gui/src/main.cpp | 1 + 4 files changed, 56 insertions(+), 34 deletions(-) diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index ecab2c871..887303e0a 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "common/vmessagebox.h" #include @@ -52,6 +54,7 @@ #include #include #include +#include /* Images for context menu icons */ #define IMAGE_REMOVEFRIEND ":/images/removefriend16.png" @@ -378,10 +381,8 @@ void MessengerWindow::messengertreeWidgetCostumPopupMenu( QPoint point ) //contextMnu.addAction( profileviewAct); if (c->type() == 0) { contextMnu.addAction( recommendfriendAct); - } else { - //this is a SSL key - contextMnu.addAction( connectfriendAct); } + contextMnu.addAction( connectfriendAct); contextMnu.addAction(pastePersonAct); contextMnu.addAction( removefriendAct); //contextMnu.addAction( exportfriendAct); @@ -688,7 +689,6 @@ void MessengerWindow::insertPeers() } break; } - } } } @@ -866,23 +866,35 @@ void MessengerWindow::removefriend() void MessengerWindow::connectfriend() { - QTreeWidgetItem *c = getCurrentPeer(); + QTreeWidgetItem *c = getCurrentPeer(); #ifdef PEERS_DEBUG - std::cerr << "PeersDialog::connectfriend()" << std::endl; + std::cerr << "PeersDialog::connectfriend()" << std::endl; #endif - if (!c) - { + if (!c) + { #ifdef PEERS_DEBUG - std::cerr << "PeersDialog::connectfriend() Noone Selected -- sorry" << std::endl; + std::cerr << "PeersDialog::connectfriend() Noone Selected -- sorry" << std::endl; #endif - return; - } + return; + } - if (rsPeers) - { - rsPeers->connectAttempt(getPeersRsCertId(c)); - c -> setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2))); - } + if (rsPeers) + { + if (c->type() == 0) { + int childCount = c->childCount(); + for (int childIndex = 0; childIndex < childCount; childIndex++) { + QTreeWidgetItem *item = c->child(childIndex); + if (item->type() == 1) { + rsPeers->connectAttempt(getPeersRsCertId(item)); + item->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2))); + } + } + } else { + //this is a SSL key + rsPeers->connectAttempt(getPeersRsCertId(c)); + c->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2))); + } + } } /* GUI stuff -> don't do anything directly with Control */ diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 214735c37..b72770d67 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "common/vmessagebox.h" #include @@ -421,10 +422,8 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point ) //contextMnu.addAction( profileviewAct); if (c->type() == 0) { contextMnu.addAction( recommendfriendAct); - } else { - //this is a SSL key - contextMnu.addAction( connectfriendAct); } + contextMnu.addAction( connectfriendAct); contextMnu.addAction(pastePersonAct); contextMnu.addAction( removefriendAct); //contextMnu.addAction( exportfriendAct); @@ -928,23 +927,35 @@ void PeersDialog::removefriend() void PeersDialog::connectfriend() { - QTreeWidgetItem *c = getCurrentPeer(); + QTreeWidgetItem *c = getCurrentPeer(); #ifdef PEERS_DEBUG - std::cerr << "PeersDialog::connectfriend()" << std::endl; + std::cerr << "PeersDialog::connectfriend()" << std::endl; #endif - if (!c) - { + if (!c) + { #ifdef PEERS_DEBUG - std::cerr << "PeersDialog::connectfriend() Noone Selected -- sorry" << std::endl; + std::cerr << "PeersDialog::connectfriend() Noone Selected -- sorry" << std::endl; #endif - return; - } + return; + } - if (rsPeers) - { - rsPeers->connectAttempt(getPeerRsCertId(c)); - c -> setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2))); - } + if (rsPeers) + { + if (c->type() == 0) { + int childCount = c->childCount(); + for (int childIndex = 0; childIndex < childCount; childIndex++) { + QTreeWidgetItem *item = c->child(childIndex); + if (item->type() == 1) { + rsPeers->connectAttempt(getPeerRsCertId(item)); + item->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2))); + } + } + } else { + //this is a SSL key + rsPeers->connectAttempt(getPeerRsCertId(c)); + c->setIcon(COLUMN_NAME,(QIcon(IMAGE_CONNECT2))); + } + } } /* GUI stuff -> don't do anything directly with Control */ diff --git a/retroshare-gui/src/gui/PeersDialog.h b/retroshare-gui/src/gui/PeersDialog.h index 444505592..1514ae21a 100644 --- a/retroshare-gui/src/gui/PeersDialog.h +++ b/retroshare-gui/src/gui/PeersDialog.h @@ -22,9 +22,6 @@ #ifndef _PEERSDIALOG_H #define _PEERSDIALOG_H -#include - -#include "chat/PopupChatDialog.h" #include "chat/HandleRichText.h" #include "RsAutoUpdatePage.h" @@ -49,6 +46,7 @@ class QAction; class QTextEdit; class QTextCharFormat; class ChatDialog; +class AttachFileItem; class PeersDialog : public RsAutoUpdatePage { diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index a45327eaf..fc3f3ec3c 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -28,6 +28,7 @@ #include "gui/TransfersDialog.h" #include "gui/MessagesDialog.h" #include "gui/SharedFilesDialog.h" +#include "gui/chat/PopupChatDialog.h" #include "gui/MessengerWindow.h" #include "gui/NetworkDialog.h" #include "gui/StartDialog.h"