mozilla-kde.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Sat, 12 Mar 2016 08:51:29 +0100
branchfirefox45
changeset 904 6a889427cd4f
parent 901 eb9ebe3e2e6a
child 909 c6717354928b
permissions -rw-r--r--
45.0 release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
828
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
     1
# HG changeset patch
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
     2
# Parent  797d5f17b080f54439602f107ecaf6b09a0ef5c1
398
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     3
Description: Add KDE integration to Firefox (toolkit parts)
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     4
Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     5
Author: Lubos Lunak <lunak@suse.com>
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     6
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     7
     https://bugzilla.novell.com/show_bug.cgi?id=170055
937669e1c537 ported and reenabled KDE integration (bnc#746591)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 368
diff changeset
     8
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
     9
diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
    10
--- a/modules/libpref/Preferences.cpp
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
    11
+++ b/modules/libpref/Preferences.cpp
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
    12
@@ -30,16 +30,17 @@
164
995e803e8198 rebase patches to snapshot 20100929
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 153
diff changeset
    13
 #include "nsIZipReader.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 #include "nsPrefBranch.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 #include "nsXPIDLString.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
 #include "nsCRT.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
 #include "nsCOMArray.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
 #include "nsXPCOMCID.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
 #include "nsAutoPtr.h"
686
ab25aac2aa83 Firefox 26.0b5 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 680
diff changeset
    20
 #include "nsPrintfCString.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
 #include "nsQuickSort.h"
889
de3a92aed259 43.0b9 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 885
diff changeset
    24
 #include "PLDHashTable.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
 #include "prefapi.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
 #include "prefread.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
 #include "prefapi_private_data.h"
612
3006d73ad2fa move on to Aurora 20
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 609
diff changeset
    29
 
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    30
@@ -1136,16 +1137,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
181
12fe57ebc7a1 if any xul application (like Firefox) has ships a kde.js pref file make sure it gets loaded last
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 169
diff changeset
    31
 
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
    32
 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
    33
 {
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
    34
   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
    35
   nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    36
   if (NS_FAILED(rv))
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    37
     return rv;
181
12fe57ebc7a1 if any xul application (like Firefox) has ships a kde.js pref file make sure it gets loaded last
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 169
diff changeset
    38
 
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
    39
+  // 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
    40
+  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
    41
+#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
    42
+    ""
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
+#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
    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
+
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
+  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
    47
+    for(int i = 0;
716
cef565f1c325 update to Firefox 29.0b7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 703
diff changeset
    48
+        i < MOZ_ARRAY_LENGTH(specialFiles);
181
12fe57ebc7a1 if any xul application (like Firefox) has ships a kde.js pref file make sure it gets loaded last
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 169
diff changeset
    49
+        ++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
    50
+      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
    51
+        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
    52
+        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
    53
+      }
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
+  }
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
+
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    57
   nsCOMPtr<nsISimpleEnumerator> list;
181
12fe57ebc7a1 if any xul application (like Firefox) has ships a kde.js pref file make sure it gets loaded last
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 169
diff changeset
    58
   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
    59
               NS_GET_IID(nsISimpleEnumerator),
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    60
               getter_AddRefs(list));
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    61
   if (!list)
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    62
     return NS_OK;
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    63
 
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    64
   bool hasMore;
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    65
@@ -1161,17 +1180,17 @@ static nsresult pref_LoadPrefsInDirList(
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    66
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
    67
     nsAutoCString leaf;
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    68
     path->GetNativeLeafName(leaf);
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    69
 
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    70
     // Do we care if a file provided by this process fails to load?
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
    71
     if (Substring(leaf, leaf.Length() - 4).EqualsLiteral(".xpi"))
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    72
       ReadExtensionPrefs(path);
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    73
     else
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
    74
-      pref_LoadPrefsInDir(path, nullptr, 0);
716
cef565f1c325 update to Firefox 29.0b7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 703
diff changeset
    75
+      pref_LoadPrefsInDir(path, specialFiles, MOZ_ARRAY_LENGTH(specialFiles));
181
12fe57ebc7a1 if any xul application (like Firefox) has ships a kde.js pref file make sure it gets loaded last
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 169
diff changeset
    76
   }
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
   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
    78
 }
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
 
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    80
 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
419
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    81
 {
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    82
   nsZipItemPtr<char> manifest(jarReader, name, true);
f6b055dd94bc commit Aurora 13 state
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 409
diff changeset
    83
   NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
    84
@@ -1265,26 +1284,38 @@ 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
    85
   /* 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
    86
   static const char* specialFiles[] = {
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    87
 #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
    88
     "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
    89
 #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
    90
     "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
    91
 #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
    92
     "unix.js"
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    93
+    , "" // placeholder for KDE  (empty is otherwise harmless)
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    94
 #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
    95
     , "openvms.js"
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    96
 #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
    97
     , "aix.js"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
 #endif
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
    99
 #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
   100
     "beos.js"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
 #endif
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   102
   };
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
 
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   104
+  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
   105
+    for(int i = 0;
716
cef565f1c325 update to Firefox 29.0b7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 703
diff changeset
   106
+        i < MOZ_ARRAY_LENGTH(specialFiles);
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   107
+        ++i ) {
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   108
+      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
   109
+        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
   110
+        break;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
+      }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   112
+    }
340
aabcc7895695 update to version 8.0b1 (just merged stuff; build might still fail)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
   113
+  }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   114
+
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   115
   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
   116
   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
   117
     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
   118
 
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   119
   // Load jar:$app/omni.jar!/defaults/preferences/*.js
438
7d934b2f5014 rebased and removed upstreamed and obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 419
diff changeset
   120
   // or jar:$gre/omni.jar!/defaults/preferences/*.js.
899
44a28160de40 prepare 44.0b9
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 893
diff changeset
   121
   RefPtr<nsZipArchive> appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
438
7d934b2f5014 rebased and removed upstreamed and obsolete patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 419
diff changeset
   122
   // GetReader(mozilla::Omnijar::APP) returns null when $app == $gre, in which
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   123
diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   124
--- a/modules/libpref/moz.build
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   125
+++ b/modules/libpref/moz.build
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   126
@@ -31,16 +31,20 @@ UNIFIED_SOURCES += [
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   127
     'prefread.cpp',
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   128
 ]
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   129
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   130
 # prefapi.cpp cannot be built in unified mode because it uses plarena.h
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   131
 SOURCES += [
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   132
     'prefapi.cpp',
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   133
 ]
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   134
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   135
+LOCAL_INCLUDES += [
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   136
+    '/toolkit/xre'
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   137
+]
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   138
+
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   139
 include('/ipc/chromium/chromium-config.mozbuild')
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   140
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   141
 FINAL_LIBRARY = 'xul'
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   142
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   143
 DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   144
 DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   145
 
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   146
 if CONFIG['GNU_CXX']:
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   147
diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   148
--- a/python/mozbuild/mozpack/chrome/flags.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   149
+++ b/python/mozbuild/mozpack/chrome/flags.py
881
1268ddc9dc16 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 869
diff changeset
   150
@@ -211,16 +211,17 @@ class Flags(OrderedDict):
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   151
         'contentaccessible': Flag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   152
         'os': StringFlag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   153
         'osversion': VersionFlag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   154
         'abi': StringFlag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   155
         'platform': Flag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   156
         'xpcnativewrappers': Flag,
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   157
         'tablet': Flag,
807
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   158
         'process': StringFlag,
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   159
+        'desktop': StringFlag,
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   160
     }
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   161
     RE = re.compile(r'([!<>=]+)')
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   162
 
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   163
     def __init__(self, *flags):
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   164
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   165
         Initialize a set of flags given in string form.
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   166
            flags = Flags('contentaccessible=yes', 'appversion>=3.5')
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   167
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   168
diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   169
--- a/python/mozbuild/mozpack/chrome/manifest.py
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   170
+++ b/python/mozbuild/mozpack/chrome/manifest.py
881
1268ddc9dc16 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 869
diff changeset
   171
@@ -33,16 +33,17 @@ class ManifestEntry(object):
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   172
         'application',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   173
         'platformversion',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   174
         'os',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   175
         'osversion',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   176
         'abi',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   177
         'xpcnativewrappers',
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   178
         'tablet',
807
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   179
         'process',
f54c68340963 Aurora 35.0 (20141115) uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 779
diff changeset
   180
+        'desktop',
637
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   181
     ]
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   182
 
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   183
     def __init__(self, base, *flags):
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   184
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   185
         Initialize a manifest entry with the given base path and flags.
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   186
         '''
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   187
         self.base = base
73640b76d6c3 first building version of FF21
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 612
diff changeset
   188
         self.flags = Flags(*flags)
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   189
diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   190
--- a/toolkit/components/downloads/moz.build
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   191
+++ b/toolkit/components/downloads/moz.build
889
de3a92aed259 43.0b9 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 885
diff changeset
   192
@@ -65,15 +65,16 @@ if not CONFIG['MOZ_SUITE']:
de3a92aed259 43.0b9 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 885
diff changeset
   193
         'nsDownloadManagerUI.js',
de3a92aed259 43.0b9 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 885
diff changeset
   194
         'nsDownloadManagerUI.manifest',
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   195
     ]
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   196
 
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   197
 FINAL_LIBRARY = 'xul'
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   198
 
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   199
 LOCAL_INCLUDES += [
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   200
     '../protobuf',
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   201
-    '/ipc/chromium/src'
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   202
+    '/ipc/chromium/src',
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   203
+    '/toolkit/xre'
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   204
 ]
467
a9baaad57fa4 refreshed patches and removed obsolete ones
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 438
diff changeset
   205
 
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   206
 DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
881
1268ddc9dc16 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 869
diff changeset
   207
 DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   208
 
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   209
 CXXFLAGS += CONFIG['TK_CFLAGS']
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   210
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
   211
--- a/toolkit/components/downloads/nsDownloadManager.cpp
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 244
diff changeset
   212
+++ b/toolkit/components/downloads/nsDownloadManager.cpp
885
ee3c462047d5 42 beta cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 881
diff changeset
   213
@@ -51,16 +51,20 @@
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   214
 #ifdef XP_WIN
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
 #include <shlobj.h>
686
ab25aac2aa83 Firefox 26.0b5 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 680
diff changeset
   216
 #include "nsWindowsHelpers.h"
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
 #ifdef DOWNLOAD_SCANNER
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
 #include "nsDownloadScanner.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
 #endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
 #endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+#if defined(XP_UNIX) && !defined(XP_MACOSX)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+#include "nsKDEUtils.h"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   226
 #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
   227
 #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
   228
 #endif
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   229
 
399
20f8b5f0aea6 port KDE patches to Gecko 11
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 398
diff changeset
   230
 #ifdef MOZ_WIDGET_ANDROID
259
31beb466ca79 snapshot 20110411
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
   231
 #include "AndroidBridge.h"
31beb466ca79 snapshot 20110411
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
   232
 #endif
837
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 828
diff changeset
   233
 
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   234
@@ -2719,16 +2723,25 @@ nsDownload::SetState(DownloadState aStat
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   235
       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
   236
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
       // Master pref to control this function.
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   238
       bool showTaskbarAlert = true;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   239
       if (pref)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
         pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
       if (showTaskbarAlert) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
+        if( nsKDEUtils::kdeSupport()) {
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   244
+          nsTArray<nsCString> command;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   245
+          command.AppendElement( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" ));
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   246
+          nsAutoString displayName;
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   247
+          GetDisplayName( displayName );
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 546
diff changeset
   248
+          command.AppendElement( nsAutoCString( ToNewUTF8String( displayName )));
367
3fabd9f66322 begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 356
diff changeset
   249
+          nsKDEUtils::command( command );
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
+        } else {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
+        // begin non-KDE block
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   252
         int32_t alertInterval = 2000;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   253
         if (pref)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   254
           pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   255
 
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   256
         int64_t alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 538
diff changeset
   257
         int64_t goat = PR_Now() - mStartTime;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
         showTaskbarAlert = goat > alertIntervalUSec;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
 
904
6a889427cd4f 45.0 release
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 901
diff changeset
   260
@@ -2759,16 +2772,17 @@ nsDownload::SetState(DownloadState aStat
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
                   NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title,
612
3006d73ad2fa move on to Aurora 20
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 609
diff changeset
   262
                   message, !removeWhenDone,
3006d73ad2fa move on to Aurora 20
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 609
diff changeset
   263
                   mPrivate ? NS_LITERAL_STRING("private") : NS_LITERAL_STRING("non-private"),
703
c4aab80e472f Firefox 28.0beta1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 691
diff changeset
   264
                   mDownloadManager, EmptyString(), NS_LITERAL_STRING("auto"),
837
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 828
diff changeset
   265
                   EmptyString(), EmptyString(), nullptr, mPrivate);
779
354c672efefa rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 766
diff changeset
   266
             }
260
a9a2a9c8b831 fix incorrectly rebased patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 259
diff changeset
   267
         }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
       }
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   269
+      }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   270
 
686
ab25aac2aa83 Firefox 26.0b5 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 680
diff changeset
   271
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   272
       nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
153
46ee28dc7145 Update to 4.0b5
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 127
diff changeset
   273
       nsCOMPtr<nsIFile> file;
46ee28dc7145 Update to 4.0b5
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 127
diff changeset
   274
       nsAutoString path;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
 
153
46ee28dc7145 Update to 4.0b5
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 127
diff changeset
   276
       if (fileURL &&
289
3c0dff7ca9c4 Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 284
diff changeset
   277
           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
   278
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
   279
--- a/toolkit/content/jar.mn
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
+++ b/toolkit/content/jar.mn
899
44a28160de40 prepare 44.0b9
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 893
diff changeset
   281
@@ -64,29 +64,33 @@ toolkit.jar:
889
de3a92aed259 43.0b9 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 885
diff changeset
   282
    content/global/viewZoomOverlay.js
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
 *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   284
    content/global/bindings/browser.xml         (widgets/browser.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   285
    content/global/bindings/button.xml          (widgets/button.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   286
    content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   287
    content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   288
    content/global/bindings/datetimepicker.xml  (widgets/datetimepicker.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
 *+ 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
   290
+*+ 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
   291
+% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   292
    content/global/bindings/editor.xml          (widgets/editor.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   293
    content/global/bindings/expander.xml        (widgets/expander.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   294
 *  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
   295
 *+ content/global/bindings/findbar.xml         (widgets/findbar.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   296
    content/global/bindings/general.xml         (widgets/general.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   297
    content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
 *+ content/global/bindings/listbox.xml         (widgets/listbox.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   299
    content/global/bindings/menu.xml            (widgets/menu.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   300
    content/global/bindings/menulist.xml        (widgets/menulist.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   301
    content/global/bindings/notification.xml    (widgets/notification.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   302
    content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   303
    content/global/bindings/popup.xml           (widgets/popup.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
 *+ 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
   305
+*+ 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
   306
+% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   307
    content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   308
    content/global/bindings/radio.xml           (widgets/radio.xml)
653
38c67b6b2f37 Aurora 23 (20130616)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 650
diff changeset
   309
    content/global/bindings/remote-browser.xml  (widgets/remote-browser.xml)
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   310
    content/global/bindings/resizer.xml         (widgets/resizer.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   311
    content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   312
    content/global/bindings/scale.xml           (widgets/scale.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   313
    content/global/bindings/scrollbar.xml       (widgets/scrollbar.xml)
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   314
    content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
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
   316
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
+++ b/toolkit/content/widgets/dialog-kde.xml
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   319
@@ -0,0 +1,460 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
+<?xml version="1.0"?>
515
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   321
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   322
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   323
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
0f6539389500 Aurora 16 uplift
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 467
diff changeset
   324
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+<bindings id="dialogBindings"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+          xmlns="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+          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
   329
+          xmlns:xbl="http://www.mozilla.org/xbl">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+  
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+  <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
   332
+    <resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
+      <stylesheet src="chrome://global/skin/dialog.css"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
+    </resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
+    <content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
+      <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
   337
+        <children/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
+      </xul:vbox>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+      <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
   341
+                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
   342
+#ifdef XP_UNIX_GNOME
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
+                >
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+        <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
   345
+        <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
   346
+        <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
   347
+        <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
   348
+        <xul:spacer anonid="spacer" flex="1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+        <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
   351
+#elif XP_UNIX
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   352
+                >
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   353
+	<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   354
+	<xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   355
+	<xul:spacer anonid="spacer" flex="1"/>
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   356
+	<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
   357
+	<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
   358
+	<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
   359
+	<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
   360
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
+                pack="end">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
+        <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
   363
+        <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
   364
+        <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
   365
+        <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
   366
+        <xul:button dlgtype="cancel" class="dialog-button"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+        <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
   368
+        <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
   369
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
+      </xul:hbox>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
+    </content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
+    <implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
+      <field name="_mStrBundle">null</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
+      <field name="_closeHandler">(function(event) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   376
+        if (!document.documentElement.cancelDialog())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+          event.preventDefault();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
+      })</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+      <property name="buttons"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
+                onget="return this.getAttribute('buttons');"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+                onset="this._configureButtons(val); return val;"/>
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
+      <property name="defaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   385
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
+          if (this.hasAttribute("defaultButton"))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
+            return this.getAttribute("defaultButton");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
+          else // default to the accept button
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
+            return "accept";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   393
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   394
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   395
+          this._setDefaultButton(val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   396
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   397
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   398
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   399
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
+      <method name="acceptDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   404
+          return this._doButtonCommand("accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   409
+      <method name="cancelDialog">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   411
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   412
+          return this._doButtonCommand("cancel");
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
+      </method>
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
+      <method name="getButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   420
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+          return this._buttons[aDlgType];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
+      <method name="moveToAlertPosition">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   427
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
+          // 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
   430
+          if (window.outerWidth == 1) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
+            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
   432
+            sizeToContent();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   433
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   435
+          if (opener) {
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   436
+            var xOffset = (opener.outerWidth - window.outerWidth) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   437
+            var yOffset = opener.outerHeight / 5;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
+
868
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   439
+            var newX = opener.screenX + xOffset;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   440
+            var newY = opener.screenY + yOffset;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   441
+          } else {
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   442
+            newX = (screen.availWidth - window.outerWidth) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   443
+            newY = (screen.availHeight - window.outerHeight) / 2;
284da266ec46 40beta rebase
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 850
diff changeset
   444
+          }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   446
+          // 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
   447
+          if (newX < screen.availLeft)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
+            newX = screen.availLeft + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
+          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
   450
+            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
   451
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   452
+          if (newY < screen.availTop)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
+            newY = screen.availTop + 20;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   454
+          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
   455
+            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
   456
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   457
+          window.moveTo( newX, newY );
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   460
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   461
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   462
+      <method name="centerWindowOnScreen">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   463
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   465
+          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
   466
+          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
   467
+  
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   468
+          xOffset = xOffset > 0 ? xOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   469
+          yOffset = yOffset > 0 ? yOffset : 0;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+          window.moveTo(xOffset, yOffset);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+      <constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
+      <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
+        this._configureButtons(this.buttons);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+        // 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
   480
+        window.addEventListener("close", this._closeHandler, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+        // 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
   483
+        window.addEventListener("load", this.postLoadInit, false);
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
+        window.moveToAlertPosition = this.moveToAlertPosition;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+        window.centerWindowOnScreen = this.centerWindowOnScreen;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+      ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+      </constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
+      <method name="postLoadInit">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   492
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
+          function focusInit() {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
+            const dialog = document.documentElement;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+            const defaultButton = dialog.getButton(dialog.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
+            // 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
   498
+            if (!document.commandDispatcher.focusedElement) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
+              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+              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
   502
+              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
   503
+                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
   504
+                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
   505
+                       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
   506
+                  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
   507
+                  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
   508
+                  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
   509
+                    break;
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   510
+                }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
+
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   512
+                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
   513
+                  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
   514
+                    // 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
   515
+                    // 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
   516
+                    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
   517
+                  }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   518
+                }
127
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   519
+#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
   520
+                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
   521
+                  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
   522
+                }
4c86470ed796 Reenabling KDE integration patches (part 1: rebase and reenable; might need post-fixes)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 64
diff changeset
   523
+#endif
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+              }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+            }
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
+            try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+              if (defaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+                window.notifyDefaultButtonLoaded(defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+            } catch (e) { }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   531
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   533
+          // 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
   534
+          setTimeout(focusInit, 0);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+      </method>                
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   539
+      <property name="mStrBundle">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   542
+          if (!this._mStrBundle) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
+            // 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
   544
+            // see bug 63370 for details
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   545
+            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
   546
+                                         .getService(Components.interfaces.nsIStringBundleService)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
+                                         .createBundle("chrome://global/locale/dialog.properties");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   548
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
+          return this._mStrBundle;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
+        ]]></getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
+      </property>
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
+      <method name="_configureButtons">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
+        <parameter name="aButtons"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+          // 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
   558
+          var buttons = {};
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
+          this._buttons = buttons;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
+          buttons.accept = document.getAnonymousElementByAttribute(this, "dlgtype", "accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
+          buttons.cancel = document.getAnonymousElementByAttribute(this, "dlgtype", "cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
+          buttons.extra1 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra1");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
+          buttons.extra2 = document.getAnonymousElementByAttribute(this, "dlgtype", "extra2");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
+          buttons.help = document.getAnonymousElementByAttribute(this, "dlgtype", "help");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+          buttons.disclosure = document.getAnonymousElementByAttribute(this, "dlgtype", "disclosure");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
+          // look for any overriding explicit button elements
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+          var exBtns = this.getElementsByAttribute("dlgtype", "*");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
+          var dlgtype;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
+          var i;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   571
+          for (i = 0; i < exBtns.length; ++i) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+            dlgtype = exBtns[i].getAttribute("dlgtype");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
+            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
   574
+            buttons[dlgtype] = exBtns[i];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   575
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   576
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
+          // 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
   578
+          for (dlgtype in buttons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
+            var button = buttons[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
+            button.addEventListener("command", this._handleButtonCommand, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
+            // 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
   583
+            if (!button.hasAttribute("label")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
+              // 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
   585
+              if (this.hasAttribute("buttonlabel"+dlgtype)) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
+                button.setAttribute("label", this.getAttribute("buttonlabel"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   587
+                if (this.hasAttribute("buttonaccesskey"+dlgtype))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   588
+                  button.setAttribute("accesskey", this.getAttribute("buttonaccesskey"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   589
+              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
+                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
   591
+                var accessKey = this.mStrBundle.GetStringFromName("accesskey-"+dlgtype);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
+                if (accessKey)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
+                  button.setAttribute("accesskey", accessKey);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
+              }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
+            // 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
   597
+            if (!button.hasAttribute("icon")) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   598
+              // 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
   599
+              if (this.hasAttribute("buttonicon"+dlgtype))
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   600
+                button.setAttribute("icon", this.getAttribute("buttonicon"+dlgtype));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   601
+              // otherwise set defaults
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   602
+              else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
+                switch (dlgtype) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
+                  case "accept":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   605
+                    button.setAttribute("icon","accept");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   607
+                  case "cancel":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   608
+                    button.setAttribute("icon","cancel");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
+                    break;
194
b77b8588484c sync dialog-kde.xml
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 191
diff changeset
   610
+                  case "disclosure":
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
+                    button.setAttribute("icon","properties");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
+                  case "help":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
+                    button.setAttribute("icon","help");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   616
+                  default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+                    break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
+                }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   619
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   620
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+          // 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
   623
+          this.defaultButton = this.defaultButton;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   625
+          // 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
   626
+          if (aButtons) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   627
+            // 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
   628
+            var list = aButtons.split(",");
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
+            // mark shown dlgtypes as true
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
+            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
   632
+                          disclosure: false, extra1: false, extra2: false };
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
+            for (i = 0; i < list.length; ++i)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
+              shown[list[i].replace(/ /g, "")] = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   635
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   636
+            // hide/show the buttons we want
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
+            for (dlgtype in buttons) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
+              buttons[dlgtype].hidden = !shown[dlgtype];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
+#ifdef XP_WIN
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
+#           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
   642
+            var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
+            spacer.removeAttribute("hidden");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
+            spacer.setAttribute("flex", shown["extra2"]?"1":"0");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   645
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   646
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   647
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
+      <method name="_setDefaultButton">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
+        <parameter name="aNewDefault"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   654
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   656
+          // 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
   657
+          var oldDefaultButton = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
+          if (oldDefaultButton)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   659
+            oldDefaultButton.removeAttribute("default");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   660
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
+          var newDefaultButton = this.getButton(aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
+          if (newDefaultButton) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
+            this.setAttribute("defaultButton", aNewDefault);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
+            newDefaultButton.setAttribute("default", "true");
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
+          else {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
+            this.setAttribute("defaultButton", "none");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   668
+            if (aNewDefault != "none")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
+              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
   670
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   672
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   673
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   674
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   675
+      <method name="_handleButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
+        <parameter name="aEvent"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   679
+          return document.documentElement._doButtonCommand(
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   680
+                                        aEvent.target.getAttribute("dlgtype"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   681
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   682
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   683
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   684
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   685
+      <method name="_doButtonCommand">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   686
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   687
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
+          var button = this.getButton(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
+          if (!button.disabled) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
+            var noCancel = this._fireButtonEvent(aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   692
+            if (noCancel) {
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   693
+              if (aDlgType == "accept" || aDlgType == "cancel") {
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   694
+                var closingEvent = new CustomEvent("dialogclosing", {
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   695
+                  bubbles: true,
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   696
+                  detail: { button: aDlgType },
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   697
+                });
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   698
+                this.dispatchEvent(closingEvent);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
+                window.close();
766
e0b23b7851e9 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 760
diff changeset
   700
+              }
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   701
+            }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   702
+            return noCancel;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   703
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   704
+          return true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   705
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   706
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   707
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   708
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   709
+      <method name="_fireButtonEvent">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   710
+        <parameter name="aDlgType"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   711
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   712
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   713
+          var event = document.createEvent("Events");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   714
+          event.initEvent("dialog"+aDlgType, true, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   715
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   716
+          // handle dom event handlers
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   717
+          var noCancel = this.dispatchEvent(event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   718
+          
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   719
+          // handle any xml attribute event handlers
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   720
+          var handler = this.getAttribute("ondialog"+aDlgType);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   721
+          if (handler != "") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   722
+            var fn = new Function("event", handler);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   723
+            var returned = fn(event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   724
+            if (returned == false)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   725
+              noCancel = false;
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
+          return noCancel;
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   731
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   732
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   733
+      <method name="_hitEnter">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   734
+        <parameter name="evt"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   735
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   736
+        <![CDATA[
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   737
+          if (evt.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   738
+            return;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   739
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   740
+          var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   741
+          if (btn)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   742
+            this._doButtonCommand(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   743
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   744
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   745
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   746
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   747
+    </implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   748
+    
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   749
+    <handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   750
+      <handler event="keypress" keycode="VK_RETURN"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   751
+               group="system" action="this._hitEnter(event);"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   752
+      <handler event="keypress" keycode="VK_ESCAPE" group="system">
400
6a1811ef3174 update for 11.0b4
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 399
diff changeset
   753
+        if (!event.defaultPrevented)
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   754
+          this.cancelDialog();
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   755
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
+#ifdef XP_MACOSX
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   757
+      <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
   758
+#else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   759
+      <handler event="focus" phase="capturing">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   760
+        var btn = this.getButton(this.defaultButton);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   761
+        if (btn)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   762
+          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
   763
+      </handler>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   764
+#endif
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   765
+    </handlers>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   766
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   767
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   768
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
+  <binding id="dialogheader">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
+    <resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   771
+      <stylesheet src="chrome://global/skin/dialog.css"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   772
+    </resources>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   773
+    <content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   774
+      <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
   775
+      <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
   776
+    </content>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   777
+  </binding>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   778
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   779
+</bindings>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   780
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
   781
new file mode 100644
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   782
--- /dev/null
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   783
+++ b/toolkit/content/widgets/preferences-kde.xml
881
1268ddc9dc16 rebased patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 869
diff changeset
   784
@@ -0,0 +1,1403 @@
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+<?xml version="1.0"?>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
+<!DOCTYPE bindings [
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
+  <!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
   789
+  %preferencesDTD;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   790
+  <!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
   791
+  %globalKeysDTD;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   792
+]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   793
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   794
+<bindings id="preferencesBindings"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
+          xmlns="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   796
+          xmlns:xbl="http://www.mozilla.org/xbl"
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   797
+          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
   798
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   799
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   800
+# = Preferences Window Framework
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   801
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   802
+#   The syntax for use looks something like:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   803
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
+#   <prefwindow>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   805
+#     <prefpane id="prefPaneA">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   806
+#       <preferences>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   807
+#         <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
   808
+#         <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
   809
+#       </preferences>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   810
+#       <checkbox label="Preference" preference="preference1"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   811
+#     </prefpane>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   812
+#   </prefwindow>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   813
+#
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   814
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   815
+  <binding id="preferences">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   816
+    <implementation implements="nsIObserver">
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   817
+      <method name="_constructAfterChildren">
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   818
+      <body>
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   819
+      <![CDATA[
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   820
+      // This method will be called after each one of the child
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   821
+      // <preference> elements is constructed. Its purpose is to propagate
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   822
+      // the values to the associated form elements
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   823
+
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   824
+      var elements = this.getElementsByTagName("preference");
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   825
+      for (let element of elements) {
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   826
+        if (!element._constructed) {
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   827
+          return;
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   828
+        }
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   829
+      }
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   830
+      for (let element of elements) {
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   831
+        element.updateElements();
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   832
+      }
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   833
+      ]]>
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   834
+      </body>
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   835
+      </method>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   836
+      <method name="observe">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   837
+        <parameter name="aSubject"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   838
+        <parameter name="aTopic"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   839
+        <parameter name="aData"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   840
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   841
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   842
+          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
   843
+            var preference = this.childNodes[i];
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   844
+            if (preference.name == aData) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   845
+              preference.value = preference.valueFromPreferences;
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
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   848
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   849
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   850
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   851
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   852
+      <method name="fireChangedEvent">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   853
+        <parameter name="aPreference"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   854
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   855
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   856
+          // Value changed, synthesize an event
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   857
+          try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   858
+            var event = document.createEvent("Events");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   859
+            event.initEvent("change", true, true);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   860
+            aPreference.dispatchEvent(event);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   861
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   862
+          catch (e) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   863
+            Components.utils.reportError(e);
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
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   866
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   867
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   868
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   869
+      <field name="service">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   870
+        Components.classes["@mozilla.org/preferences-service;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   871
+                  .getService(Components.interfaces.nsIPrefService);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   872
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
+      <field name="rootBranch">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   874
+        Components.classes["@mozilla.org/preferences-service;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   875
+                  .getService(Components.interfaces.nsIPrefBranch);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   877
+      <field name="defaultBranch">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   878
+        this.service.getDefaultBranch("");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   879
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   880
+      <field name="rootBranchInternal">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   881
+        Components.classes["@mozilla.org/preferences-service;1"]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   882
+                  .getService(Components.interfaces.nsIPrefBranchInternal);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   883
+      </field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   884
+      <property name="type" readonly="true">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   885
+        <getter>
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
+            return document.documentElement.type || "";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   888
+          ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   889
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   890
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
+      <property name="instantApply" readonly="true">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   893
+          <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
+            var doc = document.documentElement;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   895
+            return this.type == "child" ? doc.instantApply
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   896
+                                        : 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
   897
+          ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   898
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   899
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
+    </implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
+  </binding>
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
+  <binding id="preference">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
+    <implementation>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   905
+      <constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   906
+      <![CDATA[
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   907
+        this._constructed = true;
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   908
+
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+        // 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
   910
+        // we have nothing to do here
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   911
+        if (!this.name)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   912
+          return;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+        this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   915
+            .addObserver(this.name, this.preferences, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
+        // 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
   917
+        // 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
   918
+        // preferences, to pick up any edits a user may have made. 
828
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
   919
+
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
   920
+        var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
   921
+                    .getService(Components.interfaces.nsIScriptSecurityManager);
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
+        if (this.preferences.type == "child" && 
828
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
   923
+            !this.instantApply && window.opener &&
59013b3a51f5 update to 36.0b3
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 807
diff changeset
   924
+            secMan.isSystemPrincipal(window.opener.document.nodePrincipal)) {
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   925
+          var pdoc = window.opener.document;
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
+          // 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
   928
+          var preference = null;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
+          var parentPreferences = pdoc.getElementsByTagName("preferences");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
+          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
   931
+            var parentPrefs = parentPreferences[k]
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
+                                    .getElementsByAttribute("name", this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+            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
   934
+              if (parentPrefs[l].localName == "preference")
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   935
+                preference = parentPrefs[l];
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
+          }
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   938
+
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   939
+          // Don't use the value setter here, we don't want updateElements to be prematurely fired.
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   940
+          this._value = preference ? preference.value : this.valueFromPreferences;
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   941
+        }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
+        else
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   943
+          this._value = this.valueFromPreferences;
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   944
+        this.preferences._constructAfterChildren();
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
+      ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
+      </constructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+      <destructor>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   948
+        this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   949
+            .removeObserver(this.name, this.preferences);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
+      </destructor>
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   951
+      <field name="_constructed">false</field>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
+      <property name="instantApply">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
+          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
   955
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
+      <property name="preferences" onget="return this.parentNode"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
+      <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
   960
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
+          if (val == this.name)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   963
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   964
+          this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   965
+              .removeObserver(this.name, this.preferences);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   966
+          this.setAttribute('name', val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   967
+          this.preferences.rootBranchInternal
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
+              .addObserver(val, this.preferences, false);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
+              
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   971
+        </setter>
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
+      <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
   974
+                            onset="this.setAttribute('type', val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   975
+      <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
   976
+                                onset="this.setAttribute('inverted', val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   977
+      <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
   978
+                                onset="this.setAttribute('readonly', val); return val;"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
+      <field name="_value">null</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
+      <method name="_setValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
+        <parameter name="aValue"/>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
+        <![CDATA[
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   985
+          if (this.value !== aValue) {
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
+            this._value = aValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
+            if (this.instantApply)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
+              this.valueFromPreferences = aValue;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   989
+            this.preferences.fireChangedEvent(this);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   990
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
+          return aValue;
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
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
+      </method>
748
72ba5129e5fd full rebase to Aurora 32
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 738
diff changeset
   995
+      <property name="value" onget="return this._value" onset="return this._setValue(val);"/>
9
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   997
+      <property name="locked">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   998
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+          return this.preferences.rootBranch.prefIsLocked(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+      <property name="disabled">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+          return this.getAttribute("disabled") == "true";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1008
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+          if (val) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+            this.setAttribute("disabled", "true");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+          else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+            this.removeAttribute("disabled");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+          if (!this.id)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
+          var elements = document.getElementsByAttribute("preference", this.id);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
+          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
  1019
+            elements[i].disabled = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1020
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
+            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
  1022
+            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
  1023
+              labels[j].disabled = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1024
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
+      <property name="tabIndex">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
+          return parseInt(this.getAttribute("tabindex"));
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
+          if (val) 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
+            this.setAttribute("tabindex", val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1039
+          else
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1040
+            this.removeAttribute("tabindex");
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
+          if (!this.id)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1044
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1045
+          var elements = document.getElementsByAttribute("preference", this.id);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1046
+          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
  1047
+            elements[i].tabIndex = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1048
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1049
+            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
  1050
+            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
  1051
+              labels[j].tabIndex = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1052
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1053
+            
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1054
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1055
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
+        </setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1058
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1059
+      <property name="hasUserValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
+          return this.preferences.rootBranch.prefHasUserValue(this.name) &&
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1063
+                 this.value !== undefined;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1065
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1066
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1068
+      <method name="reset">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1069
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
+          // defer reset until preference update
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1071
+          this.value = undefined;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1072
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1073
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1074
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1075
+      <field name="_useDefault">false</field>      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1076
+      <property name="defaultValue">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1077
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1078
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1079
+          this._useDefault = true;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1080
+          var val = this.valueFromPreferences;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1081
+          this._useDefault = false;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1082
+          return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1083
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1084
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1085
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1087
+      <property name="_branch">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1088
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
+          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
  1090
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
+      </property>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1092
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+      <field name="batching">false</field>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1094
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1095
+      <method name="_reportUnknownType">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1096
+        <body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1097
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+          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
  1099
+                                         .getService(Components.interfaces.nsIConsoleService);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
+          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
  1101
+                    this.name + "' has unknown type '" + this.type + "'.";
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1102
+          consoleService.logStringMessage(msg);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1103
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1104
+        </body>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1105
+      </method>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
+      
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1107
+      <property name="valueFromPreferences">
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1108
+        <getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1109
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1110
+          try {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
+            // Force a resync of value with preferences.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
+            switch (this.type) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
+            case "int":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1114
+              return this._branch.getIntPref(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1115
+            case "bool":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
+              var val = this._branch.getBoolPref(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
+              return this.inverted ? !val : val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
+            case "wstring":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1119
+              return this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1120
+                         .getComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1121
+                         .data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
+            case "string":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
+            case "unichar":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
+              return this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
+                         .getComplexValue(this.name, Components.interfaces.nsISupportsString)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
+                         .data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
+            case "fontname":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+              var family = this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
+                               .getComplexValue(this.name, Components.interfaces.nsISupportsString)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1130
+                               .data;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1131
+              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
  1132
+                                             .createInstance(Components.interfaces.nsIFontEnumerator);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
+              return fontEnumerator.getStandardFamilyName(family);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
+            case "file":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
+              var f = this._branch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
+                          .getComplexValue(this.name, Components.interfaces.nsILocalFile);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
+              return f;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
+            default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+              this._reportUnknownType();
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
+          catch (e) { }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
+          return null;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1144
+        ]]>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1145
+        </getter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
+        <setter>
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
+        <![CDATA[
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
+          // Exit early if nothing to do.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+          if (this.readonly || this.valueFromPreferences == val)
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+          // 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
  1153
+          if (val === undefined) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+            this.preferences.rootBranch.clearUserPref(this.name);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+            return val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+          }
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+          // Force a resync of preferences with value.
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+          switch (this.type) {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+          case "int":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+            this.preferences.rootBranch.setIntPref(this.name, val);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+          case "bool":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+            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
  1165
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+          case "wstring":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+            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
  1168
+                                .createInstance(Components.interfaces.nsIPrefLocalizedString);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+            pls.data = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+            this.preferences.rootBranch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+                .setComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString, pls);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
+          case "string":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1174
+          case "unichar":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1175
+          case "fontname":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1176
+            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
  1177
+                                .createInstance(Components.interfaces.nsISupportsString);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1178
+            iss.data = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1179
+            this.preferences.rootBranch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1180
+                .setComplexValue(this.name, Components.interfaces.nsISupportsString, iss);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1181
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1182
+          case "file":
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1183
+            var lf;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1184
+            if (typeof(val) == "string") {
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1185
+              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
  1186
+                             .createInstance(Components.interfaces.nsILocalFile);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1187
+              lf.persistentDescriptor = val;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1188
+              if (!lf.exists())
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1189
+                lf.initWithPath(val);
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
+            else 
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1192
+              lf = val.QueryInterface(Components.interfaces.nsILocalFile);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1193
+            this.preferences.rootBranch
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1194
+                .setComplexValue(this.name, Components.interfaces.nsILocalFile, lf);
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1195
+            break;
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1196
+          default:
bc5dfe5b853a Rebased KDE integration patches to 1.9.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1197
+            this._reportUnknownType();
bc5dfe5b853a Rebased KDE