File r899959.diff of Package kdepim4
Subject: kresources: Write subresource state changes immediately
From: wstephenson@suse.de
Bug: kolab#3314
Patch-upstream: 899959
--- kresources/kolab/kabc/resourcekolab.cpp (revision 899958)
+++ kresources/kolab/kabc/resourcekolab.cpp (revision 899959)
@@ -134,14 +134,7 @@ bool KABC::ResourceKolab::doOpen()
void KABC::ResourceKolab::doClose()
{
- KConfig config( configFile() );
-
- Kolab::ResourceMap::ConstIterator it;
- for ( it = mSubResources.begin(); it != mSubResources.end(); ++it ) {
- KConfigGroup group = config.group( it.key() );
- group.writeEntry( "Active", it.value().active() );
- group.writeEntry( "CompletionWeight", it.value().completionWeight() );
- }
+ writeConfig();
}
KABC::Ticket * KABC::ResourceKolab::requestSaveTicket()
@@ -671,6 +664,7 @@ void KABC::ResourceKolab::setSubresource
} else {
kDebug(5650) <<"setSubresourceCompletionWeight: subresource" << subresource <<" not found";
}
+ writeConfig();
}
@@ -686,4 +680,16 @@ bool KABC::ResourceKolab::removeSubresou
return kmailRemoveSubresource( id );
}
+void KABC::ResourceKolab::writeConfig()
+{
+ KConfig config( configFile() );
+
+ Kolab::ResourceMap::ConstIterator it;
+ for ( it = mSubResources.constBegin(); it != mSubResources.constEnd(); ++it ) {
+ KConfigGroup group = config.group( it.key() );
+ group.writeEntry( "Active", it.value().active() );
+ group.writeEntry( "CompletionWeight", it.value().completionWeight() );
+ }
+}
+
#include "resourcekolab.moc"
--- kresources/kolab/kabc/resourcekolab.h (revision 899958)
+++ kresources/kolab/kabc/resourcekolab.h (revision 899959)
@@ -163,6 +163,9 @@ protected:
return Kolab::ResourceKolabBase::configFile( "kabc" );
}
+ using KABC::Resource::writeConfig;
+ void writeConfig();
+
// The list of subresources
Kolab::ResourceMap mSubResources;
QString mCachedSubresource;
Index: kresources/kolab/kabc/resourcekolab.cpp
===================================================================
Index: kresources/kolab/kabc/resourcekolab.h
===================================================================