comparison 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
comparison
equal deleted inserted replaced
239:06a1f6829310 240:ce446666f5a2
192 192
193 static const String[] CDE_ICON_EXT = [ ".m.pm"[], ".l.pm", ".s.pm", ".t.pm" ]; 193 static const String[] CDE_ICON_EXT = [ ".m.pm"[], ".l.pm", ".s.pm", ".t.pm" ];
194 static const String[] CDE_MASK_EXT = [ ".m_m.bm"[], ".l_m.bm", ".s_m.bm", ".t_m.bm" ]; 194 static const String[] CDE_MASK_EXT = [ ".m_m.bm"[], ".l_m.bm", ".s_m.bm", ".t_m.bm" ];
195 static const String DESKTOP_DATA = "Program_DESKTOP"; 195 static const String DESKTOP_DATA = "Program_DESKTOP";
196 static const String ICON_THEME_DATA = "Program_GNOME_ICON_THEME"; 196 static const String ICON_THEME_DATA = "Program_GNOME_ICON_THEME";
197 static const String PREFIX_HTTP = "http://"; //$NON-NLS-1$
198 static const String PREFIX_HTTPS = "https://"; //$NON-NLS-1$
197 static const int DESKTOP_UNKNOWN = 0; 199 static const int DESKTOP_UNKNOWN = 0;
198 static const int DESKTOP_GNOME = 1; 200 static const int DESKTOP_GNOME = 1;
199 static const int DESKTOP_GNOME_24 = 2; 201 static const int DESKTOP_GNOME_24 = 2;
200 static const int DESKTOP_CDE = 3; 202 static const int DESKTOP_CDE = 3;
201 static const int PREFERRED_ICON_SIZE = 16; 203 static const int PREFERRED_ICON_SIZE = 16;
853 855
854 /* 856 /*
855 * API: When support for multiple displays is added, this method will 857 * API: When support for multiple displays is added, this method will
856 * become public and the original method above can be deprecated. 858 * become public and the original method above can be deprecated.
857 */ 859 */
858 static bool launch(Display display, String fileName) { 860 static bool launch (Display display, String fileName) {
859 if (fileName is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); 861 if (fileName is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
860 switch(getDesktop(display)) { 862 switch (getDesktop (display)) {
861 case DESKTOP_GNOME_24: 863 case DESKTOP_GNOME_24:
862 if (gnome_24_launch (fileName)) return true; 864 if (gnome_24_launch (fileName)) return true;
863 default: 865 default:
864 int index = fileName.lastIndexOf('.'); 866 int index = fileName.lastIndexOf ('.');
865 if (index !is -1) { 867 if (index !is -1) {
866 String extension = fileName.substring (index); 868 String extension = fileName.substring (index);
867 Program program = Program.findProgram (display, extension); 869 Program program = Program.findProgram (display, extension);
870 if (program !is null && program.execute (fileName)) return true;
871 }
872 String lowercaseName = fileName.toLowerCase ();
873 if (lowercaseName.startsWith (PREFIX_HTTP) || lowercaseName.startsWith (PREFIX_HTTPS)) {
874 Program program = Program.findProgram (display, ".html"); //$NON-NLS-1$
875 if (program is null) {
876 program = Program.findProgram (display, ".htm"); //$NON-NLS-1$
877 }
868 if (program !is null && program.execute (fileName)) return true; 878 if (program !is null && program.execute (fileName)) return true;
869 } 879 }
870 break; 880 break;
871 } 881 }
872 try { 882 try {