2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-30 23:23:35 -07:00
|
|
|
|
2011-04-08 01:32:00 -07:00
|
|
|
#include "nsQtNetworkManager.h"
|
2010-08-30 23:23:35 -07:00
|
|
|
#include "nsAutodialQt.h"
|
|
|
|
#include "nsNetCID.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIPrefBranch.h"
|
|
|
|
#include "nsIPrefService.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
nsAutodial::nsAutodial()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutodial::~nsAutodial()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsAutodial::Init()
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2014-01-04 07:02:17 -08:00
|
|
|
nsAutodial::DialDefault(const char16_t* hostName)
|
2010-08-30 23:23:35 -07:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
if (nsQtNetworkManager::get()->openConnection(QString::fromUtf16((const ushort*)hostName))) {
|
2010-08-30 23:23:35 -07:00
|
|
|
return NS_OK;
|
2011-04-08 01:32:00 -07:00
|
|
|
}
|
2010-08-30 23:23:35 -07:00
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2010-08-30 23:23:35 -07:00
|
|
|
nsAutodial::ShouldDialOnNetworkError()
|
|
|
|
{
|
2011-05-07 01:27:13 -07:00
|
|
|
if (nsQtNetworkManager::get()->isOnline()) {
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2011-04-08 01:32:00 -07:00
|
|
|
}
|
2010-08-30 23:23:35 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2010-08-30 23:23:35 -07:00
|
|
|
}
|