TODO/mozilla-kde.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Sun, 29 Nov 2009 14:10:26 +0100
changeset 4 523b1d92948c
permissions -rw-r--r--
Add mozilla-xulrunner192 package
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
--- mozilla/chrome/src/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
+++ mozilla/chrome/src/Makefile.in	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
@@ -86,6 +86,7 @@ EXTRA_DSO_LDOPTS = \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
 EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
 endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
--- mozilla/chrome/src/nsChromeRegistry.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
+++ mozilla/chrome/src/nsChromeRegistry.cpp	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
@@ -114,6 +114,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 #include "nsIXULAppInfo.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 #include "nsIXULRuntime.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
 #include "nsPresShellIterator.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
 #ifdef MOZ_XUL
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
 // keep all the RDF stuff together, in case we can remove it in the far future
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
@@ -2208,6 +2209,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
   NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
   NS_NAMED_LITERAL_STRING(kOs, "os");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
   NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
+  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
   nsCOMPtr<nsIIOService> io (do_GetIOService());
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
   if (!io) return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
@@ -2251,6 +2253,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
   
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
   nsAutoString osVersion;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
+  nsAutoString desktop;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
 #if defined(XP_WIN)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
   OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
   if (GetVersionEx(&info)) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
@@ -2258,6 +2261,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
                                          info.dwMajorVersion,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
                                          info.dwMinorVersion);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
+  desktop = NS_LITERAL_STRING("win");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
 #elif defined(XP_MACOSX)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
   long majorVersion, minorVersion;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
   if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
@@ -2266,10 +2270,12 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
                                          majorVersion,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
                                          minorVersion);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
+  desktop = NS_LITERAL_STRING("macosx");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
 #elif defined(MOZ_WIDGET_GTK2)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
   nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
                                        gtk_major_version,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
                                        gtk_minor_version);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
+  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome"); // TODO others?
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
   char *token;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
@@ -2313,6 +2319,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
@@ -2326,6 +2333,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
             CheckFlag(kContentAccessible, wtoken, contentAccessible) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
             CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
@@ -2337,7 +2345,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
       if (badFlag || stApp == eBad || stAppVersion == eBad || 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
       nsCOMPtr<nsIURI> resolved;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
@@ -2398,6 +2406,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
@@ -2408,6 +2417,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
         if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
@@ -2419,7 +2429,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
       if (badFlag || stApp == eBad || stAppVersion == eBad ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
       nsCOMPtr<nsIURI> resolved;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
@@ -2460,6 +2470,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
@@ -2470,6 +2481,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
         if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   122
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   124
@@ -2481,7 +2493,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   126
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   127
       if (badFlag || stApp == eBad || stAppVersion == eBad ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   128
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   129
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   130
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   132
       nsCOMPtr<nsIURI> resolved;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
@@ -2524,6 +2536,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   134
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   135
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   137
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   139
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   141
@@ -2534,6 +2547,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   142
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   143
         if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   145
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   146
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
@@ -2545,7 +2559,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   150
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   151
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
       if (badFlag || stApp == eBad || stAppVersion == eBad ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   156
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   157
       nsCOMPtr<nsIURI> baseuri, overlayuri;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   158
@@ -2580,6 +2594,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   159
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   164
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
@@ -2590,6 +2605,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   167
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
         if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
@@ -2601,7 +2617,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   176
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   177
       if (badFlag || stApp == eBad || stAppVersion == eBad ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
       nsCOMPtr<nsIURI> baseuri, overlayuri;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
@@ -2640,6 +2656,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   187
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   191
@@ -2650,6 +2667,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
         if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   194
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   196
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   197
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
@@ -2661,7 +2679,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   201
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
       if (badFlag || stApp == eBad || stAppVersion == eBad ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   205
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   206
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
       nsCOMPtr<nsIURI> chromeuri, resolveduri;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
@@ -2702,6 +2720,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   209
       TriState stApp = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
       TriState stOsVersion = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
       TriState stOs = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
+      TriState stDesktop = eUnspecified;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
       PRBool badFlag = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
@@ -2712,6 +2731,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
         if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
             CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
+            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
             CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
             CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
           continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
@@ -2723,7 +2743,7 @@ nsChromeRegistry::ProcessManifestBuffer(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   227
       if (badFlag || stApp == eBad || stAppVersion == eBad || 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
-          stOs == eBad || stOsVersion == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
+          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
         continue;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
       
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   232
       nsDependentCString host(package);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
--- mozilla/modules/libpref/src/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   234
+++ mozilla/modules/libpref/src/Makefile.in	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   235
@@ -97,3 +97,5 @@ nsPrefService.$(OBJ_SUFFIX): nsPrefServi
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   236
 	@$(MAKE_DEPS_AUTO_CXX)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
 	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   238
 endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   239
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
--- mozilla/modules/libpref/src/nsPrefService.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
+++ mozilla/modules/libpref/src/nsPrefService.cpp	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
@@ -51,6 +51,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
 #include "nsCOMArray.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
 #include "nsXPCOMCID.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
 #include "nsAutoPtr.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
 #include "nsQuickSort.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
 #include "prmem.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
@@ -606,7 +607,8 @@ pref_LoadPrefsInDir(nsIFile* aDir, char
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   252
   return rv;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   253
 }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   254
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   255
-static nsresult pref_LoadPrefsInDirList(const char *listId)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   256
+static nsresult pref_LoadPrefsInDirList(const char *listId,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   257
+    char const *const *aSpecialFiles = NULL, PRUint32 aSpecialFilesCount = 0)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
   nsresult rv;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   260
   nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
@@ -625,7 +627,7 @@ static nsresult pref_LoadPrefsInDirList(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   262
         nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   263
         if (dir) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
           // Do we care if a file provided by this process fails to load?
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   265
-          pref_LoadPrefsInDir(dir, nsnull, 0); 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   266
+          pref_LoadPrefsInDir(dir, aSpecialFiles, aSpecialFilesCount); 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
         }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   269
     }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
@@ -676,6 +678,7 @@ static nsresult pref_InitInitialObjects(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
 #if defined(MOZ_WIDGET_PHOTON)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   272
 	  , "photon.js"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
 #endif		 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   274
+      , "" // placeholder for KDE  (empty is otherwise harmless)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
 #elif defined(XP_OS2)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   276
       "os2pref.js"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   277
 #elif defined(XP_BEOS)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   278
@@ -683,12 +686,23 @@ static nsresult pref_InitInitialObjects(
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
   };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   281
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   282
+  if( nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
+      for( int i = 0;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+           i < NS_ARRAY_LENGTH(specialFiles);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
+           ++i ) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+          if( *specialFiles[ i ] == '\0' ) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+              specialFiles[ i ] = "kde.js";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+              break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+          }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
+      }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+  }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+      
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
   rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   294
   if (NS_FAILED(rv)) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   295
     NS_WARNING("Error parsing application default preferences.");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   296
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   297
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
-  rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   299
+  rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST, specialFiles, NS_ARRAY_LENGTH(specialFiles));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
   NS_ENSURE_SUCCESS(rv, rv);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   301
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
   NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
--- mozilla/toolkit/components/downloads/src/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+++ mozilla/toolkit/components/downloads/src/Makefile.in	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
@@ -100,3 +100,4 @@ include $(topsrcdir)/config/rules.mk
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
--- mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+++ mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
@@ -85,6 +85,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
 #include "nsDocShellCID.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
 #include "nsIPrivateBrowsingService.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
 #include "nsNetCID.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   316
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
 #if defined(XP_WIN) && !defined(WINCE) 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
 #include <shlobj.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
@@ -2299,6 +2300,15 @@ nsDownload::SetState(DownloadState aStat
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
         pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
       if (showTaskbarAlert) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+        if( nsKDEUtils::kdeSupport()) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+            nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+            command.AppendCString( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+            nsAutoString displayName;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+            GetDisplayName( displayName );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+            command.AppendCString( nsCAutoString( ToNewUTF8String( displayName )));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+            nsKDEUtils::command( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+        } else {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   332
+        // begin non-KDE block
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
         PRInt32 alertInterval = 2000;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
         if (pref)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
           pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
@@ -2334,6 +2344,7 @@ nsDownload::SetState(DownloadState aStat
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   337
                   EmptyString());
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
             }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
         }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+        } // end non-KDE block
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   341
       }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
 #if defined(XP_WIN) && !defined(WINCE)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
       nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
--- mozilla/toolkit/content/jar.mn.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
+++ mozilla/toolkit/content/jar.mn	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   346
@@ -43,6 +43,8 @@ toolkit.jar:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
 *+ content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
 *+ content/global/bindings/datetimepicker.xml  (widgets/datetimepicker.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
 *+ content/global/bindings/dialog.xml          (widgets/dialog.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+*+ content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
 *+ content/global/bindings/editor.xml          (widgets/editor.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
 *  content/global/bindings/expander.xml        (widgets/expander.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
 *  content/global/bindings/filefield.xml       (widgets/filefield.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
@@ -56,6 +58,8 @@ toolkit.jar:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   356
 *+ content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   357
 *+ content/global/bindings/popup.xml           (widgets/popup.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   358
 *+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
+*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   360
+% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
 *+ content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
 *+ content/global/bindings/radio.xml           (widgets/radio.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   363
 *+ content/global/bindings/resizer.xml         (widgets/resizer.xml)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   364
--- mozilla/toolkit/content/widgets/dialog-kde.xml.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
+++ mozilla/toolkit/content/widgets/dialog-kde.xml	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
@@ -19,7 +19,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
           
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
       <xul:hbox class="dialog-button-box" anonid="buttons"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
                 xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
-#ifdef XP_UNIX
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
+#ifdef XP_UNIX_GNOME
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
                 >
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
         <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
         <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
@@ -28,6 +28,15 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   376
         <xul:spacer anonid="spacer" flex="1"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
         <xul:button dlgtype="cancel" class="dialog-button"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
         <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
+#elif XP_UNIX
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+                pack="end">
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   383
+        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   384
+        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   385
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
+        <xul:button dlgtype="cancel" class="dialog-button"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
 #else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
                 pack="end">
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
         <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
--- mozilla/toolkit/content/widgets/preferences-kde.xml.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+++ mozilla/toolkit/content/widgets/preferences-kde.xml	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   393
@@ -573,7 +573,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   394
         </xul:deck>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   395
       </xul:hbox>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   396
       <xul:hbox anonid="dlg-buttons" class="prefWindow-dlgbuttons"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   397
-#ifdef XP_UNIX
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   398
+#ifdef XP_UNIX_GNOME
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   399
                 >
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
         <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
         <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
@@ -582,6 +582,15 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
         <xul:spacer anonid="spacer" flex="1"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   404
         <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
         <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+#elif XP_UNIX
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+                pack="end">
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   409
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+        <xul:spacer anonid="spacer" flex="1"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   411
+        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   412
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   413
+        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   414
+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
 #else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   416
                 pack="end">
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   417
         <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
--- mozilla/toolkit/system/unixproxy/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+++ mozilla/toolkit/system/unixproxy/Makefile.in	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   420
@@ -64,4 +64,6 @@ CPPSRCS = \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
         nsUnixSystemProxySettings.cpp \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
         $(NULL)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
 include $(topsrcdir)/config/rules.mk
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   427
--- mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
+++ mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
@@ -49,6 +49,8 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   430
 #include "nsPrintfCString.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
 #include "nsNetUtil.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   432
 #include "nsISupportsPrimitives.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   433
+#include "nsVoidArray.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   435
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
 class nsUnixSystemProxySettings : public nsISystemProxySettings {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   437
 public:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
@@ -65,6 +67,7 @@ private:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
   PRBool IsProxyMode(const char* aMode);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
   nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   442
+  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
 };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   444
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
 NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   446
@@ -412,6 +415,9 @@ nsUnixSystemProxySettings::GetProxyForUR
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
   rv = aURI->GetPort(&port);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
   NS_ENSURE_SUCCESS(rv, rv);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   450
+  if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   451
+    return GetProxyFromKDE( scheme, host, port, aResult );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   452
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
   if (!mGConf)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   454
     return GetProxyFromEnvironment(scheme, host, port, aResult);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   455
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   456
@@ -432,3 +438,28 @@ static const nsModuleComponentInfo compo
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   457
 };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   458
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   459
 NS_IMPL_NSGETMODULE(nsUnixProxyModule, components)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   460
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   461
+nsresult
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   462
+nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   463
+                                             const nsACString& aHost,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
+                                             PRInt32 aPort,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   465
+                                             nsACString& aResult)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   467
+  nsCAutoString url;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   468
+  url = aScheme;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   469
+  url += "://";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+  url += aHost;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
+  if( aPort >= 0 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
+      {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+      url += ":";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
+      url += nsPrintfCString("%d", aPort);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+      }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
+  nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
+  command.AppendCString( NS_LITERAL_CSTRING( "GETPROXY" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+  command.AppendCString( url );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+  nsCStringArray result;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
+  if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
+      return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+  aResult = *result[ 0 ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   483
+  return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   484
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   485
--- mozilla/toolkit/xre/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+++ mozilla/toolkit/xre/Makefile.in	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
@@ -98,6 +98,7 @@ endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
 EXPORTS = \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
 	xrecore.h \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
 	nsXULAppAPI.h \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+	nsKDEUtils.h \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   492
 	$(NULL)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
 CPPSRCS = \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
@@ -133,7 +134,7 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
 CPPSRCS += nsNativeAppSupportBeOS.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
 else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   498
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
-CPPSRCS += nsNativeAppSupportUnix.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
 else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
 CPPSRCS += nsNativeAppSupportDefault.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
 endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   504
--- mozilla/toolkit/xre/nsKDEUtils.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+++ mozilla/toolkit/xre/nsKDEUtils.cpp	2009-09-14 10:04:14.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   506
@@ -0,0 +1,329 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   507
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
+/* ***** BEGIN LICENSE BLOCK *****
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
+ * The contents of this file are subject to the Mozilla Public License Version
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
+ * 1.1 (the "License"); you may not use this file except in compliance with
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
+ * the License. You may obtain a copy of the License at
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
+ * http://www.mozilla.org/MPL/
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   515
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   516
+ * Software distributed under the License is distributed on an "AS IS" basis,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   517
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   518
+ * for the specific language governing rights and limitations under the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+ * License.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   520
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   521
+ * The Original Code is Unix Native App Support.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   522
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+ * The Initial Developer of the Original Code is
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+ * Mozilla Corporation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+ * Portions created by the Initial Developer are Copyright (C) 2007
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   526
+ * the Initial Developer. All Rights Reserved.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+ * Contributor(s):
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+ * Alternatively, the contents of this file may be used under the terms of
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   531
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   533
+ * in which case the provisions of the GPL or the LGPL are applicable instead
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   534
+ * of those above. If you wish to allow use of your version of this file only
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+ * under the terms of either the GPL or the LGPL, and not to allow others to
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+ * use your version of this file under the terms of the MPL, indicate your
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+ * decision by deleting the provisions above and replace them with the notice
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+ * and other provisions required by the GPL or the LGPL. If you do not delete
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   539
+ * the provisions above, a recipient may use your version of this file under
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+ * the terms of any one of the MPL, the GPL or the LGPL.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   542
+ * ***** END LICENSE BLOCK ***** */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   544
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   545
+#include "nsIWidget.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
+#include <gtk/gtkwindow.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   548
+#include <gtk/gtkmain.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
+#include <limits.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
+#include <stdio.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   552
+#include <sys/wait.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   553
+#include <unistd.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
+#include <X11/Xlib.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+//#define DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+#ifdef DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   558
+#define KMOZILLAHELPER "kmozillahelper"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
+#else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
+// not need for lib64, it's a binary
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
+#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
+#endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
+#define KMOZILLAHELPER_VERSION 5
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+#define MAKE_STR2( n ) #n
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
+#define MAKE_STR( n ) MAKE_STR2( n )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+static bool getKdeSession()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
+    Display* dpy = XOpenDisplay( NULL );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   571
+    if( dpy == NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+        return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
+    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   574
+    bool kde = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   575
+    if( kde_full_session != None )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   576
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
+        int cnt;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   578
+        if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
+            for( int i = 0;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
+                 i < cnt;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
+                 ++i )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   583
+                {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
+                if( props[ i ] == kde_full_session )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
+                    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
+                    kde = true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   587
+#ifdef DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   588
+                    fprintf( stderr, "KDE SESSION %d\n", kde );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   589
+#endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
+                    break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   591
+                    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
+                }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
+            XFree( props );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
+    XCloseDisplay( dpy );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   597
+    return kde;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   598
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   599
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   600
+static bool getKdeSupport()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   601
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   602
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
+    command.AppendCString( NS_LITERAL_CSTRING( "CHECK" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
+    command.AppendCString( NS_LITERAL_CSTRING( MAKE_STR( KMOZILLAHELPER_VERSION )));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   605
+    bool kde = nsKDEUtils::command( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
+#ifdef DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   607
+    fprintf( stderr, "KDE RUNNING %d\n", kde );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   608
+#endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
+    return kde;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
+nsKDEUtils::nsKDEUtils()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
+    : commandFile( NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
+    , replyFile( NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   616
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
+nsKDEUtils::~nsKDEUtils()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   619
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   620
+//    closeHelper(); not actually useful, exiting will close the fd too
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   623
+nsKDEUtils* nsKDEUtils::self()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   625
+    static nsKDEUtils s;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   626
+    return &s;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   627
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   628
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   629
+static bool helperRunning = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   630
+static bool helperFailed = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   632
+bool nsKDEUtils::kdeSession()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
+    static bool session = getKdeSession();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   635
+    return session;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   636
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
+bool nsKDEUtils::kdeSupport()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
+    static bool support = kdeSession() && getKdeSupport();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
+    return support && helperRunning;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
+struct nsKDECommandData
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   645
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   646
+    FILE* file;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   647
+    nsCStringArray* output;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
+    GMainLoop* loop;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
+    bool success;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
+    };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
+static gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   654
+    nsKDECommandData* p = static_cast< nsKDECommandData* >( data );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
+    char buf[ 8192 ]; // TODO big enough
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   656
+    bool command_done = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
+    bool command_failed = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
+    while( !command_done && !command_failed && fgets( buf, 8192, p->file ) != NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   659
+        { // TODO what if the kernel splits a line into two chunks?
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   660
+//#ifdef DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
+//        fprintf( stderr, "READ: %s %d\n", buf, feof( p->file ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
+//#endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
+        if( char* eol = strchr( buf, '\n' ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
+            *eol = '\0';
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   665
+        command_done = ( strcmp( buf, "\\1" ) == 0 );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   666
+        command_failed = ( strcmp( buf, "\\0" ) == 0 );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
+        nsCAutoString line( buf );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   668
+        line.ReplaceSubstring( "\\n", "\n" );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
+        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   670
+        if( p->output && !( command_done || command_failed ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
+            p->output->AppendCString( nsCString( buf )); // TODO utf8?
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   672
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   673
+    bool quit = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   674
+    if( feof( p->file ) || command_failed )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   675
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
+        quit = true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
+        p->success = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   679
+    if( command_done )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   680
+        { // reading one reply finished
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   681
+        quit = true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   682
+        p->success = true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   683
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   684
+    if( quit )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   685
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   686
+        if( p->loop )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   687
+            g_main_loop_quit( p->loop );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
+        return FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
+    return TRUE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   692
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   693
+bool nsKDEUtils::command( const nsCStringArray& command, nsCStringArray* output )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   694
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   695
+    return self()->internalCommand( command, NULL, false, output );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   696
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   697
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   698
+bool nsKDEUtils::commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   700
+    return self()->internalCommand( command, parent, true, output );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   701
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   702
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   703
+bool nsKDEUtils::internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool blockUi,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   704
+    nsCStringArray* output )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   705
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   706
+    if( !startHelper())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   707
+        return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   708
+    feedCommand( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   709
+    // do not store the data in 'this' but in extra structure, just in case there
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   710
+    // is reentrancy (can there be? the event loop is re-entered)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   711
+    nsKDECommandData data;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   712
+    data.file = replyFile;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   713
+    data.output = output;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   714
+    data.success = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   715
+    if( blockUi )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   716
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   717
+        data.loop = g_main_loop_new( NULL, FALSE );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   718
+        GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   719
+        if( parent && parent->group )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   720
+            gtk_window_group_add_window( parent->group, GTK_WINDOW( window ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   721
+        gtk_widget_realize( window );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   722
+        gtk_widget_set_sensitive( window, TRUE );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   723
+        gtk_grab_add( window );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   724
+        GIOChannel* channel = g_io_channel_unix_new( fileno( data.file ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   725
+        g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   726
+        g_io_channel_unref( channel );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   727
+        g_main_loop_run( data.loop );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   728
+        g_main_loop_unref( data.loop );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   729
+        gtk_grab_remove( window );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   730
+        gtk_widget_destroy( window );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   731
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   732
+    else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   733
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   734
+        data.loop = NULL;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   735
+        while( kdeReadFunc( NULL, static_cast< GIOCondition >( 0 ), &data ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   736
+            ;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   737
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   738
+    return data.success;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   739
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   740
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   741
+bool nsKDEUtils::startHelper()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   742
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   743
+    if( helperRunning )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   744
+        return true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   745
+    if( helperFailed )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   746
+        return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   747
+    helperFailed = true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   748
+    int fdcommand[ 2 ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   749
+    int fdreply[ 2 ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   750
+    if( pipe( fdcommand ) < 0 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   751
+        return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   752
+    if( pipe( fdreply ) < 0 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   753
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   754
+        close( fdcommand[ 0 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   755
+        close( fdcommand[ 1 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
+        return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   757
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   758
+    char* args[ 2 ] = { const_cast< char* >( KMOZILLAHELPER ), NULL };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   759
+    switch( fork())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   760
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   761
+        case -1:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   762
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   763
+            close( fdcommand[ 0 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   764
+            close( fdcommand[ 1 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   765
+            close( fdreply[ 0 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   766
+            close( fdreply[ 1 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   767
+            return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   768
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
+        case 0: // child
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   771
+            if( dup2( fdcommand[ 0 ], STDIN_FILENO ) < 0 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   772
+                _exit( 1 );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   773
+            if( dup2( fdreply[ 1 ], STDOUT_FILENO ) < 0 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   774
+                _exit( 1 );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   775
+            int maxfd = 1024; // close all other fds
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   776
+            struct rlimit rl;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   777
+            if( getrlimit( RLIMIT_NOFILE, &rl ) == 0 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   778
+                maxfd = rl.rlim_max;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   779
+            for( int i = 3;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   780
+                 i < maxfd;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   781
+                 ++i )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   782
+                close( i );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   783
+#ifdef DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
+            execvp( KMOZILLAHELPER, args );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+#else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
+            execv( KMOZILLAHELPER, args );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
+#endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
+            _exit( 1 ); // failed
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   789
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   790
+        default: // parent
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   791
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   792
+            commandFile = fdopen( fdcommand[ 1 ], "w" );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   793
+            replyFile = fdopen( fdreply[ 0 ], "r" );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   794
+            close( fdcommand[ 0 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
+            close( fdreply[ 1 ] );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   796
+            if( commandFile == NULL || replyFile == NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   797
+                {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   798
+                closeHelper();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   799
+                return false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   800
+                }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   801
+            // ok, helper ready, getKdeRunning() will check if it works
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   802
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   803
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
+    helperFailed = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   805
+    helperRunning = true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   806
+    return true;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   807
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   808
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   809
+void nsKDEUtils::closeHelper()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   810
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   811
+    if( commandFile != NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   812
+        fclose( commandFile ); // this will also make the helper quit
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   813
+    if( replyFile != NULL )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   814
+        fclose( replyFile );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   815
+    helperRunning = false;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   816
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   817
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   818
+void nsKDEUtils::feedCommand( const nsCStringArray& command )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   819
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   820
+    for( int i = 0;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   821
+         i < command.Count();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   822
+         ++i )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   823
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   824
+        nsCString line = *command[ i ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   825
+        line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   826
+        line.ReplaceSubstring( "\n", "\\n" );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   827
+#ifdef DEBUG_KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   828
+        fprintf( stderr, "COMM: %s\n", line.get());
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   829
+#endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   830
+        fputs( line.get(), commandFile );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   831
+        fputs( "\n", commandFile );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   832
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   833
+    fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   834
+    fflush( commandFile );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   835
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   836
--- mozilla/toolkit/xre/nsKDEUtils.h.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   837
+++ mozilla/toolkit/xre/nsKDEUtils.h	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   838
@@ -0,0 +1,77 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   839
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   840
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   841
+ * ***** BEGIN LICENSE BLOCK *****
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   842
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   843
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   844
+ * The contents of this file are subject to the Mozilla Public License Version
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   845
+ * 1.1 (the "License"); you may not use this file except in compliance with
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   846
+ * the License. You may obtain a copy of the License at
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   847
+ * http://www.mozilla.org/MPL/
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   848
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   849
+ * Software distributed under the License is distributed on an "AS IS" basis,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   850
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   851
+ * for the specific language governing rights and limitations under the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   852
+ * License.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   853
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   854
+ * The Original Code is Mozilla Communicator client code.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   855
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   856
+ * The Initial Developer of the Original Code is
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   857
+ * Netscape Communications Corporation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   858
+ * Portions created by the Initial Developer are Copyright (C) 1998
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   859
+ * the Initial Developer. All Rights Reserved.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   860
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   861
+ * Contributor(s):
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   862
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   863
+ * Alternatively, the contents of this file may be used under the terms of
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   864
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   865
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   866
+ * in which case the provisions of the GPL or the LGPL are applicable instead
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   867
+ * of those above. If you wish to allow use of your version of this file only
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   868
+ * under the terms of either the GPL or the LGPL, and not to allow others to
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   869
+ * use your version of this file under the terms of the MPL, indicate your
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   870
+ * decision by deleting the provisions above and replace them with the notice
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   871
+ * and other provisions required by the GPL or the LGPL. If you do not delete
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   872
+ * the provisions above, a recipient may use your version of this file under
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
+ * the terms of any one of the MPL, the GPL or the LGPL.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   874
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   875
+ * ***** END LICENSE BLOCK ***** */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   877
+#ifndef nsKDEUtils_h__
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   878
+#define nsKDEUtils_h__
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   879
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   880
+#include "nsStringGlue.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   881
+#include "nsVoidArray.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   882
+#include <stdio.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   883
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   884
+typedef struct _GtkWindow GtkWindow;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   885
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   886
+class NS_EXPORT nsKDEUtils
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   887
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   888
+    public:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   889
+        /* Returns true if running inside a KDE session (regardless of whether there is KDE
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   890
+           support available for Firefox). This should be used e.g. when determining
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
+           dialog button order but not for code that requires the KDE support. */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
+        static bool kdeSession();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   893
+        /* Returns true if running inside a KDE session and KDE support is available
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
+           for Firefox. This should be used everywhere where the external helper is needed. */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   895
+        static bool kdeSupport();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   896
+        /* Executes the given helper command, returns true if helper returned success. */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   897
+        static bool command( const nsCStringArray& command, nsCStringArray* output = NULL );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   898
+        /* Like command(), but additionally blocks the parent widget like if there was
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   899
+           a modal dialog shown and enters the event loop (i.e. there are still paint updates,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
+           this is for commands that take long). */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
+        static bool commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output = NULL );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   902
+    private:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   903
+        nsKDEUtils();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
+        ~nsKDEUtils();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   905
+        static nsKDEUtils* self();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   906
+        bool startHelper();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   907
+        void closeHelper();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   908
+        void feedCommand( const nsCStringArray& command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+        bool internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool isParent,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   910
+            nsCStringArray* output );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   911
+        FILE* commandFile;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   912
+        FILE* replyFile;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+    };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   915
+#endif // nsKDEUtils
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
--- mozilla/uriloader/exthandler/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
+++ mozilla/uriloader/exthandler/Makefile.in	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   918
@@ -109,8 +109,9 @@ endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
 LOCAL_INCLUDES = -I$(srcdir)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   920
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   921
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
-OSHELPER	+= nsGNOMERegistry.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   923
+OSHELPER	+= nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   924
 OSHELPER  += nsMIMEInfoUnix.cpp
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   925
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   926
 endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   927
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
--- mozilla/uriloader/exthandler/unix/nsCommonRegistry.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
+++ mozilla/uriloader/exthandler/unix/nsCommonRegistry.cpp	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   931
@@ -0,0 +1,87 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+/* ***** BEGIN LICENSE BLOCK *****
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   935
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   936
+ * The contents of this file are subject to the Mozilla Public License Version
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   937
+ * 1.1 (the "License"); you may not use this file except in compliance with
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   938
+ * the License. You may obtain a copy of the License at
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   939
+ * http://www.mozilla.org/MPL/
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   940
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   941
+ * Software distributed under the License is distributed on an "AS IS" basis,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
+ * for the specific language governing rights and limitations under the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
+ * License.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
+ * The Original Code is the GNOME helper app implementation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   948
+ * The Initial Developer of the Original Code is
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   949
+ * IBM Corporation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
+ * Portions created by the Initial Developer are Copyright (C) 2003
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   951
+ * the Initial Developer. All Rights Reserved.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
+ * Contributor(s):
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
+ *  Brian Ryner <bryner@brianryner.com>  (Original Author)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   955
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
+ * Alternatively, the contents of this file may be used under the terms of
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
+ * in which case the provisions of the GPL or the LGPL are applicable instead
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   960
+ * of those above. If you wish to allow use of your version of this file only
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
+ * under the terms of either the GPL or the LGPL, and not to allow others to
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
+ * use your version of this file under the terms of the MPL, indicate your
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   963
+ * decision by deleting the provisions above and replace them with the notice
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   964
+ * and other provisions required by the GPL or the LGPL. If you do not delete
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   965
+ * the provisions above, a recipient may use your version of this file under
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   966
+ * the terms of any one of the MPL, the GPL or the LGPL.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   967
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
+ * ***** END LICENSE BLOCK ***** */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
+#include "nsCommonRegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   971
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   972
+#include "nsGNOMERegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
+#include "nsKDERegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   974
+#include "nsString.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   975
+#include "nsVoidArray.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   976
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   977
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   978
+/* static */ PRBool
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+nsCommonRegistry::HandlerExists(const char *aProtocolScheme)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
+    if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
+        return nsKDERegistry::HandlerExists( aProtocolScheme );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
+    return nsGNOMERegistry::HandlerExists( aProtocolScheme );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   985
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
+/* static */ nsresult
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
+nsCommonRegistry::LoadURL(nsIURI *aURL)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   989
+    if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   990
+        return nsKDERegistry::LoadURL( aURL );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
+    return nsGNOMERegistry::LoadURL( aURL );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   993
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
+/* static */ void
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   995
+nsCommonRegistry::GetAppDescForScheme(const nsACString& aScheme,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
+                                     nsAString& aDesc)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   997
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   998
+    if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+        return nsKDERegistry::GetAppDescForScheme( aScheme, aDesc );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
+    return nsGNOMERegistry::GetAppDescForScheme( aScheme, aDesc );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+/* static */ already_AddRefed<nsMIMEInfoBase>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+nsCommonRegistry::GetFromExtension(const nsACString& aFileExt)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+    if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1008
+        return nsKDERegistry::GetFromExtension( aFileExt );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+    return nsGNOMERegistry::GetFromExtension( aFileExt );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+/* static */ already_AddRefed<nsMIMEInfoBase>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
+nsCommonRegistry::GetFromType(const nsACString& aMIMEType)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
+    if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
+        return nsKDERegistry::GetFromType( aMIMEType );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
+    return nsGNOMERegistry::GetFromType( aMIMEType );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
--- mozilla/uriloader/exthandler/unix/nsCommonRegistry.h.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1020
+++ mozilla/uriloader/exthandler/unix/nsCommonRegistry.h	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
@@ -0,0 +1,56 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
+/* ***** BEGIN LICENSE BLOCK *****
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1023
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1024
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
+ * The contents of this file are subject to the Mozilla Public License Version
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
+ * 1.1 (the "License"); you may not use this file except in compliance with
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
+ * the License. You may obtain a copy of the License at
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
+ * http://www.mozilla.org/MPL/
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
+ * Software distributed under the License is distributed on an "AS IS" basis,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
+ * for the specific language governing rights and limitations under the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
+ * License.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
+ * The Original Code is the GNOME helper app implementation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
+ * The Initial Developer of the Original Code is
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
+ * IBM Corporation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1039
+ * Portions created by the Initial Developer are Copyright (C) 2003
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1040
+ * the Initial Developer. All Rights Reserved.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
+ * Contributor(s):
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
+ *  Brian Ryner <bryner@brianryner.com>  (Original Author)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1044
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1045
+ * Alternatively, the contents of this file may be used under the terms of
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1046
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1047
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1048
+ * in which case the provisions of the GPL or the LGPL are applicable instead
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1049
+ * of those above. If you wish to allow use of your version of this file only
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1050
+ * under the terms of either the GPL or the LGPL, and not to allow others to
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1051
+ * use your version of this file under the terms of the MPL, indicate your
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1052
+ * decision by deleting the provisions above and replace them with the notice
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1053
+ * and other provisions required by the GPL or the LGPL. If you do not delete
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1054
+ * the provisions above, a recipient may use your version of this file under
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1055
+ * the terms of any one of the MPL, the GPL or the LGPL.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
+ * ***** END LICENSE BLOCK ***** */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1058
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1059
+#include "nsIURI.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
+#include "nsCOMPtr.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
+class nsMIMEInfoBase;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1063
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
+class nsCommonRegistry
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1065
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1066
+ public:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
+  static PRBool HandlerExists(const char *aProtocolScheme);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1068
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1069
+  static nsresult LoadURL(nsIURI *aURL);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1071
+  static void GetAppDescForScheme(const nsACString& aScheme,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1072
+                                  nsAString& aDesc);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1073
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1074
+  static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1075
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1076
+  static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1077
+};
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1078
--- mozilla/uriloader/exthandler/unix/nsKDERegistry.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1079
+++ mozilla/uriloader/exthandler/unix/nsKDERegistry.cpp	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1080
@@ -0,0 +1,119 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1081
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1082
+/* ***** BEGIN LICENSE BLOCK *****
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1083
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1084
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1085
+ * The contents of this file are subject to the Mozilla Public License Version
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
+ * 1.1 (the "License"); you may not use this file except in compliance with
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1087
+ * the License. You may obtain a copy of the License at
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1088
+ * http://www.mozilla.org/MPL/
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1090
+ * Software distributed under the License is distributed on an "AS IS" basis,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1092
+ * for the specific language governing rights and limitations under the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+ * License.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1094
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1095
+ * The Original Code is the GNOME helper app implementation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1096
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1097
+ * The Initial Developer of the Original Code is
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+ * IBM Corporation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1099
+ * Portions created by the Initial Developer are Copyright (C) 2003
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
+ * the Initial Developer. All Rights Reserved.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1101
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1102
+ * Contributor(s):
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1103
+ *  Brian Ryner <bryner@brianryner.com>  (Original Author)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1104
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1105
+ * Alternatively, the contents of this file may be used under the terms of
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1107
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1108
+ * in which case the provisions of the GPL or the LGPL are applicable instead
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1109
+ * of those above. If you wish to allow use of your version of this file only
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1110
+ * under the terms of either the GPL or the LGPL, and not to allow others to
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
+ * use your version of this file under the terms of the MPL, indicate your
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
+ * decision by deleting the provisions above and replace them with the notice
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
+ * and other provisions required by the GPL or the LGPL. If you do not delete
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1114
+ * the provisions above, a recipient may use your version of this file under
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1115
+ * the terms of any one of the MPL, the GPL or the LGPL.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
+ * ***** END LICENSE BLOCK ***** */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1119
+#include "nsKDERegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1120
+#include "prlink.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1121
+#include "prmem.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
+#include "nsString.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
+#include "nsILocalFile.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
+#include "nsMIMEInfoUnix.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
+#include "nsAutoPtr.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+/* static */ PRBool
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
+nsKDERegistry::HandlerExists(const char *aProtocolScheme)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1130
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1131
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1132
+    command.AppendCString( NS_LITERAL_CSTRING( "HANDLEREXISTS" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
+    command.AppendCString( nsCAutoString( aProtocolScheme ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
+    return nsKDEUtils::command( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
+/* static */ nsresult
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
+nsKDERegistry::LoadURL(nsIURI *aURL)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
+    command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
+    nsCString url;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
+    aURL->GetSpec( url );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1144
+    command.AppendCString( url );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1145
+    return nsKDEUtils::command( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
+/* static */ void
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+                                     nsAString& aDesc)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1153
+    command.AppendCString( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+    command.AppendCString( aScheme );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+    nsCStringArray output;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+    if( nsKDEUtils::command( command, &output ) && output.Count() == 1 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+        CopyUTF8toUTF16( *output[ 0 ], aDesc );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+/* static */ already_AddRefed<nsMIMEInfoBase>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
+nsKDERegistry::GetFromExtension(const nsACString& aFileExt)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+    NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot");
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1165
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+    command.AppendCString( NS_LITERAL_CSTRING( "GETFROMEXTENSION" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+    command.AppendCString( aFileExt );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1168
+    return GetFromHelper( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+/* static */ already_AddRefed<nsMIMEInfoBase>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+nsKDERegistry::GetFromType(const nsACString& aMIMEType)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1174
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1175
+    command.AppendCString( NS_LITERAL_CSTRING( "GETFROMTYPE" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1176
+    command.AppendCString( aMIMEType );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1177
+    return GetFromHelper( command );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1178
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1179
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1180
+/* static */ already_AddRefed<nsMIMEInfoBase>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1181
+nsKDERegistry::GetFromHelper(const nsCStringArray& command)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1182
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1183
+    nsCStringArray output;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1184
+    if( nsKDEUtils::command( command, &output ) && output.Count() == 3 )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1185
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1186
+        nsCString mimetype = *output[ 0 ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1187
+        nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1188
+        NS_ENSURE_TRUE(mimeInfo, nsnull);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1189
+        nsCString description = *output[ 1 ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1190
+        mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1191
+        nsCString handlerAppName = *output[ 2 ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1192
+        mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1193
+        mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1194
+        nsMIMEInfoBase* retval;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1195
+        NS_ADDREF((retval = mimeInfo));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1196
+        return retval;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1197
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1198
+    return nsnull;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1199
+}
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1200
--- mozilla/uriloader/exthandler/unix/nsKDERegistry.h.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1201
+++ mozilla/uriloader/exthandler/unix/nsKDERegistry.h	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1202
@@ -0,0 +1,61 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1203
+/* ***** BEGIN LICENSE BLOCK *****
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1204
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1205
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1206
+ * The contents of this file are subject to the Mozilla Public License Version
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1207
+ * 1.1 (the "License"); you may not use this file except in compliance with
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1208
+ * the License. You may obtain a copy of the License at
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1209
+ * http://www.mozilla.org/MPL/
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1210
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1211
+ * Software distributed under the License is distributed on an "AS IS" basis,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1212
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1213
+ * for the specific language governing rights and limitations under the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1214
+ * License.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1215
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1216
+ * The Original Code is the GNOME helper app implementation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1217
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1218
+ * The Initial Developer of the Original Code is
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1219
+ * IBM Corporation.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1220
+ * Portions created by the Initial Developer are Copyright (C) 2003
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1221
+ * the Initial Developer. All Rights Reserved.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1222
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1223
+ * Contributor(s):
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1224
+ *  Brian Ryner <bryner@brianryner.com>  (Original Author)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1225
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1226
+ * Alternatively, the contents of this file may be used under the terms of
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1227
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1228
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1229
+ * in which case the provisions of the GPL or the LGPL are applicable instead
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1230
+ * of those above. If you wish to allow use of your version of this file only
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1231
+ * under the terms of either the GPL or the LGPL, and not to allow others to
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1232
+ * use your version of this file under the terms of the MPL, indicate your
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1233
+ * decision by deleting the provisions above and replace them with the notice
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1234
+ * and other provisions required by the GPL or the LGPL. If you do not delete
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1235
+ * the provisions above, a recipient may use your version of this file under
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1236
+ * the terms of any one of the MPL, the GPL or the LGPL.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1237
+ *
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1238
+ * ***** END LICENSE BLOCK ***** */
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1239
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1240
+#include "nsIURI.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1241
+#include "nsCOMPtr.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1242
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1243
+class nsMIMEInfoBase;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1244
+class nsCAutoString;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1245
+class nsCStringArray;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1246
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1247
+class nsKDERegistry
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1248
+{
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1249
+ public:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1250
+  static PRBool HandlerExists(const char *aProtocolScheme);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1251
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1252
+  static nsresult LoadURL(nsIURI *aURL);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1253
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1254
+  static void GetAppDescForScheme(const nsACString& aScheme,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1255
+                                  nsAString& aDesc);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1256
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1257
+  static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1258
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1259
+  static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1260
+ private:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1261
+  static already_AddRefed<nsMIMEInfoBase> GetFromHelper(const nsCStringArray& command);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1262
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1263
+};
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1264
--- mozilla/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp.sav	2009-09-14 10:02:42.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1265
+++ mozilla/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp	2009-09-14 10:07:10.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1266
@@ -44,18 +44,19 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1267
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1268
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1269
 #include "nsMIMEInfoUnix.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1270
-#include "nsGNOMERegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1271
+#include "nsCommonRegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1272
 #include "nsIGnomeVFSService.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1273
 #include "nsAutoPtr.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1274
 #ifdef MOZ_ENABLE_DBUS
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1275
 #include "nsDBusHandlerApp.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1276
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1277
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1278
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1279
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1280
 nsresult
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1281
 nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1282
 { 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1283
-  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1284
+  nsresult rv = nsCommonRegistry::LoadURL(aURI);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1285
 #ifdef MOZ_PLATFORM_HILDON
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1286
   if (NS_FAILED(rv)){
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1287
     HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1288
@@ -75,11 +76,11 @@ NS_IMETHODIMP
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1289
 nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1290
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1291
   *_retval = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1292
-  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mType);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1293
+  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mType);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1294
   if (!mimeInfo) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1295
     nsCAutoString ext;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1296
     GetPrimaryExtension(ext);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1297
-    mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1298
+    mimeInfo = nsCommonRegistry::GetFromExtension(ext);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1299
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1300
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1301
   if (mimeInfo)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1302
@@ -106,6 +107,19 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1303
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1304
   nsCAutoString nativePath;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1305
   aFile->GetNativePath(nativePath);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1306
+  
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1307
+  if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1308
+      {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1309
+      nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1310
+      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1311
+      command.AppendCString( nativePath );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1312
+      if( nsKDEUtils::command( command ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1313
+          return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1314
+      if (!mDefaultApplication)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1315
+        return NS_ERROR_FILE_NOT_FOUND;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1316
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1317
+      return LaunchWithIProcess(mDefaultApplication, nativePath);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1318
+      }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1319
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1320
   nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1321
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1322
@@ -116,7 +130,7 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1323
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1324
     // If we haven't got an app we try to get a valid one by searching for the
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1325
     // extension mapped type
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1326
-    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1327
+    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1328
     if (mimeInfo) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1329
       nsCAutoString type;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1330
       mimeInfo->GetType(type);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1331
--- mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp.sav	2009-09-14 10:02:42.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1332
+++ mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1333
@@ -44,7 +44,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1334
 #include "nsOSHelperAppService.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1335
 #include "nsMIMEInfoUnix.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1336
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1337
-#include "nsGNOMERegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1338
+#include "nsCommonRegistry.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1339
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1340
 #include "nsISupports.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1341
 #include "nsString.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1342
@@ -1210,7 +1210,7 @@ nsresult nsOSHelperAppService::OSProtoco
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1343
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1344
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1345
   // Check the GConf registry for a protocol handler
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1346
-  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1347
+  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1348
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1349
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1350
   return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1351
@@ -1219,7 +1219,7 @@ nsresult nsOSHelperAppService::OSProtoco
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1352
 NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1353
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1354
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1355
-  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1356
+  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1357
   return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1358
 #else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1359
   return NS_ERROR_NOT_AVAILABLE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1360
@@ -1315,7 +1315,7 @@ nsOSHelperAppService::GetFromExtension(c
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1361
     
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1362
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1363
     LOG(("Looking in GNOME registry\n"));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1364
-    nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromExtension(aFileExt).get();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1365
+    nsMIMEInfoBase *gnomeInfo = nsCommonRegistry::GetFromExtension(aFileExt).get();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1366
     if (gnomeInfo) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1367
       LOG(("Got MIMEInfo from GNOME registry\n"));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1368
       return gnomeInfo;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1369
@@ -1441,7 +1441,7 @@ nsOSHelperAppService::GetFromType(const
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1370
     // get back a MIMEInfo without any extensions set.  In that case we'll have
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1371
     // to look in our mime.types files for the extensions.    
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1372
     LOG(("Looking in GNOME registry\n"));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1373
-    gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType).get();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1374
+    gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType).get();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1375
     if (gnomeInfo && gnomeInfo->HasExtensions()) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1376
       LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n"));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1377
       return gnomeInfo;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1378
--- mozilla/widget/src/gtk2/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1379
+++ mozilla/widget/src/gtk2/Makefile.in	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1380
@@ -182,6 +182,8 @@ INCLUDES	+= \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1381
 		-I$(topsrcdir)/other-licenses/atk-1.0 \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1382
 		$(NULL)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1383
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1384
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1385
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1386
 test_container: mozdrawingarea.o mozcontainer.o test_container.c
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1387
 	$(CC) $(MOZ_GTK2_CFLAGS) -o test_container test_container.c \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1388
 		mozdrawingarea.o mozcontainer.o \
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1389
--- mozilla/widget/src/gtk2/nsFilePicker.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1390
+++ mozilla/widget/src/gtk2/nsFilePicker.cpp	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1391
@@ -40,6 +40,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1392
 #include <gtk/gtkstock.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1393
 #include <gtk/gtkmessagedialog.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1394
 #include <gtk/gtkimage.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1395
+#include <gdk/gdkx.h>
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1396
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1397
 #include "nsIFileURL.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1398
 #include "nsIURI.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1399
@@ -59,6 +60,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1400
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1401
 #include "nsFilePicker.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1402
 #include "nsAccessibilityHelper.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1403
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1404
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1405
 #define DECL_FUNC_PTR(func) static _##func##_fn _##func
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1406
 #define GTK_FILE_CHOOSER(widget) ((GtkFileChooser*) widget)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1407
@@ -95,6 +97,7 @@ typedef GtkWidget* (*_gtk_file_chooser_d
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1408
                                                       GtkFileChooserAction action,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1409
                                                       const gchar *first_button_text,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1410
                                                       ...);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1411
+typedef void (*_gtk_dialog_set_alternative_button_order_fn)(GtkDialog *dialog, gint first_response_id, ...);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1412
 typedef void (*_gtk_file_chooser_set_select_multiple_fn)(GtkFileChooser* chooser, gboolean truth);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1413
 typedef void (*_gtk_file_chooser_set_do_overwrite_confirmation_fn)(GtkFileChooser* chooser, gboolean do_confirm);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1414
 typedef void (*_gtk_file_chooser_set_current_name_fn)(GtkFileChooser* chooser, const gchar* name);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1415
@@ -119,6 +122,7 @@ DECL_FUNC_PTR(gtk_file_chooser_get_filen
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1416
 DECL_FUNC_PTR(gtk_file_chooser_get_uri);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1417
 DECL_FUNC_PTR(gtk_file_chooser_get_uris);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1418
 DECL_FUNC_PTR(gtk_file_chooser_dialog_new);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1419
+DECL_FUNC_PTR(gtk_dialog_set_alternative_button_order);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1420
 DECL_FUNC_PTR(gtk_file_chooser_set_select_multiple);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1421
 DECL_FUNC_PTR(gtk_file_chooser_set_do_overwrite_confirmation);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1422
 DECL_FUNC_PTR(gtk_file_chooser_set_current_name);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1423
@@ -214,6 +218,7 @@ nsFilePicker::LoadSymbolsGTK24()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1424
   GET_LIBGTK_FUNC(gtk_file_chooser_get_uri);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1425
   GET_LIBGTK_FUNC(gtk_file_chooser_get_uris);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1426
   GET_LIBGTK_FUNC(gtk_file_chooser_dialog_new);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1427
+  GET_LIBGTK_FUNC(gtk_dialog_set_alternative_button_order);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1428
   GET_LIBGTK_FUNC(gtk_file_chooser_set_select_multiple);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1429
   GET_LIBGTK_FUNC_OPT(gtk_file_chooser_set_do_overwrite_confirmation);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1430
   GET_LIBGTK_FUNC(gtk_file_chooser_set_current_name);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1431
@@ -442,7 +447,8 @@ nsFilePicker::AppendFilter(const nsAStri
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1432
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1433
   if (aFilter.EqualsLiteral("..apps")) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1434
     // No platform specific thing we can do here, really....
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1435
-    return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1436
+    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1437
+        return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1438
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1439
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1440
   nsCAutoString filter, name;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1441
@@ -590,6 +596,9 @@ confirm_overwrite_file (GtkWidget *paren
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1442
 NS_IMETHODIMP
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1443
 nsFilePicker::Show(PRInt16 *aReturn)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1444
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1445
+  if( nsKDEUtils::kdeSupport())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1446
+      return kdeFileDialog( aReturn );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1447
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1448
   NS_ENSURE_ARG_POINTER(aReturn);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1449
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1450
   nsXPIDLCString title;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1451
@@ -605,6 +614,12 @@ nsFilePicker::Show(PRInt16 *aReturn)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1452
                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1453
                                    accept_button, GTK_RESPONSE_ACCEPT,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1454
                                    NULL);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1455
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1456
+  _gtk_dialog_set_alternative_button_order(GTK_DIALOG(file_chooser),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1457
+                                          GTK_RESPONSE_ACCEPT,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1458
+                                          GTK_RESPONSE_CANCEL,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1459
+                                          -1);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1460
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1461
   if (mAllowURLs) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1462
     _gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1463
   }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1464
@@ -727,3 +742,221 @@ nsFilePicker::Show(PRInt16 *aReturn)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1465
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1466
   return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1467
 }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1468
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1469
+nsCString nsFilePicker::kdeMakeFilter( int index )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1470
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1471
+    nsCString buf = *mFilters[ index ];
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1472
+    for( PRUint32 i = 0;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1473
+         i < buf.Length();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1474
+         ++i )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1475
+        if( buf[ i ] == ';' ) // KDE separates just using spaces
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1476
+            buf.SetCharAt( ' ', i );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1477
+    if (!mFilterNames[index]->IsEmpty())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1478
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1479
+        buf += "|";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1480
+        buf += mFilterNames[index]->get();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1481
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1482
+    return buf;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1483
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1484
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1485
+static PRInt32 windowToXid( nsIWidget* widget )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1486
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1487
+    GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1488
+    GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget )));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1489
+    return GDK_WINDOW_XID( gdk_window );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1490
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1491
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1492
+NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1493
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1494
+    NS_ENSURE_ARG_POINTER(aReturn);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1495
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1496
+    if( mMode == modeOpen && mFilters.Count() == 1 && mFilters[ 0 ]->EqualsLiteral( "..apps" ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1497
+        return kdeAppsDialog( aReturn );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1498
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1499
+    nsXPIDLCString title;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1500
+    title.Adopt(ToNewUTF8String(mTitle));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1501
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1502
+    const char* arg = NULL;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1503
+    if( mAllowURLs )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1504
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1505
+        switch( mMode )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1506
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1507
+            case nsIFilePicker::modeOpen:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1508
+            case nsIFilePicker::modeOpenMultiple:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1509
+                arg = "GETOPENURL";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1510
+                break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1511
+            case nsIFilePicker::modeSave:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1512
+                arg = "GETSAVEURL";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1513
+                break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1514
+            case nsIFilePicker::modeGetFolder:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1515
+                arg = "GETDIRECTORYURL";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1516
+                break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1517
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1518
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1519
+    else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1520
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1521
+        switch( mMode )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1522
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1523
+            case nsIFilePicker::modeOpen:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1524
+            case nsIFilePicker::modeOpenMultiple:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1525
+                arg = "GETOPENFILENAME";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1526
+                break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1527
+            case nsIFilePicker::modeSave:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1528
+                arg = "GETSAVEFILENAME";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1529
+                break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1530
+            case nsIFilePicker::modeGetFolder:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1531
+                arg = "GETDIRECTORYFILENAME";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1532
+                break;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1533
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1534
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1535
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1536
+  nsCAutoString directory;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1537
+  if (mDisplayDirectory) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1538
+    mDisplayDirectory->GetNativePath(directory);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1539
+  } else if (mPrevDisplayDirectory) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1540
+    mPrevDisplayDirectory->GetNativePath(directory);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1541
+  }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1542
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1543
+    nsCAutoString startdir;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1544
+  if (!directory.IsEmpty()) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1545
+    startdir = directory;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1546
+  }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1547
+  if (mMode == nsIFilePicker::modeSave) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1548
+    if( !startdir.IsEmpty())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1549
+      {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1550
+      startdir += "/";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1551
+      startdir += ToNewUTF8String(mDefault);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1552
+      }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1553
+    else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1554
+      startdir = ToNewUTF8String(mDefault);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1555
+  }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1556
+  if( startdir.IsEmpty())
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1557
+      startdir = ".";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1558
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1559
+    nsCAutoString filters;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1560
+    PRInt32 count = mFilters.Count();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1561
+    if( count == 0 ) //just in case
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1562
+        filters = "*";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1563
+    else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1564
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1565
+        filters = kdeMakeFilter( 0 );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1566
+        for (PRInt32 i = 1; i < count; ++i)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1567
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1568
+            filters += "\n";
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1569
+            filters += kdeMakeFilter( i );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1570
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1571
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1572
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1573
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1574
+    command.AppendCString( nsCAutoString( arg ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1575
+    command.AppendCString( startdir );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1576
+    if( mMode != nsIFilePicker::modeGetFolder )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1577
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1578
+        command.AppendCString( filters );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1579
+        nsCAutoString selected;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1580
+        selected.AppendInt( mSelectedType );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1581
+        command.AppendCString( selected );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1582
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1583
+    command.AppendCString( title );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1584
+    if( mMode == nsIFilePicker::modeOpenMultiple )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1585
+        command.AppendCString( NS_LITERAL_CSTRING( "MULTIPLE" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1586
+    if( PRInt32 xid = windowToXid( mParentWidget ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1587
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1588
+        command.AppendCString( NS_LITERAL_CSTRING( "PARENT" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1589
+        nsCAutoString parent;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1590
+        parent.AppendInt( xid );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1591
+        command.AppendCString( parent );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1592
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1593
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1594
+    nsCStringArray output;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1595
+    if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1596
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1597
+        *aReturn = nsIFilePicker::returnOK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1598
+        mFiles.Clear();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1599
+        if( mMode != nsIFilePicker::modeGetFolder )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1600
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1601
+            mSelectedType = atoi( output[ 0 ]->get());
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1602
+            output.RemoveCStringAt( 0 );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1603
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1604
+        if (mMode == nsIFilePicker::modeOpenMultiple)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1605
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1606
+            mFileURL.Truncate();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1607
+            PRUint32 count = output.Count();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1608
+            for( PRUint32 i = 0;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1609
+                 i < count;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1610
+                 ++i )
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1611
+                {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1612
+                nsCOMPtr<nsILocalFile> localfile;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1613
+                nsresult rv = NS_NewNativeLocalFile( *output[ i ],
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1614
+                                      PR_FALSE,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1615
+                                      getter_AddRefs(localfile));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1616
+                if (NS_SUCCEEDED(rv))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1617
+                    mFiles.AppendObject(localfile);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1618
+                }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1619
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1620
+        else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1621
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1622
+            mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1623
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1624
+  // Remember last used directory.
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1625
+  nsCOMPtr<nsILocalFile> file;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1626
+  GetFile(getter_AddRefs(file));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1627
+  if (file) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1628
+    nsCOMPtr<nsIFile> dir;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1629
+    file->GetParent(getter_AddRefs(dir));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1630
+    nsCOMPtr<nsILocalFile> localDir(do_QueryInterface(dir));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1631
+    if (localDir) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1632
+      localDir.swap(mPrevDisplayDirectory);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1633
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1634
+  }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1635
+        if (mMode == nsIFilePicker::modeSave)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1636
+            {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1637
+            nsCOMPtr<nsILocalFile> file;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1638
+            GetFile(getter_AddRefs(file));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1639
+            if (file)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1640
+                {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1641
+                PRBool exists = PR_FALSE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1642
+                file->Exists(&exists);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1643
+                if (exists) // TODO do overwrite check in the helper app
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1644
+                    *aReturn = nsIFilePicker::returnReplace;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1645
+                }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1646
+            }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1647
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1648
+    else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1649
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1650
+        *aReturn = nsIFilePicker::returnCancel;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1651
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1652
+    return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1653
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1654
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1655
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1656
+NS_IMETHODIMP nsFilePicker::kdeAppsDialog(PRInt16 *aReturn)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1657
+    {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1658
+    NS_ENSURE_ARG_POINTER(aReturn);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1659
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1660
+    nsXPIDLCString title;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1661
+    title.Adopt(ToNewUTF8String(mTitle));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1662
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1663
+    nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1664
+    command.AppendCString( NS_LITERAL_CSTRING( "APPSDIALOG" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1665
+    command.AppendCString( title );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1666
+    if( PRInt32 xid = windowToXid( mParentWidget ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1667
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1668
+        command.AppendCString( NS_LITERAL_CSTRING( "PARENT" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1669
+        nsCAutoString parent;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1670
+        parent.AppendInt( xid );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1671
+        command.AppendCString( parent );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1672
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1673
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1674
+    nsCStringArray output;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1675
+    if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output ))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1676
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1677
+        *aReturn = nsIFilePicker::returnOK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1678
+        mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1679
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1680
+    else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1681
+        {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1682
+        *aReturn = nsIFilePicker::returnCancel;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1683
+        }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1684
+    return NS_OK;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1685
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1686
--- mozilla/widget/src/gtk2/nsFilePicker.h.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1687
+++ mozilla/widget/src/gtk2/nsFilePicker.h	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1688
@@ -98,6 +98,12 @@ protected:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1689
 private:
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1690
   static nsILocalFile *mPrevDisplayDirectory;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1691
   static PRLibrary *mGTK24;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1692
+  
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1693
+  bool kdeRunning();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1694
+  bool getKdeRunning();
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1695
+  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1696
+  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1697
+  nsCString kdeMakeFilter( int index );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1698
 };
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1699
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1700
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1701
--- mozilla/widget/src/gtk2/nsPrintDialogGTK.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1702
+++ mozilla/widget/src/gtk2/nsPrintDialogGTK.cpp	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1703
@@ -145,6 +145,10 @@ ShowCustomDialog(GtkComboBox *changed_bo
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1704
                                                          GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1705
                                                          NULL);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1706
   gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1707
+  gtk_dialog_set_alternative_button_order(GTK_DIALOG(prompt_dialog),
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1708
+                                          GTK_RESPONSE_ACCEPT,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1709
+                                          GTK_RESPONSE_REJECT,
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1710
+                                          -1);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1711
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1712
   printBundle->GetStringFromName(NS_LITERAL_STRING("customHeaderFooterPrompt").get(), getter_Copies(intlString));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1713
   GtkWidget* custom_label = gtk_label_new(NS_ConvertUTF16toUTF8(intlString).get());
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1714
--- mozilla/xpcom/io/Makefile.in.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1715
+++ mozilla/xpcom/io/Makefile.in	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1716
@@ -199,3 +199,4 @@ endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1717
 endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1718
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1719
 LOCAL_INCLUDES	= -I..
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1720
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1721
--- mozilla/xpcom/io/nsLocalFileUnix.cpp.sav	2009-09-14 10:00:21.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1722
+++ mozilla/xpcom/io/nsLocalFileUnix.cpp	2009-09-14 10:04:15.000000000 +0200
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1723
@@ -84,6 +84,7 @@
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1724
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1725
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1726
 #include "nsIGnomeVFSService.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1727
+#include "nsKDEUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1728
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1729
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1730
 #include "nsNativeCharsetUtils.h"
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1731
@@ -1666,16 +1667,13 @@ NS_IMETHODIMP
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1732
 nsLocalFile::Reveal()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1733
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1734
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1735
-    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1736
-    if (!vfs)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1737
-        return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1738
-
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1739
+    nsCAutoString url;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1740
     PRBool isDirectory;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1741
     if (NS_FAILED(IsDirectory(&isDirectory)))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1742
         return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1743
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1744
     if (isDirectory) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1745
-        return vfs->ShowURIForInput(mPath);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1746
+        url = mPath;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1747
     } else {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1748
         nsCOMPtr<nsIFile> parentDir;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1749
         nsCAutoString dirPath;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1750
@@ -1684,8 +1682,21 @@ nsLocalFile::Reveal()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1751
         if (NS_FAILED(parentDir->GetNativePath(dirPath)))
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1752
             return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1753
 
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1754
-        return vfs->ShowURIForInput(dirPath);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1755
+        url = dirPath;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1756
     }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1757
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1758
+    if( nsKDEUtils::kdeSupport()) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1759
+        nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1760
+        command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1761
+        command.AppendCString( url );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1762
+        return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1763
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1764
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1765
+    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1766
+    if (!vfs)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1767
+        return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1768
+    return vfs->ShowURIForInput(url);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1769
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1770
 #else
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1771
     return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1772
 #endif
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1773
@@ -1695,6 +1706,13 @@ NS_IMETHODIMP
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1774
 nsLocalFile::Launch()
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1775
 {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1776
 #ifdef MOZ_WIDGET_GTK2
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1777
+    if( nsKDEUtils::kdeSupport()) {
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1778
+        nsCStringArray command;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1779
+        command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1780
+        command.AppendCString( mPath );
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1781
+        return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1782
+    }
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1783
+
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1784
     nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1785
     if (!vfs)
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1786
         return NS_ERROR_FAILURE;
523b1d92948c Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1787