Class XDesktopEntry
java.lang.Object
net.sourceforge.jnlp.util.XDesktopEntry
- All Implemented Interfaces:
GenericDesktopEntry
This class builds a (freedesktop.org) desktop entry out of a
JNLPFile
. This entry can be used to install desktop shortcuts. See xdg-desktop-icon
(1) and http://standards.freedesktop.org/desktop-entry-spec/latest/ for more
information-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]static final Stringprivate JNLPFileprivate static final Stringprivate Stringprivate intprivate static final Stringprivate static final Stringprivate static final Loggerprivate static final Stringprivate static final Stringprivate static final int[](package private) static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) Stringprivate voidCache the icon for the desktop entryprivate voidprivate FileconvertToIco(File source, String targetName) voidcreateDesktopShortcuts(AccessWarningPaneComplexReturn.ShortcutResult menu, AccessWarningPaneComplexReturn.ShortcutResult desktop) Create a desktop shortcut for this desktop entryvoidvoidprivate static FiledownloadFavIcon(JNLPFile file) private static StringevaluateLinuxVariables(String orig) private static StringevaluateLinuxVariables(String orig, Map<String, String> variables) private static URLprivate static StringfilterQuotes(String string) private static StringfindAndVerifyBasicDir(File f, String message) private static Stringprivate static Stringprivate static StringInstead of having all this parsing of user-dirs.dirs and replacing variables we can execute `echo $(xdg-user-dir DESKTOP)` and it will do all the job in case approaches below become failingstatic Stringstatic String(package private) StringgetContent(boolean menu, AccessWarningPaneComplexReturn.ShortcutResult info) Returns the contents of theXDesktopEntryas a String.(package private) static File(package private) static Stringprivate static StringgetFreedesktopOrgDesktopPathFrom(File userDirs) private Stringprivate String(package private) Fileprivate StringgetUniqueIconName(String iconName) private voidInstall this XDesktopEntry into the user's desktop as a launcher.private voidInstall this XDesktopEntry into the user's menu.voidrefreshExistingShortcuts(boolean desktop, boolean menu) private static StringSanitizes a string so that it can be used safely in a key=value pair in a desktop entry file.
-
Field Details
-
LOG
-
file
-
iconSize
private int iconSize -
iconLocation
-
VALID_ICON_SIZES
private static final int[] VALID_ICON_SIZES -
GIF
- See Also:
-
JPG
- See Also:
-
JPEG
- See Also:
-
PNG
- See Also:
-
BROWSERS
-
FAVICON
- See Also:
-
XDG_DESKTOP_DIR
- See Also:
-
MIC
- See Also:
-
-
Constructor Details
-
XDesktopEntry
-
-
Method Details
-
getContent
Returns the contents of theXDesktopEntryas a String.- Parameters:
menu- whether to create this icon to menuinfo- result of user's interference- Returns:
- string with desktop shortcut specification
-
getBrowserBin
-
sanitize
-
getShortcutTmpFile
File getShortcutTmpFile() -
createDesktopShortcuts
public void createDesktopShortcuts(AccessWarningPaneComplexReturn.ShortcutResult menu, AccessWarningPaneComplexReturn.ShortcutResult desktop) Create a desktop shortcut for this desktop entry- Specified by:
createDesktopShortcutsin interfaceGenericDesktopEntry- Parameters:
menu- how to create in menudesktop- how to create on desktop
-
installMenuLauncher
Install this XDesktopEntry into the user's menu. -
installDesktopLauncher
Install this XDesktopEntry into the user's desktop as a launcher. -
refreshExistingShortcuts
public void refreshExistingShortcuts(boolean desktop, boolean menu) - Specified by:
refreshExistingShortcutsin interfaceGenericDesktopEntry
-
getGeneratedJnlpFileName
- Specified by:
getGeneratedJnlpFileNamein interfaceGenericDesktopEntry
-
cacheIcon
Cache the icon for the desktop entry -
getUniqueIconName
-
convertToIco
-
cacheAndGetIconLocation
String cacheAndGetIconLocation() -
possibleFavIconLocations
-
favUrl
private static URL favUrl(String delimiter, String path, JNLPFile file) throws MalformedURLException - Throws:
MalformedURLException
-
downloadFavIcon
-
cantCache
-
getShortcutName
-
getDesktopIconFile
- Specified by:
getDesktopIconFilein interfaceGenericDesktopEntry
-
getDesktop
-
getLinuxMenuIconFile
- Specified by:
getLinuxMenuIconFilein interfaceGenericDesktopEntry
-
getShortcutFileName
-
findAndVerifyGeneratedJnlpDir
-
findAndVerifyJavawsMenuDir
-
findAndVerifyBasicDir
-
findFreedesktopOrgDesktopPathCatch
-
findFreedesktopOrgDesktopPath
Instead of having all this parsing of user-dirs.dirs and replacing variables we can execute `echo $(xdg-user-dir DESKTOP)` and it will do all the job in case approaches below become failing- Returns:
- variables (if declared) and quotation marks (unless escaped) free path
- Throws:
IOException- if no file do not exists or key with desktop do not exists
-
getFreedesktopOrgDesktopPathFrom
- Throws:
IOException
-
getFreedesktopOrgDesktopPathFrom
- Throws:
IOException
-
filterQuotes
-
evaluateLinuxVariables
-
evaluateLinuxVariables
-
createShortcutOnWindowsDesktop
public void createShortcutOnWindowsDesktop()- Specified by:
createShortcutOnWindowsDesktopin interfaceGenericDesktopEntry
-
createWindowsMenu
public void createWindowsMenu()- Specified by:
createWindowsMenuin interfaceGenericDesktopEntry
-