mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 09:50:12 +00:00
Make the settings dialog work in the frameworks branch
The KF5 version of KPageDialog has no virtual slot "slotButtonClicked(int button)". Its kdelibs 4.x counterpart had such a slot, which was connected automatically to the corresponding signal. This slot was overriden by DolphinSettingsDialog::slotButtonClicked(int button) which was responsible for applying the changed setting and restoring the default values if the corresponding button was clicked. The lack of the buttonClicked(int) signal and the corresponding slot caused the problem that clicking a button in the settings dialog had no effect. This patch makes the functions applySettings() and restoreDefaults() functions slots, and connects them directly to the "clicked" signal of the corresponding buttons. BUG: 335709 REVIEW: 118576
This commit is contained in:
parent
c12dc996f5
commit
05c8254ee4
|
@ -53,6 +53,10 @@ DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) :
|
||||||
box->button(QDialogButtonBox::Ok)->setDefault(true);
|
box->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
setButtonBox(box);
|
setButtonBox(box);
|
||||||
|
|
||||||
|
connect(box->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings);
|
||||||
|
connect(box->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings);
|
||||||
|
connect(box->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &DolphinSettingsDialog::restoreDefaults);
|
||||||
|
|
||||||
// Startup
|
// Startup
|
||||||
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this);
|
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this);
|
||||||
KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage,
|
KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage,
|
||||||
|
@ -114,18 +118,6 @@ DolphinSettingsDialog::~DolphinSettingsDialog()
|
||||||
//saveDialogSize(dialogConfig);
|
//saveDialogSize(dialogConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinSettingsDialog::slotButtonClicked(int button)
|
|
||||||
{
|
|
||||||
if ((button == QDialogButtonBox::Ok) || (button == QDialogButtonBox::Apply)) {
|
|
||||||
applySettings();
|
|
||||||
} else if (button == QDialogButtonBox::RestoreDefaults) {
|
|
||||||
restoreDefaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma message("TODO: port")
|
|
||||||
//KPageDialog::slotButtonClicked(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DolphinSettingsDialog::enableApply()
|
void DolphinSettingsDialog::enableApply()
|
||||||
{
|
{
|
||||||
buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(true);
|
buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(true);
|
||||||
|
|
|
@ -42,15 +42,9 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
|
||||||
protected slots:
|
|
||||||
/** @see KDialog::slotButtonClicked() */
|
|
||||||
virtual void slotButtonClicked(int button);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Enables the Apply button. */
|
/** Enables the Apply button. */
|
||||||
void enableApply();
|
void enableApply();
|
||||||
|
|
||||||
private:
|
|
||||||
void applySettings();
|
void applySettings();
|
||||||
void restoreDefaults();
|
void restoreDefaults();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue