Added to display RetroShare ID on Peer Details

Added to display for each Signers Peer Name + (PeerId)
Added first basic add a Friend with RetroShare ID, not yet finished

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3239 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-06-30 21:57:46 +00:00
parent 17723df2c8
commit 6008ef5e22
4 changed files with 138 additions and 5 deletions

View File

@ -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<std::string>::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());

View File

@ -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">
@ -108,6 +108,20 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_rsid">
<property name="text">
<string>RetroShare ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="rsid">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -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("<span style=\"font-size:14pt; font-weight:500;"
"color:#32cd32;\">%1</span>");
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;
}
}
}

View File

@ -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