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

Merge branch 'pr1480'

Conflicts:
	src/widget/form/addfriendform.cpp
This commit is contained in:
Dubslow 2015-03-27 17:36:08 -05:00
commit 72e78ff6cd
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
2 changed files with 13 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <QFont>
#include <QMessageBox>
#include <QErrorMessage>
#include <QClipboard>
#include <tox/tox.h>
#include "ui_mainwindow.h"
#include "src/nexus.h"
@ -67,6 +68,7 @@ void AddFriendForm::show(Ui::MainWindow &ui)
ui.mainHead->layout()->addWidget(head);
main->show();
head->show();
setIdFromClipboard();
toxId.setFocus();
}
@ -116,3 +118,13 @@ Ignore the proxy and connect to the Internet directly?"), QMessageBox::Yes|QMess
this->message.clear();
}
}
void AddFriendForm::setIdFromClipboard()
{
QClipboard* clipboard = QApplication::clipboard();
QString id = clipboard->text().trimmed();
if (Core::getInstance()->isReady() && !id.isEmpty() && ToxID::isToxId(id)) {
if (!ToxID::fromString(id).isMine())
toxId.setText(id);
}
}

View File

@ -45,6 +45,7 @@ private slots:
void onSendTriggered();
private:
void setIdFromClipboard();
QLabel headLabel, toxIdLabel, messageLabel;
QPushButton sendButton;
QLineEdit toxId;