Ignore:
Timestamp:
01/29/10 15:16:05 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
6645e1f
Parents:
5007fde
Message:

implemented 'proxy settings' dialog

  • user can secify proxy for network communication
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/importschedulewidget.cpp

    r5007fde ra023fd2  
    22
    33#include <schedulexmlparser.h>
     4#include "proxysettingsdialog.h"
    45
    56#include <QDir>
     
    1011#include <QNetworkReply>
    1112#include <QDebug>
     13#include <appsettings.h>
    1214
    1315const QString SCHEDULE_URL = "http://fosdem.org/2010/schedule/xml";
     16
     17const QString PROXY_USERNAME;
     18const QString PROXY_PASSWD;
    1419
    1520ImportScheduleWidget::ImportScheduleWidget(QWidget *aParent)
     
    2934    connect(online, SIGNAL(clicked()), SLOT(downloadSchedule()));
    3035
     36    connect(proxySettings, SIGNAL(clicked()), SLOT(setupProxy()));
    3137    mNetworkAccessManager = new QNetworkAccessManager(this);
    3238    connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkQueryFinished(QNetworkReply*)));
     
    8187void ImportScheduleWidget::networkQueryFinished(QNetworkReply *aReply)
    8288{
    83     qDebug() << "ImportScheduleWidget::networkQueryFinished()";
    84 
    8589    if ( aReply->error() != QNetworkReply::NoError )
    8690    {
     
    9599void ImportScheduleWidget::downloadSchedule()
    96100{
    97     qDebug() << "downloading schedule";
    98 
    99101    QNetworkRequest request;
    100102    request.setUrl(QUrl(SCHEDULE_URL));
     
    107109    online->hide();
    108110    progressBar->show();
     111    proxySettings->hide();
    109112
    110113    int confId = mXmlParser->parseData(aData);
     
    113116    browse->show();
    114117    online->show();
     118    proxySettings->show();
    115119    importScheduleLabel->setText("Import schedule: ");
    116120
     
    118122}
    119123
     124void ImportScheduleWidget::setupProxy()
     125{
     126    ProxySettingsDialog dialog;
     127    dialog.exec();
     128
     129    qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
     130    QNetworkProxy proxy(
     131            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
     132            AppSettings::proxyAddress(),
     133            AppSettings::proxyPort(),
     134            PROXY_USERNAME,
     135            PROXY_PASSWD);
     136    QNetworkProxy::setApplicationProxy(proxy);
     137
     138    mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
     139}
     140
Note: See TracChangeset for help on using the changeset viewer.