mozilla-kde.patch
changeset 181 12fe57ebc7a1
parent 169 cba7c6321c84
child 191 14282ac75832
equal deleted inserted replaced
180:3b887a914979 181:12fe57ebc7a1
    37  #include "pldhash.h"
    37  #include "pldhash.h"
    38  
    38  
    39  #include "prefapi.h"
    39  #include "prefapi.h"
    40  #include "prefread.h"
    40  #include "prefread.h"
    41  #include "prefapi_private_data.h"
    41  #include "prefapi_private_data.h"
    42 @@ -837,28 +838,40 @@ static nsresult pref_InitDefaults()
    42 @@ -783,30 +784,48 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
       
    43  }
       
    44  
       
    45  static nsresult pref_LoadPrefsInDirList(const char *listId)
       
    46  {
       
    47    nsresult rv;
       
    48    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
       
    49    if (NS_FAILED(rv)) return rv;
       
    50  
       
    51 +  // make sure we load these special files after all the others
       
    52 +  static const char* specialFiles[] = {
       
    53 +#if defined(XP_UNIX)
       
    54 +    ""
       
    55 +#endif
       
    56 +  };
       
    57 +
       
    58 +  if (nsKDEUtils::kdeSession()) {
       
    59 +    for(int i = 0;
       
    60 +        i < NS_ARRAY_LENGTH(specialFiles);
       
    61 +        ++i ) {
       
    62 +      if (*specialFiles[ i ] == '\0') {
       
    63 +        specialFiles[ i ] = "kde.js";
       
    64 +        break;
       
    65 +      }
       
    66 +    }
       
    67 +  }
       
    68 +
       
    69    nsCOMPtr<nsISimpleEnumerator> dirList;
       
    70    dirSvc->Get(listId,
       
    71                NS_GET_IID(nsISimpleEnumerator),
       
    72                getter_AddRefs(dirList));
       
    73    if (dirList) {
       
    74      PRBool hasMore;
       
    75      while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) {
       
    76        nsCOMPtr<nsISupports> elem;
       
    77        dirList->GetNext(getter_AddRefs(elem));
       
    78        if (elem) {
       
    79          nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
       
    80          if (dir) {
       
    81            // Do we care if a file provided by this process fails to load?
       
    82 -          pref_LoadPrefsInDir(dir, nsnull, 0); 
       
    83 +          pref_LoadPrefsInDir(dir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
       
    84          }
       
    85        }
       
    86      }
       
    87    }
       
    88    return NS_OK;
       
    89  }
       
    90  
       
    91  //----------------------------------------------------------------------------------------
       
    92 @@ -837,28 +856,40 @@ static nsresult pref_InitDefaults()
    43    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    93    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    44    static const char* specialFiles[] = {
    94    static const char* specialFiles[] = {
    45  #if defined(XP_MAC) || defined(XP_MACOSX)
    95  #if defined(XP_MAC) || defined(XP_MACOSX)
    46        "macprefs.js"
    96        "macprefs.js"
    47  #elif defined(XP_WIN)
    97  #elif defined(XP_WIN)