[Libreoffice-commits] core.git: desktop/inc desktop/Library_sofficeapp.mk desktop/source

Stephan Bergmann sbergman at redhat.com
Fri Oct 18 08:36:55 PDT 2013


 desktop/Library_sofficeapp.mk        |    1 
 desktop/inc/app.hxx                  |    4 -
 desktop/source/app/app.cxx           |   63 ++++++++++++++++------
 desktop/source/app/appfirststart.cxx |  100 -----------------------------------
 4 files changed, 47 insertions(+), 121 deletions(-)

New commits:
commit 5732ff540edbaa4ad5d92177c48e0a79e385b5cb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 18 17:35:57 2013 +0200

    Some clean-up
    
    Change-Id: I142f9c4e73585272c3028880e40c20f4a056f3c3

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 0179476..0c6c3e7 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -70,7 +70,6 @@ endif
 
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
     desktop/source/app/app \
-    desktop/source/app/appfirststart \
     desktop/source/app/appinit \
     desktop/source/app/check_ext_deps \
     desktop/source/app/cmdlineargs \
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 503c11d..d01e964 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -118,9 +118,6 @@ class Desktop : public Application
         // first-start (ever) related methods
         static sal_Bool         CheckExtensionDependencies();
 
-        static void             DoRestartActionsIfNecessary( sal_Bool bQuickStart );
-        static void             SetRestartState();
-
         void                    SynchronizeExtensionRepositories();
         void                    SetSplashScreenText( const OUString& rText );
         void                    SetSplashScreenProgress( sal_Int32 );
@@ -141,7 +138,6 @@ class Desktop : public Application
         sal_Bool                InitializeInstallation( const OUString& rAppFilename );
         bool                    InitializeConfiguration();
         void                    FlushConfiguration();
-        static sal_Bool         shouldLaunchQuickstart();
         sal_Bool                InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
 
         void                    HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 4c36cd3..b9e4ad1 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -84,6 +84,7 @@
 #include <unotools/moduleoptions.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Office/Recovery.hxx>
+#include <officecfg/Setup.hxx>
 #include <osl/file.hxx>
 #include <osl/process.h>
 #include <rtl/uri.hxx>
@@ -318,6 +319,52 @@ bool cleanExtensionCache() {
     return true;
 }
 
+bool shouldLaunchQuickstart()
+{
+    bool bQuickstart = Desktop::GetCommandLineArgs().IsQuickstart();
+    if (!bQuickstart)
+    {
+        const SfxPoolItem* pItem=0;
+        SfxItemSet aQLSet(SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER);
+        SFX_APP()->GetOptions(aQLSet);
+        SfxItemState eState = aQLSet.GetItemState(SID_ATTR_QUICKLAUNCHER, sal_False, &pItem);
+        if (SFX_ITEM_SET == eState)
+            bQuickstart = ((SfxBoolItem*)pItem)->GetValue();
+    }
+    return bQuickstart;
+}
+
+void SetRestartState() {
+    try {
+        boost::shared_ptr< comphelper::ConfigurationChanges > batch(
+            comphelper::ConfigurationChanges::create());
+        officecfg::Setup::Office::OfficeRestartInProgress::set(true, batch);
+        batch->commit();
+    } catch (css::uno::Exception & e) {
+        SAL_WARN("desktop.app", "ignoring Exception \"" << e.Message << "\"");
+    }
+}
+
+void DoRestartActionsIfNecessary(bool quickstart) {
+    if (quickstart) {
+        try {
+            if (officecfg::Setup::Office::OfficeRestartInProgress::get()) {
+                boost::shared_ptr< comphelper::ConfigurationChanges > batch(
+                    comphelper::ConfigurationChanges::create());
+                officecfg::Setup::Office::OfficeRestartInProgress::set(
+                    false, batch);
+                batch->commit();
+                css::office::Quickstart::createStart(
+                    comphelper::getProcessComponentContext(),
+                    shouldLaunchQuickstart());
+            }
+        } catch (css::uno::Exception & e) {
+            SAL_WARN(
+                "desktop.app", "ignoring Exception \"" << e.Message << "\"");
+        }
+    }
+}
+
 }
 
 // ----------------------------------------------------------------------------
@@ -1858,22 +1905,6 @@ void Desktop::FlushConfiguration()
         css::uno::UNO_QUERY_THROW)->flush();
 }
 
-sal_Bool Desktop::shouldLaunchQuickstart()
-{
-    sal_Bool bQuickstart = GetCommandLineArgs().IsQuickstart();
-    if (!bQuickstart)
-    {
-        const SfxPoolItem* pItem=0;
-        SfxItemSet aQLSet(SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER);
-        SFX_APP()->GetOptions(aQLSet);
-        SfxItemState eState = aQLSet.GetItemState(SID_ATTR_QUICKLAUNCHER, sal_False, &pItem);
-        if (SFX_ITEM_SET == eState)
-            bQuickstart = ((SfxBoolItem*)pItem)->GetValue();
-    }
-    return bQuickstart;
-}
-
-
 sal_Bool Desktop::InitializeQuickstartMode( const Reference< XComponentContext >& rxContext )
 {
     try
diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx
deleted file mode 100644
index a5e3e32..0000000
--- a/desktop/source/app/appfirststart.cxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <osl/file.hxx>
-#include <rtl/bootstrap.hxx>
-#include <rtl/ustring.hxx>
-#include <unotools/configmgr.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/configuration/theDefaultProvider.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/office/Quickstart.hpp>
-
-#include "app.hxx"
-
-using namespace ::desktop;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-
-static const char aAccessSrvc[] = "com.sun.star.configuration.ConfigurationUpdateAccess";
-
-/* Local function - get access to the configuration */
-static Reference< XPropertySet > impl_getConfigurationAccess( const OUString& rPath )
-{
-    Reference< XMultiServiceFactory > xConfigProvider(
-        configuration::theDefaultProvider::get(
-            comphelper::getProcessComponentContext() ) );
-    Sequence< Any > aArgs( 1 );
-    NamedValue aValue( OUString( "nodepath"  ), makeAny( rPath ) );
-    aArgs[0] <<= aValue;
-    return Reference< XPropertySet >(
-            xConfigProvider->createInstanceWithArguments( OUString(aAccessSrvc), aArgs ), UNO_QUERY_THROW );
-}
-
-void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart )
-{
-    if ( bQuickStart )
-    {
-        try
-        {
-            Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( "org.openoffice.Setup/Office"  ) );
-
-            OUString sPropName( "OfficeRestartInProgress"  );
-            Any aRestart = xPSet->getPropertyValue( sPropName );
-            sal_Bool bRestart = sal_False;
-            if ( ( aRestart >>= bRestart ) && bRestart )
-            {
-                xPSet->setPropertyValue( sPropName, makeAny( sal_False ) );
-                Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
-
-                sal_Bool bQuickstart = shouldLaunchQuickstart();
-
-                css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-                css::office::Quickstart::createStart(xContext, bQuickstart);
-            }
-        }
-        catch( const uno::Exception& )
-        {
-            // this is no critical operation so it should not prevent office from starting
-        }
-    }
-}
-
-void Desktop::SetRestartState()
-{
-    try
-    {
-        Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( "org.openoffice.Setup/Office"  ) );
-        OUString sPropName( "OfficeRestartInProgress"  );
-        xPSet->setPropertyValue( sPropName, makeAny( sal_True ) );
-        Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
-    }
-    catch( const uno::Exception& )
-    {
-        // this is no critical operation, ignore the exception
-    }
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list