Version: v0.8.3 (using KDE 3.1.0) Installed from: SuSE Compiler: gcc version 2.95.3 20010315 (SuSE) OS: Linux (i686) release 2.4.18-4GB At least some changes in the settings dialog are saved when clicking the cancel button.
Subject: Re: New: settings saved on click on cancel button On Tuesday 08 April 2003 12:57, you wrote: > > At least some changes in the settings dialog are saved when clicking the > cancel button. Would you mind telling us which? Thanks Carsten Pfeiffer -----BEGIN PGP SIGNATURE----- iQEVAwUBPpK8VKWgYMJuwmZtAQH9cwgAwBtdUPz3lMSx/CA3E/AosYxpF3MRUxb+ ovAyiTlIzSlLFllDxXUcbSAMZQTB23hi4S+OpWPMs2hFg64jMxrhPUtjy6n4SMMq NeJqvKecHbeeG2cB4KNFqxWq5IH//6wskdY5frfGn7FZBkQKrOrRhZSaQG66yXZ0 7PHKPTs6ne/Osd5fkV18qkTJxVlwYCfw9Cr9w793zv6TO3mNZEoO0gVL5/zpEhFv y49vpSdCoTALbv3wZ92UiTaWoHiRz7jiifZXBDzmB5YKyoG03L6MEFudJH3991eD QxjWQQWsBD5uzw86euvho4e6rRkZ8e43pBXYHShci7ihw5cmuqWmlA== =QAzz -----END PGP SIGNATURE-----
Looks as if all the settings are kept when cancelling. I played around a bit with the options in the connection tab and they are all kept. Looks like the cancel button is connected to the accept()-slot instead of reject().
CVS commit by pino: Hopefully fix bug #56997 (normal): settings saved on click on cancel button I'm going to backporting it soon. CCBUGS: 56997 M +42 -35 dlgPreferences.cpp 1.19 M +8 -4 dlgPreferences.h 1.7 --- kdenetwork/kget/dlgPreferences.cpp #1.18:1.19 @@ -59,5 +59,4 @@ DlgPreferences::DlgPreferences(QWidget * conDlg = new DlgConnection(page); topLayout->addWidget(conDlg); - connect( conDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("Automation")); @@ -66,5 +65,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(autDlg); topLayout->addStretch(); - connect( autDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("Limits")); @@ -73,5 +71,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(limDlg); topLayout->addStretch(); - connect( limDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("Advanced")); @@ -80,5 +77,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(advDlg); topLayout->addStretch(); - connect( advDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); // page = addPage(i18n("Search")); @@ -92,5 +88,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(dirDlg); topLayout->addStretch(); - connect( dirDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("System")); @@ -99,19 +94,16 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(sysDlg); topLayout->addStretch(); - connect( sysDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); // type of connection influences autoDisconnect & timedDisconnect features connect(conDlg, SIGNAL(typeChanged(int)), autDlg, SLOT(slotTypeChanged(int))); - connect(this, SIGNAL(applyClicked()), SLOT(applySettings())); + loadAllData(); - conDlg->setData(); - autDlg->setData(); - limDlg->setData(); - advDlg->setData(); - // seaDlg->setData(); - dirDlg->setData(); - sysDlg->setData(); - enableButton( Apply, false ); + connect( conDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( autDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( limDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( advDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( dirDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( sysDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); } @@ -119,26 +111,8 @@ DlgPreferences::DlgPreferences(QWidget * void DlgPreferences::slotChanged() { + changed = true; enableButton( Apply, true ); } - -void -DlgPreferences::closeEvent(QCloseEvent * e) -{ - kmain->m_paPreferences->setEnabled(true); - KDialogBase::closeEvent(e); -} - - -void DlgPreferences::done(int r) -{ - if (r != Rejected) { - applySettings(); - } - - hide(); -} - - void DlgPreferences::applySettings() { @@ -152,4 +126,37 @@ void DlgPreferences::applySettings() ksettings.save(); + changed = false; + enableButton( Apply, false ); +} + +void DlgPreferences::slotOk() +{ + if ( changed ) + applySettings(); + accept(); +} + +void DlgPreferences::slotCancel() +{ + if ( changed ) + loadAllData(); + reject(); +} + +void DlgPreferences::slotApply() +{ + applySettings(); +} + +void DlgPreferences::loadAllData() +{ + conDlg->setData(); + autDlg->setData(); + limDlg->setData(); + advDlg->setData(); + // seaDlg->setData(); + dirDlg->setData(); + sysDlg->setData(); + changed = false; enableButton( Apply, false ); } --- kdenetwork/kget/dlgPreferences.h #1.6:1.7 @@ -50,6 +50,4 @@ Q_OBJECT public: ~DlgPreferences() {} -protected: - void closeEvent(QCloseEvent *); private: @@ -64,8 +62,14 @@ private: DlgSystem *sysDlg; + bool changed; + + void loadAllData(); + protected slots: - virtual void done(int r); void applySettings(); void slotChanged(); + virtual void slotOk(); + virtual void slotCancel(); + virtual void slotApply(); };
CVS commit by pino: Backporting fix for bug #56997 (normal): settings saved on click on cancel button BUGS: 56997 M +42 -35 dlgPreferences.cpp 1.18.8.1 M +8 -4 dlgPreferences.h 1.6.8.1 --- kdenetwork/kget/dlgPreferences.cpp #1.18:1.18.8.1 @@ -59,5 +59,4 @@ DlgPreferences::DlgPreferences(QWidget * conDlg = new DlgConnection(page); topLayout->addWidget(conDlg); - connect( conDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("Automation")); @@ -66,5 +65,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(autDlg); topLayout->addStretch(); - connect( autDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("Limits")); @@ -73,5 +71,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(limDlg); topLayout->addStretch(); - connect( limDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("Advanced")); @@ -80,5 +77,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(advDlg); topLayout->addStretch(); - connect( advDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); // page = addPage(i18n("Search")); @@ -92,5 +88,4 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(dirDlg); topLayout->addStretch(); - connect( dirDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); page = addPage(i18n("System")); @@ -99,19 +94,16 @@ DlgPreferences::DlgPreferences(QWidget * topLayout->addWidget(sysDlg); topLayout->addStretch(); - connect( sysDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); // type of connection influences autoDisconnect & timedDisconnect features connect(conDlg, SIGNAL(typeChanged(int)), autDlg, SLOT(slotTypeChanged(int))); - connect(this, SIGNAL(applyClicked()), SLOT(applySettings())); + loadAllData(); - conDlg->setData(); - autDlg->setData(); - limDlg->setData(); - advDlg->setData(); - // seaDlg->setData(); - dirDlg->setData(); - sysDlg->setData(); - enableButton( Apply, false ); + connect( conDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( autDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( limDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( advDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( dirDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + connect( sysDlg, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); } @@ -119,26 +111,8 @@ DlgPreferences::DlgPreferences(QWidget * void DlgPreferences::slotChanged() { + changed = true; enableButton( Apply, true ); } - -void -DlgPreferences::closeEvent(QCloseEvent * e) -{ - kmain->m_paPreferences->setEnabled(true); - KDialogBase::closeEvent(e); -} - - -void DlgPreferences::done(int r) -{ - if (r != Rejected) { - applySettings(); - } - - hide(); -} - - void DlgPreferences::applySettings() { @@ -152,4 +126,37 @@ void DlgPreferences::applySettings() ksettings.save(); + changed = false; + enableButton( Apply, false ); +} + +void DlgPreferences::slotOk() +{ + if ( changed ) + applySettings(); + accept(); +} + +void DlgPreferences::slotCancel() +{ + if ( changed ) + loadAllData(); + reject(); +} + +void DlgPreferences::slotApply() +{ + applySettings(); +} + +void DlgPreferences::loadAllData() +{ + conDlg->setData(); + autDlg->setData(); + limDlg->setData(); + advDlg->setData(); + // seaDlg->setData(); + dirDlg->setData(); + sysDlg->setData(); + changed = false; enableButton( Apply, false ); } --- kdenetwork/kget/dlgPreferences.h #1.6:1.6.8.1 @@ -50,6 +50,4 @@ Q_OBJECT public: ~DlgPreferences() {} -protected: - void closeEvent(QCloseEvent *); private: @@ -64,8 +62,14 @@ private: DlgSystem *sysDlg; + bool changed; + + void loadAllData(); + protected slots: - virtual void done(int r); void applySettings(); void slotChanged(); + virtual void slotOk(); + virtual void slotCancel(); + virtual void slotApply(); };