# HG changeset patch # User Jiri Vanek # Date 1551099344 -3600 # Node ID 0bec8e87f1807024dd5364ba23ce0189a5c8f266 # Parent 9abf341f758fd341e647c75b5d243e30ca54c7bb 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 9abf341f758f -r 0bec8e87f180 ChangeLog --- a/ChangeLog Mon Feb 25 13:54:27 2019 +0100 +++ b/ChangeLog Mon Feb 25 13:55:44 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 9abf341f758f -r 0bec8e87f180 NEWS --- a/NEWS Mon Feb 25 13:54:27 2019 +0100 +++ b/NEWS Mon Feb 25 13:55:44 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.1 (2017-12-15): * better work with authors file diff -r 9abf341f758f -r 0bec8e87f180 netx/net/sourceforge/jnlp/JNLPFile.java --- a/netx/net/sourceforge/jnlp/JNLPFile.java Mon Feb 25 13:54:27 2019 +0100 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Mon Feb 25 13:55:44 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 9abf341f758f -r 0bec8e87f180 netx/net/sourceforge/jnlp/util/XDesktopEntry.java --- a/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Mon Feb 25 13:54:27 2019 +0100 +++ b/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Mon Feb 25 13:55:44 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()); }