netwerk/base/src/nsAutodialQt.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/src/nsAutodialQt.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsQtNetworkManager.h"
     1.9 +#include "nsAutodialQt.h"
    1.10 +#include "nsNetCID.h"
    1.11 +#include "nsCOMPtr.h"
    1.12 +#include "nsIPrefBranch.h"
    1.13 +#include "nsIPrefService.h"
    1.14 +#include "nsIServiceManager.h"
    1.15 +
    1.16 +
    1.17 +nsAutodial::nsAutodial()
    1.18 +{
    1.19 +}
    1.20 +
    1.21 +nsAutodial::~nsAutodial()
    1.22 +{
    1.23 +}
    1.24 +
    1.25 +nsresult
    1.26 +nsAutodial::Init()
    1.27 +{
    1.28 +  return NS_OK;
    1.29 +}
    1.30 +
    1.31 +nsresult
    1.32 +nsAutodial::DialDefault(const char16_t* hostName)
    1.33 +{
    1.34 +  if (nsQtNetworkManager::get()->openConnection(QString::fromUtf16((const ushort*)hostName))) {
    1.35 +    return NS_OK;
    1.36 +  }
    1.37 +
    1.38 +  return NS_ERROR_FAILURE;
    1.39 +}
    1.40 +
    1.41 +bool
    1.42 +nsAutodial::ShouldDialOnNetworkError()
    1.43 +{
    1.44 +  if (nsQtNetworkManager::get()->isOnline()) {
    1.45 +    return false;
    1.46 +  }
    1.47 +
    1.48 +  return true;
    1.49 +}

mercurial