diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-01 10:08:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-01 13:03:14 +0200 |
commit | 879c1c398ffdd00b7a9e9cc3cbe26e1aa263e00d (patch) | |
tree | c41e2fe73fcd16c7765afcd85e709e51e4cdb6d5 /sfx2 | |
parent | 871035d72aa0d59b42997056b16d889dd1371ce8 (diff) |
Related: tdf#108655 only write to config if values changed
Change-Id: I6ba001745638dc2b8ce091d717915e334ece4b04
Reviewed-on: https://gerrit.libreoffice.org/40623
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 83ff5337dd6e..a75aa42c86b6 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -322,11 +322,29 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc) utl::OConfigurationNode aDeckNode (aDeckRootNode.openNode(pDeckDesc->msNodeName)); - aDeckNode.setNodeValue("Title", makeAny(pDeckDesc->msTitle)); - aDeckNode.setNodeValue("OrderIndex", makeAny(pDeckDesc->mnOrderIndex)); - aDeckNode.setNodeValue("ContextList", makeAny( sContextList )); + css::uno::Any aTitle(makeAny(pDeckDesc->msTitle)); + css::uno::Any aOrder(makeAny(pDeckDesc->mnOrderIndex)); + css::uno::Any aContextList(makeAny(sContextList)); - aDeckRootNode.commit(); + bool bChanged = false; + if (aTitle != aDeckNode.getNodeValue("Title")) + { + aDeckNode.setNodeValue("Title", aTitle); + bChanged = true; + } + if (aOrder != aDeckNode.getNodeValue("OrderIndex")) + { + aDeckNode.setNodeValue("OrderIndex", aOrder); + bChanged = true; + } + if (aContextList != aDeckNode.getNodeValue("ContextList")) + { + aDeckNode.setNodeValue("ContextList", aContextList); + bChanged = true; + } + + if (bChanged) + aDeckRootNode.commit(); // save panel settings @@ -343,6 +361,7 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc) SharedPanelContainer rPanels = pDeckDesc->mpDeck->GetPanels(); + bChanged = false; for ( SharedPanelContainer::iterator iPanel(rPanels.begin()), iEnd(rPanels.end()); iPanel!=iEnd; ++iPanel) { @@ -354,14 +373,29 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc) utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(xPanelDesc->msNodeName)); - aPanelNode.setNodeValue("Title", makeAny(xPanelDesc->msTitle)); - aPanelNode.setNodeValue("OrderIndex", makeAny(xPanelDesc->mnOrderIndex)); - aPanelNode.setNodeValue("ContextList", makeAny( sPanelContextList )); + aTitle <<= xPanelDesc->msTitle; + aOrder <<= xPanelDesc->mnOrderIndex; + aContextList <<= sPanelContextList; + if (aTitle != aPanelNode.getNodeValue("Title")) + { + aPanelNode.setNodeValue("Title", aTitle); + bChanged = true; + } + if (aOrder != aPanelNode.getNodeValue("OrderIndex")) + { + aPanelNode.setNodeValue("OrderIndex", aOrder); + bChanged = true; + } + if (aContextList != aPanelNode.getNodeValue("ContextList")) + { + aPanelNode.setNodeValue("ContextList", aContextList); + bChanged = true; + } } - aPanelRootNode.commit(); - + if (bChanged) + aPanelRootNode.commit(); } void ResourceManager::ReadPanelList() |