diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp index 804f4c298..97dc64551 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp @@ -127,8 +127,11 @@ void ConfCertDialog::loadDialog() } ui.name->setText(QString::fromStdString(detail.name)); - ui.peerid->setText(QString::fromStdString(detail.id)); + ui.peerid->setText(QString::fromStdString(detail.id)); + ui.rsid->setText(QString::fromStdString(detail.name) + "@" + QString::fromStdString(detail.id)); + 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); @@ -165,7 +168,11 @@ void ConfCertDialog::loadDialog() 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(); @@ -290,7 +297,7 @@ void ConfCertDialog::loadDialog() 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)); + ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name) + " (" + QString::fromStdString(signerDetail.id) +")"); } } } @@ -404,7 +411,7 @@ void ConfCertDialog::listWidgetContextMenuPopup( const QPoint &pos) return; QMenu menu( this ); - QAction *copyPeer = new QAction(tr("Copy Peer Name"), this ); + QAction *copyPeer = new QAction(tr("Copy Peer"), this ); connect( copyPeer , SIGNAL( triggered() ), this, SLOT( copyToClipboard() ) ); menu.addAction(copyPeer ); menu.exec(QCursor::pos()); diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.ui b/retroshare-gui/src/gui/connect/ConfCertDialog.ui index f3b98edb2..adbc35825 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.ui +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.ui @@ -21,7 +21,7 @@ - 1 + 0 @@ -108,6 +108,20 @@ + + + + RetroShare ID + + + + + + + true + + + diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp index e11855d06..d9182f83d 100755 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp @@ -73,6 +73,8 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) setPage(Page_Text, new TextPage); setPage(Page_Cert, new CertificatePage); setPage(Page_Foff, new FofPage); + setPage(Page_Rsid, new RsidPage); + setPage(Page_ErrorMessage, new ErrorMessagePage); setPage(Page_Conclusion, new ConclusionPage); @@ -168,12 +170,14 @@ IntroPage::IntroPage(QWidget *parent) textRadioButton = new QRadioButton(tr("&Enter the certificate manually")); certRadioButton = new QRadioButton(tr("&You get a certificate file from your friend" )); foffRadioButton = new QRadioButton(tr("&Make friend with selected friends of my friends" )); + rsidRadioButton = new QRadioButton(tr("&Enter RetroShare ID manually" )); textRadioButton->setChecked(true); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(textRadioButton); layout->addWidget(certRadioButton); layout->addWidget(foffRadioButton); + layout->addWidget(rsidRadioButton); setLayout(layout); } // @@ -184,6 +188,7 @@ int IntroPage::nextId() const if (textRadioButton->isChecked()) return ConnectFriendWizard::Page_Text; if (certRadioButton->isChecked()) return ConnectFriendWizard::Page_Cert; if (foffRadioButton->isChecked()) return ConnectFriendWizard::Page_Foff; + if (rsidRadioButton->isChecked()) return ConnectFriendWizard::Page_Rsid; return ConnectFriendWizard::Page_Foff; } @@ -1008,3 +1013,78 @@ void ConclusionPage::initializePage() { //============================================================================ // + +// +//============================================================================ +//============================================================================ +//============================================================================ + +RsidPage::RsidPage(QWidget *parent) : QWizardPage(parent) { + QString titleStr("%1"); + setTitle( titleStr.arg( tr("RetroShare ID") ) ) ; + + setSubTitle(tr("Use RetroShare ID for adding a Friend which is available in your network.")); + + + setAcceptDrops(true); + + userRsidLayout = new QHBoxLayout; + + userRsidFrame = new QGroupBox; + userRsidFrame->setFlat(true); + userRsidFrame->setTitle(tr("Add Friends RetroShare ID...")); + userRsidFrame->setLayout(userRsidLayout); + + friendRsidLabel = new QLabel(tr("Paste Friends RetroShare ID " + "in the box below " ) ); + friendRsidEdit = new QLineEdit; + registerField("friendRSID*", friendRsidEdit); + + + friendRSIDLayout = new QHBoxLayout; + friendRSIDLayout->addWidget(friendRsidEdit) ; + + RsidLayout = new QVBoxLayout; + RsidLayout->addWidget(userRsidFrame); + RsidLayout->addWidget(friendRsidLabel); + RsidLayout->addLayout(friendRSIDLayout); + + setLayout(RsidLayout); +} + + +//============================================================================ + +bool RsidPage::isComplete() const { + return !( (friendRsidEdit->text()).isEmpty() ); +} + +int RsidPage::nextId() const { + + std::string rsidstr; + rsidstr = friendRsidEdit->text().toStdString(); + QString rsidstring = friendRsidEdit->text(); + + if (rsidstr.empty() == false) { + RsPeerDetails pd; + if ( rsPeers->getPeerDetails(rsidstr, pd) ) { + + 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)); + + wizard()->setField("ext_friend_ip", QString::fromStdString(pd.extAddr)); + wizard()->setField("ext_friend_port", QString::number(pd.extPort)); + wizard()->setField("local_friend_ip", QString::fromStdString(pd.localAddr)); + wizard()->setField("local_friend_port", QString::number(pd.localPort)); + wizard()->setField("dyndns", QString::fromStdString(pd.dyndns)); + + return ConnectFriendWizard::Page_Conclusion ; + } else { + wizard()->setField("errorMessage", QString(tr("This Peer %1 is not available in your Network")).arg(rsidstring) ); + return ConnectFriendWizard::Page_ErrorMessage; + } + } +} diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.h b/retroshare-gui/src/gui/connect/ConnectFriendWizard.h index 08aadcb60..4f2767c6e 100755 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.h +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.h @@ -34,7 +34,7 @@ class ConnectFriendWizard : public QWizard public: - enum { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion,Page_Foff }; + enum { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion,Page_Foff, Page_Rsid }; ConnectFriendWizard(QWidget *parent = 0); @@ -60,6 +60,7 @@ private: QRadioButton *textRadioButton; QRadioButton *certRadioButton; QRadioButton *foffRadioButton; + QRadioButton *rsidRadioButton; }; //============================================================================ @@ -245,5 +246,36 @@ private: }; //============================================================================ +//! A page for exchanging RSID , for "Add friend" wizard. +class RsidPage : public QWizardPage +{ + Q_OBJECT + +public: + RsidPage(QWidget *parent = 0); + + int nextId() const; + bool isComplete() const ; + + +private: + QGroupBox* userRsidFrame; + QLabel *userFileLabel; + QHBoxLayout* userRsidLayout; + + QLabel* friendRsidLabel; + QLineEdit *friendRsidEdit; + QHBoxLayout* friendRSIDLayout; + + QVBoxLayout* RsidLayout; + +private slots: + + + +}; + +//============================================================================ + #endif