Ignore:
Timestamp:
04/15/10 14:01:48 (12 years ago)
Author:
kirilma <kirilma@…>
Branches:
master, qt5
Children:
f5b68a4
Parents:
be9b645
Message:

store URL's for conferences

  • use it at update
  • let user update the url before request
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/importschedulewidget.cpp

    rbe9b645 rd06ae27  
    3030#include <appsettings.h>
    3131
    32 const QString SCHEDULE_URL = "http://fosdem.org/2010/schedule/xml";
     32// TODO: this is temporary
     33#include <QInputDialog>
     34
     35#include "conference.h"
     36
     37// const QString SCHEDULE_URL = "http://fosdem.org/2010/schedule/xml";
    3338
    3439const QString PROXY_USERNAME;
     
    9196        }
    9297
    93         importData(file.readAll());
     98        importData(file.readAll(), QString());
    9499
    95100    }
     
    108113    else
    109114    {
    110         importData(aReply->readAll());
     115        importData(aReply->readAll(), aReply->url().toEncoded());
    111116    }
    112117}
     
    115120{
    116121    QNetworkRequest request;
    117     request.setUrl(QUrl(SCHEDULE_URL));
     122
     123    // TODO: make a nicer GUI
     124    // basically, you have to do the following things:
     125    // 1. store schedule URL for each conteferce
     126    // 2. allow refreshing of the current conference schedule with "1 button click"
     127    // 3. allow changing of the URL for a conference;
     128    //     run refresh together with it is ok and even justified by usability,
     129    //     but it must not loose this change if refresh not available.
     130    //     So it cannot be done as "do like #4 and rely on REPLACE".
     131    // 4. allow getting the new conference by URL
     132
     133    QString url_default;
     134    try {
     135        url_default = Conference::getById(Conference::activeConference()).getUrl();
     136    } catch (OrmException& e) {
     137        qWarning() << "failed to get default URL:" << e.text();
     138    }
     139
     140    bool ok = false;
     141    QString url = QInputDialog::getText(this, "URL request", "Put proper schedule URL or let it try with it", QLineEdit::Normal, url_default, &ok);
     142    if (!ok) { // cancel pressed
     143        return;
     144    }
     145    request.setUrl(QUrl(url));
    118146
    119147    mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
     
    121149}
    122150
    123 void ImportScheduleWidget::importData(const QByteArray &aData)
     151void ImportScheduleWidget::importData(const QByteArray &aData, const QString& url)
    124152{
    125153    browse->hide();
     
    128156    // proxySettings->hide();
    129157
    130     int confId = mXmlParser->parseData(aData);
     158    int confId = mXmlParser->parseData(aData, url);
    131159
    132160    progressBar->hide();
Note: See TracChangeset for help on using the changeset viewer.