diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 7a7705bb4..d1dcc1ea2 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -32,6 +32,7 @@ #include "gui/chat/ChatDialog.h" #include "gui/settings/rsharesettings.h" #include "gui/msgs/MessageComposer.h" +#include "gui/RetroShareLink.h" #include "util/QtVersion.h" #include @@ -142,7 +143,7 @@ IdDialog::IdDialog(QWidget *parent) : connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString))); connect(ui->ownOpinion_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(modifyReputation())); - connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg())); + connect(ui->inviteButton, SIGNAL(clicked()), this, SLOT(sendInvite())); ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png")); ui->headerTextLabel->setText(tr("People")); @@ -665,7 +666,7 @@ void IdDialog::insertIdDetails(uint32_t token) ui->editIdentity->setEnabled(true); ui->removeIdentity->setEnabled(true); ui->chatIdentity->setEnabled(false); - ui->messageButton->setEnabled(false); + ui->inviteButton->setEnabled(false); } else { @@ -674,7 +675,7 @@ void IdDialog::insertIdDetails(uint32_t token) ui->editIdentity->setEnabled(false); ui->removeIdentity->setEnabled(false); ui->chatIdentity->setEnabled(true); - ui->messageButton->setEnabled(true); + ui->inviteButton->setEnabled(true); } /* now fill in the reputation information */ @@ -1064,6 +1065,42 @@ void IdDialog::sendMsg() } +QString IdDialog::inviteMessage() +{ + return tr("Hi,
I want to be friends with you on RetroShare.
"); +} + +void IdDialog::sendInvite() +{ + QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); + if (!item) + { + return; + } + /* create a message */ + MessageComposer *composer = MessageComposer::newMsg(); + + composer->setTitleText(tr("You have a friend invite")); + + RsPeerId ownId = rsPeers->getOwnId(); + RetroShareLink link; + link.createCertificate(ownId); + + std::string keyId = item->text(RSID_COL_KEYID).toStdString(); + + QString sMsgText = inviteMessage(); + sMsgText += "

"; + sMsgText += tr("Respond now:") + "
"; + sMsgText += link.toHtml() + "
"; + sMsgText += "
"; + sMsgText += tr("Thanks,
") + QString::fromUtf8(rsPeers->getGPGName(rsPeers->getGPGOwnId()).c_str()); + composer->setMsgText(sMsgText); + composer->addRecipient(MessageComposer::TO, RsGxsId(keyId)); + + composer->show(); + +} + void IdDialog::banPerson() { QTreeWidgetItem *item = ui->idTreeWidget->currentItem(); diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index 9b6ba48cc..3d6101c00 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -79,6 +79,9 @@ private slots: void banPerson(); void unbanPerson(); + + static QString inviteMessage(); + void sendInvite(); private: void processSettings(bool load); diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 5528ef45f..c800c3e2c 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -305,41 +305,6 @@ - - - - - 48 - 48 - - - - - 48 - 48 - - - - Send message - - - - - - - :/images/mail-message-new.png:/images/mail-message-new.png - - - - 48 - 48 - - - - true - - - @@ -495,6 +460,13 @@ + + + + Send Invite + + +