/*
* Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
*
- * This file is part of fosdem-schedule.
+ * This file is part of ConfClerk.
*
- * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * 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.
*
- * fosdem-schedule is distributed in the hope that it will be useful, but
+ * 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
- * fosdem-schedule. If not, see <http://www.gnu.org/licenses/>.
+ * ConfClerk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "delegate.h"
#include "eventmodel.h"
}
// draw Controls
+ foreach(Control* c, mControls.values()) {
+ c->setEnabled(false);
+ }
if(event->isFavourite())
mControls[FavouriteControlOn]->paint(painter, option.rect);
else
else
mControls[AlarmControlOff]->paint(painter, option.rect);
#endif
- if (event->room()->hasMap())
- mControls[MapControl]->paint(painter, option.rect);
if(event->hasTimeConflict())
mControls[WarningControl]->paint(painter, option.rect);
while (i.hasNext())
{
ControlId id = i.next();
- if(mControls[id]->drawRect(static_cast<QTreeView*>(parent())->visualRect(aIndex)).contains(aPoint))
+ Control *control = mControls[id];
+ if (control->enabled()
+ and control->drawRect(static_cast<QTreeView*>(parent())->visualRect(aIndex)).contains(aPoint))
{
- if(id == WarningControl)
- {
- if(static_cast<Event*>(aIndex.internalPointer())->hasTimeConflict())
- return id;
- }
- else
- return id;
+ return id;
}
}
: mId(aControlId)
, mImage(new QImage(aImageName))
, mDrawPoint(QPoint(0,0))
+ , mEnabled(false)
{
QPoint p;
if (prev_control == NULL) {
void Delegate::Control::paint(QPainter* painter, const QRect rect)
{
painter->drawImage(drawPoint(rect),*image());
+ setEnabled(true);
}
void Delegate::defineControls()
{
// FAVOURITE ICONs
// on
- mControls.insert(FavouriteControlOn, new Control(FavouriteControlOn, QString(":icons/favourite-onBig.png"), NULL));
+ mControls.insert(FavouriteControlOn, new Control(FavouriteControlOn, QString(":icons/emblem-new.png"), NULL));
// off
- mControls.insert(FavouriteControlOff, new Control(FavouriteControlOff, QString(":icons/favourite-offBig.png"), NULL));
+ mControls.insert(FavouriteControlOff, new Control(FavouriteControlOff, QString(":icons/emblem-new-off.png"), NULL));
#ifdef MAEMO
// ALARM ICONs
// on
mControls.insert(AlarmControlOn,
- new Control(AlarmControlOn, QString(":icons/alarm-onBig.png"), mControls[FavouriteControlOn]));
+ new Control(AlarmControlOn, QString(":icons/appointment-soon.png"), mControls[FavouriteControlOn]));
// off
mControls.insert(AlarmControlOff,
- new Control(AlarmControlOff, QString(":icons/alarm-offBig.png"), mControls[FavouriteControlOff]));
-
- // MAP ICON
- mControls.insert(MapControl,
- new Control(MapControl, QString(":icons/compassBig.png"), mControls[AlarmControlOn]));
-#else
- // MAP ICON
- mControls.insert(MapControl,
- new Control(MapControl, QString(":icons/compassBig.png"), mControls[FavouriteControlOn]));
+ new Control(AlarmControlOff, QString(":icons/appointment-soon-off.png"), mControls[FavouriteControlOff]));
#endif
// WARNING ICON
mControls.insert(WarningControl,
- new Control(WarningControl, QString(":icons/exclamation.png"), mControls[MapControl]));
+ new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[FavouriteControlOn]));
}
bool Delegate::isPointFromRect(const QPoint &aPoint, const QRect &aRect) const