More reliable button click detection for add client dialog (#7427)
* Use more reliable method to detect button clicks on add client dialog * Use pointer to const * Remove redundant tr * Update ChangeLog
This commit is contained in:
parent
f1f7266a81
commit
228ead39fb
2 changed files with 14 additions and 5 deletions
|
|
@ -70,6 +70,7 @@ Enhancements:
|
|||
- #7424 Add Alma Linux and Rocky Linux runners
|
||||
- #7425 Refactored core process management and IPC client
|
||||
- #7426 Fixed warnings and enable errors as warnings
|
||||
- #7427 More reliable button click detection for add client dialog
|
||||
|
||||
# 1.14.6
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "gui/config/AppConfig.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace synergy::gui {
|
||||
|
||||
|
|
@ -75,15 +76,22 @@ void ServerConnection::addClient(const QString &clientName) {
|
|||
}
|
||||
|
||||
QMessageBox message(&m_parent);
|
||||
message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
|
||||
message.addButton(QObject::tr("Add client"), QMessageBox::AcceptRole);
|
||||
const QPushButton *ignore =
|
||||
message.addButton("Ignore", QMessageBox::RejectRole);
|
||||
const QPushButton *add =
|
||||
message.addButton("Add client", QMessageBox::AcceptRole);
|
||||
message.setText(
|
||||
QObject::tr("Client with name '%1' wants to connect").arg(clientName));
|
||||
QString("A new client called '%1' wants to connect").arg(clientName));
|
||||
message.exec();
|
||||
|
||||
if (message.exec() == QMessageBox::Accepted) {
|
||||
if (message.clickedButton() == add) {
|
||||
qDebug("accepted dialog, adding client: %s", qPrintable(clientName));
|
||||
emit configureClient(clientName);
|
||||
} else {
|
||||
} else if (message.clickedButton() == ignore) {
|
||||
qDebug("declined dialog, ignoring client: %s", qPrintable(clientName));
|
||||
m_ignoredClients.append(clientName);
|
||||
} else {
|
||||
qFatal("no expected dialog button was clicked");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue