diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index 18be83053..ca7c457aa 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -1014,7 +1014,7 @@ void MessengerWindow::connectfriend() /* GUI stuff -> don't do anything directly with Control */ void MessengerWindow::configurefriend() { - ConfCertDialog::show(getPeersRsCertId(getCurrentPeer())); + ConfCertDialog::showIt(getPeersRsCertId(getCurrentPeer()), ConfCertDialog::PageDetails); } void MessengerWindow::recommendfriend() diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 70e0704e9..41c10e61f 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -283,13 +283,13 @@ void NetworkDialog::deleteCert() void NetworkDialog::makeFriend() { - ConfCertDialog::showTrust(getCurrentNeighbour()->text(4).toStdString()); + ConfCertDialog::showIt(getCurrentNeighbour()->text(4).toStdString(), ConfCertDialog::PageTrust); } /** Shows Peer Information/Auth Dialog */ void NetworkDialog::peerdetails() { - ConfCertDialog::show(getCurrentNeighbour()->text(4).toStdString()); + ConfCertDialog::showIt(getCurrentNeighbour()->text(4).toStdString(), ConfCertDialog::PageDetails); } /** Open a QFileDialog to browse for a pem/pqi file. */ diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 228b80b25..b16db07f9 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -1260,7 +1260,7 @@ void PeersDialog::connectfriend() /* GUI stuff -> don't do anything directly with Control */ void PeersDialog::configurefriend() { - ConfCertDialog::show(getPeerRsCertId(getCurrentPeer())); + ConfCertDialog::showIt(getPeerRsCertId(getCurrentPeer()), ConfCertDialog::PageDetails); } void PeersDialog::addFriend() diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp index b1fe03dfe..b8801aaac 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -32,352 +33,343 @@ #include "gui/help/browser/helpbrowser.h" #include "gui/common/PeerDefs.h" +#include "gui/MainWindow.h" -ConfCertDialog *ConfCertDialog::instance() +static QMap instances; + +ConfCertDialog *ConfCertDialog::instance(const std::string& peer_id) { - static ConfCertDialog *confdialog = new ConfCertDialog ; + ConfCertDialog *d = instances[peer_id]; + if (d) { + return d; + } - return confdialog ; + d = new ConfCertDialog(peer_id); + instances[peer_id] = d; + + return d; } /* Define the format used for displaying the date and time */ #define DATETIME_FMT "MMM dd hh:mm:ss" /** Default constructor */ -ConfCertDialog::ConfCertDialog(QWidget *parent, Qt::WFlags flags) - : QDialog(parent, flags) +ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlags flags) + : QDialog(parent, flags), mId(id) { - /* Invoke Qt Designer generated QObject setup routine */ - ui.setupUi(this); + /* Invoke Qt Designer generated QObject setup routine */ + ui.setupUi(this); + setAttribute(Qt::WA_DeleteOnClose, true); - connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog())); - connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg())); - connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend())); - 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 ) ) ); + connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog())); + connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend())); + 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 ) ) ); - ui.applyButton->setToolTip(tr("Apply and Close")); + MainWindow *w = MainWindow::getInstance(); + if (w) { + connect(this, SIGNAL(configChanged()), w->getPage(MainWindow::Network), SLOT(insertConnect())); + } } -void ConfCertDialog::show(const std::string& peer_id) +ConfCertDialog::~ConfCertDialog() { - /* set the Id */ - - instance()->loadId(peer_id); - instance()->show(); + QMap::iterator it = instances.find(mId); + if (it != instances.end()) { + instances.erase(it); + } } -void ConfCertDialog::showTrust(const std::string& peer_id) +void ConfCertDialog::showIt(const std::string& peer_id, enumPage page) { - /* set the Id */ + ConfCertDialog *confdialog = instance(peer_id); - instance()->loadId(peer_id); - instance()->showTrust(); + switch (page) { + case PageDetails: + confdialog->ui.stabWidget->setCurrentIndex(0); + break; + case PageTrust: + confdialog->ui.stabWidget->setCurrentIndex(1); + break; + case PageCertificate: + confdialog->ui.stabWidget->setCurrentIndex(2); + break; + } + + confdialog->load(); + confdialog->show(); + confdialog->raise(); + confdialog->activateWindow(); + + /* window will destroy itself! */ } - -/** - Overloads the default show() slot so we can set opacity*/ - -void -ConfCertDialog::show() +void ConfCertDialog::loadAll() { - //loadSettings(); - ui.stabWidget->setCurrentIndex(0); - if(!this->isVisible()) { - QDialog::show(); - - } + QMap::iterator it; + for (it = instances.begin(); it != instances.end(); it++) { + it.value()->load(); + } } -void -ConfCertDialog::showTrust() +void ConfCertDialog::load() { - //loadSettings(); - ui.stabWidget->setCurrentIndex(1); - if(!this->isVisible()) { - QDialog::show(); + RsPeerDetails detail; + if (!rsPeers->getPeerDetails(mId, detail)) + { + QMessageBox::information(this, + tr("RetroShare"), + tr("Error : cannot get peer details.")); + close(); + return; + } - } -} - -void ConfCertDialog::closeEvent (QCloseEvent * event) -{ - QWidget::closeEvent(event); -} - -void ConfCertDialog::closeinfodlg() -{ - close(); -} - -void ConfCertDialog::loadId(std::string id) -{ - mId = id; - loadDialog(); -} - - -void ConfCertDialog::loadDialog() -{ - RsPeerDetails detail; - if (!rsPeers->getPeerDetails(mId, detail)) - { - QMessageBox::information(this, - tr("RetroShare"), - tr("Error : cannot get peer details.")); - closeinfodlg(); - } - - ui.name->setText(QString::fromStdString(detail.name)); + ui.name->setText(QString::fromStdString(detail.name)); ui.peerid->setText(QString::fromStdString(detail.id)); ui.rsid->setText(PeerDefs::rsid(detail)); - if (!detail.isOnlyGPGdetail) { - - ui.loc->setText(QString::fromStdString(detail.location)); - // Dont Show a timestamp in RS calculate the day - QDateTime date = QDateTime::fromTime_t(detail.lastConnect); - QString stime = date.toString(Qt::LocalDate); - ui.lastcontact-> setText(stime); + if (!detail.isOnlyGPGdetail) { - /* set retroshare version */ - std::map::iterator vit; - std::map versions; - bool retv = rsDisc->getDiscVersions(versions); - if (retv && versions.end() != (vit = versions.find(detail.id))) - { - ui.version->setText(QString::fromStdString(vit->second)); - } + ui.loc->setText(QString::fromStdString(detail.location)); + // Dont Show a timestamp in RS calculate the day + QDateTime date = QDateTime::fromTime_t(detail.lastConnect); + QString stime = date.toString(Qt::LocalDate); + ui.lastcontact-> setText(stime); - /* set local address */ - ui.localAddress->setText(QString::fromStdString(detail.localAddr)); - ui.localPort -> setValue(detail.localPort); - /* set the server address */ - ui.extAddress->setText(QString::fromStdString(detail.extAddr)); - ui.extPort -> setValue(detail.extPort); - - ui.dynDNS->setText(QString::fromStdString(detail.dyndns)); - - ui.ipAddressList->clear(); - for(std::list::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it) - ui.ipAddressList->addItem(QString::fromStdString(*it)); - - ui.loc->show(); - ui.label_loc->show(); - ui.lastcontact->show(); - ui.label_last_contact->show(); - ui.version->show(); - ui.label_version->show(); - - ui.groupBox->show(); - ui.rsid->hide(); - ui.label_rsid->hide(); - } else { - ui.rsid->show(); - ui.label_rsid->show(); - ui.loc->hide(); - ui.label_loc->hide(); - ui.lastcontact->hide(); - ui.label_last_contact->hide(); - ui.version->hide(); - ui.label_version->hide(); - - ui.groupBox->hide(); + /* set retroshare version */ + std::map::iterator vit; + std::map versions; + bool retv = rsDisc->getDiscVersions(versions); + if (retv && versions.end() != (vit = versions.find(detail.id))) + { + ui.version->setText(QString::fromStdString(vit->second)); } - if (detail.gpg_id == rsPeers->getGPGOwnId()) { - ui.make_friend_button->hide(); - ui.signGPGKeyCheckBox->hide(); - ui.signKeyButton->hide(); - ui.denyFriendButton->hide(); + /* set local address */ + ui.localAddress->setText(QString::fromStdString(detail.localAddr)); + ui.localPort -> setValue(detail.localPort); + /* set the server address */ + ui.extAddress->setText(QString::fromStdString(detail.extAddr)); + ui.extPort -> setValue(detail.extPort); - ui.web_of_trust_label->hide(); + ui.dynDNS->setText(QString::fromStdString(detail.dyndns)); + + ui.ipAddressList->clear(); + for(std::list::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it) + ui.ipAddressList->addItem(QString::fromStdString(*it)); + + ui.loc->show(); + ui.label_loc->show(); + ui.lastcontact->show(); + ui.label_last_contact->show(); + ui.version->show(); + ui.label_version->show(); + + ui.groupBox->show(); + ui.rsid->hide(); + ui.label_rsid->hide(); + } else { + ui.rsid->show(); + ui.label_rsid->show(); + ui.loc->hide(); + ui.label_loc->hide(); + ui.lastcontact->hide(); + ui.label_last_contact->hide(); + ui.version->hide(); + ui.label_version->hide(); + + ui.groupBox->hide(); + } + + if (detail.gpg_id == rsPeers->getGPGOwnId()) { + ui.make_friend_button->hide(); + ui.signGPGKeyCheckBox->hide(); + ui.signKeyButton->hide(); + ui.denyFriendButton->hide(); + + ui.web_of_trust_label->hide(); + ui.radioButton_trust_fully->hide(); + ui.radioButton_trust_marginnaly->hide(); + ui.radioButton_trust_never->hide(); + + ui.is_signing_me->hide(); + ui.signersBox->setTitle(tr("Your key is signed by : ")); + + } else { + ui.web_of_trust_label->show(); + ui.radioButton_trust_fully->show(); + ui.radioButton_trust_marginnaly->show(); + ui.radioButton_trust_never->show(); + + ui.is_signing_me->show(); + ui.signersBox->setTitle(tr("Peer key is signed by : ")); + + if (detail.accept_connection) { + ui.make_friend_button->hide(); + ui.denyFriendButton->show(); + ui.signGPGKeyCheckBox->hide(); + //connection already accepted, propose to sign gpg key + if (!detail.ownsign) { + ui.signKeyButton->show(); + } else { + ui.signKeyButton->hide(); + } + } else { + ui.make_friend_button->show(); + ui.denyFriendButton->hide(); + ui.signKeyButton->hide(); + if (!detail.ownsign) { + ui.signGPGKeyCheckBox->show(); + ui.signGPGKeyCheckBox->setChecked(true); + } else { + ui.signGPGKeyCheckBox->hide(); + } + } + + //web of trust + if (detail.trustLvl == 5) { + //trust is ultimate, it means it's one of our own keys + ui.web_of_trust_label->setText(tr("Your trust in this peer is ultimate, it's probably a key you own.")); ui.radioButton_trust_fully->hide(); ui.radioButton_trust_marginnaly->hide(); ui.radioButton_trust_never->hide(); - - ui.is_signing_me->hide(); - ui.signersBox->setTitle(tr("Your key is signed by : ")); - } else { - ui.make_friend_button->show(); - ui.signGPGKeyCheckBox->show(); - ui.signKeyButton->show(); - ui.denyFriendButton->show(); - - ui.web_of_trust_label->show(); ui.radioButton_trust_fully->show(); ui.radioButton_trust_marginnaly->show(); ui.radioButton_trust_never->show(); - - ui.is_signing_me->show(); - ui.signersBox->setTitle(tr("Peer key is signed by : ")); - - if (detail.accept_connection) { - ui.make_friend_button->hide(); - ui.denyFriendButton->show(); - ui.signGPGKeyCheckBox->hide(); - //connection already accepted, propose to sign gpg key - if (!detail.ownsign) { - ui.signGPGKeyCheckBox->hide(); - ui.signKeyButton->show(); - } else { - ui.signGPGKeyCheckBox->hide(); - ui.signKeyButton->hide(); - } + if (detail.trustLvl == 4) { + ui.web_of_trust_label->setText(tr("Your trust in this peer is full.")); + ui.radioButton_trust_fully->setChecked(true); + ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-48.png")); + ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); + ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png")); + } else if (detail.trustLvl == 3) { + ui.web_of_trust_label->setText(tr("Your trust in this peer is marginal.")); + ui.radioButton_trust_marginnaly->setChecked(true); + ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-48.png")); + ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png")); + ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png")); + } else if (detail.trustLvl == 2) { + ui.web_of_trust_label->setText(tr("Your trust in this peer is none.")); + ui.radioButton_trust_never->setChecked(true); + ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-48.png")); + ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png")); + ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); } else { - ui.make_friend_button->show(); - ui.denyFriendButton->hide(); - ui.signKeyButton->hide(); - if (!detail.ownsign) { - ui.signGPGKeyCheckBox->show(); - ui.signGPGKeyCheckBox->setChecked(true); - } else { - ui.signGPGKeyCheckBox->hide(); - } - } + ui.web_of_trust_label->setText(tr("Your trust in this peer is not set.")); - //web of trust - if (detail.trustLvl == 5) { - //trust is ultimate, it means it's one of our own keys - ui.web_of_trust_label->setText(tr("Your trust in this peer is ultimate, it's probably a key you own.")); - ui.radioButton_trust_fully->hide(); - ui.radioButton_trust_marginnaly->hide(); - ui.radioButton_trust_never->hide(); - } else { - ui.radioButton_trust_fully->show(); - ui.radioButton_trust_marginnaly->show(); - ui.radioButton_trust_never->show(); - if (detail.trustLvl == 4) { - ui.web_of_trust_label->setText(tr("Your trust in this peer is full.")); - ui.radioButton_trust_fully->setChecked(true); - ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-48.png")); - ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); - ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png")); - } else if (detail.trustLvl == 3) { - ui.web_of_trust_label->setText(tr("Your trust in this peer is marginal.")); - ui.radioButton_trust_marginnaly->setChecked(true); - ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-48.png")); - ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png")); - ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png")); - } else if (detail.trustLvl == 2) { - ui.web_of_trust_label->setText(tr("Your trust in this peer is none.")); - ui.radioButton_trust_never->setChecked(true); - ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-48.png")); - ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png")); - ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); - } else { - ui.web_of_trust_label->setText(tr("Your trust in this peer is not set.")); + //we have to set up the set exclusive to false in order to uncheck it all + ui.radioButton_trust_fully->setAutoExclusive(false); + ui.radioButton_trust_marginnaly->setAutoExclusive(false); + ui.radioButton_trust_never->setAutoExclusive(false); - //we have to set up the set exclusive to false in order to uncheck it all - ui.radioButton_trust_fully->setAutoExclusive(false); - ui.radioButton_trust_marginnaly->setAutoExclusive(false); - ui.radioButton_trust_never->setAutoExclusive(false); + ui.radioButton_trust_fully->setChecked(false); + ui.radioButton_trust_marginnaly->setChecked(false); + ui.radioButton_trust_never->setChecked(false); - ui.radioButton_trust_fully->setChecked(false); - ui.radioButton_trust_marginnaly->setChecked(false); - ui.radioButton_trust_never->setChecked(false); + ui.radioButton_trust_fully->setAutoExclusive(true); + ui.radioButton_trust_marginnaly->setAutoExclusive(true); + ui.radioButton_trust_never->setAutoExclusive(true); - ui.radioButton_trust_fully->setAutoExclusive(true); - ui.radioButton_trust_marginnaly->setAutoExclusive(true); - ui.radioButton_trust_never->setAutoExclusive(true); - - ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png")); - ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png")); - ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); - } - } - - if (detail.hasSignedMe) { - ui.is_signing_me->setText(tr("Peer has authenticated me as a friend and did sign my GPG key")); - } else { - ui.is_signing_me->setText(tr("Peer has not authenticated me as a friend and did not sign my GPG key")); - } - } - - ui.signers_listWidget->clear() ; - for(std::list::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) +")"); + ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png")); + ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png")); + ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); } } - std::string invite = rsPeers->GetRetroshareInvite(detail.id) ; // this needs to be a SSL id + if (detail.hasSignedMe) { + ui.is_signing_me->setText(tr("Peer has authenticated me as a friend and did sign my GPG key")); + } else { + ui.is_signing_me->setText(tr("Peer has not authenticated me as a friend and did not sign my GPG key")); + } + } - ui.userCertificateText->setReadOnly(true); - ui.userCertificateText->setMinimumHeight(200); - ui.userCertificateText->setMinimumWidth(530); - QFont font("Courier New",10,50,false); - font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch); - font.setStyle(QFont::StyleNormal); - ui.userCertificateText->setFont(font); - ui.userCertificateText->setText(QString::fromStdString(invite)); + ui.signers_listWidget->clear() ; + for(std::list::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) +")"); + } + } + + std::string invite = rsPeers->GetRetroshareInvite(detail.id) ; // this needs to be a SSL id + + ui.userCertificateText->setReadOnly(true); + ui.userCertificateText->setMinimumHeight(200); + ui.userCertificateText->setMinimumWidth(530); + QFont font("Courier New",10,50,false); + font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch); + font.setStyle(QFont::StyleNormal); + ui.userCertificateText->setFont(font); + ui.userCertificateText->setText(QString::fromStdString(invite)); } void ConfCertDialog::applyDialog() { - std::cerr << "ConfCertDialog::applyDialog() called" << std::endl ; - RsPeerDetails detail; - if (!rsPeers->getPeerDetails(mId, detail)) - { - if (!rsPeers->getGPGDetails(mId, detail)) { - QMessageBox::information(this, - tr("RetroShare"), - tr("Error : cannot get peer details.")); - closeinfodlg(); - } + std::cerr << "ConfCertDialog::applyDialog() called" << std::endl ; + RsPeerDetails detail; + if (!rsPeers->getPeerDetails(mId, detail)) + { + if (!rsPeers->getGPGDetails(mId, detail)) { + QMessageBox::information(this, + tr("RetroShare"), + tr("Error : cannot get peer details.")); + close(); + return; } + } - //check the GPG trustlvl - if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != 4) { - //trust has changed to fully - rsPeers->trustGPGCertificate(detail.id, 4); - } else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != 3) { - rsPeers->trustGPGCertificate(detail.id, 3); - } else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != 2) { - rsPeers->trustGPGCertificate(detail.id, 2); - } + //check the GPG trustlvl + if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != 4) { + //trust has changed to fully + rsPeers->trustGPGCertificate(detail.id, 4); + } else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != 3) { + rsPeers->trustGPGCertificate(detail.id, 3); + } else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != 2) { + rsPeers->trustGPGCertificate(detail.id, 2); + } - if (!detail.isOnlyGPGdetail) { - /* check if the data is the same */ - bool localChanged = false; - bool extChanged = false; - bool dnsChanged = false; + if (!detail.isOnlyGPGdetail) { + /* check if the data is the same */ + bool localChanged = false; + bool extChanged = false; + bool dnsChanged = false; - /* set local address */ - if ((detail.localAddr != ui.localAddress->text().toStdString()) || (detail.localPort != ui.localPort -> value())) - localChanged = true; + /* set local address */ + if ((detail.localAddr != ui.localAddress->text().toStdString()) || (detail.localPort != ui.localPort -> value())) + localChanged = true; - if ((detail.extAddr != ui.extAddress->text().toStdString()) || (detail.extPort != ui.extPort -> value())) - extChanged = true; + if ((detail.extAddr != ui.extAddress->text().toStdString()) || (detail.extPort != ui.extPort -> value())) + extChanged = true; - if ((detail.dyndns != ui.dynDNS->text().toStdString())) - dnsChanged = true; + if ((detail.dyndns != ui.dynDNS->text().toStdString())) + dnsChanged = true; - /* now we can action the changes */ - if (localChanged) - rsPeers->setLocalAddress(mId, ui.localAddress->text().toStdString(), ui.localPort->value()); + /* now we can action the changes */ + if (localChanged) + rsPeers->setLocalAddress(mId, ui.localAddress->text().toStdString(), ui.localPort->value()); - if (extChanged) - rsPeers->setExtAddress(mId,ui.extAddress->text().toStdString(), ui.extPort->value()); + if (extChanged) + rsPeers->setExtAddress(mId,ui.extAddress->text().toStdString(), ui.extPort->value()); - if (dnsChanged) - rsPeers->setDynDNS(mId, ui.dynDNS->text().toStdString()); + if (dnsChanged) + rsPeers->setDynDNS(mId, ui.dynDNS->text().toStdString()); - if(localChanged || extChanged || dnsChanged) - emit configChanged() ; - } + if(localChanged || extChanged || dnsChanged) + emit configChanged(); + } - closeinfodlg(); + loadAll(); + close(); } -void ConfCertDialog::makeFriend() { +void ConfCertDialog::makeFriend() +{ std::string gpg_id = rsPeers->getGPGId(mId); if (ui.signGPGKeyCheckBox->isChecked()) { rsPeers->signGPGCertificate(gpg_id); @@ -385,16 +377,22 @@ void ConfCertDialog::makeFriend() { rsPeers->setAcceptToConnectGPGCertificate(gpg_id, true); } rsPeers->addFriend(mId, gpg_id); - loadDialog(); + loadAll(); + + emit configChanged(); } -void ConfCertDialog::denyFriend() { +void ConfCertDialog::denyFriend() +{ std::string gpg_id = rsPeers->getGPGId(mId); rsPeers->setAcceptToConnectGPGCertificate(gpg_id, false); - loadDialog(); + loadAll(); + + emit configChanged(); } -void ConfCertDialog::signGPGKey() { +void ConfCertDialog::signGPGKey() +{ std::string gpg_id = rsPeers->getGPGId(mId); if (!rsPeers->signGPGCertificate(gpg_id)) { QMessageBox::warning ( NULL, @@ -402,14 +400,16 @@ void ConfCertDialog::signGPGKey() { tr("Maybe password is wrong"), QMessageBox::Ok); } - loadDialog(); + loadAll(); + + emit configChanged(); } /** Displays the help browser and displays the most recently viewed help * topic. */ void ConfCertDialog::showHelpDialog() { - showHelpDialog(QString("trust")); + showHelpDialog("trust"); } /**< Shows the help browser and displays the given help topic. */ @@ -421,27 +421,24 @@ void ConfCertDialog::showHelpDialog(const QString &topic) helpBrowser->showWindow(topic); } -void ConfCertDialog::listWidgetContextMenuPopup( const QPoint &pos) +void ConfCertDialog::listWidgetContextMenuPopup(const QPoint &pos) { QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem(); - if ( ! CurrentItem ) + if (!CurrentItem) return; - QMenu menu( this ); - QAction *copyPeer = new QAction(tr("Copy Peer"), this ); - connect( copyPeer , SIGNAL( triggered() ), this, SLOT( copyToClipboard() ) ); - menu.addAction(copyPeer ); + 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 ) + if (!CurrentItem) return; - QClipboard * cb = QApplication::clipboard(); + QClipboard *cb = QApplication::clipboard(); QString text = CurrentItem->text(); - cb->setText( text, QClipboard::Clipboard ); + cb->setText(text, QClipboard::Clipboard); } diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.h b/retroshare-gui/src/gui/connect/ConfCertDialog.h index c4dd31b87..9d9d6f358 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.h +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.h @@ -29,67 +29,46 @@ class ConfCertDialog : public QDialog { - Q_OBJECT + Q_OBJECT - public: - static void show(const std::string& id) ; - static void showTrust(const std::string& id) ; +public: + enum enumPage { PageDetails, PageTrust, PageCertificate }; + + static void showIt(const std::string& id, enumPage page); - static ConfCertDialog *instance() ; signals: - void configChanged() ; + void configChanged(); + private: + /** Default constructor */ + ConfCertDialog(const std::string& id, QWidget *parent = 0, Qt::WFlags flags = 0); + /** Default destructor */ + ~ConfCertDialog(); - /** Default constructor */ - ConfCertDialog(QWidget *parent = 0, Qt::WFlags flags = 0); - /** Default destructor */ + static ConfCertDialog *instance(const std::string& peer_id); + static void loadAll(); + void load(); - void loadId(std::string id); - -#if 0 - void setInfo(std::string name, - std::string trust, - std::string org, - std::string loc, - std::string country, - std::string signers); -#endif - -protected: - void closeEvent (QCloseEvent * event); - private slots: + void listWidgetContextMenuPopup(const QPoint &pos); - /** Overloaded QWidget.show */ - void show(); - void showTrust(); + void applyDialog(); + void makeFriend(); + void denyFriend(); + void signGPGKey(); - void listWidgetContextMenuPopup( const QPoint &pos); + void showHelpDialog(); + /** Called when a child window requests the given help topic. */ + void showHelpDialog(const QString &topic); - void closeinfodlg(); - void applyDialog(); - void makeFriend(); - void denyFriend(); - void signGPGKey(); - - void showHelpDialog(); - /** Called when a child window requests the given help topic. */ - void showHelpDialog(const QString &topic); - - void copyToClipboard(); + void copyToClipboard(); private: - - void loadDialog(); - std::string mId; - bool isPGPId; /** Qt Designer generated object */ Ui::ConfCertDialog ui; - }; #endif - diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.ui b/retroshare-gui/src/gui/connect/ConfCertDialog.ui index 724726bfe..523f3df1d 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.ui +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.ui @@ -21,7 +21,7 @@ - 2 + 0 @@ -494,7 +494,7 @@ - SignGPG Key + Sign GPG key @@ -581,6 +581,10 @@ + + + :/images/view-certificate-sign-32.png:/images/view-certificate-sign-32.png + Certificate @@ -609,6 +613,9 @@ + + Apply and Close + OK diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index 2dbd2246c..1912299f4 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index edb6a7018..4de26520a 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -1360,7 +1360,7 @@ Verfügbar: %3 Authenticate friend (Sign GPG Key) - Authentifiziere Freund(GPG Schlüssel unterzeichnen) + Authentifiziere Freund (GPG Schlüssel unterzeichnen) @@ -1396,7 +1396,7 @@ Verfügbar: %3 ConfCertDialog - + Cancel Abbrechen @@ -1406,9 +1406,9 @@ Verfügbar: %3 OK - + Peer Info - Peer Info + Nachbar Info @@ -1428,7 +1428,7 @@ Verfügbar: %3 Peer Address - Adresse des Peers + Adresse des Nachbarn @@ -1442,13 +1442,14 @@ Verfügbar: %3 + Sign GPG key Unterzeichne GPG Schlüssel - + Your trust in this peer is: - Ihr Vertrauen zu diesem Peer ist: + Ihr Vertrauen zu diesem Nachbar ist: @@ -1458,20 +1459,15 @@ Verfügbar: %3 Peer has signed my GPG key - Peer hat meinen GPG Schlüssel unterzeichnet + Nachbar hat meinen GPG Schlüssel unterzeichnet Peer key is signed by : - Peer Schlüssel ist unterzeichnet von: + Nachbar Schlüssel ist unterzeichnet von: - - SignGPG Key - Unterzeichne GPG Key - - - + Last Contact Letzter Kontakt @@ -1514,7 +1510,7 @@ Verfügbar: %3 None - Keine + Nicht @@ -1527,12 +1523,12 @@ Verfügbar: %3 Voll - + Apply and Close Übernehmen und Schliessen - + RetroShare @@ -1541,57 +1537,57 @@ Verfügbar: %3 Error : cannot get peer details. - Fehler: Kann Peer Details nicht bekommen. + Fehler: Kann Peer Details nicht ermitteln. - + Your key is signed by : Ihr Schlüssel ist unterzeichnet von: Peer key is signed by : - Peer Schlüssel ist unterzeichnet von: + Nachbar Schlüssel ist unterzeichnet von: - + Your trust in this peer is ultimate, it's probably a key you own. - Sie haben das höchste Vertrauen in diesen Peer. Es ist wahrscheinlich ein Schlüssel von Ihnen. + Sie haben das höchste Vertrauen in diesen Nachbarn. Es ist wahrscheinlich ein Schlüssel von Ihnen. Your trust in this peer is full. - Sie vertrauen diesem Peer voll. + Sie vertrauen diesem Nachbarn voll. Your trust in this peer is marginal. - Sie vertrauen diesem Peer geringfügig. + Sie vertrauen diesem Nachbarn geringfügig. Your trust in this peer is none. - Sie vertrauen diesem Peer nicht. + Sie vertrauen diesem Nachbarn nicht. Your trust in this peer is not set. - Ihr Vertrauen in diesen Peer ist nicht festgelegt. + Ihr Vertrauen in diesen Nachbarn ist nicht festgelegt. Peer has authenticated me as a friend and did sign my GPG key - Peer hat mich als Freund authentifiziert + Nachbar hat mich als Freund authentifiziert und meinen GPG Schlüssel unterzeichnet Peer has not authenticated me as a friend and did not sign my GPG key - Peer hat mich nicht als Freund authentifiziert + Nachbar hat mich nicht als Freund authentifiziert und meinen GPG Schlüssel nicht unterzeichnet - + Signature Failure Signatur Fehler @@ -1601,7 +1597,7 @@ und meinen GPG Schlüssel nicht unterzeichnet Vielleicht ist das Passwort falsch - + Trust Vertrauen @@ -1621,9 +1617,9 @@ und meinen GPG Schlüssel nicht unterzeichnet - + Copy Peer - Kopiere Peer + Kopiere Nachbar @@ -5170,7 +5166,7 @@ p, li { white-space: pre-wrap; } Do you really want to exit RetroShare ? - Wollen Sie RetroShare wirklich beenden? + Wollst Du RetroShare wirklich beenden? @@ -6564,7 +6560,7 @@ p, li { white-space: pre-wrap; } Peer details... - Peer-Dateils... + Nachbar-Details... diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index e29bb16f6..93a45dcf3 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -226,7 +226,6 @@ int main(int argc, char *argv[]) QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)),w->networkDialog,SLOT(setLogInfo(QString))) ; QObject::connect(notify,SIGNAL(errorOccurred(int,int,const QString&)),w,SLOT(displayErrorMessage(int,int,const QString&))) ; - QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ; QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ; w->installGroupChatNotifier();