Author: orw
Date: Fri Aug 23 09:51:25 2013
New Revision: 1516794

URL: http://svn.apache.org/r1516794
Log:
122976: suppress user interaction on install of already installed extension 
during the 'silent' installation of the so-called bundled extensions and during 
the migration of extensions from a former user profile


Modified:
    openoffice/trunk/main/desktop/source/app/app.cxx
    
openoffice/trunk/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
    openoffice/trunk/main/desktop/source/inc/dp_gui_handleversionexception.hxx
    
openoffice/trunk/main/desktop/source/migration/services/oo3extensionmigration.cxx

Modified: openoffice/trunk/main/desktop/source/app/app.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/source/app/app.cxx?rev=1516794&r1=1516793&r2=1516794&view=diff
==============================================================================
--- openoffice/trunk/main/desktop/source/app/app.cxx (original)
+++ openoffice/trunk/main/desktop/source/app/app.cxx Fri Aug 23 09:51:25 2013
@@ -801,8 +801,9 @@ void MinimalCommandEnv::handle(
     css::deployment::VersionException verExc;
     if ( xRequest->getRequest() >>= verExc )
     {
-        // user interaction, if an extension is already been installed.
-        bApprove = handleVersionException( verExc );
+        // choose newest version, if an extension is already been installed.
+        const bool bChooseNewestVersion = true;
+        bApprove = handleVersionException( verExc, 0, bChooseNewestVersion );
     }
 
     const css::uno::Sequence< css::uno::Reference< 
css::task::XInteractionContinuation > > conts( xRequest->getContinuations());

Modified: 
openoffice/trunk/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx?rev=1516794&r1=1516793&r2=1516794&view=diff
==============================================================================
--- 
openoffice/trunk/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
 (original)
+++ 
openoffice/trunk/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
 Fri Aug 23 09:51:25 2013
@@ -53,7 +53,8 @@ extern "C" {
 
 bool handleVersionException(
     com::sun::star::deployment::VersionException verExc,
-    DialogHelper* pDialogHelper )
+    DialogHelper* pDialogHelper,
+    const bool bChooseNewestVersion )
 {
     bool bApprove = false;
 
@@ -72,37 +73,45 @@ bool handleVersionException(
         break;
     }
     OSL_ASSERT( verExc.Deployed.is() );
-    const bool bEqualNames = verExc.NewDisplayName.equals(
-        verExc.Deployed->getDisplayName());
+
+    if ( bChooseNewestVersion )
     {
-        vos::OGuard guard(Application::GetSolarMutex());
-        WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, 
ResId(id, *DeploymentGuiResMgr::get()));
-        String s;
-        if (bEqualNames)
-        {
-            s = box.GetMessText();
-        }
-        else if (id == RID_WARNINGBOX_VERSION_EQUAL)
-        {
-            //hypothetical: requires two instances of an extension with the 
same
-            //version to have different display names. Probably the developer 
forgot
-            //to change the version.
-            s = String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
-        }
-        else if (id == RID_WARNINGBOX_VERSION_LESS)
-        {
-            s = String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
-        }
-        else if (id == RID_WARNINGBOX_VERSION_GREATER)
+        bApprove = id == RID_WARNINGBOX_VERSION_GREATER;
+    }
+    else
+    {
+        const bool bEqualNames = verExc.NewDisplayName.equals(
+            verExc.Deployed->getDisplayName());
         {
-            s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+            vos::OGuard guard(Application::GetSolarMutex());
+            WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, 
ResId(id, *DeploymentGuiResMgr::get()));
+            String s;
+            if (bEqualNames)
+            {
+                s = box.GetMessText();
+            }
+            else if (id == RID_WARNINGBOX_VERSION_EQUAL)
+            {
+                //hypothetical: requires two instances of an extension with 
the same
+                //version to have different display names. Probably the 
developer forgot
+                //to change the version.
+                s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+            }
+            else if (id == RID_WARNINGBOX_VERSION_LESS)
+            {
+                s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+            }
+            else if (id == RID_WARNINGBOX_VERSION_GREATER)
+            {
+                s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+            }
+            s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName);
+            s.SearchAndReplaceAllAscii( "$OLDNAME", 
verExc.Deployed->getDisplayName());
+            s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) 
);
+            s.SearchAndReplaceAllAscii( "$DEPLOYED", 
getVersion(verExc.Deployed) );
+            box.SetMessText(s);
+            bApprove = box.Execute() == RET_OK;
         }
-        s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName);
-        s.SearchAndReplaceAllAscii( "$OLDNAME", 
verExc.Deployed->getDisplayName());
-        s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) );
-        s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) );
-        box.SetMessText(s);
-        bApprove = box.Execute() == RET_OK;
     }
 
     return bApprove;

Modified: 
openoffice/trunk/main/desktop/source/inc/dp_gui_handleversionexception.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/source/inc/dp_gui_handleversionexception.hxx?rev=1516794&r1=1516793&r2=1516794&view=diff
==============================================================================
--- openoffice/trunk/main/desktop/source/inc/dp_gui_handleversionexception.hxx 
(original)
+++ openoffice/trunk/main/desktop/source/inc/dp_gui_handleversionexception.hxx 
Fri Aug 23 09:51:25 2013
@@ -30,10 +30,13 @@ namespace dp_gui{ class DialogHelper; }
 
 extern "C" {
 
+    // optional parameter <bChooseNewestVersion> indicates, if
+    // the newest version is chosen without user interaction.
     DESKTOP_DEPLOYMENTGUI_DLLPUBLIC
     bool handleVersionException(
         com::sun::star::deployment::VersionException verExc,
-        dp_gui::DialogHelper* pDialogHelper = 0 );
+        dp_gui::DialogHelper* pDialogHelper = 0,
+        const bool bChooseNewestVersion = false );
 }
 
 #endif

Modified: 
openoffice/trunk/main/desktop/source/migration/services/oo3extensionmigration.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/source/migration/services/oo3extensionmigration.cxx?rev=1516794&r1=1516793&r2=1516794&view=diff
==============================================================================
--- 
openoffice/trunk/main/desktop/source/migration/services/oo3extensionmigration.cxx
 (original)
+++ 
openoffice/trunk/main/desktop/source/migration/services/oo3extensionmigration.cxx
 Fri Aug 23 09:51:25 2013
@@ -530,8 +530,9 @@ void TmpRepositoryCommandEnv::handle(
     deployment::VersionException verExc;
     if ( xRequest->getRequest() >>= verExc )
     {
-        // user interaction, if an extension is already been installed.
-        approve = handleVersionException( verExc );
+        // choose newest version, if an extension is already been installed.
+        const bool bChooseNewestVersion = true;
+        approve = handleVersionException( verExc, 0, bChooseNewestVersion );
         abort = !approve;
     }
 


Reply via email to