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