mozilla-kde.patch
changeset 127 4c86470ed796
parent 64 7bb1edb78dd5
child 153 46ee28dc7145
equal deleted inserted replaced
126:7b356805729c 127:4c86470ed796
     1 diff --git a/chrome/src/Makefile.in b/chrome/src/Makefile.in
       
     2 --- a/chrome/src/Makefile.in
       
     3 +++ b/chrome/src/Makefile.in
       
     4 @@ -81,16 +81,17 @@ CPPSRCS		= \
       
     5  
       
     6  EXTRA_DSO_LDOPTS = \
       
     7                  $(MOZ_UNICHARUTIL_LIBS) \
       
     8                  $(MOZ_COMPONENT_LIBS) \
       
     9                  $(NULL)
       
    10  
       
    11  ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
       
    12  EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
       
    13 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
       
    14  endif
       
    15  
       
    16  ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
       
    17  EXTRA_DSO_LDOPTS += $(TK_LIBS)
       
    18  endif
       
    19  
       
    20  include $(topsrcdir)/config/rules.mk
       
    21  
       
    22 diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp
       
    23 --- a/chrome/src/nsChromeRegistry.cpp
       
    24 +++ b/chrome/src/nsChromeRegistry.cpp
       
    25 @@ -109,16 +109,17 @@
       
    26  #include "nsIStyleSheet.h"
       
    27  #include "nsISupportsArray.h"
       
    28  #include "nsIVersionComparator.h"
       
    29  #include "nsIWindowMediator.h"
       
    30  #include "nsIXPConnect.h"
       
    31  #include "nsIXULAppInfo.h"
       
    32  #include "nsIXULRuntime.h"
       
    33  #include "nsPresShellIterator.h"
       
    34 +#include "nsKDEUtils.h"
       
    35  
       
    36  #define UILOCALE_CMD_LINE_ARG "UILocale"
       
    37  
       
    38  #define MATCH_OS_LOCALE_PREF "intl.locale.matchOS"
       
    39  #define SELECTED_LOCALE_PREF "general.useragent.locale"
       
    40  #define SELECTED_SKIN_PREF   "general.skins.selectedSkin"
       
    41  
       
    42  static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID);
       
    43 @@ -1608,16 +1609,17 @@ nsChromeRegistry::ProcessManifestBuffer(
       
    44  
       
    45    NS_NAMED_LITERAL_STRING(kPlatform, "platform");
       
    46    NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers");
       
    47    NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible");
       
    48    NS_NAMED_LITERAL_STRING(kApplication, "application");
       
    49    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
       
    50    NS_NAMED_LITERAL_STRING(kOs, "os");
       
    51    NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
       
    52 +  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
       
    53  
       
    54    nsCOMPtr<nsIIOService> io (do_GetIOService());
       
    55    if (!io) return NS_ERROR_FAILURE;
       
    56  
       
    57    nsCOMPtr<nsIProtocolHandler> ph;
       
    58    rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
       
    59    NS_ENSURE_SUCCESS(rv, rv);
       
    60    
       
    61 @@ -1651,35 +1653,39 @@ nsChromeRegistry::ProcessManifestBuffer(
       
    62        if (NS_SUCCEEDED(rv)) {
       
    63          CopyUTF8toUTF16(s, osTarget);
       
    64          ToLowerCase(osTarget);
       
    65        }
       
    66      }
       
    67    }
       
    68    
       
    69    nsAutoString osVersion;
       
    70 +  nsAutoString desktop;
       
    71  #if defined(XP_WIN)
       
    72    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
       
    73    if (GetVersionEx(&info)) {
       
    74      nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
       
    75                                           info.dwMajorVersion,
       
    76                                           info.dwMinorVersion);
       
    77    }
       
    78 +  desktop = NS_LITERAL_STRING("win");
       
    79  #elif defined(XP_MACOSX)
       
    80    long majorVersion, minorVersion;
       
    81    if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
       
    82        (Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
       
    83      nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
       
    84                                           majorVersion,
       
    85                                           minorVersion);
       
    86    }
       
    87 +  desktop = NS_LITERAL_STRING("macosx");
       
    88  #elif defined(MOZ_WIDGET_GTK2)
       
    89    nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
       
    90                                         gtk_major_version,
       
    91                                         gtk_minor_version);
       
    92 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome"); // TODO others?
       
    93  #endif
       
    94  
       
    95    char *token;
       
    96    char *newline = buf;
       
    97    PRUint32 line = 0;
       
    98  
       
    99    // outer loop tokenizes by newline
       
   100    while (nsnull != (token = nsCRT::strtok(newline, kNewlines, &newline))) {
       
   101 @@ -1713,41 +1719,43 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   102  
       
   103        PRBool platform = PR_FALSE;
       
   104        PRBool xpcNativeWrappers = PR_TRUE;
       
   105        PRBool contentAccessible = PR_FALSE;
       
   106        TriState stAppVersion = eUnspecified;
       
   107        TriState stApp = eUnspecified;
       
   108        TriState stOsVersion = eUnspecified;
       
   109        TriState stOs = eUnspecified;
       
   110 +      TriState stDesktop = eUnspecified;
       
   111  
       
   112        PRBool badFlag = PR_FALSE;
       
   113  
       
   114        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   115               !badFlag) {
       
   116          NS_ConvertASCIItoUTF16 wtoken(token);
       
   117          ToLowerCase(wtoken);
       
   118  
       
   119          if (CheckFlag(kPlatform, wtoken, platform) ||
       
   120              CheckFlag(kXPCNativeWrappers, wtoken, xpcNativeWrappers) ||
       
   121              CheckFlag(kContentAccessible, wtoken, contentAccessible) ||
       
   122              CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   123              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   124 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   125              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   126              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   127            continue;
       
   128  
       
   129          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   130                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   131                                token);
       
   132          badFlag = PR_TRUE;
       
   133        }
       
   134  
       
   135        if (badFlag || stApp == eBad || stAppVersion == eBad || 
       
   136 -          stOs == eBad || stOsVersion == eBad)
       
   137 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   138          continue;
       
   139  
       
   140        nsCOMPtr<nsIURI> resolved;
       
   141        rv = io->NewURI(nsDependentCString(uri), nsnull, manifestURI,
       
   142                        getter_AddRefs(resolved));
       
   143        if (NS_FAILED(rv))
       
   144          continue;
       
   145  
       
   146 @@ -1798,38 +1806,40 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   147        }
       
   148  
       
   149        EnsureLowerCase(package);
       
   150  
       
   151        TriState stAppVersion = eUnspecified;
       
   152        TriState stApp = eUnspecified;
       
   153        TriState stOs = eUnspecified;
       
   154        TriState stOsVersion = eUnspecified;
       
   155 +      TriState stDesktop = eUnspecified;
       
   156  
       
   157        PRBool badFlag = PR_FALSE;
       
   158  
       
   159        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   160               !badFlag) {
       
   161          NS_ConvertASCIItoUTF16 wtoken(token);
       
   162          ToLowerCase(wtoken);
       
   163  
       
   164          if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   165              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   166 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   167              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   168              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   169            continue;
       
   170  
       
   171          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   172                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   173                                token);
       
   174          badFlag = PR_TRUE;
       
   175        }
       
   176  
       
   177        if (badFlag || stApp == eBad || stAppVersion == eBad ||
       
   178 -          stOs == eBad || stOsVersion == eBad)
       
   179 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   180          continue;
       
   181  
       
   182        nsCOMPtr<nsIURI> resolved;
       
   183        rv = io->NewURI(nsDependentCString(uri), nsnull, manifestURI,
       
   184                        getter_AddRefs(resolved));
       
   185        if (NS_FAILED(rv))
       
   186          continue;
       
   187  
       
   188 @@ -1860,38 +1870,40 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   189        }
       
   190  
       
   191        EnsureLowerCase(package);
       
   192  
       
   193        TriState stAppVersion = eUnspecified;
       
   194        TriState stApp = eUnspecified;
       
   195        TriState stOs = eUnspecified;
       
   196        TriState stOsVersion = eUnspecified;
       
   197 +      TriState stDesktop = eUnspecified;
       
   198  
       
   199        PRBool badFlag = PR_FALSE;
       
   200  
       
   201        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   202               !badFlag) {
       
   203          NS_ConvertASCIItoUTF16 wtoken(token);
       
   204          ToLowerCase(wtoken);
       
   205  
       
   206          if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   207              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   208 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   209              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   210              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   211            continue;
       
   212  
       
   213          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   214                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   215                                token);
       
   216          badFlag = PR_TRUE;
       
   217        }
       
   218  
       
   219        if (badFlag || stApp == eBad || stAppVersion == eBad ||
       
   220 -          stOs == eBad || stOsVersion == eBad)
       
   221 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   222          continue;
       
   223  
       
   224        nsCOMPtr<nsIURI> resolved;
       
   225        rv = io->NewURI(nsDependentCString(uri), nsnull, manifestURI,
       
   226                        getter_AddRefs(resolved));
       
   227        if (NS_FAILED(rv))
       
   228          continue;
       
   229  
       
   230 @@ -1924,38 +1936,40 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   231                                "Warning: malformed chrome overlay instruction.");
       
   232          continue;
       
   233        }
       
   234  
       
   235        TriState stAppVersion = eUnspecified;
       
   236        TriState stApp = eUnspecified;
       
   237        TriState stOs = eUnspecified;
       
   238        TriState stOsVersion = eUnspecified;
       
   239 +      TriState stDesktop = eUnspecified;
       
   240  
       
   241        PRBool badFlag = PR_FALSE;
       
   242  
       
   243        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   244               !badFlag) {
       
   245          NS_ConvertASCIItoUTF16 wtoken(token);
       
   246          ToLowerCase(wtoken);
       
   247  
       
   248          if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   249              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   250 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   251              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   252              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   253            continue;
       
   254  
       
   255          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   256                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   257                                token);
       
   258          badFlag = PR_TRUE;
       
   259        }
       
   260  
       
   261        if (badFlag || stApp == eBad || stAppVersion == eBad ||
       
   262 -          stOs == eBad || stOsVersion == eBad)
       
   263 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   264          continue;
       
   265  
       
   266        nsCOMPtr<nsIURI> baseuri, overlayuri;
       
   267        rv  = io->NewURI(nsDependentCString(base), nsnull, nsnull,
       
   268                         getter_AddRefs(baseuri));
       
   269        rv |= io->NewURI(nsDependentCString(overlay), nsnull, nsnull,
       
   270                         getter_AddRefs(overlayuri));
       
   271        if (NS_FAILED(rv)) {
       
   272 @@ -1980,38 +1994,40 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   273                                "Warning: malformed chrome style instruction.");
       
   274          continue;
       
   275        }
       
   276  
       
   277        TriState stAppVersion = eUnspecified;
       
   278        TriState stApp = eUnspecified;
       
   279        TriState stOs = eUnspecified;
       
   280        TriState stOsVersion = eUnspecified;
       
   281 +      TriState stDesktop = eUnspecified;
       
   282  
       
   283        PRBool badFlag = PR_FALSE;
       
   284  
       
   285        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   286               !badFlag) {
       
   287          NS_ConvertASCIItoUTF16 wtoken(token);
       
   288          ToLowerCase(wtoken);
       
   289  
       
   290          if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   291              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   292 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   293              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   294              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   295            continue;
       
   296  
       
   297          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   298                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   299                                token);
       
   300          badFlag = PR_TRUE;
       
   301        }
       
   302  
       
   303        if (badFlag || stApp == eBad || stAppVersion == eBad ||
       
   304 -          stOs == eBad || stOsVersion == eBad)
       
   305 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   306          continue;
       
   307  
       
   308        nsCOMPtr<nsIURI> baseuri, overlayuri;
       
   309        rv  = io->NewURI(nsDependentCString(base), nsnull, nsnull,
       
   310                        getter_AddRefs(baseuri));
       
   311        rv |= io->NewURI(nsDependentCString(overlay), nsnull, nsnull,
       
   312                         getter_AddRefs(overlayuri));
       
   313        if (NS_FAILED(rv))
       
   314 @@ -2040,38 +2056,40 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   315                                "Warning: malformed chrome override instruction.");
       
   316          continue;
       
   317        }
       
   318  
       
   319        TriState stAppVersion = eUnspecified;
       
   320        TriState stApp = eUnspecified;
       
   321        TriState stOs = eUnspecified;
       
   322        TriState stOsVersion = eUnspecified;
       
   323 +      TriState stDesktop = eUnspecified;
       
   324  
       
   325        PRBool badFlag = PR_FALSE;
       
   326  
       
   327        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   328               !badFlag) {
       
   329          NS_ConvertASCIItoUTF16 wtoken(token);
       
   330          ToLowerCase(wtoken);
       
   331  
       
   332          if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   333              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   334 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   335              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   336              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   337            continue;
       
   338  
       
   339          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   340                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   341                                token);
       
   342          badFlag = PR_TRUE;
       
   343        }
       
   344  
       
   345        if (badFlag || stApp == eBad || stAppVersion == eBad ||
       
   346 -          stOs == eBad || stOsVersion == eBad)
       
   347 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   348          continue;
       
   349  
       
   350        nsCOMPtr<nsIURI> chromeuri, resolveduri;
       
   351        rv  = io->NewURI(nsDependentCString(chrome), nsnull, nsnull,
       
   352                        getter_AddRefs(chromeuri));
       
   353        rv |= io->NewURI(nsDependentCString(resolved), nsnull, manifestURI,
       
   354                         getter_AddRefs(resolveduri));
       
   355        if (NS_FAILED(rv))
       
   356 @@ -2102,38 +2120,40 @@ nsChromeRegistry::ProcessManifestBuffer(
       
   357        }
       
   358  
       
   359        EnsureLowerCase(package);
       
   360  
       
   361        TriState stAppVersion = eUnspecified;
       
   362        TriState stApp = eUnspecified;
       
   363        TriState stOsVersion = eUnspecified;
       
   364        TriState stOs = eUnspecified;
       
   365 +      TriState stDesktop = eUnspecified;
       
   366  
       
   367        PRBool badFlag = PR_FALSE;
       
   368  
       
   369        while (nsnull != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
       
   370               !badFlag) {
       
   371          NS_ConvertASCIItoUTF16 wtoken(token);
       
   372          ToLowerCase(wtoken);
       
   373  
       
   374          if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
   375              CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
   376 +            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
   377              CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
       
   378              CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
       
   379            continue;
       
   380  
       
   381          LogMessageWithContext(manifestURI, line, nsIScriptError::warningFlag,
       
   382                                "Warning: Unrecognized chrome registration modifier '%s'.",
       
   383                                token);
       
   384          badFlag = PR_TRUE;
       
   385        }
       
   386  
       
   387        if (badFlag || stApp == eBad || stAppVersion == eBad || 
       
   388 -          stOs == eBad || stOsVersion == eBad)
       
   389 +          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
       
   390          continue;
       
   391        
       
   392        nsDependentCString host(package);
       
   393  
       
   394        PRBool exists;
       
   395        rv = rph->HasSubstitution(host, &exists);
       
   396        NS_ENSURE_SUCCESS(rv, rv);
       
   397        if (exists) {
       
   398 diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in
     1 diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in
   399 --- a/modules/libpref/src/Makefile.in
     2 --- a/modules/libpref/src/Makefile.in
   400 +++ b/modules/libpref/src/Makefile.in
     3 +++ b/modules/libpref/src/Makefile.in
   401 @@ -97,8 +97,10 @@ GARBAGE		+= $(addprefix $(DIST)/bin/defa
     4 @@ -90,14 +90,16 @@ GREPREF_FILES = $(topsrcdir)/netwerk/bas
   402  
       
   403  # Optimizer bug with GCC 3.2.2 on OS/2
     5  # Optimizer bug with GCC 3.2.2 on OS/2
   404  ifeq ($(OS_ARCH), OS2)
     6  ifeq ($(OS_ARCH), OS2)
   405  nsPrefService.$(OBJ_SUFFIX): nsPrefService.cpp
     7  nsPrefService.$(OBJ_SUFFIX): nsPrefService.cpp
   406  	$(REPORT_BUILD)
     8  	$(REPORT_BUILD)
   407  	@$(MAKE_DEPS_AUTO_CXX)
     9  	@$(MAKE_DEPS_AUTO_CXX)
   408  	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
    10  	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
   409  endif
    11  endif
   410 +
    12  
   411 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
    13 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
       
    14 +
       
    15  
       
    16  greprefs.js: $(GREPREF_FILES)
       
    17  	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $^ > $@
       
    18  
       
    19  libs:: greprefs.js
       
    20  	$(INSTALL) $^ $(DIST)/bin/
   412 diff --git a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp
    21 diff --git a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp
   413 --- a/modules/libpref/src/nsPrefService.cpp
    22 --- a/modules/libpref/src/nsPrefService.cpp
   414 +++ b/modules/libpref/src/nsPrefService.cpp
    23 +++ b/modules/libpref/src/nsPrefService.cpp
   415 @@ -47,16 +47,17 @@
    24 @@ -51,16 +51,17 @@
   416  #include "nsILocalFile.h"
    25  #include "nsILocalFile.h"
   417  #include "nsIObserverService.h"
    26  #include "nsIObserverService.h"
   418  #include "nsPrefBranch.h"
    27  #include "nsPrefBranch.h"
   419  #include "nsXPIDLString.h"
    28  #include "nsXPIDLString.h"
   420  #include "nsCRT.h"
    29  #include "nsCRT.h"
   428  #include "pldhash.h"
    37  #include "pldhash.h"
   429  
    38  
   430  #include "prefapi.h"
    39  #include "prefapi.h"
   431  #include "prefread.h"
    40  #include "prefread.h"
   432  #include "prefapi_private_data.h"
    41  #include "prefapi_private_data.h"
   433 @@ -610,17 +611,18 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
    42 @@ -718,28 +719,40 @@ static nsresult pref_InitDefaults()
   434          rv = rv2;
    43    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
   435        }
    44    static const char* specialFiles[] = {
   436      }
    45  #if defined(XP_MAC) || defined(XP_MACOSX)
   437    }
    46        "macprefs.js"
   438  
    47  #elif defined(XP_WIN)
   439    return rv;
    48        "winpref.js"
   440  }
    49  #elif defined(XP_UNIX)
   441  
    50        "unix.js"
   442 -static nsresult pref_LoadPrefsInDirList(const char *listId)
    51 +      , "" // placeholder for KDE  (empty is otherwise harmless)
   443 +static nsresult pref_LoadPrefsInDirList(const char *listId,
       
   444 +    char const *const *aSpecialFiles = NULL, PRUint32 aSpecialFilesCount = 0)
       
   445  {
       
   446    nsresult rv;
       
   447    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
       
   448    if (NS_FAILED(rv)) return rv;
       
   449  
       
   450    nsCOMPtr<nsISimpleEnumerator> dirList;
       
   451    dirSvc->Get(listId,
       
   452                NS_GET_IID(nsISimpleEnumerator),
       
   453 @@ -629,17 +631,17 @@ static nsresult pref_LoadPrefsInDirList(
       
   454      PRBool hasMore;
       
   455      while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) {
       
   456        nsCOMPtr<nsISupports> elem;
       
   457        dirList->GetNext(getter_AddRefs(elem));
       
   458        if (elem) {
       
   459          nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
       
   460          if (dir) {
       
   461            // Do we care if a file provided by this process fails to load?
       
   462 -          pref_LoadPrefsInDir(dir, nsnull, 0); 
       
   463 +          pref_LoadPrefsInDir(dir, aSpecialFiles, aSpecialFilesCount); 
       
   464          }
       
   465        }
       
   466      }
       
   467    }
       
   468    return NS_OK;
       
   469  }
       
   470  
       
   471  //----------------------------------------------------------------------------------------
       
   472 @@ -680,29 +682,41 @@ static nsresult pref_InitInitialObjects(
       
   473  #if defined(VMS)
    52  #if defined(VMS)
   474        , "openvms.js"
    53        , "openvms.js"
   475  #elif defined(_AIX)
    54  #elif defined(_AIX)
   476        , "aix.js"
    55        , "aix.js"
   477  #endif
    56  #endif
   478  #if defined(MOZ_WIDGET_PHOTON)
       
   479  	  , "photon.js"
       
   480  #endif		 
       
   481 +      , "" // placeholder for KDE  (empty is otherwise harmless)
       
   482  #elif defined(XP_OS2)
    57  #elif defined(XP_OS2)
   483        "os2pref.js"
    58        "os2pref.js"
   484  #elif defined(XP_BEOS)
    59  #elif defined(XP_BEOS)
   485        "beos.js"
    60        "beos.js"
   486  #endif
    61  #endif
   487    };
    62    };
   488  
    63  
   489 +  if( nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
    64 +  if(nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
   490 +      for( int i = 0;
    65 +    for( int i = 0;
   491 +           i < NS_ARRAY_LENGTH(specialFiles);
    66 +         i < NS_ARRAY_LENGTH(specialFiles);
   492 +           ++i ) {
    67 +         ++i ) {
   493 +          if( *specialFiles[ i ] == '\0' ) {
    68 +      if( *specialFiles[ i ] == '\0' ) {
   494 +              specialFiles[ i ] = "kde.js";
    69 +        specialFiles[ i ] = "kde.js";
   495 +              break;
    70 +        break;
   496 +          }
       
   497 +      }
    71 +      }
       
    72 +    }
   498 +  }
    73 +  }
   499 +      
    74 +
   500    rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
    75    rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
   501    if (NS_FAILED(rv)) {
    76    if (NS_FAILED(rv)) {
   502      NS_WARNING("Error parsing application default preferences.");
    77      NS_WARNING("Error parsing application default preferences.");
   503    }
    78    }
   504  
    79  
   505 -  rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
    80    return NS_OK;
   506 +  rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST, specialFiles, NS_ARRAY_LENGTH(specialFiles));
    81  }
   507    NS_ENSURE_SUCCESS(rv, rv);
    82  
   508  
       
   509    NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
       
   510                                  nsnull, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);
       
   511  
       
   512    nsCOMPtr<nsIObserverService> observerService = 
       
   513      do_GetService("@mozilla.org/observer-service;1", &rv);
       
   514    
       
   515 diff --git a/toolkit/components/downloads/src/Makefile.in b/toolkit/components/downloads/src/Makefile.in
    83 diff --git a/toolkit/components/downloads/src/Makefile.in b/toolkit/components/downloads/src/Makefile.in
   516 --- a/toolkit/components/downloads/src/Makefile.in
    84 --- a/toolkit/components/downloads/src/Makefile.in
   517 +++ b/toolkit/components/downloads/src/Makefile.in
    85 +++ b/toolkit/components/downloads/src/Makefile.in
   518 @@ -92,8 +92,9 @@ EXTRA_COMPONENTS = \
    86 @@ -71,8 +71,9 @@ EXTRA_COMPONENTS = \
   519    nsDownloadManagerUI.js \
    87    nsDownloadManagerUI.manifest \
   520    $(NULL)
    88    $(NULL)
   521  endif
    89  endif
   522  
    90  
   523  include $(topsrcdir)/config/rules.mk
    91  include $(topsrcdir)/config/rules.mk
   524  
    92  
   526  
    94  
   527 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
    95 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
   528 diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp
    96 diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp
   529 --- a/toolkit/components/downloads/src/nsDownloadManager.cpp
    97 --- a/toolkit/components/downloads/src/nsDownloadManager.cpp
   530 +++ b/toolkit/components/downloads/src/nsDownloadManager.cpp
    98 +++ b/toolkit/components/downloads/src/nsDownloadManager.cpp
   531 @@ -71,16 +71,20 @@
    99 @@ -76,16 +76,20 @@
   532  
   100  
   533  #if defined(XP_WIN) && !defined(WINCE)
   101  #if defined(XP_WIN) && !defined(WINCE)
   534  #include <shlobj.h>
   102  #include <shlobj.h>
   535  #ifdef DOWNLOAD_SCANNER
   103  #ifdef DOWNLOAD_SCANNER
   536  #include "nsDownloadScanner.h"
   104  #include "nsDownloadScanner.h"
   539  
   107  
   540 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
   108 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
   541 +#include "nsKDEUtils.h"
   109 +#include "nsKDEUtils.h"
   542 +#endif
   110 +#endif
   543 +
   111 +
       
   112  #ifdef XP_MACOSX
       
   113  #include <CoreFoundation/CoreFoundation.h>
       
   114  #endif
       
   115  
   544  #define DOWNLOAD_MANAGER_BUNDLE "chrome://mozapps/locale/downloads/downloads.properties"
   116  #define DOWNLOAD_MANAGER_BUNDLE "chrome://mozapps/locale/downloads/downloads.properties"
   545  #define DOWNLOAD_MANAGER_ALERT_ICON "chrome://mozapps/skin/downloads/downloadIcon.png"
   117  #define DOWNLOAD_MANAGER_ALERT_ICON "chrome://mozapps/skin/downloads/downloadIcon.png"
   546  #define PREF_BDM_SHOWALERTONCOMPLETE "browser.download.manager.showAlertOnComplete"
   118  #define PREF_BDM_SHOWALERTONCOMPLETE "browser.download.manager.showAlertOnComplete"
   547  #define PREF_BDM_SHOWALERTINTERVAL "browser.download.manager.showAlertInterval"
   119  #define PREF_BDM_SHOWALERTINTERVAL "browser.download.manager.showAlertInterval"
   548  #define PREF_BDM_RETENTION "browser.download.manager.retention"
   120 @@ -2193,16 +2197,25 @@ nsDownload::SetState(DownloadState aStat
   549  #define PREF_BDM_QUITBEHAVIOR "browser.download.manager.quitBehavior"
       
   550  #define PREF_BDM_ADDTORECENTDOCS "browser.download.manager.addToRecentDocs"
       
   551  #define PREF_BDM_SCANWHENDONE "browser.download.manager.scanWhenDone"
       
   552 @@ -2158,16 +2162,25 @@ nsDownload::SetState(DownloadState aStat
       
   553        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
   121        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
   554  
   122  
   555        // Master pref to control this function.
   123        // Master pref to control this function.
   556        PRBool showTaskbarAlert = PR_TRUE;
   124        PRBool showTaskbarAlert = PR_TRUE;
   557        if (pref)
   125        if (pref)
   573  
   141  
   574          PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
   142          PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC;
   575          PRInt64 goat = PR_Now() - mStartTime;
   143          PRInt64 goat = PR_Now() - mStartTime;
   576          showTaskbarAlert = goat > alertIntervalUSec;
   144          showTaskbarAlert = goat > alertIntervalUSec;
   577  
   145  
   578 @@ -2193,16 +2206,17 @@ nsDownload::SetState(DownloadState aStat
   146 @@ -2228,16 +2241,17 @@ nsDownload::SetState(DownloadState aStat
   579                // because if it is, they'll click open the download manager and
   147                // because if it is, they'll click open the download manager and
   580                // the items they downloaded will have been removed.
   148                // the items they downloaded will have been removed.
   581                alerts->ShowAlertNotification(
   149                alerts->ShowAlertNotification(
   582                    NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title,
   150                    NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title,
   583                    message, !removeWhenDone, EmptyString(), mDownloadManager,
   151                    message, !removeWhenDone, EmptyString(), mDownloadManager,
   584                    EmptyString());
   152                    EmptyString());
   585              }
   153              }
   586          }
   154          }
   587 +        } // end non-KDE block
   155 +        } // end non-KDE block
   588        }
   156        }
   589  #if defined(XP_WIN) && !defined(WINCE)
   157  
   590        nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
   158        nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
   591        nsCOMPtr<nsIFile> file;
   159        if (fileURL) {
   592        nsAutoString path;
   160          nsCOMPtr<nsIFile> file;
   593  
   161          if (NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) && file ) {
   594        if (fileURL &&
   162  
   595            NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
   163  #if (defined(XP_WIN) && !defined(WINCE)) || defined(XP_MACOSX)
   596 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   164 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   597 --- a/toolkit/content/jar.mn
   165 --- a/toolkit/content/jar.mn
   598 +++ b/toolkit/content/jar.mn
   166 +++ b/toolkit/content/jar.mn
   599 @@ -44,29 +44,33 @@ toolkit.jar:
   167 @@ -40,29 +40,33 @@ toolkit.jar:
   600  *+ content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
   168  *+ content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
   601  *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
   169  *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
   602  *+ content/global/bindings/browser.xml         (widgets/browser.xml)
   170  *+ content/global/bindings/browser.xml         (widgets/browser.xml)
   603  *+ content/global/bindings/button.xml          (widgets/button.xml)
   171  *+ content/global/bindings/button.xml          (widgets/button.xml)
   604  *+ content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   172  *+ content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   632  *+ content/global/bindings/splitter.xml        (widgets/splitter.xml)
   200  *+ content/global/bindings/splitter.xml        (widgets/splitter.xml)
   633 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
   201 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
   634 new file mode 100644
   202 new file mode 100644
   635 --- /dev/null
   203 --- /dev/null
   636 +++ b/toolkit/content/widgets/dialog-kde.xml
   204 +++ b/toolkit/content/widgets/dialog-kde.xml
   637 @@ -0,0 +1,445 @@
   205 @@ -0,0 +1,447 @@
   638 +<?xml version="1.0"?>
   206 +<?xml version="1.0"?>
   639 +
   207 +
   640 +<bindings id="dialogBindings"
   208 +<bindings id="dialogBindings"
   641 +          xmlns="http://www.mozilla.org/xbl"
   209 +          xmlns="http://www.mozilla.org/xbl"
   642 +          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   210 +          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   662 +        <xul:spacer anonid="spacer" flex="1"/>
   230 +        <xul:spacer anonid="spacer" flex="1"/>
   663 +        <xul:button dlgtype="cancel" class="dialog-button"/>
   231 +        <xul:button dlgtype="cancel" class="dialog-button"/>
   664 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
   232 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
   665 +#elif XP_UNIX
   233 +#elif XP_UNIX
   666 +                pack="end">
   234 +                pack="end">
   667 +        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
   235 +	<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
   668 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
   236 +	<xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
   669 +        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
   237 +	<xul:spacer anonid="spacer" flex="1" hidden="true"/>
   670 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
   238 +	<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
   671 +        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
   239 +	<xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
   672 +        <xul:button dlgtype="cancel" class="dialog-button"/>
   240 +	<xul:button dlgtype="cancel" class="dialog-button"/>
   673 +        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
   241 +	<xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
   674 +#else
   242 +#else
   675 +                pack="end">
   243 +                pack="end">
   676 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
   244 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
   677 +        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
   245 +        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
   678 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
   246 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
   806 +            // give focus to the first focusable element in the dialog
   374 +            // give focus to the first focusable element in the dialog
   807 +            if (!document.commandDispatcher.focusedElement) {
   375 +            if (!document.commandDispatcher.focusedElement) {
   808 +              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
   376 +              document.commandDispatcher.advanceFocusIntoSubtree(dialog);
   809 +
   377 +
   810 +              var focusedElt = document.commandDispatcher.focusedElement;
   378 +              var focusedElt = document.commandDispatcher.focusedElement;
   811 +              var initialFocusedElt = focusedElt;
   379 +              if (focusedElt) {
   812 +              while (focusedElt.localName == "tab" ||
   380 +                var initialFocusedElt = focusedElt;
   813 +                     focusedElt.getAttribute("noinitialfocus") == "true") {
   381 +                while (focusedElt.localName == "tab" ||
   814 +                document.commandDispatcher.advanceFocusIntoSubtree(focusedElt);
   382 +                       focusedElt.getAttribute("noinitialfocus") == "true") {
   815 +                focusedElt = document.commandDispatcher.focusedElement;
   383 +                  document.commandDispatcher.advanceFocusIntoSubtree(focusedElt);
   816 +                if (focusedElt == initialFocusedElt)
   384 +                  focusedElt = document.commandDispatcher.focusedElement;
   817 +                  break;
   385 +                  if (focusedElt == initialFocusedElt)
       
   386 +                    break;
       
   387 +                }
       
   388 +
       
   389 +                if (initialFocusedElt.localName == "tab") {
       
   390 +                  if (focusedElt.hasAttribute("dlgtype")) {
       
   391 +                    // We don't want to focus on anonymous OK, Cancel, etc. buttons,
       
   392 +                    // so return focus to the tab itself
       
   393 +                    initialFocusedElt.focus();
       
   394 +                  }
       
   395 +                }
       
   396 +#ifndef XP_MACOSX
       
   397 +                else if (focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
       
   398 +                  defaultButton.focus();
       
   399 +                }
       
   400 +#endif
   818 +              }
   401 +              }
   819 +
       
   820 +              if (initialFocusedElt.localName == "tab") {
       
   821 +                if (focusedElt.hasAttribute("dlgtype")) {
       
   822 +                  // We don't want to focus on anonymous OK, Cancel, etc. buttons,
       
   823 +                  // so return focus to the tab itself
       
   824 +                  initialFocusedElt.focus();
       
   825 +                }
       
   826 +              }
       
   827 +#ifndef XP_MACOSX
       
   828 +              else if (focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
       
   829 +                defaultButton.focus();
       
   830 +              }
       
   831 +#endif
       
   832 +            }
   402 +            }
   833 +
   403 +
   834 +            try {
   404 +            try {
   835 +              if (defaultButton)
   405 +              if (defaultButton)
   836 +                window.notifyDefaultButtonLoaded(defaultButton);
   406 +                window.notifyDefaultButtonLoaded(defaultButton);
  1669 +        <xul:spacer anonid="spacer" flex="1"/>
  1239 +        <xul:spacer anonid="spacer" flex="1"/>
  1670 +        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
  1240 +        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
  1671 +        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
  1241 +        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
  1672 +#elif XP_UNIX
  1242 +#elif XP_UNIX
  1673 +                pack="end">
  1243 +                pack="end">
  1674 +        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
  1244 +	<xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
  1675 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
  1245 +	<xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
  1676 +        <xul:spacer anonid="spacer" flex="1"/>
  1246 +	<xul:spacer anonid="spacer" flex="1"/>
  1677 +        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
  1247 +	<xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
  1678 +        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
  1248 +	<xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
  1679 +        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
  1249 +	<xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
  1680 +        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
  1250 +	<xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
  1681 +#else
  1251 +#else
  1682 +                pack="end">
  1252 +                pack="end">
  1683 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
  1253 +        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
  1684 +        <xul:spacer anonid="spacer" flex="1"/>
  1254 +        <xul:spacer anonid="spacer" flex="1"/>
  1685 +        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
  1255 +        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
  2454 +#    PrefWindow IV  (April 24, 2000)
  2024 +#    PrefWindow IV  (April 24, 2000)
  2455 +#    PrefWindow III (January 6, 2000)
  2025 +#    PrefWindow III (January 6, 2000)
  2456 +#    PrefWindow II  (???)
  2026 +#    PrefWindow II  (???)
  2457 +#    PrefWindow I   (June 4, 1999)
  2027 +#    PrefWindow I   (June 4, 1999)
  2458 +#
  2028 +#
  2459 diff --git a/toolkit/system/unixproxy/Makefile.in b/toolkit/system/unixproxy/Makefile.in
       
  2460 --- a/toolkit/system/unixproxy/Makefile.in
       
  2461 +++ b/toolkit/system/unixproxy/Makefile.in
       
  2462 @@ -54,16 +54,18 @@ LIBXUL_LIBRARY  = 1
       
  2463  
       
  2464  REQUIRES = \
       
  2465          xpcom \
       
  2466          string \
       
  2467          necko \
       
  2468          mozgnome \
       
  2469          $(NULL)
       
  2470  
       
  2471 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
       
  2472 +
       
  2473  EXTRA_DSO_LDOPTS += \
       
  2474                 $(MOZ_LIBPROXY_LIBS) \
       
  2475                 $(MOZ_COMPONENT_LIBS) \
       
  2476                 $(NULL)
       
  2477  
       
  2478  ifdef MOZ_ENABLE_LIBPROXY
       
  2479  
       
  2480  CPPSRCS = \
       
  2481 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2029 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2482 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2030 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2483 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2031 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
  2484 @@ -44,32 +44,35 @@
  2032 @@ -44,32 +44,35 @@
  2485  #include "nsIURI.h"
  2033  #include "nsIURI.h"
  2535    return GetProxyFromGConf(scheme, host, port, aResult);
  2083    return GetProxyFromGConf(scheme, host, port, aResult);
  2536  }
  2084  }
  2537  
  2085  
  2538  #define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
  2086  #define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
  2539       { 0x0fa3158c, 0xd5a7, 0x43de, \
  2087       { 0x0fa3158c, 0xd5a7, 0x43de, \
  2540 @@ -427,8 +433,33 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUn
       
  2541  static const nsModuleComponentInfo components[] = {
       
  2542    { "Unix System Proxy Settings Service",
       
  2543      NS_UNIXSYSTEMPROXYSERVICE_CID,
       
  2544      NS_SYSTEMPROXYSETTINGS_CONTRACTID,
       
  2545      nsUnixSystemProxySettingsConstructor }
       
  2546  };
       
  2547  
       
  2548  NS_IMPL_NSGETMODULE(nsUnixProxyModule, components)
       
  2549 +
       
  2550 +nsresult
       
  2551 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
       
  2552 +                                             const nsACString& aHost,
       
  2553 +                                             PRInt32 aPort,
       
  2554 +                                             nsACString& aResult)
       
  2555 +{
       
  2556 +  nsCAutoString url;
       
  2557 +  url = aScheme;
       
  2558 +  url += "://";
       
  2559 +  url += aHost;
       
  2560 +  if( aPort >= 0 )
       
  2561 +      {
       
  2562 +      url += ":";
       
  2563 +      url += nsPrintfCString("%d", aPort);
       
  2564 +      }
       
  2565 +  nsCStringArray command;
       
  2566 +  command.AppendCString( NS_LITERAL_CSTRING( "GETPROXY" ));
       
  2567 +  command.AppendCString( url );
       
  2568 +  nsCStringArray result;
       
  2569 +  if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 )
       
  2570 +      return NS_ERROR_FAILURE;
       
  2571 +  aResult = *result[ 0 ];
       
  2572 +  return NS_OK;
       
  2573 +}
       
  2574 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in
  2088 diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in
  2575 --- a/toolkit/xre/Makefile.in
  2089 --- a/toolkit/xre/Makefile.in
  2576 +++ b/toolkit/xre/Makefile.in
  2090 +++ b/toolkit/xre/Makefile.in
  2577 @@ -42,16 +42,18 @@ srcdir		= @srcdir@
  2091 @@ -95,17 +95,18 @@ CMMSRCS = nsNativeAppSupportCocoa.mm
  2578  VPATH		= @srcdir@
       
  2579  
       
  2580  include $(DEPTH)/config/autoconf.mk
       
  2581  
       
  2582  MODULE = xulapp
       
  2583  LIBRARY_NAME = xulapp_s
       
  2584  LIBXUL_LIBRARY = 1
       
  2585  
       
  2586 +EXPORTS = nsKDEUtils.h
       
  2587 +
       
  2588  REQUIRES = \
       
  2589  	appcomps \
       
  2590  	toolkitcomps \
       
  2591  	appshell \
       
  2592  	chrome \
       
  2593  	content \
       
  2594  	docshell \
       
  2595  	dom \
       
  2596 @@ -133,17 +135,17 @@ CMMSRCS = nsNativeAppSupportCocoa.mm
       
  2597  else
  2092  else
  2598  ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
  2093  ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
  2599  CPPSRCS += nsNativeAppSupportOS2.cpp
  2094  CPPSRCS += nsNativeAppSupportOS2.cpp
  2600  else
  2095  else
  2601  ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
  2096  ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
  2602  CPPSRCS += nsNativeAppSupportBeOS.cpp
  2097  CPPSRCS += nsNativeAppSupportBeOS.cpp
  2603  else
  2098  else
  2604  ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
  2099  ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
  2605 -CPPSRCS += nsNativeAppSupportUnix.cpp
  2100 -CPPSRCS += nsNativeAppSupportUnix.cpp
  2606 +CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp
  2101 +CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp
       
  2102 +EXPORTS += nsKDEUtils.h
  2607  else
  2103  else
  2608  CPPSRCS += nsNativeAppSupportDefault.cpp
  2104  ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
  2609  endif
  2105  CPPSRCS += nsNativeAppSupportQt.cpp
  2610  endif
  2106  CPPSRCS += nsQAppInstance.cpp
  2611  endif
  2107  EXPORTS += nsQAppInstance.h
  2612  endif
  2108  ifdef MOZ_ENABLE_MEEGOTOUCH
  2613  endif
  2109  MOCSRCS += moc_MozMeegoAppService.cpp
  2614  
  2110  CPPSRCS += moc_MozMeegoAppService.cpp
  2615 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
  2111 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
  2616 new file mode 100644
  2112 new file mode 100644
  2617 --- /dev/null
  2113 --- /dev/null
  2618 +++ b/toolkit/xre/nsKDEUtils.cpp
  2114 +++ b/toolkit/xre/nsKDEUtils.cpp
  2619 @@ -0,0 +1,334 @@
  2115 @@ -0,0 +1,334 @@
  3034 +
  2530 +
  3035 +#endif // nsKDEUtils
  2531 +#endif // nsKDEUtils
  3036 diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in
  2532 diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in
  3037 --- a/uriloader/exthandler/Makefile.in
  2533 --- a/uriloader/exthandler/Makefile.in
  3038 +++ b/uriloader/exthandler/Makefile.in
  2534 +++ b/uriloader/exthandler/Makefile.in
  3039 @@ -102,18 +102,19 @@ CMMSRCS	= nsOSHelperAppService.mm \
  2535 @@ -85,18 +85,19 @@ CMMSRCS	= nsOSHelperAppService.mm \
  3040  			$(NULL)
  2536  			$(NULL)
  3041  else
  2537  else
  3042  OSHELPER	= nsOSHelperAppService.cpp
  2538  OSHELPER	= nsOSHelperAppService.cpp
  3043  endif
  2539  endif
  3044  
  2540  
  3049 +OSHELPER	+= nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp
  2545 +OSHELPER	+= nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp
  3050  OSHELPER  += nsMIMEInfoUnix.cpp
  2546  OSHELPER  += nsMIMEInfoUnix.cpp
  3051 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
  2547 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
  3052  endif
  2548  endif
  3053  
  2549  
       
  2550  ifeq ($(MOZ_WIDGET_TOOLKIT),android)
       
  2551  OSHELPER += nsMIMEInfoAndroid.cpp
       
  2552  OSHELPER += nsAndroidHandlerApp.cpp
       
  2553  endif
       
  2554  
  3054  ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
  2555  ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
  3055  OSHELPER += nsGNOMERegistry.cpp
       
  3056  OSHELPER += nsMIMEInfoUnix.cpp
       
  3057  endif
       
  3058  
       
  3059  ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
       
  3060 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  2556 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  3061 new file mode 100644
  2557 new file mode 100644
  3062 --- /dev/null
  2558 --- /dev/null
  3063 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  2559 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
  3064 @@ -0,0 +1,87 @@
  2560 @@ -0,0 +1,87 @@
  3401 +
  2897 +
  3402 +};
  2898 +};
  3403 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2899 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  3404 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2900 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  3405 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  2901 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  3406 @@ -40,27 +40,30 @@
  2902 @@ -48,28 +48,31 @@
  3407  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
  2903  #include <QDesktopServices>
  3408  #include <glib.h>
  2904  #include <QUrl>
  3409  #include <hildon-uri.h>
  2905  #include <QString>
  3410  #include <hildon-mime.h>
  2906  #include <contentaction/contentaction.h>
  3411  #include <libosso.h>
  2907  #include "nsContentHandlerApp.h"
  3412  #endif
  2908  #endif
  3413  
  2909  
  3414  #include "nsMIMEInfoUnix.h"
  2910  #include "nsMIMEInfoUnix.h"
  3415 -#include "nsGNOMERegistry.h"
  2911 -#include "nsGNOMERegistry.h"
  3416 +#include "nsCommonRegistry.h"
  2912 +#include "nsCommonRegistry.h"
       
  2913  #include "nsIGIOService.h"
  3417  #include "nsIGnomeVFSService.h"
  2914  #include "nsIGnomeVFSService.h"
  3418  #include "nsAutoPtr.h"
  2915  #include "nsAutoPtr.h"
  3419  #ifdef MOZ_ENABLE_DBUS
  2916  #ifdef MOZ_ENABLE_DBUS
  3420  #include "nsDBusHandlerApp.h"
  2917  #include "nsDBusHandlerApp.h"
  3421  #endif
  2918  #endif
  3426  nsresult
  2923  nsresult
  3427  nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
  2924  nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
  3428  {
  2925  {
  3429 -  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
  2926 -  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
  3430 +  nsresult rv = nsCommonRegistry::LoadURL(aURI);
  2927 +  nsresult rv = nsCommonRegistry::LoadURL(aURI);
       
  2928  
  3431  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
  2929  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
  3432    if (NS_FAILED(rv)){
  2930    if (NS_FAILED(rv)){
  3433      HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
  2931      HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nsnull);
  3434      if (action) {
  2932      if (action) {
  3435        nsCAutoString spec;
  2933        nsCAutoString spec;
  3436        aURI->GetAsciiSpec(spec);
  2934        aURI->GetAsciiSpec(spec);
  3437        if (hildon_uri_open(spec.get(), action, nsnull))
  2935        if (hildon_uri_open(spec.get(), action, nsnull))
  3438          rv = NS_OK;
  2936 @@ -91,22 +94,22 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI *
  3439 @@ -70,21 +73,21 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI *
  2937  
  3440  #endif
       
  3441    return rv;
  2938    return rv;
  3442  }
  2939  }
  3443  
  2940  
  3444  NS_IMETHODIMP
  2941  NS_IMETHODIMP
  3445  nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
  2942  nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
  3446  {
  2943  {
  3447    *_retval = PR_FALSE;
  2944    *_retval = PR_FALSE;
  3448 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mType);
  2945 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType);
  3449 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mType);
  2946 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType);
  3450    if (!mimeInfo) {
  2947    if (!mimeInfo) {
  3451      nsCAutoString ext;
  2948      nsCAutoString ext;
  3452      GetPrimaryExtension(ext);
  2949      nsresult rv = GetPrimaryExtension(ext);
  3453 -    mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  2950      if (NS_SUCCEEDED(rv)) {
  3454 +    mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  2951 -      mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
       
  2952 +      mimeInfo = nsCommonRegistry::GetFromExtension(ext);
       
  2953      }
  3455    }
  2954    }
  3456  
       
  3457    if (mimeInfo)
  2955    if (mimeInfo)
  3458      *_retval = PR_TRUE;
  2956      *_retval = PR_TRUE;
  3459  
  2957  
  3460    if (*_retval)
  2958    if (*_retval)
  3461      return NS_OK;
  2959      return NS_OK;
  3462  
  2960  
  3463 @@ -107,25 +110,42 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
  2961 @@ -149,32 +152,49 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
  3464    nsCAutoString nativePath;
  2962      ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get()));
  3465    aFile->GetNativePath(nativePath);
  2963    if (action.isValid()) {
  3466  
  2964      action.trigger();
  3467  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
       
  3468    if(NS_SUCCEEDED(LaunchDefaultWithDBus(PromiseFlatCString(nativePath).get())))
       
  3469      return NS_OK;
  2965      return NS_OK;
       
  2966    }
       
  2967    return NS_ERROR_FAILURE;
  3470  #endif
  2968  #endif
  3471  
  2969  
  3472 +  if( nsKDEUtils::kdeSupport()) {
  2970 +  if( nsKDEUtils::kdeSupport()) {
  3473 +    PRBool supports;
  2971 +    PRBool supports;
  3474 +    if( NS_SUCCEEDED( GetHasDefaultHandler( &supports )) && supports ) {
  2972 +    if( NS_SUCCEEDED( GetHasDefaultHandler( &supports )) && supports ) {
  3475 +      nsCStringArray command;
  2973 +      nsCStringArray command;
  3476 +      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
  2974 +      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
  3477 +      command.AppendCString( nativePath );
  2975 +      command.AppendCString( nativePath );
  3478 +      command.AppendCString( NS_LITERAL_CSTRING( "MIMETYPE" ));
  2976 +      command.AppendCString( NS_LITERAL_CSTRING( "MIMETYPE" ));
  3479 +      command.AppendCString( mType );
  2977 +      command.AppendCString( mSchemeOrType );
  3480 +      if( nsKDEUtils::command( command ))
  2978 +      if( nsKDEUtils::command( command ))
  3481 +        return NS_OK;
  2979 +        return NS_OK;
  3482 +    }
  2980 +    }
  3483 +    if (!mDefaultApplication)
  2981 +    if (!mDefaultApplication)
  3484 +      return NS_ERROR_FILE_NOT_FOUND;
  2982 +      return NS_ERROR_FILE_NOT_FOUND;
  3485 +
  2983 +
  3486 +    return LaunchWithIProcess(mDefaultApplication, nativePath);
  2984 +    return LaunchWithIProcess(mDefaultApplication, nativePath);
  3487 +  }
  2985 +  }
  3488 +
  2986 +
  3489    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  2987    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  3490    if (vfs) {
  2988    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
       
  2989    if (giovfs) {
       
  2990      nsCOMPtr<nsIGIOMimeApp> app;
       
  2991      if (NS_SUCCEEDED(giovfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app)
       
  2992        return app->Launch(nativePath);
       
  2993    } else if (gnomevfs) {
       
  2994      /* Fallback to GnomeVFS */
  3491      nsCOMPtr<nsIGnomeVFSMimeApp> app;
  2995      nsCOMPtr<nsIGnomeVFSMimeApp> app;
  3492      if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
  2996      if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app)
  3493        return app->Launch(nativePath);
  2997        return app->Launch(nativePath);
  3494  
  2998    }
  3495      // If we haven't got an app we try to get a valid one by searching for the
  2999  
  3496      // extension mapped type
  3000    // If we haven't got an app we try to get a valid one by searching for the
  3497 -    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
  3001    // extension mapped type
  3498 +    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
  3002 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
  3499      if (mimeInfo) {
  3003 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
  3500        nsCAutoString type;
  3004    if (mimeInfo) {
  3501        mimeInfo->GetType(type);
  3005      nsCAutoString type;
  3502        if (NS_SUCCEEDED(vfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
  3006      mimeInfo->GetType(type);
       
  3007      if (giovfs) {
       
  3008        nsCOMPtr<nsIGIOMimeApp> app;
       
  3009        if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
  3503          return app->Launch(nativePath);
  3010          return app->Launch(nativePath);
  3504      }
  3011      } else if (gnomevfs) {
  3505    }
       
  3506  
       
  3507 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  3012 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  3508 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  3013 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  3509 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  3014 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  3510 @@ -39,17 +39,17 @@
  3015 @@ -44,17 +44,17 @@
  3511   * ***** END LICENSE BLOCK ***** */
  3016  #if (MOZ_PLATFORM_MAEMO == 6)
  3512  
  3017  #include <contentaction/contentaction.h>
  3513  #include <sys/types.h>
  3018  #include <QString>
  3514  #include <sys/stat.h>
  3019  #endif
  3515  
  3020  
  3516  #include "nsOSHelperAppService.h"
  3021  #include "nsOSHelperAppService.h"
  3517  #include "nsMIMEInfoUnix.h"
  3022  #include "nsMIMEInfoUnix.h"
  3518  #ifdef MOZ_WIDGET_GTK2
  3023  #ifdef MOZ_WIDGET_GTK2
  3519 -#include "nsGNOMERegistry.h"
  3024 -#include "nsGNOMERegistry.h"
  3524  #include "nsReadableUtils.h"
  3029  #include "nsReadableUtils.h"
  3525  #include "nsUnicharUtils.h"
  3030  #include "nsUnicharUtils.h"
  3526  #include "nsXPIDLString.h"
  3031  #include "nsXPIDLString.h"
  3527  #include "nsIURL.h"
  3032  #include "nsIURL.h"
  3528  #include "nsIFileStreams.h"
  3033  #include "nsIFileStreams.h"
  3529 @@ -1205,29 +1205,29 @@ nsOSHelperAppService::GetHandlerAndDescr
  3034 @@ -1219,29 +1219,29 @@ nsresult nsOSHelperAppService::OSProtoco
  3530  nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists)
  3035      ContentAction::Action::defaultActionForScheme(QString(aProtocolScheme) + ':');
  3531  {
  3036  
  3532    LOG(("-- nsOSHelperAppService::OSProtocolHandlerExists for '%s'\n",
  3037    if (action.isValid())
  3533         aProtocolScheme));
  3038      *aHandlerExists = PR_TRUE;
  3534    *aHandlerExists = PR_FALSE;
  3039  #endif
  3535  
  3040  
  3536  #ifdef MOZ_WIDGET_GTK2
  3041  #ifdef MOZ_WIDGET_GTK2
  3537    // Check the GConf registry for a protocol handler
  3042    // Check the GConf registry for a protocol handler
  3538 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
  3043 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
  3539 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
  3044 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
  3540  #ifdef MOZ_PLATFORM_MAEMO
  3045  #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
  3541    *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme);
  3046    *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme);
  3542  #endif
  3047  #endif
  3543  #endif
  3048  #endif
  3544  
  3049  
  3545    return NS_OK;
  3050    return NS_OK;
  3556  #endif
  3061  #endif
  3557  }
  3062  }
  3558  
  3063  
  3559  nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * platformAppPath, nsIFile ** aFile)
  3064  nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * platformAppPath, nsIFile ** aFile)
  3560  {
  3065  {
  3561 @@ -1313,17 +1313,17 @@ nsOSHelperAppService::GetFromExtension(c
  3066 @@ -1327,17 +1327,17 @@ nsOSHelperAppService::GetFromExtension(c
  3562                                           minorType,
  3067                                           minorType,
  3563                                           mime_types_description,
  3068                                           mime_types_description,
  3564                                           PR_TRUE);
  3069                                           PR_TRUE);
  3565  
  3070  
  3566    if (NS_FAILED(rv) || majorType.IsEmpty()) {
  3071    if (NS_FAILED(rv) || majorType.IsEmpty()) {
  3575      }
  3080      }
  3576  #endif
  3081  #endif
  3577  
  3082  
  3578      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt),
  3083      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt),
  3579                                    majorType,
  3084                                    majorType,
  3580 @@ -1439,17 +1439,17 @@ nsOSHelperAppService::GetFromType(const 
  3085 @@ -1453,17 +1453,17 @@ nsOSHelperAppService::GetFromType(const 
  3581  #ifdef MOZ_WIDGET_GTK2
  3086  #ifdef MOZ_WIDGET_GTK2
  3582    nsMIMEInfoBase *gnomeInfo = nsnull;
  3087    nsMIMEInfoBase *gnomeInfo = nsnull;
  3583    if (handler.IsEmpty()) {
  3088    if (handler.IsEmpty()) {
  3584      // No useful data yet.  Check the GNOME registry.  Unfortunately, newer
  3089      // No useful data yet.  Check the GNOME registry.  Unfortunately, newer
  3585      // GNOME versions no longer have type-to-extension mappings, so we might
  3090      // GNOME versions no longer have type-to-extension mappings, so we might
  3597  
  3102  
  3598    // Now look up our extensions
  3103    // Now look up our extensions
  3599 diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in
  3104 diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in
  3600 --- a/widget/src/gtk2/Makefile.in
  3105 --- a/widget/src/gtk2/Makefile.in
  3601 +++ b/widget/src/gtk2/Makefile.in
  3106 +++ b/widget/src/gtk2/Makefile.in
  3602 @@ -185,8 +185,11 @@ EXTRA_DSO_LDOPTS += -lgfxpsshar
  3107 @@ -156,8 +156,11 @@ endif
  3603  endif
  3108  
  3604  
  3109  DEFINES		+= -DCAIRO_GFX
  3605  
  3110  
  3606  DEFINES		+=
       
  3607  INCLUDES	+= \
  3111  INCLUDES	+= \
  3608  		-I$(srcdir)/../xpwidgets \
  3112  		-I$(srcdir)/../xpwidgets \
       
  3113  		-I$(srcdir)/../shared \
  3609  		-I$(topsrcdir)/other-licenses/atk-1.0 \
  3114  		-I$(topsrcdir)/other-licenses/atk-1.0 \
  3610  		$(NULL)
  3115  		$(NULL)
  3611 +
  3116 +
  3612 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
  3117 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
  3613 +
  3118 +
  3945 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
  3450 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
  3946 +  nsCString kdeMakeFilter( int index );
  3451 +  nsCString kdeMakeFilter( int index );
  3947  };
  3452  };
  3948  
  3453  
  3949  #endif
  3454  #endif
       
  3455 diff --git a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in
       
  3456 --- a/xpcom/components/Makefile.in
       
  3457 +++ b/xpcom/components/Makefile.in
       
  3458 @@ -98,10 +98,11 @@ FORCE_STATIC_LIB = 1
       
  3459  
       
  3460  # Force use of PIC
       
  3461  FORCE_USE_PIC	= 1
       
  3462  include $(topsrcdir)/config/rules.mk
       
  3463  
       
  3464  DEFINES	+= -D_IMPL_NS_COM
       
  3465  
       
  3466  ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
       
  3467 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
       
  3468  CXXFLAGS += $(MOZ_GTK2_CFLAGS)
       
  3469  endif
       
  3470 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
       
  3471 --- a/xpcom/components/ManifestParser.cpp
       
  3472 +++ b/xpcom/components/ManifestParser.cpp
       
  3473 @@ -55,16 +55,17 @@
       
  3474  #include "nsTextFormatter.h"
       
  3475  #include "nsVersionComparator.h"
       
  3476  #include "nsXPCOMCIDInternal.h"
       
  3477  
       
  3478  #include "nsIConsoleService.h"
       
  3479  #include "nsIScriptError.h"
       
  3480  #include "nsIXULAppInfo.h"
       
  3481  #include "nsIXULRuntime.h"
       
  3482 +#include "nsKDEUtils.h"
       
  3483  
       
  3484  struct ManifestDirective
       
  3485  {
       
  3486    const char* directive;
       
  3487    int argc;
       
  3488  
       
  3489    // Some directives should only be delivered for NS_COMPONENT_LOCATION
       
  3490    // manifests.
       
  3491 @@ -422,16 +423,17 @@ ParseManifestCommon(NSLocationType aType
       
  3492  
       
  3493    NS_NAMED_LITERAL_STRING(kPlatform, "platform");
       
  3494    NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible");
       
  3495    NS_NAMED_LITERAL_STRING(kApplication, "application");
       
  3496    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
       
  3497    NS_NAMED_LITERAL_STRING(kOs, "os");
       
  3498    NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
       
  3499    NS_NAMED_LITERAL_STRING(kABI, "abi");
       
  3500 +  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
       
  3501  
       
  3502    // Obsolete
       
  3503    NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers");
       
  3504  
       
  3505    nsAutoString appID;
       
  3506    nsAutoString appVersion;
       
  3507    nsAutoString osTarget;
       
  3508    nsAutoString abi;
       
  3509 @@ -461,35 +463,39 @@ ParseManifestCommon(NSLocationType aType
       
  3510          CopyUTF8toUTF16(s, abi);
       
  3511          abi.Insert(PRUnichar('_'), 0);
       
  3512          abi.Insert(osTarget, 0);
       
  3513        }
       
  3514      }
       
  3515    }
       
  3516  
       
  3517    nsAutoString osVersion;
       
  3518 +  nsAutoString desktop;
       
  3519  #if defined(XP_WIN)
       
  3520    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
       
  3521    if (GetVersionEx(&info)) {
       
  3522      nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
       
  3523                                           info.dwMajorVersion,
       
  3524                                           info.dwMinorVersion);
       
  3525    }
       
  3526 +  desktop = NS_LITERAL_STRING("win");
       
  3527  #elif defined(XP_MACOSX)
       
  3528    SInt32 majorVersion, minorVersion;
       
  3529    if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
       
  3530        (Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
       
  3531      nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
       
  3532                                           majorVersion,
       
  3533                                           minorVersion);
       
  3534    }
       
  3535 +  desktop = NS_LITERAL_STRING("macosx");
       
  3536  #elif defined(MOZ_WIDGET_GTK2)
       
  3537    nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
       
  3538                                         gtk_major_version,
       
  3539                                         gtk_minor_version);
       
  3540 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
       
  3541  #endif
       
  3542  
       
  3543    // Because contracts must be registered after CIDs, we save and process them
       
  3544    // at the end.
       
  3545    nsTArray<CachedDirective> contracts;
       
  3546  
       
  3547    char *token;
       
  3548    char *newline = buf;
       
  3549 @@ -558,24 +564,26 @@ ParseManifestCommon(NSLocationType aType
       
  3550      bool ok = true;
       
  3551      TriState stAppVersion = eUnspecified;
       
  3552      TriState stApp = eUnspecified;
       
  3553      TriState stOsVersion = eUnspecified;
       
  3554      TriState stOs = eUnspecified;
       
  3555      TriState stABI = eUnspecified;
       
  3556      bool platform = false;
       
  3557      bool contentAccessible = false;
       
  3558 +    TriState stDesktop = eUnspecified;
       
  3559  
       
  3560      while (NULL != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) {
       
  3561        ToLowerCase(token);
       
  3562        NS_ConvertASCIItoUTF16 wtoken(token);
       
  3563  
       
  3564        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
       
  3565            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
       
  3566            CheckStringFlag(kABI, wtoken, abi, stABI) ||
       
  3567 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
       
  3568            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
       
  3569            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion))
       
  3570          continue;
       
  3571  
       
  3572        if (directive->contentflags &&
       
  3573            (CheckFlag(kPlatform, wtoken, platform) ||
       
  3574             CheckFlag(kContentAccessible, wtoken, contentAccessible)))
       
  3575          continue;
       
  3576 @@ -594,16 +602,17 @@ ParseManifestCommon(NSLocationType aType
       
  3577        ok = false;
       
  3578      }
       
  3579  
       
  3580      if (!ok ||
       
  3581          stApp == eBad ||
       
  3582          stAppVersion == eBad ||
       
  3583          stOs == eBad ||
       
  3584          stOsVersion == eBad ||
       
  3585 +        stDesktop == eBad ||
       
  3586          stABI == eBad)
       
  3587        continue;
       
  3588  
       
  3589      if (directive->regfunc) {
       
  3590  #ifdef MOZ_IPC
       
  3591        if (GeckoProcessType_Default != XRE_GetProcessType())
       
  3592          continue;
       
  3593  #endif
  3950 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in
  3594 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in
  3951 --- a/xpcom/io/Makefile.in
  3595 --- a/xpcom/io/Makefile.in
  3952 +++ b/xpcom/io/Makefile.in
  3596 +++ b/xpcom/io/Makefile.in
  3953 @@ -195,14 +195,15 @@ DEFINES		+= -D_IMPL_NS_COM
  3597 @@ -191,17 +191,17 @@ include $(topsrcdir)/config/rules.mk
       
  3598  DEFINES		+= -D_IMPL_NS_COM
  3954  
  3599  
  3955  ifeq ($(OS_ARCH),Linux)
  3600  ifeq ($(OS_ARCH),Linux)
  3956  ifneq (,$(findstring lib64,$(libdir)))
  3601  ifneq (,$(findstring lib64,$(libdir)))
  3957  DEFINES     += -DHAVE_USR_LIB64_DIR
  3602  DEFINES     += -DHAVE_USR_LIB64_DIR
  3958  endif
  3603  endif
  3959  endif
  3604  endif
  3960  
  3605  
  3961  LOCAL_INCLUDES	= -I..
  3606 -LOCAL_INCLUDES	= -I..
  3962 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
  3607 +LOCAL_INCLUDES	= -I.. -I$(topsrcdir)/toolkit/xre
  3963  
  3608  
  3964  ifeq ($(MOZ_PLATFORM_MAEMO), 5)
  3609  ifeq ($(MOZ_PLATFORM_MAEMO),5)
  3965  CFLAGS          += $(MOZ_DBUS_GLIB_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS)
  3610  CFLAGS          += $(MOZ_DBUS_CFLAGS)
  3966  CXXFLAGS        += $(MOZ_DBUS_GLIB_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS)
  3611  CXXFLAGS        += $(MOZ_DBUS_CFLAGS)
  3967  endif
  3612  endif
  3968  
  3613  
       
  3614  ifdef MOZ_PLATFORM_MAEMO
       
  3615  CFLAGS          += $(MOZ_PLATFORM_MAEMO_CFLAGS)
  3969 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  3616 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  3970 --- a/xpcom/io/nsLocalFileUnix.cpp
  3617 --- a/xpcom/io/nsLocalFileUnix.cpp
  3971 +++ b/xpcom/io/nsLocalFileUnix.cpp
  3618 +++ b/xpcom/io/nsLocalFileUnix.cpp
  3972 @@ -79,16 +79,17 @@
  3619 @@ -91,16 +91,17 @@
  3973  #include "nsXPIDLString.h"
       
  3974  #include "prproces.h"
  3620  #include "prproces.h"
  3975  #include "nsIDirectoryEnumerator.h"
  3621  #include "nsIDirectoryEnumerator.h"
  3976  #include "nsISimpleEnumerator.h"
  3622  #include "nsISimpleEnumerator.h"
  3977  #include "nsITimelineService.h"
  3623  #include "nsITimelineService.h"
  3978  
  3624  
  3979  #ifdef MOZ_WIDGET_GTK2
  3625  #ifdef MOZ_WIDGET_GTK2
       
  3626  #include "nsIGIOService.h"
  3980  #include "nsIGnomeVFSService.h"
  3627  #include "nsIGnomeVFSService.h"
  3981 +#include "nsKDEUtils.h"
  3628 +#include "nsKDEUtils.h"
  3982  #endif
  3629  #endif
  3983  
  3630  
  3984  #if (MOZ_PLATFORM_MAEMO == 5)
  3631  #ifdef XP_MACOSX
  3985  #include <glib.h>
  3632  #include <Carbon/Carbon.h>
  3986  #include <hildon-uri.h>
  3633  #include "CocoaFileUtils.h"
  3987  #include <hildon-mime.h>
  3634  #include "prmem.h"
  3988  #include <libosso.h>
  3635  #include "plbase64.h"
  3989  #endif
  3636  
  3990 @@ -1627,36 +1628,46 @@ nsLocalFile::Launch()
  3637 @@ -1818,44 +1819,50 @@ nsLocalFile::Launch()
  3991  
  3638  
  3992      return NS_OK;
  3639      return NS_OK;
  3993  }
  3640  }
  3994  #else
  3641  #else
  3995  NS_IMETHODIMP
  3642  NS_IMETHODIMP
  3996  nsLocalFile::Reveal()
  3643  nsLocalFile::Reveal()
  3997  {
  3644  {
  3998  #ifdef MOZ_WIDGET_GTK2
  3645  #ifdef MOZ_WIDGET_GTK2
  3999 -    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  3646 -    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  4000 -    if (!vfs)
  3647 -    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
       
  3648 -    if (!giovfs && !gnomevfs)
  4001 -        return NS_ERROR_FAILURE;
  3649 -        return NS_ERROR_FAILURE;
  4002 -
  3650 -
  4003 +    nsCAutoString url;
  3651 +    nsCAutoString url;
  4004      PRBool isDirectory;
  3652      PRBool isDirectory;
  4005      if (NS_FAILED(IsDirectory(&isDirectory)))
  3653      if (NS_FAILED(IsDirectory(&isDirectory)))
  4006          return NS_ERROR_FAILURE;
  3654          return NS_ERROR_FAILURE;
  4007  
  3655  
  4008      if (isDirectory) {
  3656      if (isDirectory) {
  4009 -        return vfs->ShowURIForInput(mPath);
  3657 -        if (giovfs)
       
  3658 -            return giovfs->ShowURIForInput(mPath);
       
  3659 -        else 
       
  3660 -            /* Fallback to GnomeVFS */
       
  3661 -            return gnomevfs->ShowURIForInput(mPath);
  4010 +        url = mPath;
  3662 +        url = mPath;
  4011      } else {
  3663      } else {
  4012          nsCOMPtr<nsIFile> parentDir;
  3664          nsCOMPtr<nsIFile> parentDir;
  4013          nsCAutoString dirPath;
  3665          nsCAutoString dirPath;
  4014          if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
  3666          if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
  4015              return NS_ERROR_FAILURE;
  3667              return NS_ERROR_FAILURE;
  4016          if (NS_FAILED(parentDir->GetNativePath(dirPath)))
  3668          if (NS_FAILED(parentDir->GetNativePath(dirPath)))
  4017              return NS_ERROR_FAILURE;
  3669              return NS_ERROR_FAILURE;
  4018  
  3670  
  4019 -        return vfs->ShowURIForInput(dirPath);
  3671 -        if (giovfs)
       
  3672 -            return giovfs->ShowURIForInput(dirPath);
       
  3673 -        else 
       
  3674 -            return gnomevfs->ShowURIForInput(dirPath);        
  4020 +        url = dirPath;
  3675 +        url = dirPath;
  4021      }
  3676      }
  4022 +
  3677 +
  4023 +    if( nsKDEUtils::kdeSupport()) {
  3678 +    if(nsKDEUtils::kdeSupport()) {
  4024 +        nsCStringArray command;
  3679 +      nsCStringArray command;
  4025 +        command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
  3680 +      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
  4026 +        command.AppendCString( url );
  3681 +      command.AppendCString( url );
  4027 +        return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  3682 +      return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  4028 +    }
  3683 +    }
  4029 +
  3684 +
  4030 +    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  3685 +    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  4031 +    if (!vfs)
  3686 +    nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  4032 +        return NS_ERROR_FAILURE;
  3687 +    if (!giovfs && !gnomevfs)
  4033 +    return vfs->ShowURIForInput(url);
  3688 +      return NS_ERROR_FAILURE;
  4034 +
  3689 +
  4035  #else
  3690 +    if (giovfs)
       
  3691 +      return giovfs->ShowURIForInput(url);
       
  3692 +    else
       
  3693 +      return gnomevfs->ShowURIForInput(url);
       
  3694  #elif defined(XP_MACOSX)
       
  3695      CFURLRef url;
       
  3696      if (NS_SUCCEEDED(GetCFURL(&url))) {
       
  3697        nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
       
  3698        ::CFRelease(url);
       
  3699        return rv;
       
  3700      }
  4036      return NS_ERROR_FAILURE;
  3701      return NS_ERROR_FAILURE;
  4037  #endif
  3702 @@ -1881,16 +1888,23 @@ nsLocalFile::Launch()
  4038  }
       
  4039  
       
  4040  NS_IMETHODIMP
       
  4041  nsLocalFile::Launch()
       
  4042  {
       
  4043 @@ -1674,16 +1685,23 @@ nsLocalFile::Launch()
       
  4044  
  3703  
  4045      if (nsnull == connection)
  3704      if (nsnull == connection)
  4046        return NS_ERROR_FAILURE;
  3705        return NS_ERROR_FAILURE;
  4047  
  3706  
  4048      if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS)
  3707      if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS)
  4054 +      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
  3713 +      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
  4055 +      command.AppendCString( mPath );
  3714 +      command.AppendCString( mPath );
  4056 +      return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  3715 +      return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  4057 +    }
  3716 +    }
  4058 +
  3717 +
  4059      nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  3718      nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  4060      if (!vfs)
  3719      nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
  4061          return NS_ERROR_FAILURE;
  3720      if (giovfs) {
  4062  
  3721        return giovfs->ShowURIForInput(mPath);
  4063      return vfs->ShowURIForInput(mPath);
  3722      } else if (gnomevfs) {
  4064  #endif
  3723        /* GnomeVFS fallback */
  4065  #else
  3724        return gnomevfs->ShowURIForInput(mPath);
  4066      return NS_ERROR_FAILURE;
  3725      }