Use sslid to add a location when accepting a friend request from the security item with a known pgp key.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6668 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-09-01 22:18:39 +00:00
parent 8239c69963
commit 4559b48a9d
5 changed files with 28 additions and 7 deletions

View file

@ -139,7 +139,7 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
} }
} }
void ConnectFriendWizard::setGpgId(const std::string &gpgId, bool friendRequest) void ConnectFriendWizard::setGpgId(const std::string &gpgId, const std::string &sslId, bool friendRequest)
{ {
if (!rsPeers->getPeerDetails(gpgId, peerDetails)) { if (!rsPeers->getPeerDetails(gpgId, peerDetails)) {
setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId))); setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId)));
@ -147,6 +147,9 @@ void ConnectFriendWizard::setGpgId(const std::string &gpgId, bool friendRequest)
return; return;
} }
/* Set ssl id when available */
peerDetails.id = sslId;
setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion); setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
} }
@ -371,7 +374,23 @@ void ConnectFriendWizard::initializePage(int id)
ui->fr_nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str())); ui->fr_nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
ui->fr_emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str())); ui->fr_emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str()));
ui->fr_locationEdit->setText(QString::fromUtf8(peerDetails.location.c_str()));
QString loc = QString::fromUtf8(peerDetails.location.c_str());
if (!loc.isEmpty())
{
loc += " (";
loc += QString::fromStdString(peerDetails.id);
loc += ")";
}
else
{
if (!peerDetails.id.empty())
{
loc += QString::fromStdString(peerDetails.id);
}
}
ui->fr_locationEdit->setText(loc);
ui->fr_label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str())); ui->fr_label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));

View file

@ -31,7 +31,7 @@ public:
~ConnectFriendWizard(); ~ConnectFriendWizard();
void setCertificate(const QString &certificate, bool friendRequest); void setCertificate(const QString &certificate, bool friendRequest);
void setGpgId(const std::string &gpgId, bool friendRequest); void setGpgId(const std::string &gpgId, const std::string &sslId, bool friendRequest);
virtual bool validateCurrentPage(); virtual bool validateCurrentPage();
virtual int nextId() const; virtual int nextId() const;

View file

@ -327,7 +327,7 @@ void SecurityItem::friendRequest()
ConnectFriendWizard *connectFriendWizard = new ConnectFriendWizard; ConnectFriendWizard *connectFriendWizard = new ConnectFriendWizard;
connectFriendWizard->setAttribute(Qt::WA_DeleteOnClose, true); connectFriendWizard->setAttribute(Qt::WA_DeleteOnClose, true);
connectFriendWizard->setGpgId(mGpgId, true); connectFriendWizard->setGpgId(mGpgId, mSslId, true);
connectFriendWizard->show(); connectFriendWizard->show();
} }

View file

@ -23,8 +23,8 @@
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
FriendRequestToaster::FriendRequestToaster(const std::string &gpgId, const QString &sslName, const std::string &/*peerId*/) FriendRequestToaster::FriendRequestToaster(const std::string &gpgId, const QString &sslName, const std::string &peerId)
: QWidget(NULL), mGpgId(gpgId) : QWidget(NULL), mGpgId(gpgId), mSslId(peerId), mSslName(sslName)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
@ -59,7 +59,7 @@ void FriendRequestToaster::friendrequestButtonSlot()
{ {
ConnectFriendWizard *connectFriendWizard = new ConnectFriendWizard; ConnectFriendWizard *connectFriendWizard = new ConnectFriendWizard;
connectFriendWizard->setAttribute(Qt::WA_DeleteOnClose, true); connectFriendWizard->setAttribute(Qt::WA_DeleteOnClose, true);
connectFriendWizard->setGpgId(mGpgId, true); connectFriendWizard->setGpgId(mGpgId, mSslId, true);
connectFriendWizard->show(); connectFriendWizard->show();
hide(); hide();

View file

@ -39,6 +39,8 @@ private slots:
private: private:
std::string mGpgId; std::string mGpgId;
std::string mSslId;
QString mSslName;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::FriendRequestToaster ui; Ui::FriendRequestToaster ui;