Bug 56997 - settings saved on click on cancel button
Summary: settings saved on click on cancel button
Status: RESOLVED FIXED
Alias: None
Product: kget
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KGet authors
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-08 12:57 UTC by Markus Pohl
Modified: 2005-03-04 23:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Pohl 2003-04-08 12:57:58 UTC
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.
Comment 1 Carsten Pfeiffer 2003-04-08 14:12:49 UTC
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-----

Comment 2 Markus Pohl 2003-04-09 00:46:24 UTC
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(). 
Comment 3 Pino Toscano 2005-03-04 21:52:15 UTC
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();
 
 };


Comment 4 Pino Toscano 2005-03-04 23:03:31 UTC
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();
 
 };