summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-21 20:18:34 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-22 00:59:51 +0200
commitb3b2a752b71070fb58619d0a12d1f2b1017a26ef (patch)
tree1cd8023c8acc152675327315e28d81127673c2db /desktop
parentacb2bd197785a9ca715cf4e991f702bd60cd6960 (diff)
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@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx44
-rw-r--r--desktop/source/app/updater.cxx5
2 files changed, 49 insertions, 0 deletions
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();
}
}
}