mozilla-kde.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Fri, 24 Aug 2018 14:17:12 +0200
changeset 1067 735b140fb042
parent 1055 526f445635f3
child 1074 4b99400f6d17
permissions -rw-r--r--
rebased patches
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
1067
735b140fb042 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1055
diff changeset
     2
# Parent  989a507ffc5faf9a3bd950c2391a24afa9f463c8
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
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    12
@@ -77,16 +77,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
 
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    23
 #ifdef XP_WIN
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    24
 #include "windows.h"
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    25
 #endif
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    26
 
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    27
 using namespace mozilla;
181
12fe57ebc7a1 if any xul application (like Firefox) has ships a kde.js pref file make sure it gets loaded last
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 169
diff changeset
    28
 
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
    29
 #ifdef DEBUG
1067
735b140fb042 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1055
diff changeset
    30
@@ -4189,25 +4190,37 @@ Preferences::InitInitialObjects(bool aIs
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)
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
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"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
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
+
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    60
   rv = pref_LoadPrefsInDir(
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    61
     defaultPrefDir, specialFiles, ArrayLength(specialFiles));
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.
1067
735b140fb042 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1055
diff changeset
    68
@@ -4256,17 +4269,17 @@ Preferences::InitInitialObjects(bool aIs
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
 
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    86
   NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
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
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    90
@@ -29,16 +29,20 @@ EXPORTS.mozilla += [
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    91
     'Preferences.h',
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
    92
     'StaticPrefs.h',
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    93
 ]
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
    94
 
985
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
    95
 UNIFIED_SOURCES += [
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
    96
     'Preferences.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 += [
985
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
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
+
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   103
 include('/ipc/chromium/chromium-config.mozbuild')
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   104
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   105
 FINAL_LIBRARY = 'xul'
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   106
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   107
 DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   108
 DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
985
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
   109
 if CONFIG['MOZ_ENABLE_WEBRENDER']:
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
   110
     DEFINES['MOZ_ENABLE_WEBRENDER'] = True
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
985
038d048a3940 Firefox 55.0b13
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 982
diff changeset
   114
@@ -220,16 +220,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
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   156
@@ -41,10 +41,14 @@ EXTRA_JS_MODULES += [
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('**'):
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   170
     BUG_COMPONENT = ('Toolkit', 'Download Manager')
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
1067
735b140fb042 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1055
diff changeset
   174
@@ -69,16 +69,18 @@ toolkit.jar:
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   175
    content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   176
    content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
961
4665fe34fbce revert manually previously wrong rebases
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 960
diff changeset
   177
    content/global/bindings/datekeeper.js       (widgets/datekeeper.js)
4665fe34fbce revert manually previously wrong rebases
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 960
diff changeset
   178
    content/global/bindings/datepicker.js       (widgets/datepicker.js)
942
66115255ad6f prepare FF51 (currently 51.0b5)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 935
diff changeset
   179
    content/global/bindings/datetimepopup.xml   (widgets/datetimepopup.xml)
66115255ad6f prepare FF51 (currently 51.0b5)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 935
diff changeset
   180
    content/global/bindings/datetimebox.xml     (widgets/datetimebox.xml)
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/editor.xml          (widgets/editor.xml)
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   186
 *  content/global/bindings/findbar.xml         (widgets/findbar.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   187
    content/global/bindings/general.xml         (widgets/general.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   188
    content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   189
    content/global/bindings/listbox.xml         (widgets/listbox.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   190
    content/global/bindings/menu.xml            (widgets/menu.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   191
    content/global/bindings/menulist.xml        (widgets/menulist.xml)
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
   192
    content/global/bindings/notification.xml    (widgets/notification.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
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   197
@@ -0,0 +1,478 @@
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
+    <resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+      <stylesheet src="chrome://global/skin/dialog.css"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
+    </resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
+    <content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
+      <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
   219
+        <children/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
+      </xul:vbox>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   221
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+      <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
   223
+                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
   224
+#ifdef XP_UNIX_GNOME
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+                >
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
+        <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
   227
+        <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
   228
+        <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
   229
+        <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
   230
+        <xul:spacer anonid="spacer" flex="1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   232
+        <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
   233
+#elif XP_UNIX
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   234
+                >
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   235
+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   236
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   237
+        <xul:spacer anonid="spacer" flex="1"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   238
+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   239
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   240
+        <xul:button dlgtype="cancel" class="dialog-button"/>
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   241
+        <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
   242
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
+                pack="end">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
+        <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
   245
+        <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
   246
+        <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
   247
+        <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
   248
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
+        <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
   250
+        <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
   251
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   252
+      </xul:hbox>
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   253
+
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   254
+    <xul:keyset>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   255
+      <xul:key phase="capturing" oncommand="document.documentElement.openHelp(event)"
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   256
+#ifdef XP_MACOSX
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   257
+           key="&openHelpMac.commandkey;" modifiers="accel"/>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   258
+#else
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   259
+           keycode="&openHelp.commandkey;"/>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   260
+#endif
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   261
+    </xul:keyset>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   262
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   263
+    </content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   265
+    <implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   266
+      <field name="_mStrBundle">null</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
+      <field name="_closeHandler">(function(event) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
+        if (!document.documentElement.cancelDialog())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   269
+          event.preventDefault();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
+      })</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   272
+      <property name="buttons"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
+                onget="return this.getAttribute('buttons');"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   274
+                onset="this._configureButtons(val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   276
+      <property name="defaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   277
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   278
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
+          if (this.hasAttribute("defaultButton"))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
+            return this.getAttribute("defaultButton");
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   281
+          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
   282
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+          this._setDefaultButton(val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+      <method name="acceptDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   294
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   295
+          return this._doButtonCommand("accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   296
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   297
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   299
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
+      <method name="cancelDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   301
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+          return this._doButtonCommand("cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   307
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+      <method name="getButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
+          return this._buttons[aDlgType];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   316
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
+      <method name="moveToAlertPosition">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
+          // 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
   321
+          if (window.outerWidth == 1) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
+            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
   323
+            sizeToContent();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   326
+          if (opener) {
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   327
+            var xOffset = (opener.outerWidth - window.outerWidth) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   328
+            var yOffset = opener.outerHeight / 5;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   330
+            var newX = opener.screenX + xOffset;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   331
+            var newY = opener.screenY + yOffset;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   332
+          } else {
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   333
+            newX = (screen.availWidth - window.outerWidth) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   334
+            newY = (screen.availHeight - window.outerHeight) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   335
+          }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   337
+          // 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
   338
+          if (newX < screen.availLeft)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+            newX = screen.availLeft + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+          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
   341
+            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
   342
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
+          if (newY < screen.availTop)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+            newY = screen.availTop + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
+          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
   346
+            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
   347
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
+          window.moveTo( newX, newY );
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
+      <method name="centerWindowOnScreen">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
+        <![CDATA[
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   356
+          var xOffset = screen.availWidth / 2 - window.outerWidth / 2;
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   357
+          var yOffset = screen.availHeight / 2 - window.outerHeight / 2;
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   358
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
+          xOffset = xOffset > 0 ? xOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   360
+          yOffset = yOffset > 0 ? yOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
+          window.moveTo(xOffset, yOffset);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   363
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   364
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
+      <constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+      <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+        this._configureButtons(this.buttons);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
+        // listen for when window is closed via native close buttons
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   371
+        window.addEventListener("close", this._closeHandler);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
+        // for things that we need to initialize after onload fires
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   374
+        window.addEventListener("load", this.postLoadInit);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   376
+        window.moveToAlertPosition = this.moveToAlertPosition;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+        window.centerWindowOnScreen = this.centerWindowOnScreen;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
+      ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
+      </constructor>
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
+      <method name="postLoadInit">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   383
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   384
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   385
+          function focusInit() {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
+            const dialog = document.documentElement;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
+            const defaultButton = dialog.getButton(dialog.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
+            // 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
   389
+            if (!document.commandDispatcher.focusedElement) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
+              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+              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
   393
+              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
   394
+                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
   395
+                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
   396
+                       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
   397
+                  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
   398
+                  focusedElt = document.commandDispatcher.focusedElement;
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   399
+                  if (focusedElt == initialFocusedElt) {
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   400
+                    if (focusedElt.getAttribute("noinitialfocus") == "true") {
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   401
+                      focusedElt.blur();
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   402
+                    }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   403
+                    break;
1020
d2c159cb9bf2 rebased patches; updated spec file
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1014
diff changeset
   404
+                  }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   405
+                }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   407
+                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
   408
+                  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
   409
+                    // 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
   410
+                    // 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
   411
+                    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
   412
+                  }
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   413
+                } else if (!/Mac/.test(navigator.platform) &&
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   414
+                           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
   415
+                  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
   416
+                }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   417
+              }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   420
+            try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+              if (defaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
+                window.notifyDefaultButtonLoaded(defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+            } catch (e) { }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
+          // 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
   427
+          setTimeout(focusInit, 0);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
+        </body>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   430
+      </method>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
+
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   432
+      <method name="openHelp">
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   433
+        <parameter name="event"/>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   434
+        <body>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   435
+        <![CDATA[
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   436
+          var helpButton = document.documentElement.getButton("help");
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   437
+          if (helpButton.disabled || helpButton.hidden)
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   438
+            return;
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   439
+          this._fireButtonEvent("help");
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   440
+          event.stopPropagation();
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   441
+          event.preventDefault();
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   442
+        ]]>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   443
+        </body>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   444
+      </method>
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   445
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   446
+      <property name="mStrBundle">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
+          if (!this._mStrBundle) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   450
+            // 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
   451
+            // see bug 63370 for details
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   452
+            this._mStrBundle = Cc["@mozilla.org/intl/stringbundle;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   453
+                                 .getService(Ci.nsIStringBundleService)
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   454
+                                 .createBundle("chrome://global/locale/dialog.properties");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   455
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   456
+          return this._mStrBundle;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   457
+        ]]></getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   458
+      </property>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   459
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   460
+      <method name="_configureButtons">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   461
+        <parameter name="aButtons"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   462
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   463
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
+          // 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
   465
+          var buttons = {};
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
+          this._buttons = buttons;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   467
+          buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   468
+          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   469
+          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
+          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
+          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
+          // look for any overriding explicit button elements
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+          var exBtns = this.getElementsByAttribute("dlgtype", "*");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
+          var dlgtype;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
+          var i;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+          for (i = 0; i < exBtns.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+            dlgtype = exBtns[i].getAttribute("dlgtype");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
+            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
   481
+            buttons[dlgtype] = exBtns[i];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   483
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   484
+          // 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
   485
+          for (dlgtype in buttons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+            var button = buttons[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+            button.addEventListener("command", this._handleButtonCommand, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
+            // 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
   490
+            if (!button.hasAttribute("label")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+              // 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
   492
+              if (this.hasAttribute("buttonlabel" + dlgtype)) {
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   493
+                button.setAttribute("label", this.getAttribute("buttonlabel" + dlgtype));
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   494
+                if (this.hasAttribute("buttonaccesskey" + dlgtype))
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   495
+                  button.setAttribute("accesskey", this.getAttribute("buttonaccesskey" + dlgtype));
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   497
+                button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype));
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   498
+                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
   499
+                if (accessKey)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+                  button.setAttribute("accesskey", accessKey);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+              }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
+            // 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
   504
+            if (!button.hasAttribute("icon")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+              // if there's an icon specified, use that
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   506
+              if (this.hasAttribute("buttonicon" + dlgtype))
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   507
+                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
   508
+              // otherwise set defaults
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
+              else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
+                switch (dlgtype) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
+                  case "accept":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   512
+                    button.setAttribute("icon", "accept");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
+                  case "cancel":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   515
+                    button.setAttribute("icon", "cancel");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   516
+                    break;
194
b77b8588484c sync dialog-kde.xml
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 191
diff changeset
   517
+                  case "disclosure":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   518
+                    button.setAttribute("icon", "properties");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   520
+                  case "help":
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   521
+                    button.setAttribute("icon", "help");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   522
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+                  default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+                }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   526
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+          }
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
+          // 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
   530
+          this.defaultButton = this.defaultButton;
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   531
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+          // 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
   533
+          if (aButtons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   534
+            // 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
   535
+            var list = aButtons.split(",");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+            // mark shown dlgtypes as true
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+            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
   539
+                          disclosure: false, extra1: false, extra2: false };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+            for (i = 0; i < list.length; ++i)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
+              shown[list[i].replace(/ /g, "")] = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   542
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
+            // hide/show the buttons we want
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   544
+            for (dlgtype in buttons)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   545
+              buttons[dlgtype].hidden = !shown[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
+
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   547
+            // 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
   548
+            if (/Win/.test(navigator.platform)) {
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   549
+              var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   550
+              spacer.removeAttribute("hidden");
1006
5ba9b67de554 full rebase incl. fixing KDE variants of UI definitions
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1005
diff changeset
   551
+              spacer.setAttribute("flex", shown.extra2 ? "1" : "0");
909
c6717354928b Firefox 46.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 904
diff changeset
   552
+            }
9
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   558
+      <method name="_setDefaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
+        <parameter name="aNewDefault"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
+          // 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
   563
+          var oldDefaultButton = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
+          if (oldDefaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+            oldDefaultButton.removeAttribute("default");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
+          var newDefaultButton = this.getButton(aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+          if (newDefaultButton) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
+            this.setAttribute("defaultButton", aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
+            newDefaultButton.setAttribute("default", "true");
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   571
+          } else {
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+            this.setAttribute("defaultButton", "none");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
+            if (aNewDefault != "none")
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   574
+              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
   575
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   576
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   578
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
+      <method name="_handleButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
+        <parameter name="aEvent"/>
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
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
+          return document.documentElement._doButtonCommand(
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
+                                        aEvent.target.getAttribute("dlgtype"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
+        ]]>
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
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   589
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
+      <method name="_doButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   591
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
+          var button = this.getButton(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
+          if (!button.disabled) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
+            var noCancel = this._fireButtonEvent(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   597
+            if (noCancel) {
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   598
+              if (aDlgType == "accept" || aDlgType == "cancel") {
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   599
+                var closingEvent = new CustomEvent("dialogclosing", {
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   600
+                  bubbles: true,
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   601
+                  detail: { button: aDlgType },
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   602
+                });
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   603
+                this.dispatchEvent(closingEvent);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
+                window.close();
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   605
+              }
9
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
+            return noCancel;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   608
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
+          return true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
+      </method>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   613
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
+      <method name="_fireButtonEvent">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   616
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
+          var event = document.createEvent("Events");
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   619
+          event.initEvent("dialog" + aDlgType, true, true);
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   620
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+          // handle dom event handlers
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+          var noCancel = this.dispatchEvent(event);
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   623
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+          // handle any xml attribute event handlers
955
55662cbdb950 update KDE variants for UI
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 952
diff changeset
   625
+          var handler = this.getAttribute("ondialog" + aDlgType);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   626
+          if (handler != "") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   627
+            var fn = new Function("event", handler);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   628
+            var returned = fn(event);
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   629
+            // 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
   630
+            if (returned == false)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
+              noCancel = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   632
+          }
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   633
+
9
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
+      <method name="_hitEnter">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
+        <parameter name="evt"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
+        <![CDATA[
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   643
+          if (evt.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
+            return;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   645
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   646
+          var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   647
+          if (btn)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
+            this._doButtonCommand(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
+    </implementation>
916
2f9f2e040647 Firefox 47.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 909
diff changeset
   654
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
+    <handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   656
+      <handler event="keypress" keycode="VK_RETURN"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
+               group="system" action="this._hitEnter(event);"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
+      <handler event="keypress" keycode="VK_ESCAPE" group="system">
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   659
+        if (!event.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   660
+          this.cancelDialog();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
+#ifdef XP_MACOSX
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
+      <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
   664
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   665
+      <handler event="focus" phase="capturing">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   666
+        var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
+        if (btn)
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   668
+          btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Ci.nsIDOMXULButtonElement));
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   670
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
+    </handlers>
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
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   674
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   675
+</bindings>
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   676
diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   677
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   678
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
1055
526f445635f3 removed obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1050
diff changeset
   679
@@ -1035,30 +1035,60 @@ nsUnknownContentTypeDialog.prototype = {
994
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   680
 
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   681
       if (params.handlerApp &&
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   682
           params.handlerApp.executable &&
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   683
           params.handlerApp.executable.isFile()) {
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   684
         // Remember the file they chose to run.
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   685
         this.chosenApp = params.handlerApp;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   686
       }
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   687
     } else if ("@mozilla.org/applicationchooser;1" in Cc) {
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   688
-      var nsIApplicationChooser = Ci.nsIApplicationChooser;
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   689
-      var appChooser = Cc["@mozilla.org/applicationchooser;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   690
-                         .createInstance(nsIApplicationChooser);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   691
-      appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   692
-      var contentTypeDialogObj = this;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   693
-      let appChooserCallback = function appChooserCallback_done(aResult) {
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   694
-        if (aResult) {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   695
-           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
   696
-        }
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   697
-        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
   698
-      };
bf0d08380dcf fix Bug 1094747 - Open with option in download dialog has no effect with kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1045
diff changeset
   699
-      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
   700
-      // 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
   701
-      return;
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   702
+      // handle the KDE case which is implemented in the filepicker
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   703
+      // 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
   704
+      // FIXME this should be better handled in the nsIApplicationChooser
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   705
+      // interface
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   706
+      var env = Components.classes["@mozilla.org/process/environment;1"]
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   707
+                          .getService(Components.interfaces.nsIEnvironment);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   708
+      if (env.get('KDE_FULL_SESSION') == "true")
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   709
+      {
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
   710
+        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
   711
+        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
   712
+                    .createInstance(nsIFilePicker);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   713
+        fp.init(this.mDialog,
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   714
+                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   715
+                nsIFilePicker.modeOpen);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   716
+
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   717
+        fp.appendFilters(nsIFilePicker.filterApps);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   718
+
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
   719
+        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
   720
+          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
   721
+            // 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
   722
+            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
   723
+              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
   724
+                         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
   725
+            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
   726
+            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
   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
+          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
   729
+        });
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   730
+      } else {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   731
+        var nsIApplicationChooser = Ci.nsIApplicationChooser;
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   732
+        var appChooser = Cc["@mozilla.org/applicationchooser;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   733
+                           .createInstance(nsIApplicationChooser);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   734
+        appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   735
+        var contentTypeDialogObj = this;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   736
+        let appChooserCallback = function appChooserCallback_done(aResult) {
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   737
+          if (aResult) {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   738
+             contentTypeDialogObj.chosenApp = aResult.QueryInterface(Ci.nsILocalHandlerApp);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   739
+          }
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   740
+          contentTypeDialogObj.finishChooseApp();
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   741
+        };
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   742
+        appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   743
+        // The finishChooseApp is called from appChooserCallback
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   744
+        return;
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   745
+      }
994
9fc447b00040 Firefox 56.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 985
diff changeset
   746
     } else {
1045
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   747
       var nsIFilePicker = Ci.nsIFilePicker;
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   748
       var fp = Cc["@mozilla.org/filepicker;1"]
f645c886d36b rebased
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1033
diff changeset
   749
                  .createInstance(nsIFilePicker);
944
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   750
       fp.init(this.mDialog,
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   751
               this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   752
               nsIFilePicker.modeOpen);
ce8a98f8d8d7 Firefox 52.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 942
diff changeset
   753
 
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   754
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
   755
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   757
@@ -15,16 +15,17 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   758
 #include "nsPrintfCString.h"
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   759
 #include "nsNetCID.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   760
 #include "nsNetUtil.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   761
 #include "nsISupportsPrimitives.h"
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   762
 #include "nsIGSettingsService.h"
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   763
 #include "nsInterfaceHashtable.h"
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   764
 #include "mozilla/Attributes.h"
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   765
 #include "nsIURI.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   766
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   767
 
850
a2bdff616a0e prepare 38beta
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 837
diff changeset
   768
 class nsUnixSystemProxySettings final : public nsISystemProxySettings {
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
 public:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
   NS_DECL_ISUPPORTS
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   771
   NS_DECL_NSISYSTEMPROXYSETTINGS
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   772
 
686
ab25aac2aa83 Firefox 26.0b5 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 680
diff changeset
   773
   nsUnixSystemProxySettings()
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   774
     : mSchemeProxySettings(4)
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   775
@@ -39,16 +40,17 @@ private:
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   776
   nsCOMPtr<nsIGSettingsService> mGSettings;
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   777
   nsCOMPtr<nsIGSettingsCollection> mProxySettings;
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   778
   nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   779
   bool IsProxyMode(const char* aMode);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   780
   nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   781
   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   782
   nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   783
   nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
+  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
 };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
 
738
f118b88b7d7f Aurora 31 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 718
diff changeset
   787
 NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   789
 NS_IMETHODIMP
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   790
 nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   791
 {
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   792
   // dbus prevents us from being threadsafe, but this routine should not block anyhow
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   793
@@ -505,16 +507,19 @@ nsUnixSystemProxySettings::GetProxyFromG
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   794
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   795
 nsresult
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   796
 nsUnixSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   797
                                           const nsACString & aScheme,
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   798
                                           const nsACString & aHost,
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   799
                                           const int32_t      aPort,
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   800
                                           nsACString & aResult)
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   801
 {
596
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 589
diff changeset
   802
+  if (nsKDEUtils::kdeSupport())
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   803
+    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
+
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   805
   if (mProxySettings) {
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   806
     nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   807
     if (NS_SUCCEEDED(rv))
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   808
       return rv;
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   809
   }
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   810
   if (mGConf)
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   811
     return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   812
 
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   813
@@ -540,8 +545,34 @@ static const mozilla::Module::ContractID
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   814
 
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   815
 static const mozilla::Module kUnixProxyModule = {
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   816
   mozilla::Module::kVersion,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   817
   kUnixProxyCIDs,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   818
   kUnixProxyContracts
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   819
 };
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   820
 
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   821
 NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   822
+
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   823
+nsresult
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   824
+nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   825
+                                           const nsACString& aHost,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   826
+                                           PRInt32 aPort,
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   827
+                                           nsACString& aResult)
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   828
+{
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   829
+  nsAutoCString url;
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   830
+  url = aScheme;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   831
+  url += "://";
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   832
+  url += aHost;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   833
+  if( aPort >= 0 )
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   834
+  {
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   835
+    url += ":";
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   836
+    url += nsPrintfCString("%d", aPort);
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   837
+  }
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   838
+  nsTArray<nsCString> command;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   839
+  command.AppendElement( NS_LITERAL_CSTRING( "GETPROXY" ));
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   840
+  command.AppendElement( url );
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   841
+  nsTArray<nsCString> result;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   842
+  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
   843
+    return NS_ERROR_FAILURE;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   844
+  aResult = result[0];
284
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   845
+  return NS_OK;
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   846
+}
ccddc8555cdb readd lost method for non libproxy builds
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 260
diff changeset
   847
+
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   848
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
   849
--- a/toolkit/xre/moz.build
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   850
+++ b/toolkit/xre/moz.build
1067
735b140fb042 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1055
diff changeset
   851
@@ -71,17 +71,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
1032
8220ea23b47d remove obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1021
diff changeset
   852
         '../components/printingui',
932
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   853
     ]
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   854
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   855
     UNIFIED_SOURCES += [
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   856
         'nsNativeAppSupportDefault.cpp',
a58cc7936ce7 Firefox 50.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 929
diff changeset
   857
         'UIKitDirProvider.mm',
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   858
     ]
923
3cc9f17ca9bb prepare FF48
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 918
diff changeset
   859
 elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   860
+    EXPORTS += ['nsKDEUtils.h']
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   861
     UNIFIED_SOURCES += [
691
18c2dc922e51 update to Firefox 27.0b2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 686
diff changeset
   862
+        'nsKDEUtils.cpp',
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   863
         'nsNativeAppSupportUnix.cpp',
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   864
     ]
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   865
 else:
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   866
     UNIFIED_SOURCES += [
659
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   867
         'nsNativeAppSupportDefault.cpp',
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   868
     ]
fa96cf6ffd14 Aurora 24 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 653
diff changeset
   869
 
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   870
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   871
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
   872
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   874
+++ b/toolkit/xre/nsKDEUtils.cpp
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   875
@@ -0,0 +1,344 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
+/* -*- 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
   877
+/* 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
   878
+ * 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
   879
+ * 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
   880
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   881
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   882
+#include "nsIWidget.h"
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   883
+#include "nsISupportsPrimitives.h"
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   884
+#include "nsIMutableArray.h"
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   885
+#include "nsComponentManagerUtils.h"
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
   886
+#include "nsArrayUtils.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   887
+
10
1920f0ff04a3 Make mozilla-kde.patch compile with 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 9
diff changeset
   888
+#include <gtk/gtk.h>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   889
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   890
+#include <limits.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
+#include <stdio.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
+#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
   893
+#include <sys/resource.h>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
+#include <unistd.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   895
+#include <X11/Xlib.h>
935
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   896
+// 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
   897
+// 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
   898
+#ifndef None
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   899
+#define None                 0L /* universal null resource or null atom */
9ae2b79d3bb1 prepare FF 51 -> 51.0b14
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 932
diff changeset
   900
+#endif
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   902
+//#define DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   903
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
+#define KMOZILLAHELPER "kmozillahelper"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   905
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   906
+// 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
   907
+#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   908
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+
538
be682f8c9361 revert API version change for kmozillahelper
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 537
diff changeset
   910
+#define KMOZILLAHELPER_VERSION 6
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   911
+#define MAKE_STR2( n ) #n
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   912
+#define MAKE_STR( n ) MAKE_STR2( n )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+static bool getKdeSession()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   915
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
+    Display* dpy = XOpenDisplay( NULL );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
+    if( dpy == NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   918
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
+    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
   920
+    bool kde = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   921
+    if( kde_full_session != None )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   923
+        int cnt;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   924
+        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
   925
+            {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   926
+            for( int i = 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   927
+                 i < cnt;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
+                 ++i )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
+                {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
+                if( props[ i ] == kde_full_session )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   931
+                    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
+                    kde = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+                    fprintf( stderr, "KDE SESSION %d\n", kde );
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
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   937
+                    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   938
+                }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   939
+            XFree( props );
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
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
+    XCloseDisplay( dpy );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
+    return kde;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
+static bool getKdeSupport()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+    {
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   948
+    nsTArray<nsCString> command;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   949
+    command.AppendElement( NS_LITERAL_CSTRING( "CHECK" ));
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   950
+    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
   951
+    bool kde = nsKDEUtils::command( command );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
+    fprintf( stderr, "KDE RUNNING %d\n", kde );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   955
+    return kde;
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
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
+nsKDEUtils::nsKDEUtils()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
+    : commandFile( NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   960
+    , replyFile( NULL )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   963
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   964
+nsKDEUtils::~nsKDEUtils()
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
+//    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
   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
+nsKDEUtils* nsKDEUtils::self()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   971
+    static nsKDEUtils s;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   972
+    return &s;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   974
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   975
+static bool helperRunning = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   976
+static bool helperFailed = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   977
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   978
+bool nsKDEUtils::kdeSession()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
+    static bool session = getKdeSession();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
+    return session;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
+    }
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
+bool nsKDEUtils::kdeSupport()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   985
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
+    static bool support = kdeSession() && getKdeSupport();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
+    return support && helperRunning;
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
+struct nsKDECommandData
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
+    FILE* file;
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   993
+    nsTArray<nsCString>* output;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
+    GMainLoop* loop;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   995
+    bool success;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
+    };
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 gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
+    nsKDECommandData* p = static_cast< nsKDECommandData* >( data );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+    char buf[ 8192 ]; // TODO big enough
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+    bool command_done = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+    bool command_failed = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+    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
  1005
+        { // 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
  1006
+//#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+//        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
  1008
+//#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+        if( char* eol = strchr( buf, '\n' ))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+            *eol = '\0';
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+        command_done = ( strcmp( buf, "\\1" ) == 0 );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+        command_failed = ( strcmp( buf, "\\0" ) == 0 );
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
  1013
+        nsAutoCString line( buf );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+        line.ReplaceSubstring( "\\n", "\n" );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
+        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
+        if( p->output && !( command_done || command_failed ))
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
  1017
+            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
  1018
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
+    bool quit = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1020
+    if( feof( p->file ) || command_failed )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
+        quit = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1023
+        p->success = false;
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
+    if( command_done )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
+        { // reading one reply finished
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
+        quit = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
+        p->success = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
+    if( quit )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
+        if( p->loop )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
+            g_main_loop_quit( p->loop );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
+        return FALSE;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
+    return TRUE;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
+
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
  1039
+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
  1040
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
+    return self()->internalCommand( command, NULL, false, output );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
+
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1044
+bool nsKDEUtils::command( nsIArray* command, nsIArray** output)
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1045
+    {
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1046
+    nsTArray<nsCString> in;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1047
+    PRUint32 length;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1048
+    command->GetLength( &length );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1049
+    for ( PRUint32 i = 0; i < length; i++ )
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1050
+        {
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1051
+        nsCOMPtr<nsISupportsCString> str = do_QueryElementAt( command, i );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1052
+        if( str )
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1053
+            {
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
  1054
+            nsAutoCString s;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1055
+            str->GetData( s );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1056
+            in.AppendElement( s );
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1057
+            }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1058
+        }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1059
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1060
+    nsTArray<nsCString> out;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1061
+    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
  1062
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1063
+    if ( !output ) return ret;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1064
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1065
+    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
  1066
+    if ( !result ) return false;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1067
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1068
+    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
  1069
+        {
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1070
+        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
  1071
+        if ( !rstr ) return false;
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
+        rstr->SetData( out[i] );
1021
1307721d2345 fixed patches for FF58
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1020
diff changeset
  1074
+        result->AppendElement( rstr );
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1075
+        }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1076
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1077
+    NS_ADDREF( *output = result);
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1078
+    return ret;
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1079
+    }
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1080
+
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1081
+
893
86f72f1e98a4 prepare Gtk3 based builds on a feature branch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 889
diff changeset
  1082
+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
  1083
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1084
+    return self()->internalCommand( command, parent, true, output );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1085
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
+
893
86f72f1e98a4 prepare Gtk3 based builds on a feature branch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 889
diff changeset
  1087
+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
  1088
+    nsTArray<nsCString>* output )
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1090
+    if( !startHelper())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
+        return false;
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
  1092
+    feedCommand( command );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+    // 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
  1094
+    // 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
  1095
+    nsKDECommandData data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1096
+    data.file = replyFile;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1097
+    data.output = output;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+    data.success = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1099
+    if( blockUi )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1101
+        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
  1102
+        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
  1103
+        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
  1104
+            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
  1105
+        gtk_widget_realize( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
+        gtk_widget_set_sensitive( window, TRUE );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1107
+        gtk_grab_add( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1108
+        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
  1109
+        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
  1110
+        g_io_channel_unref( channel );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
+        g_main_loop_run( data.loop );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
+        g_main_loop_unref( data.loop );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
+        gtk_grab_remove( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1114
+        gtk_widget_destroy( window );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1115
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
+    else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
+        data.loop = NULL;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1119
+        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
  1120
+            ;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1121
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
+    return data.success;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
+    }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
+bool nsKDEUtils::startHelper()
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
+    {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
+    if( helperRunning )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+        return true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
+    if( helperFailed )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1130
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1131
+    helperFailed = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1132
+    int fdcommand[ 2 ];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
+    int fdreply[ 2 ];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
+    if( pipe( fdcommand ) < 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
+    if( pipe( fdreply ) < 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
+        {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
+        close( fdcommand[ 0 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+        close( fdcommand[ 1 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
+        return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
+    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
  1143
+    switch( fork())
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
+        case -1:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
+            {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
+            close( fdcommand[ 0 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
+            close( fdcommand[ 1 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+            close( fdreply[ 0 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+            close( fdreply[ 1 ] );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+            return false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1153
+        case 0: // child
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+            {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+            if( dup2( fdcommand[ 0 ], STDIN_FILENO ) < 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+                _exit( 1 );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+            if( dup2( fdreply[ 1 ], STDOUT_FILENO ) < 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+                _exit( 1 );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+            int maxfd = 1024; // close all other fds
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+            struct rlimit rl;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+            if( getrlimit( RLIMIT_NOFILE, &rl ) == 0 )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
+                maxfd = rl.rlim_max;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+            for( int i = 3;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+                 i < maxfd;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1165
+                 ++i )
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+                close( i );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+#ifdef DEBUG_KDE
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1168
+            execvp( KMOZILLAHELPER, args );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+            execv( KMOZILLAHELPER, args );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+            _exit( 1 ); // failed
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
+        default: // parent
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1175
+            {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1176
+            commandFile = fdopen( fdcommand[ 1 ], "w" );
bc5dfe5b853a Rebased KDE integr