mozilla-kde.patch
changeset 934 b61e849fe451
parent 932 a58cc7936ce7
child 935 9ae2b79d3bb1
equal deleted inserted replaced
923:3cc9f17ca9bb 934:b61e849fe451
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  972c67cdd5dd4463abbee60036b686d4cb78e616
     2 # Parent  6ff55468281e12a84adefb46b17acb60d9cea608
     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
    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 @@ -1145,16 +1146,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
    30 @@ -1180,16 +1181,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 @@ -1170,17 +1189,17 @@ static nsresult pref_LoadPrefsInDirList(
    65 @@ -1205,17 +1224,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 @@ -1274,24 +1293,36 @@ static nsresult pref_InitInitialObjects(
    84 @@ -1309,24 +1328,36 @@ static nsresult 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)
   139  FINAL_LIBRARY = 'xul'
   139  FINAL_LIBRARY = 'xul'
   140  
   140  
   141  DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
   141  DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
   142  DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
   142  DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
   143  
   143  
   144  if CONFIG['GNU_CXX']:
   144  FINAL_TARGET_PP_FILES += [
   145 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
   145 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
   146 --- a/python/mozbuild/mozpack/chrome/flags.py
   146 --- a/python/mozbuild/mozpack/chrome/flags.py
   147 +++ b/python/mozbuild/mozpack/chrome/flags.py
   147 +++ b/python/mozbuild/mozpack/chrome/flags.py
   148 @@ -211,16 +211,17 @@ class Flags(OrderedDict):
   148 @@ -211,16 +211,17 @@ class Flags(OrderedDict):
   149          'contentaccessible': Flag,
   149          'contentaccessible': Flag,
   185          self.base = base
   185          self.base = base
   186          self.flags = Flags(*flags)
   186          self.flags = Flags(*flags)
   187 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
   187 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
   188 --- a/toolkit/components/downloads/moz.build
   188 --- a/toolkit/components/downloads/moz.build
   189 +++ b/toolkit/components/downloads/moz.build
   189 +++ b/toolkit/components/downloads/moz.build
   190 @@ -60,15 +60,16 @@ if not CONFIG['MOZ_SUITE']:
   190 @@ -60,17 +60,18 @@ if not CONFIG['MOZ_SUITE']:
   191          'nsDownloadManagerUI.js',
   191          'nsDownloadManagerUI.js',
   192          'nsDownloadManagerUI.manifest',
   192          'nsDownloadManagerUI.manifest',
   193      ]
   193      ]
   194  
   194  
   195  FINAL_LIBRARY = 'xul'
   195  FINAL_LIBRARY = 'xul'
   203  
   203  
   204  DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
   204  DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
   205  DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
   205  DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
   206  
   206  
   207  CXXFLAGS += CONFIG['TK_CFLAGS']
   207  CXXFLAGS += CONFIG['TK_CFLAGS']
       
   208  
       
   209  if CONFIG['GNU_CXX']:
   208 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
   210 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
   209 --- a/toolkit/components/downloads/nsDownloadManager.cpp
   211 --- a/toolkit/components/downloads/nsDownloadManager.cpp
   210 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
   212 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
   211 @@ -51,16 +51,20 @@
   213 @@ -51,16 +51,20 @@
   212  #ifdef XP_WIN
   214  #ifdef XP_WIN
   224  #ifdef XP_MACOSX
   226  #ifdef XP_MACOSX
   225  #include <CoreFoundation/CoreFoundation.h>
   227  #include <CoreFoundation/CoreFoundation.h>
   226  #endif
   228  #endif
   227  
   229  
   228  #ifdef MOZ_WIDGET_ANDROID
   230  #ifdef MOZ_WIDGET_ANDROID
   229  #include "AndroidBridge.h"
   231  #include "GeneratedJNIWrappers.h"
   230  #endif
   232  #endif
   231  
   233  
   232 @@ -2719,16 +2723,25 @@ nsDownload::SetState(DownloadState aStat
   234 @@ -2719,16 +2723,25 @@ nsDownload::SetState(DownloadState aStat
   233        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
   235        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
   234  
   236  
   274        if (fileURL &&
   276        if (fileURL &&
   275            NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
   277            NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
   276 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   278 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   277 --- a/toolkit/content/jar.mn
   279 --- a/toolkit/content/jar.mn
   278 +++ b/toolkit/content/jar.mn
   280 +++ b/toolkit/content/jar.mn
   279 @@ -72,29 +72,33 @@ toolkit.jar:
   281 @@ -67,29 +67,33 @@ toolkit.jar:
   280     content/global/viewZoomOverlay.js
   282     content/global/viewZoomOverlay.js
   281     content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
   283     content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
   282     content/global/bindings/browser.xml         (widgets/browser.xml)
   284     content/global/bindings/browser.xml         (widgets/browser.xml)
   283     content/global/bindings/button.xml          (widgets/button.xml)
   285     content/global/bindings/button.xml          (widgets/button.xml)
   284     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   286     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   780 +</bindings>
   782 +</bindings>
   781 diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml
   783 diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml
   782 new file mode 100644
   784 new file mode 100644
   783 --- /dev/null
   785 --- /dev/null
   784 +++ b/toolkit/content/widgets/preferences-kde.xml
   786 +++ b/toolkit/content/widgets/preferences-kde.xml
   785 @@ -0,0 +1,1408 @@
   787 @@ -0,0 +1,1410 @@
   786 +<?xml version="1.0"?>
   788 +<?xml version="1.0"?>
   787 +
   789 +
   788 +<!DOCTYPE bindings [
   790 +<!DOCTYPE bindings [
   789 +  <!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
   791 +  <!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
   790 +  %preferencesDTD;
   792 +  %preferencesDTD;
   950 +            .removeObserver(this.name, this.preferences);
   952 +            .removeObserver(this.name, this.preferences);
   951 +      </destructor>
   953 +      </destructor>
   952 +      <field name="_constructed">false</field>
   954 +      <field name="_constructed">false</field>
   953 +      <property name="instantApply">
   955 +      <property name="instantApply">
   954 +        <getter>
   956 +        <getter>
       
   957 +          if (this.getAttribute("instantApply") == "false")
       
   958 +            return false;
   955 +          return this.getAttribute("instantApply") == "true" || this.preferences.instantApply;
   959 +          return this.getAttribute("instantApply") == "true" || this.preferences.instantApply;
   956 +        </getter>
   960 +        </getter>
   957 +      </property>
   961 +      </property>
   958 +
   962 +
   959 +      <property name="preferences" onget="return this.parentNode"/>
   963 +      <property name="preferences" onget="return this.parentNode"/>
  2286 +}
  2290 +}
  2287 +
  2291 +
  2288 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
  2292 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
  2289 --- a/toolkit/xre/moz.build
  2293 --- a/toolkit/xre/moz.build
  2290 +++ b/toolkit/xre/moz.build
  2294 +++ b/toolkit/xre/moz.build
  2291 @@ -48,17 +48,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
  2295 @@ -39,17 +39,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
  2292  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
  2296          'updaterfileutils_osx.mm',
  2293      EXPORTS += ['nsQAppInstance.h']
  2297      ]
  2294      SOURCES += [
  2298  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
  2295          '!moc_nsNativeAppSupportQt.cpp',
  2299      UNIFIED_SOURCES += [
  2296          'nsNativeAppSupportQt.cpp',
  2300          'nsNativeAppSupportDefault.cpp',
  2297          'nsQAppInstance.cpp',
  2301          'UIKitDirProvider.mm',
  2298      ]
  2302      ]
  2299  elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2303  elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2300 +    EXPORTS += ['nsKDEUtils.h']
  2304 +    EXPORTS += ['nsKDEUtils.h']
  2301      UNIFIED_SOURCES += [
  2305      UNIFIED_SOURCES += [
  2302 +        'nsKDEUtils.cpp',
  2306 +        'nsKDEUtils.cpp',
  2706 +
  2710 +
  2707 +#endif // nsKDEUtils
  2711 +#endif // nsKDEUtils
  2708 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  2712 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  2709 --- a/uriloader/exthandler/moz.build
  2713 --- a/uriloader/exthandler/moz.build
  2710 +++ b/uriloader/exthandler/moz.build
  2714 +++ b/uriloader/exthandler/moz.build
  2711 @@ -75,17 +75,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
  2715 @@ -77,17 +77,19 @@ else:
  2712  else:
       
  2713      # These files can't be built in unified mode because they redefine LOG.
       
  2714      SOURCES += [
  2716      SOURCES += [
  2715          osdir + '/nsOSHelperAppService.cpp',
  2717          osdir + '/nsOSHelperAppService.cpp',
  2716      ]
  2718      ]
       
  2719      if CONFIG['GNU_CXX']:
       
  2720          CXXFLAGS += ['-Wno-error=shadow']
  2717  
  2721  
  2718  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2722  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2719      UNIFIED_SOURCES += [
  2723      UNIFIED_SOURCES += [
  2720 +        'unix/nsCommonRegistry.cpp',
  2724 +        'unix/nsCommonRegistry.cpp',
  2721          'unix/nsGNOMERegistry.cpp',
  2725          'unix/nsGNOMERegistry.cpp',
  2722 +        'unix/nsKDERegistry.cpp',
  2726 +	'unix/nsKDERegistry.cpp',
  2723          'unix/nsMIMEInfoUnix.cpp',
  2727          'unix/nsMIMEInfoUnix.cpp',
  2724      ]
  2728      ]
  2725  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
  2729  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
  2726      UNIFIED_SOURCES += [
  2730      UNIFIED_SOURCES += [
  2727          'android/nsAndroidHandlerApp.cpp',
  2731          'android/nsAndroidHandlerApp.cpp',
  2728          'android/nsExternalSharingAppService.cpp',
  2732          'android/nsExternalSharingAppService.cpp',
  2729          'android/nsExternalURLHandlerService.cpp',
  2733          'android/nsExternalURLHandlerService.cpp',
  2730          'android/nsMIMEInfoAndroid.cpp',
  2734          'android/nsMIMEInfoAndroid.cpp',
  2731 @@ -129,16 +131,17 @@ include('/ipc/chromium/chromium-config.m
  2735 @@ -123,16 +125,17 @@ include('/ipc/chromium/chromium-config.m
  2732  
  2736  
  2733  FINAL_LIBRARY = 'xul'
  2737  FINAL_LIBRARY = 'xul'
  2734  
  2738  
  2735  LOCAL_INCLUDES += [
  2739  LOCAL_INCLUDES += [
  2736      '/dom/base',
  2740      '/dom/base',
  2742  
  2746  
  2743  if CONFIG['MOZ_ENABLE_DBUS']:
  2747  if CONFIG['MOZ_ENABLE_DBUS']:
  2744      CXXFLAGS += CONFIG['TK_CFLAGS']
  2748      CXXFLAGS += CONFIG['TK_CFLAGS']
  2745      CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
  2749      CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
  2746  
  2750  
  2747  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3'):
  2751  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
  2748      CXXFLAGS += CONFIG['TK_CFLAGS']
  2752      CXXFLAGS += CONFIG['TK_CFLAGS']
  2749 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  2753 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  2750 new file mode 100644
  2754 new file mode 100644
  2751 --- /dev/null
  2755 --- /dev/null
  2752 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  2756 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  2970 +
  2974 +
  2971 +#endif //nsKDERegistry_h__
  2975 +#endif //nsKDERegistry_h__
  2972 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2976 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2973 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2977 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2974 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2978 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2975 @@ -7,32 +7,35 @@
  2979 @@ -1,50 +1,53 @@
  2976  #ifdef MOZ_WIDGET_QT
  2980  /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2977  #if (MOZ_ENABLE_CONTENTACTION)
  2981   *
  2978  #include <contentaction/contentaction.h>
  2982   * This Source Code Form is subject to the terms of the Mozilla Public
  2979  #include "nsContentHandlerApp.h"
  2983   * License, v. 2.0. If a copy of the MPL was not distributed with this
  2980  #endif
  2984   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  2981  #endif
       
  2982  
  2985  
  2983  #include "nsMIMEInfoUnix.h"
  2986  #include "nsMIMEInfoUnix.h"
  2984 -#include "nsGNOMERegistry.h"
  2987 -#include "nsGNOMERegistry.h"
  2985 +#include "nsCommonRegistry.h"
  2988 +#include "nsCommonRegistry.h"
  2986  #include "nsIGIOService.h"
  2989  #include "nsIGIOService.h"
  2988  #include "nsIIOService.h"
  2991  #include "nsIIOService.h"
  2989  #include "nsAutoPtr.h"
  2992  #include "nsAutoPtr.h"
  2990  #ifdef MOZ_ENABLE_DBUS
  2993  #ifdef MOZ_ENABLE_DBUS
  2991  #include "nsDBusHandlerApp.h"
  2994  #include "nsDBusHandlerApp.h"
  2992  #endif
  2995  #endif
  2993  #ifdef MOZ_WIDGET_QT
       
  2994  #include "nsMIMEInfoQt.h"
       
  2995  #endif
       
  2996 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  2996 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  2997 +#include "nsKDEUtils.h"
  2997 +#include "nsKDEUtils.h"
  2998 +#endif
  2998 +#endif
  2999  
  2999  
  3000  nsresult
  3000  nsresult
  3001  nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
  3001  nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
  3002  {
  3002  {
  3003 -  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
  3003 -  return nsGNOMERegistry::LoadURL(aURI);
  3004 +  nsresult rv = nsCommonRegistry::LoadURL(aURI);
  3004 +  return nsCommonRegistry::LoadURL(aURI);
  3005  
  3005  }
  3006  #ifdef MOZ_WIDGET_QT
  3006  
  3007    if (NS_FAILED(rv)) {
  3007  NS_IMETHODIMP
  3008      rv = nsMIMEInfoQt::LoadUriInternal(aURI);
  3008  nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval)
  3009    }
  3009  {
  3010  #endif
  3010    // if mDefaultApplication is set, it means the application has been set from
  3011  
       
  3012    return rv;
       
  3013 @@ -45,24 +48,24 @@ nsMIMEInfoUnix::GetHasDefaultHandler(boo
       
  3014    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  3011    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  3015    // give the GNOME answer.
  3012    // give the GNOME answer.
  3016    if (mDefaultApplication)
  3013    if (mDefaultApplication)
  3017      return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
  3014      return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
  3018  
  3015  
  3036        *_retval = true;
  3033        *_retval = true;
  3037    }
  3034    }
  3038  
  3035  
  3039    if (*_retval)
  3036    if (*_retval)
  3040      return NS_OK;
  3037      return NS_OK;
  3041 @@ -97,16 +100,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
  3038 @@ -79,16 +82,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
  3042      ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get()));
  3039      ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get()));
  3043    if (action.isValid()) {
  3040    if (action.isValid()) {
  3044      action.trigger();
  3041      action.trigger();
  3045      return NS_OK;
  3042      return NS_OK;
  3046    }
  3043    }
  3271  
  3268  
  3272    GtkWindow *parent_widget =
  3269    GtkWindow *parent_widget =
  3273      GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  3270      GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  3274  
  3271  
  3275    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  3272    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  3276    const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
  3273  
  3277 @@ -595,8 +615,235 @@ nsFilePicker::Done(GtkWidget* file_choos
  3274 @@ -603,8 +623,235 @@ nsFilePicker::Done(GtkWidget* file_choos
  3278    if (mCallback) {
  3275    if (mCallback) {
  3279      mCallback->Done(result);
  3276      mCallback->Done(result);
  3280      mCallback = nullptr;
  3277      mCallback = nullptr;
  3281    } else {
  3278    } else {
  3282      mResult = result;
  3279      mResult = result;
  3586  #if defined(XP_WIN)
  3583  #if defined(XP_WIN)
  3587  #pragma warning(push)
  3584  #pragma warning(push)
  3588  #pragma warning(disable:4996) // VC12+ deprecates GetVersionEx
  3585  #pragma warning(disable:4996) // VC12+ deprecates GetVersionEx
  3589    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
  3586    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
  3590    if (GetVersionEx(&info)) {
  3587    if (GetVersionEx(&info)) {
  3591      nsTextFormatter::ssprintf(osVersion, MOZ_UTF16("%ld.%ld"),
  3588      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  3592                                info.dwMajorVersion,
  3589                                info.dwMajorVersion,
  3593                                info.dwMinorVersion);
  3590                                info.dwMinorVersion);
  3594    }
  3591    }
  3595 +  desktop = NS_LITERAL_STRING("win");
  3592 +  desktop = NS_LITERAL_STRING("win");
  3596  #pragma warning(pop)
  3593  #pragma warning(pop)
  3597  #elif defined(MOZ_WIDGET_COCOA)
  3594  #elif defined(MOZ_WIDGET_COCOA)
  3598    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
  3595    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
  3599    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
  3596    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
  3600    nsTextFormatter::ssprintf(osVersion, MOZ_UTF16("%ld.%ld"),
  3597    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  3601                              majorVersion,
  3598                              majorVersion,
  3602                              minorVersion);
  3599                              minorVersion);
  3603 +  desktop = NS_LITERAL_STRING("macosx");
  3600 +  desktop = NS_LITERAL_STRING("macosx");
  3604  #elif defined(MOZ_WIDGET_GTK)
  3601  #elif defined(MOZ_WIDGET_GTK)
  3605    nsTextFormatter::ssprintf(osVersion, MOZ_UTF16("%ld.%ld"),
  3602    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  3606                              gtk_major_version,
  3603                              gtk_major_version,
  3607                              gtk_minor_version);
  3604                              gtk_minor_version);
  3608 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
  3605 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
  3609  #elif defined(MOZ_WIDGET_ANDROID)
  3606  #elif defined(MOZ_WIDGET_ANDROID)
  3610    bool isTablet = false;
  3607    bool isTablet = false;
  3611    if (mozilla::AndroidBridge::Bridge()) {
  3608    if (mozilla::AndroidBridge::Bridge()) {
  3612      mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
  3609      mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
  3613                                                             "RELEASE",
  3610                                                             "RELEASE",
  3614                                                             osVersion);
  3611                                                             osVersion);
  3615      isTablet = mozilla::widget::GeckoAppShell::IsTablet();
  3612      isTablet = java::GeckoAppShell::IsTablet();
  3616    }
  3613    }
  3617 +  desktop = NS_LITERAL_STRING("android");
  3614 +  desktop = NS_LITERAL_STRING("android");
  3618  #endif
  3615  #endif
  3619  
  3616  
  3620    if (XRE_IsContentProcess()) {
  3617    if (XRE_IsContentProcess()) {
  3670      }
  3667      }
  3671  
  3668  
  3672 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  3669 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  3673 --- a/xpcom/components/moz.build
  3670 --- a/xpcom/components/moz.build
  3674 +++ b/xpcom/components/moz.build
  3671 +++ b/xpcom/components/moz.build
  3675 @@ -47,12 +47,13 @@ FINAL_LIBRARY = 'xul'
  3672 @@ -44,12 +44,13 @@ FINAL_LIBRARY = 'xul'
  3676  LOCAL_INCLUDES += [
  3673  LOCAL_INCLUDES += [
  3677      '!..',
  3674      '!..',
  3678      '../base',
  3675      '../base',
  3679      '../build',
  3676      '../build',
  3680      '../ds',
  3677      '../ds',