예제 #1
0
void ClientProxy::setCSyncProxy( const QUrl& url, CSYNC *csync_ctx )
{
#ifdef USE_NEON
    /* Store proxy */
    QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QNetworkProxyQuery(url));
    // We set at least one in Application
    Q_ASSERT(proxies.count() > 0);
    if (proxies.count() == 0) {
        qDebug() << Q_FUNC_INFO << "No proxy!";
        return;
    }
    QNetworkProxy proxy = proxies.first();
    if (proxy.type() == QNetworkProxy::NoProxy) {
        qDebug() << "Passing NO proxy to csync for" << url.toString();
    } else {
        qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
                 << " to csync for" << url.toString();
    }

    csync_set_module_property( csync_ctx, "proxy_type", (void*)(proxyTypeToCStr(proxy.type())));
    csync_set_module_property( csync_ctx, "proxy_host", proxy.hostName().toUtf8().data());
    int proxy_port         = proxy.port();
    csync_set_module_property( csync_ctx, "proxy_port", &proxy_port );
    csync_set_module_property( csync_ctx, "proxy_user", proxy.user().toUtf8().data());
    csync_set_module_property( csync_ctx, "proxy_pwd",  proxy.password().toUtf8().data());
#else
    Q_UNUSED(url);
    Q_UNUSED(csync_ctx);
#endif
}
예제 #2
0
void ClientProxy::setCSyncProxy( const QUrl& url, CSYNC *csync_ctx )
{
    /* Store proxy */
    QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QNetworkProxyQuery(url));
    // We set at least one in Application
    Q_ASSERT(proxies.count() > 0);
    QNetworkProxy proxy = proxies.first();
    if (proxy.type() == QNetworkProxy::NoProxy) {
        qDebug() << "Passing NO proxy to csync for" << url.toString();
    } else {
        qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
                 << " to csync for" << url.toString();
    }

    const char *proxy_type = proxyTypeToCStr(proxy.type());
    const char* proxy_host = proxy.hostName().toUtf8().data();
    int proxy_port         = proxy.port();
    const char *proxy_user = proxy.user().toUtf8().data();
    const char *proxy_pwd  = proxy.password().toUtf8().data();

    csync_set_module_property( csync_ctx, "proxy_type", (void*)proxy_type );
    csync_set_module_property( csync_ctx, "proxy_host", (void*)proxy_host );
    csync_set_module_property( csync_ctx, "proxy_port", (void*)&proxy_port );
    csync_set_module_property( csync_ctx, "proxy_user", (void*)proxy_user );
    csync_set_module_property( csync_ctx, "proxy_pwd",  (void*)proxy_pwd );

}
예제 #3
0
/** Slot connected to proxy authentication required */
void HttpDownloaderPrivate::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
{
    LOG("Proxy authentication required: " +  proxy.hostName());
    const QString &host = proxy.hostName();
    m_AuthTimes.insert(host, m_AuthTimes.value(host, 0) + 1);
    if (m_AuthTimes.value(host) > MAX_AUTHENTIFICATION_TRIES) {
        LOG_ERROR("Proxy authentication max tries achieved. " +  host);
        return;
    }
    if (!proxy.user().isEmpty() && !proxy.password().isEmpty()) {
        authenticator->setUser(proxy.user());
        authenticator->setPassword(proxy.password());
    } else {
        // Ask user for identification
        Utils::BasicLoginDialog dlg;
        dlg.setModal(true);
        dlg.setTitle(tr("Proxy authentication required"));
        // TODO: manage icon
//        dlg.setToggleViewIcon(core().icon(ICONEYES));
        if (dlg.exec()==QDialog::Accepted) {
            authenticator->setUser(dlg.login());
            authenticator->setPassword(dlg.password());
        }
    }
    // TODO: manage ServerEngineStatus here
}
예제 #4
0
void ownCloudFolder::setProxy()
{
    if( _csync_ctx ) {
        /* Store proxy */
        QUrl proxyUrl(ownCloudInfo::instance()->webdavUrl());
        QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(proxyUrl);
        // We set at least one in Application
        Q_ASSERT(proxies.count() > 0);
        QNetworkProxy proxy = proxies.first();
        if (proxy.type() == QNetworkProxy::NoProxy) {
            qDebug() << "Passing NO proxy to csync for" << proxyUrl;
        } else {
            qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
                     << " to csync for" << proxyUrl;
        }
        int proxyPort = proxy.port();

        csync_set_module_property(_csync_ctx, "proxy_type", (char*) proxyTypeToCStr(proxy.type()) );
        csync_set_module_property(_csync_ctx, "proxy_host", proxy.hostName().toUtf8().data() );
        csync_set_module_property(_csync_ctx, "proxy_port", &proxyPort );
        csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data()     );
        csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() );

        csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx);
    }
}
void ProxyPreferencesWidget::autoDetectProxy()
{
    LOG("Trying to find system proxy.");
    QNetworkProxy proxy;
//    QNetworkProxyFactory::setUseSystemConfiguration(true);
    QNetworkProxyQuery npq(QUrl("http://www.google.com"));
    QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
    foreach(const QNetworkProxy &p, listOfProxies) {
        if (p.type()==QNetworkProxy::HttpProxy && !p.hostName().isEmpty()) {
            LOG("Using proxy " + p.hostName());
            proxy = p;
            break;
        }
    }

    if (proxy.hostName().isEmpty()) {
        ui->proxyHostName->clear();
        ui->proxyPort->setValue(0);
        ui->proxyUserName->clear();
        ui->proxyUserPassword->clear();
    } else {
        ui->proxyHostName->setText(proxy.hostName());
        ui->proxyPort->setValue(proxy.port());
        ui->proxyUserName->setText(proxy.user());
        ui->proxyUserPassword->setText(proxy.password());
    }
}
예제 #6
0
void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
{
    QWidget *mainWindow = Gui::getMainWindow();

    QDialog dialog(mainWindow);
    dialog.setWindowFlags(Qt::Sheet);

    Ui_DlgAuthorization proxyDialog;
    proxyDialog.setupUi(&dialog);
    dialog.adjustSize();

    QString introMessage = tr("<qt>Connect to proxy \"%1\" using:</qt>");
#if QT_VERSION >= 0x050000
    introMessage = introMessage.arg(QString(proxy.hostName()).toHtmlEscaped());
#else
    introMessage = introMessage.arg(Qt::escape(proxy.hostName()));
#endif
    proxyDialog.siteDescription->setText(introMessage);
    proxyDialog.siteDescription->setWordWrap(true);

    if (dialog.exec() == QDialog::Accepted) {
        auth->setUser(proxyDialog.username->text());
        auth->setPassword(proxyDialog.password->text());
    }
}
예제 #7
0
QString Phantom::proxy()
{
    QNetworkProxy proxy = QNetworkProxy::applicationProxy();
    if (proxy.hostName().isEmpty()) {
        return NULL;
    }
    return proxy.hostName() + ":" + QString::number(proxy.port());
}
예제 #8
0
void FileDownloader::setProxy(QNetworkProxy proxy) {
	http->abort();
	http->setProxy(proxy);

	qDebug("FileDownloader::setProxy: host: '%s' port: %d type: %d",
           proxy.hostName().toUtf8().constData(), proxy.port(), proxy.type());
}
예제 #9
0
 void MapNetwork::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
 {
     qDebug() << "Proxy Aut req" << proxy.hostName() << &authenticator;
     QDialog dialog;
     QGridLayout layout;
     QLabel username, password;
     username.setText("Username:"******"Password:"******"OK");
     connect(&button, SIGNAL(clicked()), &dialog, SLOT(accept()));
     layout.addWidget(&button, 2, 0, 1, 2, Qt::AlignCenter);
     dialog.setLayout(&layout);
     dialog.exec();
     authenticator->setUser(user.text());
     authenticator->setPassword(pass.text());
 }
예제 #10
0
void PaymentServer::initNetManager()
{
    if (!optionsModel)
        return;
    delete netManager;

    // netManager is used to fetch paymentrequests given in bitcoin: URIs
    netManager = new QNetworkAccessManager(this);

    QNetworkProxy proxy;

    // Query active SOCKS5 proxy
    if (optionsModel->getProxySettings(proxy)) {
        netManager->setProxy(proxy);

        qDebug() << "PaymentServer::initNetManager: Using SOCKS5 proxy" << proxy.hostName() << ":" << proxy.port();
    }
    else
        qDebug() << "PaymentServer::initNetManager: No active proxy server found.";

    connect(netManager, SIGNAL(finished(QNetworkReply*)),
            this, SLOT(netRequestFinished(QNetworkReply*)));
    connect(netManager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)),
            this, SLOT(reportSslErrors(QNetworkReply*, const QList<QSslError> &)));
}
예제 #11
0
void PatMainWindow::setRubyProxyEnvironment(const QNetworkProxy &t_proxy)
{
  OS_ASSERT(t_proxy.type() == QNetworkProxy::NoProxy || t_proxy.type() == QNetworkProxy::HttpProxy);

  if (t_proxy.type() == QNetworkProxy::NoProxy)
  {
    LOG(Info, "Clearing proxy environment variables");
    bool set = qputenv("HTTP_PROXY", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_USER", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_PASS", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_USER", QByteArray());
    OS_ASSERT(set);
    set = qputenv("HTTP_PASS", QByteArray());
    OS_ASSERT(set);
  } else if (t_proxy.type() == QNetworkProxy::HttpProxy) {
    LOG(Info, "Clearing proxy environment variables");
    QUrl urlsimple;
    urlsimple.setHost(t_proxy.hostName());
    urlsimple.setPort(t_proxy.port());
    urlsimple.setScheme("http");
    bool set = qputenv("HTTP_PROXY", urlsimple.toString().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_USER", t_proxy.user().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_PROXY_PASS", t_proxy.password().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_USER", t_proxy.user().toLatin1());
    OS_ASSERT(set);
    set = qputenv("HTTP_PASS", t_proxy.password().toLatin1());
    OS_ASSERT(set);
  }
}
예제 #12
0
파일: proxy.cpp 프로젝트: grumpy-irc/grumpy
void Proxy::Init()
{
    if (CONF->UsingProxy())
    {
        QNetworkProxy ps = CONF->GetProxy();
        SetProxy(CONF->ProxyType(), ps.hostName(), ps.port(), ps.user(), ps.password());
    }
}
		void save()
		{
			QNetworkProxy proxy = QNetworkProxy::applicationProxy();
			Config::setValue("/Network/Proxy/Type", proxy.type());
			Config::setValue("/Network/Proxy/HostName", proxy.hostName());
			Config::setValue("/Network/Proxy/Port", proxy.port());
			Config::setValue("/Network/Proxy/User", proxy.user());
			Config::setValue("/Network/Proxy/Password", proxy.password());
		}
예제 #14
0
void connection::setCurrentProxy(QNetworkProxy &proxyToCopy)
{
	currentProxy.setType(proxyToCopy.type());
	currentProxy.setHostName(proxyToCopy.hostName());
	currentProxy.setPort(proxyToCopy.port());
	currentProxy.setUser(proxyToCopy.user());
	currentProxy.setPassword(proxyToCopy.password());
	
}
예제 #15
0
void SslTlsSocket::delayedStart()
{
    QSslSocket *sock = qobject_cast<QSslSocket *>(d);
    Q_ASSERT(sock);

    switch (m_proxySettings) {
    case Streams::ProxySettings::RespectSystemProxy:
    {
        QNetworkProxy setting;
        QNetworkProxyQuery query = QNetworkProxyQuery(host, port, m_protocolTag, QNetworkProxyQuery::TcpSocket);

        // set to true if a capable setting is found
        bool capableSettingFound = false;

        // set to true if at least one valid setting is found
        bool settingFound = false;

        // FIXME: this static function works particularly slow in Windows
        QList<QNetworkProxy> proxySettingsList = QNetworkProxyFactory::systemProxyForQuery(query);

        /* Proxy Settings are read from the user's environment variables by the above static method.
         * A peculiar case is with *nix systems, where an undefined environment variable is returned as
         * an empty string. Such entries *might* exist in our proxySettingsList, and shouldn't be processed.
         * One good check is to use hostName() of the QNetworkProxy object, and treat the Proxy Setting as invalid if
         * the host name is empty. */
        Q_FOREACH (setting, proxySettingsList) {
            if (!setting.hostName().isEmpty()) {
                settingFound = true;

                // now check whether setting has capabilities
                if (setting.capabilities().testFlag(QNetworkProxy::TunnelingCapability)) {
                    sock->setProxy(setting);
                    capableSettingFound = true;
                    break;
                }
            }
        }

        if (!settingFound || proxySettingsList.isEmpty()) {
            sock->setProxy(QNetworkProxy::NoProxy);
        } else if (!capableSettingFound) {
            emit disconnected(tr("The underlying socket is having troubles when processing connection to %1:%2: %3")
                              .arg(host, QString::number(port), QStringLiteral("Cannot find proxy setting capable of tunneling")));
        }
        break;
    }
    case Streams::ProxySettings::DirectConnect:
        sock->setProxy(QNetworkProxy::NoProxy);
        break;
    }

    if (startEncrypted)
        sock->connectToHostEncrypted(host, port);
    else
        sock->connectToHost(host, port);
}
void PackageManagerProxyFactory::setProxyCredentials(const QNetworkProxy &proxy,
                                                     const QString &user,
                                                     const QString &password)
{
    auto p = std::find_if(m_proxyCredentials.begin(), m_proxyCredentials.end(),
                          FindProxyCredential(proxy.hostName(), proxy.port()));

    if (p == m_proxyCredentials.end()) {
        ProxyCredential proxyCredential;
        proxyCredential.host = proxy.hostName();
        proxyCredential.port = proxy.port();
        proxyCredential.user = user;
        proxyCredential.password = password;
        m_proxyCredentials.append(proxyCredential);
    } else {
        p->user = user;
        p->password = password;
    }
}
예제 #17
0
void FindSubtitlesWindow::setProxy(QNetworkProxy proxy) {
	downloader->abort();
	downloader->setProxy(proxy);

#ifdef DOWNLOAD_SUBS
	file_downloader->setProxy(proxy);
#endif

	qDebug("FindSubtitlesWindow::setProxy: host: '%s' port: %d type: %d",
           proxy.hostName().toUtf8().constData(), proxy.port(), proxy.type());
}
예제 #18
0
void EnrichmentDialog::initEditorPage()
{
	http = new QHttp(this);
    connect(http, SIGNAL(done(bool)), this, SLOT(updateForm(bool)));
    http->setHost("mathtran.org");
	QNetworkProxy proxy = QNetworkProxy::applicationProxy();
	if (!proxy.hostName().isEmpty())
		http->setProxy(proxy.hostName(), proxy.port(), proxy.user(), proxy.password());

	compileProcess = NULL;
	dvipngProcess = NULL;

	editPage = new QWidget();

    equationEditor = new QTextEdit;

	texFormatButtons = new TextFormatButtons(equationEditor, TextFormatButtons::Equation);

	texCompilerBox = new QComboBox;
	texCompilerBox->addItem(tr("MathTran (http://www.mathtran.org/)"));
	texCompilerBox->addItem(tr("locally installed"));
	if (d_app)
		texCompilerBox->setCurrentIndex(d_app->d_latex_compiler);
	connect(texCompilerBox, SIGNAL(activated(int)), this, SLOT(updateCompilerInterface(int)));

	QHBoxLayout *hl = new QHBoxLayout;
	hl->addWidget(new QLabel(tr("LaTeX Compiler")));
	hl->addWidget(texCompilerBox);

	outputLabel = new QLabel;
    outputLabel->setFrameShape(QFrame::StyledPanel);

	QVBoxLayout *layout = new QVBoxLayout(editPage);
    layout->addWidget(equationEditor, 1);
	layout->addWidget(texFormatButtons);
	layout->addLayout(hl);
	layout->addWidget(new QLabel(tr("Preview:")));
	layout->addWidget(outputLabel);

	tabWidget->addTab(editPage, tr("&Text" ));
}
예제 #19
0
void NetworkManager::handleProxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
{
	if (NetworkManagerFactory::isUsingSystemProxyAuthentication())
	{
		authenticator->setUser(QString());

		return;
	}

	AuthenticationDialog dialog(QUrl(proxy.hostName()), authenticator, SessionsManager::getActiveWindow());
	dialog.exec();
}
예제 #20
0
void HTTPTransportTest::testSetProperty()
{
    HTTPTransport transport;
    transport.setProperty("foo", "bar");
    QString proxyHost("http://foo.bar.net");
    transport.setProperty(HTTPNUMBEROFRESENDATTEMPTSPROP, "10");
    transport.setProperty(HTTPPROXYHOSTPROP, proxyHost);
    transport.setProperty(HTTPPROXYPORTPROP, "5555");

    QNetworkProxy proxy = transport.getProxyConfig();
    QCOMPARE(proxy.hostName(), proxyHost);
    QCOMPARE(proxy.port(), (quint16)5555);
}
예제 #21
0
void HTTPTransportTest::testSetProxy()
{
    HTTPTransport transport;
    QNetworkProxy proxy;
    QString proxyHost("http://foo.bar.net");
    quint16 port = 5555;
    proxy.setHostName(proxyHost);
    proxy.setPort(port);
    transport.setProxyConfig(proxy);

    proxy = transport.getProxyConfig();
    QCOMPARE(proxy.hostName(), proxyHost);
    QCOMPARE(proxy.port(), port);
}
예제 #22
0
void    Credentials::handleCredentials(const QNetworkProxy& proxy,
                                       QAuthenticator* auth)
{
  const QStringList credentials = getCredentials(proxy.hostName());
#ifndef QT_NO_DEBUG
  qDebug() << "[Credentials::handleCredentials]"
	   << "credentials size:" << credentials.size();
#endif
  if (credentials.size() == 2)
    {
      auth->setUser(credentials.at(0));
      auth->setPassword(credentials.at(1));
    }
}
예제 #23
0
/*!
  \brief Gets called when the current proxy requires authentication.

  If the user defined a custom proxy and supplied it with credentials, we
  silently use those, otherwise we show a little proxy authentication dialog.

  \param[in]  proxy         The proxy causing trouble.
  \param[out] authenticator Use this object to supply credentials to the proxy.
*/
void
Steam::doProxyAuthenticationRequired( const QNetworkProxy &proxy,
                                      QAuthenticator *authenticator )
{
  QString name = proxy.hostName();
  QString login = Settings::Instance()->proxyLogin();
  QString password = Settings::Instance()->proxyPassword();

  if( ! login.isEmpty() && ! password.isEmpty() )
  {
    authenticator->setUser( login );
    authenticator->setPassword( password );
    return;
  }
}
예제 #24
0
파일: updateapp.cpp 프로젝트: avary/QtAdb
void UpdateApp::proxyAuthenticationRequired ( const QNetworkProxy & proxy, QAuthenticator * authenticator )
{
    LoginDialog * login = new LoginDialog();

    login->setMessage(proxy.hostName());

    if (login->exec() == LoginDialog::Accepted)
    {
        authenticator->setPassword(login->password());

        authenticator->setUser(login->user());
    }

    delete login;
}
예제 #25
0
void ThunderCore::loadSettings()
{
    QSettings settings;
    settings.beginGroup("Proxy");

    if (settings.value("ProxyEnabled", false).toBool())
    {
        QNetworkProxy proxy;
        proxy.setUser(settings.value("User").toString());
        proxy.setPassword(settings.value("Cred").toString());
        proxy.setHostName(settings.value("Server").toString());

        error (tr("Proxy %1 is enabled.").arg(proxy.hostName()), Info);
        tc_nam->setProxy(proxy);
    }

}
예제 #26
0
NetworkSettingsDialog::NetworkSettingsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NetworkSettingsDialog)
{
    ui->setupUi(this);
    QValidator *val = new QIntValidator(this);
    ui->proxyportEdit->setValidator(val);

    QNetworkProxy proxy = QNetworkProxy::applicationProxy();

    if (proxy.type() != proxy.NoProxy)
    {
        ui->proxyhostEdit->setText(proxy.hostName());
        ui->proxyportEdit->setText(QString::number(proxy.port()));
        ui->proxyuserEdit->setText(proxy.user());
        ui->proxypassEdit->setText(proxy.password());
    }
}
QList<QNetworkProxy> PackageManagerProxyFactory::queryProxy(const QNetworkProxyQuery &query)
{
    const Settings &settings = m_core->settings();
    QList<QNetworkProxy> list;

    if (settings.proxyType() == Settings::SystemProxy) {
        QList<QNetworkProxy> systemProxies = systemProxyForQuery(query);

        auto proxyIter = systemProxies.begin();
        for (; proxyIter != systemProxies.end(); ++proxyIter) {
            QNetworkProxy &proxy = *proxyIter;
            auto p = std::find_if(m_proxyCredentials.constBegin(), m_proxyCredentials.constEnd(),
                                  FindProxyCredential(proxy.hostName(), proxy.port()));
            if (p != m_proxyCredentials.constEnd()) {
                proxy.setUser(p->user);
                proxy.setPassword(p->password);
            }
        }
        return systemProxies;
    }

    if ((settings.proxyType() == Settings::NoProxy))
        return list << QNetworkProxy(QNetworkProxy::NoProxy);

    if (query.queryType() == QNetworkProxyQuery::UrlRequest) {
        QNetworkProxy proxy;
        if (query.url().scheme() == QLatin1String("ftp")) {
            proxy = settings.ftpProxy();
        } else if (query.url().scheme() == QLatin1String("http")
                 || query.url().scheme() == QLatin1String("https")) {
            proxy = settings.httpProxy();
        }


        auto p = std::find_if(m_proxyCredentials.constBegin(), m_proxyCredentials.constEnd(),
                              FindProxyCredential(proxy.hostName(), proxy.port()));
        if (p != m_proxyCredentials.constEnd()) {
            proxy.setUser(p->user);
            proxy.setPassword(p->password);
        }
        return list << proxy;
    }
    return list << QNetworkProxy(QNetworkProxy::DefaultProxy);
}
void ProxyPreferencesWidget::setDataToUi()
{
    ui->proxyHostName->clear();
    ui->proxyPort->setValue(0);
    ui->proxyUserName->clear();
    ui->proxyUserPassword->clear();
    const QString &proxyString = settings()->value(Core::Constants::S_PROXY).toString();
    if (!proxyString.isEmpty()) {
        QNetworkProxy proxy;
        if (!Utils::Serializer::deserializeProxy(proxyString, proxy)) {
            LOG_ERROR("Proxy serialized string corrupted");
            return;
        }
        ui->proxyHostName->setText(proxy.hostName());
        ui->proxyPort->setValue(proxy.port());
        ui->proxyUserName->setText(proxy.user());
        ui->proxyUserPassword->setText(proxy.password());
    }
}
예제 #29
0
파일: proxy.cpp 프로젝트: grumpy-irc/grumpy
Proxy::Proxy(QWidget *parent) : QDialog(parent), ui(new Ui::Proxy)
{
    this->ui->setupUi(this);
    this->ui->comboBox->addItem("None");
    this->ui->comboBox->addItem("Socks 5");
    this->ui->comboBox->addItem("Http");
    this->ui->comboBox->addItem("Http (caching proxy)");
    this->ui->comboBox->addItem("Ftp");
    this->ui->comboBox->setCurrentIndex(CONF->ProxyType());
    if (CONF->UsingProxy())
    {
        QNetworkProxy ps = CONF->GetProxy();
        this->ui->checkBox->setChecked(true);
        this->ui->lineEdit->setText(ps.hostName());
        this->ui->lineEdit_2->setText(QString::number(ps.port()));
        this->ui->lineEdit_3->setText(ps.user());
        this->ui->lineEdit_4->setText(ps.password());
    }
}
void QtWebKitNetworkManager::handleProxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
{
	if (NetworkManagerFactory::isUsingSystemProxyAuthentication())
	{
		authenticator->setUser(QString());

		return;
	}

	emit messageChanged(tr("Waiting for authentication…"));

	AuthenticationDialog *authenticationDialog = new AuthenticationDialog(proxy.hostName(), authenticator, m_widget);
	authenticationDialog->setButtonsVisible(false);

	ContentsDialog dialog(Utils::getIcon(QLatin1String("dialog-password")), authenticationDialog->windowTitle(), QString(), QString(), (QDialogButtonBox::Ok | QDialogButtonBox::Cancel), authenticationDialog, m_widget);

	connect(&dialog, SIGNAL(accepted()), authenticationDialog, SLOT(accept()));
	connect(m_widget, SIGNAL(aboutToReload()), &dialog, SLOT(close()));

	m_widget->showDialog(&dialog);
}