# HG changeset patch # User Jiri Vanek # Date 1549545159 -3600 # Node ID 87556fa6a5114c03e533f0adc9adf7cebe0a6e56 # Parent 3a3e13df995c092c7814ca092272b2f892e986b1 Desktop sortcuts name is now based on title. And only if missing, then on file * netx/net/sourceforge/jnlp/JNLPFile.java: new method of createNameForDesktopFile, which returns title if it is present, jnlp file name otherwise. * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: getGeneratedJnlpFileName and getDesktopIconName now uses * NEWS: mentioned diff -r 3a3e13df995c -r 87556fa6a511 ChangeLog --- a/ChangeLog Wed Feb 06 19:05:05 2019 +0100 +++ b/ChangeLog Thu Feb 07 14:12:39 2019 +0100 @@ -1,3 +1,11 @@ +2019-02-07 Jiri Vanek + + Desktop sortcuts name is now based on title. And only if missing, then on file + * netx/net/sourceforge/jnlp/JNLPFile.java: new method of createNameForDesktopFile, which + returns title if it is present, jnlp file name otherwise. + * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: getGeneratedJnlpFileName and getDesktopIconName now uses + * NEWS: mentioned + 2019-02-06 Jiri Vanek Delete-by app dialogue split keys to two groups instead of mixing them diff -r 3a3e13df995c -r 87556fa6a511 NEWS --- a/NEWS Wed Feb 06 19:05:05 2019 +0100 +++ b/NEWS Thu Feb 07 14:12:39 2019 +0100 @@ -16,6 +16,7 @@ * deployment.config now support generic url instead just file * Added support for windows desktop shortcuts via https://github.com/DmitriiShamrikov/mslinks * cache can now be operated by groups, list by -Xcacheids (details via -verbose, can filter by regex), Xclearcache now can clear only selected id. There is also gui to operate cache via id in itweb-settings now. +* desktop shortcut name get shortened to title or file if title is missing. New in release 1.7 (2017-07-19): * PR3366 - bash completion file was split to three, and is setup-able by bashcompdir environment variable diff -r 3a3e13df995c -r 87556fa6a511 netx/net/sourceforge/jnlp/JNLPFile.java --- a/netx/net/sourceforge/jnlp/JNLPFile.java Wed Feb 06 19:05:05 2019 +0100 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Thu Feb 07 14:12:39 2019 +0100 @@ -1190,7 +1190,7 @@ return "Generated from applet from " + createJnlpVendorValue(); } - public String createJnlpTitleValue() { + private String createJnlpTitleValue() { final String location; if (getSourceLocation() != null) { location = new File(getSourceLocation().getFile()).getName(); @@ -1215,6 +1215,15 @@ return getTitle() + " from " + createJnlpTitleValue(); } + public String createNameForDesktopFile() { + String basicTitle = getTitle(); + if (basicTitle == null || basicTitle.trim().isEmpty()) { + return createJnlpTitleValue().replaceAll(".jnlp$",""); + } else { + return basicTitle; + } + } + //not private for testing purposes static String[] splitEntryPoints(String entryPointString) { if (entryPointString == null || entryPointString.trim().isEmpty()) { diff -r 3a3e13df995c -r 87556fa6a511 netx/net/sourceforge/jnlp/util/XDesktopEntry.java --- a/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Wed Feb 06 19:05:05 2019 +0100 +++ b/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Thu Feb 07 14:12:39 2019 +0100 @@ -414,7 +414,7 @@ @Override public File getGeneratedJnlpFileName() { - String name = FileUtils.sanitizeFileName(file.createJnlpTitle()); + String name = FileUtils.sanitizeFileName(file.createNameForDesktopFile()); while (name.endsWith(".jnlp")) { name = name.substring(0, name.length() - 5); } @@ -558,9 +558,10 @@ } static String getDesktopIconName(JNLPFile file) { - return sanitize(file.createJnlpTitle()); + return sanitize(file.createNameForDesktopFile()); } + @Override public File getDesktopIconFile() { return new File(getDesktop(), getDesktopIconFileName()); }