kconfig deprecated stuff cleanup continued

svn path=/trunk/KDE/kdebase/workspace/; revision=704275
icc-effect-5.14.5
Mickael Marchand 2007-08-24 14:33:03 +00:00
parent 89467f4afc
commit 2d2fdb6675
2 changed files with 12 additions and 15 deletions

View File

@ -29,10 +29,10 @@ int main( int argc, char* argv[] )
} }
KConfig src_cfg( file ); KConfig src_cfg( file );
KConfig dest_cfg( "kwinrulesrc" ); KConfig dest_cfg( "kwinrulesrc" );
src_cfg.setGroup( "General" ); KConfigGroup scg(&src_cfg, "General");
dest_cfg.setGroup( "General" ); KConfigGroup dcg(&dest_cfg, "General");
int count = src_cfg.readEntry( "count", 0 ); int count = scg.readEntry( "count", 0 );
int pos = dest_cfg.readEntry( "count", 0 ); int pos = dcg.readEntry( "count", 0 );
for( int group = 1; for( int group = 1;
group <= count; group <= count;
++group ) ++group )
@ -40,16 +40,15 @@ int main( int argc, char* argv[] )
QMap< QString, QString > entries = src_cfg.entryMap( QString::number( group )); QMap< QString, QString > entries = src_cfg.entryMap( QString::number( group ));
++pos; ++pos;
dest_cfg.deleteGroup( QString::number( pos )); dest_cfg.deleteGroup( QString::number( pos ));
dest_cfg.setGroup( QString::number( pos )); KConfigGroup dcg2 (&dest_cfg, QString::number( pos ));
for( QMap< QString, QString >::ConstIterator it = entries.begin(); for( QMap< QString, QString >::ConstIterator it = entries.begin();
it != entries.end(); it != entries.end();
++it ) ++it )
dest_cfg.writeEntry( it.key(), *it ); dcg2.writeEntry( it.key(), *it );
} }
dest_cfg.setGroup( "General" ); dcg.writeEntry( "count", pos );
dest_cfg.writeEntry( "count", pos ); scg.sync();
src_cfg.sync(); dcg.sync();
dest_cfg.sync();
// Send signal to all kwin instances // Send signal to all kwin instances
QDBusMessage message = QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");

View File

@ -101,8 +101,8 @@ void loadFakeSessionInfo( KConfig* config )
void writeRules( KConfig& cfg ) void writeRules( KConfig& cfg )
{ {
cfg.setGroup( "General" ); KConfigGroup cg(&cfg, "General");
int pos = cfg.readEntry( "count",0 ); int pos = cg.readEntry( "count",0 );
QList<SessionInfo*>::iterator it; QList<SessionInfo*>::iterator it;
for ( it = fakeSession.begin(); it != fakeSession.end(); ++it) for ( it = fakeSession.begin(); it != fakeSession.end(); ++it)
@ -110,7 +110,6 @@ void writeRules( KConfig& cfg )
if( (*it)->resourceName.isEmpty() && (*it)->resourceClass.isEmpty()) if( (*it)->resourceName.isEmpty() && (*it)->resourceClass.isEmpty())
continue; continue;
++pos; ++pos;
cfg.setGroup( QString::number( pos ));
KConfigGroup groupCfg(&cfg, QString::number( pos )); KConfigGroup groupCfg(&cfg, QString::number( pos ));
groupCfg.writeEntry( "description", ( const char* ) ( (*it)->resourceClass + " (KDE3.2)" )); groupCfg.writeEntry( "description", ( const char* ) ( (*it)->resourceClass + " (KDE3.2)" ));
groupCfg.writeEntry( "wmclass", ( const char* )( (*it)->resourceName + ' ' + (*it)->resourceClass )); groupCfg.writeEntry( "wmclass", ( const char* )( (*it)->resourceName + ' ' + (*it)->resourceClass ));
@ -154,8 +153,7 @@ void writeRules( KConfig& cfg )
groupCfg.writeEntry( "noborder", (*it)->userNoBorder ); groupCfg.writeEntry( "noborder", (*it)->userNoBorder );
groupCfg.writeEntry( "noborderrule", 4 ); groupCfg.writeEntry( "noborderrule", 4 );
} }
cfg.setGroup( "General" ); cg.writeEntry( "count", pos );
cfg.writeEntry( "count", pos );
} }
int main() int main()