cancel->hide();
connect(online, SIGNAL(clicked()), SLOT(downloadSchedule()));
+ connect(changeUrl, SIGNAL(clicked()), SLOT(on_changeUrl()));
+ connect(newConfFromUrl, SIGNAL(clicked()), SLOT(on_newFromUrl()));
+ connect(delConf, SIGNAL(clicked()), SLOT(on_delete()));
+
mNetworkAccessManager = new QNetworkAccessManager(this);
connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkQueryFinished(QNetworkReply*)));
mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
void ImportScheduleWidget::downloadSchedule()
{
- QNetworkRequest request;
// TODO: make a nicer GUI
// basically, you have to do the following things:
// So it cannot be done as "do like #4 and rely on REPLACE".
// 4. allow getting the new conference by URL
- QString url_default;
- try {
- url_default = Conference::getById(Conference::activeConference()).getUrl();
- } catch (OrmException& e) {
- qWarning() << "failed to get default URL:" << e.text();
+ // FIXME: it will throw
+ // GUI should not show this button if there is no active conf
+ importFromNetwork(Conference::getById(Conference::activeConference()).getUrl());
+}
+
+void ImportScheduleWidget::on_changeUrl()
+{
+ // FIXME: it will throw
+ // GUI should not show this button if there is no active conf
+ Conference active_conference = Conference::getById(Conference::activeConference());
+ bool ok = false;
+ QString new_url =
+ QInputDialog::getText(this, "URL request", "Enter the new URL for conference schedule"
+ , QLineEdit::Normal
+ , active_conference.getUrl()
+ , &ok);
+ if (ok) {
+ active_conference.setUrl(new_url);
}
+}
+void ImportScheduleWidget::on_newFromUrl()
+{
bool ok = false;
- QString url = QInputDialog::getText(this, "URL request", "Put proper schedule URL or let it try with it", QLineEdit::Normal, url_default, &ok);
- if (!ok) { // cancel pressed
- return;
+ QString url = QInputDialog::getText(this, "URL request", "Put the schedule URL", QLineEdit::Normal, "", &ok);
+ if (ok) {
+ importFromNetwork(url);
}
+
+}
+
+void ImportScheduleWidget::on_delete()
+{
+ // TODO: implement
+}
+
+void ImportScheduleWidget::importFromNetwork(const QString& url)
+{
+ QNetworkRequest request;
request.setUrl(QUrl(url));
mNetworkAccessManager->setProxy(QNetworkProxy::applicationProxy());
<rect>
<x>0</x>
<y>0</y>
- <width>699</width>
+ <width>710</width>
<height>79</height>
</rect>
</property>
</property>
</widget>
</item>
+ <item>
+ <widget class="QPushButton" name="changeUrl">
+ <property name="text">
+ <string>Change Url</string>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QPushButton" name="online">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>10</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="text">
- <string>Online</string>
+ <string>Reresh</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="newConfFromUrl">
+ <property name="text">
+ <string>From Url</string>
</property>
</widget>
</item>
</sizepolicy>
</property>
<property name="text">
- <string>Browse</string>
+ <string>From File</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="delConf">
+ <property name="text">
+ <string>Delete</string>
</property>
</widget>
</item>
}
}
+ #if 0
void setId(int id) { setValue("id", id); }
void setTitle(const QString& title) { setValue("title", title); }
void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
void setDayChange(int dayChange) { setValue("day_change", dayChange); }
void setTimeslotDuration(int timeslotDuration) { setValue("timeslot_duration", timeslotDuration); }
void setActive(bool active) { setValue("active", (int)((active))); }
- void setUrl(const QString& url) { setValue("url", url.isNull() ? QVariant() : url); }
+ #endif
+ void setUrl(const QString& url)
+ {
+ setValue("url", url.isNull() ? QVariant() : url);
+ update("url");
+ }
};
#endif /* CONFERENCE_H */