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:
parent 5308aa88
...@@ -50,11 +50,10 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent) ...@@ -50,11 +50,10 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent)
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout); setLayout(mainLayout);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return); okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
okButton->setDefault(true); okButton->setAutoDefault(false);
setModal(false); setModal(false);
setMinimumSize(QSize(200,200)); setMinimumSize(QSize(200,200));
...@@ -68,11 +67,13 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent) ...@@ -68,11 +67,13 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent)
mGridLayout->addWidget(b,0,0); mGridLayout->addWidget(b,0,0);
QPushButton *mButton = new QPushButton(i18n("Configure..."),frame); QPushButton *mButton = new QPushButton(i18n("Configure..."),frame);
mGridLayout->addWidget(mButton,1,1); mGridLayout->addWidget(mButton,1,1);
mainLayout->addWidget(frame); mainLayout->addWidget(frame);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
adjustSize(); adjustSize();
mChatDlg = new KChatDialog(mChat,frame,true); mChatDlg = new KChatDialog(mChat,frame,true);
connect(mButton, &QPushButton::clicked, mChatDlg, &KChatDialog::show); 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