finished add a Friend with RetroShare ID in ConnectFriendWizard

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3240 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-07-01 19:04:41 +00:00
parent 6008ef5e22
commit 840f077826

View File

@ -1062,14 +1062,22 @@ bool RsidPage::isComplete() const {
int RsidPage::nextId() const { int RsidPage::nextId() const {
std::string rsidstr;
rsidstr = friendRsidEdit->text().toStdString();
QString rsidstring = friendRsidEdit->text(); QString rsidstring = friendRsidEdit->text();
if (rsidstr.empty() == false) { if (rsidstring.isEmpty() == false) {
// search for peer id in string
std::string rsidstr;
int nIndex = rsidstring.indexOf("@");
if (nIndex >= 0) {
// found "@", extract peer id from string
rsidstr = rsidstring.mid(nIndex + 1).toStdString();
} else {
// maybe its only the peer id
rsidstr = rsidstring.toStdString();
}
RsPeerDetails pd; RsPeerDetails pd;
if ( rsPeers->getPeerDetails(rsidstr, pd) ) { if ( rsPeers->getPeerDetails(rsidstr, pd) ) {
wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.id)); 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(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.gpg_id));
wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location)); wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location));
@ -1087,4 +1095,6 @@ int RsidPage::nextId() const {
return ConnectFriendWizard::Page_ErrorMessage; return ConnectFriendWizard::Page_ErrorMessage;
} }
} }
return ConnectFriendWizard::Page_Rsid;
} }