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