Added Send Invite Button to People Dialog.

This commit is contained in:
defnax 2015-12-24 14:31:52 +01:00
parent e3f496f3d9
commit 12c919491c
3 changed files with 50 additions and 38 deletions

View File

@ -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 <retroshare/rspeers.h>
@ -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,<br>I want to be friends with you on RetroShare.<br>");
}
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 += "<br><br>";
sMsgText += tr("Respond now:") + "<br>";
sMsgText += link.toHtml() + "<br>";
sMsgText += "<br>";
sMsgText += tr("Thanks, <br>") + 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();

View File

@ -79,6 +79,9 @@ private slots:
void banPerson();
void unbanPerson();
static QString inviteMessage();
void sendInvite();
private:
void processSettings(bool load);

View File

@ -305,41 +305,6 @@
</property>
</widget>
</item>
<item row="0" column="3" rowspan="2">
<widget class="QToolButton" name="messageButton">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolTip">
<string>Send message</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail-message-new.png</normaloff>:/images/mail-message-new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -495,6 +460,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="inviteButton">
<property name="text">
<string>Send Invite</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">