Mercurial > projects > dwt-linux
diff dwt/program/Program.d @ 240:ce446666f5a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 12 May 2008 19:13:01 +0200 |
parents | 380bad9f6852 |
children | 5a30aa9820f3 |
line wrap: on
line diff
--- a/dwt/program/Program.d Mon May 12 15:36:37 2008 +0200 +++ b/dwt/program/Program.d Mon May 12 19:13:01 2008 +0200 @@ -194,6 +194,8 @@ static const String[] CDE_MASK_EXT = [ ".m_m.bm"[], ".l_m.bm", ".s_m.bm", ".t_m.bm" ]; static const String DESKTOP_DATA = "Program_DESKTOP"; static const String ICON_THEME_DATA = "Program_GNOME_ICON_THEME"; + static const String PREFIX_HTTP = "http://"; //$NON-NLS-1$ + static const String PREFIX_HTTPS = "https://"; //$NON-NLS-1$ static const int DESKTOP_UNKNOWN = 0; static const int DESKTOP_GNOME = 1; static const int DESKTOP_GNOME_24 = 2; @@ -855,18 +857,26 @@ * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ -static bool launch(Display display, String fileName) { +static bool launch (Display display, String fileName) { if (fileName is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); - switch(getDesktop(display)) { + switch (getDesktop (display)) { case DESKTOP_GNOME_24: if (gnome_24_launch (fileName)) return true; default: - int index = fileName.lastIndexOf('.'); + int index = fileName.lastIndexOf ('.'); if (index !is -1) { String extension = fileName.substring (index); Program program = Program.findProgram (display, extension); if (program !is null && program.execute (fileName)) return true; } + String lowercaseName = fileName.toLowerCase (); + if (lowercaseName.startsWith (PREFIX_HTTP) || lowercaseName.startsWith (PREFIX_HTTPS)) { + Program program = Program.findProgram (display, ".html"); //$NON-NLS-1$ + if (program is null) { + program = Program.findProgram (display, ".htm"); //$NON-NLS-1$ + } + if (program !is null && program.execute (fileName)) return true; + } break; } try {