Commit c44b68ff authored by Kevin Funk's avatar Kevin Funk Committed by Laurent Montel
Browse files

followup: Do provide just a "Close" action

We are already confirming deleting entries in the list. Previously we
had to additionally press "Apply" to save these changes. This doesn't
make sense.

Just provide a "Close" button to close the dialog and save the changes
whenever we close the dialog.
parent 816c924b
......@@ -43,11 +43,10 @@ FollowUpReminderNoAnswerDialog::FollowUpReminderNoAnswerDialog(QWidget *parent)
mWidget->setObjectName(QStringLiteral("FollowUpReminderInfoWidget"));
mainLayout->addWidget(mWidget);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &FollowUpReminderNoAnswerDialog::slotSave);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
closeButton->setDefault(true);
closeButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::rejected, this, &FollowUpReminderNoAnswerDialog::reject);
mainLayout->addWidget(buttonBox);
......@@ -128,5 +127,16 @@ void FollowUpReminderNoAnswerDialog::slotSave()
if (mWidget->save()) {
Q_EMIT needToReparseConfiguration();
}
accept();
}
void FollowUpReminderNoAnswerDialog::reject()
{
slotSave();
QDialog::reject();
}
void FollowUpReminderNoAnswerDialog::closeEvent(QCloseEvent *event)
{
slotSave();
QDialog::closeEvent(event);
}
......@@ -22,9 +22,16 @@ public:
void setInfo(const QList<FollowUpReminder::FollowUpReminderInfo *> &info);
void wakeUp();
public Q_SLOTS:
void reject() override;
Q_SIGNALS:
void needToReparseConfiguration();
protected:
void closeEvent(QCloseEvent *) override;
private:
void slotDBusNotificationsPropertiesChanged(const QString &interface, const QVariantMap &changedProperties, const QStringList &invalidatedProperties);
void slotSave();
......
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