mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-27 19:10:41 -05:00
remove the ssl cert storage. Big rewrite of ssl cert and friend management
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2017 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bb9fb11257
commit
9976b80566
39 changed files with 2056 additions and 1957 deletions
|
|
@ -188,10 +188,10 @@ void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint point )
|
|||
|
||||
// That's what context menus are made for
|
||||
RsPeerDetails detail;
|
||||
if(!rsPeers->getPGPDetails(peer_id, detail)) // that is not suppose to fail.
|
||||
if(!rsPeers->getGPGDetails(peer_id, detail)) // that is not suppose to fail.
|
||||
return ;
|
||||
|
||||
if(peer_id != rsPeers->getPGPOwnId())
|
||||
if(peer_id != rsPeers->getGPGOwnId())
|
||||
{
|
||||
if(detail.ownsign)
|
||||
{
|
||||
|
|
@ -217,7 +217,7 @@ void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint point )
|
|||
#endif
|
||||
}
|
||||
}
|
||||
if ( peer_id == rsPeers->getPGPOwnId())
|
||||
if ( peer_id == rsPeers->getGPGOwnId())
|
||||
{
|
||||
exportcertAct = new QAction(QIcon(IMAGE_EXPIORT), tr( "Export my Cert" ), this );
|
||||
connect( exportcertAct , SIGNAL( triggered() ), this, SLOT( on_actionExportKey_activated() ) );
|
||||
|
|
@ -260,8 +260,8 @@ void NetworkDialog::makeFriend()
|
|||
QTreeWidgetItem *wi = getCurrentNeighbour();
|
||||
std::string authId = wi->text(4).toStdString() ;
|
||||
|
||||
rsPeers->SignGPGCertificate(authId);
|
||||
rsPeers->addFriend(authId);
|
||||
rsPeers->signGPGCertificate(authId);
|
||||
rsPeers->addDummyFriend(authId);
|
||||
|
||||
insertConnect() ;
|
||||
}
|
||||
|
|
@ -348,9 +348,9 @@ void NetworkDialog::insertConnect()
|
|||
std::list<std::string> neighs; //these are GPG ids
|
||||
std::list<std::string>::iterator it;
|
||||
if (ui.showUnvalidKeys->isChecked()) {
|
||||
rsPeers->getPGPAllList(neighs);
|
||||
rsPeers->getGPGAllList(neighs);
|
||||
} else {
|
||||
rsPeers->getPGPValidList(neighs);
|
||||
rsPeers->getGPGValidList(neighs);
|
||||
}
|
||||
|
||||
/* get a link to the table */
|
||||
|
|
@ -364,17 +364,17 @@ void NetworkDialog::insertConnect()
|
|||
}
|
||||
|
||||
RsPeerDetails ownGPGDetails ;
|
||||
rsPeers->getPGPDetails(rsPeers->getPGPOwnId(), ownGPGDetails);
|
||||
rsPeers->getGPGDetails(rsPeers->getGPGOwnId(), ownGPGDetails);
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = neighs.begin(); it != neighs.end(); it++)
|
||||
{
|
||||
if (*it == rsPeers->getPGPOwnId()) {
|
||||
if (*it == rsPeers->getGPGOwnId()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPGPDetails(*it, detail))
|
||||
if (!rsPeers->getGPGDetails(*it, detail))
|
||||
{
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
|
@ -525,9 +525,10 @@ std::string NetworkDialog::loadneighbour()
|
|||
|
||||
std::string file = fileName.toStdString();
|
||||
std::string id;
|
||||
std::string gpg_id;
|
||||
if (file != "")
|
||||
{
|
||||
rsPeers->LoadCertificateFromFile(file, id);
|
||||
rsPeers->loadCertificateFromFile(file, id, gpg_id);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
|
@ -608,7 +609,7 @@ void NetworkDialog::on_actionExportKey_activated()
|
|||
QDir::homePath(),
|
||||
"RetroShare Certificate (*.pqi)");
|
||||
|
||||
if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
if ( rsPeers->saveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
{
|
||||
QMessageBox::information(this, tr("RetroShare"),
|
||||
tr("Certificate file successfully created"),
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ void NetworkView::insertPeers()
|
|||
/* add all friends */
|
||||
std::list<std::string> ids;
|
||||
std::list<std::string>::iterator it;
|
||||
rsPeers->getPGPAllList(ids);
|
||||
std::string ownId = rsPeers->getPGPOwnId();
|
||||
rsPeers->getGPGAllList(ids);
|
||||
std::string ownId = rsPeers->getGPGOwnId();
|
||||
|
||||
std::cerr << "NetworkView::insertPeers()" << std::endl;
|
||||
|
||||
|
|
@ -326,9 +326,9 @@ void NetworkView::insertSignatures()
|
|||
/* iterate through all friends */
|
||||
std::list<std::string> ids;
|
||||
std::list<std::string>::iterator it, sit;
|
||||
std::string ownId = rsPeers->getPGPOwnId();
|
||||
std::string ownId = rsPeers->getGPGOwnId();
|
||||
|
||||
rsPeers->getPGPAllList(ids);
|
||||
rsPeers->getGPGAllList(ids);
|
||||
|
||||
std::cerr << "NetworkView::insertSignatures()" << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ void PeersDialog::insertPeers()
|
|||
return;
|
||||
}
|
||||
|
||||
rsPeers->getPGPAcceptedList(gpgFriends);
|
||||
rsPeers->getGPGAcceptedList(gpgFriends);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *peerWidget = ui.peertreeWidget;
|
||||
|
|
@ -287,122 +287,124 @@ void PeersDialog::insertPeers()
|
|||
|
||||
//add the gpg friends
|
||||
for(it = gpgFriends.begin(); it != gpgFriends.end(); it++) {
|
||||
if (*it == rsPeers->getPGPOwnId()) {
|
||||
std::cerr << "" << *it << std::endl;
|
||||
if (*it == rsPeers->getGPGOwnId()) {
|
||||
continue;
|
||||
}
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(*it, detail)) {
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item;
|
||||
QList<QTreeWidgetItem *> list = peerWidget->findItems (QString::fromStdString(detail.id), Qt::MatchExactly, 3);
|
||||
if (list.size() == 1) {
|
||||
item = list.front();
|
||||
} else {
|
||||
item = new QTreeWidgetItem(0);
|
||||
item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(*it, detail)) {
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item;
|
||||
QList<QTreeWidgetItem *> list = peerWidget->findItems (QString::fromStdString(detail.gpg_id), Qt::MatchExactly, 3);
|
||||
if (list.size() == 1) {
|
||||
item = list.front();
|
||||
} else {
|
||||
item = new QTreeWidgetItem(0);
|
||||
item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
|
||||
}
|
||||
|
||||
item -> setText(0, QString::fromStdString(detail.name));
|
||||
|
||||
item -> setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
//item -> setText( 1, QString::fromStdString(detail.name));
|
||||
|
||||
/* not displayed, used to find back the item */
|
||||
item -> setText(3, QString::fromStdString(detail.id));
|
||||
|
||||
/* add to the list. If item is already in the list, it won't be duplicated thanks to Qt */
|
||||
peerWidget->addTopLevelItem(item);
|
||||
|
||||
//add the childs (ssl certs)
|
||||
//item->takeChildren();
|
||||
|
||||
std::list<std::string> sslContacts;
|
||||
rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslContacts);
|
||||
for(std::list<std::string>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
|
||||
RsPeerDetails sslDetail;
|
||||
if (!rsPeers->getPeerDetails(*sslIt, sslDetail)) {
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
item -> setText(0, QString::fromStdString(detail.name));
|
||||
/* find the sslItem */
|
||||
QTreeWidgetItem *sslItem = new QTreeWidgetItem(1);
|
||||
bool gotToExpandBecauseNewChild = true;
|
||||
for (int childIndex = 0; childIndex < item->childCount(); childIndex++) {
|
||||
if (item->child(childIndex)->text(3).toStdString() == sslDetail.id) {
|
||||
sslItem = item->child(childIndex);
|
||||
gotToExpandBecauseNewChild = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* not displayed, used to find back the item */
|
||||
sslItem -> setText(3, QString::fromStdString(sslDetail.id));
|
||||
|
||||
item -> setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
//item -> setText( 1, QString::fromStdString(detail.name));
|
||||
if (rsMsgs->getCustomStateString(sslDetail.id) != "") {
|
||||
sslItem -> setText( 0, tr("location : ") + QString::fromStdString(sslDetail.location) + tr(" - ") + QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id)));
|
||||
sslItem -> setToolTip( 0, tr("location : ") + QString::fromStdString(sslDetail.location) + tr(" - ") + QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id)));
|
||||
} else {
|
||||
sslItem -> setText( 0, tr("location : ") + QString::fromStdString(sslDetail.location));
|
||||
sslItem -> setToolTip( 0, tr("location : ") + QString::fromStdString(sslDetail.location));
|
||||
}
|
||||
|
||||
/* not displayed, used to find back the item */
|
||||
item -> setText(3, QString::fromStdString(detail.id));
|
||||
sslItem -> setText(1, QString::fromStdString(sslDetail.autoconnect));
|
||||
|
||||
/* add to the list. If item is already in the list, it won't be duplicated thanks to Qt */
|
||||
peerWidget->addTopLevelItem(item);
|
||||
|
||||
//add the childs (ssl certs)
|
||||
//item->takeChildren();
|
||||
|
||||
std::list<std::string> sslContacts;
|
||||
rsPeers->getSSLChildListOfGPGId(detail.id, sslContacts);
|
||||
for(std::list<std::string>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
|
||||
RsPeerDetails sslDetail;
|
||||
if (!rsPeers->getPeerDetails(*sslIt, sslDetail)) {
|
||||
continue; /* BAD */
|
||||
/* change color and icon */
|
||||
int i;
|
||||
if (sslDetail.state & RS_PEER_STATE_CONNECTED) {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::darkBlue));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
|
||||
/* find the sslItem */
|
||||
QTreeWidgetItem *sslItem = new QTreeWidgetItem(1);
|
||||
bool gotToExpandBecauseNewChild = true;
|
||||
for (int childIndex = 0; childIndex < item->childCount(); childIndex++) {
|
||||
if (item->child(childIndex)->text(3).toStdString() == sslDetail.id) {
|
||||
sslItem = item->child(childIndex);
|
||||
gotToExpandBecauseNewChild = false;
|
||||
break;
|
||||
}
|
||||
} else if (sslDetail.state & RS_PEER_STATE_UNREACHABLE) {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_UNREACHABLE)));
|
||||
QFont font;
|
||||
font.setBold(false);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::darkRed));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
/* not displayed, used to find back the item */
|
||||
sslItem -> setText(3, QString::fromStdString(sslDetail.id));
|
||||
|
||||
if (rsMsgs->getCustomStateString(sslDetail.id) != "") {
|
||||
sslItem -> setText( 0, tr("location : ") + QString::fromStdString(sslDetail.location) + tr(" - ") + QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id)));
|
||||
sslItem -> setToolTip( 0, tr("location : ") + QString::fromStdString(sslDetail.location) + tr(" - ") + QString::fromStdString(rsMsgs->getCustomStateString(sslDetail.id)));
|
||||
} else if (sslDetail.state & RS_PEER_STATE_ONLINE) {
|
||||
/* bright green */
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_AVAIBLE)));
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::darkCyan));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
} else {
|
||||
if (time(NULL) - sslDetail.lastConnect < 3600) {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_OFFLINE)));
|
||||
} else {
|
||||
sslItem -> setText( 0, tr("location : ") + QString::fromStdString(sslDetail.location));
|
||||
sslItem -> setToolTip( 0, tr("location : ") + QString::fromStdString(sslDetail.location));
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_OFFLINE2)));
|
||||
}
|
||||
|
||||
/* not displayed, used to find back the item */
|
||||
sslItem -> setText(1, QString::fromStdString(sslDetail.autoconnect));
|
||||
|
||||
/* change color and icon */
|
||||
int i;
|
||||
if (sslDetail.state & RS_PEER_STATE_CONNECTED) {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::darkBlue));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
} else if (sslDetail.state & RS_PEER_STATE_UNREACHABLE) {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_UNREACHABLE)));
|
||||
QFont font;
|
||||
font.setBold(false);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::darkRed));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
} else if (sslDetail.state & RS_PEER_STATE_ONLINE) {
|
||||
/* bright green */
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_AVAIBLE)));
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::darkCyan));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
} else {
|
||||
if (time(NULL) - sslDetail.lastConnect < 3600) {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_OFFLINE)));
|
||||
} else {
|
||||
sslItem -> setIcon(0,(QIcon(IMAGE_OFFLINE2)));
|
||||
}
|
||||
QFont font;
|
||||
font.setBold(false);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::black));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PEERS_DEBUG
|
||||
std::cerr << "PeersDialog::insertPeers() inserting sslItem." << std::endl;
|
||||
#endif
|
||||
/* add to the list. If item is already in the list, it won't be duplicated thanks to Qt */
|
||||
item->addChild(sslItem);
|
||||
if (gotToExpandBecauseNewChild) {
|
||||
item->setExpanded(true);
|
||||
QFont font;
|
||||
font.setBold(false);
|
||||
for(i = 0; i < 3; i++) {
|
||||
sslItem -> setTextColor(i,(Qt::black));
|
||||
sslItem -> setFont(i,font);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PEERS_DEBUG
|
||||
std::cerr << "PeersDialog::insertPeers() inserting sslItem." << std::endl;
|
||||
#endif
|
||||
/* add to the list. If item is already in the list, it won't be duplicated thanks to Qt */
|
||||
item->addChild(sslItem);
|
||||
if (gotToExpandBecauseNewChild) {
|
||||
item->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -443,7 +445,7 @@ void PeersDialog::exportfriend()
|
|||
#endif
|
||||
if (rsPeers)
|
||||
{
|
||||
rsPeers->SaveCertificateToFile(id, file);
|
||||
rsPeers->saveCertificateToFile(id, file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ void TrustView::update()
|
|||
|
||||
std::list<std::string> neighs;
|
||||
|
||||
if(!rsPeers->getOthersList(neighs))
|
||||
// if(!rsPeers->getOthersList(neighs))
|
||||
return ;
|
||||
|
||||
// neighs.push_back(rsPeers->getPGPOwnId()) ;
|
||||
|
|
|
|||
|
|
@ -106,8 +106,7 @@ void ConfCertDialog::loadDialog()
|
|||
ui.name->setText(QString::fromStdString(detail.name));
|
||||
ui.peerid->setText(QString::fromStdString(detail.id));
|
||||
if (!detail.isOnlyGPGdetail) {
|
||||
ui.orgloc->setText(QString::fromStdString(detail.org));
|
||||
ui.country->setText(QString::fromStdString(detail.location));
|
||||
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);
|
||||
|
|
@ -133,25 +132,21 @@ void ConfCertDialog::loadDialog()
|
|||
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
||||
ui.ipAddressList->addItem(QString::fromStdString(*it));
|
||||
|
||||
ui.orgloc->show();
|
||||
ui.label_11->show();
|
||||
ui.country->show();
|
||||
ui.label_8->show();
|
||||
ui.loc->show();
|
||||
ui.label_loc->show();
|
||||
ui.lastcontact->show();
|
||||
ui.label_7->show();
|
||||
ui.label_last_contact->show();
|
||||
ui.version->show();
|
||||
ui.label_3->show();
|
||||
ui.label_version->show();
|
||||
|
||||
ui.groupBox->show();
|
||||
} else {
|
||||
ui.orgloc->hide();
|
||||
ui.label_11->hide();
|
||||
ui.country->hide();
|
||||
ui.label_8->hide();
|
||||
ui.loc->hide();
|
||||
ui.label_loc->hide();
|
||||
ui.lastcontact->hide();
|
||||
ui.label_7->hide();
|
||||
ui.label_last_contact->hide();
|
||||
ui.version->hide();
|
||||
ui.label_3->hide();
|
||||
ui.label_version->hide();
|
||||
|
||||
ui.groupBox->hide();
|
||||
}
|
||||
|
|
@ -201,7 +196,7 @@ void ConfCertDialog::loadDialog()
|
|||
ui.signers->clear() ;
|
||||
for(std::list<std::string>::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) {
|
||||
RsPeerDetails signerDetail;
|
||||
if (rsPeers->getPGPDetails(*it, signerDetail)) {
|
||||
if (rsPeers->getGPGDetails(*it, signerDetail)) {
|
||||
ui.signers->append(QString::fromStdString(signerDetail.name));
|
||||
}
|
||||
}
|
||||
|
|
@ -214,7 +209,7 @@ void ConfCertDialog::applyDialog()
|
|||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(mId, detail))
|
||||
{
|
||||
if (!rsPeers->getPGPDetails(mId, detail)) {
|
||||
if (!rsPeers->getGPGDetails(mId, detail)) {
|
||||
QMessageBox::information(this,
|
||||
tr("RetroShare"),
|
||||
tr("Error : cannot get peer details."));
|
||||
|
|
@ -225,12 +220,11 @@ void ConfCertDialog::applyDialog()
|
|||
//check the GPG trustlvl
|
||||
if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != 4) {
|
||||
//trust has changed to fully
|
||||
rsPeers->TrustGPGCertificate(detail.id, 4);
|
||||
rsPeers->trustGPGCertificate(detail.id, 4);
|
||||
} else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != 3) {
|
||||
rsPeers->TrustGPGCertificate(detail.id, 3);
|
||||
|
||||
rsPeers->trustGPGCertificate(detail.id, 3);
|
||||
} else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != 2) {
|
||||
rsPeers->TrustGPGCertificate(detail.id, 2);
|
||||
rsPeers->trustGPGCertificate(detail.id, 2);
|
||||
}
|
||||
|
||||
if (!detail.isOnlyGPGdetail) {
|
||||
|
|
@ -262,6 +256,6 @@ void ConfCertDialog::applyDialog()
|
|||
|
||||
void ConfCertDialog::makeFriend()
|
||||
{
|
||||
rsPeers->SignGPGCertificate(mId);
|
||||
rsPeers->signGPGCertificate(mId);
|
||||
loadDialog();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="stabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
</property>
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
|
|
@ -52,76 +52,62 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Org / Loc:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="orgloc">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Country/State:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="country">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="label_id">
|
||||
<property name="text">
|
||||
<string>Peer ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="peerid">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_last_contact">
|
||||
<property name="text">
|
||||
<string>Last Contact</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lastcontact">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="version">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_version">
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_loc">
|
||||
<property name="text">
|
||||
<string>Loc:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="loc">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void ConnectDialog::authAttempt()
|
|||
/* well lets do it ! */
|
||||
std::cerr << "Attempting AuthCode:" << authCode << std::endl;
|
||||
//rsPeers->AuthCertificate(authId, authCode);
|
||||
rsPeers->addFriend(authId);
|
||||
rsPeers->addDummyFriend(authId);
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
|
||||
/* close it up! */
|
||||
|
|
@ -151,15 +151,20 @@ bool ConnectDialog::loadPeer(std::string id)
|
|||
|
||||
switch(detail.trustLvl)
|
||||
{
|
||||
case RS_TRUST_LVL_GOOD:
|
||||
trustString = "Good";
|
||||
case RS_TRUST_LVL_ULTIMATE:
|
||||
trustString = "Ultimate";
|
||||
break;
|
||||
case RS_TRUST_LVL_FULL:
|
||||
trustString = "Full";
|
||||
break;
|
||||
case RS_TRUST_LVL_MARGINAL:
|
||||
trustString = "Marginal";
|
||||
break;
|
||||
case RS_TRUST_LVL_UNKNOWN:
|
||||
case RS_TRUST_LVL_NONE:
|
||||
trustString = "None";
|
||||
break;
|
||||
default:
|
||||
trustString = "No Trust";
|
||||
trustString = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,16 @@
|
|||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#define SSL_ID_FIELD_CONNECT_FRIEND_WIZARD "idField"
|
||||
#define GPG_ID_FIELD_CONNECT_FRIEND_WIZARD "GPGidField"
|
||||
#define LOCATION_FIELD_CONNECT_FRIEND_WIZARD "peerLocation"
|
||||
#define CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD "peerCertString"
|
||||
#define SIGN_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD "signRadioButton"
|
||||
#define ACCEPT_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD "acceptRadioButton"
|
||||
|
||||
|
||||
|
||||
|
||||
//============================================================================
|
||||
//!
|
||||
ConnectFriendWizard::ConnectFriendWizard(QWidget *parent)
|
||||
|
|
@ -92,23 +102,40 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent)
|
|||
void
|
||||
ConnectFriendWizard::accept()
|
||||
{
|
||||
if ( hasVisitedPage(Page_Conclusion) )
|
||||
{
|
||||
std::string authId = field("idField").toString().toStdString();
|
||||
std::string authCode = field("authCode").toString().toStdString();
|
||||
if ( hasVisitedPage(Page_Conclusion) ) {
|
||||
std::cerr << "ConnectFriendWizard::accept() called with page conclusion visited" << std::endl;
|
||||
|
||||
//rsPeers->AuthCertificate(authId, authCode );
|
||||
rsPeers->addFriend(authId);
|
||||
std::string ssl_Id = field(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString();
|
||||
std::string gpg_Id = field(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString();
|
||||
bool sign = field(SIGN_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD).toBool();
|
||||
bool accept_connection = field(ACCEPT_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD).toBool();
|
||||
|
||||
//let's check if there is ip adresses in the wizard.
|
||||
if (!this->field("ext_friend_ip").isNull() && !this->field("ext_friend_port").isNull()) {
|
||||
std::cerr << "ConnectFriendWizard::accept() : setting ip ext address." << std::endl;
|
||||
rsPeers->setExtAddress(authId, this->field("ext_friend_ip").toString().toStdString(), this->field("ext_friend_port").toInt());
|
||||
}
|
||||
if (!this->field("local_friend_ip").isNull() && !this->field("local_friend_port").isNull()) {
|
||||
std::cerr << "ConnectFriendWizard::accept() : setting ip local address." << std::endl;
|
||||
rsPeers->setLocalAddress(authId, this->field("local_friend_ip").toString().toStdString(), this->field("local_friend_port").toInt());
|
||||
}
|
||||
if (gpg_Id != "") {
|
||||
if (sign) {
|
||||
std::cerr << "ConclusionPage::validatePage() signing GPG key." << std::endl;
|
||||
rsPeers->signGPGCertificate(gpg_Id); //bye default sign set accept_connection to true;
|
||||
} else if (accept_connection) {
|
||||
std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl;
|
||||
rsPeers->setAcceptToConnectGPGCertificate(gpg_Id, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (ssl_Id != "") {
|
||||
rsPeers->addFriend(ssl_Id, gpg_Id);
|
||||
//let's check if there is ip adresses in the wizard.
|
||||
if (!this->field("ext_friend_ip").isNull() && !this->field("ext_friend_port").isNull()) {
|
||||
std::cerr << "ConnectFriendWizard::accept() : setting ip ext address." << std::endl;
|
||||
rsPeers->setExtAddress(ssl_Id, this->field("ext_friend_ip").toString().toStdString(), this->field("ext_friend_port").toInt());
|
||||
}
|
||||
if (!this->field("local_friend_ip").isNull() && !this->field("local_friend_port").isNull()) {
|
||||
std::cerr << "ConnectFriendWizard::accept() : setting ip local address." << std::endl;
|
||||
rsPeers->setLocalAddress(ssl_Id, this->field("local_friend_ip").toString().toStdString(), this->field("local_friend_port").toInt());
|
||||
}
|
||||
if (!this->field("peerLocation").isNull()) {
|
||||
std::cerr << "ConnectFriendWizard::accept() : setting peerLocation." << std::endl;
|
||||
rsPeers->setLocation(ssl_Id, this->field("peerLocation").toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
|
||||
}
|
||||
|
|
@ -313,17 +340,21 @@ TextPage::copyCert()
|
|||
//============================================================================
|
||||
//
|
||||
|
||||
int
|
||||
TextPage::nextId() const
|
||||
{
|
||||
std::string id;
|
||||
std::string certstr;
|
||||
|
||||
certstr = friendCertEdit->toPlainText().toStdString();
|
||||
int TextPage::nextId() const {
|
||||
|
||||
if ( rsPeers->LoadCertificateFromString(certstr, id) )
|
||||
{
|
||||
//parse the text to get ip address
|
||||
std::string certstr;
|
||||
certstr = friendCertEdit->toPlainText().toStdString();
|
||||
RsPeerDetails pd;
|
||||
if ( rsPeers->loadDetailsFromStringCert(certstr, pd) ) {
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "ConnectFriendWizard got id : " << pd.id << "; gpg_id : " << pd.gpg_id << std::endl;
|
||||
#endif
|
||||
wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.id));
|
||||
wizard()->setField(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.gpg_id));
|
||||
wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location));
|
||||
wizard()->setField(CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(certstr));
|
||||
|
||||
//parse the text to get ip address
|
||||
try {
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "Paring cert for ip detection : " << certstr << std::endl;
|
||||
|
|
@ -369,7 +400,7 @@ TextPage::nextId() const
|
|||
parsePosition = subCert.find(";");
|
||||
std::string ext_port = subCert.substr(0, parsePosition);
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "Ext port : " << ext_port << std::endl;
|
||||
std::cerr << "Ext port : " << ext_port << std::endl;
|
||||
#endif
|
||||
|
||||
//let's store the result in the friend wizard. We will retreive it in the acept() method
|
||||
|
|
@ -383,7 +414,6 @@ TextPage::nextId() const
|
|||
} catch (...) {
|
||||
std::cerr << "ConnectFriendWizard : Parse ip address error." << std::endl;
|
||||
}
|
||||
wizard()->setField("idField", QString::fromStdString(id));
|
||||
return ConnectFriendWizard::Page_Conclusion ;
|
||||
}
|
||||
else
|
||||
|
|
@ -400,9 +430,7 @@ TextPage::nextId() const
|
|||
//============================================================================
|
||||
//============================================================================
|
||||
//
|
||||
FofPage::FofPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
FofPage::FofPage(QWidget *parent) : QWizardPage(parent) {
|
||||
_friends_signed = false ;
|
||||
QString titleStr("<span style=\"font-size:14pt; font-weight:500;" "color:#32cd32;\">%1</span>");
|
||||
setTitle( titleStr.arg( tr("Friends of friends") ) ) ;
|
||||
|
|
@ -442,35 +470,26 @@ FofPage::FofPage(QWidget *parent)
|
|||
updatePeersList(0) ;
|
||||
}
|
||||
|
||||
void FofPage::updatePeersList(int e)
|
||||
{
|
||||
void FofPage::updatePeersList(int e) {
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
std::cout << "updating peers list with e=" << e << std::endl ;
|
||||
|
||||
selectedPeersTW->clearContents() ;
|
||||
selectedPeersTW->setRowCount(0) ;
|
||||
selectedPeersTW->setRowCount(0) ;
|
||||
|
||||
std::list<std::string> ids ;
|
||||
rsPeers->getOthersList(ids) ;
|
||||
rsPeers->getGPGAllList(ids) ;
|
||||
|
||||
int row = 0 ;
|
||||
|
||||
_id_boxes.clear() ;
|
||||
std::cerr << "FofPage::updatePeersList() updating peers list with e=" << e << std::endl ;
|
||||
|
||||
// We have to use this trick because signers are given by their names instead of their ids. That's a cause
|
||||
// for some confusion when two peers have the same name.
|
||||
//
|
||||
std::set<std::string> my_friends_names ;
|
||||
|
||||
std::list<std::string> friends_ids ;
|
||||
rsPeers->getFriendList(friends_ids) ;
|
||||
|
||||
for(std::list<std::string>::const_iterator it(friends_ids.begin());it!=friends_ids.end();++it)
|
||||
my_friends_names.insert(rsPeers->getPeerName(*it)) ;
|
||||
|
||||
// Now fill in the table of selected peers.
|
||||
//
|
||||
for(std::list<std::string>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
std::list<std::string> gpg_ids;
|
||||
rsPeers->getGPGAllList(gpg_ids);
|
||||
for(std::list<std::string>::const_iterator it(gpg_ids.begin());it!=gpg_ids.end();++it)
|
||||
{
|
||||
std::cerr << "examining peer " << *it << " (name=" << rsPeers->getPeerName(*it) ;
|
||||
RsPeerDetails details ;
|
||||
|
|
@ -485,10 +504,11 @@ void FofPage::updatePeersList(int e)
|
|||
|
||||
std::set<std::string> common_friends ;
|
||||
|
||||
for(std::list<std::string>::const_iterator it2(details.gpgSigners.begin());it2!=details.gpgSigners.end();++it2)
|
||||
if(my_friends_names.find(*it2) != my_friends_names.end() && *it2 != details.name)
|
||||
common_friends.insert(*it2) ;
|
||||
|
||||
for(std::list<std::string>::const_iterator it2(details.gpgSigners.begin());it2!=details.gpgSigners.end();++it2) {
|
||||
if(rsPeers->isGPGAccepted(*it2)) {
|
||||
common_friends.insert(*it2);
|
||||
}
|
||||
}
|
||||
bool show = false;
|
||||
|
||||
switch(e)
|
||||
|
|
@ -511,13 +531,14 @@ void FofPage::updatePeersList(int e)
|
|||
default: break ;
|
||||
}
|
||||
|
||||
if(show)
|
||||
if(show)
|
||||
{
|
||||
selectedPeersTW->insertRow(row) ;
|
||||
|
||||
QCheckBox *cb = new QCheckBox ;
|
||||
cb->setChecked(true) ;
|
||||
_id_boxes[cb] = details.id ;
|
||||
_gpg_id_boxes[cb] = details.gpg_id ;
|
||||
|
||||
selectedPeersTW->setCellWidget(row,0,cb) ;
|
||||
selectedPeersTW->setItem(row,1,new QTableWidgetItem(QString::fromStdString(details.name))) ;
|
||||
|
|
@ -535,6 +556,8 @@ void FofPage::updatePeersList(int e)
|
|||
++row ;
|
||||
}
|
||||
}
|
||||
std::cerr << "FofPage::updatePeersList() finished iterating over peers" << std::endl ;
|
||||
|
||||
if(row>0)
|
||||
{
|
||||
selectedPeersTW->resizeColumnsToContents() ;
|
||||
|
|
@ -547,18 +570,15 @@ void FofPage::updatePeersList(int e)
|
|||
selectedPeersTW->setSortingEnabled(true) ;
|
||||
}
|
||||
|
||||
int FofPage::nextId() const
|
||||
{
|
||||
int FofPage::nextId() const {
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
bool FofPage::isComplete() const
|
||||
{
|
||||
bool FofPage::isComplete() const {
|
||||
return _friends_signed ;
|
||||
}
|
||||
|
||||
void FofPage::signAllSelectedUsers()
|
||||
{
|
||||
void FofPage::signAllSelectedUsers() {
|
||||
std::cerr << "makign lots of friends !!" << std::endl ;
|
||||
|
||||
for(std::map<QCheckBox*,std::string>::const_iterator it(_id_boxes.begin());it!=_id_boxes.end();++it)
|
||||
|
|
@ -566,7 +586,7 @@ void FofPage::signAllSelectedUsers()
|
|||
{
|
||||
std::cerr << "Making friend with " << it->second << std::endl ;
|
||||
//rsPeers->AuthCertificate(it->second, "");
|
||||
rsPeers->addFriend(it->second);
|
||||
rsPeers->addFriend(it->second, _gpg_id_boxes[it->first]);
|
||||
}
|
||||
|
||||
_friends_signed = true ;
|
||||
|
|
@ -584,9 +604,7 @@ void FofPage::signAllSelectedUsers()
|
|||
//============================================================================
|
||||
//============================================================================
|
||||
|
||||
CertificatePage::CertificatePage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
CertificatePage::CertificatePage(QWidget *parent) : QWizardPage(parent) {
|
||||
QString titleStr("<span style=\"font-size:14pt; font-weight:500;"
|
||||
"color:#32cd32;\">%1</span>");
|
||||
setTitle( titleStr.arg( tr("Certificate files") ) ) ;
|
||||
|
|
@ -637,9 +655,7 @@ CertificatePage::CertificatePage(QWidget *parent)
|
|||
|
||||
//============================================================================
|
||||
|
||||
void
|
||||
CertificatePage::loadFriendCert()
|
||||
{
|
||||
void CertificatePage::loadFriendCert() {
|
||||
QString fileName =
|
||||
QFileDialog::getOpenFileName(this, tr("Select Certificate"),
|
||||
"", tr("Certificates (*.pqi *.pem)"));
|
||||
|
|
@ -653,9 +669,7 @@ CertificatePage::loadFriendCert()
|
|||
|
||||
//============================================================================
|
||||
|
||||
void
|
||||
CertificatePage::generateCertificateCalled()
|
||||
{
|
||||
void CertificatePage::generateCertificateCalled() {
|
||||
qDebug() << " generateCertificateCalled";
|
||||
|
||||
QString qdir = QFileDialog::getSaveFileName(this,
|
||||
|
|
@ -663,7 +677,7 @@ CertificatePage::generateCertificateCalled()
|
|||
QDir::homePath(),
|
||||
"RetroShare Certificate (*.pqi)");
|
||||
|
||||
if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
if ( rsPeers->saveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
{
|
||||
QMessageBox::information(this, tr("RetroShare"),
|
||||
tr("Certificate file successfully created"),
|
||||
|
|
@ -679,33 +693,31 @@ CertificatePage::generateCertificateCalled()
|
|||
|
||||
//============================================================================
|
||||
|
||||
bool
|
||||
CertificatePage::isComplete() const
|
||||
{
|
||||
bool CertificatePage::isComplete() const {
|
||||
return !( (friendFileNameEdit->text()).isEmpty() );
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
int
|
||||
CertificatePage::nextId() const
|
||||
{
|
||||
int CertificatePage::nextId() const {
|
||||
std::string id;
|
||||
|
||||
QString fn = friendFileNameEdit->text();
|
||||
if (QFile::exists(fn))
|
||||
{
|
||||
std::string fnstr = fn.toStdString();
|
||||
if ( rsPeers->LoadCertificateFromFile(fnstr, id) )
|
||||
// if ( rsPeers->LoadCertificateFromFile(fnstr, id) )
|
||||
if ( false )
|
||||
{
|
||||
wizard()->setField("idField", QString::fromStdString(id));
|
||||
wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(id));
|
||||
|
||||
return ConnectFriendWizard::Page_Conclusion;
|
||||
}
|
||||
else
|
||||
{
|
||||
wizard()->setField("errorMessage",
|
||||
QString(tr("Certificate Load Failed:something is wrong with %1 ")).arg(fn) );
|
||||
// QString(tr("Certificate Load Failed:something is wrong with %1 ")).arg(fn) );
|
||||
QString(tr("Not implemented ")));
|
||||
return ConnectFriendWizard::Page_ErrorMessage;
|
||||
}
|
||||
}
|
||||
|
|
@ -752,65 +764,71 @@ int ErrorMessagePage::nextId() const
|
|||
//============================================================================
|
||||
//============================================================================
|
||||
|
||||
ConclusionPage::ConclusionPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
ConclusionPage::ConclusionPage(QWidget *parent) : QWizardPage(parent) {
|
||||
QString titleStr("<span style=\"font-size:14pt; font-weight:500;"
|
||||
"color:#32cd32;\">%1</span>");
|
||||
setTitle( titleStr.arg( tr("Make Friend") ) ) ;
|
||||
|
||||
setSubTitle(tr("Fill details about your friend here"));
|
||||
setSubTitle(tr("Details about your friend : "));
|
||||
|
||||
peerDetailsFrame = new QGroupBox;
|
||||
peerDetailsFrame->setTitle( tr("Peer details") );
|
||||
|
||||
peerDetailsLayout = new QGridLayout();
|
||||
|
||||
trustLabel = new QLabel( tr("Trust:") );
|
||||
|
||||
trustLabel = new QLabel( tr("Key validity:") );
|
||||
peerDetailsLayout->addWidget(trustLabel, 0,0,1,1);
|
||||
trustEdit = new QLineEdit();
|
||||
trustEdit = new QLabel();
|
||||
peerDetailsLayout->addWidget(trustEdit, 0,1,1,1);
|
||||
nameLabel = new QLabel( tr("Name:") );
|
||||
peerDetailsLayout->addWidget(nameLabel, 1,0,1,1);
|
||||
nameEdit = new QLineEdit();
|
||||
nameEdit = new QLabel();
|
||||
peerDetailsLayout->addWidget(nameEdit, 1,1,1,1);
|
||||
orgLabel = new QLabel( tr("Org:") );
|
||||
peerDetailsLayout->addWidget(orgLabel, 2,0,1,1);
|
||||
orgEdit = new QLineEdit();
|
||||
peerDetailsLayout->addWidget(orgEdit, 2,1,1,1);
|
||||
emailLabel = new QLabel( tr("Email:") );
|
||||
peerDetailsLayout->addWidget(emailLabel, 2,0,1,1);
|
||||
emailEdit = new QLabel();
|
||||
peerDetailsLayout->addWidget(emailEdit, 2,1,1,1);
|
||||
locLabel = new QLabel( tr("Loc:") );
|
||||
peerDetailsLayout->addWidget(locLabel, 3,0,1,1);
|
||||
locEdit = new QLineEdit();
|
||||
locEdit = new QLabel();
|
||||
peerDetailsLayout->addWidget(locEdit, 3,1,1,1);
|
||||
countryLabel = new QLabel( tr("Country:") );
|
||||
peerDetailsLayout->addWidget(countryLabel, 4,0,1,1);
|
||||
countryEdit = new QLineEdit();
|
||||
peerDetailsLayout->addWidget(countryEdit, 4,1,1,1);
|
||||
signersLabel = new QLabel( tr("Signers") );
|
||||
peerDetailsLayout->addWidget(signersLabel, 5,0,1,1);
|
||||
peerDetailsLayout->addWidget(signersLabel, 4,0,1,1);
|
||||
signersEdit = new QTextEdit();
|
||||
peerDetailsLayout->addWidget(signersEdit, 5,1,1,1);
|
||||
peerDetailsLayout->addWidget(signersEdit, 4,1,1,1);
|
||||
|
||||
peerDetailsFrame->setLayout(peerDetailsLayout);
|
||||
|
||||
authCodeLabel = new QLabel( tr("AUTH CODE") );
|
||||
authCodeEdit = new QLineEdit();
|
||||
registerField("authCode", authCodeEdit);
|
||||
|
||||
authCodeLayout = new QHBoxLayout();
|
||||
authCodeLayout->addWidget(authCodeLabel);
|
||||
authCodeLayout->addWidget(authCodeEdit);
|
||||
authCodeLayout->addStretch();
|
||||
signGPGRadioButton = new QRadioButton();
|
||||
signGPGRadioButton->setText(tr("Add as friend and Sign GPG Key"));
|
||||
registerField(SIGN_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD,signGPGRadioButton);
|
||||
acceptNoSignGPGRadioButton = new QRadioButton();
|
||||
acceptNoSignGPGRadioButton->setText(tr("Add as friend but don't sign GPG Key"));
|
||||
registerField(ACCEPT_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD,acceptNoSignGPGRadioButton);
|
||||
peerDetailsLayout->addWidget(signGPGRadioButton, 5,0,1,-1); // QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
|
||||
peerDetailsLayout->addWidget(acceptNoSignGPGRadioButton, 6,0,1,-1); // QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
|
||||
|
||||
conclusionPageLayout = new QVBoxLayout();
|
||||
conclusionPageLayout->addWidget(peerDetailsFrame);
|
||||
conclusionPageLayout->addLayout(authCodeLayout);
|
||||
|
||||
setLayout(conclusionPageLayout);
|
||||
|
||||
//registering fields for cross pages access. There maybe a cleaner solution
|
||||
peerIdEdit = new QLineEdit(this);
|
||||
peerIdEdit->setVisible(false);
|
||||
registerField("idField",peerIdEdit);
|
||||
registerField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD,peerIdEdit);
|
||||
|
||||
peerGPGIdEdit = new QLineEdit(this);
|
||||
peerGPGIdEdit->setVisible(false);
|
||||
registerField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD,peerGPGIdEdit);
|
||||
|
||||
peerLocation = new QLineEdit(this);
|
||||
peerLocation->setVisible(false);
|
||||
registerField(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD,peerLocation);
|
||||
|
||||
peerCertStringEdit = new QLineEdit(this);
|
||||
peerCertStringEdit->setVisible(false);
|
||||
registerField(CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD,peerCertStringEdit);
|
||||
|
||||
ext_friend_ip = new QLineEdit(this);
|
||||
ext_friend_ip->setVisible(false);
|
||||
|
|
@ -831,36 +849,75 @@ ConclusionPage::ConclusionPage(QWidget *parent)
|
|||
|
||||
//============================================================================
|
||||
//
|
||||
int ConclusionPage::nextId() const
|
||||
{
|
||||
int ConclusionPage::nextId() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
//============================================================================
|
||||
//
|
||||
void
|
||||
ConclusionPage::initializePage()
|
||||
{
|
||||
std::string id = field("idField").toString().toStdString();
|
||||
void ConclusionPage::initializePage() {
|
||||
std::string id = field(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString();
|
||||
std::string gpg_id = field(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString();
|
||||
std::string location = field(LOCATION_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString();
|
||||
std::string certString = field(CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString();
|
||||
std::cerr << "Conclusion page id : " << id << "; gpg_id : " << gpg_id << std::endl;
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(id, detail))
|
||||
{
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
return ;//false;
|
||||
if (!rsPeers->loadDetailsFromStringCert(certString, detail)) {
|
||||
if (!rsPeers->getPeerDetails(id, detail)) {
|
||||
if (!rsPeers->getPeerDetails(gpg_id, detail)) {
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
return ;//false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set the radio button to sign the GPG key
|
||||
if (detail.accept_connection && !detail.ownsign) {
|
||||
//gpg key connection is already accepted, don't propose to accept it again
|
||||
signGPGRadioButton->setText(tr("Peer is already a GPG key is already a retroshare friend. Sign his GPG key."));
|
||||
signGPGRadioButton->setChecked(true);
|
||||
acceptNoSignGPGRadioButton->hide();
|
||||
acceptNoSignGPGRadioButton->setChecked(false);
|
||||
}
|
||||
if (!detail.accept_connection && detail.ownsign) {
|
||||
//gpg key is already signed, don't propose to sign it again
|
||||
acceptNoSignGPGRadioButton->setText(tr("GPG key is already signed, make it a retroshare friend."));
|
||||
acceptNoSignGPGRadioButton->setChecked(true);
|
||||
signGPGRadioButton->hide();
|
||||
signGPGRadioButton->setChecked(false);
|
||||
}
|
||||
if (!detail.accept_connection && !detail.ownsign) {
|
||||
signGPGRadioButton->setText(tr("Add as friend and Sign GPG Key"));
|
||||
signGPGRadioButton->show();
|
||||
acceptNoSignGPGRadioButton->setText(tr("Add as friend but don't sign GPG Key"));
|
||||
acceptNoSignGPGRadioButton->show();
|
||||
}
|
||||
if (detail.accept_connection && detail.ownsign && !detail.isOnlyGPGdetail) {
|
||||
acceptNoSignGPGRadioButton->setChecked(false);
|
||||
acceptNoSignGPGRadioButton->hide();
|
||||
signGPGRadioButton->setChecked(false);
|
||||
signGPGRadioButton->hide();
|
||||
radioButtonsLabel = new QLabel(tr("It seems your friend is already registered. Adding it might just set it's ip address."));
|
||||
peerDetailsLayout->addWidget(radioButtonsLabel, 7,0,1,-1); // QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 )
|
||||
}
|
||||
|
||||
std::string trustString;
|
||||
|
||||
switch(detail.trustLvl)
|
||||
switch(detail.validLvl)
|
||||
{
|
||||
case RS_TRUST_LVL_GOOD:
|
||||
trustString = "Good";
|
||||
case RS_TRUST_LVL_ULTIMATE:
|
||||
trustString = "Ultimate";
|
||||
break;
|
||||
case RS_TRUST_LVL_FULL:
|
||||
trustString = "Full";
|
||||
break;
|
||||
case RS_TRUST_LVL_MARGINAL:
|
||||
trustString = "Marginal";
|
||||
break;
|
||||
case RS_TRUST_LVL_UNKNOWN:
|
||||
case RS_TRUST_LVL_NONE:
|
||||
trustString = "None";
|
||||
break;
|
||||
default:
|
||||
trustString = "No Trust";
|
||||
break;
|
||||
|
|
@ -868,8 +925,7 @@ ConclusionPage::initializePage()
|
|||
|
||||
QString ts;
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = detail.gpgSigners.begin(); it != detail.gpgSigners.end(); it++)
|
||||
{
|
||||
for(it = detail.gpgSigners.begin(); it != detail.gpgSigners.end(); it++) {
|
||||
ts.append(QString::fromStdString( rsPeers->getPeerName(*it) ));
|
||||
ts.append( "<" ) ;
|
||||
ts.append( QString::fromStdString(*it) );
|
||||
|
|
@ -879,14 +935,11 @@ ConclusionPage::initializePage()
|
|||
|
||||
nameEdit->setText( QString::fromStdString( detail.name ) ) ;
|
||||
trustEdit->setText(QString::fromStdString( trustString ) ) ;
|
||||
orgEdit->setText(QString::fromStdString( detail.org ) );
|
||||
locEdit->setText( QString::fromStdString( detail.location ) );
|
||||
countryEdit->setText( QString::fromStdString( detail.email ) );
|
||||
emailEdit->setText(QString::fromStdString( detail.email ) );
|
||||
locEdit->setText( QString::fromStdString( location ) );
|
||||
signersEdit->setPlainText( ts );
|
||||
|
||||
authCodeEdit->setText( QString::fromStdString(detail.authcode) );
|
||||
}
|
||||
//
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,8 @@ private:
|
|||
QVBoxLayout* certPageLayout;
|
||||
|
||||
bool _friends_signed ;
|
||||
std::map<QCheckBox*,std::string> _id_boxes ;
|
||||
std::map<QCheckBox*,std::string> _id_boxes ;
|
||||
std::map<QCheckBox*,std::string> _gpg_id_boxes ;
|
||||
|
||||
private slots:
|
||||
void signAllSelectedUsers() ;
|
||||
|
|
@ -203,31 +204,32 @@ private slots:
|
|||
|
||||
private:
|
||||
QGroupBox* peerDetailsFrame;
|
||||
QGridLayout* peerDetailsLayout;
|
||||
QLabel* trustLabel;
|
||||
QLineEdit* trustEdit;
|
||||
QLabel* trustEdit;
|
||||
QLabel* nameLabel;
|
||||
QLineEdit* nameEdit;
|
||||
QLabel* orgLabel;
|
||||
QLineEdit* orgEdit;
|
||||
QLabel* nameEdit;
|
||||
QLabel* emailLabel;
|
||||
QLabel* emailEdit;
|
||||
QLabel* locLabel;
|
||||
QLineEdit* locEdit;
|
||||
QLabel* countryLabel;
|
||||
QLineEdit* countryEdit;
|
||||
QLabel* locEdit;
|
||||
QLabel* signersLabel;
|
||||
QTextEdit* signersEdit;
|
||||
QGridLayout* peerDetailsLayout;
|
||||
|
||||
QLabel* authCodeLabel;
|
||||
QLineEdit* authCodeEdit;
|
||||
QHBoxLayout* authCodeLayout;
|
||||
|
||||
QLabel* radioButtonsLabel;
|
||||
QRadioButton *signGPGRadioButton;
|
||||
QRadioButton *acceptNoSignGPGRadioButton;
|
||||
|
||||
QVBoxLayout* conclusionPageLayout;
|
||||
|
||||
//! peer id
|
||||
|
||||
//! It's a hack; This widget is used only to register "id" field in the
|
||||
//! wizard. Really the widget isn't displayed.
|
||||
// //! It's a hack; This widget is used only to register "id" field in the
|
||||
// //! wizard. Really the widget isn't displayed.
|
||||
QLineEdit* peerIdEdit;
|
||||
QLineEdit* peerGPGIdEdit;
|
||||
QLineEdit* peerLocation;
|
||||
QLineEdit* peerCertStringEdit;
|
||||
QLineEdit* ext_friend_ip;
|
||||
QLineEdit* ext_friend_port;
|
||||
QLineEdit* local_friend_ip;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ bool GraphWidget::clearGraph()
|
|||
scene->setSceneRect(-200, -200, 1000, 1000);
|
||||
setScene(scene);
|
||||
|
||||
centerNode = new Node(this, 1, rsPeers->getPGPOwnId(), "You");
|
||||
centerNode = new Node(this, 1, rsPeers->getGPGOwnId(), "You");
|
||||
scene->addItem(centerNode);
|
||||
centerNode->setPos(0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ void Node::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
(ntype == ELASTIC_NODE_TYPE_FRIEND) ||
|
||||
(ntype == ELASTIC_NODE_TYPE_OWN))
|
||||
{
|
||||
rsPeers->getOthersList(ids);
|
||||
rsPeers->getFriendList(ids);
|
||||
|
||||
QAction *addAction = menu.addAction("Add All as Friends");
|
||||
QAction *rmAction = menu.addAction("Remove All as Friends");
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ void NotifyQt::UpdateGUI()
|
|||
|
||||
/* id the name */
|
||||
std::string name = rsPeers->getPeerName(id);
|
||||
std::cerr << "NotifyQT got message for peer id : " << id << "; name : " << name << std::endl;
|
||||
std::string realmsg = "<strong>" + name + "</strong>";
|
||||
switch(type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ CryptoPage::exportPublicKey()
|
|||
QDir::homePath(),
|
||||
"RetroShare Certificate (*.pqi)");
|
||||
|
||||
if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
if ( rsPeers->saveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
{
|
||||
QMessageBox::information(this, tr("RetroShare"),
|
||||
tr("Certificate file successfully created"),
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ void PeerStatus::getPeerStatus()
|
|||
int friends = ids.size();
|
||||
|
||||
ids.clear();
|
||||
rsPeers->getOthersList(ids);
|
||||
//rsPeers->getOthersList(ids);
|
||||
int others = 1 + ids.size();
|
||||
|
||||
std::ostringstream out2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue