From 136e5f3de730f11eba7be8b1d4b1f04e9f36d3c5 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Wed, 23 May 2012 21:19:13 -0400 Subject: [PATCH] desktop: fixed Evolution config writing, setting enabled only if URL is present Combined with the previous feature, it is now possible to only configure one object type in the Evolution settings dialog, and have the sync work correctly, disabling the type that is not fully configured yet. --- desktop/src/osconv22.cc | 14 ++++++++------ desktop/src/osconv40.cc | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/desktop/src/osconv22.cc b/desktop/src/osconv22.cc index 965e862b..d9005b35 100644 --- a/desktop/src/osconv22.cc +++ b/desktop/src/osconv22.cc @@ -320,12 +320,14 @@ void Converter22::Save(const Config::Evolution &config, throw Config::SaveError("Cannot save a plugin with a member_id of -1"); ostringstream oss; - oss << "\n" - << " " << config.GetAddressPath() << "\n" - << " " << config.GetCalendarPath() << "\n" - << " " << config.GetTasksPath() << "\n" - << "" - << endl; + oss << "\n"; + if( config.GetAddressPath().size() ) + oss << " " << config.GetAddressPath() << "\n"; + if( config.GetCalendarPath().size() ) + oss << " " << config.GetCalendarPath() << "\n"; + if( config.GetTasksPath().size() ) + oss << " " << config.GetTasksPath() << "\n"; + oss << "" << endl; m_api.SetConfiguration(group_name, config.GetMemberId(), oss.str()); } diff --git a/desktop/src/osconv40.cc b/desktop/src/osconv40.cc index 6c87246c..e886a104 100644 --- a/desktop/src/osconv40.cc +++ b/desktop/src/osconv40.cc @@ -308,23 +308,23 @@ void Converter40::Save(const Config::Evolution &config, const std::string &group OS40PluginConfig cfg = m_api.GetConfigurationObj(group_name, config.GetMemberId()); cfg.GetResource("contact")-> - Enable(true). + Enable(config.GetAddressPath().size()). SetObjFormat("vcard21", "VCARD_EXTENSION=Evolution"). SetObjFormat("vcard30", "VCARD_EXTENSION=Evolution"). SetUrl(config.GetAddressPath()). AddResource(); cfg.GetResource("event")-> - Enable(true). + Enable(config.GetCalendarPath().size()). SetObjFormat("vevent20"). SetUrl(config.GetCalendarPath()). AddResource(); cfg.GetResource("todo")-> - Enable(true). + Enable(config.GetTasksPath().size()). SetObjFormat("vtodo20"). SetUrl(config.GetTasksPath()). AddResource(); cfg.GetResource("note")-> - Enable(true). + Enable(config.GetMemosPath().size()). SetObjFormat("vjournal"). SetUrl(config.GetMemosPath()). AddResource(); -- 2.11.4.GIT