Ignore:
Timestamp:
2004-01-16T16:04:59+13:00 (20 years ago)
Author:
jmt12
Message:

Heres a bunch of other changed files. If it wasn't a Friday afternoon I might be bothered finding out what I actually changed in them. Such changes include: a new option or three on preferences, a bug fix for the GDM classes, several changes to CDM to allow for G2.39 configuration files, a fix to Codec to allow for quotes in format strings and more work on CommandTokenizer to allow for stupid, stupid, stupid collectionextra's starting with speech marks then a new line. Plus other stuff. And things. Peace Out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java

    r6314 r6539  
    105105
    106106    public String getBrowserCommand(String url) {
    107     String command = null;
     107    System.err.println("Get browser command: " + url);
     108    // First off we try to retrieve one from the configuration
     109    String command = Gatherer.config.getPreviewCommand();
     110    // If that worked, substitute in the url and return
     111    if(command != null && command.length() > 0) {
     112        command = command.replaceAll("%1", url);
     113        System.err.println("Result = " + command);
     114        return command;
     115    }
     116    // Failing that we have to prompt the user for what they want to do, but we do our best to provide a sensible default (if available).
     117    // For windows we can have a pretty good guess
    108118    if(Utility.isWindows()) {
    109119        // we use cmd and start
     
    113123        command = StaticStrings.WIN_OPEN_COMMAND;//"cmd.exe /c start \"\" \""+url+"\"";
    114124        }
    115         command = command.replaceAll(FILENAME_ARG, url);
    116         return command;
    117     }
     125    }
     126
     127    // Now prompt the user
     128    FileAssociationDialog dialog = new FileAssociationDialog(this);
     129    command = dialog.display(true, command);
     130    dialog.dispose();
     131    dialog = null;
     132
     133    // Store the result if any
     134    if(command != null) {
     135        Gatherer.config.setPreviewCommand(command);
     136    }
     137
    118138    // for now uder linux get the fileassoc thing. but eventually want a separate thing.
    119     // pretend we are tyring to open an html file
     139    // pretend we are trying to open an html file
    120140    // Mmmoooo. - jmt12
     141    /*
    121142    String extension = "html";
    122143    Element entry = getCommand(extension);
     
    140161        MSMUtils.setValue(entry, command.replaceAll("temp.html", FILENAME_ARG));
    141162    }
    142    
     163    */
    143164    // if we haven't got a command by now, we'll never get one
    144     if (command == null) return null;
     165    if (command == null) {
     166        System.err.println("Result = " + command);
     167        return null;
     168    }
    145169    // Replace %1 with the url in quotes
    146170    command = command.replaceAll(FILENAME_ARG, url);
     171    System.err.println("Result = " + command);
    147172    return command;
    148173    }
Note: See TracChangeset for help on using the changeset viewer.