mozilla-kde.patch
changeset 994 9fc447b00040
parent 985 038d048a3940
child 999 932b3ad009d5
equal deleted inserted replaced
993:c360e9aac24a 994:9fc447b00040
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  172cd661ceed38b3161c6246f6729f4d8370dce3
     2 # Parent  faadbf89d1cb02eefec4c5dfd3ab86bc20d815d5
     3 Description: Add KDE integration to Firefox (toolkit parts)
     3 Description: Add KDE integration to Firefox (toolkit parts)
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     5 Author: Lubos Lunak <lunak@suse.com>
     5 Author: Lubos Lunak <lunak@suse.com>
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
     8 
     8 
     9 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
     9 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
    10 --- a/modules/libpref/Preferences.cpp
    10 --- a/modules/libpref/Preferences.cpp
    11 +++ b/modules/libpref/Preferences.cpp
    11 +++ b/modules/libpref/Preferences.cpp
    12 @@ -32,16 +32,17 @@
    12 @@ -33,16 +33,17 @@
    13  #include "nsIZipReader.h"
    13  #include "nsIZipReader.h"
    14  #include "nsPrefBranch.h"
    14  #include "nsPrefBranch.h"
    15  #include "nsXPIDLString.h"
    15  #include "nsXPIDLString.h"
    16  #include "nsCRT.h"
    16  #include "nsCRT.h"
    17  #include "nsCOMArray.h"
    17  #include "nsCOMArray.h"
    25  
    25  
    26  #include "prefapi.h"
    26  #include "prefapi.h"
    27  #include "prefread.h"
    27  #include "prefread.h"
    28  #include "prefapi_private_data.h"
    28  #include "prefapi_private_data.h"
    29  
    29  
    30 @@ -1219,16 +1220,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
    30 @@ -1435,16 +1436,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
    31  
    31  
    32  static nsresult pref_LoadPrefsInDirList(const char *listId)
    32  static nsresult pref_LoadPrefsInDirList(const char *listId)
    33  {
    33  {
    34    nsresult rv;
    34    nsresult rv;
    35    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
    35    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
    60                getter_AddRefs(list));
    60                getter_AddRefs(list));
    61    if (!list)
    61    if (!list)
    62      return NS_OK;
    62      return NS_OK;
    63  
    63  
    64    bool hasMore;
    64    bool hasMore;
    65 @@ -1244,17 +1263,17 @@ static nsresult pref_LoadPrefsInDirList(
    65 @@ -1460,17 +1479,17 @@ static nsresult pref_LoadPrefsInDirList(
    66  
    66  
    67      nsAutoCString leaf;
    67      nsAutoCString leaf;
    68      path->GetNativeLeafName(leaf);
    68      path->GetNativeLeafName(leaf);
    69  
    69  
    70      // Do we care if a file provided by this process fails to load?
    70      // Do we care if a file provided by this process fails to load?
    79  
    79  
    80  static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
    80  static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
    81  {
    81  {
    82    nsZipItemPtr<char> manifest(jarReader, name, true);
    82    nsZipItemPtr<char> manifest(jarReader, name, true);
    83    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
    83    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
    84 @@ -1348,24 +1367,36 @@ static nsresult pref_InitInitialObjects(
    84 @@ -1566,24 +1585,36 @@ pref_InitInitialObjects()
    85    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    85    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    86    static const char* specialFiles[] = {
    86    static const char* specialFiles[] = {
    87  #if defined(XP_MACOSX)
    87  #if defined(XP_MACOSX)
    88      "macprefs.js"
    88      "macprefs.js"
    89  #elif defined(XP_WIN)
    89  #elif defined(XP_WIN)
   704 +</bindings>
   704 +</bindings>
   705 diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml
   705 diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml
   706 new file mode 100644
   706 new file mode 100644
   707 --- /dev/null
   707 --- /dev/null
   708 +++ b/toolkit/content/widgets/preferences-kde.xml
   708 +++ b/toolkit/content/widgets/preferences-kde.xml
   709 @@ -0,0 +1,1380 @@
   709 @@ -0,0 +1,1409 @@
   710 +<?xml version="1.0"?>
   710 +<?xml version="1.0"?>
   711 +
   711 +
   712 +<!DOCTYPE bindings [
   712 +<!DOCTYPE bindings [
   713 +  <!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
   713 +  <!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
   714 +  %preferencesDTD;
   714 +  %preferencesDTD;
   740 +  <binding id="preferences">
   740 +  <binding id="preferences">
   741 +    <implementation implements="nsIObserver">
   741 +    <implementation implements="nsIObserver">
   742 +      <method name="_constructAfterChildren">
   742 +      <method name="_constructAfterChildren">
   743 +      <body>
   743 +      <body>
   744 +      <![CDATA[
   744 +      <![CDATA[
   745 +      // This method will be called after each one of the child
   745 +      // This method will be called after the last of the child
   746 +      // <preference> elements is constructed. Its purpose is to propagate
   746 +      // <preference> elements is constructed. Its purpose is to propagate
   747 +      // the values to the associated form elements
   747 +      // the values to the associated form elements. Sometimes the code for
       
   748 +      // some <preference> initializers depend on other <preference> elements
       
   749 +      // being initialized so we wait and call updateElements on all of them
       
   750 +      // once the last one has been constructed. See bugs 997570 and 992185.
   748 +
   751 +
   749 +      var elements = this.getElementsByTagName("preference");
   752 +      var elements = this.getElementsByTagName("preference");
   750 +      for (let element of elements) {
       
   751 +        if (!element._constructed) {
       
   752 +          return;
       
   753 +        }
       
   754 +      }
       
   755 +      for (let element of elements) {
   753 +      for (let element of elements) {
   756 +        element.updateElements();
   754 +        element.updateElements();
   757 +      }
   755 +      }
       
   756 +
       
   757 +      this._constructAfterChildrenCalled = true;
   758 +      ]]>
   758 +      ]]>
   759 +      </body>
   759 +      </body>
   760 +      </method>
   760 +      </method>
   761 +      <method name="observe">
   761 +      <method name="observe">
   762 +        <parameter name="aSubject"/>
   762 +        <parameter name="aSubject"/>
   819 +            return this.type == "child" ? doc.instantApply
   819 +            return this.type == "child" ? doc.instantApply
   820 +                                        : doc.instantApply || this.rootBranch.getBoolPref("browser.preferences.instantApply");
   820 +                                        : doc.instantApply || this.rootBranch.getBoolPref("browser.preferences.instantApply");
   821 +          ]]>
   821 +          ]]>
   822 +        </getter>
   822 +        </getter>
   823 +      </property>
   823 +      </property>
       
   824 +
       
   825 +      <!-- We want to call _constructAfterChildren after all child
       
   826 +           <preference> elements have been constructed. To do this, we get
       
   827 +           and store the node list of all child <preference> elements in the
       
   828 +           constructor, and maintain a count which is incremented in the
       
   829 +           constructor of <preference>. _constructAfterChildren is called
       
   830 +           when the count matches the length of the list. -->
       
   831 +      <field name="_constructedChildrenCount">0</field>
       
   832 +      <field name="_preferenceChildren">null</field>
       
   833 +      <!-- Some <preference> elements are added dynamically after
       
   834 +           _constructAfterChildren has already been called - we want to
       
   835 +           avoid looping over all of them again in this case so we remember
       
   836 +           if we already called it. -->
       
   837 +      <field name="_constructAfterChildrenCalled">false</field>
       
   838 +      <constructor>
       
   839 +      <![CDATA[
       
   840 +        this._preferenceChildren = this.getElementsByTagName("preference");
       
   841 +      ]]>
       
   842 +      </constructor>
   824 +    </implementation>
   843 +    </implementation>
   825 +  </binding>
   844 +  </binding>
   826 +
   845 +
   827 +  <binding id="preference">
   846 +  <binding id="preference">
   828 +    <implementation>
   847 +    <implementation>
   829 +      <constructor>
   848 +      <constructor>
   830 +      <![CDATA[
   849 +      <![CDATA[
   831 +        this._constructed = true;
       
   832 +
       
   833 +        // if the element has been inserted without the name attribute set,
   850 +        // if the element has been inserted without the name attribute set,
   834 +        // we have nothing to do here
   851 +        // we have nothing to do here
   835 +        if (!this.name)
   852 +        if (!this.name)
   836 +          return;
   853 +          return;
   837 +
   854 +
   860 +            }
   877 +            }
   861 +          }
   878 +          }
   862 +
   879 +
   863 +          // Don't use the value setter here, we don't want updateElements to be prematurely fired.
   880 +          // Don't use the value setter here, we don't want updateElements to be prematurely fired.
   864 +          this._value = preference ? preference.value : this.valueFromPreferences;
   881 +          this._value = preference ? preference.value : this.valueFromPreferences;
   865 +        } else
   882 +        } else {
   866 +          this._value = this.valueFromPreferences;
   883 +          this._value = this.valueFromPreferences;
   867 +        this.preferences._constructAfterChildren();
   884 +        }
       
   885 +        if (this.preferences._constructAfterChildrenCalled) {
       
   886 +          // This <preference> was added after _constructAfterChildren() was already called.
       
   887 +          // We can directly call updateElements().
       
   888 +          this.updateElements();
       
   889 +          return;
       
   890 +        }
       
   891 +        this.preferences._constructedChildrenCount++;
       
   892 +        if (this.preferences._constructedChildrenCount ==
       
   893 +            this.preferences._preferenceChildren.length) {
       
   894 +          // This is the last <preference>, time to updateElements() on all of them.
       
   895 +          this.preferences._constructAfterChildren();
       
   896 +        }
   868 +      ]]>
   897 +      ]]>
   869 +      </constructor>
   898 +      </constructor>
   870 +      <destructor>
   899 +      <destructor>
   871 +        this.preferences.rootBranchInternal
   900 +        this.preferences.rootBranchInternal
   872 +            .removeObserver(this.name, this.preferences);
   901 +            .removeObserver(this.name, this.preferences);
  2088 +#    PrefWindow I   (June 4, 1999)
  2117 +#    PrefWindow I   (June 4, 1999)
  2089 +#
  2118 +#
  2090 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
  2119 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
  2091 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
  2120 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
  2092 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
  2121 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
  2093 @@ -625,17 +625,17 @@ nsUnknownContentTypeDialog.prototype = {
  2122 @@ -628,17 +628,17 @@ nsUnknownContentTypeDialog.prototype = {
  2094        else
  2123        else
  2095          typeString = mimeInfo.MIMEType;
  2124          typeString = mimeInfo.MIMEType;
  2096      }
  2125      }
  2097      // When the length is unknown, contentLength would be -1
  2126      // When the length is unknown, contentLength would be -1
  2098      if (this.mLauncher.contentLength >= 0) {
  2127      if (this.mLauncher.contentLength >= 0) {
  2107        type.value = typeString;
  2136        type.value = typeString;
  2108      }
  2137      }
  2109    },
  2138    },
  2110  
  2139  
  2111    // Returns true if opening the default application makes sense.
  2140    // Returns true if opening the default application makes sense.
  2112 @@ -799,17 +799,17 @@ nsUnknownContentTypeDialog.prototype = {
  2141 @@ -802,17 +802,17 @@ nsUnknownContentTypeDialog.prototype = {
  2113        switch (this.dialogElement("openHandler").selectedIndex) {
  2142        switch (this.dialogElement("openHandler").selectedIndex) {
  2114        case 0:
  2143        case 0:
  2115          // No app need be specified in this case.
  2144          // No app need be specified in this case.
  2116          ok = true;
  2145          ok = true;
  2117          break;
  2146          break;
  2126  
  2155  
  2127      // Enable Ok button if ok to press.
  2156      // Enable Ok button if ok to press.
  2128      this.mDialog.document.documentElement.getButton("accept").disabled = !ok;
  2157      this.mDialog.document.documentElement.getButton("accept").disabled = !ok;
  2129    },
  2158    },
  2130  
  2159  
  2131 @@ -1066,30 +1066,56 @@ nsUnknownContentTypeDialog.prototype = {
  2160 @@ -1067,30 +1067,57 @@ nsUnknownContentTypeDialog.prototype = {
       
  2161  
       
  2162        if (params.handlerApp &&
  2132            params.handlerApp.executable &&
  2163            params.handlerApp.executable &&
  2133            params.handlerApp.executable.isFile()) {
  2164            params.handlerApp.executable.isFile()) {
  2134          // Remember the file they chose to run.
  2165          // Remember the file they chose to run.
  2135          this.chosenApp = params.handlerApp;
  2166          this.chosenApp = params.handlerApp;
  2136        }
  2167        }
  2137      }
  2168      } else if ("@mozilla.org/applicationchooser;1" in Components.classes) {
  2138      else {
       
  2139  #if MOZ_WIDGET_GTK == 3
       
  2140 -      var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser;
  2169 -      var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser;
  2141 -      var appChooser = Components.classes["@mozilla.org/applicationchooser;1"]
  2170 -      var appChooser = Components.classes["@mozilla.org/applicationchooser;1"]
  2142 -                                 .createInstance(nsIApplicationChooser);
  2171 -                                 .createInstance(nsIApplicationChooser);
  2143 -      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
  2172 -      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
  2144 -      var contentTypeDialogObj = this;
  2173 -      var contentTypeDialogObj = this;
  2145 -      let appChooserCallback = function appChooserCallback_done(aResult) {
  2174 -      let appChooserCallback = function appChooserCallback_done(aResult) {
  2146 -        if (aResult) {
  2175 -        if (aResult) {
  2147 -           contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp);
  2176 -           contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp);
  2148 +      // handle the KDE case which is implemented in the filepicker
  2177 +      // handle the KDE case which is implemented in the filepicker
  2149 +      // therefore falling back to Gtk2 like behaviour if KDE is running
  2178 +      // therefore falling back to Gtk2 like behaviour if KDE is running
  2150 +      // FIXME this should be better handled in the nsIApplicationChooser interface
  2179 +      // FIXME this should be better handled in the nsIApplicationChooser
       
  2180 +      // interface
  2151 +      var env = Components.classes["@mozilla.org/process/environment;1"]
  2181 +      var env = Components.classes["@mozilla.org/process/environment;1"]
  2152 +                          .getService(Components.interfaces.nsIEnvironment);
  2182 +                          .getService(Components.interfaces.nsIEnvironment);
  2153 +      if (env.get('KDE_FULL_SESSION') == "true")
  2183 +      if (env.get('KDE_FULL_SESSION') == "true")
  2154 +      {
  2184 +      {
  2155 +        var nsIFilePicker = Components.interfaces.nsIFilePicker;
  2185 +        var nsIFilePicker = Components.interfaces.nsIFilePicker;
  2188 +        };
  2218 +        };
  2189 +        appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
  2219 +        appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
  2190 +        // The finishChooseApp is called from appChooserCallback
  2220 +        // The finishChooseApp is called from appChooserCallback
  2191 +        return;
  2221 +        return;
  2192 +      }
  2222 +      }
  2193  #else
  2223      } else {
  2194        var nsIFilePicker = Components.interfaces.nsIFilePicker;
  2224        var nsIFilePicker = Components.interfaces.nsIFilePicker;
  2195        var fp = Components.classes["@mozilla.org/filepicker;1"]
  2225        var fp = Components.classes["@mozilla.org/filepicker;1"]
  2196                           .createInstance(nsIFilePicker);
  2226                           .createInstance(nsIFilePicker);
  2197        fp.init(this.mDialog,
  2227        fp.init(this.mDialog,
  2198                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
  2228                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),