Kaydet (Commit) ed13d17d authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

122976: suppress user interaction on install of already installed extension…

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
üst c68c57a1
...@@ -801,8 +801,9 @@ void MinimalCommandEnv::handle( ...@@ -801,8 +801,9 @@ void MinimalCommandEnv::handle(
css::deployment::VersionException verExc; css::deployment::VersionException verExc;
if ( xRequest->getRequest() >>= verExc ) if ( xRequest->getRequest() >>= verExc )
{ {
// user interaction, if an extension is already been installed. // choose newest version, if an extension is already been installed.
bApprove = handleVersionException( verExc ); const bool bChooseNewestVersion = true;
bApprove = handleVersionException( verExc, 0, bChooseNewestVersion );
} }
const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > conts( xRequest->getContinuations()); const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > conts( xRequest->getContinuations());
......
...@@ -53,7 +53,8 @@ extern "C" { ...@@ -53,7 +53,8 @@ extern "C" {
bool handleVersionException( bool handleVersionException(
com::sun::star::deployment::VersionException verExc, com::sun::star::deployment::VersionException verExc,
DialogHelper* pDialogHelper ) DialogHelper* pDialogHelper,
const bool bChooseNewestVersion )
{ {
bool bApprove = false; bool bApprove = false;
...@@ -72,37 +73,45 @@ bool handleVersionException( ...@@ -72,37 +73,45 @@ bool handleVersionException(
break; break;
} }
OSL_ASSERT( verExc.Deployed.is() ); OSL_ASSERT( verExc.Deployed.is() );
const bool bEqualNames = verExc.NewDisplayName.equals(
verExc.Deployed->getDisplayName()); if ( bChooseNewestVersion )
{ {
vos::OGuard guard(Application::GetSolarMutex()); bApprove = id == RID_WARNINGBOX_VERSION_GREATER;
WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get())); }
String s; else
if (bEqualNames) {
{ const bool bEqualNames = verExc.NewDisplayName.equals(
s = box.GetMessText(); verExc.Deployed->getDisplayName());
}
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())); 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; return bApprove;
......
...@@ -30,10 +30,13 @@ namespace dp_gui{ class DialogHelper; } ...@@ -30,10 +30,13 @@ namespace dp_gui{ class DialogHelper; }
extern "C" { extern "C" {
// optional parameter <bChooseNewestVersion> indicates, if
// the newest version is chosen without user interaction.
DESKTOP_DEPLOYMENTGUI_DLLPUBLIC DESKTOP_DEPLOYMENTGUI_DLLPUBLIC
bool handleVersionException( bool handleVersionException(
com::sun::star::deployment::VersionException verExc, com::sun::star::deployment::VersionException verExc,
dp_gui::DialogHelper* pDialogHelper = 0 ); dp_gui::DialogHelper* pDialogHelper = 0,
const bool bChooseNewestVersion = false );
} }
#endif #endif
...@@ -530,8 +530,9 @@ void TmpRepositoryCommandEnv::handle( ...@@ -530,8 +530,9 @@ void TmpRepositoryCommandEnv::handle(
deployment::VersionException verExc; deployment::VersionException verExc;
if ( xRequest->getRequest() >>= verExc ) if ( xRequest->getRequest() >>= verExc )
{ {
// user interaction, if an extension is already been installed. // choose newest version, if an extension is already been installed.
approve = handleVersionException( verExc ); const bool bChooseNewestVersion = true;
approve = handleVersionException( verExc, 0, bChooseNewestVersion );
abort = !approve; abort = !approve;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment