Really don't show empty Writer document on cancelled recovery

Commit b5ad981518 tried to make that,
but either didn't work on all platforms, or was broken later. Then,
commit fbe9accf36 handled one special
case.

The problem is that cancelling recovery returns false. It's unclear
why the distinction should be done for the cancelled recovery case:
in any case, if the recovery has opened some documents, it will be
handled in the code that enumerates frames ("no default document if
 a document was loaded by recovery..." comment). In other cases, we
need to honour user command line parameters (selected module), and
if none is specified, do the global default, which is currently to
show Start Center. So - let the OpenDefault() do just that.

Change-Id: I90f3581fc72628d1317e97074a4a1d352d630c7e
Reviewed-on: https://gerrit.libreoffice.org/54604
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Mike Kaganski
2018-05-20 20:44:25 +03:00
committed by Stephan Bergmann
parent 059872b47e
commit c8c7f19073

View File

@@ -1972,10 +1972,6 @@ IMPL_LINK_NOARG(Desktop, OpenClients_Impl, void*, void)
void Desktop::OpenClients()
{
// check if a document has been recovered - if there is one of if a document was loaded by cmdline, no default document
// should be created
bool bRecovery = false;
const CommandLineArgs& rArgs = GetCommandLineArgs();
if (!rArgs.IsQuickstart())
@@ -2070,7 +2066,7 @@ void Desktop::OpenClients()
{
try
{
bRecovery = impl_callRecoveryUI(
impl_callRecoveryUI(
false , // false => force recovery instead of emergency save
bExistsRecoveryData);
}
@@ -2079,9 +2075,6 @@ void Desktop::OpenClients()
SAL_WARN( "desktop.app", "Error during recovery" << e);
}
}
else if (bExistsRecoveryData && bDisableRecovery && !rArgs.HasModuleParam())
// prevent new Writer doc
bRecovery = true;
Reference< XSessionManagerListener2 > xSessionListener;
try
@@ -2188,14 +2181,7 @@ void Desktop::OpenClients()
// soffice was started as tray icon ...
return;
if ( bRecovery )
{
ShowBackingComponent(nullptr);
}
else
{
OpenDefault();
}
OpenDefault();
}
void Desktop::OpenDefault()
@@ -2228,6 +2214,12 @@ void Desktop::OpenDefault()
if ( aName.isEmpty() )
{
if (aOpt.IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE))
{
ShowBackingComponent(nullptr);
return;
}
// Old way to create a default document
if ( aOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
aName = aOpt.GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory::WRITER );