Commit 1c3dd8c2 authored by Christian Loose's avatar Christian Loose
Browse files

* don't leak KConfig objects

* open cvs DCOP service configuration only once

svn path=/trunk/kdesdk/cervisia/; revision=196225
parent 9b6075a9
......@@ -64,6 +64,9 @@ SettingsDialog::SettingsDialog( KConfig *conf, QWidget *parent, const char *name
{
config = conf;
// open cvs DCOP service configuration file
mServiceConfig = new KConfig("cvsservicerc");
//
// General Options
//
......@@ -222,14 +225,17 @@ SettingsDialog::SettingsDialog( KConfig *conf, QWidget *parent, const char *name
setHelp("customization", "cervisia");
}
SettingsDialog::~SettingsDialog()
{
delete mServiceConfig;
}
void SettingsDialog::readSettings()
{
// read entries from cvs DCOP service configuration
KConfig* serviceConf = new KConfig("cvsservicerc");
serviceConf->setGroup("General");
cvspathedit->setText(serviceConf->readEntry("CVSPath", "cvs"));
compressioncombo->setCurrentItem(serviceConf->readNumEntry("Compression", 0));
mServiceConfig->setGroup("General");
cvspathedit->setText(mServiceConfig->readEntry("CVSPath", "cvs"));
compressioncombo->setCurrentItem(mServiceConfig->readNumEntry("Compression", 0));
config->setGroup("General");
timeoutedit->setValue((int)config->readUnsignedNumEntry("Timeout", 4000));
......@@ -269,13 +275,12 @@ void SettingsDialog::readSettings()
void SettingsDialog::writeSettings()
{
// write entries to cvs DCOP service configuration
KConfig* serviceConf = new KConfig("cvsservicerc");
serviceConf->setGroup("General");
serviceConf->writeEntry("CVSPath", cvspathedit->text());
serviceConf->writeEntry("Compression", compressioncombo->currentItem());
mServiceConfig->setGroup("General");
mServiceConfig->writeEntry("CVSPath", cvspathedit->text());
mServiceConfig->writeEntry("Compression", compressioncombo->currentItem());
// write to disk so other services can reparse the configuration
serviceConf->sync();
mServiceConfig->sync();
config->setGroup("General");
config->writeEntry("Timeout", (unsigned)timeoutedit->value());
......@@ -330,7 +335,7 @@ void SettingsDialog::done(int res)
if (res == Accepted)
writeSettings();
QDialog::done(res);
KDialogBase::done(res);
delete this;
}
......
......@@ -47,6 +47,7 @@ class SettingsDialog : public KDialogBase
public:
SettingsDialog( KConfig *conf, QWidget *parent=0, const char *name=0 );
virtual ~SettingsDialog();
protected slots:
virtual void done(int res);
......@@ -82,6 +83,8 @@ private:
KColorButton *diffchangebutton;
KColorButton *diffinsertbutton;
KColorButton *diffdeletebutton;
KConfig* mServiceConfig;
};
#endif
......
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