korganizer

#include <kodaymatrix.h>

Inheritance diagram for KODayMatrix:
KCal::Calendar::Observer

Public Slots

void updateView ()
 
void recalculateToday ()
 
void resourcesChanged ()
 

Signals

void selected (const KCal::DateList &daylist)
 
void incidenceDropped (Incidence *incidence, const TQDate &dt)
 
void incidenceDroppedMove (Incidence *oldincidence, const TQDate &dt)
 

Public Member Functions

 KODayMatrix (TQWidget *parent, const char *name)
 
 ~KODayMatrix ()
 
void setCalendar (Calendar *)
 
void updateView (const TQDate &actdate)
 
void updateEvents ()
 
const TQDate & getDate (int offset)
 
TQString getHolidayLabel (int offset)
 
void addSelectedDaysTo (DateList &)
 
void setSelectedDaysFrom (const TQDate &start, const TQDate &end)
 
void clearSelection ()
 
bool isTodayVisible () const
 
bool isBeginningOfMonth () const
 
bool isEndOfMonth () const
 
void calendarIncidenceAdded (Incidence *incidence)
 
void calendarIncidenceChanged (Incidence *incidence)
 
void calendarIncidenceDeleted (Incidence *incidence)
 
void setUpdateNeeded ()
 
- Public Member Functions inherited from KCal::Calendar::Observer
virtual void calendarModified (bool, Calendar *)
 

Static Public Member Functions

static TQPair< TQDate, TQDate > matrixLimits (const TQDate &month)
 

Protected Member Functions

void paintEvent (TQPaintEvent *ev)
 
void mousePressEvent (TQMouseEvent *e)
 
void mouseReleaseEvent (TQMouseEvent *e)
 
void mouseMoveEvent (TQMouseEvent *e)
 
void dragEnterEvent (TQDragEnterEvent *)
 
void dragMoveEvent (TQDragMoveEvent *)
 
void dragLeaveEvent (TQDragLeaveEvent *)
 
void dropEvent (TQDropEvent *)
 
void resizeEvent (TQResizeEvent *)
 

Detailed Description

Replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed.

Cornelius thought this was a waste of memory and a lot of overhead. In addition the selection was not very intuitive so I decided to rewrite it using a TQFrame that draws the labels and allows for dragging selection while maintaining nearly full compatibility in behavior with its predecessor.

The following functionality has been changed:

o when shifting events in the agenda view from one day to another the day matrix is updated now o dragging an event to the matrix will MOVE not COPY the event to the new date. o no support for Ctrl+click to create groups of dates (This has not really been supported in the predecessor. It was not very intuitive nor was it user friendly.) This feature has been replaced with dragging a selection on the matrix. The matrix will automatically choose the appropriate selection (e.g. you are not any longer able to select two distinct groups of date selections as in the old class) o now that you can select more then a week it can happen that not all selected days are displayed in the matrix. However this is preferred to the alternative which would mean to adjust the selection and leave some days undisplayed while scrolling through the months

day matrix widget of the KDateNavigator

Author
Eitzenberger Thomas

Definition at line 105 of file kodaymatrix.h.

Constructor & Destructor Documentation

◆ KODayMatrix()

KODayMatrix::KODayMatrix ( TQWidget *  parent,
const char *  name 
)

constructor to create a day matrix widget.

Parameters
parentwidget that is the parent of the day matrix. Normally this should be a KDateNavigator
namename of the widget

Definition at line 102 of file kodaymatrix.cpp.

◆ ~KODayMatrix()

KODayMatrix::~KODayMatrix ( )

destructor that deallocates all dynamically allocated private members.

Definition at line 152 of file kodaymatrix.cpp.

Member Function Documentation

◆ addSelectedDaysTo()

void KODayMatrix::addSelectedDaysTo ( DateList &  selDays)

adds all actual selected days from mSelStart to mSelEnd to the supplied DateList.

Definition at line 162 of file kodaymatrix.cpp.

◆ clearSelection()

void KODayMatrix::clearSelection ( )

Clear all selections.

Definition at line 203 of file kodaymatrix.cpp.

◆ getDate()

const TQDate & KODayMatrix::getDate ( int  offset)

returns the TQDate object associated with day indexed by the supplied offset.

Definition at line 320 of file kodaymatrix.cpp.

◆ getHolidayLabel()

TQString KODayMatrix::getHolidayLabel ( int  offset)

returns the official name of this holy day or 0 if there is no label for this day.

Definition at line 329 of file kodaymatrix.cpp.

◆ incidenceDropped

void KODayMatrix::incidenceDropped ( Incidence incidence,
const TQDate &  dt 
)
signal

emitted if the user has dropped an incidence (event or todo) inside the matrix

Parameters
incidencethe dropped calendar incidence
dtTQDate that has been selected

◆ incidenceDroppedMove

void KODayMatrix::incidenceDroppedMove ( Incidence oldincidence,
const TQDate &  dt 
)
signal

emitted if the user has dropped an event inside the matrix and chose to move it instead of copy

Parameters
oldincidencethe new calendar incidence
dtTQDate that has been selected

◆ isBeginningOfMonth()

bool KODayMatrix::isBeginningOfMonth ( ) const
inline

If today is visible, then we can find out if today is near the beginning or the end of the month.

This is dependent on today remaining the index in the array of visible dates and going from top left (0) to bottom right (41).

Definition at line 185 of file kodaymatrix.h.

◆ isTodayVisible()

bool KODayMatrix::isTodayVisible ( ) const
inline

Is today visible in the view? Keep this in sync with the values today (below) can take.

Definition at line 177 of file kodaymatrix.h.

◆ matrixLimits()

TQPair< TQDate, TQDate > KODayMatrix::matrixLimits ( const TQDate &  month)
static

returns the first and last date of the 6*7 matrix that displays month

Parameters
monthThe month we want to get matrix boundaries

Definition at line 713 of file kodaymatrix.cpp.

◆ recalculateToday

void KODayMatrix::recalculateToday ( )
slot

Calculate which square in the matrix should be hilighted to indicate it's today.

Definition at line 208 of file kodaymatrix.cpp.

◆ resourcesChanged

void KODayMatrix::resourcesChanged ( )
slot

Handle resource changes.

Definition at line 363 of file kodaymatrix.cpp.

◆ selected

void KODayMatrix::selected ( const KCal::DateList &  daylist)
signal

emitted if the user selects a block of days with the mouse by dragging a rectangle inside the matrix

Parameters
daylistlist of days that have been selected by the user

◆ setCalendar()

void KODayMatrix::setCalendar ( Calendar cal)

Associate a calendar with this day matrix.

If there is a calendar, the day matrix will accept drops and days with events will be highlighted.

Definition at line 117 of file kodaymatrix.cpp.

◆ setSelectedDaysFrom()

void KODayMatrix::setSelectedDaysFrom ( const TQDate &  start,
const TQDate &  end 
)

sets the actual to be displayed selection in the day matrix starting from start and ending with end.

Theview must be manually updated by calling repaint. (?)

Definition at line 195 of file kodaymatrix.cpp.

◆ updateEvents()

void KODayMatrix::updateEvents ( )

Update event states of dates.

Depending of the preferences days with events are highlighted in some way.

Definition at line 294 of file kodaymatrix.cpp.

◆ updateView [1/2]

void KODayMatrix::updateView ( )
slot

Recalculates all the flags of the days in the matrix like holidays or events on a day (Actually calls above method with the actual startdate).

Definition at line 226 of file kodaymatrix.cpp.

◆ updateView() [2/2]

void KODayMatrix::updateView ( const TQDate &  actdate)

updates the day matrix to start with the given date.

Does all the necessary checks for holidays or events on a day and stores them for display later on. Does NOT update the view visually. Call repaint() for this.

Parameters
actdaterecalculates the day matrix to show NUMDAYS starting from this date.

Definition at line 236 of file kodaymatrix.cpp.


The documentation for this class was generated from the following files: