/*
* Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
+ * Copyright (C) 2011-2012 Philipp Spitzer, gregor herrmann, Stefan Stahl
*
* This file is part of ConfClerk.
*
#include "conferencemodel.h"
#include "urlinputdialog.h"
-#include "mapwindow.h"
#include "errormessage.h"
#include <QInputDialog>
connect(removeBtn, SIGNAL(clicked()), SLOT(removeClicked()));
connect(changeUrl, SIGNAL(clicked()), SLOT(changeUrlClicked()));
connect(refreshBtn, SIGNAL(clicked()), SLOT(refreshClicked()));
- connect(showMapButton, SIGNAL(clicked()), SLOT(conferenceMapClicked()));
connect(buttonBox, SIGNAL(rejected()), SLOT(close()));
// it's OK to emit selection signals here
conferenceTitle->setText(conf.title());
conferenceSubtitle->setText(conf.subtitle());
- conferenceWhere->setText(conf.city() + ", " + conf.venue());
+ conferenceWhere->setText(conf.city() + (!conf.venue().isEmpty() ? ", " + conf.venue() : ""));
conferenceWhen->setText(
- conf.start().toString("dd-MM-yyyy")
- + ", " +
- conf.end().toString("dd-MM-yyyy"));
-
- QString map = conf.map();
- if (map.isEmpty()) {
- showMapButton->hide();
- } else {
- showMapButton->show();
- }
-
+ conf.start().toString("yyyy-MM-dd")
+ + " - " +
+ conf.end().toString("yyyy-MM-dd"));
conferenceInfo->setCurrentIndex(0);
removeBtn->show();
}
void ConferenceEditor::changeUrlClicked()
{
- if (selected_id < 0) {
- return;
- }
- const Conference& selected = Conference::getById(selected_id);
+ if (selected_id < 0) return;
+ const Conference& selectedConf = Conference::getById(selected_id);
bool ok;
- QString url = QInputDialog::getText(this, "URL Input", "Enter schedule URL", QLineEdit::Normal, selected.url(), &ok);
+ QString url = QInputDialog::getText(this, "URL Input", "Enter schedule URL", QLineEdit::Normal, selectedConf.url(), &ok);
if (ok) {
emit changeUrlRequested(selected_id, url);
void ConferenceEditor::refreshClicked()
{
- if (selected_id < 0) {
- return;
- }
- const Conference& selected = Conference::getById(selected_id);
+ if (selected_id < 0) return;
+ const Conference& selectedConf = Conference::getById(selected_id);
+ QString url = selectedConf.url();
- QString url = selected.url();
-
- if (!url.isEmpty()) {
- emit haveConferenceUrl(url);
- } else {
+ if (url.isEmpty()) {
static const QString format("Schedule URL for %1 is not set. Enter the schedule URL:");
bool ok;
- QString url = QInputDialog::getText(this, "URL Input", format.arg(selected.title()), QLineEdit::Normal, QString(), &ok);
-
- if (ok) {
- // first save it, to remain if fetch fails
- emit changeUrlRequested(selected_id, url);
- // then fetch
- emit haveConferenceUrl(url);
- }
+ QString url = QInputDialog::getText(this, "URL Input", format.arg(selectedConf.title()), QLineEdit::Normal, QString(), &ok);
+ if (!ok) return;
+ // first save it, to remain if fetch fails
+ emit changeUrlRequested(selected_id, url);
}
+ // fetch
+ importStarted(); // just to show the progress bar
+ emit haveConferenceUrl(url);
}
void ConferenceEditor::importStarted()
void ConferenceEditor::importFinished(const QString& title)
{
- qDebug() << __PRETTY_FUNCTION__ << title;
addBtn->show();
// removeItem should be shown later, but it takes some time,
// and not looks good
itemSelected(QModelIndex(), QModelIndex());
}
-void ConferenceEditor::conferenceMapClicked()
-{
- Conference conf = Conference::getById(selected_id);
- QString mapPath = conf.map();
- if(mapPath.isEmpty() or !QFile::exists(mapPath)) {
- error_message("Map is not available");
- return;
- }
-
- QString roomName;
-
- QPixmap map(mapPath);
- MapWindow window(map,roomName,this);
- window.exec();
-}