From a01da841e512f6bf32e903500d2ef6fb99dc032f Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 13 Feb 2003 19:00:08 +0000 Subject: [PATCH] Changing from default action to a different one should work (didn't if the default was "save"). Bug 193054, r=pkw@us.ibm.com, sr=mscott, a=asa --- .../ui/helperAppDlg/nsHelperAppDlg.js | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/embedding/components/ui/helperAppDlg/nsHelperAppDlg.js b/embedding/components/ui/helperAppDlg/nsHelperAppDlg.js index 20b5d2dcb867..4eb1ef5e34d4 100644 --- a/embedding/components/ui/helperAppDlg/nsHelperAppDlg.js +++ b/embedding/components/ui/helperAppDlg/nsHelperAppDlg.js @@ -515,9 +515,7 @@ nsHelperAppDialog.prototype = { return this.helperAppChoice() != this.mLauncher.MIMEInfo.preferredApplicationHandler; }, - // See if the user changed things, and if so, update the - // mimeTypes.rdf entry for this mime type. - updateHelperAppPref: function() { + updateMIMEInfo: function() { var needUpdate = false; // If current selection differs from what's in the mime info object, // then we need to update. @@ -554,16 +552,20 @@ nsHelperAppDialog.prototype = { // Make sure mime info has updated setting for the "always ask" flag. this.mLauncher.MIMEInfo.alwaysAskBeforeHandling = this.dialogElement( "alwaysAskMe" ).checked; - - if ( needUpdate ) { - // We update by passing this mime info into the "Edit Type" helper app - // pref dialog. It will update the data source and close the dialog - // automatically. - this.mDialog.openDialog( "chrome://communicator/content/pref/pref-applications-edit.xul", - "_blank", - "chrome,modal=yes,resizable=no", - this ); - } + + return needUpdate; + }, + + // See if the user changed things, and if so, update the + // mimeTypes.rdf entry for this mime type. + updateHelperAppPref: function() { + // We update by passing this mime info into the "Edit Type" helper app + // pref dialog. It will update the data source and close the dialog + // automatically. + this.mDialog.openDialog( "chrome://communicator/content/pref/pref-applications-edit.xul", + "_blank", + "chrome,modal=yes,resizable=no", + this ); }, // onOK: @@ -601,6 +603,7 @@ nsHelperAppDialog.prototype = { // "Save to Disk" dialog. In those cases, we don't want to // update the helper application preferences in the RDF file. try { + var needUpdate = this.updateMIMEInfo(); if ( this.dialogElement( "saveToDisk" ).selected ) this.mLauncher.saveToDisk( null, false ); else @@ -609,8 +612,10 @@ nsHelperAppDialog.prototype = { // Update user pref for this mime type (if necessary). We do not // store anything in the mime type preferences for the ambiguous // type application/octet-stream. - if ( this.mLauncher.MIMEInfo.MIMEType != "application/octet-stream" ) + if ( needUpdate && + this.mLauncher.MIMEInfo.MIMEType != "application/octet-stream" ) { this.updateHelperAppPref(); + } } catch(e) { }