[Libreoffice-commits] .: 5 commits - desktop/scripts desktop/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Jan 11 09:35:06 PST 2011
desktop/scripts/soffice.sh | 2 -
desktop/source/app/app.cxx | 5 +++
desktop/source/app/cmdlineargs.cxx | 11 ++++++++
desktop/source/app/cmdlineargs.hxx | 8 +++---
desktop/source/app/cmdlinehelp.cxx | 47 ++++++++++++++++++++++++++++---------
desktop/source/app/cmdlinehelp.hxx | 1
6 files changed, 59 insertions(+), 15 deletions(-)
New commits:
commit f4b46c5756de4abb61bb7b569a658fb206c99c72
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Jan 11 12:33:18 2011 -0500
Use a dialog for the non-unix platforms.
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index 4b1b464..6a09755 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -133,7 +133,7 @@ namespace desktop
" If -outdir is not specified then current working dir is used as output_dir.\n"\
" Eg. -print-to-file *.doc\n"\
" -print-to-file -printer-name nasty_lowres_printer -outdir /home/user *.doc\n"\
- "\nRemaining arguments will be treated as filenames or URLs of documents to open.\n";
+ "\nRemaining arguments will be treated as filenames or URLs of documents to open.\n\n";
void ReplaceStringHookProc( UniString& rStr );
@@ -187,7 +187,14 @@ namespace desktop
::rtl::OUString aDefault;
String aVerId = ::utl::Bootstrap::getBuildIdData(aDefault);
aVersionMsg.SearchAndReplaceAscii("%BUILDID", aVerId);
+#ifdef UNX
fprintf(stdout, "%s", ByteString(aVersionMsg, RTL_TEXTENCODING_ASCII_US).GetBuffer());
+#else
+ // Just re-use the help dialog for now.
+ CmdlineHelpDialog aDlg;
+ aDlg.m_ftHead.SetText(aVersionMsg);
+ aDlg.Execute();
+#endif
}
#ifndef UNX
commit 3dce95f138677233c5685bca72a00cfe368826e1
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Jan 11 12:27:51 2011 -0500
Updated the help to add the --version option.
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index ffed125..4b1b464 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -71,6 +71,7 @@ namespace desktop
"--nodefault \n"\
"--headless \n"\
"--help/-h/-? \n"\
+ "--version \n"\
"--writer \n"\
"--calc \n"\
"--draw \n"\
@@ -91,6 +92,7 @@ namespace desktop
"don't start with an empty document\n"\
"like invisible but no userinteraction at all.\n"\
"show this message and exit.\n"\
+ "display the version information.\n"\
"create new text document.\n"\
"create new spreadsheet document.\n"\
"create new drawing.\n"\
commit 33060984a42629d9e6e202c6d45e757e36ad2a25
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Jan 11 12:22:38 2011 -0500
Display the real version number.
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index 137f1d3..ffed125 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -54,9 +54,10 @@ namespace desktop
// __BOTTOM__
// [OK]
- const char *aCmdLineHelp_head =
+ const char *aCmdLineHelp_version =
"%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION %BUILDID\n"\
- "\n"\
+ "\n";
+ const char *aCmdLineHelp_head =
"Usage: %CMDNAME [options] [documents...]\n"\
"\n"\
"Options:\n";
@@ -138,19 +139,21 @@ namespace desktop
{
// if you put variables in other chunks don't forget to call the replace routines
// for those chunks...
+ String aHelpMessage_version(aCmdLineHelp_version, RTL_TEXTENCODING_ASCII_US);
String aHelpMessage_head(aCmdLineHelp_head, RTL_TEXTENCODING_ASCII_US);
String aHelpMessage_left(aCmdLineHelp_left, RTL_TEXTENCODING_ASCII_US);
String aHelpMessage_right(aCmdLineHelp_right, RTL_TEXTENCODING_ASCII_US);
String aHelpMessage_bottom(aCmdLineHelp_bottom, RTL_TEXTENCODING_ASCII_US);
- ReplaceStringHookProc(aHelpMessage_head);
+ ReplaceStringHookProc(aHelpMessage_version);
::rtl::OUString aDefault;
String aVerId( ::utl::Bootstrap::getBuildIdData( aDefault ));
- aHelpMessage_head.SearchAndReplaceAscii( "%BUILDID", aVerId );
+ aHelpMessage_version.SearchAndReplaceAscii( "%BUILDID", aVerId );
aHelpMessage_head.SearchAndReplaceAscii( "%CMDNAME", String( "soffice", RTL_TEXTENCODING_ASCII_US) );
#ifdef UNX
// on unix use console for output
- fprintf(stdout, "%s\n", ByteString(aHelpMessage_head,
- RTL_TEXTENCODING_ASCII_US).GetBuffer());
+ fprintf(stdout, "%s%s",
+ ByteString(aHelpMessage_version, RTL_TEXTENCODING_ASCII_US).GetBuffer(),
+ ByteString(aHelpMessage_head, RTL_TEXTENCODING_ASCII_US).GetBuffer());
// merge left and right column
int n = aHelpMessage_left.GetTokenCount ('\n');
ByteString bsLeft(aHelpMessage_left, RTL_TEXTENCODING_ASCII_US);
@@ -165,7 +168,9 @@ namespace desktop
#else
// rest gets a dialog box
CmdlineHelpDialog aDlg;
- aDlg.m_ftHead.SetText(aHelpMessage_head);
+ String head = aHelpMessage_version;
+ head.Append(aHelpMessage_head);
+ aDlg.m_ftHead.SetText(head);
aDlg.m_ftLeft.SetText(aHelpMessage_left);
aDlg.m_ftRight.SetText(aHelpMessage_right);
aDlg.m_ftBottom.SetText(aHelpMessage_bottom);
@@ -175,7 +180,12 @@ namespace desktop
void displayVersion()
{
- fprintf(stdout, "Display version here\n");
+ String aVersionMsg(aCmdLineHelp_version, RTL_TEXTENCODING_ASCII_US);
+ ReplaceStringHookProc(aVersionMsg);
+ ::rtl::OUString aDefault;
+ String aVerId = ::utl::Bootstrap::getBuildIdData(aDefault);
+ aVersionMsg.SearchAndReplaceAscii("%BUILDID", aVerId);
+ fprintf(stdout, "%s", ByteString(aVersionMsg, RTL_TEXTENCODING_ASCII_US).GetBuffer());
}
#ifndef UNX
commit 4735dc65229dcb1787304e16a55c2b366128cfba
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Jan 11 12:05:34 2011 -0500
Print help to stdout, not to stderr like the rest of the programs.
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index 1010e72..137f1d3 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -149,7 +149,7 @@ namespace desktop
aHelpMessage_head.SearchAndReplaceAscii( "%CMDNAME", String( "soffice", RTL_TEXTENCODING_ASCII_US) );
#ifdef UNX
// on unix use console for output
- fprintf(stderr, "%s\n", ByteString(aHelpMessage_head,
+ fprintf(stdout, "%s\n", ByteString(aHelpMessage_head,
RTL_TEXTENCODING_ASCII_US).GetBuffer());
// merge left and right column
int n = aHelpMessage_left.GetTokenCount ('\n');
@@ -157,10 +157,10 @@ namespace desktop
ByteString bsRight(aHelpMessage_right, RTL_TEXTENCODING_ASCII_US);
for ( int i = 0; i < n; i++ )
{
- fprintf(stderr, "%s", bsLeft.GetToken(i, '\n').GetBuffer());
- fprintf(stderr, "%s\n", bsRight.GetToken(i, '\n').GetBuffer());
+ fprintf(stdout, "%s", bsLeft.GetToken(i, '\n').GetBuffer());
+ fprintf(stdout, "%s\n", bsRight.GetToken(i, '\n').GetBuffer());
}
- fprintf(stderr, "%s", ByteString(aHelpMessage_bottom,
+ fprintf(stdout, "%s", ByteString(aHelpMessage_bottom,
RTL_TEXTENCODING_ASCII_US).GetBuffer());
#else
// rest gets a dialog box
commit 870fbd35ab09f344143308433f8a7c4c75840fcb
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Jan 11 12:04:28 2011 -0500
Hook for supporting --version command line option for Unix.
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index bc8ecc9..ef52370 100644
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -98,7 +98,7 @@ done
# test for availability of the fast external splash
for arg in $@; do
case "$arg" in
- --nologo|-nologo|--no-oosplash|-no-oosplash|--help|-help|-h|-\?)
+ --nologo|-nologo|--no-oosplash|-no-oosplash|--version|--help|-help|-h|-\?)
no_oosplash=y
;;
esac
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index d9c506e..36c8f66 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -707,6 +707,11 @@ void Desktop::Init()
displayCmdlineHelp();
SetBootstrapStatus(BS_TERMINATE);
}
+ else if ( pCmdLineArgs->IsVersion() )
+ {
+ displayVersion();
+ SetBootstrapStatus(BS_TERMINATE);
+ }
#endif
// start ipc thread only for non-remote offices
RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) ::OfficeIPCThread::EnableOfficeIPCThread" );
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 5ff4f76..b4ede8b 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -519,6 +519,11 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True );
return sal_True;
}
+ else if ( oArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "version" )) == sal_True )
+ {
+ SetBoolParam_Impl( CMD_BOOLPARAM_VERSION, sal_True );
+ return sal_True;
+ }
else if ( oArg.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("splash-pipe=")) )
{
AddStringListParam_Impl( CMD_STRINGPARAM_SPLASHPIPE, oArg.copy(RTL_CONSTASCII_LENGTH("splash-pipe=")) );
@@ -848,6 +853,12 @@ sal_Bool CommandLineArgs::IsWeb() const
return m_aBoolParams[ CMD_BOOLPARAM_WEB ];
}
+sal_Bool CommandLineArgs::IsVersion() const
+{
+ osl::MutexGuard aMutexGuard( m_aMutex );
+ return m_aBoolParams[ CMD_BOOLPARAM_VERSION ];
+}
+
sal_Bool CommandLineArgs::HasModuleParam() const
{
osl::MutexGuard aMutexGuard( m_aMutex );
diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx
index d567204..e670ccc 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -41,7 +41,7 @@ class CommandLineArgs
public:
enum BoolParam // must be zero based!
{
- CMD_BOOLPARAM_MINIMIZED,
+ CMD_BOOLPARAM_MINIMIZED = 0,
CMD_BOOLPARAM_INVISIBLE,
CMD_BOOLPARAM_NORESTORE,
CMD_BOOLPARAM_BEAN,
@@ -72,12 +72,13 @@ class CommandLineArgs
CMD_BOOLPARAM_HELPIMPRESS,
CMD_BOOLPARAM_HELPBASE,
CMD_BOOLPARAM_PSN,
+ CMD_BOOLPARAM_VERSION,
CMD_BOOLPARAM_COUNT // must be last element!
};
enum StringParam // must be zero based!
{
- CMD_STRINGPARAM_PORTAL,
+ CMD_STRINGPARAM_PORTAL = 0,
CMD_STRINGPARAM_SPLASHPIPE,
CMD_STRINGPARAM_ACCEPT,
CMD_STRINGPARAM_UNACCEPT,
@@ -103,7 +104,7 @@ class CommandLineArgs
enum GroupParamId
{
- CMD_GRPID_MODULE,
+ CMD_GRPID_MODULE = 0,
CMD_GRPID_COUNT
};
@@ -161,6 +162,7 @@ class CommandLineArgs
sal_Bool IsGlobal() const;
sal_Bool IsMath() const;
sal_Bool IsWeb() const;
+ sal_Bool IsVersion() const;
sal_Bool HasModuleParam() const;
// Access to string parameters
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index f643aa6..1010e72 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -172,6 +172,12 @@ namespace desktop
aDlg.Execute();
#endif
}
+
+ void displayVersion()
+ {
+ fprintf(stdout, "Display version here\n");
+ }
+
#ifndef UNX
CmdlineHelpDialog::CmdlineHelpDialog (void)
: ModalDialog( NULL, DesktopResId( DLG_CMDLINEHELP ) )
diff --git a/desktop/source/app/cmdlinehelp.hxx b/desktop/source/app/cmdlinehelp.hxx
index 823e7b4..2036d64 100644
--- a/desktop/source/app/cmdlinehelp.hxx
+++ b/desktop/source/app/cmdlinehelp.hxx
@@ -6,6 +6,7 @@
namespace desktop
{
void displayCmdlineHelp( void );
+ void displayVersion();
#ifndef UNX
class CmdlineHelpDialog : public ModalDialog
{
More information about the Libreoffice-commits
mailing list