Revision: 7499
http://mahogany.svn.sourceforge.net/mahogany/?rev=7499&view=rev
Author: vadz
Date: 2008-07-31 16:18:38 +0000 (Thu, 31 Jul 2008)
Log Message:
-----------
add %s to the end of external commands if it's not specified in them already;
add explanation of %s to the dialog
Modified Paths:
--------------
trunk/M/include/sysutil.h
trunk/M/src/gui/ClickURL.cpp
trunk/M/src/gui/wxComposeView.cpp
trunk/M/src/gui/wxOptionsDlg.cpp
trunk/M/src/util/sysutil.cpp
Modified: trunk/M/include/sysutil.h
===================================================================
--- trunk/M/include/sysutil.h 2008-07-31 15:53:13 UTC (rev 7498)
+++ trunk/M/include/sysutil.h 2008-07-31 16:18:38 UTC (rev 7499)
@@ -94,6 +94,19 @@
bool m_keepFile;
};
+/**
+ Helper function to create the full command string from the name of an
+ external command and the given parameter.
+
+ @param command
+ The external command. It may include "%s" to be replaced by the parameter
+ value or not, in the latter case the parameter is appended to the end of
+ the command.
+ @param parameter
+ The parameter to be passed to the external command.
+ */
+String ExpandExternalCommand(String command, const String& parameter);
+
//@}
#endif // M_SYSUTIL_H
Modified: trunk/M/src/gui/ClickURL.cpp
===================================================================
--- trunk/M/src/gui/ClickURL.cpp 2008-07-31 15:53:13 UTC (rev 7498)
+++ trunk/M/src/gui/ClickURL.cpp 2008-07-31 16:18:38 UTC (rev 7499)
@@ -47,8 +47,9 @@
#include "Composer.h"
#include "Collect.h"
+#include "sysutil.h"
+
#include <wx/clipbrd.h>
-#include <wx/mimetype.h>
#ifdef OS_UNIX
#include <sys/stat.h>
@@ -502,10 +503,10 @@
}
}
#endif // Unix
- // either not netscape or ns isn't running or we have non-UNIX
- if(! bOk)
+ // either not Netscape or Netscape isn't running or we have non-UNIX
+ if ( !bOk )
{
- String command = wxFileType::ExpandCommand(browser, m_url);
+ const String command = ExpandExternalCommand(browser, m_url);
wxString errmsg;
errmsg.Printf(_("Couldn't launch browser: '%s' failed"),
Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp 2008-07-31 15:53:13 UTC (rev 7498)
+++ trunk/M/src/gui/wxComposeView.cpp 2008-07-31 16:18:38 UTC (rev 7499)
@@ -3630,8 +3630,7 @@
// we have a handy function in wxFileType which will replace
// '%s' with the file name or add the file name at the end if
// there is no '%s'
- String
- command = wxFileType::ExpandCommand(extEdit,
tmpFileName.GetName());
+ String command = ExpandExternalCommand(extEdit,
tmpFileName.GetName());
// do start the external process
m_procExtEdit = new wxProcess(this, HelperProcess_Editor);
Modified: trunk/M/src/gui/wxOptionsDlg.cpp
===================================================================
--- trunk/M/src/gui/wxOptionsDlg.cpp 2008-07-31 15:53:13 UTC (rev 7498)
+++ trunk/M/src/gui/wxOptionsDlg.cpp 2008-07-31 16:18:38 UTC (rev 7499)
@@ -513,7 +513,9 @@
// helper programs
ConfigField_HelpersFirst = ConfigField_AdbLast,
- ConfigField_HelpersHelp1,
+ ConfigField_HelpersHelpPercentS,
+ ConfigField_HelpersSkip0,
+ ConfigField_HelpersHelpBrowser,
ConfigField_Browser,
#ifndef OS_WIN // we don't care about browser kind under Windows
ConfigField_BrowserIsNetscape,
@@ -521,6 +523,7 @@
ConfigField_BrowserInNewWindow,
#ifdef OS_UNIX
+ ConfigField_HelpersSkip1,
ConfigField_HelpersHelp2,
ConfigField_HelpBrowserKind,
ConfigField_HelpBrowser,
@@ -528,18 +531,24 @@
#endif // OS_UNIX
#ifdef OS_UNIX
+ ConfigField_HelpersSkip2,
ConfigField_ImageConverter,
ConfigField_ConvertGraphicsFormat,
#endif // OS_UNIX
+ ConfigField_HelpersSkip3,
ConfigField_HelpExternalEditor,
ConfigField_ExternalEditor,
ConfigField_AutoLaunchExtEditor,
+
#ifdef USE_OPENSSL
+ ConfigField_HelpersSkip4,
ConfigField_SslHelp,
ConfigField_SslDllName,
ConfigField_CryptoDllName,
#endif // USE_OPENSSL
+
+ ConfigField_HelpersSkip4,
ConfigField_PGPHelp,
ConfigField_PGPCommand,
ConfigField_PGPKeyServer,
@@ -1731,7 +1740,16 @@
#endif // USE_BBDB
// helper programs
- { gettext_noop("The following program will be used to open URLs embedded in
messages:"), Field_Message, -1 },
+ { gettext_noop("The specification of the helper programs below can include "
+ "the special string \"%s\" to be replaced with the parameter
"
+ "to the command (i.e. the URL or the name of the file).\n"
+ "If it is not used, the parameter is appended to the end of "
+ "the command."), Field_Message, -1 },
+ { "\n\n", Field_Message, -1 },
+ { gettext_noop("The following program will be used to open URLs embedded "
+ "in messages.\n"
+ "Leave it empty to use the system default browser."),
+ Field_Message, -1
},
{ gettext_noop("Open &URLs with"), Field_File, -1
},
// we don't care if it is Netscape or not under Windows
#ifndef OS_WIN
@@ -1747,39 +1765,45 @@
#endif // Win/Unix
},
#ifdef OS_UNIX
+ { "\n", Field_Message, -1 },
{ gettext_noop("The following program will be used to view the online help
system:"), Field_Message, -1 },
{ gettext_noop("&Help viewer"
":internal"
- ":external"), Field_Combo, -1
},
- { gettext_noop("&External viewer"), Field_File, -1
},
- { gettext_noop("Help &viewer is Netscape"), Field_Bool, -1
},
+ ":external"), Field_Combo, -1
},
+ { gettext_noop("&External viewer"), Field_File, -1
},
+ { gettext_noop("Help &viewer is Netscape"), Field_Bool, -1
},
#endif // OS_UNIX
#ifdef OS_UNIX
+ { "\n", Field_Message, -1 },
{ gettext_noop("&Image format converter"), Field_File, -1
},
{ gettext_noop("Conversion &graphics format"
":XPM:PNG:BMP:JPG:GIF:PCX:PNM"), Field_Combo, -1 },
#endif // OS_UNIX
+ { "\n", Field_Message, -1 },
{ gettext_noop("You may configure the external editor to be used when
composing the messages\n"
- "and optionally choose to launch it automatically."),
+ "and optionally choose to always launch it automatically."),
Field_Message, -1
},
{ gettext_noop("&External editor"), Field_File, -1
},
{ gettext_noop("Always &use it"), Field_Bool,
ConfigField_ExternalEditor },
+
#ifdef USE_OPENSSL
- { gettext_noop("\n"
- "Mahogany can use SSL (Secure Sockets Layer) for secure,\n"
+ { "\n", Field_Message, -1 },
+ { gettext_noop("Mahogany can use SSL (Secure Sockets Layer) for secure, "
"encrypted communications, if you have the libssl and
libcrypto\n"
"shared libraries (DLLs) on your system."),
Field_Message, -1 },
{ gettext_noop("Location of lib&ssl"), Field_File, -1
},
{ gettext_noop("Location of libcr&ypto"), Field_File, -1
},
#endif // USE_OPENSSL
- { gettext_noop("\n"
- "GNU Privacy Guard or a compatible program may be used\n"
- "to verify the cryptographic signatures of the messages\n"
- "you receive and decrypt them. The public key server is\n"
- "used to retrieve the keys of the senders."), Field_Message,
-1 },
+
+ { "\n", Field_Message, -1 },
+ { gettext_noop("GNU Privacy Guard or a compatible program may be used "
+ "to verify the cryptographic signatures of the messages "
+ "you receive and decrypt them.\n"
+ "The public key server is used to retrieve the keys of "
+ "the senders."), Field_Message, -1 },
{ gettext_noop("&GPG command"), Field_File, -1
},
{ gettext_noop("GPG public &key server"), Field_Text, -1
},
@@ -2253,6 +2277,8 @@
// helper programs
CONFIG_NONE(),
+ CONFIG_NONE(),
+ CONFIG_NONE(),
CONFIG_ENTRY(MP_BROWSER),
#ifndef OS_WIN
CONFIG_ENTRY(MP_BROWSER_ISNS),
@@ -2261,24 +2287,29 @@
#ifdef OS_UNIX
CONFIG_NONE(),
+ CONFIG_NONE(),
CONFIG_ENTRY(MP_HELPBROWSER_KIND),
CONFIG_ENTRY(MP_HELPBROWSER),
CONFIG_ENTRY(MP_HELPBROWSER_ISNS),
#endif // OS_UNIX
#ifdef OS_UNIX
+ CONFIG_NONE(),
CONFIG_ENTRY(MP_CONVERTPROGRAM),
CONFIG_ENTRY(MP_TMPGFXFORMAT),
#endif
CONFIG_NONE(),
+ CONFIG_NONE(),
CONFIG_ENTRY(MP_EXTERNALEDITOR),
CONFIG_ENTRY(MP_ALWAYS_USE_EXTERNALEDITOR),
#ifdef USE_OPENSSL
CONFIG_NONE(),
+ CONFIG_NONE(),
CONFIG_ENTRY(MP_SSL_DLL_SSL),
CONFIG_ENTRY(MP_SSL_DLL_CRYPTO),
#endif // USE_OPENSSL
+ CONFIG_NONE(),
CONFIG_NONE(), // PGP help
CONFIG_ENTRY(MP_PGP_COMMAND),
CONFIG_ENTRY(MP_PGP_KEYSERVER),
Modified: trunk/M/src/util/sysutil.cpp
===================================================================
--- trunk/M/src/util/sysutil.cpp 2008-07-31 15:53:13 UTC (rev 7498)
+++ trunk/M/src/util/sysutil.cpp 2008-07-31 16:18:38 UTC (rev 7499)
@@ -27,6 +27,7 @@
# include <fcntl.h>
#endif
+#include <wx/mimetype.h>
bool sysutil_compare_filenames(String const &file1, String const
&file2)
@@ -77,3 +78,12 @@
return strutil_compare_filenames(file1, file2);
#endif
}
+
+String ExpandExternalCommand(String command, const String& parameter)
+{
+ if ( command.find("%s") == String::npos )
+ command += " %s";
+
+ return wxFileType::ExpandCommand(command, parameter);
+}
+
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates