1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr1272'

This commit is contained in:
tux3 2015-02-25 11:03:01 +01:00
commit 559be200ff
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
3 changed files with 12 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include <QErrorMessage> #include <QErrorMessage>
#include <tox/tox.h> #include <tox/tox.h>
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "src/nexus.h"
#include "src/core.h" #include "src/core.h"
#include "src/misc/cdata.h" #include "src/misc/cdata.h"
#include "src/toxdns.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")); 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")); messageLabel.setText(tr("Message","The message you send in friend requests"));
sendButton.setText(tr("Send friend request")); 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); main->setLayout(&layout);
layout.addWidget(&toxIdLabel); layout.addWidget(&toxIdLabel);
@ -50,6 +50,7 @@ AddFriendForm::AddFriendForm()
headLayout.addWidget(&headLabel); headLayout.addWidget(&headLabel);
connect(&sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered())); connect(&sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered()));
connect(Nexus::getCore(), &Core::usernameSet, this, &AddFriendForm::onUsernameSet);
} }
AddFriendForm::~AddFriendForm() AddFriendForm::~AddFriendForm()
@ -81,6 +82,11 @@ void AddFriendForm::showWarning(const QString &message) const
warning.exec(); 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() void AddFriendForm::onSendTriggered()
{ {
QString id = toxId.text().trimmed(); QString id = toxId.text().trimmed();

View File

@ -41,6 +41,9 @@ signals:
protected: protected:
void showWarning(const QString& message) const; void showWarning(const QString& message) const;
public slots:
void onUsernameSet(const QString& userName);
private slots: private slots:
void onSendTriggered(); void onSendTriggered();

View File

@ -18,6 +18,7 @@
#include "src/widget/toxuri.h" #include "src/widget/toxuri.h"
#include "src/toxdns.h" #include "src/toxdns.h"
#include "src/widget/tool/friendrequestdialog.h" #include "src/widget/tool/friendrequestdialog.h"
#include "src/nexus.h"
#include "src/core.h" #include "src/core.h"
#include <QByteArray> #include <QByteArray>
#include <QString> #include <QString>
@ -67,7 +68,7 @@ void handleToxURI(const QString &toxURI)
} }
else 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) if (dialog.exec() == QDialog::Accepted)
Core::getInstance()->requestFriendship(toxid, dialog.getRequestMessage()); Core::getInstance()->requestFriendship(toxid, dialog.getRequestMessage());
} }