Commit dfb41994 authored by Yuri Chornoivan's avatar Yuri Chornoivan
Browse files

Clean up the chat dialog code a bit, set the keyboard focus on the chat message field

Summary: Remove unnecessary repetition of code and focusing of "Configure..." button by default that leads to unexpected opening of the chat configuration dialog or closing the chat dialog when you press Enter in the message field.

Test Plan: Open the "Game -> Network Chat..." dialog, add some message and press Enter. Chat does not work as before (I cannot figure up why) but at least it does not open the configuration dialog and does not close either.

Reviewers: #kde_games, aacid

Reviewed By: aacid

Subscribers: aacid, kde-games-devel

Differential Revision: https://phabricator.kde.org/D25981
parent 5308aa88
......@@ -50,11 +50,10 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent)
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
okButton->setDefault(true);
okButton->setAutoDefault(false);
setModal(false);
setMinimumSize(QSize(200,200));
......@@ -68,11 +67,13 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent)
mGridLayout->addWidget(b,0,0);
QPushButton *mButton = new QPushButton(i18n("Configure..."),frame);
mButton->setAutoDefault(false);
mGridLayout->addWidget(mButton,1,1);
mainLayout->addWidget(frame);
mainLayout->addWidget(buttonBox);
adjustSize();
mChat->setFocus();
mChatDlg = new KChatDialog(mChat,frame,true);
connect(mButton, &QPushButton::clicked, mChatDlg, &KChatDialog::show);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment