[Libreoffice-commits] core.git: desktop/source officecfg/registry

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Jun 21 23:00:14 UTC 2017


 desktop/source/app/app.cxx                                 |   44 +++++++++++++
 desktop/source/app/updater.cxx                             |    5 +
 officecfg/registry/schema/org/openoffice/Office/Update.xcs |   19 +++++
 3 files changed, 68 insertions(+)

New commits:
commit b3b2a752b71070fb58619d0a12d1f2b1017a26ef
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jun 21 20:18:34 2017 +0200

    updater: handle the SeeAlso property after the update succeeded
    
    Change-Id: Ib90f1f7def6de05144bf8215a97a6d6e15207b88
    Reviewed-on: https://gerrit.libreoffice.org/39073
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 1a765eaa884f..0e7f37fe0c48 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -75,6 +75,8 @@
 #include <com/sun/star/ui/theUIElementFactoryManager.hpp>
 #include <com/sun/star/ui/theWindowStateConfiguration.hpp>
 #include <com/sun/star/office/Quickstart.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
 
 #include <desktop/exithelper.h>
 #include <sal/log.hxx>
@@ -1465,6 +1467,41 @@ int Desktop::Main()
 #if HAVE_FEATURE_UPDATE_MAR
         if (officecfg::Office::Update::Update::Enabled::get())
         {
+            // check if we just updated
+            bool bUpdateRunning = officecfg::Office::Update::Update::UpdateRunning::get();
+            if (bUpdateRunning)
+            {
+                OUString aSeeAlso = officecfg::Office::Update::Update::SeeAlso::get();
+                OUString aOldBuildID = officecfg::Office::Update::Update::OldBuildID::get();
+
+                OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":buildid}");
+                rtl::Bootstrap::expandMacros(aBuildID);
+                if (aOldBuildID == aBuildID)
+                {
+                    SAL_INFO("desktop", "failed updater");
+                }
+                else
+                {
+                    if (!aSeeAlso.isEmpty())
+                    {
+                        SAL_INFO("desktop", "See also: " << aSeeAlso);
+                                Reference< css::system::XSystemShellExecute > xSystemShell(
+                        SystemShellExecute::create(::comphelper::getProcessComponentContext()) );
+
+                        xSystemShell->execute( aSeeAlso, OUString(), SystemShellExecuteFlags::URIS_ONLY );
+                    }
+                }
+
+                // reset all the configuration values,
+                // all values need to be read before this code
+                std::shared_ptr< comphelper::ConfigurationChanges > batch(
+                        comphelper::ConfigurationChanges::create());
+                officecfg::Office::Update::Update::UpdateRunning::set(false, batch);
+                officecfg::Office::Update::Update::SeeAlso::set(OUString(), batch);
+                officecfg::Office::Update::Update::OldBuildID::set(OUString(), batch);
+                batch->commit();
+            }
+
             osl::DirectoryItem aPatchInfo;
             osl::DirectoryItem::get(Updater::getUpdateInfoURL(), aPatchInfo);
             osl::DirectoryItem aDirectoryItem;
@@ -1472,6 +1509,13 @@ int Desktop::Main()
 
             if (aPatchInfo.is() && aDirectoryItem.is())
             {
+                OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":buildid}");
+                rtl::Bootstrap::expandMacros(aBuildID);
+                std::shared_ptr< comphelper::ConfigurationChanges > batch(
+                        comphelper::ConfigurationChanges::create());
+                officecfg::Office::Update::Update::OldBuildID::set(aBuildID, batch);
+                officecfg::Office::Update::Update::UpdateRunning::set(true, batch);
+                batch->commit();
                 update();
             }
             else if (isTimeForUpdateCheck())
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 468c94b4e74c..1d2b7585321c 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -694,6 +694,11 @@ void update_checker()
                     }
                 }
                 CreateValidUpdateDir(aUpdateInfo);
+                OUString aSeeAlsoURL = aUpdateInfo.aSeeAlsoURL;
+                std::shared_ptr< comphelper::ConfigurationChanges > batch(
+                        comphelper::ConfigurationChanges::create());
+                officecfg::Office::Update::Update::SeeAlso::set(aSeeAlsoURL, batch);
+                batch->commit();
             }
         }
     }
diff --git a/officecfg/registry/schema/org/openoffice/Office/Update.xcs b/officecfg/registry/schema/org/openoffice/Office/Update.xcs
index 5ad40022e3e5..16f57bc8a986 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Update.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Update.xcs
@@ -47,6 +47,25 @@
             </info>
             <value>daily-master-gandalf</value>
         </prop>
+        <prop oor:name="UpdateRunning" oor:type="xs:boolean" oor:nillable="false">
+            <info>
+                <desc>Determines if we are currently in an update process.
+                    Needs to be reset after the update has been applied</desc>
+            </info>
+            <value>false</value>
+        </prop>
+        <prop oor:name="OldBuildID" oor:type="xs:string" oor:nillable="false">
+            <info>
+                <desc>The build ID of the build before the update</desc>
+            </info>
+            <value></value>
+        </prop>
+        <prop oor:name="SeeAlso" oor:type="xs:string" oor:nillable="false">
+            <info>
+                <desc>The URL to open after a successful update.</desc>
+            </info>
+            <value></value>
+        </prop>
     </group>
   </component>
 </oor:component-schema>


More information about the Libreoffice-commits mailing list