Browse Source

Merge branch 'pr1480'

Conflicts:
	src/widget/form/addfriendform.cpp
pull/1418/head
Dubslow 10 years ago
parent
commit
72e78ff6cd
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
  1. 12
      src/widget/form/addfriendform.cpp
  2. 1
      src/widget/form/addfriendform.h

12
src/widget/form/addfriendform.cpp

@ -19,6 +19,7 @@ @@ -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) @@ -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 @@ -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);
}
}

1
src/widget/form/addfriendform.h

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

Loading…
Cancel
Save