mozilla-kde.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Fri, 26 Oct 2012 13:01:33 +0200
changeset 568 2c74c5927ea2
parent 546 2c9448fe783c
child 589 b3ff3d8ebf9d
permissions -rw-r--r--
first working Aurora 18 build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     1
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
     2
Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     3
Author: Lubos Lunak <lunak@suse.com>
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     4
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
     5
     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
     6
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
--- a/modules/libpref/src/Makefile.in
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
+++ b/modules/libpref/src/Makefile.in
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
    10
@@ -45,14 +45,16 @@ GREPREF_FILES = $(topsrcdir)/netwerk/bas
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
 # Optimizer bug with GCC 3.2.2 on OS/2
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 ifeq ($(OS_ARCH), OS2)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 nsPrefService.$(OBJ_SUFFIX): nsPrefService.cpp
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 	$(REPORT_BUILD)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 	@$(MAKE_DEPS_AUTO_CXX)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
 	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
 endif
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    18
 
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    19
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    21
 
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    22
 greprefs.js: $(GREPREF_FILES)
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    23
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $^ > $@
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    24
 
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    25
 libs:: greprefs.js
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
    26
 	$(INSTALL) $^ $(DIST)/bin/
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    27
diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    28
--- a/modules/libpref/src/Preferences.cpp
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    29
+++ b/modules/libpref/src/Preferences.cpp
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
    30
@@ -23,16 +23,17 @@
210
f4f4388b26a8 update to 2.0b9/4.0b9
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 208
diff changeset
    31
 #include "nsIStringEnumerator.h"
164
995e803e8198 rebase patches to snapshot 20100929
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 153
diff changeset
    32
 #include "nsIZipReader.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
 #include "nsPrefBranch.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
 #include "nsXPIDLString.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 #include "nsCRT.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
 #include "nsCOMArray.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 #include "nsXPCOMCID.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
 #include "nsAutoPtr.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
 #include "nsQuickSort.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
 #include "prmem.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
 #include "pldhash.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
 #include "prefapi.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
 #include "prefread.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
 #include "prefapi_private_data.h"
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
    48
@@ -896,16 +897,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
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
    49
 
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
    50
 static nsresult pref_LoadPrefsInDirList(const char *listId)
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
    51
 {
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
    52
   nsresult rv;
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
    53
   nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    54
   if (NS_FAILED(rv))
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    55
     return rv;
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
    56
 
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
    57
+  // make sure we load these special files after all the others
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
    58
+  static const char* specialFiles[] = {
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
    59
+#if defined(XP_UNIX)
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
    60
+    ""
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
    61
+#endif
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
    62
+  };
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
    63
+
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
    64
+  if (nsKDEUtils::kdeSession()) {
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
    65
+    for(int i = 0;
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
    66
+        i < NS_ARRAY_LENGTH(specialFiles);
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
    67
+        ++i ) {
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
    68
+      if (*specialFiles[ i ] == '\0') {
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
    69
+        specialFiles[ i ] = "kde.js";
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
    70
+        break;
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
    71
+      }
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
    72
+    }
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
    73
+  }
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
    74
+
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    75
   nsCOMPtr<nsISimpleEnumerator> list;
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
    76
   dirSvc->Get(listId,
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
    77
               NS_GET_IID(nsISimpleEnumerator),
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    78
               getter_AddRefs(list));
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    79
   if (!list)
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    80
     return NS_OK;
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    81
 
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    82
   bool hasMore;
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
    83
@@ -921,17 +940,17 @@ static nsresult pref_LoadPrefsInDirList(
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    84
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
    85
     nsAutoCString leaf;
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    86
     path->GetNativeLeafName(leaf);
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    87
 
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    88
     // Do we care if a file provided by this process fails to load?
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    89
     if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    90
       ReadExtensionPrefs(path);
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    91
     else
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
    92
-      pref_LoadPrefsInDir(path, nullptr, 0);
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    93
+      pref_LoadPrefsInDir(path, specialFiles, NS_ARRAY_LENGTH(specialFiles));
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
    94
   }
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
    95
   return NS_OK;
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
    96
 }
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
    97
 
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    98
 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    99
 {
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   100
   nsZipItemPtr<char> manifest(jarReader, name, true);
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   101
   NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   102
@@ -1025,28 +1044,40 @@ static nsresult pref_InitInitialObjects(
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   103
   /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   104
   static const char* specialFiles[] = {
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   105
 #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
   106
     "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
   107
 #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
   108
     "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
   109
 #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
   110
     "unix.js"
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   111
+    , "" // placeholder for KDE  (empty is otherwise harmless)
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   112
 #if defined(VMS)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   113
     , "openvms.js"
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   114
 #elif defined(_AIX)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   115
     , "aix.js"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
 #endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
 #elif defined(XP_OS2)
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   118
     "os2pref.js"
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   119
 #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
   120
     "beos.js"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
 #endif
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   122
   };
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
 
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   124
+  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
   125
+    for(int i = 0;
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   126
+        i < NS_ARRAY_LENGTH(specialFiles);
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   127
+        ++i ) {
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   128
+      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
   129
+        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
   130
+        break;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
+      }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   132
+    }
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   133
+  }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   134
+
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   135
   rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, ArrayLength(specialFiles));
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   136
   if (NS_FAILED(rv))
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   137
     NS_WARNING("Error parsing application default preferences.");
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
 
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   139
   // 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
   140
   // or jar:$gre/omni.jar!/defaults/preferences/*.js.
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   141
   nsRefPtr<nsZipArchive> appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
438
7d934b2f5014 rebased and removed upstreamed and obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 419
diff changeset
   142
   // GetReader(mozilla::Omnijar::APP) returns null when $app == $gre, in which
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   143
diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   144
--- a/toolkit/components/downloads/Makefile.in
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   145
+++ b/toolkit/components/downloads/Makefile.in
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
   146
@@ -41,9 +41,12 @@ EXTRA_COMPONENTS = \
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   147
   nsDownloadManagerUI.manifest \
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 289
diff changeset
   148
   $(NULL)
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 289
diff changeset
   149
 endif
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   150
 
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   151
 TEST_DIRS += test
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
 include $(topsrcdir)/config/rules.mk
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
   154
 
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
   156
+
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
   157
+
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
   158
 CXXFLAGS += $(TK_CFLAGS)
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   159
diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   160
--- a/toolkit/components/downloads/nsDownloadManager.cpp
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   161
+++ b/toolkit/components/downloads/nsDownloadManager.cpp
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   162
@@ -36,16 +36,20 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
 
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   164
 #ifdef XP_WIN
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
 #include <shlobj.h>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
 #ifdef DOWNLOAD_SCANNER
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   167
 #include "nsDownloadScanner.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
 #endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
 #endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
+#if defined(XP_UNIX) && !defined(XP_MACOSX)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   175
 #ifdef XP_MACOSX
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   176
 #include <CoreFoundation/CoreFoundation.h>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   177
 #endif
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   178
 
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   179
 #ifdef MOZ_WIDGET_ANDROID
259
31beb466ca79 snapshot 20110411
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
   180
 #include "AndroidBridge.h"
31beb466ca79 snapshot 20110411
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
   181
 #endif
31beb466ca79 snapshot 20110411
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
   182
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   183
@@ -2253,16 +2257,25 @@ nsDownload::SetState(DownloadState aStat
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
       nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
       // Master pref to control this function.
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   187
       bool showTaskbarAlert = true;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
       if (pref)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
         pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   191
       if (showTaskbarAlert) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
+        if( nsKDEUtils::kdeSupport()) {
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   193
+          nsTArray<nsCString> command;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   194
+          command.AppendElement( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" ));
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   195
+          nsAutoString displayName;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   196
+          GetDisplayName( displayName );
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   197
+          command.AppendElement( nsAutoCString( ToNewUTF8String( displayName )));
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   198
+          nsKDEUtils::command( command );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
+        } else {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
+        // begin non-KDE block
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   201
         int32_t alertInterval = 2000;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
         if (pref)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
           pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
 
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   205
         int64_t alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   206
         int64_t goat = PR_Now() - mStartTime;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
         showTaskbarAlert = goat > alertIntervalUSec;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   209
@@ -2286,19 +2299,20 @@ nsDownload::SetState(DownloadState aStat
260
a9a2a9c8b831 fix incorrectly rebased patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 259
diff changeset
   210
               // If downloads are automatically removed per the user's
259
31beb466ca79 snapshot 20110411
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
   211
               // retention policy, there's no reason to make the text clickable
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
               // because if it is, they'll click open the download manager and
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
               // the items they downloaded will have been removed.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
               alerts->ShowAlertNotification(
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
                   NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title,
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
                   message, !removeWhenDone, EmptyString(), mDownloadManager,
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
                   EmptyString());
260
a9a2a9c8b831 fix incorrectly rebased patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 259
diff changeset
   218
-            }
a9a2a9c8b831 fix incorrectly rebased patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 259
diff changeset
   219
+          }
a9a2a9c8b831 fix incorrectly rebased patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 259
diff changeset
   220
         }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
       }
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   222
+      }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   223
 
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
   224
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK2)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
       nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
153
46ee28dc7145 Update to 4.0b5
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 127
diff changeset
   226
       nsCOMPtr<nsIFile> file;
46ee28dc7145 Update to 4.0b5
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 127
diff changeset
   227
       nsAutoString path;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
 
153
46ee28dc7145 Update to 4.0b5
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 127
diff changeset
   229
       if (fileURL &&
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   230
           NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
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
   232
--- a/toolkit/content/jar.mn
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
+++ b/toolkit/content/jar.mn
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   234
@@ -46,29 +46,33 @@ toolkit.jar:
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   235
    content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   236
 *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   237
    content/global/bindings/browser.xml         (widgets/browser.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   238
    content/global/bindings/button.xml          (widgets/button.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   239
    content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   240
    content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   241
    content/global/bindings/datetimepicker.xml  (widgets/datetimepicker.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
 *+ content/global/bindings/dialog.xml          (widgets/dialog.xml)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
+*+ content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
+% 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
   245
    content/global/bindings/editor.xml          (widgets/editor.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   246
    content/global/bindings/expander.xml        (widgets/expander.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
 *  content/global/bindings/filefield.xml       (widgets/filefield.xml)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
 *+ content/global/bindings/findbar.xml         (widgets/findbar.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   249
    content/global/bindings/general.xml         (widgets/general.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   250
    content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
 *+ content/global/bindings/listbox.xml         (widgets/listbox.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   252
    content/global/bindings/menu.xml            (widgets/menu.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   253
    content/global/bindings/menulist.xml        (widgets/menulist.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   254
    content/global/bindings/notification.xml    (widgets/notification.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   255
    content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   256
    content/global/bindings/popup.xml           (widgets/popup.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   257
 *+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
+*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
+% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   260
    content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   261
    content/global/bindings/radio.xml           (widgets/radio.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   262
    content/global/bindings/resizer.xml         (widgets/resizer.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   263
    content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   264
    content/global/bindings/scale.xml           (widgets/scale.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   265
    content/global/bindings/scrollbar.xml       (widgets/scrollbar.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   266
    content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   267
    content/global/bindings/splitter.xml        (widgets/splitter.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
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
   269
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
+++ b/toolkit/content/widgets/dialog-kde.xml
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   272
@@ -0,0 +1,451 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
+<?xml version="1.0"?>
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   274
+<!-- 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
   275
+   - 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
   276
+   - 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
   277
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   278
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
+<bindings id="dialogBindings"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
+          xmlns="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   281
+          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
   282
+          xmlns:xbl="http://www.mozilla.org/xbl">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
+  
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+  <binding id="dialog" extends="chrome://global/content/bindings/general.xml#root-element">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
+    <resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+      <stylesheet src="chrome://global/skin/dialog.css"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+    </resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+    <content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+      <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
   290
+        <children/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+      </xul:vbox>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
+      <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
   294
+                xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   295
+#ifdef XP_UNIX_GNOME
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
+        <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
   298
+        <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
   299
+        <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
   300
+        <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
   301
+        <xul:spacer anonid="spacer" flex="1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+        <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
   304
+#elif XP_UNIX
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+                pack="end">
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   306
+	<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   307
+	<xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   308
+	<xul:spacer anonid="spacer" flex="1" hidden="true"/>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   309
+	<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   310
+	<xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   311
+	<xul:button dlgtype="cancel" class="dialog-button"/>
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   312
+	<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
   313
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
+                pack="end">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+        <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
   316
+        <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
   317
+        <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
   318
+        <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
   319
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
+        <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
   321
+        <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
   322
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
+      </xul:hbox>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+    </content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+    <implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+      <field name="_mStrBundle">null</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+      <field name="_closeHandler">(function(event) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+        if (!document.documentElement.cancelDialog())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+          event.preventDefault();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+      })</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   332
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
+      <property name="buttons"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
+                onget="return this.getAttribute('buttons');"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
+                onset="this._configureButtons(val); return val;"/>
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
+      <property name="defaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+          if (this.hasAttribute("defaultButton"))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   341
+            return this.getAttribute("defaultButton");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
+          else // default to the accept button
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
+            return "accept";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   346
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
+          this._setDefaultButton(val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
+      <method name="acceptDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   356
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   357
+          return this._doButtonCommand("accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   358
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   360
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
+      <method name="cancelDialog">
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
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
+          return this._doButtonCommand("cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+      </method>
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
+      <method name="getButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
+          return this._buttons[aDlgType];
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+      </method>
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
+      <method name="moveToAlertPosition">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+          // 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
   383
+          if (window.outerWidth == 1) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   384
+            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
   385
+            sizeToContent();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
+          var xOffset = (opener.outerWidth - window.outerWidth) / 2;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
+          var yOffset = opener.outerHeight / 5;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
+          var newX = opener.screenX + xOffset;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+          var newY = opener.screenY + yOffset;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   393
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   394
+          // 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
   395
+          if (newX < screen.availLeft)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   396
+            newX = screen.availLeft + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   397
+          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
   398
+            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
   399
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
+          if (newY < screen.availTop)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
+            newY = screen.availTop + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+          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
   403
+            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
   404
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
+          window.moveTo( newX, newY );
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   409
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+      <method name="centerWindowOnScreen">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   411
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   412
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   413
+          var xOffset = screen.availWidth/2 - window.outerWidth/2;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   414
+          var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
+  
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   416
+          xOffset = xOffset > 0 ? xOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   417
+          yOffset = yOffset > 0 ? yOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
+          window.moveTo(xOffset, yOffset);
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+      <constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+      <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
+        this._configureButtons(this.buttons);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   427
+        // listen for when window is closed via native close buttons
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
+        window.addEventListener("close", this._closeHandler, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   430
+        // for things that we need to initialize after onload fires
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
+        window.addEventListener("load", this.postLoadInit, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   432
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   433
+        window.moveToAlertPosition = this.moveToAlertPosition;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+        window.centerWindowOnScreen = this.centerWindowOnScreen;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   435
+      ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
+      </constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   437
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
+      <method name="postLoadInit">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   442
+          function focusInit() {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
+            const dialog = document.documentElement;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   444
+            const defaultButton = dialog.getButton(dialog.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
+            // 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
   446
+            if (!document.commandDispatcher.focusedElement) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
+              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
+              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
   450
+              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
   451
+                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
   452
+                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
   453
+                       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
   454
+                  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
   455
+                  focusedElt = document.commandDispatcher.focusedElement;
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   456
+                  if (focusedElt == initialFocusedElt)
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   457
+                    break;
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   458
+                }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   459
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   460
+                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
   461
+                  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
   462
+                    // 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
   463
+                    // 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
   464
+                    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
   465
+                  }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
+                }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   467
+#ifndef XP_MACOSX
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   468
+                else if (focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   469
+                  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
   470
+                }
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   471
+#endif
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
+              }
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
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+            try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
+              if (defaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
+                window.notifyDefaultButtonLoaded(defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+            } catch (e) { }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
+          // 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
   482
+          setTimeout(focusInit, 0);
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   485
+      </method>                
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+      <property name="mStrBundle">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
+          if (!this._mStrBundle) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+            // 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
   492
+            // see bug 63370 for details
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+            this._mStrBundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
+                                         .getService(Components.interfaces.nsIStringBundleService)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
+                                         .createBundle("chrome://global/locale/dialog.properties");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
+          return this._mStrBundle;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   498
+        ]]></getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+      <method name="_configureButtons">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
+        <parameter name="aButtons"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   504
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+          // 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
   506
+          var buttons = {};
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   507
+          this._buttons = buttons;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
+          buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
+          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
+          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
+          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
+          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
+          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   515
+          // look for any overriding explicit button elements
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   516
+          var exBtns = this.getElementsByAttribute("dlgtype", "*");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   517
+          var dlgtype;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   518
+          var i;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+          for (i = 0; i < exBtns.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   520
+            dlgtype = exBtns[i].getAttribute("dlgtype");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   521
+            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
   522
+            buttons[dlgtype] = exBtns[i];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+          // 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
   526
+          for (dlgtype in buttons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+            var button = buttons[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+            button.addEventListener("command", this._handleButtonCommand, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+            // 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
   531
+            if (!button.hasAttribute("label")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+              // dialog attributes override the default labels in dialog.properties
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   533
+              if (this.hasAttribute("buttonlabel"+dlgtype)) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   534
+                button.setAttribute("label", this.getAttribute("buttonlabel"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+                if (this.hasAttribute("buttonaccesskey"+dlgtype))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+                  button.setAttribute("accesskey", this.getAttribute("buttonaccesskey"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+                button.setAttribute("label", this.mStrBundle.GetStringFromName("button-"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   539
+                var accessKey = this.mStrBundle.GetStringFromName("accesskey-"+dlgtype);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+                if (accessKey)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
+                  button.setAttribute("accesskey", accessKey);
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
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   544
+            // 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
   545
+            if (!button.hasAttribute("icon")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
+              // if there's an icon specified, use that
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
+              if (this.hasAttribute("buttonicon"+dlgtype))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   548
+                button.setAttribute("icon", this.getAttribute("buttonicon"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
+              // otherwise set defaults
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
+              else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
+                switch (dlgtype) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   552
+                  case "accept":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   553
+                    button.setAttribute("icon","accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
+                  case "cancel":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+                    button.setAttribute("icon","cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+                    break;
194
b77b8588484c sync dialog-kde.xml
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 191
diff changeset
   558
+                  case "disclosure":
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
+                    button.setAttribute("icon","properties");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
+                  case "help":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
+                    button.setAttribute("icon","help");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
+                  default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+                    break;
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
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
+          // 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
   571
+          this.defaultButton = this.defaultButton;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
+          // 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
   574
+          if (aButtons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   575
+            // 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
   576
+            var list = aButtons.split(",");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   578
+            // mark shown dlgtypes as true
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
+            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
   580
+                          disclosure: false, extra1: false, extra2: false };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
+            for (i = 0; i < list.length; ++i)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
+              shown[list[i].replace(/ /g, "")] = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   583
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
+            // hide/show the buttons we want
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
+            for (dlgtype in buttons) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
+              buttons[dlgtype].hidden = !shown[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   587
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   588
+#ifdef XP_WIN
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   589
+#           show the spacer on Windows only when the extra2 button is present
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
+            var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   591
+            spacer.removeAttribute("hidden");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
+            spacer.setAttribute("flex", shown["extra2"]?"1":"0");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   597
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   598
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   599
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   600
+      <method name="_setDefaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   601
+        <parameter name="aNewDefault"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   602
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
+          // 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
   605
+          var oldDefaultButton = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
+          if (oldDefaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   607
+            oldDefaultButton.removeAttribute("default");
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
+          var newDefaultButton = this.getButton(aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
+          if (newDefaultButton) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
+            this.setAttribute("defaultButton", aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
+            newDefaultButton.setAttribute("default", "true");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
+          else {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
+            this.setAttribute("defaultButton", "none");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   616
+            if (aNewDefault != "none")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+              dump("invalid new default button: " +  aNewDefault + ", assuming: none\n");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   619
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   620
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   623
+      <method name="_handleButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   625
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   626
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   627
+          return document.documentElement._doButtonCommand(
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   628
+                                        aEvent.target.getAttribute("dlgtype"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   629
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   630
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   632
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
+      <method name="_doButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   635
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   636
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
+          var button = this.getButton(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
+          if (!button.disabled) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
+            var noCancel = this._fireButtonEvent(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
+            if (noCancel) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
+              if (aDlgType == "accept" || aDlgType == "cancel")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
+                window.close();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
+            return noCancel;
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
+          return true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   647
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
+      <method name="_fireButtonEvent">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   654
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
+          var event = document.createEvent("Events");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   656
+          event.initEvent("dialog"+aDlgType, true, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
+          // handle dom event handlers
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   659
+          var noCancel = this.dispatchEvent(event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   660
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
+          // handle any xml attribute event handlers
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
+          var handler = this.getAttribute("ondialog"+aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
+          if (handler != "") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
+            var fn = new Function("event", handler);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   665
+            var returned = fn(event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   666
+            if (returned == false)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
+              noCancel = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   668
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   670
+          return noCancel;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   672
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   673
+      </method>
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
+      <method name="_hitEnter">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
+        <parameter name="evt"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
+        <![CDATA[
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   679
+          if (evt.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   680
+            return;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   681
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   682
+          var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   683
+          if (btn)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   684
+            this._doButtonCommand(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   685
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   686
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   687
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
+    </implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
+    
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
+    <handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   692
+      <handler event="keypress" keycode="VK_ENTER"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   693
+               group="system" action="this._hitEnter(event);"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   694
+      <handler event="keypress" keycode="VK_RETURN"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   695
+               group="system" action="this._hitEnter(event);"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   696
+      <handler event="keypress" keycode="VK_ESCAPE" group="system">
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   697
+        if (!event.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   698
+          this.cancelDialog();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   700
+#ifdef XP_MACOSX
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   701
+      <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
   702
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   703
+      <handler event="focus" phase="capturing">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   704
+        var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   705
+        if (btn)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   706
+          btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Components.interfaces.nsIDOMXULButtonElement));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   707
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   708
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   709
+    </handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   710
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   711
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   712
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   713
+  <binding id="dialogheader">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   714
+    <resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   715
+      <stylesheet src="chrome://global/skin/dialog.css"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   716
+    </resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   717
+    <content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   718
+      <xul:label class="dialogheader-title" xbl:inherits="value=title,crop" crop="right" flex="1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   719
+      <xul:label class="dialogheader-description" xbl:inherits="value=description"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   720
+    </content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   721
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   722
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   723
+</bindings>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   724
diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   725
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   726
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   727
+++ b/toolkit/content/widgets/preferences-kde.xml
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   728
@@ -0,0 +1,1339 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   729
+<?xml version="1.0"?>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   730
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   731
+<!DOCTYPE bindings [
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   732
+  <!ENTITY % preferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   733
+  %preferencesDTD;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   734
+  <!ENTITY % globalKeysDTD SYSTEM "chrome://global/locale/globalKeys.dtd">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   735
+  %globalKeysDTD;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   736
+]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   737
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   738
+<bindings id="preferencesBindings"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   739
+          xmlns="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   740
+          xmlns:xbl="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   741
+          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
   742
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   743
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   744
+# = Preferences Window Framework
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   745
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   746
+#   The syntax for use looks something like:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   747
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   748
+#   <prefwindow>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   749
+#     <prefpane id="prefPaneA">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   750
+#       <preferences>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   751
+#         <preference id="preference1" name="app.preference1" type="bool" onchange="foo();"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   752
+#         <preference id="preference2" name="app.preference2" type="bool" useDefault="true"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   753
+#       </preferences>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   754
+#       <checkbox label="Preference" preference="preference1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   755
+#     </prefpane>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
+#   </prefwindow>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   757
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   758
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   759
+  <binding id="preferences">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   760
+    <implementation implements="nsIObserver">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   761
+      <method name="observe">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   762
+        <parameter name="aSubject"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   763
+        <parameter name="aTopic"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   764
+        <parameter name="aData"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   765
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   766
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   767
+          for (var i = 0; i < this.childNodes.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   768
+            var preference = this.childNodes[i];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
+            if (preference.name == aData) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
+              preference.value = preference.valueFromPreferences;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   771
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   772
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   773
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   774
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   775
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   776
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   777
+      <method name="fireChangedEvent">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   778
+        <parameter name="aPreference"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   779
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   780
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   781
+          // Value changed, synthesize an event
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   782
+          try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   783
+            var event = document.createEvent("Events");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
+            event.initEvent("change", true, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+            aPreference.dispatchEvent(event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
+          catch (e) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
+            Components.utils.reportError(e);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   789
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   790
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   791
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   792
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   793
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   794
+      <field name="service">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
+        Components.classes["@mozilla.org/preferences-service;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   796
+                  .getService(Components.interfaces.nsIPrefService);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   797
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   798
+      <field name="rootBranch">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   799
+        Components.classes["@mozilla.org/preferences-service;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   800
+                  .getService(Components.interfaces.nsIPrefBranch);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   801
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   802
+      <field name="defaultBranch">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   803
+        this.service.getDefaultBranch("");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   805
+      <field name="rootBranchInternal">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   806
+        Components.classes["@mozilla.org/preferences-service;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   807
+                  .getService(Components.interfaces.nsIPrefBranchInternal);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   808
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   809
+      <property name="type" readonly="true">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   810
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   811
+          <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   812
+            return document.documentElement.type || "";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   813
+          ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   814
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   815
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   816
+      <property name="instantApply" readonly="true">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   817
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   818
+          <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   819
+            var doc = document.documentElement;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   820
+            return this.type == "child" ? doc.instantApply
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   821
+                                        : doc.instantApply || this.rootBranch.getBoolPref("browser.preferences.instantApply");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   822
+          ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   823
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   824
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   825
+    </implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   826
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   827
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   828
+  <binding id="preference">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   829
+    <implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   830
+      <constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   831
+      <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   832
+        // if the element has been inserted without the name attribute set,
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   833
+        // we have nothing to do here
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   834
+        if (!this.name)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   835
+          return;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   836
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   837
+        this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   838
+            .addObserver(this.name, this.preferences, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   839
+        // In non-instant apply mode, we must try and use the last saved state
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   840
+        // from any previous opens of a child dialog instead of the value from
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   841
+        // preferences, to pick up any edits a user may have made. 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   842
+        if (this.preferences.type == "child" && 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   843
+            !this.instantApply && window.opener) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   844
+          var pdoc = window.opener.document;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   845
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   846
+          // Try to find a preference element for the same preference.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   847
+          var preference = null;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   848
+          var parentPreferences = pdoc.getElementsByTagName("preferences");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   849
+          for (var k = 0; (k < parentPreferences.length && !preference); ++k) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   850
+            var parentPrefs = parentPreferences[k]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   851
+                                    .getElementsByAttribute("name", this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   852
+            for (var l = 0; (l < parentPrefs.length && !preference); ++l) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   853
+              if (parentPrefs[l].localName == "preference")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   854
+                preference = parentPrefs[l];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   855
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   856
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   857
+          this._setValue(preference ? preference.value 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   858
+                                    : this.valueFromPreferences, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   859
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   860
+        else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   861
+          this._setValue(this.valueFromPreferences, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   862
+      ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   863
+      </constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   864
+      <destructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   865
+        this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   866
+            .removeObserver(this.name, this.preferences);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   867
+      </destructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   868
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   869
+      <property name="instantApply">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   870
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   871
+          return this.getAttribute("instantApply") == "true" || this.preferences.instantApply;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   872
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   874
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   875
+      <property name="preferences" onget="return this.parentNode"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
+      <property name="name" onget="return this.getAttribute('name');">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   877
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   878
+          if (val == this.name)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   879
+            return val;
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
+          this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   882
+              .removeObserver(this.name, this.preferences);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   883
+          this.setAttribute('name', val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   884
+          this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   885
+              .addObserver(val, this.preferences, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   886
+              
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   887
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   888
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   889
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   890
+      <property name="type" onget="return this.getAttribute('type');"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
+                            onset="this.setAttribute('type', val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
+      <property name="inverted" onget="return this.getAttribute('inverted') == 'true';"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   893
+                                onset="this.setAttribute('inverted', val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
+      <property name="readonly" onget="return this.getAttribute('readonly') == 'true';"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   895
+                                onset="this.setAttribute('readonly', val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   896
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   897
+      <field name="_value">null</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   898
+      <method name="_setValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   899
+        <parameter name="aValue"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
+        <parameter name="aUpdate"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   902
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   903
+          if (aUpdate && this.value !== aValue) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
+            this._value = aValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   905
+            if (this.instantApply)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   906
+              this.valueFromPreferences = aValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   907
+            this.preferences.fireChangedEvent(this);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   908
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+          else if (!aUpdate) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   910
+            this._value = aValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   911
+            this.updateElements();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   912
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+          return aValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   915
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
+      <property name="value" onget="return this._value" onset="return this._setValue(val, true);"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   918
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
+      <property name="locked">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   920
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   921
+          return this.preferences.rootBranch.prefIsLocked(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   923
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   924
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   925
+      <property name="disabled">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   926
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   927
+          return this.getAttribute("disabled") == "true";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   931
+          if (val) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
+            this.setAttribute("disabled", "true");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+          else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+            this.removeAttribute("disabled");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   935
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   936
+          if (!this.id)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   937
+            return val;
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
+          var elements = document.getElementsByAttribute("preference", this.id);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   940
+          for (var i = 0; i < elements.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   941
+            elements[i].disabled = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
+            var labels = document.getElementsByAttribute("control", elements[i].id);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
+            for (var j = 0; j < labels.length; ++j)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
+              labels[j].disabled = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   948
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   949
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   951
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
+      <property name="tabIndex">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   955
+          return parseInt(this.getAttribute("tabindex"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
+          if (val) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   960
+            this.setAttribute("tabindex", val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
+          else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
+            this.removeAttribute("tabindex");
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
+          if (!this.id)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   965
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   966
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   967
+          var elements = document.getElementsByAttribute("preference", this.id);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
+          for (var i = 0; i < elements.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
+            elements[i].tabIndex = val;
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
+            var labels = document.getElementsByAttribute("control", elements[i].id);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   972
+            for (var j = 0; j < labels.length; ++j)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
+              labels[j].tabIndex = val;
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
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   976
+          return val;
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
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
+      <property name="hasUserValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
+          return this.preferences.rootBranch.prefHasUserValue(this.name) &&
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   985
+                 this.value !== undefined;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
+      </property>
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
+      <method name="reset">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
+          // defer reset until preference update
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   993
+          this.value = undefined;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   995
+      </method>
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
+      <field name="_useDefault">false</field>      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   998
+      <property name="defaultValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+          this._useDefault = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+          var val = this.valueFromPreferences;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+          this._useDefault = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1008
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+      <property name="_branch">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+          return this._useDefault ? this.preferences.defaultBranch : this.preferences.rootBranch;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
+      <field name="batching">false</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
+      <method name="_reportUnknownType">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1020
+          var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
+                                         .getService(Components.interfaces.nsIConsoleService);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
+          var msg = "<preference> with id='" + this.id + "' and name='" + 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1023
+                    this.name + "' has unknown type '" + this.type + "'.";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1024
+          consoleService.logStringMessage(msg);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
+      <property name="valueFromPreferences">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
+          try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
+            // Force a resync of value with preferences.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
+            switch (this.type) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
+            case "int":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
+              return this._branch.getIntPref(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
+            case "bool":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
+              var val = this._branch.getBoolPref(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1039
+              return this.inverted ? !val : val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1040
+            case "wstring":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
+              return this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
+                         .getComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
+                         .data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1044
+            case "string":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1045
+            case "unichar":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1046
+              return this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1047
+                         .getComplexValue(this.name, Components.interfaces.nsISupportsString)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1048
+                         .data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1049
+            case "fontname":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1050
+              var family = this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1051
+                               .getComplexValue(this.name, Components.interfaces.nsISupportsString)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1052
+                               .data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1053
+              var fontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1054
+                                             .createInstance(Components.interfaces.nsIFontEnumerator);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1055
+              return fontEnumerator.getStandardFamilyName(family);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
+            case "file":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
+              var f = this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1058
+                          .getComplexValue(this.name, Components.interfaces.nsILocalFile);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1059
+              return f;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
+            default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
+              this._reportUnknownType();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1063
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
+          catch (e) { }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1065
+          return null;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1066
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1068
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1069
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
+          // Exit early if nothing to do.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1071
+          if (this.readonly || this.valueFromPreferences == val)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1072
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1073
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1074
+          // The special value undefined means 'reset preference to default'.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1075
+          if (val === undefined) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1076
+            this.preferences.rootBranch.clearUserPref(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1077
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1078
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1079
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1080
+          // Force a resync of preferences with value.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1081
+          switch (this.type) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1082
+          case "int":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1083
+            this.preferences.rootBranch.setIntPref(this.name, val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1084
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1085
+          case "bool":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
+            this.preferences.rootBranch.setBoolPref(this.name, this.inverted ? !val : val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1087
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1088
+          case "wstring":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
+            var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1090
+                                .createInstance(Components.interfaces.nsIPrefLocalizedString);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
+            pls.data = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1092
+            this.preferences.rootBranch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+                .setComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString, pls);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1094
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1095
+          case "string":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1096
+          case "unichar":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1097
+          case "fontname":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+            var iss = Components.classes["@mozilla.org/supports-string;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1099
+                                .createInstance(Components.interfaces.nsISupportsString);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
+            iss.data = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1101
+            this.preferences.rootBranch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1102
+                .setComplexValue(this.name, Components.interfaces.nsISupportsString, iss);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1103
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1104
+          case "file":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1105
+            var lf;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
+            if (typeof(val) == "string") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1107
+              lf = Components.classes["@mozilla.org/file/local;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1108
+                             .createInstance(Components.interfaces.nsILocalFile);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1109
+              lf.persistentDescriptor = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1110
+              if (!lf.exists())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
+                lf.initWithPath(val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
+            else 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1114
+              lf = val.QueryInterface(Components.interfaces.nsILocalFile);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1115
+            this.preferences.rootBranch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
+                .setComplexValue(this.name, Components.interfaces.nsILocalFile, lf);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
+          default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1119
+            this._reportUnknownType();
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
+          if (!this.batching)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
+            this.preferences.service.savePrefFile(null);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
+          return val;
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
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+      <method name="setElementValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
+        <parameter name="aElement"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1130
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1131
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1132
+          if (this.locked)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
+            aElement.disabled = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
+          if (!this.isElementEditable(aElement))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
+            return;
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
+          var rv = undefined;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+          if (aElement.hasAttribute("onsyncfrompreference")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
+            // Value changed, synthesize an event
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
+            try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
+              var event = document.createEvent("Events");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
+              event.initEvent("syncfrompreference", true, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1144
+              var f = new Function ("event", 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1145
+                                    aElement.getAttribute("onsyncfrompreference"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
+              rv = f.call(aElement, event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
+            catch (e) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+              Components.utils.reportError(e);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+          var val = rv !== undefined ? rv : (this.instantApply ? this.valueFromPreferences : this.value);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1153
+          // if the preference is marked for reset, show default value in UI
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+          if (val === undefined)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+            val = this.defaultValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+          /**
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+           * Initialize a UI element property with a value. Handles the case 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+           * where an element has not yet had a XBL binding attached for it and
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+           * the property setter does not yet exist by setting the same attribute
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+           * on the XUL element using DOM apis and assuming the element's 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
+           * constructor or property getters appropriately handle this state. 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+           */
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+          function setValue(element, attribute, value) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1165
+            if (attribute in element) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+              element[attribute] = value;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+            else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1168
+              element.setAttribute(attribute, value);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+          if (aElement.localName == "checkbox" ||
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+              aElement.localName == "listitem")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+            setValue(aElement, "checked", val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
+          else if (aElement.localName == "colorpicker")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1174
+            setValue(aElement, "color", val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1175
+          else if (aElement.localName == "textbox") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1176
+            // XXXmano Bug 303998: Avoid a caret placement issue if either the
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1177
+            // preference observer or its setter calls updateElements as a result
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1178
+            // of the input event handler.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1179
+            if (aElement.value !== val)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1180
+              setValue(aElement, "value", val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1181
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1182
+          else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1183
+            setValue(aElement, "value", val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1184
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1185
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1186
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1187
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1188
+      <method name="getElementValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1189
+        <parameter name="aElement"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1190
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1191
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1192
+          if (aElement.hasAttribute("onsynctopreference")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1193
+            // Value changed, synthesize an event
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1194
+            try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1195
+              var event = document.createEvent("Events");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1196
+              event.initEvent("synctopreference", true, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1197
+              var f = new Function ("event", 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1198
+                                    aElement.getAttribute("onsynctopreference"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1199
+              var rv = f.call(aElement, event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1200
+              if (rv !== undefined) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1201
+                return rv;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1202
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1203
+            catch (e) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1204
+              Components.utils.reportError(e);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1205
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1206
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.o&