Kaydet (Commit) c13529cd authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#121498: also process --help/--version before VCL init on Win

Otherwise they would be passed to the other running instance, and
processed there, without outputting the data to the callng console

Change-Id: I5cd9d11b567dfed06e19e9a2c4c29bc82868c064
Reviewed-on: https://gerrit.libreoffice.org/63577
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 9cc6b8eb
......@@ -1256,25 +1256,6 @@ int Desktop::Main()
CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
#if HAVE_FEATURE_DESKTOP
const OUString& aUnknown( rCmdLineArgs.GetUnknown() );
if ( !aUnknown.isEmpty() )
{
displayCmdlineHelp( aUnknown );
return EXIT_FAILURE;
}
if ( rCmdLineArgs.IsHelp() )
{
displayCmdlineHelp( OUString() );
return EXIT_SUCCESS;
}
if ( rCmdLineArgs.IsVersion() )
{
displayVersion();
return EXIT_SUCCESS;
}
#endif
Translate::SetReadStringHook(ReplaceStringHookProc);
// Startup screen
......@@ -2341,12 +2322,6 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
}
}
break;
case ApplicationEvent::Type::Help:
displayCmdlineHelp(rAppEvent.GetStringData());
break;
case ApplicationEvent::Type::Version:
displayVersion();
break;
case ApplicationEvent::Type::Open:
{
const CommandLineArgs& rCmdLine = GetCommandLineArgs();
......
......@@ -947,19 +947,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) {
bool bDocRequestSent = false;
OUString aUnknown( aCmdLineArgs->GetUnknown() );
if ( !aUnknown.isEmpty() || aCmdLineArgs->IsHelp() )
{
ApplicationEvent* pAppEvent =
new ApplicationEvent(ApplicationEvent::Type::Help, aUnknown);
ImplPostForeignAppEvent( pAppEvent );
}
else if ( aCmdLineArgs->IsVersion() )
{
ApplicationEvent* pAppEvent =
new ApplicationEvent(ApplicationEvent::Type::Version);
ImplPostForeignAppEvent( pAppEvent );
}
else
if (aUnknown.isEmpty() && !aCmdLineArgs->IsHelp() && !aCmdLineArgs->IsVersion())
{
const CommandLineArgs &rCurrentCmdLineArgs = Desktop::GetCommandLineArgs();
......
......@@ -142,7 +142,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
desktop::Desktop aDesktop;
// This string is used during initialization of the Gtk+ VCL module
Application::SetAppName( "soffice" );
#ifdef UNX
// handle --version and --help already here, otherwise they would be handled
// after VCL initialization that might fail if $DISPLAY is not set
const desktop::CommandLineArgs& rCmdLineArgs = desktop::Desktop::GetCommandLineArgs();
......@@ -165,7 +165,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
desktop::displayVersion();
return EXIT_SUCCESS;
}
#endif
return SVMain();
#if defined ANDROID
} catch (const css::uno::Exception &e) {
......
......@@ -128,8 +128,6 @@ public:
enum class Type {
Accept, ///< Listen for connections
Appear, ///< Make application appear
Help, ///< Bring up help options (command-line help)
Version, ///< Display product version
Open, ///< Open a document
OpenHelpUrl, ///< Open a help URL
Print, ///< Print document
......@@ -141,29 +139,27 @@ public:
/** Explicit constructor for ApplicationEvent.
@attention Type::Appear, Type::Version, Type::PrivateDoShutdown and
@attention Type::Appear, Type::PrivateDoShutdown and
Type::QuickStart are the \em only events that don't need to include
a data string with the event. No other events should use this
constructor!
*/
explicit ApplicationEvent(Type type): aEvent(type)
{
assert(
type == Type::Appear || type == Type::Version
|| type == Type::PrivateDoShutdown || type == Type::QuickStart);
assert(type == Type::Appear || type == Type::PrivateDoShutdown || type == Type::QuickStart);
}
/** Constructor for ApplicationEvent, accepts a string for the data
associated with the event.
@attention Type::Accept, Type::Help, Type::OpenHelpUrl, Type::ShowDialog
@attention Type::Accept, Type::OpenHelpUrl, Type::ShowDialog
and Type::Unaccept are the \em only events that accept a single
string as event data. No other events should use this constructor!
*/
ApplicationEvent(Type type, OUString const & data): aEvent(type)
{
assert(
type == Type::Accept || type == Type::Help || type == Type::OpenHelpUrl
type == Type::Accept || type == Type::OpenHelpUrl
|| type == Type::ShowDialog || type == Type::Unaccept);
aData.push_back(data);
}
......@@ -193,14 +189,14 @@ public:
/** Gets the application event's data string.
@attention The \em only events that need a single string Type::Accept,
Type::Help, Type::OpenHelpUrl, Type::ShowDialog and Type::Unaccept
Type::OpenHelpUrl, Type::ShowDialog and Type::Unaccept
@returns The event's data string.
*/
OUString const & GetStringData() const
{
assert(
aEvent == Type::Accept || aEvent == Type::Help
aEvent == Type::Accept
|| aEvent == Type::OpenHelpUrl || aEvent == Type::ShowDialog
|| aEvent == Type::Unaccept);
assert(aData.size() == 1);
......
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