X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/blobdiff_plain/0bb39f584c6cf15956ec3f92d1d39bd4fd4fd80a..351728eb784ba307ebcca9841341f4617b73845e:/src/gui/eventdialog.cpp diff --git a/src/gui/eventdialog.cpp b/src/gui/eventdialog.cpp index bf06f36..486d2d9 100644 --- a/src/gui/eventdialog.cpp +++ b/src/gui/eventdialog.cpp @@ -1,97 +1,125 @@ +/* + * Copyright (C) 2010 Ixonos Plc. + * Copyright (C) 2011-2012 Philipp Spitzer, gregor herrmann, Stefan Stahl + * + * This file is part of ConfClerk. + * + * ConfClerk is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 2 of the License, or (at your option) + * any later version. + * + * ConfClerk is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * ConfClerk. If not, see . + */ #include "eventdialog.h" -#include +#include "conference.h" #include #ifdef MAEMO -#include +#include "alarm.h" #endif -EventDialog::EventDialog(const int &aEventId, QWidget *aParent) - : QDialog(aParent) - , mEventId(aEventId) -{ +EventDialog::EventDialog(int conferenceId, int eventId, QWidget *parent): QDialog(parent), mConferenceId(conferenceId), mEventId(eventId) { setupUi(this); #ifdef MAEMO showFullScreen(); +#else + alarmButton->hide(); #endif - Event event = Event::getById(mEventId,Conference::activeConference()); + Event event = Event::getById(mEventId, mConferenceId); title->setText(event.title()); persons->setText(event.persons().join(" and ")); abstract->setText(event.abstract()); description->setText(event.description()); - links->setText(static_cast(event.links().values()).join("\n")); + QStringList linksText = static_cast(event.links().values()); + for (QStringList::iterator linkIterator = linksText.begin(); linkIterator != linksText.end(); ++linkIterator) + *linkIterator = QString("%1").arg(*linkIterator); + links->setText(linksText.join("
")); connect(favouriteButton, SIGNAL(clicked()), SLOT(favouriteClicked())); connect(alarmButton, SIGNAL(clicked()), SLOT(alarmClicked())); if(event.isFavourite()) { - favouriteButton->setIcon(QIcon(":/icons/favourite-onBig.png")); + favouriteButton->setIcon(QIcon(":/icons/favourite-on.png")); } if(event.hasAlarm()) { - alarmButton->setIcon(QIcon(":/icons/alarm-onBig.png")); + alarmButton->setIcon(QIcon(":/icons/alarm-on.png")); } } void EventDialog::favouriteClicked() { - Event event = Event::getById(mEventId,Conference::activeConference()); + Event event = Event::getById(mEventId, mConferenceId); + QList conflicts = Event::conflictEvents(event.id(), mConferenceId); if(event.isFavourite()) { event.setFavourite(false); - favouriteButton->setIcon(QIcon(":/icons/favourite-offBig.png")); + favouriteButton->setIcon(QIcon(":/icons/favourite-off.png")); } else { event.setFavourite(true); - favouriteButton->setIcon(QIcon(":/icons/favourite-onBig.png")); + favouriteButton->setIcon(QIcon(":/icons/favourite-on.png")); } event.update("favourite"); - qDebug() << " FAVOURITE [" << event.id() << "] -> " << event.isFavourite(); - // update EVENT_CONFLICT table - event.updateConflicts(); + + if(event.isFavourite()) + { + // event has became 'favourite' and so 'conflicts' list may have changed + conflicts = Event::conflictEvents(event.id(), mConferenceId); + } + + // have to emit 'eventChanged' signal on all events in conflict + for(int i=0; isetIcon(QIcon(":/icons/alarm-offBig.png")); + alarmButton->setIcon(QIcon(":/icons/alarm-off.png")); #ifdef MAEMO - // remove alarm from the 'alarmd' alrms list + // remove alarm from the 'alarmd' alarms list Alarm alarm; - alarm.deleteAlarm(event.id()); + alarm.deleteAlarm(event.conferenceId(), event.id()); // TODO: test if removing was successfull #endif /* MAEMO */ } else { event.setHasAlarm(true); - alarmButton->setIcon(QIcon(":/icons/alarm-onBig.png")); + alarmButton->setIcon(QIcon(":/icons/alarm-on.png")); #ifdef MAEMO // add alarm to the 'alarmd' Alarm alarm; - int cookie = alarm.addAlarm(event.id(),QDateTime::currentDateTime().addSecs(10)); - qDebug() << "cookie: " << cookie; + alarm.addAlarm(event.conferenceId(), event.id(), event.title(), event.start().addSecs(PRE_EVENT_ALARM_SEC)); #endif /* MAEMO */ } event.update("alarm"); - qDebug() << " ALARM [" << event.id() << "] -> " << event.hasAlarm(); // since the Alarm icon has changed, update TreeView accordingly // all TreeViews have to listen on this signal - emit(eventHasChanged(event.id())); + emit eventChanged(event.id(), false); }