Skip to content

Commit 5f84964

Browse files
committed
Fixed cppcheck-opensource#4357: Wrongly configured slot caused Ok() handler being not called.
1 parent 29263e6 commit 5f84964

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

gui/applicationdialog.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ApplicationDialog::ApplicationDialog(const QString &title,
3434
mUI.setupUi(this);
3535

3636
connect(mUI.mButtonBrowse, SIGNAL(clicked()), this, SLOT(Browse()));
37-
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
37+
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(Ok()));
3838
connect(mUI.mButtons, SIGNAL(rejected()), this, SLOT(reject()));
3939
mUI.mPath->setText(app.getPath());
4040
mUI.mName->setText(app.getName());
@@ -70,21 +70,22 @@ void ApplicationDialog::Browse()
7070

7171
void ApplicationDialog::Ok()
7272
{
73-
if (mUI.mName->text().isEmpty() || mUI.mPath->text().isEmpty() ||
74-
mUI.mParameters->text().isEmpty()) {
73+
if (mUI.mName->text().isEmpty() || mUI.mPath->text().isEmpty()) {
7574
QMessageBox msg(QMessageBox::Warning,
7675
tr("Cppcheck"),
77-
tr("You must specify a name, a path and parameters for the application!"),
76+
tr("You must specify a name, a path and optionally parameters for the application!"),
7877
QMessageBox::Ok,
7978
this);
8079

8180
msg.exec();
8281

82+
reject();
8383
} else {
8484
// Convert possible native (Windows) path to internal presentation format
8585
mApplication.setName(mUI.mName->text());
8686
mApplication.setPath(QDir::fromNativeSeparators(mUI.mPath->text()));
8787
mApplication.setParameters(mUI.mParameters->text());
88+
8889
accept();
8990
}
9091
}

0 commit comments

Comments
 (0)