firefox-kde.patch
changeset 739 e178ad08fed6
parent 738 f118b88b7d7f
child 748 72ba5129e5fd
equal deleted inserted replaced
738:f118b88b7d7f 739:e178ad08fed6
  1374      'nsSetDefaultBrowser.manifest',
  1374      'nsSetDefaultBrowser.manifest',
  1375 diff --git a/browser/components/shell/src/nsKDEShellService.cpp b/browser/components/shell/src/nsKDEShellService.cpp
  1375 diff --git a/browser/components/shell/src/nsKDEShellService.cpp b/browser/components/shell/src/nsKDEShellService.cpp
  1376 new file mode 100644
  1376 new file mode 100644
  1377 --- /dev/null
  1377 --- /dev/null
  1378 +++ b/browser/components/shell/src/nsKDEShellService.cpp
  1378 +++ b/browser/components/shell/src/nsKDEShellService.cpp
  1379 @@ -0,0 +1,234 @@
  1379 @@ -0,0 +1,238 @@
  1380 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1380 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1381 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1381 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1382 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1382 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1383 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1383 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1384 +
  1384 +
       
  1385 +#include "mozilla/ArrayUtils.h"
       
  1386 +
       
  1387 +#include "nsCOMPtr.h"
  1385 +#include "nsKDEShellService.h"
  1388 +#include "nsKDEShellService.h"
  1386 +#include "nsShellService.h"
  1389 +#include "nsShellService.h"
  1387 +#include "nsKDEUtils.h"
  1390 +#include "nsKDEUtils.h"
  1388 +#include "nsCOMPtr.h"
       
  1389 +#include "nsIPrefService.h"
  1391 +#include "nsIPrefService.h"
  1390 +#include "nsIProcess.h"
  1392 +#include "nsIProcess.h"
  1391 +#include "nsIFile.h"
  1393 +#include "nsIFile.h"
  1392 +#include "nsServiceManagerUtils.h"
  1394 +#include "nsServiceManagerUtils.h"
  1393 +#include "nsComponentManagerUtils.h"
  1395 +#include "nsComponentManagerUtils.h"
  1394 +#include "nsIMutableArray.h"
  1396 +#include "nsIMutableArray.h"
  1395 +#include "nsISupportsPrimitives.h"
  1397 +#include "nsISupportsPrimitives.h"
  1396 +#include "nsArrayUtils.h"
  1398 +#include "nsArrayUtils.h"
  1397 +
  1399 +
       
  1400 +using namespace mozilla;
       
  1401 +
  1398 +nsresult
  1402 +nsresult
  1399 +nsKDEShellService::Init()
  1403 +nsKDEShellService::Init()
  1400 +    {
  1404 +{
  1401 +    if( !nsKDEUtils::kdeSupport())
  1405 +    if( !nsKDEUtils::kdeSupport())
  1402 +        return NS_ERROR_NOT_AVAILABLE;
  1406 +        return NS_ERROR_NOT_AVAILABLE;
  1403 +    return NS_OK;
  1407 +    return NS_OK;
  1404 +    }
  1408 +}
  1405 +
  1409 +
  1406 +NS_IMPL_ISUPPORTS1(nsKDEShellService, nsIShellService)
  1410 +NS_IMPL_ISUPPORTS(nsKDEShellService, nsIShellService)
  1407 +
  1411 +
  1408 +NS_IMETHODIMP
  1412 +NS_IMETHODIMP
  1409 +nsKDEShellService::IsDefaultBrowser(bool aStartupCheck,
  1413 +nsKDEShellService::IsDefaultBrowser(bool aStartupCheck,
  1410 +                                    bool aForAllTypes,
  1414 +                                    bool aForAllTypes,
  1411 +                                    bool* aIsDefaultBrowser)
  1415 +                                    bool* aIsDefaultBrowser)
  1412 +    {
  1416 +{
  1413 +    *aIsDefaultBrowser = false;
  1417 +    *aIsDefaultBrowser = false;
  1414 +    if (aStartupCheck)
  1418 +    if (aStartupCheck)
  1415 +        mCheckedThisSession = true;
  1419 +        mCheckedThisSession = true;
  1416 +
  1420 +
  1417 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1421 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1426 +    command->AppendElement( str, false );
  1430 +    command->AppendElement( str, false );
  1427 +
  1431 +
  1428 +    if( nsKDEUtils::command( command ))
  1432 +    if( nsKDEUtils::command( command ))
  1429 +        *aIsDefaultBrowser = true;
  1433 +        *aIsDefaultBrowser = true;
  1430 +    return NS_OK;
  1434 +    return NS_OK;
  1431 +    }
  1435 +}
  1432 +
  1436 +
  1433 +NS_IMETHODIMP
  1437 +NS_IMETHODIMP
  1434 +nsKDEShellService::SetDefaultBrowser(bool aClaimAllTypes,
  1438 +nsKDEShellService::SetDefaultBrowser(bool aClaimAllTypes,
  1435 +                                     bool aForAllUsers)
  1439 +                                     bool aForAllUsers)
  1436 +    {
  1440 +{
  1437 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1441 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1438 +    if (!command)
  1442 +    if (!command)
  1439 +        return NS_ERROR_FAILURE;
  1443 +        return NS_ERROR_FAILURE;
  1440 +
  1444 +
  1441 +    nsCOMPtr<nsISupportsCString> cmdstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
  1445 +    nsCOMPtr<nsISupportsCString> cmdstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
  1448 +
  1452 +
  1449 +    paramstr->SetData( aClaimAllTypes ? NS_LITERAL_CSTRING( "ALLTYPES" ) : NS_LITERAL_CSTRING( "NORMAL" ));
  1453 +    paramstr->SetData( aClaimAllTypes ? NS_LITERAL_CSTRING( "ALLTYPES" ) : NS_LITERAL_CSTRING( "NORMAL" ));
  1450 +    command->AppendElement( paramstr, false );
  1454 +    command->AppendElement( paramstr, false );
  1451 +
  1455 +
  1452 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  1456 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  1453 +    }
  1457 +}
  1454 +
  1458 +
  1455 +NS_IMETHODIMP
  1459 +NS_IMETHODIMP
  1456 +nsKDEShellService::GetShouldCheckDefaultBrowser(bool* aResult)
  1460 +nsKDEShellService::GetShouldCheckDefaultBrowser(bool* aResult)
  1457 +{
  1461 +{
  1458 +  // If we've already checked, the browser has been started and this is a
  1462 +  // If we've already checked, the browser has been started and this is a
  1495 +}
  1499 +}
  1496 +
  1500 +
  1497 +NS_IMETHODIMP
  1501 +NS_IMETHODIMP
  1498 +nsKDEShellService::SetDesktopBackground(nsIDOMElement* aElement,
  1502 +nsKDEShellService::SetDesktopBackground(nsIDOMElement* aElement,
  1499 +                                          PRInt32 aPosition)
  1503 +                                          PRInt32 aPosition)
  1500 +    {
  1504 +{
  1501 +    return NS_ERROR_NOT_IMPLEMENTED;
  1505 +    return NS_ERROR_NOT_IMPLEMENTED;
  1502 +    }
  1506 +}
  1503 +
  1507 +
  1504 +NS_IMETHODIMP
  1508 +NS_IMETHODIMP
  1505 +nsKDEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
  1509 +nsKDEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
  1506 +    {
  1510 +{
  1507 +    return NS_ERROR_NOT_IMPLEMENTED;
  1511 +    return NS_ERROR_NOT_IMPLEMENTED;
  1508 +    }
  1512 +}
  1509 +
  1513 +
  1510 +NS_IMETHODIMP
  1514 +NS_IMETHODIMP
  1511 +nsKDEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
  1515 +nsKDEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
  1512 +    {
  1516 +{
  1513 +    return NS_ERROR_NOT_IMPLEMENTED;
  1517 +    return NS_ERROR_NOT_IMPLEMENTED;
  1514 +    }
  1518 +}
  1515 +
  1519 +
  1516 +NS_IMETHODIMP
  1520 +NS_IMETHODIMP
  1517 +nsKDEShellService::OpenApplication(PRInt32 aApplication)
  1521 +nsKDEShellService::OpenApplication(PRInt32 aApplication)
  1518 +    {
  1522 +{
  1519 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1523 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1520 +    if (!command)
  1524 +    if (!command)
  1521 +        return NS_ERROR_FAILURE;
  1525 +        return NS_ERROR_FAILURE;
  1522 +
  1526 +
  1523 +    nsCOMPtr<nsISupportsCString> str = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
  1527 +    nsCOMPtr<nsISupportsCString> str = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
  1531 +    else
  1535 +    else
  1532 +        return NS_ERROR_NOT_IMPLEMENTED;
  1536 +        return NS_ERROR_NOT_IMPLEMENTED;
  1533 +
  1537 +
  1534 +    command->AppendElement( str, false );
  1538 +    command->AppendElement( str, false );
  1535 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  1539 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  1536 +    }
  1540 +}
  1537 +
  1541 +
  1538 +NS_IMETHODIMP
  1542 +NS_IMETHODIMP
  1539 +nsKDEShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI)
  1543 +nsKDEShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI)
  1540 +    {
  1544 +{
  1541 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1545 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1542 +    if (!command)
  1546 +    if (!command)
  1543 +        return NS_ERROR_FAILURE;
  1547 +        return NS_ERROR_FAILURE;
  1544 +
  1548 +
  1545 +    nsCOMPtr<nsISupportsCString> cmdstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
  1549 +    nsCOMPtr<nsISupportsCString> cmdstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
  1556 +    appstr->SetData( app );
  1560 +    appstr->SetData( app );
  1557 +    command->AppendElement( appstr, false );
  1561 +    command->AppendElement( appstr, false );
  1558 +    uristr->SetData( aURI );
  1562 +    uristr->SetData( aURI );
  1559 +    command->AppendElement( uristr, false );
  1563 +    command->AppendElement( uristr, false );
  1560 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  1564 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  1561 +    }
  1565 +}
  1562 +
  1566 +
  1563 +NS_IMETHODIMP
  1567 +NS_IMETHODIMP
  1564 +nsKDEShellService::GetDefaultFeedReader(nsIFile** _retval)
  1568 +nsKDEShellService::GetDefaultFeedReader(nsIFile** _retval)
  1565 +    {
  1569 +{
  1566 +    *_retval = nullptr;
  1570 +    *_retval = nullptr;
  1567 +
  1571 +
  1568 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1572 +    nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
  1569 +    if( !command )
  1573 +    if( !command )
  1570 +        return NS_ERROR_FAILURE;
  1574 +        return NS_ERROR_FAILURE;
  1608 +    if (!exists)
  1612 +    if (!exists)
  1609 +        return NS_ERROR_FAILURE;
  1613 +        return NS_ERROR_FAILURE;
  1610 +
  1614 +
  1611 +    NS_ADDREF(*_retval = defaultReader);
  1615 +    NS_ADDREF(*_retval = defaultReader);
  1612 +    return NS_OK;
  1616 +    return NS_OK;
  1613 +    }
  1617 +}
  1614 diff --git a/browser/components/shell/src/nsKDEShellService.h b/browser/components/shell/src/nsKDEShellService.h
  1618 diff --git a/browser/components/shell/src/nsKDEShellService.h b/browser/components/shell/src/nsKDEShellService.h
  1615 new file mode 100644
  1619 new file mode 100644
  1616 --- /dev/null
  1620 --- /dev/null
  1617 +++ b/browser/components/shell/src/nsKDEShellService.h
  1621 +++ b/browser/components/shell/src/nsKDEShellService.h
  1618 @@ -0,0 +1,59 @@
  1622 @@ -0,0 +1,60 @@
  1619 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1623 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1620 +/* ***** BEGIN LICENSE BLOCK *****
  1624 +/* ***** BEGIN LICENSE BLOCK *****
  1621 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  1625 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  1622 + *
  1626 + *
  1623 + * The contents of this file are subject to the Mozilla Public License Version
  1627 + * The contents of this file are subject to the Mozilla Public License Version
  1655 +#ifndef nskdeshellservice_h____
  1659 +#ifndef nskdeshellservice_h____
  1656 +#define nskdeshellservice_h____
  1660 +#define nskdeshellservice_h____
  1657 +
  1661 +
  1658 +#include "nsIShellService.h"
  1662 +#include "nsIShellService.h"
  1659 +#include "nsStringAPI.h"
  1663 +#include "nsStringAPI.h"
  1660 +
  1664 +#include "mozilla/Attributes.h"
  1661 +class nsKDEShellService : public nsIShellService
  1665 +
       
  1666 +class nsKDEShellService MOZ_FINAL : public nsIShellService
  1662 +{
  1667 +{
  1663 +public:
  1668 +public:
  1664 +  nsKDEShellService() : mCheckedThisSession(PR_FALSE) { }
  1669 +  nsKDEShellService() : mCheckedThisSession(false) { }
  1665 +
  1670 +
  1666 +  NS_DECL_ISUPPORTS
  1671 +  NS_DECL_ISUPPORTS
  1667 +  NS_DECL_NSISHELLSERVICE
  1672 +  NS_DECL_NSISHELLSERVICE
  1668 +
  1673 +
  1669 +  nsresult Init() NS_HIDDEN;
  1674 +  nsresult Init() NS_HIDDEN;
  1670 +
  1675 +
  1671 +private:
  1676 +private:
  1672 +  ~nsKDEShellService() {}
  1677 +  ~nsKDEShellService() {}
  1673 +
  1678 +
  1674 +  PRPackedBool mCheckedThisSession;
  1679 +  bool mCheckedThisSession;
  1675 +};
  1680 +};
  1676 +
  1681 +
  1677 +#endif // nskdeshellservice_h____
  1682 +#endif // nskdeshellservice_h____
  1678 diff --git a/browser/components/shell/src/nsUnixShellService.cpp b/browser/components/shell/src/nsUnixShellService.cpp
  1683 diff --git a/browser/components/shell/src/nsUnixShellService.cpp b/browser/components/shell/src/nsUnixShellService.cpp
  1679 new file mode 100644
  1684 new file mode 100644