2 * Copyright (C) 2010 Ixonos Plc.
3 * Copyright (C) 2011-2013 Philipp Spitzer, gregor herrmann, Stefan Stahl
5 * This file is part of ConfClerk.
7 * ConfClerk is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 2 of the License, or (at your option)
12 * ConfClerk is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * ConfClerk. If not, see <http://www.gnu.org/licenses/>.
21 #include "dayviewtabcontainer.h"
23 DayViewTabContainer::DayViewTabContainer(QWidget *aParent): TabContainer(aParent) {
27 void DayViewTabContainer::expandTimeGroup(QTime time, int conferenceId) {
28 EventModel* eventModel = static_cast<EventModel*>(treeView->model());
30 // iterate over the time groups
31 for (int g = 0; g != eventModel->rowCount(); ++g) {
32 QModelIndex groupIdx = eventModel->index(g, 0);
33 // iterate over the events in the group
34 for (int e = 0; e != eventModel->rowCount(groupIdx); ++e) {
35 QModelIndex eventIdx = eventModel->index(e, 0, groupIdx);
36 int eventId = eventIdx.data().toInt();
37 Event event = Event::getById(eventId, conferenceId);
38 if (time < event.start().time().addSecs(event.duration())) { // if time < end
40 treeView->expand(groupIdx);
41 treeView->scrollTo(eventIdx, QAbstractItemView::PositionAtTop);
49 void DayViewTabContainer::loadEvents( const QDate &aDate, const int aConferenceId ) {
50 static_cast<EventModel*>(treeView->model())->loadEvents( aDate, aConferenceId );