void ConfCertDialog::load() { RsPeerDetails detail; if(!rsPeers->getPeerDetails(peerId, detail)) { QMessageBox::information(this, tr("RetroShare"), tr("Error : cannot get peer details.")); close(); return; } ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_DIRECT_DL ) ; ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ; //ui.pgpfingerprint->setText(QString::fromUtf8(detail.name.c_str())); ui.peerid->setText(QString::fromStdString(detail.id.toStdString())); RetroShareLink link; link.createPerson(detail.gpg_id); ui.pgpfingerprint->setText(link.toHtml()); ui.pgpfingerprint->setToolTip(link.title()); ui.avatar->setId(ChatId(peerId)); ui.loc->setText(QString::fromUtf8(detail.location.c_str())); // Dont Show a timestamp in RS calculate the day ui.lastcontact->setText(DateTime::formatLongDateTime(detail.lastConnect)); /* set retroshare version */ std::string version; rsDisc->getPeerVersion(detail.id, version); ui.version->setText(QString::fromStdString(version)); RsPeerCryptoParams cdet ; if(RsControl::instance()->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0) { QString ct ; ct += QString::fromStdString(cdet.cipher_version) + ": "; ct += QString::fromStdString(cdet.cipher_name); if(cdet.cipher_version != "TLSv1.2") ct += QString::number(cdet.cipher_bits_1); ui.crypto_info->setText(ct) ; } else ui.crypto_info->setText(tr("Not connected")) ; if (detail.isHiddenNode) { // enable only the first row and set name of the first label to "Hidden Address" ui.l_localAddress->setText(tr("Hidden Address")); ui.l_extAddress->setEnabled(false); ui.extAddress->setEnabled(false); ui.l_portExternal->setEnabled(false); ui.extPort->setEnabled(false); ui.l_dynDNS->setEnabled(false); ui.dynDNS->setEnabled(false); /* set hidden address */ ui.localAddress->setText(QString::fromStdString(detail.hiddenNodeAddress)); ui.localPort -> setValue(detail.hiddenNodePort); // set everything else to none ui.extAddress->setText(tr("none")); ui.extPort->setValue(0); ui.dynDNS->setText(tr("none")); } else { // enable everything and set name of the first label to "Local Address" ui.l_localAddress->setText(tr("Local Address")); ui.l_extAddress->setEnabled(true); ui.extAddress->setEnabled(true); ui.l_portExternal->setEnabled(true); ui.extPort->setEnabled(true); ui.l_dynDNS->setEnabled(true); ui.dynDNS->setEnabled(true); /* 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.statusline->setText(StatusDefs::connectStateString(detail)); 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)); ui.loc->show(); ui.label_loc->show(); ui.statusline->show(); ui.label_status->show(); ui.lastcontact->show(); ui.label_last_contact->show(); ui.version->show(); ui.label_version->show(); ui.groupBox->show(); ui.groupBox_4->show(); ui.tabWidget->show(); //ui.rsid->hide(); //ui.label_rsid->hide(); ui.pgpfingerprint->show(); //ui.pgpfingerprint_label->show(); ui.stabWidget->setTabEnabled(2,true) ; ui.stabWidget->setTabEnabled(3,true) ; ui.stabWidget->setTabEnabled(4,true) ; loadInvitePage() ; }
void ConfCertDialog::load() { RsPeerDetails detail; if (!rsPeers->getPeerDetails(mId, detail)) { QMessageBox::information(this, tr("RetroShare"), tr("Error : cannot get peer details.")); close(); return; } if(detail.isOnlyGPGdetail && !rsPeers->isKeySupported(mId)) { ui.make_friend_button->setEnabled(false) ; ui.make_friend_button->setToolTip(tr("The supplied key algorithm is not supported by RetroShare\n(Only RSA keys are supported at the moment)")) ; } else { ui.make_friend_button->setEnabled(true) ; ui.make_friend_button->setToolTip("") ; } ui._anonymous_routing_CB->setChecked(detail.service_perm_flags & RS_SERVICE_PERM_TURTLE ) ; ui._discovery_CB->setChecked( detail.service_perm_flags & RS_SERVICE_PERM_DISCOVERY ) ; ui._forums_channels_CB->setChecked( detail.service_perm_flags & RS_SERVICE_PERM_DISTRIB ) ; ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_SERVICE_PERM_DIRECT_DL ) ; ui.name->setText(QString::fromUtf8(detail.name.c_str())); ui.peerid->setText(QString::fromStdString(detail.id)); RetroShareLink link; link.createPerson(detail.id); ui.rsid->setText(link.toHtml()); ui.pgpfingerprint->setText(misc::fingerPrintStyleSplit(QString::fromStdString(detail.fpr))); ui.rsid->setToolTip(link.title()); if (!detail.isOnlyGPGdetail) { ui.avatar->setId(mId, false); ui.loc->setText(QString::fromUtf8(detail.location.c_str())); // Dont Show a timestamp in RS calculate the day ui.lastcontact->setText(DateTime::formatLongDateTime(detail.lastConnect)); /* set retroshare version */ std::string version; rsDisc->getPeerVersion(detail.id, version); ui.version->setText(QString::fromStdString(version)); RsPeerCryptoParams cdet ; if(RsControl::instance()->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0) { QString ct ; ct += QString::fromStdString(cdet.cipher_name) ; ct += QString::number(cdet.cipher_bits_1) ; ct += "-"+QString::fromStdString(cdet.cipher_version) ; ui.crypto_info->setText(ct) ; } else ui.crypto_info->setText(tr("Not connected")) ; if (detail.isHiddenNode) { /* set local address */ ui.localAddress->setText("hidden"); ui.localPort -> setValue(0); /* set the server address */ ui.extAddress->setText("hidden"); ui.extPort -> setValue(0); ui.dynDNS->setText(QString::fromStdString(detail.hiddenNodeAddress)); } else { /* 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.statusline->setText(StatusDefs::connectStateString(detail)); 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)); ui.loc->show(); ui.label_loc->show(); ui.statusline->show(); ui.label_status->show(); ui.lastcontact->show(); ui.label_last_contact->show(); ui.version->show(); ui.label_version->show(); ui.groupBox->show(); ui.groupBox_4->show(); ui.tabWidget->show(); ui.rsid->hide(); ui.label_rsid->hide(); ui.pgpfingerprint->show(); ui.pgpfingerprint_label->show(); } else { ui.avatar->setId(mId, true); ui.rsid->show(); ui.peerid->hide(); ui.label_id->hide(); ui.label_rsid->show(); ui.pgpfingerprint->show(); ui.pgpfingerprint_label->show(); ui.loc->hide(); ui.label_loc->hide(); ui.statusline->hide(); ui.label_status->hide(); ui.lastcontact->hide(); ui.label_last_contact->hide(); ui.version->hide(); ui.label_version->hide(); ui.groupBox_4->hide(); ui.crypto_info->hide(); ui.crypto_label->hide(); ui.groupBox->hide(); ui.tabWidget->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("My 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(false); } else { ui.signGPGKeyCheckBox->hide(); } } //web of trust if (detail.trustLvl == RS_TRUST_LVL_ULTIMATE) { //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 == RS_TRUST_LVL_FULL) { 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 == RS_TRUST_LVL_MARGINAL) { 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 == RS_TRUST_LVL_NEVER) { 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); 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_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 PGP key")); } else { ui.is_signing_me->setText(tr("Peer has not authenticated me as a friend and did not sign my PGP key")); } } QString text; for(std::list<std::string>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) { link.createPerson(*it); if (link.valid()) { text += link.toHtml() + "<BR>"; } } ui.signers->setHtml(text); loadInvitePage() ; }
void ConfCertDialog::load() { RsPeerDetails detail; if (!rsPeers->getPeerDetails(mId, detail)) { QMessageBox::information(this, tr("RetroShare"), tr("Error : cannot get peer details.")); close(); return; } if(detail.isOnlyGPGdetail && !rsPeers->isKeySupported(mId)) { ui.make_friend_button->setEnabled(false) ; ui.make_friend_button->setToolTip(tr("The supplied key algorithm is not supported by RetroShare\n(Only RSA keys are supported at the moment)")) ; } else { ui.make_friend_button->setEnabled(true) ; ui.make_friend_button->setToolTip("") ; } ui.name->setText(QString::fromUtf8(detail.name.c_str())); ui.peerid->setText(QString::fromStdString(detail.id)); RetroShareLink link; link.createPerson(detail.id); ui.rsid->setText(link.toHtml()); ui.rsid->setToolTip(link.title()); if (!detail.isOnlyGPGdetail) { ui.avatar->setId(mId, false); ui.loc->setText(QString::fromUtf8(detail.location.c_str())); // 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); ui.dynDNS->setText(QString::fromStdString(detail.dyndns)); ui.statusline->setText(StatusDefs::connectStateString(detail)); 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)); ui.loc->show(); ui.label_loc->show(); ui.statusline->show(); ui.label_status->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.avatar->setId(mId, true); ui.rsid->show(); ui.label_rsid->show(); ui.loc->hide(); ui.label_loc->hide(); ui.statusline->hide(); ui.label_status->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(false); } else { ui.signGPGKeyCheckBox->hide(); } } //web of trust if (detail.trustLvl == RS_TRUST_LVL_ULTIMATE) { //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 == RS_TRUST_LVL_FULL) { 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 == RS_TRUST_LVL_MARGINAL) { 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 == RS_TRUST_LVL_NEVER) { 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); 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_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")); } } QString text; for(std::list<std::string>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) { link.createPerson(*it); if (link.valid()) { text += link.toHtml() + "<BR>"; } } ui.signers->setHtml(text); loadInvitePage() ; }