Changeset 2dffed3 in confclerk_git for src/gui/mainwindow.cpp


Ignore:
Timestamp:
08/22/12 00:11:58 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
7680536
Parents:
ca20842
Message:

On the way to fix #45.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    rca20842 r2dffed3  
    148148    Conference active = Conference::getById(confId);
    149149    if (active.url().isEmpty()) return;
    150     importFromNetwork(active.url());
     150    importFromNetwork(active.url(), confId);
    151151    setEnabled(false);
    152152}
     
    318318    ConferenceEditor dialog(conferenceModel, this);
    319319
    320     connect(&dialog, SIGNAL(haveConferenceUrl(const QString&)), SLOT(importFromNetwork(const QString&)));
    321     connect(&dialog, SIGNAL(haveConferenceFile(const QString&)), SLOT(importFromFile(const QString&)));
     320    connect(&dialog, SIGNAL(haveConferenceUrl(const QString&, int)), SLOT(importFromNetwork(const QString&, int)));
     321    connect(&dialog, SIGNAL(haveConferenceFile(const QString&, int)), SLOT(importFromFile(const QString&, int)));
    322322    connect(&dialog, SIGNAL(removeConferenceRequested(int)), SLOT(removeConference(int)));
    323323    connect(&dialog, SIGNAL(changeUrlRequested(int, const QString&)),
     
    350350        if (!redirectUrl.isEmpty()) {
    351351            if (redirectUrl != aReply->request().url()) {
    352                 importFromNetwork(redirectUrl.toString());
     352                importFromNetwork(redirectUrl.toString(), aReply->request().attribute(QNetworkRequest::User).toInt());
    353353                return; // don't enable controls
    354354            } else {
     
    356356            }
    357357        } else {
    358             importData(aReply->readAll(), aReply->url().toEncoded());
     358            importData(aReply->readAll(), aReply->url().toEncoded(), aReply->request().attribute(QNetworkRequest::User).toInt());
    359359        }
    360360    }
     
    362362}
    363363
    364 void MainWindow::importData(const QByteArray &aData, const QString& url)
    365 {
    366     mXmlParser->parseData(aData, url);
    367 }
    368 
    369 void MainWindow::importFromNetwork(const QString& url)
     364void MainWindow::importData(const QByteArray &aData, const QString& url, int conferenceId)
     365{
     366    mXmlParser->parseData(aData, url, conferenceId);
     367}
     368
     369void MainWindow::importFromNetwork(const QString& url, int conferenceId)
    370370{
    371371    QNetworkRequest request;
    372372    request.setUrl(QUrl(url));
     373    request.setAttribute(QNetworkRequest::User, conferenceId);
    373374
    374375    mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
     
    376377}
    377378
    378 void MainWindow::importFromFile(const QString& filename)
     379void MainWindow::importFromFile(const QString& filename, int conferenceId)
    379380{
    380381    QFile file(filename);
     
    384385    }
    385386
    386     importData(file.readAll(), "");
     387    importData(file.readAll(), "", conferenceId);
    387388}
    388389
Note: See TracChangeset for help on using the changeset viewer.