diff -r 4b419fce88dc -r 8220ea23b47d mozilla-kde.patch --- a/mozilla-kde.patch Fri Feb 09 13:28:07 2018 +0100 +++ b/mozilla-kde.patch Fri Feb 09 16:30:49 2018 +0100 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 5be2231eadfb6de978e93c0ba95469e8a4d54cb0 +# Parent 0a40cd14044b87117b99763e7a155b6deb5ab180 Description: Add KDE integration to Firefox (toolkit parts) Author: Wolfgang Rosenauer Author: Lubos Lunak @@ -9,7 +9,7 @@ diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp -@@ -75,16 +75,17 @@ +@@ -76,16 +76,17 @@ #include "nsXPCOMCID.h" #include "nsXPCOM.h" #include "nsXULAppAPI.h" @@ -20,68 +20,14 @@ #include "prlink.h" +#include "nsKDEUtils.h" - #ifdef MOZ_CRASHREPORTER - #include "nsICrashReporter.h" - #endif - #ifdef XP_WIN #include "windows.h" #endif -@@ -4324,16 +4325,34 @@ pref_LoadPrefsInDirList(const char* aLis - { - nsresult rv; - nsCOMPtr dirSvc( - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); - if (NS_FAILED(rv)) { - return rv; - } + + using namespace mozilla; -+ // make sure we load these special files after all the others -+ static const char* specialFiles[] = { -+#if defined(XP_UNIX) -+ "" -+#endif -+ }; -+ -+ if (nsKDEUtils::kdeSession()) { -+ for(int i = 0; -+ i < MOZ_ARRAY_LENGTH(specialFiles); -+ ++i ) { -+ if (*specialFiles[ i ] == '\0') { -+ specialFiles[ i ] = "kde.js"; -+ break; -+ } -+ } -+ } -+ - nsCOMPtr list; - dirSvc->Get(aListId, NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(list)); - if (!list) { - return NS_OK; - } - - bool hasMore; - while (NS_SUCCEEDED(list->HasMoreElements(&hasMore)) && hasMore) { -@@ -4344,17 +4363,17 @@ pref_LoadPrefsInDirList(const char* aLis - } - - nsCOMPtr path = do_QueryInterface(elem); - if (!path) { - continue; - } - - // Do we care if a file provided by this process fails to load? -- pref_LoadPrefsInDir(path, nullptr, 0); -+ pref_LoadPrefsInDir(path, specialFiles, ArrayLength(specialFiles)); - } - - return NS_OK; - } - - static nsresult - pref_ReadPrefFromJar(nsZipArchive* aJarReader, const char* aName) - { -@@ -4461,25 +4480,37 @@ pref_InitInitialObjects() + #ifdef DEBUG +@@ -4235,25 +4236,37 @@ Preferences::InitInitialObjects() // application pref files for backwards compatibility. static const char* specialFiles[] = { #if defined(XP_MACOSX) @@ -119,6 +65,25 @@ // Load jar:$app/omni.jar!/defaults/preferences/*.js // or jar:$gre/omni.jar!/defaults/preferences/*.js. +@@ -4302,17 +4315,17 @@ Preferences::InitInitialObjects() + } + + nsCOMPtr path = do_QueryInterface(elem); + if (!path) { + continue; + } + + // Do we care if a file provided by this process fails to load? +- pref_LoadPrefsInDir(path, nullptr, 0); ++ pref_LoadPrefsInDir(path, specialFiles, ArrayLength(specialFiles)); + } + } + + #ifdef MOZ_WIDGET_ANDROID + // Set up the correct default for toolkit.telemetry.enabled. If this build + // has MOZ_TELEMETRY_ON_BY_DEFAULT *or* we're on the beta channel, telemetry + // is on by default, otherwise not. This is necessary so that beta users who + // are testing final release builds don't flipflop defaults. diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build --- a/modules/libpref/moz.build +++ b/modules/libpref/moz.build @@ -205,11 +170,11 @@ diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn -@@ -75,29 +75,33 @@ toolkit.jar: +@@ -67,16 +67,18 @@ toolkit.jar: + content/global/bindings/checkbox.xml (widgets/checkbox.xml) content/global/bindings/colorpicker.xml (widgets/colorpicker.xml) content/global/bindings/datekeeper.js (widgets/datekeeper.js) content/global/bindings/datepicker.js (widgets/datepicker.js) - content/global/bindings/datetimepicker.xml (widgets/datetimepicker.xml) content/global/bindings/datetimepopup.xml (widgets/datetimepopup.xml) content/global/bindings/datetimebox.xml (widgets/datetimebox.xml) content/global/bindings/datetimebox.css (widgets/datetimebox.css) @@ -217,7 +182,6 @@ +* content/global/bindings/dialog-kde.xml (widgets/dialog-kde.xml) +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde content/global/bindings/editor.xml (widgets/editor.xml) - content/global/bindings/expander.xml (widgets/expander.xml) content/global/bindings/filefield.xml (widgets/filefield.xml) * content/global/bindings/findbar.xml (widgets/findbar.xml) content/global/bindings/general.xml (widgets/general.xml) @@ -225,30 +189,20 @@ content/global/bindings/listbox.xml (widgets/listbox.xml) content/global/bindings/menu.xml (widgets/menu.xml) content/global/bindings/menulist.xml (widgets/menulist.xml) - content/global/bindings/notification.xml (widgets/notification.xml) - content/global/bindings/numberbox.xml (widgets/numberbox.xml) - content/global/bindings/popup.xml (widgets/popup.xml) - * content/global/bindings/preferences.xml (widgets/preferences.xml) -+* content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml) -+% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde - content/global/bindings/progressmeter.xml (widgets/progressmeter.xml) - content/global/bindings/radio.xml (widgets/radio.xml) - content/global/bindings/remote-browser.xml (widgets/remote-browser.xml) - content/global/bindings/resizer.xml (widgets/resizer.xml) - content/global/bindings/richlistbox.xml (widgets/richlistbox.xml) - content/global/bindings/scale.xml (widgets/scale.xml) - content/global/bindings/scrollbar.xml (widgets/scrollbar.xml) - content/global/bindings/scrollbox.xml (widgets/scrollbox.xml) diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml new file mode 100644 --- /dev/null +++ b/toolkit/content/widgets/dialog-kde.xml -@@ -0,0 +1,459 @@ +@@ -0,0 +1,477 @@ + + + ++ ++ %globalKeysDTD; ++]> + + -diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml -new file mode 100644 ---- /dev/null -+++ b/toolkit/content/widgets/preferences-kde.xml -@@ -0,0 +1,1409 @@ -+ -+ -+ -+ %preferencesDTD; -+ -+ %globalKeysDTD; -+]> -+ -+ -+ -+# -+# = Preferences Window Framework -+# -+# The syntax for use looks something like: -+# -+# -+# -+# -+# -+# -+# -+# -+# -+# -+# -+ -+ -+ -+ -+ -+ elements is constructed. Its purpose is to propagate -+ // the values to the associated form elements. Sometimes the code for -+ // some initializers depend on other elements -+ // being initialized so we wait and call updateElements on all of them -+ // once the last one has been constructed. See bugs 997570 and 992185. -+ -+ var elements = this.getElementsByTagName("preference"); -+ for (let element of elements) { -+ element.updateElements(); -+ } -+ -+ this._constructAfterChildrenCalled = true; -+ ]]> -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ Components.classes["@mozilla.org/preferences-service;1"] -+ .getService(Components.interfaces.nsIPrefService); -+ -+ -+ Components.classes["@mozilla.org/preferences-service;1"] -+ .getService(Components.interfaces.nsIPrefBranch); -+ -+ -+ this.service.getDefaultBranch(""); -+ -+ -+ Components.classes["@mozilla.org/preferences-service;1"] -+ .getService(Components.interfaces.nsIPrefBranch); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ 0 -+ null -+ -+ false -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ was added after _constructAfterChildren() was already called. -+ // We can directly call updateElements(). -+ this.updateElements(); -+ return; -+ } -+ this.preferences._constructedChildrenCount++; -+ if (this.preferences._constructedChildrenCount == -+ this.preferences._preferenceChildren.length) { -+ // This is the last , time to updateElements() on all of them. -+ this.preferences._constructAfterChildren(); -+ } -+ ]]> -+ -+ -+ this.preferences.rootBranchInternal -+ .removeObserver(this.name, this.preferences); -+ -+ false -+ -+ -+ if (this.getAttribute("instantApply") == "false") -+ return false; -+ return this.getAttribute("instantApply") == "true" || this.preferences.instantApply; -+ -+ -+ -+ -+ -+ -+ if (val == this.name) -+ return val; -+ -+ this.preferences.rootBranchInternal -+ .removeObserver(this.name, this.preferences); -+ this.setAttribute("name", val); -+ this.preferences.rootBranchInternal -+ .addObserver(val, this.preferences); -+ -+ return val; -+ -+ -+ -+ -+ -+ -+ null -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ return this.preferences.rootBranch.prefIsLocked(this.name); -+ -+ -+ -+ -+ -+ return this.getAttribute("disabled") == "true"; -+ -+ -+ -+ -+ -+ -+ -+ -+ return parseInt(this.getAttribute("tabindex")); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ // defer reset until preference update -+ this.value = undefined; -+ -+ -+ -+ false -+ -+ -+ -+ -+ -+ -+ -+ -+ return this._useDefault ? this.preferences.defaultBranch : this.preferences.rootBranch; -+ -+ -+ -+ false -+ -+ -+ -+ with id='" + this.id + "' and name='" + -+ this.name + "' has unknown type '" + this.type + "'."; -+ consoleService.logStringMessage(msg); -+ ]]> -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ this.updateElements(); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+#else -+ title="&preferencesDefaultTitleMac.title;"> -+#endif -+ -+ -+ -+ -+ -+ -+ -+ -+ -+#ifndef XP_UNIX -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ false -+ -+ false -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ this.setAttribute("lastSelected", val); -+ document.persist(this.id, "lastSelected"); -+ return val; -+ -+ -+ -+ -+ if (!this._currentPane) -+ this._currentPane = this.preferencePanes[0]; -+ -+ return this._currentPane; -+ -+ -+ null -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ false -+ -+ -+ -+ 1) -+ aPaneElement.removeAttribute("flex"); -+ // Calling sizeToContent after the first prefpane is loaded -+ // will size the windows contents so style information is -+ // available to calculate correct sizing. -+ if (!this._initialized && prefpanes.length > 1) { -+ if (this._shouldAnimate) -+ this.style.minHeight = 0; -+ window.sizeToContent(); -+ } -+ -+ var oldPane = this.lastSelected ? document.getElementById(this.lastSelected) : this.preferencePanes[0]; -+ oldPane.selected = !(aPaneElement.selected = true); -+ this.lastSelected = aPaneElement.id; -+ this.currentPane = aPaneElement; -+ this._initialized = true; -+ -+ // Only animate if we've switched between prefpanes -+ if (this._shouldAnimate && oldPane.id != aPaneElement.id) { -+ aPaneElement.style.opacity = 0.0; -+ this.animate(oldPane, aPaneElement); -+ } else if (!this._shouldAnimate && prefpanes.length > 1) { -+ var targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer).height); -+ var verticalPadding = parseInt(window.getComputedStyle(aPaneElement).paddingTop); -+ verticalPadding += parseInt(window.getComputedStyle(aPaneElement).paddingBottom); -+ if (aPaneElement.contentHeight > targetHeight - verticalPadding) { -+ // To workaround the bottom border of a groupbox from being -+ // cutoff an hbox with a class of bottomBox may enclose it. -+ // This needs to include its padding to resize properly. -+ // See bug 394433 -+ var bottomPadding = 0; -+ var bottomBox = aPaneElement.getElementsByAttribute("class", "bottomBox")[0]; -+ if (bottomBox) -+ bottomPadding = parseInt(window.getComputedStyle(bottomBox).paddingBottom); -+ window.innerHeight += bottomPadding + verticalPadding + aPaneElement.contentHeight - targetHeight; -+ } -+ -+ // XXX rstrong - extend the contents of the prefpane to -+ // prevent elements from being cutoff (see bug 349098). -+ if (aPaneElement.contentHeight + verticalPadding < targetHeight) -+ aPaneElement._content.style.height = targetHeight - verticalPadding + "px"; -+ } -+ } -+ break; -+ } -+ } -+ ]]> -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ oldHeight ? 1 : -1; -+ var sizeDelta = Math.abs(oldHeight - aNewPane.contentHeight); -+ this._animateRemainder = sizeDelta % this._animateIncrement; -+ -+ this._setUpAnimationTimer(oldHeight); -+ ]]> -+ -+ -+ -+ -+ -+ 0 && this._currentHeight >= lastSelectedPane.contentHeight) || -+ (this._multiplier < 0 && this._currentHeight <= lastSelectedPane.contentHeight)) -+ return 0; -+ -+ if ((this._multiplier > 0 && newHeight > lastSelectedPane.contentHeight) || -+ (this._multiplier < 0 && newHeight < lastSelectedPane.contentHeight)) -+ increment = this._animateRemainder * this._multiplier; -+ return increment; -+ ]]> -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ null -+ null -+ 15 -+ 40 -+ 5 -+ 0.40 -+ 0 -+ 0 -+ 0 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ return openDialog(aURL, "", "modal,centerscreen,resizable=no" + (aFeatures != "" ? ("," + aFeatures) : ""), aParams); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ if (event.originalTarget.hasAttribute("pane")) { -+ var pane = document.getElementById(event.originalTarget.getAttribute("pane")); -+ this.showPane(pane); -+ } -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ false -+ -+ -+ -+ -+ -+ return document.getElementById(aElement.getAttribute("preference")); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ new Set(); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ var targetHeight = parseInt(window.getComputedStyle(this._content).height); -+ targetHeight += parseInt(window.getComputedStyle(this._content).marginTop); -+ targetHeight += parseInt(window.getComputedStyle(this._content).marginBottom); -+ return targetHeight; -+ -+ -+ -+ document.getAnonymousElementByAttribute(this, "class", "content-box"); -+ -+ -+ -+ -+ // This "command" event handler tracks changes made to preferences by -+ // the user in this window. -+ if (event.sourceEvent) -+ event = event.sourceEvent; -+ this.userChangedValue(event.target); -+ -+ -+ // This "select" event handler tracks changes made to colorpicker -+ // preferences by the user in this window. -+ if (event.target.localName == "colorpicker") -+ this.userChangedValue(event.target); -+ -+ -+ // This "change" event handler tracks changes made to preferences by -+ // the user in this window. -+ this.userChangedValue(event.target); -+ -+ -+ // This "input" event handler tracks changes made to preferences by -+ // the user in this window. -+ this.userChangedValue(event.target); -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+# -+# This is PrefWindow 6. The Code Could Well Be Ready, Are You? -+# -+# Historical References: -+# PrefWindow V (February 1, 2003) -+# PrefWindow IV (April 24, 2000) -+# PrefWindow III (January 6, 2000) -+# PrefWindow II (???) -+# PrefWindow I (June 4, 1999) -+# diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -2327,7 +881,7 @@ --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -61,17 +61,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co - '../components/printingui/mac', + '../components/printingui', ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit': UNIFIED_SOURCES += [ @@ -2755,14 +1309,14 @@ SOURCES += [ osdir + '/nsOSHelperAppService.cpp', ] - if CONFIG['GNU_CXX']: + if CONFIG['CC_TYPE'] in ('clang', 'gcc'): CXXFLAGS += ['-Wno-error=shadow'] if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: UNIFIED_SOURCES += [ + 'unix/nsCommonRegistry.cpp', 'unix/nsGNOMERegistry.cpp', -+ 'unix/nsKDERegistry.cpp', ++ 'unix/nsKDERegistry.cpp', 'unix/nsMIMEInfoUnix.cpp', ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': @@ -2771,7 +1325,7 @@ 'android/nsExternalSharingAppService.cpp', 'android/nsExternalURLHandlerService.cpp', 'android/nsMIMEInfoAndroid.cpp', -@@ -129,16 +131,17 @@ include('/ipc/chromium/chromium-config.m +@@ -124,16 +126,17 @@ include('/ipc/chromium/chromium-config.m FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ @@ -2787,7 +1341,7 @@ CXXFLAGS += CONFIG['TK_CFLAGS'] CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS'] - if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3': CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp new file mode 100644 @@ -3073,14 +1627,14 @@ if (*_retval) return NS_OK; -@@ -79,16 +82,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns - ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get())); - if (action.isValid()) { - action.trigger(); - return NS_OK; - } - return NS_ERROR_FAILURE; - #endif +@@ -59,16 +62,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns + // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to + // give the GNOME answer. + if (mDefaultApplication) + return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile); + + nsAutoCString nativePath; + aFile->GetNativePath(nativePath); + if( nsKDEUtils::kdeSupport()) { + bool supports; @@ -3208,7 +1762,7 @@ diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build -@@ -109,16 +109,17 @@ else: +@@ -121,16 +121,17 @@ else: include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' @@ -3577,7 +2131,7 @@ + NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn); + nsCString kdeMakeFilter( int index ); + - #if (MOZ_WIDGET_GTK == 3) + #ifdef MOZ_WIDGET_GTK GtkFileChooserWidget *mFileChooserDelegate; #endif }; @@ -3756,7 +2310,7 @@ #include "prmem.h" #include "plbase64.h" -@@ -1938,59 +1939,74 @@ nsLocalFile::SetPersistentDescriptor(con +@@ -1934,59 +1935,74 @@ nsLocalFile::SetPersistentDescriptor(con return InitWithNativePath(aPersistentDescriptor); #endif } @@ -3835,5 +2389,5 @@ } return giovfs->ShowURIForInput(mPath); - #elif defined(MOZ_ENABLE_CONTENTACTION) - QUrl uri = QUrl::fromLocalFile(QString::fromUtf8(mPath.get())); + #elif defined(MOZ_WIDGET_ANDROID) + // Try to get a mimetype, if this fails just use the file uri alone