View | Details | Raw Unified | Return to bug 21511
Collapse All | Expand All

(-)mozilla/browser/app/Makefile.in.sav (+1 lines)
Lines 49-54 DIRS = profile/extensions Link Here
49
49
50
PREF_JS_EXPORTS = $(srcdir)/profile/firefox.js \
50
PREF_JS_EXPORTS = $(srcdir)/profile/firefox.js \
51
		  $(srcdir)/profile/channel-prefs.js \
51
		  $(srcdir)/profile/channel-prefs.js \
52
		  $(srcdir)/profile/kde.js \
52
		  $(NULL)
53
		  $(NULL)
53
54
54
ifndef MOZ_BRANDING_DIRECTORY
55
ifndef MOZ_BRANDING_DIRECTORY
(-)mozilla/browser/app/profile/kde.js.sav (+1 lines)
Line 0 Link Here
1
pref("browser.preferences.instantApply", false);
(-)mozilla/browser/components/build/nsModule.cpp.sav (-3 / +4 lines)
Lines 46-52 Link Here
46
#elif defined(XP_MACOSX)
46
#elif defined(XP_MACOSX)
47
#include "nsMacShellService.h"
47
#include "nsMacShellService.h"
48
#elif defined(MOZ_WIDGET_GTK2)
48
#elif defined(MOZ_WIDGET_GTK2)
49
#include "nsGNOMEShellService.h"
49
#include "nsUnixShellService.h"
50
#endif
50
#endif
51
51
52
#ifndef WINCE
52
#ifndef WINCE
Lines 88-94 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindows Link Here
88
#elif defined(XP_MACOSX)
88
#elif defined(XP_MACOSX)
89
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
89
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
90
#elif defined(MOZ_WIDGET_GTK2)
90
#elif defined(MOZ_WIDGET_GTK2)
91
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
91
// in nsUnixShellService
92
//NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixShellService, Init)
92
#endif
93
#endif
93
94
94
#ifndef WINCE
95
#ifndef WINCE
Lines 132-138 static const nsModuleComponentInfo compo Link Here
132
  { "Browser Shell Service",
133
  { "Browser Shell Service",
133
    NS_SHELLSERVICE_CID,
134
    NS_SHELLSERVICE_CID,
134
    NS_SHELLSERVICE_CONTRACTID,
135
    NS_SHELLSERVICE_CONTRACTID,
135
    nsGNOMEShellServiceConstructor },
136
    nsUnixShellServiceConstructor },
136
137
137
#endif
138
#endif
138
139
(-)mozilla/browser/components/shell/src/Makefile.in.sav (-1 / +2 lines)
Lines 75-85 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_ Link Here
75
CPPSRCS = nsMacShellService.cpp
75
CPPSRCS = nsMacShellService.cpp
76
else
76
else
77
ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
77
ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
78
CPPSRCS = nsGNOMEShellService.cpp
78
CPPSRCS = nsUnixShellService.cpp nsGNOMEShellService.cpp nsKDEShellService.cpp
79
REQUIRES	+= \
79
REQUIRES	+= \
80
		mozgnome \
80
		mozgnome \
81
		thebes \
81
		thebes \
82
		$(NULL)
82
		$(NULL)
83
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
83
endif
84
endif
84
endif
85
endif
85
endif
86
endif
(-)mozilla/browser/components/shell/src/nsKDEShellService.cpp.sav (+193 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is Shell Service.
16
 *
17
 * The Initial Developer of the Original Code is mozilla.org.
18
 * Portions created by the Initial Developer are Copyright (C) 2004
19
 * the Initial Developer. All Rights Reserved.
20
 *
21
 * Contributor(s):
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
27
 * of those above. If you wish to allow use of your version of this file only
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
29
 * use your version of this file under the terms of the MPL, indicate your
30
 * decision by deleting the provisions above and replace them with the notice
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
32
 * the provisions above, a recipient may use your version of this file under
33
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 *
35
 * ***** END LICENSE BLOCK ***** */
36
37
#include "nsKDEShellService.h"
38
#include "nsShellService.h"
39
#include "nsKDEUtils.h"
40
#include "nsCOMPtr.h"
41
#include "nsIPrefService.h"
42
#include "nsIProcess.h"
43
#include "nsILocalFile.h"
44
#include "nsServiceManagerUtils.h"
45
#include "nsComponentManagerUtils.h"
46
47
nsresult
48
nsKDEShellService::Init()
49
    {
50
    if( !nsKDEUtils::kdeSupport())
51
        return NS_ERROR_NOT_AVAILABLE;
52
    return NS_OK;
53
    }
54
55
NS_IMPL_ISUPPORTS1(nsKDEShellService, nsIShellService)
56
57
NS_IMETHODIMP
58
nsKDEShellService::IsDefaultBrowser(PRBool aStartupCheck,
59
                                      PRBool* aIsDefaultBrowser)
60
    {
61
    *aIsDefaultBrowser = PR_FALSE;
62
    if (aStartupCheck)
63
        mCheckedThisSession = PR_TRUE;
64
    nsCStringArray command;
65
    command.AppendCString( NS_LITERAL_CSTRING( "ISDEFAULTBROWSER" ));
66
    if( nsKDEUtils::command( command ))
67
        *aIsDefaultBrowser = PR_TRUE;
68
    return NS_OK;
69
    }
70
71
NS_IMETHODIMP
72
nsKDEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
73
                                       PRBool aForAllUsers)
74
    {
75
    nsCStringArray command;
76
    command.AppendCString( NS_LITERAL_CSTRING( "SETDEFAULTBROWSER" ));
77
    command.AppendCString( aClaimAllTypes ? NS_LITERAL_CSTRING( "ALLTYPES" ) : NS_LITERAL_CSTRING( "NORMAL" ));
78
    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
79
    }
80
81
NS_IMETHODIMP
82
nsKDEShellService::GetShouldCheckDefaultBrowser(PRBool* aResult)
83
{
84
  // If we've already checked, the browser has been started and this is a 
85
  // new window open, and we don't want to check again.
86
  if (mCheckedThisSession) {
87
    *aResult = PR_FALSE;
88
    return NS_OK;
89
  }
90
91
  nsCOMPtr<nsIPrefBranch> prefs;
92
  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
93
  if (pserve)
94
    pserve->GetBranch("", getter_AddRefs(prefs));
95
96
  if (prefs)
97
    prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
98
99
  return NS_OK;
100
}
101
102
NS_IMETHODIMP
103
nsKDEShellService::SetShouldCheckDefaultBrowser(PRBool aShouldCheck)
104
{
105
  nsCOMPtr<nsIPrefBranch> prefs;
106
  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
107
  if (pserve)
108
    pserve->GetBranch("", getter_AddRefs(prefs));
109
110
  if (prefs)
111
    prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
112
113
  return NS_OK;
114
}
115
116
NS_IMETHODIMP
117
nsKDEShellService::SetDesktopBackground(nsIDOMElement* aElement, 
118
                                          PRInt32 aPosition)
119
    {
120
    return NS_ERROR_NOT_IMPLEMENTED;
121
    }
122
123
NS_IMETHODIMP
124
nsKDEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
125
    {
126
    return NS_ERROR_NOT_IMPLEMENTED;
127
    }
128
129
NS_IMETHODIMP
130
nsKDEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
131
    {
132
    return NS_ERROR_NOT_IMPLEMENTED;
133
    }
134
135
NS_IMETHODIMP
136
nsKDEShellService::OpenApplication(PRInt32 aApplication)
137
    {
138
    nsCStringArray command;
139
    if( aApplication == APPLICATION_MAIL )
140
        command.AppendCString( NS_LITERAL_CSTRING( "OPENMAIL" ));
141
    else if( aApplication == APPLICATION_NEWS )
142
        command.AppendCString( NS_LITERAL_CSTRING( "OPENNEWS" ));
143
    else
144
        return NS_ERROR_NOT_IMPLEMENTED;
145
    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
146
    }
147
148
NS_IMETHODIMP
149
nsKDEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsACString& aURI)
150
    {
151
    nsCStringArray command;
152
    command.AppendCString( NS_LITERAL_CSTRING( "RUN" ));
153
    nsCString app;
154
    nsresult rv = aApplication->GetNativePath( app );
155
    NS_ENSURE_SUCCESS( rv, rv );
156
    command.AppendCString( app );
157
    command.AppendCString( aURI );
158
    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
159
    }
160
161
NS_IMETHODIMP
162
nsKDEShellService::GetDefaultFeedReader(nsILocalFile** _retval)
163
    {
164
    *_retval = nsnull;
165
166
    nsCStringArray command;
167
    command.AppendCString( NS_LITERAL_CSTRING( "GETDEFAULTFEEDREADER" ));
168
    nsCStringArray output;
169
    if( !nsKDEUtils::command( command, &output ) || output.Count() != 1 )
170
        return NS_ERROR_FAILURE;
171
172
    nsCString path;
173
    path = *output[ 0 ];
174
    if (path.IsEmpty())
175
        return NS_ERROR_FAILURE;
176
177
    nsresult rv;
178
    nsCOMPtr<nsILocalFile> defaultReader =
179
        do_CreateInstance("@mozilla.org/file/local;1", &rv);
180
    NS_ENSURE_SUCCESS(rv, rv);
181
182
    rv = defaultReader->InitWithNativePath(path);
183
    NS_ENSURE_SUCCESS(rv, rv);
184
185
    PRBool exists;
186
    rv = defaultReader->Exists(&exists);
187
    NS_ENSURE_SUCCESS(rv, rv);
188
    if (!exists)
189
        return NS_ERROR_FAILURE;
190
191
    NS_ADDREF(*_retval = defaultReader);
192
    return NS_OK;
193
    }
(-)mozilla/browser/components/shell/src/nsKDEShellService.h.sav (+59 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is Shell Service.
16
 *
17
 * The Initial Developer of the Original Code is mozilla.org.
18
 * Portions created by the Initial Developer are Copyright (C) 2004
19
 * the Initial Developer. All Rights Reserved.
20
 *
21
 * Contributor(s):
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
27
 * of those above. If you wish to allow use of your version of this file only
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
29
 * use your version of this file under the terms of the MPL, indicate your
30
 * decision by deleting the provisions above and replace them with the notice
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
32
 * the provisions above, a recipient may use your version of this file under
33
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 *
35
 * ***** END LICENSE BLOCK ***** */
36
37
#ifndef nskdeshellservice_h____
38
#define nskdeshellservice_h____
39
40
#include "nsIShellService.h"
41
#include "nsStringAPI.h"
42
43
class nsKDEShellService : public nsIShellService
44
{
45
public:
46
  nsKDEShellService() : mCheckedThisSession(PR_FALSE) { }
47
48
  NS_DECL_ISUPPORTS
49
  NS_DECL_NSISHELLSERVICE
50
51
  nsresult Init() NS_HIDDEN;
52
53
private:
54
  ~nsKDEShellService() {}
55
56
  PRPackedBool mCheckedThisSession;
57
};
58
59
#endif // nskdeshellservice_h____
(-)mozilla/browser/components/shell/src/nsUnixShellService.cpp.sav (+52 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is Shell Service.
16
 *
17
 * The Initial Developer of the Original Code is mozilla.org.
18
 * Portions created by the Initial Developer are Copyright (C) 2004
19
 * the Initial Developer. All Rights Reserved.
20
 *
21
 * Contributor(s):
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
27
 * of those above. If you wish to allow use of your version of this file only
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
29
 * use your version of this file under the terms of the MPL, indicate your
30
 * decision by deleting the provisions above and replace them with the notice
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
32
 * the provisions above, a recipient may use your version of this file under
33
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 *
35
 * ***** END LICENSE BLOCK ***** */
36
37
#include "nsUnixShellService.h"
38
#include "nsGNOMEShellService.h"
39
#include "nsKDEShellService.h"
40
#include "nsKDEUtils.h"
41
#include "nsIGenericFactory.h"
42
43
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
44
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsKDEShellService, Init)
45
46
NS_METHOD
47
nsUnixShellServiceConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
48
{
49
    if( nsKDEUtils::kdeSupport())
50
        return nsKDEShellServiceConstructor( aOuter, aIID, aResult );
51
    return nsGNOMEShellServiceConstructor( aOuter, aIID, aResult );
52
}
(-)mozilla/browser/components/shell/src/nsUnixShellService.h.sav (+45 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is Shell Service.
16
 *
17
 * The Initial Developer of the Original Code is mozilla.org.
18
 * Portions created by the Initial Developer are Copyright (C) 2004
19
 * the Initial Developer. All Rights Reserved.
20
 *
21
 * Contributor(s):
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
27
 * of those above. If you wish to allow use of your version of this file only
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
29
 * use your version of this file under the terms of the MPL, indicate your
30
 * decision by deleting the provisions above and replace them with the notice
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
32
 * the provisions above, a recipient may use your version of this file under
33
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 *
35
 * ***** END LICENSE BLOCK ***** */
36
37
#ifndef nsunixshellservice_h____
38
#define nsunixshellservice_h____
39
40
#include "nsIShellService.h"
41
42
NS_METHOD
43
nsUnixShellServiceConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult);
44
45
#endif // nsunixshellservice_h____
(-)mozilla/browser/installer/unix/packages-static.sav (+1 lines)
Lines 291-296 bin/icons/*.png Link Here
291
bin/@PREF_DIR@/firefox.js
291
bin/@PREF_DIR@/firefox.js
292
bin/@PREF_DIR@/firefox-branding.js
292
bin/@PREF_DIR@/firefox-branding.js
293
bin/@PREF_DIR@/channel-prefs.js
293
bin/@PREF_DIR@/channel-prefs.js
294
bin/@PREF_DIR@/kde.js
294
bin/greprefs/all.js
295
bin/greprefs/all.js
295
bin/greprefs/security-prefs.js
296
bin/greprefs/security-prefs.js
296
bin/greprefs/xpinstall.js
297
bin/greprefs/xpinstall.js
(-)mozilla/chrome/src/Makefile.in.sav (+1 lines)
Lines 86-91 EXTRA_DSO_LDOPTS = \ Link Here
86
86
87
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
87
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
88
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
88
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
89
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
89
endif
90
endif
90
91
91
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
92
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
(-)mozilla/chrome/src/nsChromeRegistry.cpp.sav (-7 / +27 lines)
Lines 114-119 Link Here
114
#include "nsIXULAppInfo.h"
114
#include "nsIXULAppInfo.h"
115
#include "nsIXULRuntime.h"
115
#include "nsIXULRuntime.h"
116
#include "nsPresShellIterator.h"
116
#include "nsPresShellIterator.h"
117
#include "nsKDEUtils.h"
117
118
118
#ifdef MOZ_XUL
119
#ifdef MOZ_XUL
119
// keep all the RDF stuff together, in case we can remove it in the far future
120
// keep all the RDF stuff together, in case we can remove it in the far future
Lines 2208-2213 nsChromeRegistry::ProcessManifestBuffer( Link Here
2208
  NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
2209
  NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
2209
  NS_NAMED_LITERAL_STRING(kOs, "os");
2210
  NS_NAMED_LITERAL_STRING(kOs, "os");
2210
  NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
2211
  NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
2212
  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
2211
2213
2212
  nsCOMPtr<nsIIOService> io (do_GetIOService());
2214
  nsCOMPtr<nsIIOService> io (do_GetIOService());
2213
  if (!io) return NS_ERROR_FAILURE;
2215
  if (!io) return NS_ERROR_FAILURE;
Lines 2251-2256 nsChromeRegistry::ProcessManifestBuffer( Link Here
2251
  }
2253
  }
2252
  
2254
  
2253
  nsAutoString osVersion;
2255
  nsAutoString osVersion;
2256
  nsAutoString desktop;
2254
#if defined(XP_WIN)
2257
#if defined(XP_WIN)
2255
  OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
2258
  OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
2256
  if (GetVersionEx(&info)) {
2259
  if (GetVersionEx(&info)) {
Lines 2258-2263 nsChromeRegistry::ProcessManifestBuffer( Link Here
2258
                                         info.dwMajorVersion,
2261
                                         info.dwMajorVersion,
2259
                                         info.dwMinorVersion);
2262
                                         info.dwMinorVersion);
2260
  }
2263
  }
2264
  desktop = NS_LITERAL_STRING("win");
2261
#elif defined(XP_MACOSX)
2265
#elif defined(XP_MACOSX)
2262
  long majorVersion, minorVersion;
2266
  long majorVersion, minorVersion;
2263
  if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
2267
  if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
Lines 2266-2275 nsChromeRegistry::ProcessManifestBuffer( Link Here
2266
                                         majorVersion,
2270
                                         majorVersion,
2267
                                         minorVersion);
2271
                                         minorVersion);
2268
  }
2272
  }
2273
  desktop = NS_LITERAL_STRING("macosx");
2269
#elif defined(MOZ_WIDGET_GTK2)
2274
#elif defined(MOZ_WIDGET_GTK2)
2270
  nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
2275
  nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
2271
                                       gtk_major_version,
2276
                                       gtk_major_version,
2272
                                       gtk_minor_version);
2277
                                       gtk_minor_version);
2278
  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome"); // TODO others?
2273
#endif
2279
#endif
2274
2280
2275
  char *token;
2281
  char *token;
Lines 2313-2318 nsChromeRegistry::ProcessManifestBuffer( Link Here
2313
      TriState stApp = eUnspecified;
2319
      TriState stApp = eUnspecified;
2314
      TriState stOsVersion = eUnspecified;
2320
      TriState stOsVersion = eUnspecified;
2315
      TriState stOs = eUnspecified;
2321
      TriState stOs = eUnspecified;
2322
      TriState stDesktop = eUnspecified;
2316
2323
2317
      PRBool badFlag = PR_FALSE;
2324
      PRBool badFlag = PR_FALSE;
2318
2325
Lines 2326-2331 nsChromeRegistry::ProcessManifestBuffer( Link Here
2326
            CheckFlag(kContentAccessible, wtoken, contentAccessible) ||
2333
            CheckFlag(kContentAccessible, wtoken, contentAccessible) ||
2327
            CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2334
            CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2328
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2335
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2336
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2329
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2337
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2330
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2338
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2331
          continue;
2339
          continue;
Lines 2337-2343 nsChromeRegistry::ProcessManifestBuffer( Link Here
2337
      }
2345
      }
2338
2346
2339
      if (badFlag || stApp == eBad || stAppVersion == eBad || 
2347
      if (badFlag || stApp == eBad || stAppVersion == eBad || 
2340
          stOs == eBad || stOsVersion == eBad)
2348
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2341
        continue;
2349
        continue;
2342
2350
2343
      nsCOMPtr<nsIURI> resolved;
2351
      nsCOMPtr<nsIURI> resolved;
Lines 2398-2403 nsChromeRegistry::ProcessManifestBuffer( Link Here
2398
      TriState stApp = eUnspecified;
2406
      TriState stApp = eUnspecified;
2399
      TriState stOs = eUnspecified;
2407
      TriState stOs = eUnspecified;
2400
      TriState stOsVersion = eUnspecified;
2408
      TriState stOsVersion = eUnspecified;
2409
      TriState stDesktop = eUnspecified;
2401
2410
2402
      PRBool badFlag = PR_FALSE;
2411
      PRBool badFlag = PR_FALSE;
2403
2412
Lines 2408-2413 nsChromeRegistry::ProcessManifestBuffer( Link Here
2408
2417
2409
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2418
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2410
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2419
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2420
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2411
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2421
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2412
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2422
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2413
          continue;
2423
          continue;
Lines 2419-2425 nsChromeRegistry::ProcessManifestBuffer( Link Here
2419
      }
2429
      }
2420
2430
2421
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2431
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2422
          stOs == eBad || stOsVersion == eBad)
2432
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2423
        continue;
2433
        continue;
2424
2434
2425
      nsCOMPtr<nsIURI> resolved;
2435
      nsCOMPtr<nsIURI> resolved;
Lines 2460-2465 nsChromeRegistry::ProcessManifestBuffer( Link Here
2460
      TriState stApp = eUnspecified;
2470
      TriState stApp = eUnspecified;
2461
      TriState stOs = eUnspecified;
2471
      TriState stOs = eUnspecified;
2462
      TriState stOsVersion = eUnspecified;
2472
      TriState stOsVersion = eUnspecified;
2473
      TriState stDesktop = eUnspecified;
2463
2474
2464
      PRBool badFlag = PR_FALSE;
2475
      PRBool badFlag = PR_FALSE;
2465
2476
Lines 2470-2475 nsChromeRegistry::ProcessManifestBuffer( Link Here
2470
2481
2471
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2482
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2472
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2483
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2484
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2473
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2485
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2474
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2486
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2475
          continue;
2487
          continue;
Lines 2481-2487 nsChromeRegistry::ProcessManifestBuffer( Link Here
2481
      }
2493
      }
2482
2494
2483
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2495
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2484
          stOs == eBad || stOsVersion == eBad)
2496
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2485
        continue;
2497
        continue;
2486
2498
2487
      nsCOMPtr<nsIURI> resolved;
2499
      nsCOMPtr<nsIURI> resolved;
Lines 2524-2529 nsChromeRegistry::ProcessManifestBuffer( Link Here
2524
      TriState stApp = eUnspecified;
2536
      TriState stApp = eUnspecified;
2525
      TriState stOs = eUnspecified;
2537
      TriState stOs = eUnspecified;
2526
      TriState stOsVersion = eUnspecified;
2538
      TriState stOsVersion = eUnspecified;
2539
      TriState stDesktop = eUnspecified;
2527
2540
2528
      PRBool badFlag = PR_FALSE;
2541
      PRBool badFlag = PR_FALSE;
2529
2542
Lines 2534-2539 nsChromeRegistry::ProcessManifestBuffer( Link Here
2534
2547
2535
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2548
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2536
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2549
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2550
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2537
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2551
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2538
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2552
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2539
          continue;
2553
          continue;
Lines 2545-2551 nsChromeRegistry::ProcessManifestBuffer( Link Here
2545
      }
2559
      }
2546
2560
2547
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2561
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2548
          stOs == eBad || stOsVersion == eBad)
2562
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2549
        continue;
2563
        continue;
2550
2564
2551
      nsCOMPtr<nsIURI> baseuri, overlayuri;
2565
      nsCOMPtr<nsIURI> baseuri, overlayuri;
Lines 2580-2585 nsChromeRegistry::ProcessManifestBuffer( Link Here
2580
      TriState stApp = eUnspecified;
2594
      TriState stApp = eUnspecified;
2581
      TriState stOs = eUnspecified;
2595
      TriState stOs = eUnspecified;
2582
      TriState stOsVersion = eUnspecified;
2596
      TriState stOsVersion = eUnspecified;
2597
      TriState stDesktop = eUnspecified;
2583
2598
2584
      PRBool badFlag = PR_FALSE;
2599
      PRBool badFlag = PR_FALSE;
2585
2600
Lines 2590-2595 nsChromeRegistry::ProcessManifestBuffer( Link Here
2590
2605
2591
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2606
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2592
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2607
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2608
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2593
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2609
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2594
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2610
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2595
          continue;
2611
          continue;
Lines 2601-2607 nsChromeRegistry::ProcessManifestBuffer( Link Here
2601
      }
2617
      }
2602
2618
2603
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2619
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2604
          stOs == eBad || stOsVersion == eBad)
2620
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2605
        continue;
2621
        continue;
2606
2622
2607
      nsCOMPtr<nsIURI> baseuri, overlayuri;
2623
      nsCOMPtr<nsIURI> baseuri, overlayuri;
Lines 2640-2645 nsChromeRegistry::ProcessManifestBuffer( Link Here
2640
      TriState stApp = eUnspecified;
2656
      TriState stApp = eUnspecified;
2641
      TriState stOs = eUnspecified;
2657
      TriState stOs = eUnspecified;
2642
      TriState stOsVersion = eUnspecified;
2658
      TriState stOsVersion = eUnspecified;
2659
      TriState stDesktop = eUnspecified;
2643
2660
2644
      PRBool badFlag = PR_FALSE;
2661
      PRBool badFlag = PR_FALSE;
2645
2662
Lines 2650-2655 nsChromeRegistry::ProcessManifestBuffer( Link Here
2650
2667
2651
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2668
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2652
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2669
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2670
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2653
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2671
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2654
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2672
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2655
          continue;
2673
          continue;
Lines 2661-2667 nsChromeRegistry::ProcessManifestBuffer( Link Here
2661
      }
2679
      }
2662
2680
2663
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2681
      if (badFlag || stApp == eBad || stAppVersion == eBad ||
2664
          stOs == eBad || stOsVersion == eBad)
2682
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2665
        continue;
2683
        continue;
2666
2684
2667
      nsCOMPtr<nsIURI> chromeuri, resolveduri;
2685
      nsCOMPtr<nsIURI> chromeuri, resolveduri;
Lines 2702-2707 nsChromeRegistry::ProcessManifestBuffer( Link Here
2702
      TriState stApp = eUnspecified;
2720
      TriState stApp = eUnspecified;
2703
      TriState stOsVersion = eUnspecified;
2721
      TriState stOsVersion = eUnspecified;
2704
      TriState stOs = eUnspecified;
2722
      TriState stOs = eUnspecified;
2723
      TriState stDesktop = eUnspecified;
2705
2724
2706
      PRBool badFlag = PR_FALSE;
2725
      PRBool badFlag = PR_FALSE;
2707
2726
Lines 2712-2717 nsChromeRegistry::ProcessManifestBuffer( Link Here
2712
2731
2713
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2732
        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
2714
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2733
            CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
2734
            CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
2715
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2735
            CheckVersionFlag(kOsVersion, wtoken, osVersion, vc, stOsVersion) ||
2716
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2736
            CheckVersionFlag(kAppVersion, wtoken, appVersion, vc, stAppVersion))
2717
          continue;
2737
          continue;
Lines 2723-2729 nsChromeRegistry::ProcessManifestBuffer( Link Here
2723
      }
2743
      }
2724
2744
2725
      if (badFlag || stApp == eBad || stAppVersion == eBad || 
2745
      if (badFlag || stApp == eBad || stAppVersion == eBad || 
2726
          stOs == eBad || stOsVersion == eBad)
2746
          stOs == eBad || stOsVersion == eBad || stDesktop == eBad)
2727
        continue;
2747
        continue;
2728
      
2748
      
2729
      nsDependentCString host(package);
2749
      nsDependentCString host(package);
(-)mozilla/modules/libpref/src/Makefile.in.sav (+2 lines)
Lines 97-99 nsPrefService.$(OBJ_SUFFIX): nsPrefServi Link Here
97
	@$(MAKE_DEPS_AUTO_CXX)
97
	@$(MAKE_DEPS_AUTO_CXX)
98
	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
98
	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
99
endif
99
endif
100
101
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
(-)mozilla/modules/libpref/src/nsPrefService.cpp.sav (-3 / +17 lines)
Lines 51-56 Link Here
51
#include "nsCOMArray.h"
51
#include "nsCOMArray.h"
52
#include "nsXPCOMCID.h"
52
#include "nsXPCOMCID.h"
53
#include "nsAutoPtr.h"
53
#include "nsAutoPtr.h"
54
#include "nsKDEUtils.h"
54
55
55
#include "nsQuickSort.h"
56
#include "nsQuickSort.h"
56
#include "prmem.h"
57
#include "prmem.h"
Lines 606-612 pref_LoadPrefsInDir(nsIFile* aDir, char Link Here
606
  return rv;
607
  return rv;
607
}
608
}
608
609
609
static nsresult pref_LoadPrefsInDirList(const char *listId)
610
static nsresult pref_LoadPrefsInDirList(const char *listId,
611
    char const *const *aSpecialFiles = NULL, PRUint32 aSpecialFilesCount = 0)
610
{
612
{
611
  nsresult rv;
613
  nsresult rv;
612
  nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
614
  nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
Lines 625-631 static nsresult pref_LoadPrefsInDirList( Link Here
625
        nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
627
        nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
626
        if (dir) {
628
        if (dir) {
627
          // Do we care if a file provided by this process fails to load?
629
          // Do we care if a file provided by this process fails to load?
628
          pref_LoadPrefsInDir(dir, nsnull, 0); 
630
          pref_LoadPrefsInDir(dir, aSpecialFiles, aSpecialFilesCount); 
629
        }
631
        }
630
      }
632
      }
631
    }
633
    }
Lines 676-681 static nsresult pref_InitInitialObjects( Link Here
676
#if defined(MOZ_WIDGET_PHOTON)
678
#if defined(MOZ_WIDGET_PHOTON)
677
	  , "photon.js"
679
	  , "photon.js"
678
#endif		 
680
#endif		 
681
      , "" // placeholder for KDE  (empty is otherwise harmless)
679
#elif defined(XP_OS2)
682
#elif defined(XP_OS2)
680
      "os2pref.js"
683
      "os2pref.js"
681
#elif defined(XP_BEOS)
684
#elif defined(XP_BEOS)
Lines 683-694 static nsresult pref_InitInitialObjects( Link Here
683
#endif
686
#endif
684
  };
687
  };
685
688
689
  if( nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
690
      for( int i = 0;
691
           i < NS_ARRAY_LENGTH(specialFiles);
692
           ++i ) {
693
          if( *specialFiles[ i ] == '\0' ) {
694
              specialFiles[ i ] = "kde.js";
695
              break;
696
          }
697
      }
698
  }
699
      
686
  rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
700
  rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
687
  if (NS_FAILED(rv)) {
701
  if (NS_FAILED(rv)) {
688
    NS_WARNING("Error parsing application default preferences.");
702
    NS_WARNING("Error parsing application default preferences.");
689
  }
703
  }
690
704
691
  rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
705
  rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST, specialFiles, NS_ARRAY_LENGTH(specialFiles));
692
  NS_ENSURE_SUCCESS(rv, rv);
706
  NS_ENSURE_SUCCESS(rv, rv);
693
707
694
  NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
708
  NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
(-)mozilla/toolkit/content/jar.mn.sav (+4 lines)
Lines 43-48 toolkit.jar: Link Here
43
*+ content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
43
*+ content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
44
*+ content/global/bindings/datetimepicker.xml  (widgets/datetimepicker.xml)
44
*+ content/global/bindings/datetimepicker.xml  (widgets/datetimepicker.xml)
45
*+ content/global/bindings/dialog.xml          (widgets/dialog.xml)
45
*+ content/global/bindings/dialog.xml          (widgets/dialog.xml)
46
*+ content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
47
% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
46
*+ content/global/bindings/editor.xml          (widgets/editor.xml)
48
*+ content/global/bindings/editor.xml          (widgets/editor.xml)
47
*  content/global/bindings/expander.xml        (widgets/expander.xml)
49
*  content/global/bindings/expander.xml        (widgets/expander.xml)
48
*  content/global/bindings/filefield.xml       (widgets/filefield.xml)
50
*  content/global/bindings/filefield.xml       (widgets/filefield.xml)
Lines 56-61 toolkit.jar: Link Here
56
*+ content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
58
*+ content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
57
*+ content/global/bindings/popup.xml           (widgets/popup.xml)
59
*+ content/global/bindings/popup.xml           (widgets/popup.xml)
58
*+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
60
*+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
61
*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml)
62
% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde
59
*+ content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
63
*+ content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
60
*+ content/global/bindings/radio.xml           (widgets/radio.xml)
64
*+ content/global/bindings/radio.xml           (widgets/radio.xml)
61
*+ content/global/bindings/resizer.xml         (widgets/resizer.xml)
65
*+ content/global/bindings/resizer.xml         (widgets/resizer.xml)
(-)mozilla/toolkit/content/widgets/dialog-kde.xml.sav (-1 / +10 lines)
Lines 19-25 Link Here
19
          
19
          
20
      <xul:hbox class="dialog-button-box" anonid="buttons"
20
      <xul:hbox class="dialog-button-box" anonid="buttons"
21
                xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
21
                xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
22
#ifdef XP_UNIX
22
#ifdef XP_UNIX_GNOME
23
                >
23
                >
24
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
24
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
25
        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
25
        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
Lines 28-33 Link Here
28
        <xul:spacer anonid="spacer" flex="1"/>
28
        <xul:spacer anonid="spacer" flex="1"/>
29
        <xul:button dlgtype="cancel" class="dialog-button"/>
29
        <xul:button dlgtype="cancel" class="dialog-button"/>
30
        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
30
        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
31
#elif XP_UNIX
32
                pack="end">
33
        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
34
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
35
        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
36
        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
37
        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
38
        <xul:button dlgtype="cancel" class="dialog-button"/>
39
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
31
#else
40
#else
32
                pack="end">
41
                pack="end">
33
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
42
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
(-)mozilla/toolkit/content/widgets/preferences-kde.xml.sav (-1 / +10 lines)
Lines 573-579 Link Here
573
        </xul:deck>
573
        </xul:deck>
574
      </xul:hbox>
574
      </xul:hbox>
575
      <xul:hbox anonid="dlg-buttons" class="prefWindow-dlgbuttons"
575
      <xul:hbox anonid="dlg-buttons" class="prefWindow-dlgbuttons"
576
#ifdef XP_UNIX
576
#ifdef XP_UNIX_GNOME
577
                >
577
                >
578
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
578
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
579
        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
579
        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
Lines 582-587 Link Here
582
        <xul:spacer anonid="spacer" flex="1"/>
582
        <xul:spacer anonid="spacer" flex="1"/>
583
        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
583
        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
584
        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
584
        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
585
#elif XP_UNIX
586
                pack="end">
587
        <xul:button dlgtype="help" class="dialog-button" hidden="true" icon="help"/>
588
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
589
        <xul:spacer anonid="spacer" flex="1"/>
590
        <xul:button dlgtype="accept" class="dialog-button" icon="accept"/>
591
        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
592
        <xul:button dlgtype="cancel" class="dialog-button" icon="cancel"/>
593
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
585
#else
594
#else
586
                pack="end">
595
                pack="end">
587
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
596
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
(-)mozilla/toolkit/system/unixproxy/Makefile.in.sav (+2 lines)
Lines 64-67 CPPSRCS = \ Link Here
64
        nsUnixSystemProxySettings.cpp \
64
        nsUnixSystemProxySettings.cpp \
65
        $(NULL)
65
        $(NULL)
66
66
67
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
68
67
include $(topsrcdir)/config/rules.mk
69
include $(topsrcdir)/config/rules.mk
(-)mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.sav (+31 lines)
Lines 49-54 Link Here
49
#include "nsPrintfCString.h"
49
#include "nsPrintfCString.h"
50
#include "nsNetUtil.h"
50
#include "nsNetUtil.h"
51
#include "nsISupportsPrimitives.h"
51
#include "nsISupportsPrimitives.h"
52
#include "nsVoidArray.h"
53
#include "nsKDEUtils.h"
52
54
53
class nsUnixSystemProxySettings : public nsISystemProxySettings {
55
class nsUnixSystemProxySettings : public nsISystemProxySettings {
54
public:
56
public:
Lines 65-70 private: Link Here
65
  PRBool IsProxyMode(const char* aMode);
67
  PRBool IsProxyMode(const char* aMode);
66
  nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
68
  nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
67
  nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
69
  nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
70
  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
68
};
71
};
69
72
70
NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
73
NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
Lines 412-417 nsUnixSystemProxySettings::GetProxyForUR Link Here
412
  rv = aURI->GetPort(&port);
415
  rv = aURI->GetPort(&port);
413
  NS_ENSURE_SUCCESS(rv, rv);
416
  NS_ENSURE_SUCCESS(rv, rv);
414
417
418
  if( nsKDEUtils::kdeSupport())
419
    return GetProxyFromKDE( scheme, host, port, aResult );
420
415
  if (!mGConf)
421
  if (!mGConf)
416
    return GetProxyFromEnvironment(scheme, host, port, aResult);
422
    return GetProxyFromEnvironment(scheme, host, port, aResult);
417
423
Lines 432-434 static const nsModuleComponentInfo compo Link Here
432
};
438
};
433
439
434
NS_IMPL_NSGETMODULE(nsUnixProxyModule, components)
440
NS_IMPL_NSGETMODULE(nsUnixProxyModule, components)
441
442
nsresult
443
nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
444
                                             const nsACString& aHost,
445
                                             PRInt32 aPort,
446
                                             nsACString& aResult)
447
{
448
  nsCAutoString url;
449
  url = aScheme;
450
  url += "://";
451
  url += aHost;
452
  if( aPort >= 0 )
453
      {
454
      url += ":";
455
      url += nsPrintfCString("%d", aPort);
456
      }
457
  nsCStringArray command;
458
  command.AppendCString( NS_LITERAL_CSTRING( "GETPROXY" ));
459
  command.AppendCString( url );
460
  nsCStringArray result;
461
  if( !nsKDEUtils::command( command, &result ) || result.Count() != 1 )
462
      return NS_ERROR_FAILURE;
463
  aResult = *result[ 0 ];
464
  return NS_OK;
465
}
(-)mozilla/toolkit/xre/Makefile.in.sav (-1 / +1 lines)
Lines 133-139 ifeq ($(MOZ_WIDGET_TOOLKIT),beos) Link Here
133
CPPSRCS += nsNativeAppSupportBeOS.cpp
133
CPPSRCS += nsNativeAppSupportBeOS.cpp
134
else
134
else
135
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
135
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
136
CPPSRCS += nsNativeAppSupportUnix.cpp
136
CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp
137
else
137
else
138
CPPSRCS += nsNativeAppSupportDefault.cpp
138
CPPSRCS += nsNativeAppSupportDefault.cpp
139
endif
139
endif
(-)mozilla/toolkit/xre/nsKDEUtils.cpp.sav (+329 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is Unix Native App Support.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * Mozilla Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 2007
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *
24
 * Alternatively, the contents of this file may be used under the terms of
25
 * either the GNU General Public License Version 2 or later (the "GPL"), or
26
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
 * in which case the provisions of the GPL or the LGPL are applicable instead
28
 * of those above. If you wish to allow use of your version of this file only
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
30
 * use your version of this file under the terms of the MPL, indicate your
31
 * decision by deleting the provisions above and replace them with the notice
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 * the provisions above, a recipient may use your version of this file under
34
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 *
36
 * ***** END LICENSE BLOCK ***** */
37
38
#include "nsKDEUtils.h"
39
#include "nsIWidget.h"
40
41
#include <gtk/gtkwindow.h>
42
#include <gtk/gtkmain.h>
43
44
#include <limits.h>
45
#include <stdio.h>
46
#include <sys/wait.h>
47
#include <unistd.h>
48
#include <X11/Xlib.h>
49
50
//#define DEBUG_KDE
51
#ifdef DEBUG_KDE
52
#define KMOZILLAHELPER "kmozillahelper"
53
#else
54
// not need for lib64, it's a binary
55
#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper"
56
#endif
57
58
#define KMOZILLAHELPER_VERSION 4
59
#define MAKE_STR2( n ) #n
60
#define MAKE_STR( n ) MAKE_STR2( n )
61
62
static bool getKdeSession()
63
    {
64
    Display* dpy = XOpenDisplay( NULL );
65
    if( dpy == NULL )
66
        return false;
67
    Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True );
68
    bool kde = false;
69
    if( kde_full_session != None )
70
        {
71
        int cnt;
72
        if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt ))
73
            {
74
            for( int i = 0;
75
                 i < cnt;
76
                 ++i )
77
                {
78
                if( props[ i ] == kde_full_session )
79
                    {
80
                    kde = true;
81
#ifdef DEBUG_KDE
82
                    fprintf( stderr, "KDE SESSION %d\n", kde );
83
#endif
84
                    break;
85
                    }
86
                }
87
            XFree( props );
88
            }
89
        }
90
    XCloseDisplay( dpy );
91
    return kde;
92
    }
93
94
static bool getKdeSupport()
95
    {
96
    nsCStringArray command;
97
    command.AppendCString( NS_LITERAL_CSTRING( "CHECK" ));
98
    command.AppendCString( NS_LITERAL_CSTRING( MAKE_STR( KMOZILLAHELPER_VERSION )));
99
    bool kde = nsKDEUtils::command( command );
100
#ifdef DEBUG_KDE
101
    fprintf( stderr, "KDE RUNNING %d\n", kde );
102
#endif
103
    return kde;
104
    }
105
106
nsKDEUtils::nsKDEUtils()
107
    : commandFile( NULL )
108
    , replyFile( NULL )
109
    {
110
    }
111
112
nsKDEUtils::~nsKDEUtils()
113
    {
114
//    closeHelper(); not actually useful, exiting will close the fd too
115
    }
116
117
nsKDEUtils* nsKDEUtils::self()
118
    {
119
    static nsKDEUtils s;
120
    return &s;
121
    }
122
123
static bool helperRunning = false;
124
static bool helperFailed = false;
125
126
bool nsKDEUtils::kdeSession()
127
    {
128
    static bool session = getKdeSession();
129
    return session;
130
    }
131
132
bool nsKDEUtils::kdeSupport()
133
    {
134
    static bool support = kdeSession() && getKdeSupport();
135
    return support && helperRunning;
136
    }
137
138
struct nsKDECommandData
139
    {
140
    FILE* file;
141
    nsCStringArray* output;
142
    GMainLoop* loop;
143
    bool success;
144
    };
145
146
static gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data )
147
    {
148
    nsKDECommandData* p = static_cast< nsKDECommandData* >( data );
149
    char buf[ 8192 ]; // TODO big enough
150
    bool command_done = false;
151
    bool command_failed = false;
152
    while( !command_done && !command_failed && fgets( buf, 8192, p->file ) != NULL )
153
        { // TODO what if the kernel splits a line into two chunks?
154
//#ifdef DEBUG_KDE
155
//        fprintf( stderr, "READ: %s %d\n", buf, feof( p->file ));
156
//#endif
157
        if( char* eol = strchr( buf, '\n' ))
158
            *eol = '\0';
159
        command_done = ( strcmp( buf, "\\1" ) == 0 );
160
        command_failed = ( strcmp( buf, "\\0" ) == 0 );
161
        nsCAutoString line( buf );
162
        line.ReplaceSubstring( "\\n", "\n" );
163
        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
164
        if( p->output && !( command_done || command_failed ))
165
            p->output->AppendCString( nsCString( buf )); // TODO utf8?
166
        }
167
    bool quit = false;
168
    if( feof( p->file ) || command_failed )
169
        {
170
        quit = true;
171
        p->success = false;
172
        }
173
    if( command_done )
174
        { // reading one reply finished
175
        quit = true;
176
        p->success = true;
177
        }
178
    if( quit )
179
        {
180
        if( p->loop )
181
            g_main_loop_quit( p->loop );
182
        return FALSE;
183
        }
184
    return TRUE;
185
    }
186
187
bool nsKDEUtils::command( const nsCStringArray& command, nsCStringArray* output )
188
    {
189
    return self()->internalCommand( command, NULL, false, output );
190
    }
191
192
bool nsKDEUtils::commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output )
193
    {
194
    return self()->internalCommand( command, parent, true, output );
195
    }
196
197
bool nsKDEUtils::internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool blockUi,
198
    nsCStringArray* output )
199
    {
200
    if( !startHelper())
201
        return false;
202
    feedCommand( command );
203
    // do not store the data in 'this' but in extra structure, just in case there
204
    // is reentrancy (can there be? the event loop is re-entered)
205
    nsKDECommandData data;
206
    data.file = replyFile;
207
    data.output = output;
208
    data.success = false;
209
    if( blockUi )
210
        {
211
        data.loop = g_main_loop_new( NULL, FALSE );
212
        GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
213
        if( parent && parent->group )
214
            gtk_window_group_add_window( parent->group, GTK_WINDOW( window ));
215
        gtk_widget_realize( window );
216
        gtk_widget_set_sensitive( window, TRUE );
217
        gtk_grab_add( window );
218
        GIOChannel* channel = g_io_channel_unix_new( fileno( data.file ));
219
        g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data );
220
        g_io_channel_unref( channel );
221
        g_main_loop_run( data.loop );
222
        g_main_loop_unref( data.loop );
223
        gtk_grab_remove( window );
224
        gtk_widget_destroy( window );
225
        }
226
    else
227
        {
228
        data.loop = NULL;
229
        while( kdeReadFunc( NULL, static_cast< GIOCondition >( 0 ), &data ))
230
            ;
231
        }
232
    return data.success;
233
    }
234
235
bool nsKDEUtils::startHelper()
236
    {
237
    if( helperRunning )
238
        return true;
239
    if( helperFailed )
240
        return false;
241
    helperFailed = true;
242
    int fdcommand[ 2 ];
243
    int fdreply[ 2 ];
244
    if( pipe( fdcommand ) < 0 )
245
        return false;
246
    if( pipe( fdreply ) < 0 )
247
        {
248
        close( fdcommand[ 0 ] );
249
        close( fdcommand[ 1 ] );
250
        return false;
251
        }
252
    char* args[ 2 ] = { const_cast< char* >( KMOZILLAHELPER ), NULL };
253
    switch( fork())
254
        {
255
        case -1:
256
            {
257
            close( fdcommand[ 0 ] );
258
            close( fdcommand[ 1 ] );
259
            close( fdreply[ 0 ] );
260
            close( fdreply[ 1 ] );
261
            return false;
262
            }
263
        case 0: // child
264
            {
265
            if( dup2( fdcommand[ 0 ], STDIN_FILENO ) < 0 )
266
                _exit( 1 );
267
            if( dup2( fdreply[ 1 ], STDOUT_FILENO ) < 0 )
268
                _exit( 1 );
269
            int maxfd = 1024; // close all other fds
270
            struct rlimit rl;
271
            if( getrlimit( RLIMIT_NOFILE, &rl ) == 0 )
272
                maxfd = rl.rlim_max;
273
            for( int i = 3;
274
                 i < maxfd;
275
                 ++i )
276
                close( i );
277
#ifdef DEBUG_KDE
278
            execvp( KMOZILLAHELPER, args );
279
#else
280
            execv( KMOZILLAHELPER, args );
281
#endif
282
            _exit( 1 ); // failed
283
            }
284
        default: // parent
285
            {
286
            commandFile = fdopen( fdcommand[ 1 ], "w" );
287
            replyFile = fdopen( fdreply[ 0 ], "r" );
288
            close( fdcommand[ 0 ] );
289
            close( fdreply[ 1 ] );
290
            if( commandFile == NULL || replyFile == NULL )
291
                {
292
                closeHelper();
293
                return false;
294
                }
295
            // ok, helper ready, getKdeRunning() will check if it works
296
            }
297
        }
298
    helperFailed = false;
299
    helperRunning = true;
300
    return true;
301
    }
302
303
void nsKDEUtils::closeHelper()
304
    {
305
    if( commandFile != NULL )
306
        fclose( commandFile ); // this will also make the helper quit
307
    if( replyFile != NULL )
308
        fclose( replyFile );
309
    helperRunning = false;
310
    }
311
312
void nsKDEUtils::feedCommand( const nsCStringArray& command )
313
    {
314
    for( int i = 0;
315
         i < command.Count();
316
         ++i )
317
        {
318
        nsCString line = *command[ i ];
319
        line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape
320
        line.ReplaceSubstring( "\n", "\\n" );
321
#ifdef DEBUG_KDE
322
        fprintf( stderr, "COMM: %s\n", line.get());
323
#endif
324
        fputs( line.get(), commandFile );
325
        fputs( "\n", commandFile );
326
        }
327
    fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data
328
    fflush( commandFile );
329
    }
(-)mozilla/toolkit/xre/nsKDEUtils.h.sav (+77 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 *
3
 * ***** BEGIN LICENSE BLOCK *****
4
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version
7
 * 1.1 (the "License"); you may not use this file except in compliance with
8
 * the License. You may obtain a copy of the License at
9
 * http://www.mozilla.org/MPL/
10
 *
11
 * Software distributed under the License is distributed on an "AS IS" basis,
12
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
 * for the specific language governing rights and limitations under the
14
 * License.
15
 *
16
 * The Original Code is Mozilla Communicator client code.
17
 *
18
 * The Initial Developer of the Original Code is
19
 * Netscape Communications Corporation.
20
 * Portions created by the Initial Developer are Copyright (C) 1998
21
 * the Initial Developer. All Rights Reserved.
22
 *
23
 * Contributor(s):
24
 *
25
 * Alternatively, the contents of this file may be used under the terms of
26
 * either of the GNU General Public License Version 2 or later (the "GPL"),
27
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
29
 * of those above. If you wish to allow use of your version of this file only
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
31
 * use your version of this file under the terms of the MPL, indicate your
32
 * decision by deleting the provisions above and replace them with the notice
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
34
 * the provisions above, a recipient may use your version of this file under
35
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 *
37
 * ***** END LICENSE BLOCK ***** */
38
39
#ifndef nsKDEUtils_h__
40
#define nsKDEUtils_h__
41
42
#include "nsStringGlue.h"
43
#include "nsVoidArray.h"
44
#include <stdio.h>
45
46
typedef struct _GtkWindow GtkWindow;
47
48
class NS_EXPORT nsKDEUtils
49
    {
50
    public:
51
        /* Returns true if running inside a KDE session (regardless of whether there is KDE
52
           support available for Firefox). This should be used e.g. when determining
53
           dialog button order but not for code that requires the KDE support. */
54
        static bool kdeSession();
55
        /* Returns true if running inside a KDE session and KDE support is available
56
           for Firefox. This should be used everywhere where the external helper is needed. */
57
        static bool kdeSupport();
58
        /* Executes the given helper command, returns true if helper returned success. */
59
        static bool command( const nsCStringArray& command, nsCStringArray* output = NULL );
60
        /* Like command(), but additionally blocks the parent widget like if there was
61
           a modal dialog shown and enters the event loop (i.e. there are still paint updates,
62
           this is for commands that take long). */
63
        static bool commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output = NULL );
64
    private:
65
        nsKDEUtils();
66
        ~nsKDEUtils();
67
        static nsKDEUtils* self();
68
        bool startHelper();
69
        void closeHelper();
70
        void feedCommand( const nsCStringArray& command );
71
        bool internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool isParent,
72
            nsCStringArray* output );
73
        FILE* commandFile;
74
        FILE* replyFile;
75
    };
76
77
#endif // nsKDEUtils
(-)mozilla/uriloader/exthandler/Makefile.in.sav (-1 / +2 lines)
Lines 109-116 endif Link Here
109
LOCAL_INCLUDES = -I$(srcdir)
109
LOCAL_INCLUDES = -I$(srcdir)
110
110
111
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
111
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
112
OSHELPER	+= nsGNOMERegistry.cpp
112
OSHELPER	+= nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp
113
OSHELPER  += nsMIMEInfoUnix.cpp
113
OSHELPER  += nsMIMEInfoUnix.cpp
114
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
114
endif
115
endif
115
116
116
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
117
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
(-)mozilla/uriloader/exthandler/unix/nsCommonRegistry.cpp.sav (+87 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is the GNOME helper app implementation.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * IBM Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 2003
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *  Brian Ryner <bryner@brianryner.com>  (Original Author)
24
 *
25
 * Alternatively, the contents of this file may be used under the terms of
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
29
 * of those above. If you wish to allow use of your version of this file only
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
31
 * use your version of this file under the terms of the MPL, indicate your
32
 * decision by deleting the provisions above and replace them with the notice
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
34
 * the provisions above, a recipient may use your version of this file under
35
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 *
37
 * ***** END LICENSE BLOCK ***** */
38
39
#include "nsCommonRegistry.h"
40
41
#include "nsGNOMERegistry.h"
42
#include "nsKDERegistry.h"
43
#include "nsString.h"
44
#include "nsVoidArray.h"
45
#include "nsKDEUtils.h"
46
47
/* static */ PRBool
48
nsCommonRegistry::HandlerExists(const char *aProtocolScheme)
49
{
50
    if( nsKDEUtils::kdeSupport())
51
        return nsKDERegistry::HandlerExists( aProtocolScheme );
52
    return nsGNOMERegistry::HandlerExists( aProtocolScheme );
53
}
54
55
/* static */ nsresult
56
nsCommonRegistry::LoadURL(nsIURI *aURL)
57
{
58
    if( nsKDEUtils::kdeSupport())
59
        return nsKDERegistry::LoadURL( aURL );
60
    return nsGNOMERegistry::LoadURL( aURL );
61
}
62
63
/* static */ void
64
nsCommonRegistry::GetAppDescForScheme(const nsACString& aScheme,
65
                                     nsAString& aDesc)
66
{
67
    if( nsKDEUtils::kdeSupport())
68
        return nsKDERegistry::GetAppDescForScheme( aScheme, aDesc );
69
    return nsGNOMERegistry::GetAppDescForScheme( aScheme, aDesc );
70
}
71
72
73
/* static */ already_AddRefed<nsMIMEInfoBase>
74
nsCommonRegistry::GetFromExtension(const nsACString& aFileExt)
75
{
76
    if( nsKDEUtils::kdeSupport())
77
        return nsKDERegistry::GetFromExtension( aFileExt );
78
    return nsGNOMERegistry::GetFromExtension( aFileExt );
79
}
80
81
/* static */ already_AddRefed<nsMIMEInfoBase>
82
nsCommonRegistry::GetFromType(const nsACString& aMIMEType)
83
{
84
    if( nsKDEUtils::kdeSupport())
85
        return nsKDERegistry::GetFromType( aMIMEType );
86
    return nsGNOMERegistry::GetFromType( aMIMEType );
87
}
(-)mozilla/uriloader/exthandler/unix/nsCommonRegistry.h.sav (+56 lines)
Line 0 Link Here
1
/* ***** BEGIN LICENSE BLOCK *****
2
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
 *
4
 * The contents of this file are subject to the Mozilla Public License Version
5
 * 1.1 (the "License"); you may not use this file except in compliance with
6
 * the License. You may obtain a copy of the License at
7
 * http://www.mozilla.org/MPL/
8
 *
9
 * Software distributed under the License is distributed on an "AS IS" basis,
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
 * for the specific language governing rights and limitations under the
12
 * License.
13
 *
14
 * The Original Code is the GNOME helper app implementation.
15
 *
16
 * The Initial Developer of the Original Code is
17
 * IBM Corporation.
18
 * Portions created by the Initial Developer are Copyright (C) 2003
19
 * the Initial Developer. All Rights Reserved.
20
 *
21
 * Contributor(s):
22
 *  Brian Ryner <bryner@brianryner.com>  (Original Author)
23
 *
24
 * Alternatively, the contents of this file may be used under the terms of
25
 * either the GNU General Public License Version 2 or later (the "GPL"), or
26
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
 * in which case the provisions of the GPL or the LGPL are applicable instead
28
 * of those above. If you wish to allow use of your version of this file only
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
30
 * use your version of this file under the terms of the MPL, indicate your
31
 * decision by deleting the provisions above and replace them with the notice
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 * the provisions above, a recipient may use your version of this file under
34
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 *
36
 * ***** END LICENSE BLOCK ***** */
37
38
#include "nsIURI.h"
39
#include "nsCOMPtr.h"
40
41
class nsMIMEInfoBase;
42
43
class nsCommonRegistry
44
{
45
 public:
46
  static PRBool HandlerExists(const char *aProtocolScheme);
47
48
  static nsresult LoadURL(nsIURI *aURL);
49
50
  static void GetAppDescForScheme(const nsACString& aScheme,
51
                                  nsAString& aDesc);
52
53
  static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt);
54
55
  static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType);
56
};
(-)mozilla/uriloader/exthandler/unix/nsKDERegistry.cpp.sav (+119 lines)
Line 0 Link Here
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is the GNOME helper app implementation.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * IBM Corporation.
19
 * Portions created by the Initial Developer are Copyright (C) 2003
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *  Brian Ryner <bryner@brianryner.com>  (Original Author)
24
 *
25
 * Alternatively, the contents of this file may be used under the terms of
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
29
 * of those above. If you wish to allow use of your version of this file only
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
31
 * use your version of this file under the terms of the MPL, indicate your
32
 * decision by deleting the provisions above and replace them with the notice
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
34
 * the provisions above, a recipient may use your version of this file under
35
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 *
37
 * ***** END LICENSE BLOCK ***** */
38
39
#include "nsKDERegistry.h"
40
#include "prlink.h"
41
#include "prmem.h"
42
#include "nsString.h"
43
#include "nsILocalFile.h"
44
#include "nsMIMEInfoUnix.h"
45
#include "nsAutoPtr.h"
46
#include "nsKDEUtils.h"
47
48
/* static */ PRBool
49
nsKDERegistry::HandlerExists(const char *aProtocolScheme)
50
{
51
    nsCStringArray command;
52
    command.AppendCString( NS_LITERAL_CSTRING( "HANDLEREXISTS" ));
53
    command.AppendCString( nsCAutoString( aProtocolScheme ));
54
    return nsKDEUtils::command( command );
55
}
56
57
/* static */ nsresult
58
nsKDERegistry::LoadURL(nsIURI *aURL)
59
{
60
    nsCStringArray command;
61
    command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
62
    nsCString url;
63
    aURL->GetSpec( url );
64
    command.AppendCString( url );
65
    return nsKDEUtils::command( command );
66
}
67
68
/* static */ void
69
nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme,
70
                                     nsAString& aDesc)
71
{
72
    nsCStringArray command;
73
    command.AppendCString( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" ));
74
    command.AppendCString( aScheme );
75
    nsCStringArray output;
76
    if( nsKDEUtils::command( command, &output ) && output.Count() == 1 )
77
        CopyUTF8toUTF16( *output[ 0 ], aDesc );
78
}
79
80
81
/* static */ already_AddRefed<nsMIMEInfoBase>
82
nsKDERegistry::GetFromExtension(const nsACString& aFileExt)
83
{
84
    NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot");
85
    nsCStringArray command;
86
    command.AppendCString( NS_LITERAL_CSTRING( "GETFROMEXTENSION" ));
87
    command.AppendCString( aFileExt );
88
    return GetFromHelper( command );
89
}
90
91
/* static */ already_AddRefed<nsMIMEInfoBase>
92
nsKDERegistry::GetFromType(const nsACString& aMIMEType)
93
{
94
    nsCStringArray command;
95
    command.AppendCString( NS_LITERAL_CSTRING( "GETFROMTYPE" ));
96
    command.AppendCString( aMIMEType );
97
    return GetFromHelper( command );
98
}
99
100
/* static */ already_AddRefed<nsMIMEInfoBase>
101
nsKDERegistry::GetFromHelper(const nsCStringArray& command)
102
{
103
    nsCStringArray output;
104
    if( nsKDEUtils::command( command, &output ) && output.Count() == 3 )
105
        {
106
        nsCString mimetype = *output[ 0 ];
107
        nsRefPtr<nsMIMEInfoUnix> mimeInfo = new nsMIMEInfoUnix( mimetype );
108
        NS_ENSURE_TRUE(mimeInfo, nsnull);
109
        nsCString description = *output[ 1 ];
110
        mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description));
111
        nsCString handlerAppName = *output[ 2 ];
112
        mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName));
113
        mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
114
        nsMIMEInfoBase* retval;
115
        NS_ADDREF((retval = mimeInfo));
116
        return retval;
117
        }
118
    return nsnull;
119
}
(-)mozilla/uriloader/exthandler/unix/nsKDERegistry.h.sav (+61 lines)
Line 0 Link Here
1
/* ***** BEGIN LICENSE BLOCK *****
2
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
 *
4
 * The contents of this file are subject to the Mozilla Public License Version
5
 * 1.1 (the "License"); you may not use this file except in compliance with
6
 * the License. You may obtain a copy of the License at
7
 * http://www.mozilla.org/MPL/
8
 *
9
 * Software distributed under the License is distributed on an "AS IS" basis,
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
 * for the specific language governing rights and limitations under the
12
 * License.
13
 *
14
 * The Original Code is the GNOME helper app implementation.
15
 *
16
 * The Initial Developer of the Original Code is
17
 * IBM Corporation.
18
 * Portions created by the Initial Developer are Copyright (C) 2003
19
 * the Initial Developer. All Rights Reserved.
20
 *
21
 * Contributor(s):
22
 *  Brian Ryner <bryner@brianryner.com>  (Original Author)
23
 *
24
 * Alternatively, the contents of this file may be used under the terms of
25
 * either the GNU General Public License Version 2 or later (the "GPL"), or
26
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
 * in which case the provisions of the GPL or the LGPL are applicable instead
28
 * of those above. If you wish to allow use of your version of this file only
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
30
 * use your version of this file under the terms of the MPL, indicate your
31
 * decision by deleting the provisions above and replace them with the notice
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 * the provisions above, a recipient may use your version of this file under
34
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 *
36
 * ***** END LICENSE BLOCK ***** */
37
38
#include "nsIURI.h"
39
#include "nsCOMPtr.h"
40
41
class nsMIMEInfoBase;
42
class nsCAutoString;
43
class nsCStringArray;
44
45
class nsKDERegistry
46
{
47
 public:
48
  static PRBool HandlerExists(const char *aProtocolScheme);
49
50
  static nsresult LoadURL(nsIURI *aURL);
51
52
  static void GetAppDescForScheme(const nsACString& aScheme,
53
                                  nsAString& aDesc);
54
55
  static already_AddRefed<nsMIMEInfoBase> GetFromExtension(const nsACString& aFileExt);
56
57
  static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType);
58
 private:
59
  static already_AddRefed<nsMIMEInfoBase> GetFromHelper(const nsCStringArray& command);
60
61
};
(-)mozilla/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp.sav (-5 / +19 lines)
Lines 44-61 Link Here
44
44
45
45
46
#include "nsMIMEInfoUnix.h"
46
#include "nsMIMEInfoUnix.h"
47
#include "nsGNOMERegistry.h"
47
#include "nsCommonRegistry.h"
48
#include "nsIGnomeVFSService.h"
48
#include "nsIGnomeVFSService.h"
49
#ifdef MOZ_ENABLE_DBUS
49
#ifdef MOZ_ENABLE_DBUS
50
#include "nsDBusHandlerApp.h"
50
#include "nsDBusHandlerApp.h"
51
#endif
51
#endif
52
#include "nsAutoPtr.h"
52
#include "nsAutoPtr.h"
53
#include "nsKDEUtils.h"
53
54
54
55
55
nsresult
56
nsresult
56
nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
57
nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
57
{ 
58
{ 
58
  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
59
  nsresult rv = nsCommonRegistry::LoadURL(aURI);
59
#ifdef MOZ_PLATFORM_HILDON
60
#ifdef MOZ_PLATFORM_HILDON
60
  if (NS_FAILED(rv)){
61
  if (NS_FAILED(rv)){
61
    HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
62
    HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
Lines 75-85 NS_IMETHODIMP Link Here
75
nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
76
nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
76
{
77
{
77
  *_retval = PR_FALSE;
78
  *_retval = PR_FALSE;
78
  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mType);
79
  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mType);
79
  if (!mimeInfo) {
80
  if (!mimeInfo) {
80
     nsCAutoString ext;
81
     nsCAutoString ext;
81
     GetPrimaryExtension(ext);
82
     GetPrimaryExtension(ext);
82
     mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
83
     mimeInfo = nsCommonRegistry::GetFromExtension(ext);
83
  }
84
  }
84
85
85
  if (mimeInfo)
86
  if (mimeInfo)
Lines 106-111 nsMIMEInfoUnix::LaunchDefaultWithFile(ns Link Here
106
{
107
{
107
  nsCAutoString nativePath;
108
  nsCAutoString nativePath;
108
  aFile->GetNativePath(nativePath);
109
  aFile->GetNativePath(nativePath);
110
  
111
  if( nsKDEUtils::kdeSupport())
112
      {
113
      nsCStringArray command;
114
      command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
115
      command.AppendCString( nativePath );
116
      if( nsKDEUtils::command( command ))
117
          return NS_OK;
118
      if (!mDefaultApplication)
119
        return NS_ERROR_FILE_NOT_FOUND;
120
121
      return LaunchWithIProcess(mDefaultApplication, nativePath);
122
      }
109
123
110
  nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
124
  nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
111
125
Lines 116-122 nsMIMEInfoUnix::LaunchDefaultWithFile(ns Link Here
116
130
117
    // If we haven't got an app we try to get a valid one by searching for the
131
    // If we haven't got an app we try to get a valid one by searching for the
118
    // extension mapped type
132
    // extension mapped type
119
    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
133
    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
120
    if (mimeInfo) {
134
    if (mimeInfo) {
121
      nsCAutoString type;
135
      nsCAutoString type;
122
      mimeInfo->GetType(type);
136
      mimeInfo->GetType(type);
(-)mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp.sav (-5 / +5 lines)
Lines 44-50 Link Here
44
#include "nsOSHelperAppService.h"
44
#include "nsOSHelperAppService.h"
45
#include "nsMIMEInfoUnix.h"
45
#include "nsMIMEInfoUnix.h"
46
#ifdef MOZ_WIDGET_GTK2
46
#ifdef MOZ_WIDGET_GTK2
47
#include "nsGNOMERegistry.h"
47
#include "nsCommonRegistry.h"
48
#endif
48
#endif
49
#include "nsISupports.h"
49
#include "nsISupports.h"
50
#include "nsString.h"
50
#include "nsString.h"
Lines 1210-1216 nsresult nsOSHelperAppService::OSProtoco Link Here
1210
1210
1211
#ifdef MOZ_WIDGET_GTK2
1211
#ifdef MOZ_WIDGET_GTK2
1212
  // Check the GConf registry for a protocol handler
1212
  // Check the GConf registry for a protocol handler
1213
  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
1213
  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
1214
#endif
1214
#endif
1215
1215
1216
  return NS_OK;
1216
  return NS_OK;
Lines 1219-1225 nsresult nsOSHelperAppService::OSProtoco Link Here
1219
NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
1219
NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
1220
{
1220
{
1221
#ifdef MOZ_WIDGET_GTK2
1221
#ifdef MOZ_WIDGET_GTK2
1222
  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
1222
  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
1223
  return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
1223
  return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
1224
#else
1224
#else
1225
  return NS_ERROR_NOT_AVAILABLE;
1225
  return NS_ERROR_NOT_AVAILABLE;
Lines 1315-1321 nsOSHelperAppService::GetFromExtension(c Link Here
1315
    
1315
    
1316
#ifdef MOZ_WIDGET_GTK2
1316
#ifdef MOZ_WIDGET_GTK2
1317
    LOG(("Looking in GNOME registry\n"));
1317
    LOG(("Looking in GNOME registry\n"));
1318
    nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromExtension(aFileExt).get();
1318
    nsMIMEInfoBase *gnomeInfo = nsCommonRegistry::GetFromExtension(aFileExt).get();
1319
    if (gnomeInfo) {
1319
    if (gnomeInfo) {
1320
      LOG(("Got MIMEInfo from GNOME registry\n"));
1320
      LOG(("Got MIMEInfo from GNOME registry\n"));
1321
      return gnomeInfo;
1321
      return gnomeInfo;
Lines 1441-1447 nsOSHelperAppService::GetFromType(const Link Here
1441
    // get back a MIMEInfo without any extensions set.  In that case we'll have
1441
    // get back a MIMEInfo without any extensions set.  In that case we'll have
1442
    // to look in our mime.types files for the extensions.    
1442
    // to look in our mime.types files for the extensions.    
1443
    LOG(("Looking in GNOME registry\n"));
1443
    LOG(("Looking in GNOME registry\n"));
1444
    gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType).get();
1444
    gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType).get();
1445
    if (gnomeInfo && gnomeInfo->HasExtensions()) {
1445
    if (gnomeInfo && gnomeInfo->HasExtensions()) {
1446
      LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n"));
1446
      LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n"));
1447
      return gnomeInfo;
1447
      return gnomeInfo;
(-)mozilla/widget/src/gtk2/Makefile.in.sav (+2 lines)
Lines 182-187 INCLUDES += \ Link Here
182
		-I$(topsrcdir)/other-licenses/atk-1.0 \
182
		-I$(topsrcdir)/other-licenses/atk-1.0 \
183
		$(NULL)
183
		$(NULL)
184
184
185
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
186
185
test_container: mozdrawingarea.o mozcontainer.o test_container.c
187
test_container: mozdrawingarea.o mozcontainer.o test_container.c
186
	$(CC) $(MOZ_GTK2_CFLAGS) -o test_container test_container.c \
188
	$(CC) $(MOZ_GTK2_CFLAGS) -o test_container test_container.c \
187
		mozdrawingarea.o mozcontainer.o \
189
		mozdrawingarea.o mozcontainer.o \
(-)mozilla/widget/src/gtk2/nsFilePicker.cpp.sav (-1 / +234 lines)
Lines 40-45 Link Here
40
#include <gtk/gtkstock.h>
40
#include <gtk/gtkstock.h>
41
#include <gtk/gtkmessagedialog.h>
41
#include <gtk/gtkmessagedialog.h>
42
#include <gtk/gtkimage.h>
42
#include <gtk/gtkimage.h>
43
#include <gdk/gdkx.h>
43
44
44
#include "nsIFileURL.h"
45
#include "nsIFileURL.h"
45
#include "nsIURI.h"
46
#include "nsIURI.h"
Lines 59-64 Link Here
59
60
60
#include "nsFilePicker.h"
61
#include "nsFilePicker.h"
61
#include "nsAccessibilityHelper.h"
62
#include "nsAccessibilityHelper.h"
63
#include "nsKDEUtils.h"
62
64
63
#define DECL_FUNC_PTR(func) static _##func##_fn _##func
65
#define DECL_FUNC_PTR(func) static _##func##_fn _##func
64
#define GTK_FILE_CHOOSER(widget) ((GtkFileChooser*) widget)
66
#define GTK_FILE_CHOOSER(widget) ((GtkFileChooser*) widget)
Lines 95-100 typedef GtkWidget* (*_gtk_file_chooser_d Link Here
95
                                                      GtkFileChooserAction action,
97
                                                      GtkFileChooserAction action,
96
                                                      const gchar *first_button_text,
98
                                                      const gchar *first_button_text,
97
                                                      ...);
99
                                                      ...);
100
typedef void (*_gtk_dialog_set_alternative_button_order_fn)(GtkDialog *dialog, gint first_response_id, ...);
98
typedef void (*_gtk_file_chooser_set_select_multiple_fn)(GtkFileChooser* chooser, gboolean truth);
101
typedef void (*_gtk_file_chooser_set_select_multiple_fn)(GtkFileChooser* chooser, gboolean truth);
99
typedef void (*_gtk_file_chooser_set_do_overwrite_confirmation_fn)(GtkFileChooser* chooser, gboolean do_confirm);
102
typedef void (*_gtk_file_chooser_set_do_overwrite_confirmation_fn)(GtkFileChooser* chooser, gboolean do_confirm);
100
typedef void (*_gtk_file_chooser_set_current_name_fn)(GtkFileChooser* chooser, const gchar* name);
103
typedef void (*_gtk_file_chooser_set_current_name_fn)(GtkFileChooser* chooser, const gchar* name);
Lines 119-124 DECL_FUNC_PTR(gtk_file_chooser_get_filen Link Here
119
DECL_FUNC_PTR(gtk_file_chooser_get_uri);
122
DECL_FUNC_PTR(gtk_file_chooser_get_uri);
120
DECL_FUNC_PTR(gtk_file_chooser_get_uris);
123
DECL_FUNC_PTR(gtk_file_chooser_get_uris);
121
DECL_FUNC_PTR(gtk_file_chooser_dialog_new);
124
DECL_FUNC_PTR(gtk_file_chooser_dialog_new);
125
DECL_FUNC_PTR(gtk_dialog_set_alternative_button_order);
122
DECL_FUNC_PTR(gtk_file_chooser_set_select_multiple);
126
DECL_FUNC_PTR(gtk_file_chooser_set_select_multiple);
123
DECL_FUNC_PTR(gtk_file_chooser_set_do_overwrite_confirmation);
127
DECL_FUNC_PTR(gtk_file_chooser_set_do_overwrite_confirmation);
124
DECL_FUNC_PTR(gtk_file_chooser_set_current_name);
128
DECL_FUNC_PTR(gtk_file_chooser_set_current_name);
Lines 214-219 nsFilePicker::LoadSymbolsGTK24() Link Here
214
  GET_LIBGTK_FUNC(gtk_file_chooser_get_uri);
218
  GET_LIBGTK_FUNC(gtk_file_chooser_get_uri);
215
  GET_LIBGTK_FUNC(gtk_file_chooser_get_uris);
219
  GET_LIBGTK_FUNC(gtk_file_chooser_get_uris);
216
  GET_LIBGTK_FUNC(gtk_file_chooser_dialog_new);
220
  GET_LIBGTK_FUNC(gtk_file_chooser_dialog_new);
221
  GET_LIBGTK_FUNC(gtk_dialog_set_alternative_button_order);
217
  GET_LIBGTK_FUNC(gtk_file_chooser_set_select_multiple);
222
  GET_LIBGTK_FUNC(gtk_file_chooser_set_select_multiple);
218
  GET_LIBGTK_FUNC_OPT(gtk_file_chooser_set_do_overwrite_confirmation);
223
  GET_LIBGTK_FUNC_OPT(gtk_file_chooser_set_do_overwrite_confirmation);
219
  GET_LIBGTK_FUNC(gtk_file_chooser_set_current_name);
224
  GET_LIBGTK_FUNC(gtk_file_chooser_set_current_name);
Lines 442-448 nsFilePicker::AppendFilter(const nsAStri Link Here
442
{
447
{
443
  if (aFilter.EqualsLiteral("..apps")) {
448
  if (aFilter.EqualsLiteral("..apps")) {
444
    // No platform specific thing we can do here, really....
449
    // No platform specific thing we can do here, really....
445
    return NS_OK;
450
    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
451
        return NS_OK;
446
  }
452
  }
447
453
448
  nsCAutoString filter, name;
454
  nsCAutoString filter, name;
Lines 590-595 confirm_overwrite_file (GtkWidget *paren Link Here
590
NS_IMETHODIMP
596
NS_IMETHODIMP
591
nsFilePicker::Show(PRInt16 *aReturn)
597
nsFilePicker::Show(PRInt16 *aReturn)
592
{
598
{
599
  if( nsKDEUtils::kdeSupport())
600
      return kdeFileDialog( aReturn );
601
593
  NS_ENSURE_ARG_POINTER(aReturn);
602
  NS_ENSURE_ARG_POINTER(aReturn);
594
603
595
  nsXPIDLCString title;
604
  nsXPIDLCString title;
Lines 605-610 nsFilePicker::Show(PRInt16 *aReturn) Link Here
605
                                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
614
                                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
606
                                   accept_button, GTK_RESPONSE_ACCEPT,
615
                                   accept_button, GTK_RESPONSE_ACCEPT,
607
                                   NULL);
616
                                   NULL);
617
618
  _gtk_dialog_set_alternative_button_order(GTK_DIALOG(file_chooser),
619
                                          GTK_RESPONSE_ACCEPT,
620
                                          GTK_RESPONSE_CANCEL,
621
                                          -1);
622
608
  if (mAllowURLs) {
623
  if (mAllowURLs) {
609
    _gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE);
624
    _gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE);
610
  }
625
  }
Lines 727-729 nsFilePicker::Show(PRInt16 *aReturn) Link Here
727
742
728
  return NS_OK;
743
  return NS_OK;
729
}
744
}
745
746
nsCString nsFilePicker::kdeMakeFilter( int index )
747
    {
748
    nsCString buf = *mFilters[ index ];
749
    for( PRUint32 i = 0;
750
         i < buf.Length();
751
         ++i )
752
        if( buf[ i ] == ';' ) // KDE separates just using spaces
753
            buf.SetCharAt( ' ', i );
754
    if (!mFilterNames[index]->IsEmpty())
755
        {
756
        buf += "|";
757
        buf += mFilterNames[index]->get();
758
        }
759
    return buf;
760
    }
761
762
static PRInt32 windowToXid( nsIWidget* widget )
763
    {
764
    GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget );
765
    GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget )));
766
    return GDK_WINDOW_XID( gdk_window );
767
    }
768
769
NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn)
770
    {
771
    NS_ENSURE_ARG_POINTER(aReturn);
772
773
    if( mMode == modeOpen && mFilters.Count() == 1 && mFilters[ 0 ]->EqualsLiteral( "..apps" ))
774
        return kdeAppsDialog( aReturn );
775
776
    nsXPIDLCString title;
777
    title.Adopt(ToNewUTF8String(mTitle));
778
779
    const char* arg = NULL;
780
    if( mAllowURLs )
781
        {
782
        switch( mMode )
783
            {
784
            case nsIFilePicker::modeOpen:
785
            case nsIFilePicker::modeOpenMultiple:
786
                arg = "GETOPENURL";
787
                break;
788
            case nsIFilePicker::modeSave:
789
                arg = "GETSAVEURL";
790
                break;
791
            case nsIFilePicker::modeGetFolder:
792
                arg = "GETDIRECTORYURL";
793
                break;
794
            }
795
        }
796
    else
797
        {
798
        switch( mMode )
799
            {
800
            case nsIFilePicker::modeOpen:
801
            case nsIFilePicker::modeOpenMultiple:
802
                arg = "GETOPENFILENAME";
803
                break;
804
            case nsIFilePicker::modeSave:
805
                arg = "GETSAVEFILENAME";
806
                break;
807
            case nsIFilePicker::modeGetFolder:
808
                arg = "GETDIRECTORYFILENAME";
809
                break;
810
            }
811
        }
812
813
  nsCAutoString directory;
814
  if (mDisplayDirectory) {
815
    mDisplayDirectory->GetNativePath(directory);
816
  } else if (mPrevDisplayDirectory) {
817
    mPrevDisplayDirectory->GetNativePath(directory);
818
  }
819
820
    nsCAutoString startdir;
821
  if (!directory.IsEmpty()) {
822
    startdir = directory;
823
  }
824
  if (mMode == nsIFilePicker::modeSave) {
825
    if( !startdir.IsEmpty())
826
      {
827
      startdir += "/";
828
      startdir += ToNewUTF8String(mDefault);
829
      }
830
    else
831
      startdir = ToNewUTF8String(mDefault);
832
  }
833
  if( startdir.IsEmpty())
834
      startdir = ".";
835
836
    nsCAutoString filters;
837
    PRInt32 count = mFilters.Count();
838
    if( count == 0 ) //just in case
839
        filters = "*";
840
    else
841
        {
842
        filters = kdeMakeFilter( 0 );
843
        for (PRInt32 i = 1; i < count; ++i)
844
            {
845
            filters += "\n";
846
            filters += kdeMakeFilter( i );
847
            }
848
        }
849
850
    nsCStringArray command;
851
    command.AppendCString( nsCAutoString( arg ));
852
    command.AppendCString( startdir );
853
    if( mMode != nsIFilePicker::modeGetFolder )
854
        {
855
        command.AppendCString( filters );
856
        nsCAutoString selected;
857
        selected.AppendInt( mSelectedType );
858
        command.AppendCString( selected );
859
        }
860
    command.AppendCString( title );
861
    if( mMode == nsIFilePicker::modeOpenMultiple )
862
        command.AppendCString( NS_LITERAL_CSTRING( "MULTIPLE" ));
863
    if( PRInt32 xid = windowToXid( mParentWidget ))
864
        {
865
        command.AppendCString( NS_LITERAL_CSTRING( "PARENT" ));
866
        nsCAutoString parent;
867
        parent.AppendInt( xid );
868
        command.AppendCString( parent );
869
        }
870
871
    nsCStringArray output;
872
    if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output ))
873
        {
874
        *aReturn = nsIFilePicker::returnOK;
875
        mFiles.Clear();
876
        if( mMode != nsIFilePicker::modeGetFolder )
877
            {
878
            mSelectedType = atoi( output[ 0 ]->get());
879
            output.RemoveCStringAt( 0 );
880
            }
881
        if (mMode == nsIFilePicker::modeOpenMultiple)
882
            {
883
            mFileURL.Truncate();
884
            PRUint32 count = output.Count();
885
            for( PRUint32 i = 0;
886
                 i < count;
887
                 ++i )
888
                {
889
                nsCOMPtr<nsILocalFile> localfile;
890
                nsresult rv = NS_NewNativeLocalFile( *output[ i ],
891
                                      PR_FALSE,
892
                                      getter_AddRefs(localfile));
893
                if (NS_SUCCEEDED(rv))
894
                    mFiles.AppendObject(localfile);
895
                }
896
            }
897
        else
898
            {
899
            mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString();
900
            }
901
  // Remember last used directory.
902
  nsCOMPtr<nsILocalFile> file;
903
  GetFile(getter_AddRefs(file));
904
  if (file) {
905
    nsCOMPtr<nsIFile> dir;
906
    file->GetParent(getter_AddRefs(dir));
907
    nsCOMPtr<nsILocalFile> localDir(do_QueryInterface(dir));
908
    if (localDir) {
909
      localDir.swap(mPrevDisplayDirectory);
910
    }
911
  }
912
        if (mMode == nsIFilePicker::modeSave)
913
            {
914
            nsCOMPtr<nsILocalFile> file;
915
            GetFile(getter_AddRefs(file));
916
            if (file)
917
                {
918
                PRBool exists = PR_FALSE;
919
                file->Exists(&exists);
920
                if (exists) // TODO do overwrite check in the helper app
921
                    *aReturn = nsIFilePicker::returnReplace;
922
                }
923
            }
924
        }
925
    else
926
        {
927
        *aReturn = nsIFilePicker::returnCancel;
928
        }
929
    return NS_OK;
930
    }
931
932
933
NS_IMETHODIMP nsFilePicker::kdeAppsDialog(PRInt16 *aReturn)
934
    {
935
    NS_ENSURE_ARG_POINTER(aReturn);
936
937
    nsXPIDLCString title;
938
    title.Adopt(ToNewUTF8String(mTitle));
939
940
    nsCStringArray command;
941
    command.AppendCString( NS_LITERAL_CSTRING( "APPSDIALOG" ));
942
    command.AppendCString( title );
943
    if( PRInt32 xid = windowToXid( mParentWidget ))
944
        {
945
        command.AppendCString( NS_LITERAL_CSTRING( "PARENT" ));
946
        nsCAutoString parent;
947
        parent.AppendInt( xid );
948
        command.AppendCString( parent );
949
        }
950
951
    nsCStringArray output;
952
    if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output ))
953
        {
954
        *aReturn = nsIFilePicker::returnOK;
955
        mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString();
956
        }
957
    else
958
        {
959
        *aReturn = nsIFilePicker::returnCancel;
960
        }
961
    return NS_OK;
962
    }
(-)mozilla/widget/src/gtk2/nsFilePicker.h.sav (+6 lines)
Lines 98-103 protected: Link Here
98
private:
98
private:
99
  static nsILocalFile *mPrevDisplayDirectory;
99
  static nsILocalFile *mPrevDisplayDirectory;
100
  static PRLibrary *mGTK24;
100
  static PRLibrary *mGTK24;
101
  
102
  bool kdeRunning();
103
  bool getKdeRunning();
104
  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
105
  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
106
  nsCString kdeMakeFilter( int index );
101
};
107
};
102
108
103
#endif
109
#endif
(-)mozilla/widget/src/gtk2/nsPrintDialogGTK.cpp.sav (+4 lines)
Lines 145-150 ShowCustomDialog(GtkComboBox *changed_bo Link Here
145
                                                         GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
145
                                                         GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
146
                                                         NULL);
146
                                                         NULL);
147
  gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT);
147
  gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT);
148
  gtk_dialog_set_alternative_button_order(GTK_DIALOG(prompt_dialog),
149
                                          GTK_RESPONSE_ACCEPT,
150
                                          GTK_RESPONSE_REJECT,
151
                                          -1);
148
152
149
  printBundle->GetStringFromName(NS_LITERAL_STRING("customHeaderFooterPrompt").get(), getter_Copies(intlString));
153
  printBundle->GetStringFromName(NS_LITERAL_STRING("customHeaderFooterPrompt").get(), getter_Copies(intlString));
150
  GtkWidget* custom_label = gtk_label_new(NS_ConvertUTF16toUTF8(intlString).get());
154
  GtkWidget* custom_label = gtk_label_new(NS_ConvertUTF16toUTF8(intlString).get());
(-)mozilla/xpcom/io/Makefile.in.sav (+1 lines)
Lines 199-201 endif Link Here
199
endif
199
endif
200
200
201
LOCAL_INCLUDES	= -I..
201
LOCAL_INCLUDES	= -I..
202
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
(-)mozilla/xpcom/io/nsLocalFileUnix.cpp.sav (-6 / +24 lines)
Lines 84-89 Link Here
84
84
85
#ifdef MOZ_WIDGET_GTK2
85
#ifdef MOZ_WIDGET_GTK2
86
#include "nsIGnomeVFSService.h"
86
#include "nsIGnomeVFSService.h"
87
#include "nsKDEUtils.h"
87
#endif
88
#endif
88
89
89
#include "nsNativeCharsetUtils.h"
90
#include "nsNativeCharsetUtils.h"
Lines 1666-1681 NS_IMETHODIMP Link Here
1666
nsLocalFile::Reveal()
1667
nsLocalFile::Reveal()
1667
{
1668
{
1668
#ifdef MOZ_WIDGET_GTK2
1669
#ifdef MOZ_WIDGET_GTK2
1669
    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
1670
    nsCAutoString url;
1670
    if (!vfs)
1671
        return NS_ERROR_FAILURE;
1672
1673
    PRBool isDirectory;
1671
    PRBool isDirectory;
1674
    if (NS_FAILED(IsDirectory(&isDirectory)))
1672
    if (NS_FAILED(IsDirectory(&isDirectory)))
1675
        return NS_ERROR_FAILURE;
1673
        return NS_ERROR_FAILURE;
1676
1674
1677
    if (isDirectory) {
1675
    if (isDirectory) {
1678
        return vfs->ShowURIForInput(mPath);
1676
        url = mPath;
1679
    } else {
1677
    } else {
1680
        nsCOMPtr<nsIFile> parentDir;
1678
        nsCOMPtr<nsIFile> parentDir;
1681
        nsCAutoString dirPath;
1679
        nsCAutoString dirPath;
Lines 1684-1691 nsLocalFile::Reveal() Link Here
1684
        if (NS_FAILED(parentDir->GetNativePath(dirPath)))
1682
        if (NS_FAILED(parentDir->GetNativePath(dirPath)))
1685
            return NS_ERROR_FAILURE;
1683
            return NS_ERROR_FAILURE;
1686
1684
1687
        return vfs->ShowURIForInput(dirPath);
1685
        url = dirPath;
1688
    }
1686
    }
1687
1688
    if( nsKDEUtils::kdeSupport()) {
1689
        nsCStringArray command;
1690
        command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
1691
        command.AppendCString( url );
1692
        return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
1693
    }
1694
1695
    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
1696
    if (!vfs)
1697
        return NS_ERROR_FAILURE;
1698
    return vfs->ShowURIForInput(url);
1699
1689
#else
1700
#else
1690
    return NS_ERROR_FAILURE;
1701
    return NS_ERROR_FAILURE;
1691
#endif
1702
#endif
Lines 1695-1700 NS_IMETHODIMP Link Here
1695
nsLocalFile::Launch()
1706
nsLocalFile::Launch()
1696
{
1707
{
1697
#ifdef MOZ_WIDGET_GTK2
1708
#ifdef MOZ_WIDGET_GTK2
1709
    if( nsKDEUtils::kdeSupport()) {
1710
        nsCStringArray command;
1711
        command.AppendCString( NS_LITERAL_CSTRING( "OPEN" ));
1712
        command.AppendCString( mPath );
1713
        return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
1714
    }
1715
1698
    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
1716
    nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
1699
    if (!vfs)
1717
    if (!vfs)
1700
        return NS_ERROR_FAILURE;
1718
        return NS_ERROR_FAILURE;

Return to bug 21511