mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Make default friend request message contain nickname
This commit is contained in:
parent
fdb86ca7e9
commit
75734c35ac
@ -21,6 +21,7 @@
|
||||
#include <QErrorMessage>
|
||||
#include <tox/tox.h>
|
||||
#include "ui_mainwindow.h"
|
||||
#include "src/nexus.h"
|
||||
#include "src/core.h"
|
||||
#include "src/misc/cdata.h"
|
||||
#include "src/toxdns.h"
|
||||
@ -37,7 +38,6 @@ AddFriendForm::AddFriendForm()
|
||||
toxIdLabel.setText(tr("Tox ID","Tox ID of the person you're sending a friend request to"));
|
||||
messageLabel.setText(tr("Message","The message you send in friend requests"));
|
||||
sendButton.setText(tr("Send friend request"));
|
||||
message.setPlaceholderText(tr("Tox me maybe?","Default message in friend requests if the field is left blank. Write something appropriate!"));
|
||||
|
||||
main->setLayout(&layout);
|
||||
layout.addWidget(&toxIdLabel);
|
||||
@ -50,6 +50,7 @@ AddFriendForm::AddFriendForm()
|
||||
headLayout.addWidget(&headLabel);
|
||||
|
||||
connect(&sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered()));
|
||||
connect(Nexus::getCore(), &Core::usernameSet, this, &AddFriendForm::onUsernameSet);
|
||||
}
|
||||
|
||||
AddFriendForm::~AddFriendForm()
|
||||
@ -81,6 +82,11 @@ void AddFriendForm::showWarning(const QString &message) const
|
||||
warning.exec();
|
||||
}
|
||||
|
||||
void AddFriendForm::onUsernameSet(const QString& username)
|
||||
{
|
||||
message.setPlaceholderText(tr("%1 here! Tox me maybe?","Default message in friend requests if the field is left blank. Write something appropriate!").arg(username));
|
||||
}
|
||||
|
||||
void AddFriendForm::onSendTriggered()
|
||||
{
|
||||
QString id = toxId.text().trimmed();
|
||||
|
@ -41,6 +41,9 @@ signals:
|
||||
protected:
|
||||
void showWarning(const QString& message) const;
|
||||
|
||||
public slots:
|
||||
void onUsernameSet(const QString& userName);
|
||||
|
||||
private slots:
|
||||
void onSendTriggered();
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "src/widget/toxuri.h"
|
||||
#include "src/toxdns.h"
|
||||
#include "src/widget/tool/friendrequestdialog.h"
|
||||
#include "src/nexus.h"
|
||||
#include "src/core.h"
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
@ -67,7 +68,7 @@ void handleToxURI(const QString &toxURI)
|
||||
}
|
||||
else
|
||||
{
|
||||
ToxURIDialog dialog(0, toxaddr, QObject::tr("Tox me maybe?","Default message in Tox URI friend requests. Write something appropriate!"));
|
||||
ToxURIDialog dialog(0, toxaddr, QObject::tr("%1 here! Tox me maybe?","Default message in Tox URI friend requests. Write something appropriate!").arg(Nexus::getCore()->getUsername()));
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
Core::getInstance()->requestFriendship(toxid, dialog.getRequestMessage());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user