[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdebase/kcontrol/componentchooser
From: Matthias Kretz <kretz () kde ! org>
Date: 2003-09-23 18:21:35
[Download RAW message or body]
CVS commit by mkretz:
> Please don't allocate that on the heap unless you have to.
>
> KSimpleConfig cfg( latestEditedService );
> will do just fine. No malloc, no free needed.
done.
M +10 -14 componentchooser.cpp 1.23
--- kdebase/kcontrol/componentchooser/componentchooser.cpp #1.22:1.23
@@ -299,7 +299,6 @@ ComponentChooser::ComponentChooser(QWidg
for (QStringList::Iterator it=services.begin();it!=services.end();++it)
{
- KSimpleConfig *cfg=new KSimpleConfig((*it));
- ServiceChooser->insertItem(new \
MyListBoxItem(cfg->readEntry("Name",i18n("Unknown")),(*it)));
- delete cfg;
+ KSimpleConfig cfg(*it);
+ ServiceChooser->insertItem(new \
MyListBoxItem(cfg.readEntry("Name",i18n("Unknown")),(*it)));
}
@@ -318,11 +317,11 @@ void ComponentChooser::slotServiceSelect
if (KMessageBox::questionYesNo(this,i18n("<qt>You changed the \
default component of your choice, do want to save that change now ?<BR><BR>Selecting \
<B>No</B> will discard your changes</qt>"))==KMessageBox::Yes) save(); }
- KSimpleConfig *cfg=new KSimpleConfig(static_cast<MyListBoxItem*>(it)->File);
+ KSimpleConfig cfg(static_cast<MyListBoxItem*>(it)->File);
- ComponentDescription->setText(cfg->readEntry("Comment",i18n("No description \
available"))); + \
ComponentDescription->setText(cfg.readEntry("Comment",i18n("No description \
available")));
ComponentDescription->setMinimumSize(ComponentDescription->sizeHint());
- QString cfgType=cfg->readEntry("configurationType");
+ QString cfgType=cfg.readEntry("configurationType");
QWidget *newConfigWidget = 0;
if (cfgType.isEmpty() || (cfgType=="component"))
@@ -364,8 +363,7 @@ void ComponentChooser::slotServiceSelect
if (configWidget)
- static_cast<CfgPlugin*>(configWidget->qt_cast("CfgPlugin"))->load(cfg);
+ static_cast<CfgPlugin*>(configWidget->qt_cast("CfgPlugin"))->load(&cfg);
emitChanged(false);
- delete cfg;
latestEditedService=static_cast<MyListBoxItem*>(it)->File;
}
@@ -390,7 +388,6 @@ void ComponentChooser::load() {
if( plugin )
{
- KSimpleConfig *cfg=new KSimpleConfig(latestEditedService);
- plugin->load( cfg );
- delete cfg;
+ KSimpleConfig cfg(latestEditedService);
+ plugin->load( &cfg );
}
}
@@ -404,7 +401,6 @@ void ComponentChooser::save() {
if( plugin )
{
- KSimpleConfig *cfg=new KSimpleConfig(latestEditedService);
- plugin->save( cfg );
- delete cfg;
+ KSimpleConfig cfg(latestEditedService);
+ plugin->save( &cfg );
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic