korganizer Library API Documentation

KODayMatrix Class Reference

Replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. day matrix widget of the KDateNavigator. More...

#include <kodaymatrix.h>

List of all members.

Public Slots

void updateView ()
void recalculateToday ()

Signals

void selected (const KCal::DateList &daylist)
void eventDropped (Event *event)
void eventDroppedMove (Event *oldevent, Event *newevent)
void todoDroppedMove (Todo *oldtodo, Todo *newtodo)
void todoDropped (Todo *todo)

Public Member Functions

 KODayMatrix (QWidget *parent, QDate date, const char *name)
 ~KODayMatrix ()
void setCalendar (Calendar *)
void updateView (QDate actdate)
void updateEvents ()
const QDate & getDate (int offset)
QString getHolidayLabel (int offset)
void addSelectedDaysTo (DateList &)
void setSelectedDaysFrom (const QDate &start, const QDate &end)
bool isTodayVisible () const
bool isBeginningOfMonth () const
bool isEndOfMonth () const

Protected Member Functions

void paintEvent (QPaintEvent *ev)
void mousePressEvent (QMouseEvent *e)
void mouseReleaseEvent (QMouseEvent *e)
void mouseMoveEvent (QMouseEvent *e)
void dragEnterEvent (QDragEnterEvent *)
void dragMoveEvent (QDragMoveEvent *)
void dragLeaveEvent (QDragLeaveEvent *)
void dropEvent (QDropEvent *)
void resizeEvent (QResizeEvent *)


Detailed Description

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

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 QFrame 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 TODO ET 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

Author:
Eitzenberger Thomas

Definition at line 102 of file kodaymatrix.h.


Constructor & Destructor Documentation

KODayMatrix::KODayMatrix QWidget *  parent,
QDate  date,
const char *  name
 

constructor to create a day matrix widget.

Parameters:
parent widget that is the parent of the day matrix. Normally this should be a KDateNavigator
calendar instance of a calendar on which all calculations are based
date start date of the matrix (is expected to be already fixed). It is assumed that this date is the first week day to be shown in the matrix.
name name of the widget

Definition at line 102 of file kodaymatrix.cpp.

References KODayMatrix(), and updateView().

Referenced by KODayMatrix().

KODayMatrix::~KODayMatrix  ) 
 

destructor that deallocates all dynamically allocated private members.

Definition at line 146 of file kodaymatrix.cpp.


Member Function Documentation

void KODayMatrix::setCalendar Calendar *   ) 
 

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 123 of file kodaymatrix.cpp.

References setCalendar(), and updateEvents().

Referenced by setCalendar().

void KODayMatrix::updateView QDate  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:
actdate recalculates the day matrix to show NUMDAYS starting from this date.

Definition at line 223 of file kodaymatrix.cpp.

References recalculateToday(), and updateEvents().

void KODayMatrix::updateEvents  ) 
 

Update event states of dates.

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

Definition at line 276 of file kodaymatrix.cpp.

Referenced by setCalendar(), and updateView().

const QDate & KODayMatrix::getDate int  offset  ) 
 

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

Definition at line 300 of file kodaymatrix.cpp.

References getDate().

Referenced by getDate().

QString 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 309 of file kodaymatrix.cpp.

References getHolidayLabel().

Referenced by getHolidayLabel(), and DynamicTip::maybeTip().

void KODayMatrix::addSelectedDaysTo DateList &   ) 
 

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

Definition at line 161 of file kodaymatrix.cpp.

References addSelectedDaysTo().

Referenced by addSelectedDaysTo().

void KODayMatrix::setSelectedDaysFrom const QDate &  start,
const QDate &  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 194 of file kodaymatrix.cpp.

References setSelectedDaysFrom().

Referenced by setSelectedDaysFrom().

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 167 of file kodaymatrix.h.

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 175 of file kodaymatrix.h.

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 218 of file kodaymatrix.cpp.

Referenced by KODayMatrix().

void KODayMatrix::recalculateToday  )  [slot]
 

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

Definition at line 201 of file kodaymatrix.cpp.

Referenced by updateView().

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:
daylist list of days that have been selected by the user

void KODayMatrix::eventDropped Event *  event  )  [signal]
 

emitted if the user has dropped an event inside the matrix

Parameters:
event the dropped calendar event

void KODayMatrix::eventDroppedMove Event *  oldevent,
Event *  newevent
[signal]
 

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

Parameters:
oldevent the new calendar event
newevent the item that was moved

void KODayMatrix::todoDroppedMove Todo *  oldtodo,
Todo *  newtodo
[signal]
 

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

Parameters:
oldtodo the new todo
newtodo the item that was moved

void KODayMatrix::todoDropped Todo *  todo  )  [signal]
 

emitted if the user has dropped a todo inside the matrix

Parameters:
event the dropped todo item


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:14 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003