From b1117bb9e31018460b5adc05428842555d47c1b9 Mon Sep 17 00:00:00 2001 From: Nils Schwabe Date: Thu, 6 Mar 2014 16:02:08 +0100 Subject: vmchooser is now able to get vsessions from a given url --- src/dialog.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/dialog.cpp') diff --git a/src/dialog.cpp b/src/dialog.cpp index d758b0a..def152c 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -12,6 +12,7 @@ #include "save_restore_session.h" #include "sessiontreeitem.h" #include "globals.h" +#include "vsession.h" Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { @@ -246,3 +247,30 @@ void Dialog::on_centerTimer() { } } +void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { + if (reply->error() != QNetworkReply::NoError) { + qDebug() << "Error reading from URL: " << reply->error(); + return; + } + + QString xml_doc(reply->readAll()); + + QFile file("/tmp/vmchooser2.xml"); + if (!file.open(QIODevice::WriteOnly)) { + if (debugMode) { + qDebug() << "Could not write XML to /tmp"; + } + return; + } + + QByteArray data = xml_doc.toUtf8(); + + if (file.write(data) != data.length()) { + return; + } + + file.close(); + + this->addItems(VSession::readXmlFile(file.fileName()), QCoreApplication::instance()->translate("Dialog", "Virtual Sessions")); +} + -- cgit v1.2.3-55-g7522