mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
merged peer detail dialogs from network and friends tab
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1191 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d201d41736
commit
01bbd5ef03
@ -43,6 +43,8 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
#include "connect/ConfCertDialog.h"
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
#define IMAGE_LOADCERT ":/images/loadcert16.png"
|
#define IMAGE_LOADCERT ":/images/loadcert16.png"
|
||||||
#define IMAGE_PEERDETAILS ":/images/peerdetails_16x16.png"
|
#define IMAGE_PEERDETAILS ":/images/peerdetails_16x16.png"
|
||||||
@ -247,11 +249,12 @@ void NetworkDialog::makeFriend()
|
|||||||
/** Shows Peer Information/Auth Dialog */
|
/** Shows Peer Information/Auth Dialog */
|
||||||
void NetworkDialog::peerdetails()
|
void NetworkDialog::peerdetails()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
#ifdef NET_DEBUG
|
#ifdef NET_DEBUG
|
||||||
std::cerr << "ConnectionsDialog::peerdetails()" << std::endl;
|
std::cerr << "ConnectionsDialog::peerdetails()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTreeWidgetItem *wi = getCurrentNeighbour();
|
QTreeWidgetItem *wi =
|
||||||
if (!wi)
|
if (!wi)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -260,6 +263,8 @@ void NetworkDialog::peerdetails()
|
|||||||
out << id;
|
out << id;
|
||||||
|
|
||||||
showpeerdetails(out.str());
|
showpeerdetails(out.str());
|
||||||
|
#endif
|
||||||
|
ConfCertDialog::show(getCurrentNeighbour()->text(9).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Shows Peer Information/Auth Dialog */
|
/** Shows Peer Information/Auth Dialog */
|
||||||
|
@ -637,24 +637,7 @@ void PeersDialog::trustfriend()
|
|||||||
/* GUI stuff -> don't do anything directly with Control */
|
/* GUI stuff -> don't do anything directly with Control */
|
||||||
void PeersDialog::configurefriend()
|
void PeersDialog::configurefriend()
|
||||||
{
|
{
|
||||||
/* display Dialog */
|
ConfCertDialog::show(getPeerRsCertId(getCurrentPeer()));
|
||||||
#ifdef PEERS_DEBUG
|
|
||||||
std::cerr << "PeersDialog::configurefriend()" << std::endl;
|
|
||||||
#endif
|
|
||||||
QTreeWidgetItem *c = getCurrentPeer();
|
|
||||||
|
|
||||||
|
|
||||||
static ConfCertDialog *confdialog = new ConfCertDialog();
|
|
||||||
|
|
||||||
|
|
||||||
if (!c)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* set the Id */
|
|
||||||
std::string id = getPeerRsCertId(c);
|
|
||||||
|
|
||||||
confdialog -> loadId(id);
|
|
||||||
confdialog -> show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string)
|
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string)
|
||||||
|
@ -25,6 +25,12 @@
|
|||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
|
ConfCertDialog *ConfCertDialog::instance()
|
||||||
|
{
|
||||||
|
static ConfCertDialog *confdialog = new ConfCertDialog ;
|
||||||
|
|
||||||
|
return confdialog ;
|
||||||
|
}
|
||||||
|
|
||||||
/* Define the format used for displaying the date and time */
|
/* Define the format used for displaying the date and time */
|
||||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||||
@ -39,11 +45,19 @@ ConfCertDialog::ConfCertDialog(QWidget *parent, Qt::WFlags flags)
|
|||||||
|
|
||||||
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
|
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
|
||||||
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg()));
|
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg()));
|
||||||
|
connect(ui._makeFriendPB, SIGNAL(clicked()), this, SLOT(makeFriend()));
|
||||||
|
|
||||||
|
|
||||||
//setFixedSize(QSize(434, 462));
|
//setFixedSize(QSize(434, 462));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfCertDialog::show(const std::string& peer_id)
|
||||||
|
{
|
||||||
|
/* set the Id */
|
||||||
|
|
||||||
|
instance()->loadId(peer_id);
|
||||||
|
instance()->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,7 +117,7 @@ void ConfCertDialog::loadDialog()
|
|||||||
ui.extPort -> setValue(detail.extPort);
|
ui.extPort -> setValue(detail.extPort);
|
||||||
|
|
||||||
/* set the url for DNS access (OLD) */
|
/* set the url for DNS access (OLD) */
|
||||||
ui.extName->setText(QString::fromStdString(""));
|
//ui.extName->setText(QString::fromStdString(""));
|
||||||
|
|
||||||
/**** TODO ****/
|
/**** TODO ****/
|
||||||
//ui.chkFirewall ->setChecked(ni->firewalled);
|
//ui.chkFirewall ->setChecked(ni->firewalled);
|
||||||
@ -113,44 +127,29 @@ void ConfCertDialog::loadDialog()
|
|||||||
|
|
||||||
//ui.indivRate->setValue(0);
|
//ui.indivRate->setValue(0);
|
||||||
|
|
||||||
ui.trustLvl->setText(QString::fromStdString(RsPeerTrustString(detail.trustLvl)));
|
//ui.trustLvl->setText(QString::fromStdString(RsPeerTrustString(detail.trustLvl)));
|
||||||
|
|
||||||
if(rsPeers->isOnline(detail.id) || rsPeers->isTrustingMe(detail.id))
|
ui._peerTrustsMeCB->setChecked(rsPeers->isOnline(detail.id) || rsPeers->isTrustingMe(detail.id)) ;
|
||||||
ui._isTrustingMeTF->setText("Yes");
|
ui._peerTrustsMeCB->setEnabled(false);
|
||||||
else
|
ui.signBox->setChecked(detail.ownsign) ;
|
||||||
ui._isTrustingMeTF->setText("No");
|
ui.signBox->setEnabled(!detail.ownsign) ;
|
||||||
|
|
||||||
if (detail.ownsign)
|
ui._peerAcceptedCB->setChecked(detail.state & RS_PEER_STATE_FRIEND) ;
|
||||||
{
|
ui._peerAcceptedCB->setEnabled(detail.ownsign) ;
|
||||||
ui.signBox -> setCheckState(Qt::Checked);
|
|
||||||
ui.signBox -> setEnabled(false);
|
|
||||||
if (detail.trusted)
|
|
||||||
{
|
|
||||||
ui.trustBox -> setCheckState(Qt::Checked);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui.trustBox -> setCheckState(Qt::Unchecked);
|
|
||||||
}
|
|
||||||
ui.trustBox -> setCheckable(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui.signBox -> setCheckState(Qt::Unchecked);
|
|
||||||
ui.signBox -> setEnabled(true);
|
|
||||||
|
|
||||||
ui.trustBox -> setCheckState(Qt::Unchecked);
|
|
||||||
ui.trustBox -> setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ui.signers->clear() ;
|
||||||
|
for(std::list<std::string>::const_iterator it(detail.signers.begin());it!=detail.signers.end();++it)
|
||||||
|
ui.signers->append(QString::fromStdString(*it)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ConfCertDialog::applyDialog()
|
void ConfCertDialog::applyDialog()
|
||||||
{
|
{
|
||||||
|
std::cerr << "In apply dialog" << std::endl ;
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
if (!rsPeers->getPeerDetails(mId, detail))
|
if (!rsPeers->getPeerDetails(mId, detail))
|
||||||
{
|
{
|
||||||
|
std::cerr << "Could not get details from " << mId << std::endl ;
|
||||||
/* fail */
|
/* fail */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -163,57 +162,26 @@ void ConfCertDialog::applyDialog()
|
|||||||
bool trustChanged = false;
|
bool trustChanged = false;
|
||||||
|
|
||||||
/* set local address */
|
/* set local address */
|
||||||
if ((detail.localAddr != ui.localAddress->text().toStdString())
|
if ((detail.localAddr != ui.localAddress->text().toStdString()) || (detail.localPort != ui.localPort -> value()))
|
||||||
|| (detail.localPort != ui.localPort -> value()))
|
|
||||||
{
|
|
||||||
/* changed ... set it */
|
|
||||||
localChanged = true;
|
localChanged = true;
|
||||||
}
|
|
||||||
|
|
||||||
if ((detail.extAddr != ui.extAddress->text().toStdString())
|
if ((detail.extAddr != ui.extAddress->text().toStdString()) || (detail.extPort != ui.extPort -> value()))
|
||||||
|| (detail.extPort != ui.extPort -> value()))
|
|
||||||
{
|
|
||||||
/* changed ... set it */
|
|
||||||
extChanged = true;
|
extChanged = true;
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if ((detail.firewalled != ui.chkFirewall ->isChecked()) ||
|
|
||||||
(detail.forwardPort != ui.chkForwarded ->isChecked()))
|
|
||||||
{
|
|
||||||
/* changed ... set it */
|
|
||||||
fwChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ni -> maxRate != ui.indivRate->value())
|
|
||||||
{
|
|
||||||
/* nada */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (detail.ownsign)
|
if (detail.ownsign)
|
||||||
{
|
{
|
||||||
if (detail.trusted != ui.trustBox->isChecked())
|
if (ui._peerAcceptedCB->isChecked() != ((detail.state & RS_PEER_STATE_FRIEND) > 0))
|
||||||
{
|
|
||||||
trustChanged = true;
|
trustChanged = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if (ui.signBox->isChecked())
|
||||||
{
|
signChanged = true;
|
||||||
if (ui.signBox->isChecked())
|
|
||||||
{
|
|
||||||
signChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now we can action the changes */
|
/* now we can action the changes */
|
||||||
if (localChanged)
|
if (localChanged)
|
||||||
rsPeers->setLocalAddress(mId,
|
rsPeers->setLocalAddress(mId, ui.localAddress->text().toStdString(), ui.localPort->value());
|
||||||
ui.localAddress->text().toStdString(), ui.localPort->value());
|
|
||||||
|
|
||||||
if (extChanged)
|
if (extChanged)
|
||||||
rsPeers->setExtAddress(mId,
|
rsPeers->setExtAddress(mId,ui.extAddress->text().toStdString(), ui.extPort->value());
|
||||||
ui.extAddress->text().toStdString(), ui.extPort->value());
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (fwChanged)
|
if (fwChanged)
|
||||||
@ -221,20 +189,41 @@ void ConfCertDialog::applyDialog()
|
|||||||
ui.chkForwarded->isChecked());
|
ui.chkForwarded->isChecked());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (trustChanged)
|
|
||||||
rsPeers->TrustCertificate(mId, ui.trustBox->isChecked());
|
|
||||||
|
|
||||||
if (signChanged)
|
if (signChanged)
|
||||||
|
{
|
||||||
|
std::cerr << "Signature changed. Signing certificate" << mId << std::endl ;
|
||||||
rsPeers->SignCertificate(mId);
|
rsPeers->SignCertificate(mId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trustChanged)
|
||||||
|
{
|
||||||
|
std::cerr << "Acceptance changed. Authing ceAuthrtificate" << mId << std::endl ;
|
||||||
|
if(ui._peerAcceptedCB->isChecked())
|
||||||
|
rsPeers->AuthCertificate(mId, "");
|
||||||
|
else
|
||||||
|
rsPeers->removeFriend(mId);
|
||||||
|
}
|
||||||
|
|
||||||
/* reload now */
|
/* reload now */
|
||||||
loadDialog();
|
loadDialog();
|
||||||
|
|
||||||
/* close the Dialog after the Changes applied */
|
/* close the Dialog after the Changes applied */
|
||||||
closeinfodlg();
|
closeinfodlg();
|
||||||
|
|
||||||
|
if(trustChanged || signChanged)
|
||||||
|
emit configChanged() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfCertDialog::makeFriend()
|
||||||
|
{
|
||||||
|
ui.signBox->setChecked(true) ;
|
||||||
|
ui._peerAcceptedCB->setChecked(true) ;
|
||||||
|
|
||||||
|
// rsPeers->TrustCertificate(mId, ui.trustBox->isChecked());
|
||||||
|
// rsPeers->SignCertificate(mId);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void ConfCertDialog::setInfo(std::string name,
|
void ConfCertDialog::setInfo(std::string name,
|
||||||
std::string trust,
|
std::string trust,
|
||||||
std::string org,
|
std::string org,
|
||||||
@ -249,5 +238,6 @@ void ConfCertDialog::setInfo(std::string name,
|
|||||||
//ui.country->setText(QString::fromStdString(country));
|
//ui.country->setText(QString::fromStdString(country));
|
||||||
//ui.signers->setText(QString::fromStdString(signers));
|
//ui.signers->setText(QString::fromStdString(signers));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,14 @@ class ConfCertDialog : public QDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static void show(const std::string& id) ;
|
||||||
|
|
||||||
|
static ConfCertDialog *instance() ;
|
||||||
|
signals:
|
||||||
|
void configChanged() ;
|
||||||
|
private:
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
ConfCertDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
ConfCertDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
@ -39,14 +46,16 @@ public:
|
|||||||
|
|
||||||
void loadId(std::string id);
|
void loadId(std::string id);
|
||||||
|
|
||||||
|
#if 0
|
||||||
void setInfo(std::string name,
|
void setInfo(std::string name,
|
||||||
std::string trust,
|
std::string trust,
|
||||||
std::string org,
|
std::string org,
|
||||||
std::string loc,
|
std::string loc,
|
||||||
std::string country,
|
std::string country,
|
||||||
std::string signers);
|
std::string signers);
|
||||||
|
#endif
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
/** Overloaded QWidget.show */
|
/** Overloaded QWidget.show */
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
@ -57,6 +66,7 @@ private slots:
|
|||||||
|
|
||||||
void closeinfodlg();
|
void closeinfodlg();
|
||||||
void applyDialog();
|
void applyDialog();
|
||||||
|
void makeFriend();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -68,6 +78,7 @@ void loadDialog();
|
|||||||
std::string mId;
|
std::string mId;
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::ConfCertDialog ui;
|
Ui::ConfCertDialog ui;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,7 @@
|
|||||||
#include <gui/StartDialog.h>
|
#include <gui/StartDialog.h>
|
||||||
#include <gui/GenCertDialog.h>
|
#include <gui/GenCertDialog.h>
|
||||||
#include <gui/Preferences/rsharesettings.h>
|
#include <gui/Preferences/rsharesettings.h>
|
||||||
|
#include <gui/connect/ConfCertDialog.h>
|
||||||
|
|
||||||
/*** WINDOWS DON'T LIKE THIS - REDEFINES VER numbers.
|
/*** WINDOWS DON'T LIKE THIS - REDEFINES VER numbers.
|
||||||
#include <gui/qskinobject/qskinobject.h>
|
#include <gui/qskinobject/qskinobject.h>
|
||||||
@ -172,6 +173,8 @@ int main(int argc, char *argv[])
|
|||||||
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&)));
|
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&)));
|
||||||
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)),w->networkDialog,SLOT(setLogInfo(QString))) ;
|
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)),w->networkDialog,SLOT(setLogInfo(QString))) ;
|
||||||
|
|
||||||
|
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
|
|
||||||
/* only show window, if not startMinimized */
|
/* only show window, if not startMinimized */
|
||||||
if (!startMinimised)
|
if (!startMinimised)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user