From 34e42590a8ef21c1377f89c7b82f25bcf0aec3cb Mon Sep 17 00:00:00 2001 From: alwin Date: Sat, 19 Mar 2005 13:44:30 +0000 Subject: so.... I looked for a problem. could not found due the kind of code structure. so I had reorganized the code into a more sensefull structure so every one should be able to find some code sequences when searching for a bug. yes - now I found the problem and can thinking about resolving it. --- (limited to 'core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp') diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp new file mode 100644 index 0000000..797f766 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp @@ -0,0 +1,85 @@ +#include "datebookweeklstevent.h" +#include "datebooktypes.h" + +#include + +#include + +#include +#include + +DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, + int weeklistviewconfig, + QWidget* parent, + const char* name, + WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) +{ + // old values... lastday = "__|__", middle=" |---", Firstday="00:00", + QString s,start,middle,end,day; + + odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; + if(weeklistviewconfig==NONE) { // No times displayed. +// start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); +// middle.sprintf("<--->"); +// end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); +// day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); + } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. + start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); + middle.sprintf(" |---"); + end.sprintf("__|__"); + day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); + } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. + start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); + middle.sprintf("<--->"); + end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); + day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); + } + + if(ev.event().type() == Event::Normal) { + if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event. + s=day; + } else if(ev.startDate()==ev.date()) { // start event. + s=start; + } else if(ev.endDate()==ev.date()) { // end event. + s=end; + } else { // middle day. + s=middle; + } + } else { + s=""; + } + setText(QString(s) + " " + ev.description()); +// connect(this, SIGNAL(clicked()), this, SLOT(editMe())); + setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); +} +void DateBookWeekLstEvent::editMe() { + emit editEvent(event.event()); +} +void DateBookWeekLstEvent::duplicateMe() +{ + emit duplicateEvent(event.event()); +} +void DateBookWeekLstEvent::deleteMe() +{ + emit removeEvent(event.event()); + emit redraw(); +} +void DateBookWeekLstEvent::beamMe() +{ + emit beamEvent( event.event() ); +} +void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) +{ + if (!event.event().isValidUid()) { + // this is just such a holiday event. + return; + } + popmenue = new QPopupMenu; + + popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); + popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); + popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); + if(Ir::supported()) + popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); + popmenue->popup( mapToGlobal( e->pos() )); +} -- cgit v0.9.0.2