Changeset 9d2ae5


Ignore:
Timestamp:
Aug 17, 2018, 3:47:49 PM (2 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
f29e9b
Parents:
8e8ffa
Message:

replaced filepicker and nsILocalFile

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content/prefDialog/vI_prefDialog.js

    r8e8ffa r9d2ae5  
    9292        filePicker.init(window, "", Components.interfaces.nsIFilePicker.modeSave);
    9393
    94         if (filePicker.show() != Components.interfaces.nsIFilePicker.returnCancel) {
     94        if (this._pickerShow(filePicker) != Components.interfaces.nsIFilePicker.returnCancel) {
    9595          if (filePicker.file.parent.path == defaultPath)
    9696            document.getElementById(elementID).setAttribute("value", filePicker.file.leafName);
     
    9898            document.getElementById(elementID).setAttribute("value", filePicker.file.path);
    9999        }
     100      },
     101     
     102      _pickerShow: function (fp) {
     103        let done = false;
     104        let rv, result;
     105        fp.open(result => {
     106          rv = result;
     107          done = true;
     108        });
     109        let thread = Components.classes["@mozilla.org/thread-manager;1"]
     110                              .getService().currentThread;
     111        while (!done) {
     112          thread.processNextEvent(true);
     113        }
     114        return rv;
    100115      },
    101116
  • modules/vI_rdfDatasource.js

    r8e8ffa r9d2ae5  
    4242};
    4343
    44 function initWithFilePath_tryDelimiters(_nsILocalFile, path, filename) {
     44function initWithFilePath_tryDelimiters(_nsIFile, path, filename) {
    4545  try {
    4646    Log.debug("Filename try linux delimiter: '" + path + "/" + filename + "'");
    47     _nsILocalFile.initWithPath(path + "/" + filename);
     47    _nsIFile.initWithPath(path + "/" + filename);
    4848  } catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) {
    4949    try {
    5050      Log.debug("Filename try windows delimiter: '" + path + "\\" + filename + "'");
    51       _nsILocalFile.initWithPath(path + "\\" + filename);
     51      _nsIFile.initWithPath(path + "\\" + filename);
    5252    } catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) {
    5353      Log.debug("Filename not valid: '" + path + "[\\/]" + filename + "'");
     
    151151      .getService(Components.interfaces.nsIFileProtocolHandler)
    152152    var newFile = Components.classes["@mozilla.org/file/local;1"]
    153       .createInstance(Components.interfaces.nsILocalFile);
     153      .createInstance(Components.interfaces.nsIFile);
    154154
    155155    var file = Components.classes["@mozilla.org/file/directory_service;1"]
     
    622622    filePicker.appendFilter("RDF Files", "*.rdf");
    623623
    624     if (filePicker.show() != Components.interfaces.nsIFilePicker.returnCancel) {
     624    if (this._pickerShow(filePicker) != Components.interfaces.nsIFilePicker.returnCancel) {
    625625      var rdfDataFile = Components.classes["@mozilla.org/file/local;1"]
    626         .createInstance(Components.interfaces.nsILocalFile);
     626        .createInstance(Components.interfaces.nsIFile);
    627627      var file = Components.classes["@mozilla.org/file/directory_service;1"]
    628628        .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
     
    633633  },
    634634
     635  _pickerShow: function (fp) {
     636    let done = false;
     637    let rv, result;
     638    fp.open(result => {
     639      rv = result;
     640      done = true;
     641    });
     642    let thread = Components.classes["@mozilla.org/thread-manager;1"]
     643                          .getService().currentThread;
     644    while (!done) {
     645      thread.processNextEvent(true);
     646    }
     647    return rv;
     648  },
     649 
    635650  _getRDFResourceForVIdentity: function (recDescription, recType) {
    636651    if (!this._rdfDataSource) return null;
     
    12381253    filePicker.appendFilters(Components.interfaces.nsIFilePicker.filterText | Components.interfaces.nsIFilePicker.filterAll);
    12391254
    1240     if (filePicker.show() == Components.interfaces.nsIFilePicker.returnOK) {
     1255    if (this._pickerShow(filePicker) == Components.interfaces.nsIFilePicker.returnOK) {
    12411256      Log.debug("import: preparation:");
    12421257
    12431258      var importRdfDataFile = Components.classes["@mozilla.org/file/local;1"]
    1244         .createInstance(Components.interfaces.nsILocalFile);
     1259        .createInstance(Components.interfaces.nsIFile);
    12451260      var file = Components.classes["@mozilla.org/file/directory_service;1"]
    12461261        .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
     
    13111326      Log.debug("IMPORT DONE.");
    13121327    }
     1328  },
     1329 
     1330  _pickerShow: function (fp) {
     1331    let done = false;
     1332    let rv, result;
     1333    fp.open(result => {
     1334      rv = result;
     1335      done = true;
     1336    });
     1337    let thread = Components.classes["@mozilla.org/thread-manager;1"]
     1338                          .getService().currentThread;
     1339    while (!done) {
     1340      thread.processNextEvent(true);
     1341    }
     1342    return rv;
    13131343  }
    13141344}
Note: See TracChangeset for help on using the changeset viewer.