mozilla-kde.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 15 May 2019 19:43:42 +0200
branchfirefox67
changeset 1093 3942c205588b
parent 1089 eca1c1f2fe50
permissions -rw-r--r--
67.0 release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
828
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
     1
# HG changeset patch
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
     2
# Parent  cafacdb0b7c50666e5dcc927684a23e8733206a5
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     3
Description: Add KDE integration to Firefox (toolkit parts)
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     4
Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     5
Author: Lubos Lunak <lunak@suse.com>
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     6
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     7
     https://bugzilla.novell.com/show_bug.cgi?id=170055
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     8
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
     9
diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
    10
--- a/modules/libpref/Preferences.cpp
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
    11
+++ b/modules/libpref/Preferences.cpp
1082
821cfbe8efcc Firefox 64.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1074
diff changeset
    12
@@ -81,16 +81,17 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 #include "nsXPCOMCID.h"
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    14
 #include "nsXPCOM.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    15
 #include "nsXULAppAPI.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    16
 #include "nsZipArchive.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    17
 #include "plbase64.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    18
 #include "PLDHashTable.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    19
 #include "plstr.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    20
 #include "prlink.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 
1074
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
    23
 #ifdef MOZ_MEMORY
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
    24
 #  include "mozmemory.h"
1074
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
    25
 #endif
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
    26
 
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    27
 #ifdef XP_WIN
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
    28
 #  include "windows.h"
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    29
 #endif
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
    30
@@ -4493,25 +4494,37 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    31
   // application pref files for backwards compatibility.
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    32
   static const char* specialFiles[] = {
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    33
 #if defined(XP_MACOSX)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    34
     "macprefs.js"
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    35
 #elif defined(XP_WIN)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    36
     "winpref.js"
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    37
 #elif defined(XP_UNIX)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    38
     "unix.js"
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    39
+    , "" // placeholder for KDE  (empty is otherwise harmless)
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
    40
 #  if defined(_AIX)
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    41
     ,
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    42
     "aix.js"
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
    43
 #  endif
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    44
 #elif defined(XP_BEOS)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    45
     "beos.js"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
 #endif
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    47
   };
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
 
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    49
+  if(nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
    50
+    for(int i = 0;
716
cef565f1c325 update to Firefox 29.0b7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 703
diff changeset
    51
+        i < MOZ_ARRAY_LENGTH(specialFiles);
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    52
+        ++i ) {
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    53
+      if( *specialFiles[ i ] == '\0' ) {
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    54
+        specialFiles[ i ] = "kde.js";
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    55
+        break;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
+      }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    57
+    }
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    58
+  }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    59
+
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
    60
   rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
    61
                            ArrayLength(specialFiles));
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    62
   if (NS_FAILED(rv)) {
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    63
     NS_WARNING("Error parsing application default preferences.");
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    64
   }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
 
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    66
   // Load jar:$app/omni.jar!/defaults/preferences/*.js
438
7d934b2f5014 rebased and removed upstreamed and obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 419
diff changeset
    67
   // or jar:$gre/omni.jar!/defaults/preferences/*.js.
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
    68
@@ -4559,17 +4572,17 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    69
       }
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    70
 
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    71
       nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    72
       if (!path) {
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    73
         continue;
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    74
       }
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    75
 
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    76
       // Do we care if a file provided by this process fails to load?
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    77
-      pref_LoadPrefsInDir(path, nullptr, 0);
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    78
+      pref_LoadPrefsInDir(path, specialFiles, ArrayLength(specialFiles));
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    79
     }
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    80
   }
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    81
 
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    82
   if (XRE_IsParentProcess()) {
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    83
     SetupTelemetryPref();
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    84
   }
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    85
 
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
    86
   NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr,
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    87
diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    88
--- a/modules/libpref/moz.build
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    89
+++ b/modules/libpref/moz.build
1074
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
    90
@@ -31,16 +31,20 @@ EXPORTS.mozilla += [
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    91
     'StaticPrefs.h',
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    92
 ]
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    93
 
985
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
    94
 UNIFIED_SOURCES += [
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
    95
     'Preferences.cpp',
1074
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
    96
     'SharedPrefMap.cpp',
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    97
 ]
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    98
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    99
+LOCAL_INCLUDES += [
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   100
+    '/toolkit/xre'
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   101
+]
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   102
+
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   103
 XPCOM_MANIFESTS += [
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   104
     'components.conf',
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   105
 ]
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   106
 
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   107
 include('/ipc/chromium/chromium-config.mozbuild')
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   108
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   109
 FINAL_LIBRARY = 'xul'
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   110
 
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   111
diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   112
--- a/python/mozbuild/mozpack/chrome/flags.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   113
+++ b/python/mozbuild/mozpack/chrome/flags.py
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   114
@@ -223,16 +223,17 @@ class Flags(OrderedDict):
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   115
         'contentaccessible': Flag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   116
         'os': StringFlag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   117
         'osversion': VersionFlag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   118
         'abi': StringFlag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   119
         'platform': Flag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   120
         'xpcnativewrappers': Flag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   121
         'tablet': Flag,
807
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   122
         'process': StringFlag,
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   123
+        'desktop': StringFlag,
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   124
     }
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   125
     RE = re.compile(r'([!<>=]+)')
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   126
 
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   127
     def __init__(self, *flags):
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   128
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   129
         Initialize a set of flags given in string form.
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   130
            flags = Flags('contentaccessible=yes', 'appversion>=3.5')
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   131
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   132
diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   133
--- a/python/mozbuild/mozpack/chrome/manifest.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   134
+++ b/python/mozbuild/mozpack/chrome/manifest.py
1067
735b140fb042 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1055
diff changeset
   135
@@ -39,16 +39,17 @@ class ManifestEntry(object):
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   136
         'platformversion',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   137
         'os',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   138
         'osversion',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   139
         'abi',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   140
         'xpcnativewrappers',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   141
         'tablet',
807
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   142
         'process',
1005
6d716caa6abe 57.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 999
diff changeset
   143
         'contentaccessible',
6d716caa6abe 57.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 999
diff changeset
   144
+	'desktop',
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   145
     ]
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   146
 
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   147
     def __init__(self, base, *flags):
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   148
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   149
         Initialize a manifest entry with the given base path and flags.
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   150
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   151
         self.base = base
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   152
         self.flags = Flags(*flags)
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   153
diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   154
--- a/toolkit/components/downloads/moz.build
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   155
+++ b/toolkit/components/downloads/moz.build
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   156
@@ -41,10 +41,14 @@ XPCOM_MANIFESTS += [
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   157
 
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   158
 if CONFIG['MOZ_PLACES']:
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   159
     EXTRA_JS_MODULES += [
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   160
         'DownloadHistory.jsm',
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   161
     ]
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   162
 
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   163
 FINAL_LIBRARY = 'xul'
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   164
 
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   165
+LOCAL_INCLUDES += [
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   166
+    '/toolkit/xre'
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   167
+]
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   168
+
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   169
 with Files('**'):
1074
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
   170
     BUG_COMPONENT = ('Toolkit', 'Downloads API')
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
--- a/toolkit/content/jar.mn
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
+++ b/toolkit/content/jar.mn
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   174
@@ -63,16 +63,18 @@ toolkit.jar:
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   175
    content/global/widgets.css
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   176
    content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   177
    content/global/bindings/button.xml          (widgets/button.xml)
1082
821cfbe8efcc Firefox 64.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1074
diff changeset
   178
    content/global/bindings/calendar.js         (widgets/calendar.js)
961
4665fe34fbce revert manually previously wrong rebases
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 960
diff changeset
   179
    content/global/bindings/datekeeper.js       (widgets/datekeeper.js)
4665fe34fbce revert manually previously wrong rebases
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 960
diff changeset
   180
    content/global/bindings/datepicker.js       (widgets/datepicker.js)
942
66115255ad6f prepare FF51 (currently 51.0b5)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 935
diff changeset
   181
    content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   182
 *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   183
+*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
+% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   185
    content/global/bindings/general.xml         (widgets/general.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   186
    content/global/bindings/menu.xml            (widgets/menu.xml)
1074
4b99400f6d17 rebased patches and updated spec for 63.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1067
diff changeset
   187
    content/global/bindings/popup.xml           (widgets/popup.xml)
1082
821cfbe8efcc Firefox 64.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1074
diff changeset
   188
    content/global/bindings/radio.xml           (widgets/radio.xml)
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   189
    content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   190
    content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   191
    content/global/bindings/spinner.js          (widgets/spinner.js)
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   192
    content/global/bindings/tabbox.xml          (widgets/tabbox.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   194
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   196
+++ b/toolkit/content/widgets/dialog-kde.xml
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   197
@@ -0,0 +1,507 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
+<?xml version="1.0"?>
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   199
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   200
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   201
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   202
+
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   203
+<!DOCTYPE bindings [
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   204
+  <!ENTITY % globalKeysDTD SYSTEM "chrome://global/locale/globalKeys.dtd">
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   205
+  %globalKeysDTD;
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   206
+]>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
+<bindings id="dialogBindings"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   209
+          xmlns="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
+          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
+          xmlns:xbl="http://www.mozilla.org/xbl">
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   212
+
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   213
+  <binding id="dialog">
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
+    <content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+      <xul:vbox class="box-inherit dialog-content-box" flex="1">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
+        <children/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
+      </xul:vbox>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   218
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
+      <xul:hbox class="dialog-button-box" anonid="buttons"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
+                xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
918
0f93e8da34b6 boo#984403 - OK and cancel button reversed in FF47
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 916
diff changeset
   221
+#ifdef XP_UNIX_GNOME
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+                >
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   227
+        <xul:spacer anonid="spacer" flex="1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
+#elif XP_UNIX
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   231
+                >
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   232
+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   233
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   234
+        <xul:spacer anonid="spacer" flex="1"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   235
+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   236
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   237
+        <xul:button dlgtype="cancel" class="dialog-button"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   238
+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   239
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
+                pack="end">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
+        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
+      </xul:hbox>
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   250
+
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   251
+    <xul:keyset>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   252
+      <xul:key phase="capturing" oncommand="document.documentElement.openHelp(event)"
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   253
+#ifdef XP_MACOSX
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   254
+           key="&openHelpMac.commandkey;" modifiers="accel"/>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   255
+#else
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   256
+           keycode="&openHelp.commandkey;"/>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   257
+#endif
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   258
+    </xul:keyset>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   259
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   260
+    </content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   262
+    <implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   263
+      <field name="_mStrBundle">null</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
+      <field name="_closeHandler">(function(event) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   265
+        if (!document.documentElement.cancelDialog())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   266
+          event.preventDefault();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
+      })</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
+
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   269
+      <!-- Gets populated by elements that are passed to document.l10n.setAttributes
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   270
+           to localize the dialog buttons. Needed to properly size the dialog after
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   271
+           the asynchronous translation. -->
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   272
+      <field name="_l10nButtons">[]</field>
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   273
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   274
+      <property name="buttons"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
+                onget="return this.getAttribute('buttons');"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   276
+                onset="this._configureButtons(val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   277
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   278
+      <property name="defaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   281
+          if (this.hasAttribute("defaultButton"))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   282
+            return this.getAttribute("defaultButton");
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   283
+          return "accept"; // default to the accept button
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+          this._setDefaultButton(val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   294
+      <method name="acceptDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   295
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   296
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   297
+          return this._doButtonCommand("accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   299
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   301
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+      <method name="cancelDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+          return this._doButtonCommand("cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   309
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
+      <method name="getButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
+          return this._buttons[aDlgType];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   316
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
+      <method name="moveToAlertPosition">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
+          // hack. we need this so the window has something like its final size
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
+          if (window.outerWidth == 1) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+            dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+            sizeToContent();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   328
+          if (opener) {
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   329
+            var xOffset = (opener.outerWidth - window.outerWidth) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   330
+            var yOffset = opener.outerHeight / 5;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   332
+            var newX = opener.screenX + xOffset;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   333
+            var newY = opener.screenY + yOffset;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   334
+          } else {
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   335
+            newX = (screen.availWidth - window.outerWidth) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   336
+            newY = (screen.availHeight - window.outerHeight) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   337
+          }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+          // ensure the window is fully onscreen (if smaller than the screen)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+          if (newX < screen.availLeft)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   341
+            newX = screen.availLeft + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
+          if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
+            newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
+          if (newY < screen.availTop)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   346
+            newY = screen.availTop + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
+          if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
+            newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+          window.moveTo( newX, newY );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
+      <method name="centerWindowOnScreen">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   356
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   357
+        <![CDATA[
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   358
+          var xOffset = screen.availWidth / 2 - window.outerWidth / 2;
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   359
+          var yOffset = screen.availHeight / 2 - window.outerHeight / 2;
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   360
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
+          xOffset = xOffset > 0 ? xOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
+          yOffset = yOffset > 0 ? yOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   363
+          window.moveTo(xOffset, yOffset);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   364
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+      <constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
+      <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
+        this._configureButtons(this.buttons);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+        // listen for when window is closed via native close buttons
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   373
+        window.addEventListener("close", this);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
+        // for things that we need to initialize after onload fires
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   376
+        window.addEventListener("load", this);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
+        window.moveToAlertPosition = this.moveToAlertPosition;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
+        window.centerWindowOnScreen = this.centerWindowOnScreen;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+      ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
+      </constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   383
+      <method name="handleEvent">
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   384
+        <parameter name="aEvent"/>
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   385
+        <body><![CDATA[
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   386
+          switch (aEvent.type) {
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   387
+            case "close": {
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   388
+              this._closeHandler(aEvent);
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   389
+              break;
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   390
+            }
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   391
+            case "load": {
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   392
+              this.postLoadInit(aEvent);
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   393
+              break;
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   394
+            }
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   395
+          }
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   396
+        ]]></body>
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   397
+      </method>
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   398
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   399
+      <method name="postLoadInit">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
+          function focusInit() {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   404
+            const dialog = document.documentElement;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
+            const defaultButton = dialog.getButton(dialog.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+            // give focus to the first focusable element in the dialog
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+            if (!document.commandDispatcher.focusedElement) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   409
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+              var focusedElt = document.commandDispatcher.focusedElement;
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   411
+              if (focusedElt) {
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   412
+                var initialFocusedElt = focusedElt;
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   413
+                while (focusedElt.localName == "tab" ||
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   414
+                       focusedElt.getAttribute("noinitialfocus") == "true") {
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   415
+                  document.commandDispatcher.advanceFocusIntoSubtree(focusedElt);
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   416
+                  focusedElt = document.commandDispatcher.focusedElement;
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   417
+                  if (focusedElt == initialFocusedElt) {
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   418
+                    if (focusedElt.getAttribute("noinitialfocus") == "true") {
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   419
+                      focusedElt.blur();
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   420
+                    }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   421
+                    break;
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   422
+                  }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   423
+                }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   425
+                if (initialFocusedElt.localName == "tab") {
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   426
+                  if (focusedElt.hasAttribute("dlgtype")) {
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   427
+                    // We don't want to focus on anonymous OK, Cancel, etc. buttons,
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   428
+                    // so return focus to the tab itself
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   429
+                    initialFocusedElt.focus();
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   430
+                  }
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   431
+                } else if (!/Mac/.test(navigator.platform) &&
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   432
+                           focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   433
+                  defaultButton.focus();
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   434
+                }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   435
+              }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   437
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
+            try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
+              if (defaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
+                window.notifyDefaultButtonLoaded(defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
+            } catch (e) { }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   442
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   444
+          // Give focus after onload completes, see bug 103197.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
+          setTimeout(focusInit, 0);
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   446
+
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   447
+          if (this._l10nButtons.length) {
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   448
+            document.l10n.translateElements(this._l10nButtons).then(() => {
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   449
+              window.sizeToContent();
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   450
+            });
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   451
+          }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   452
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
+        </body>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   454
+      </method>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   455
+
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   456
+      <method name="openHelp">
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   457
+        <parameter name="event"/>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   458
+        <body>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   459
+        <![CDATA[
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   460
+          var helpButton = document.documentElement.getButton("help");
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   461
+          if (helpButton.disabled || helpButton.hidden)
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   462
+            return;
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   463
+          this._fireButtonEvent("help");
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   464
+          event.stopPropagation();
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   465
+          event.preventDefault();
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   466
+        ]]>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   467
+        </body>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   468
+      </method>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   469
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+      <property name="mStrBundle">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+          if (!this._mStrBundle) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
+            // need to create string bundle manually instead of using <xul:stringbundle/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+            // see bug 63370 for details
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   476
+            this._mStrBundle = Cc["@mozilla.org/intl/stringbundle;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   477
+                                 .getService(Ci.nsIStringBundleService)
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   478
+                                 .createBundle("chrome://global/locale/dialog.properties");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
+          return this._mStrBundle;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
+        ]]></getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+      </property>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   483
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   484
+      <method name="_configureButtons">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   485
+        <parameter name="aButtons"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+          // by default, get all the anonymous button elements
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
+          var buttons = {};
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
+          this._buttons = buttons;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+          buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   492
+          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
+          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
+          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   498
+          // look for any overriding explicit button elements
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
+          var exBtns = this.getElementsByAttribute("dlgtype", "*");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+          var dlgtype;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+          var i;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
+          for (i = 0; i < exBtns.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
+            dlgtype = exBtns[i].getAttribute("dlgtype");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   504
+            buttons[dlgtype].hidden = true; // hide the anonymous button
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+            buttons[dlgtype] = exBtns[i];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   506
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   507
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
+          // add the label and oncommand handler to each button
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
+          for (dlgtype in buttons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
+            var button = buttons[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
+            button.addEventListener("command", this._handleButtonCommand, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
+            // don't override custom labels with pre-defined labels on explicit buttons
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
+            if (!button.hasAttribute("label")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   515
+              // dialog attributes override the default labels in dialog.properties
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   516
+              if (this.hasAttribute("buttonlabel" + dlgtype)) {
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   517
+                button.setAttribute("label", this.getAttribute("buttonlabel" + dlgtype));
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   518
+                if (this.hasAttribute("buttonaccesskey" + dlgtype))
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   519
+                  button.setAttribute("accesskey", this.getAttribute("buttonaccesskey" + dlgtype));
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   520
+              } else if (this.hasAttribute("buttonid" + dlgtype)) {
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   521
+                document.l10n.setAttributes(button, this.getAttribute("buttonid" + dlgtype));
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   522
+                this._l10nButtons.push(button);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   524
+                button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype));
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   525
+                var accessKey = this.mStrBundle.GetStringFromName("accesskey-" + dlgtype);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   526
+                if (accessKey)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+                  button.setAttribute("accesskey", accessKey);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+              }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+            // allow specifying alternate icons in the dialog header
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   531
+            if (!button.hasAttribute("icon")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+              // if there's an icon specified, use that
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   533
+              if (this.hasAttribute("buttonicon" + dlgtype))
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   534
+                button.setAttribute("icon", this.getAttribute("buttonicon" + dlgtype));
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+              // otherwise set defaults
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+              else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+                switch (dlgtype) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+                  case "accept":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   539
+                    button.setAttribute("icon", "accept");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
+                  case "cancel":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   542
+                    button.setAttribute("icon", "cancel");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
+                    break;
194
b77b8588484c sync dialog-kde.xml
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 191
diff changeset
   544
+                  case "disclosure":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   545
+                    button.setAttribute("icon", "properties");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
+                  case "help":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   548
+                    button.setAttribute("icon", "help");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
+                  default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   552
+                }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   553
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+          // ensure that hitting enter triggers the default button command
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+          this.defaultButton = this.defaultButton;
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   558
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
+          // if there is a special button configuration, use it
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
+          if (aButtons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
+            // expect a comma delimited list of dlgtype values
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
+            var list = aButtons.split(",");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
+            // mark shown dlgtypes as true
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+            var shown = { accept: false, cancel: false, help: false,
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
+                          disclosure: false, extra1: false, extra2: false };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
+            for (i = 0; i < list.length; ++i)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+              shown[list[i].replace(/ /g, "")] = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
+            // hide/show the buttons we want
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   571
+            for (dlgtype in buttons)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+              buttons[dlgtype].hidden = !shown[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
+
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   574
+            // show the spacer on Windows only when the extra2 button is present
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   575
+            if (/Win/.test(navigator.platform)) {
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   576
+              var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   577
+              spacer.removeAttribute("hidden");
1006
5ba9b67de554 full rebase incl. fixing KDE variants of UI definitions
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1005
diff changeset
   578
+              spacer.setAttribute("flex", shown.extra2 ? "1" : "0");
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   579
+            }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   583
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
+      <method name="_setDefaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
+        <parameter name="aNewDefault"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   587
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   588
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   589
+          // remove the default attribute from the previous default button, if any
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
+          var oldDefaultButton = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   591
+          if (oldDefaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
+            oldDefaultButton.removeAttribute("default");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
+          var newDefaultButton = this.getButton(aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
+          if (newDefaultButton) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
+            this.setAttribute("defaultButton", aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   597
+            newDefaultButton.setAttribute("default", "true");
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   598
+          } else {
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   599
+            this.setAttribute("defaultButton", "none");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   600
+            if (aNewDefault != "none")
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   601
+              dump("invalid new default button: " + aNewDefault + ", assuming: none\n");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   602
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   605
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   607
+      <method name="_handleButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   608
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
+          return document.documentElement._doButtonCommand(
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
+                                        aEvent.target.getAttribute("dlgtype"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   616
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+      <method name="_doButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   619
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   620
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+          var button = this.getButton(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+          if (!button.disabled) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   623
+            var noCancel = this._fireButtonEvent(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+            if (noCancel) {
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   625
+              if (aDlgType == "accept" || aDlgType == "cancel") {
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   626
+                var closingEvent = new CustomEvent("dialogclosing", {
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   627
+                  bubbles: true,
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   628
+                  detail: { button: aDlgType },
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   629
+                });
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   630
+                this.dispatchEvent(closingEvent);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
+                window.close();
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   632
+              }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
+            return noCancel;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   635
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   636
+          return true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   640
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
+      <method name="_fireButtonEvent">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   645
+          var event = document.createEvent("Events");
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   646
+          event.initEvent("dialog" + aDlgType, true, true);
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   647
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
+          // handle dom event handlers
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
+          var noCancel = this.dispatchEvent(event);
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   650
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
+          // handle any xml attribute event handlers
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   652
+          var handler = this.getAttribute("ondialog" + aDlgType);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
+          if (handler != "") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   654
+            var fn = new Function("event", handler);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
+            var returned = fn(event);
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   656
+            // eslint-disable-next-line mozilla/no-compare-against-boolean-literals
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
+            if (returned == false)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
+              noCancel = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   659
+          }
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   660
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
+          return noCancel;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   665
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   666
+      <method name="_hitEnter">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
+        <parameter name="evt"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   668
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
+        <![CDATA[
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   670
+          if (evt.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
+            return;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   672
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   673
+          var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   674
+          if (btn)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   675
+            this._doButtonCommand(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   679
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   680
+    </implementation>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   681
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   682
+    <handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   683
+      <handler event="keypress" keycode="VK_RETURN"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   684
+               group="system" action="this._hitEnter(event);"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   685
+      <handler event="keypress" keycode="VK_ESCAPE" group="system">
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   686
+        if (!event.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   687
+          this.cancelDialog();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
+#ifdef XP_MACOSX
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
+      <handler event="keypress" key="." modifiers="meta" phase="capturing" action="this.cancelDialog();"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   692
+      <handler event="focus" phase="capturing">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   693
+        var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   694
+        if (btn)
1089
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   695
+          btn.setAttribute("default", event.originalTarget == btn ||
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   696
+                           !(event.originalTarget.localName == "button" ||
eca1c1f2fe50 Firefox 66.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1085
diff changeset
   697
+                             event.originalTarget.localName == "toolbarbutton"));
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   698
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   700
+    </handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   701
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   702
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   703
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   704
+</bindings>
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   705
diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   706
--- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   707
+++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   708
@@ -1030,30 +1030,60 @@ nsUnknownContentTypeDialog.prototype = {
994
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   709
 
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   710
       if (params.handlerApp &&
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   711
           params.handlerApp.executable &&
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   712
           params.handlerApp.executable.isFile()) {
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   713
         // Remember the file they chose to run.
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   714
         this.chosenApp = params.handlerApp;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   715
       }
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   716
     } else if ("@mozilla.org/applicationchooser;1" in Cc) {
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   717
-      var nsIApplicationChooser = Ci.nsIApplicationChooser;
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   718
-      var appChooser = Cc["@mozilla.org/applicationchooser;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   719
-                         .createInstance(nsIApplicationChooser);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   720
-      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   721
-      var contentTypeDialogObj = this;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   722
-      let appChooserCallback = function appChooserCallback_done(aResult) {
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   723
-        if (aResult) {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   724
-           contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
1050
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   725
-        }
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   726
-        contentTypeDialogObj.finishChooseApp();
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   727
-      };
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   728
-      appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   729
-      // The finishChooseApp is called from appChooserCallback
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   730
-      return;
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   731
+      // handle the KDE case which is implemented in the filepicker
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   732
+      // therefore falling back to Gtk2 like behaviour if KDE is running
994
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   733
+      // FIXME this should be better handled in the nsIApplicationChooser
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   734
+      // interface
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   735
+      var env = Components.classes["@mozilla.org/process/environment;1"]
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   736
+                          .getService(Components.interfaces.nsIEnvironment);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   737
+      if (env.get('KDE_FULL_SESSION') == "true")
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   738
+      {
1050
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   739
+        var nsIFilePicker = Ci.nsIFilePicker;
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   740
+        var fp = Cc["@mozilla.org/filepicker;1"]
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   741
+                    .createInstance(nsIFilePicker);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   742
+        fp.init(this.mDialog,
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   743
+                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   744
+                nsIFilePicker.modeOpen);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   745
+
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   746
+        fp.appendFilters(nsIFilePicker.filterApps);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   747
+
1050
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   748
+        fp.open(aResult => {
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   749
+          if (aResult == nsIFilePicker.returnOK && fp.file) {
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   750
+            // Remember the file they chose to run.
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   751
+            var localHandlerApp =
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   752
+              Cc["@mozilla.org/uriloader/local-handler-app;1"].
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   753
+                         createInstance(Ci.nsILocalHandlerApp);
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   754
+            localHandlerApp.executable = fp.file;
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   755
+            this.chosenApp = localHandlerApp;
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   756
+          }
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   757
+          this.finishChooseApp();
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   758
+        });
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   759
+      } else {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   760
+        var nsIApplicationChooser = Ci.nsIApplicationChooser;
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   761
+        var appChooser = Cc["@mozilla.org/applicationchooser;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   762
+                           .createInstance(nsIApplicationChooser);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   763
+        appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   764
+        var contentTypeDialogObj = this;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   765
+        let appChooserCallback = function appChooserCallback_done(aResult) {
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   766
+          if (aResult) {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   767
+             contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   768
+          }
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   769
+          contentTypeDialogObj.finishChooseApp();
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   770
+        };
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   771
+        appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   772
+        // The finishChooseApp is called from appChooserCallback
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   773
+        return;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   774
+      }
994
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   775
     } else {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   776
       var nsIFilePicker = Ci.nsIFilePicker;
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   777
       var fp = Cc["@mozilla.org/filepicker;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   778
                  .createInstance(nsIFilePicker);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   779
       fp.init(this.mDialog,
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   780
               this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   781
               nsIFilePicker.modeOpen);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   782
 
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   783
diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   786
@@ -15,16 +15,17 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
 #include "nsPrintfCString.h"
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   788
 #include "nsNetCID.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   789
 #include "nsNetUtil.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   790
 #include "nsISupportsPrimitives.h"
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   791
 #include "nsIGSettingsService.h"
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   792
 #include "nsInterfaceHashtable.h"
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   793
 #include "mozilla/Attributes.h"
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   794
 #include "nsIURI.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   796
 
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   797
 using namespace mozilla;
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   798
 
850
a2bdff616a0e prepare 38beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 837
diff changeset
   799
 class nsUnixSystemProxySettings final : public nsISystemProxySettings {
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   800
  public:
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   801
   NS_DECL_ISUPPORTS
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   802
   NS_DECL_NSISYSTEMPROXYSETTINGS
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   803
 
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   804
@@ -44,16 +45,18 @@ class nsUnixSystemProxySettings final : 
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   805
                                    nsACString& aResult);
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   806
   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   807
                              int32_t aPort, nsACString& aResult);
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   808
   nsresult GetProxyFromGSettings(const nsACString& aScheme,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   809
                                  const nsACString& aHost, int32_t aPort,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   810
                                  nsACString& aResult);
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   811
   nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   812
                                        nsACString& aResult);
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   813
+  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   814
+                           PRInt32 aPort, nsACString& aResult);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   815
 };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   816
 
738
f118b88b7d7f Aurora 31 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 718
diff changeset
   817
 NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   818
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   819
 NS_IMETHODIMP
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   820
 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   821
   // dbus prevents us from being threadsafe, but this routine should not block
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   822
   // anyhow
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   823
@@ -487,22 +490,51 @@ nsresult nsUnixSystemProxySettings::GetP
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   824
   return NS_OK;
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   825
 }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   826
 
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   827
 nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   828
                                                    const nsACString& aScheme,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   829
                                                    const nsACString& aHost,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   830
                                                    const int32_t aPort,
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   831
                                                    nsACString& aResult) {
596
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 589
diff changeset
   832
+  if (nsKDEUtils::kdeSupport())
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   833
+    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   834
+
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   835
   if (mProxySettings) {
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   836
     nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   837
     if (NS_SUCCEEDED(rv)) return rv;
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   838
   }
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   839
   if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   840
 
1085
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   841
   return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
87f893cf45b9 Firefox 65.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1082
diff changeset
   842
 }
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   843
 
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   844
+nsresult
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   845
+nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   846
+                                           const nsACString& aHost,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   847
+                                           PRInt32 aPort,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   848
+                                           nsACString& aResult)
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   849
+{
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   850
+  nsAutoCString url;
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   851
+  url = aScheme;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   852
+  url += "://";
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   853
+  url += aHost;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   854
+  if( aPort >= 0 )
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   855
+  {
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   856
+    url += ":";
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   857
+    url += nsPrintfCString("%d", aPort);
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   858
+  }
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   859
+  nsTArray<nsCString> command;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   860
+  command.AppendElement( NS_LITERAL_CSTRING( "GETPROXY" ));
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   861
+  command.AppendElement( url );
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   862
+  nsTArray<nsCString> result;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   863
+  if( !nsKDEUtils::command( command, &result ) || result.Length() != 1 )
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   864
+    return NS_ERROR_FAILURE;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   865
+  aResult = result[0];
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   866
+  return NS_OK;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   867
+}
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   868
+
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   869
+
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   870
 NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   871
   auto result = MakeRefPtr<nsUnixSystemProxySettings>();
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   872
   result->Init();
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   873
   return result.forget().downcast<nsISupports>();
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   874
 }
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   875
diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   876
--- a/toolkit/xre/moz.build
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   877
+++ b/toolkit/xre/moz.build
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   878
@@ -83,17 +83,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   879
         '../components/printingui',
932
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   880
     ]
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   881
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   882
     UNIFIED_SOURCES += [
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   883
         'nsNativeAppSupportDefault.cpp',
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   884
         'UIKitDirProvider.mm',
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   885
     ]
923
3cc9f17ca9bb prepare FF48
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 918
diff changeset
   886
 elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   887
+    EXPORTS += ['nsKDEUtils.h']
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   888
     UNIFIED_SOURCES += [
691
18c2dc922e51 update to Firefox 27.0b2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 686
diff changeset
   889
+        'nsKDEUtils.cpp',
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   890
         'nsNativeAppSupportUnix.cpp',
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   891
     ]
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   892
 else:
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   893
     UNIFIED_SOURCES += [
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   894
         'nsNativeAppSupportDefault.cpp',
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   895
     ]
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   896
 
1093
3942c205588b 67.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1089
diff changeset
   897
 if CONFIG['MOZ_HAS_REMOTE']:
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   898
diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   899
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
+++ b/toolkit/xre/nsKDEUtils.cpp
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   902
@@ -0,0 +1,344 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   903
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
546
2c9448fe783c MPL-2.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   904
+/* This Source Code Form is subject to the terms of the Mozilla Public
2c9448fe783c MPL-2.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   905
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
2c9448fe783c MPL-2.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   906
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   907
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   908
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+#include "nsIWidget.h"
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   910
+#include "nsISupportsPrimitives.h"
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   911
+#include "nsIMutableArray.h"
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   912
+#include "nsComponentManagerUtils.h"
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   913
+#include "nsArrayUtils.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+
10
1920f0ff04a3 Make mozilla-kde.patch compile with 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 9
diff changeset
   915
+#include <gtk/gtk.h>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
+#include <limits.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   918
+#include <stdio.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
+#include <sys/wait.h>
517
fa93154734b8 Fix mozilla-kde.patch to include sys/resource.h for getrlimit etc (glibc 2.16)
Andreas Jaeger <aj@suse.de>
parents: 515
diff changeset
   920
+#include <sys/resource.h>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   921
+#include <unistd.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
+#include <X11/Xlib.h>
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   923
+// copied from X11/X.h as a hack since for an unknown
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   924
+// reason it's not picked up from X11/X.h
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   925
+#ifndef None
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   926
+#define None                 0L /* universal null resource or null atom */
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   927
+#endif
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
+//#define DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   931
+#define KMOZILLAHELPER "kmozillahelper"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+// not need for lib64, it's a binary
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   935
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   936
+
538
be682f8c9361 revert API version change for kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 537
diff changeset
   937
+#define KMOZILLAHELPER_VERSION 6
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   938
+#define MAKE_STR2( n ) #n
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   939
+#define MAKE_STR( n ) MAKE_STR2( n )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   940
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   941
+static bool getKdeSession()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
+    Display* dpy = XOpenDisplay( NULL );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
+    if( dpy == NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
+    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+    bool kde = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   948
+    if( kde_full_session != None )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   949
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
+        int cnt;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   951
+        if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt ))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
+            {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
+            for( int i = 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
+                 i < cnt;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   955
+                 ++i )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
+                {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
+                if( props[ i ] == kde_full_session )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
+                    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
+                    kde = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   960
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
+                    fprintf( stderr, "KDE SESSION %d\n", kde );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   963
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   964
+                    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   965
+                }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   966
+            XFree( props );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   967
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
+    XCloseDisplay( dpy );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
+    return kde;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   971
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   972
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
+static bool getKdeSupport()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   974
+    {
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   975
+    nsTArray<nsCString> command;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   976
+    command.AppendElement( NS_LITERAL_CSTRING( "CHECK" ));
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   977
+    command.AppendElement( NS_LITERAL_CSTRING( MAKE_STR( KMOZILLAHELPER_VERSION )));
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   978
+    bool kde = nsKDEUtils::command( command );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
+    fprintf( stderr, "KDE RUNNING %d\n", kde );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
+    return kde;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   985
+nsKDEUtils::nsKDEUtils()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
+    : commandFile( NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
+    , replyFile( NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   989
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   990
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
+nsKDEUtils::~nsKDEUtils()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   993
+//    closeHelper(); not actually useful, exiting will close the fd too
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   995
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
+nsKDEUtils* nsKDEUtils::self()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   997
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   998
+    static nsKDEUtils s;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+    return &s;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+static bool helperRunning = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+static bool helperFailed = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+bool nsKDEUtils::kdeSession()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+    static bool session = getKdeSession();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1008
+    return session;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+bool nsKDEUtils::kdeSupport()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
+    static bool support = kdeSession() && getKdeSupport();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+    return support && helperRunning;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
+struct nsKDECommandData
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
+    FILE* file;
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
  1020
+    nsTArray<nsCString>* output;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
+    GMainLoop* loop;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
+    bool success;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1023
+    };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1024
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
+static gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
+    nsKDECommandData* p = static_cast< nsKDECommandData* >( data );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
+    char buf[ 8192 ]; // TODO big enough
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
+    bool command_done = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
+    bool command_failed = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
+    while( !command_done && !command_failed && fgets( buf, 8192, p->file ) != NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
+        { // TODO what if the kernel splits a line into two chunks?
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
+//#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
+//        fprintf( stderr, "READ: %s %d\n", buf, feof( p->file ));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
+//#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
+        if( char* eol = strchr( buf, '\n' ))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
+            *eol = '\0';
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
+        command_done = ( strcmp( buf, "\\1" ) == 0 );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1039
+        command_failed = ( strcmp( buf, "\\0" ) == 0 );
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
  1040
+        nsAutoCString line( buf );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
+        line.ReplaceSubstring( "\\n", "\n" );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
+        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
+        if( p->output && !( command_done || command_failed ))
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
  1044
+            p->output->AppendElement( nsCString( buf )); // TODO utf8?
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1045
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1046
+    bool quit = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1047
+    if( feof( p->file ) || command_failed )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1048
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1049
+        quit = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1050
+        p->success = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1051
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1052
+    if( command_done )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1053
+        { // reading one reply finished
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1054
+        quit = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1055
+        p->success = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
+    if( quit )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1058
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1059
+        if( p->loop )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
+            g_main_loop_quit( p->loop );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
+        return FALSE;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1063
+    return TRUE;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1065
+
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
  1066
+bool nsKDEUtils::command( const nsTArray<nsCString>& command, nsTArray<nsCString>* output )
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1068
+    return self()->internalCommand( command, NULL, false, output );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1069
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
+
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1071
+bool nsKDEUtils::command( nsIArray* command, nsIArray** output)
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1072
+    {
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1073
+    nsTArray<nsCString> in;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1074
+    PRUint32 length;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1075
+    command->GetLength( &length );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1076
+    for ( PRUint32 i = 0; i < length; i++ )
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1077
+        {
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1078
+        nsCOMPtr<nsISupportsCString> str = do_QueryElementAt( command, i );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1079
+        if( str )
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1080
+            {
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
  1081
+            nsAutoCString s;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1082
+            str->GetData( s );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1083
+            in.AppendElement( s );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1084
+            }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1085
+        }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1086
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1087
+    nsTArray<nsCString> out;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1088
+    bool ret = self()->internalCommand( in, NULL, false, &out );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1089
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1090
+    if ( !output ) return ret;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1091
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1092
+    nsCOMPtr<nsIMutableArray> result = do_CreateInstance( NS_ARRAY_CONTRACTID );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1093
+    if ( !result ) return false;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1094
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1095
+    for ( PRUint32 i = 0; i < out.Length(); i++ )
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1096
+        {
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1097
+        nsCOMPtr<nsISupportsCString> rstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1098
+        if ( !rstr ) return false;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1099
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1100
+        rstr->SetData( out[i] );
1021
1307721d2345 fixed patches for FF58
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1020
diff changeset
  1101
+        result->AppendElement( rstr );
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1102
+        }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1103
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1104
+    NS_ADDREF( *output = result);
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1105
+    return ret;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1106
+    }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1107
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1108
+
893
86f72f1e98a4 prepare Gtk3 based builds on a feature branch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 889
diff changeset
  1109
+bool nsKDEUtils::commandBlockUi( const nsTArray<nsCString>& command, GtkWindow* parent, nsTArray<nsCString>* output )
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1110
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
+    return self()->internalCommand( command, parent, true, output );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
+
893
86f72f1e98a4 prepare Gtk3 based builds on a feature branch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 889
diff changeset
  1114
+bool nsKDEUtils::internalCommand( const nsTArray<nsCString>& command, GtkWindow* parent, bool blockUi,
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
  1115
+    nsTArray<nsCString>* output )
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
+    if( !startHelper())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
+        return false;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1119
+    feedCommand( command );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1120
+    // do not store the data in 'this' but in extra structure, just in case there
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1121
+    // is reentrancy (can there be? the event loop is re-entered)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
+    nsKDECommandData data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
+    data.file = replyFile;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
+    data.output = output;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
+    data.success = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
+    if( blockUi )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+        data.loop = g_main_loop_new( NULL, FALSE );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
+        GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
893
86f72f1e98a4 prepare Gtk3 based builds on a feature branch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 889
diff changeset
  1130
+        if( parent && gtk_window_get_group(parent) )
86f72f1e98a4 prepare Gtk3 based builds on a feature branch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 889
diff changeset
  1131
+            gtk_window_group_add_window( gtk_window_get_group(parent), GTK_WINDOW( window ));
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1132
+        gtk_widget_realize( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
+        gtk_widget_set_sensitive( window, TRUE );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
+        gtk_grab_add( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
+        GIOChannel* channel = g_io_channel_unix_new( fileno( data.file ));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
+        g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
+        g_io_channel_unref( channel );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
+        g_main_loop_run( data.loop );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+        g_main_loop_unref( data.loop );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
+        gtk_grab_remove( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
+        gtk_widget_destroy( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
+    else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1144
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1145
+        data.loop = NULL;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
+        while( kdeReadFunc( NULL, static_cast< GIOCondition >( 0 ), &data ))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
+            ;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+    return data.success;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+bool nsKDEUtils::startHelper()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1153
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+    if( helperRunning )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+        return true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+    if( helperFailed )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+    helperFailed = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+    int fdcommand[ 2 ];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+    int fdreply[ 2 ];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+    if( pipe( fdcommand ) < 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+    if( pipe( fdreply ) < 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1165
+        close( fdcommand[ 0 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+        close( fdcommand[ 1 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1168
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+    char* args[ 2 ] = { const_cast< char* >( KMOZILLAHELPER ), NULL };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+    switch( fork())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+        case -1:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
+            {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1174
+            close( fdcommand[ 0 ] );