2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006, crypton
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2009-07-17 17:41:20 -04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2007-11-14 22:18:48 -05:00
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
#include "ConfCertDialog.h"
|
|
|
|
|
2010-07-23 14:52:58 -04:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QClipboard>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2008-01-25 03:49:40 -05:00
|
|
|
#include "rsiface/rspeers.h"
|
2009-07-17 17:41:20 -04:00
|
|
|
#include "rsiface/rsdisc.h"
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-07-23 14:52:58 -04:00
|
|
|
#include "gui/help/browser/helpbrowser.h"
|
2009-01-01 19:55:03 -05:00
|
|
|
|
2009-05-07 18:43:11 -04:00
|
|
|
ConfCertDialog *ConfCertDialog::instance()
|
|
|
|
{
|
|
|
|
static ConfCertDialog *confdialog = new ConfCertDialog ;
|
|
|
|
|
|
|
|
return confdialog ;
|
|
|
|
}
|
2009-01-01 19:55:03 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/* 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)
|
2008-04-07 20:31:46 -04:00
|
|
|
: QDialog(parent, flags)
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
|
|
|
/* Invoke Qt Designer generated QObject setup routine */
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
|
|
|
|
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg()));
|
2010-01-13 16:25:18 -05:00
|
|
|
connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend()));
|
2010-01-13 16:32:56 -05:00
|
|
|
connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
|
|
|
|
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
|
2010-06-03 14:34:43 -04:00
|
|
|
connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
|
2010-06-13 19:42:21 -04:00
|
|
|
connect(ui.signers_listWidget, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( listWidgetContextMenuPopup( QPoint ) ) );
|
2009-07-17 17:41:20 -04:00
|
|
|
|
2009-05-16 13:17:46 -04:00
|
|
|
ui.applyButton->setToolTip(tr("Apply and Close"));
|
2007-11-14 22:18:48 -05:00
|
|
|
}
|
|
|
|
|
2009-05-07 18:43:11 -04:00
|
|
|
void ConfCertDialog::show(const std::string& peer_id)
|
|
|
|
{
|
|
|
|
/* set the Id */
|
|
|
|
|
|
|
|
instance()->loadId(peer_id);
|
2010-01-13 16:32:05 -05:00
|
|
|
instance()->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfCertDialog::showTrust(const std::string& peer_id)
|
|
|
|
{
|
|
|
|
/* set the Id */
|
|
|
|
|
|
|
|
instance()->loadId(peer_id);
|
|
|
|
instance()->showTrust();
|
2009-05-07 18:43:11 -04:00
|
|
|
}
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
|
2009-07-17 17:41:20 -04:00
|
|
|
/**
|
2007-11-14 22:18:48 -05:00
|
|
|
Overloads the default show() slot so we can set opacity*/
|
|
|
|
|
|
|
|
void
|
|
|
|
ConfCertDialog::show()
|
|
|
|
{
|
|
|
|
//loadSettings();
|
2010-01-13 16:32:05 -05:00
|
|
|
ui.stabWidget->setCurrentIndex(0);
|
|
|
|
if(!this->isVisible()) {
|
|
|
|
QDialog::show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ConfCertDialog::showTrust()
|
|
|
|
{
|
|
|
|
//loadSettings();
|
|
|
|
ui.stabWidget->setCurrentIndex(1);
|
2007-11-14 22:18:48 -05:00
|
|
|
if(!this->isVisible()) {
|
2008-04-07 20:31:46 -04:00
|
|
|
QDialog::show();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfCertDialog::closeEvent (QCloseEvent * event)
|
|
|
|
{
|
|
|
|
QWidget::closeEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfCertDialog::closeinfodlg()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfCertDialog::loadId(std::string id)
|
|
|
|
{
|
|
|
|
mId = id;
|
|
|
|
loadDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfCertDialog::loadDialog()
|
|
|
|
{
|
2008-01-25 03:49:40 -05:00
|
|
|
RsPeerDetails detail;
|
|
|
|
if (!rsPeers->getPeerDetails(mId, detail))
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
2010-01-13 16:14:49 -05:00
|
|
|
QMessageBox::information(this,
|
|
|
|
tr("RetroShare"),
|
|
|
|
tr("Error : cannot get peer details."));
|
|
|
|
closeinfodlg();
|
2010-01-13 16:11:02 -05:00
|
|
|
}
|
2009-07-17 17:41:20 -04:00
|
|
|
|
2008-01-25 03:49:40 -05:00
|
|
|
ui.name->setText(QString::fromStdString(detail.name));
|
2010-06-30 17:57:46 -04:00
|
|
|
ui.peerid->setText(QString::fromStdString(detail.id));
|
|
|
|
ui.rsid->setText(QString::fromStdString(detail.name) + "@" + QString::fromStdString(detail.id));
|
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
if (!detail.isOnlyGPGdetail) {
|
2010-06-30 17:57:46 -04:00
|
|
|
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.loc->setText(QString::fromStdString(detail.location));
|
2010-01-13 16:11:02 -05:00
|
|
|
// 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 retroshare version */
|
|
|
|
std::map<std::string, std::string>::iterator vit;
|
|
|
|
std::map<std::string, std::string> versions;
|
|
|
|
bool retv = rsDisc->getDiscVersions(versions);
|
|
|
|
if (retv && versions.end() != (vit = versions.find(detail.id)))
|
|
|
|
{
|
|
|
|
ui.version->setText(QString::fromStdString(vit->second));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2010-04-22 14:49:51 -04:00
|
|
|
ui.dynDNS->setText(QString::fromStdString(detail.dyndns));
|
|
|
|
|
2010-01-13 16:11:02 -05:00
|
|
|
ui.ipAddressList->clear();
|
|
|
|
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
|
|
|
ui.ipAddressList->addItem(QString::fromStdString(*it));
|
2010-01-13 16:12:56 -05:00
|
|
|
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.loc->show();
|
|
|
|
ui.label_loc->show();
|
2010-01-13 16:12:56 -05:00
|
|
|
ui.lastcontact->show();
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.label_last_contact->show();
|
2010-01-13 16:12:56 -05:00
|
|
|
ui.version->show();
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.label_version->show();
|
2010-01-13 16:12:56 -05:00
|
|
|
|
|
|
|
ui.groupBox->show();
|
2010-06-30 17:57:46 -04:00
|
|
|
ui.rsid->hide();
|
|
|
|
ui.label_rsid->hide();
|
2010-01-13 16:11:02 -05:00
|
|
|
} else {
|
2010-06-30 17:57:46 -04:00
|
|
|
ui.rsid->show();
|
|
|
|
ui.label_rsid->show();
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.loc->hide();
|
|
|
|
ui.label_loc->hide();
|
2010-01-13 16:11:02 -05:00
|
|
|
ui.lastcontact->hide();
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.label_last_contact->hide();
|
2010-01-13 16:11:02 -05:00
|
|
|
ui.version->hide();
|
2010-01-13 16:22:52 -05:00
|
|
|
ui.label_version->hide();
|
2010-01-13 16:11:02 -05:00
|
|
|
|
|
|
|
ui.groupBox->hide();
|
|
|
|
}
|
2009-11-11 17:12:50 -05:00
|
|
|
|
2010-01-13 16:32:56 -05:00
|
|
|
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 : "));
|
2010-01-13 16:11:02 -05:00
|
|
|
|
|
|
|
} else {
|
2010-01-13 16:32:56 -05:00
|
|
|
ui.make_friend_button->show();
|
|
|
|
ui.signGPGKeyCheckBox->show();
|
|
|
|
ui.signKeyButton->show();
|
|
|
|
ui.denyFriendButton->show();
|
2010-01-13 16:14:49 -05:00
|
|
|
|
2010-01-13 16:32:56 -05:00
|
|
|
ui.web_of_trust_label->show();
|
2010-01-13 16:14:49 -05:00
|
|
|
ui.radioButton_trust_fully->show();
|
|
|
|
ui.radioButton_trust_marginnaly->show();
|
|
|
|
ui.radioButton_trust_never->show();
|
2010-01-13 16:32:56 -05:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
2010-01-13 16:14:49 -05:00
|
|
|
} else {
|
2010-01-13 16:32:56 -05:00
|
|
|
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();
|
|
|
|
} 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);
|
2010-02-27 12:47:52 -05:00
|
|
|
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"));
|
2010-01-13 16:32:56 -05:00
|
|
|
} 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);
|
2010-02-27 12:47:52 -05:00
|
|
|
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"));
|
2010-01-13 16:32:56 -05:00
|
|
|
} 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);
|
2010-02-27 12:47:52 -05:00
|
|
|
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"));
|
2010-01-13 16:32:56 -05:00
|
|
|
} else {
|
|
|
|
ui.web_of_trust_label->setText(tr("Your trust in this peer is not set."));
|
2010-04-25 13:07:04 -04:00
|
|
|
|
|
|
|
//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);
|
|
|
|
|
2010-01-13 16:32:56 -05:00
|
|
|
ui.radioButton_trust_fully->setChecked(false);
|
|
|
|
ui.radioButton_trust_marginnaly->setChecked(false);
|
|
|
|
ui.radioButton_trust_never->setChecked(false);
|
2010-04-25 13:07:04 -04:00
|
|
|
|
|
|
|
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"));
|
2010-01-13 16:32:56 -05:00
|
|
|
}
|
2010-01-13 16:14:49 -05:00
|
|
|
}
|
2010-01-13 16:32:56 -05:00
|
|
|
|
|
|
|
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"));
|
|
|
|
}
|
2010-01-13 16:11:02 -05:00
|
|
|
}
|
|
|
|
|
2010-06-13 19:42:21 -04:00
|
|
|
ui.signers_listWidget->clear() ;
|
2010-01-13 16:11:02 -05:00
|
|
|
for(std::list<std::string>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) {
|
|
|
|
RsPeerDetails signerDetail;
|
2010-01-13 16:22:52 -05:00
|
|
|
if (rsPeers->getGPGDetails(*it, signerDetail)) {
|
2010-06-30 17:57:46 -04:00
|
|
|
ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name) + " (" + QString::fromStdString(signerDetail.id) +")");
|
2010-01-13 16:11:02 -05:00
|
|
|
}
|
|
|
|
}
|
2007-11-14 22:18:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfCertDialog::applyDialog()
|
|
|
|
{
|
2010-01-13 16:14:49 -05:00
|
|
|
std::cerr << "ConfCertDialog::applyDialog() called" << std::endl ;
|
|
|
|
RsPeerDetails detail;
|
2008-01-25 03:49:40 -05:00
|
|
|
if (!rsPeers->getPeerDetails(mId, detail))
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
2010-01-13 16:22:52 -05:00
|
|
|
if (!rsPeers->getGPGDetails(mId, detail)) {
|
2010-01-13 16:14:49 -05:00
|
|
|
QMessageBox::information(this,
|
|
|
|
tr("RetroShare"),
|
|
|
|
tr("Error : cannot get peer details."));
|
|
|
|
closeinfodlg();
|
|
|
|
}
|
|
|
|
}
|
2009-07-17 17:41:20 -04:00
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
//check the GPG trustlvl
|
|
|
|
if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != 4) {
|
|
|
|
//trust has changed to fully
|
2010-01-13 16:22:52 -05:00
|
|
|
rsPeers->trustGPGCertificate(detail.id, 4);
|
2010-01-13 16:14:49 -05:00
|
|
|
} else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != 3) {
|
2010-01-13 16:22:52 -05:00
|
|
|
rsPeers->trustGPGCertificate(detail.id, 3);
|
2010-01-13 16:14:49 -05:00
|
|
|
} else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != 2) {
|
2010-01-13 16:22:52 -05:00
|
|
|
rsPeers->trustGPGCertificate(detail.id, 2);
|
2010-01-13 16:14:49 -05:00
|
|
|
}
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
if (!detail.isOnlyGPGdetail) {
|
|
|
|
/* check if the data is the same */
|
|
|
|
bool localChanged = false;
|
|
|
|
bool extChanged = false;
|
2010-04-22 14:49:51 -04:00
|
|
|
bool dnsChanged = false;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
/* set local address */
|
|
|
|
if ((detail.localAddr != ui.localAddress->text().toStdString()) || (detail.localPort != ui.localPort -> value()))
|
|
|
|
localChanged = true;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
if ((detail.extAddr != ui.extAddress->text().toStdString()) || (detail.extPort != ui.extPort -> value()))
|
|
|
|
extChanged = true;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-04-22 14:49:51 -04:00
|
|
|
if ((detail.dyndns != ui.dynDNS->text().toStdString()))
|
|
|
|
dnsChanged = true;
|
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
/* now we can action the changes */
|
|
|
|
if (localChanged)
|
|
|
|
rsPeers->setLocalAddress(mId, ui.localAddress->text().toStdString(), ui.localPort->value());
|
2009-07-17 17:41:20 -04:00
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
if (extChanged)
|
|
|
|
rsPeers->setExtAddress(mId,ui.extAddress->text().toStdString(), ui.extPort->value());
|
|
|
|
|
2010-04-22 14:49:51 -04:00
|
|
|
if (dnsChanged)
|
|
|
|
rsPeers->setDynDNS(mId, ui.dynDNS->text().toStdString());
|
|
|
|
|
|
|
|
if(localChanged || extChanged || dnsChanged)
|
2010-01-13 16:14:49 -05:00
|
|
|
emit configChanged() ;
|
|
|
|
}
|
2009-05-07 18:43:11 -04:00
|
|
|
|
2010-01-13 16:14:49 -05:00
|
|
|
closeinfodlg();
|
2007-11-14 22:18:48 -05:00
|
|
|
}
|
|
|
|
|
2010-01-13 16:32:56 -05:00
|
|
|
void ConfCertDialog::makeFriend() {
|
2010-01-13 16:25:18 -05:00
|
|
|
std::string gpg_id = rsPeers->getGPGId(mId);
|
|
|
|
if (ui.signGPGKeyCheckBox->isChecked()) {
|
|
|
|
rsPeers->signGPGCertificate(gpg_id);
|
|
|
|
} else {
|
|
|
|
rsPeers->setAcceptToConnectGPGCertificate(gpg_id, true);
|
|
|
|
}
|
|
|
|
rsPeers->addFriend(mId, gpg_id);
|
|
|
|
loadDialog();
|
2007-11-14 22:18:48 -05:00
|
|
|
}
|
2010-01-13 16:32:56 -05:00
|
|
|
|
|
|
|
void ConfCertDialog::denyFriend() {
|
|
|
|
std::string gpg_id = rsPeers->getGPGId(mId);
|
|
|
|
rsPeers->setAcceptToConnectGPGCertificate(gpg_id, false);
|
|
|
|
loadDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfCertDialog::signGPGKey() {
|
|
|
|
std::string gpg_id = rsPeers->getGPGId(mId);
|
2010-02-09 14:10:42 -05:00
|
|
|
if (!rsPeers->signGPGCertificate(gpg_id)) {
|
|
|
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
|
|
|
tr("Signature Failure"),
|
|
|
|
tr("Maybe password is wrong"),
|
|
|
|
QMessageBox::Ok);
|
|
|
|
}
|
2010-01-13 16:32:56 -05:00
|
|
|
loadDialog();
|
|
|
|
}
|
|
|
|
|
2010-06-03 14:34:43 -04:00
|
|
|
/** Displays the help browser and displays the most recently viewed help
|
|
|
|
* topic. */
|
|
|
|
void ConfCertDialog::showHelpDialog()
|
|
|
|
{
|
2010-06-13 19:42:21 -04:00
|
|
|
showHelpDialog(QString("trust"));
|
2010-06-03 14:34:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**< Shows the help browser and displays the given help <b>topic</b>. */
|
|
|
|
void ConfCertDialog::showHelpDialog(const QString &topic)
|
|
|
|
{
|
2010-06-13 19:42:21 -04:00
|
|
|
static HelpBrowser *helpBrowser = 0;
|
|
|
|
if (!helpBrowser)
|
2010-06-03 14:34:43 -04:00
|
|
|
helpBrowser = new HelpBrowser(this);
|
2010-06-13 19:42:21 -04:00
|
|
|
helpBrowser->showWindow(topic);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ConfCertDialog::listWidgetContextMenuPopup( const QPoint &pos)
|
|
|
|
{
|
|
|
|
QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem();
|
|
|
|
if ( ! CurrentItem )
|
|
|
|
return;
|
|
|
|
|
|
|
|
QMenu menu( this );
|
2010-06-30 17:57:46 -04:00
|
|
|
QAction *copyPeer = new QAction(tr("Copy Peer"), this );
|
2010-06-13 19:42:21 -04:00
|
|
|
connect( copyPeer , SIGNAL( triggered() ), this, SLOT( copyToClipboard() ) );
|
|
|
|
menu.addAction(copyPeer );
|
|
|
|
menu.exec(QCursor::pos());
|
|
|
|
|
2010-06-03 14:34:43 -04:00
|
|
|
}
|
|
|
|
|
2010-06-13 19:42:21 -04:00
|
|
|
void ConfCertDialog::copyToClipboard( )
|
|
|
|
{
|
|
|
|
QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem();
|
|
|
|
if ( ! CurrentItem )
|
|
|
|
return;
|
|
|
|
|
|
|
|
QClipboard * cb = QApplication::clipboard();
|
|
|
|
QString text = CurrentItem->text();
|
|
|
|
cb->setText( text, QClipboard::Clipboard );
|
|
|
|
}
|