Added double click to NetworkDialog to show the peer details.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4591 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-09-06 20:44:22 +00:00
parent c8e2a4c828
commit a34c482db1

View File

@ -85,8 +85,10 @@ NetworkDialog::NetworkDialog(QWidget *parent)
connect( ui.connecttreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connecttreeWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.connecttreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connecttreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.connecttreeWidget, SIGNAL( itemSelectionChanged()), ui.unvalidGPGkeyWidget, SLOT( clearSelection() ) ); connect( ui.connecttreeWidget, SIGNAL( itemSelectionChanged()), ui.unvalidGPGkeyWidget, SLOT( clearSelection() ) );
connect( ui.connecttreeWidget, SIGNAL( itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT( peerdetails () ) );
connect( ui.unvalidGPGkeyWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connecttreeWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.unvalidGPGkeyWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connecttreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.unvalidGPGkeyWidget, SIGNAL( itemSelectionChanged()), ui.connecttreeWidget, SLOT( clearSelection() ) ); connect( ui.unvalidGPGkeyWidget, SIGNAL( itemSelectionChanged()), ui.connecttreeWidget, SLOT( clearSelection() ) );
connect( ui.unvalidGPGkeyWidget, SIGNAL( itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT( peerdetails () ) );
connect( ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged())); connect( ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
connect( ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged())); connect( ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged()));
@ -94,7 +96,6 @@ NetworkDialog::NetworkDialog(QWidget *parent)
connect( ui.showUnvalidKeys, SIGNAL(clicked()), this, SLOT(insertConnect())); connect( ui.showUnvalidKeys, SIGNAL(clicked()), this, SLOT(insertConnect()));
/* hide the Tree +/- */ /* hide the Tree +/- */
ui.connecttreeWidget -> setRootIsDecorated( false ); ui.connecttreeWidget -> setRootIsDecorated( false );
ui.connecttreeWidget -> setColumnCount(5); ui.connecttreeWidget -> setColumnCount(5);
@ -183,7 +184,6 @@ NetworkDialog::NetworkDialog(QWidget *parent)
ui.clearButton->hide(); ui.clearButton->hide();
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -206,7 +206,7 @@ void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint /*point*/ )
QMenu contextMnu( this ); QMenu contextMnu( this );
std::string peer_id = wi->text(4).toStdString() ; std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ;
// That's what context menus are made for // That's what context menus are made for
RsPeerDetails detail; RsPeerDetails detail;
@ -258,7 +258,7 @@ void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint /*point*/ )
void NetworkDialog::denyFriend() void NetworkDialog::denyFriend()
{ {
QTreeWidgetItem *wi = getCurrentNeighbour(); QTreeWidgetItem *wi = getCurrentNeighbour();
std::string peer_id = wi->text(4).toStdString() ; std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ;
rsPeers->removeFriend(peer_id) ; rsPeers->removeFriend(peer_id) ;
insertConnect() ; insertConnect() ;
@ -280,13 +280,17 @@ void NetworkDialog::deleteCert()
void NetworkDialog::makeFriend() void NetworkDialog::makeFriend()
{ {
ConfCertDialog::showIt(getCurrentNeighbour()->text(4).toStdString(), ConfCertDialog::PageTrust); ConfCertDialog::showIt(getCurrentNeighbour()->text(COLUMN_PEERID).toStdString(), ConfCertDialog::PageTrust);
} }
/** Shows Peer Information/Auth Dialog */ /** Shows Peer Information/Auth Dialog */
void NetworkDialog::peerdetails() void NetworkDialog::peerdetails()
{ {
ConfCertDialog::showIt(getCurrentNeighbour()->text(4).toStdString(), ConfCertDialog::PageDetails); QTreeWidgetItem* item = getCurrentNeighbour();
if (item == NULL) {
return;
}
ConfCertDialog::showIt(item->text(COLUMN_PEERID).toStdString(), ConfCertDialog::PageDetails);
} }
void NetworkDialog::copyLink() void NetworkDialog::copyLink()
@ -296,7 +300,7 @@ void NetworkDialog::copyLink()
return; return;
} }
std::string peer_id = wi->text(4).toStdString() ; std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ;
std::vector<RetroShareLink> urls; std::vector<RetroShareLink> urls;
RetroShareLink link; RetroShareLink link;
@ -387,7 +391,7 @@ void NetworkDialog::insertConnect()
//remove items //remove items
int index = 0; int index = 0;
while (index < connectWidget->topLevelItemCount()) { while (index < connectWidget->topLevelItemCount()) {
std::string gpg_widget_id = (connectWidget->topLevelItem(index))->text(4).toStdString(); std::string gpg_widget_id = (connectWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString();
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || (detail.validLvl < GPGME_VALIDITY_MARGINAL && !detail.accept_connection)) { if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || (detail.validLvl < GPGME_VALIDITY_MARGINAL && !detail.accept_connection)) {
delete (connectWidget->takeTopLevelItem(index)); delete (connectWidget->takeTopLevelItem(index));
@ -397,7 +401,7 @@ void NetworkDialog::insertConnect()
} }
index = 0; index = 0;
while (index < ui.unvalidGPGkeyWidget->topLevelItemCount()) { while (index < ui.unvalidGPGkeyWidget->topLevelItemCount()) {
std::string gpg_widget_id = (ui.unvalidGPGkeyWidget->topLevelItem(index))->text(4).toStdString(); std::string gpg_widget_id = (ui.unvalidGPGkeyWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString();
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || detail.validLvl >= GPGME_VALIDITY_MARGINAL || detail.accept_connection) { if (!rsPeers->getGPGDetails(gpg_widget_id, detail) || detail.validLvl >= GPGME_VALIDITY_MARGINAL || detail.accept_connection) {
delete (ui.unvalidGPGkeyWidget->takeTopLevelItem(index)); delete (ui.unvalidGPGkeyWidget->takeTopLevelItem(index));
@ -580,7 +584,7 @@ QTreeWidgetItem *NetworkDialog::getCurrentNeighbour()
/* Utility Fns */ /* Utility Fns */
RsCertId getNeighRsCertId(QTreeWidgetItem *i) RsCertId getNeighRsCertId(QTreeWidgetItem *i)
{ {
RsCertId id = (i -> text(4)).toStdString(); RsCertId id = (i -> text(COLUMN_PEERID)).toStdString();
return id; return id;
} }