summaryrefslogtreecommitdiffabout
path: root/korganizer/kodaymatrix.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kodaymatrix.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 9812321..ca896b5 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -167,182 +167,182 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
//cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
if (mSelEnd > NUMDAYS-1) {
for (int i = i0; i <= NUMDAYS-1; i++) {
selDays.append(days[i]);
}
for (int i = NUMDAYS; i < mSelEnd; i++) {
selDays.append(days[0].addDays(i));
}
// apply normal routine to selection being entirely within matrix limits
} else {
for (int i = i0; i <= mSelEnd; i++) {
selDays.append(days[i]);
}
}
}
void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
{
mSelStart = startdate.daysTo(start);
mSelEnd = startdate.daysTo(end);
}
void KODayMatrix::recalculateToday()
{
today = -1;
for (int i=0; i<NUMDAYS; i++) {
events[i] = 0;
days[i] = startdate.addDays(i);
daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
// if today is in the currently displayed month, hilight today
if (days[i].year() == QDate::currentDate().year() &&
days[i].month() == QDate::currentDate().month() &&
days[i].day() == QDate::currentDate().day()) {
today = i;
}
}
// qDebug(QString("Today is visible at %1.").arg(today));
}
void KODayMatrix::updateView()
{
updateView(startdate);
}
void KODayMatrix::repaintViewTimed()
{
- //qDebug("KODayMatrix::repaintViewTimed ");
+ qDebug("KODayMatrix::repaintViewTimed ");
mRepaintTimer->stop();
repaint(false);
}
void KODayMatrix::updateViewTimed()
{
mUpdateTimer->stop();
- //qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii );
+ qDebug("KODayMatrix::updateView(QDate actdate)");
for(int i = 0; i < NUMDAYS; i++) {
// if events are set for the day then remember to draw it bold
QPtrList<Event> eventlist = mCalendar->events(days[i]);
Event *event;
int numEvents = eventlist.count();
for(event=eventlist.first();event != 0;event=eventlist.next()) {
ushort recurType = event->recurrence()->doesRecur();
if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
(recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
numEvents--;
}
}
events[i] = numEvents;
//if it is a holy day then draw it red. Sundays are consider holidays, too
#ifndef KORG_NOPLUGINS
QString holiStr = KOCore::self()->holiday(days[i]);
#else
QString holiStr = QString::null;
#endif
if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
!holiStr.isEmpty()) {
if (holiStr.isNull()) holiStr = "";
mHolidays[i] = holiStr;
} else {
mHolidays[i] = QString::null;
}
}
if ( ! mPendingUpdateBeforeRepaint )
repaint(false);
}
void KODayMatrix::updateView(QDate actdate)
{
if ( ! actdate.isValid() ) {
//qDebug("date not valid ");
return;
}
mDayChanged = false;
//flag to indicate if the starting day of the matrix has changed by this call
//mDayChanged = false;
// if a new startdate is to be set then apply Cornelius's calculation
// of the first day to be shown
if (actdate != startdate) {
// reset index of selection according to shift of starting date from startdate to actdate
if (mSelStart != NOSELECTION) {
int tmp = actdate.daysTo(startdate);
//kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
// shift selection if new one would be visible at least partly !
if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
// nested if is required for next X display pushed from a different month - correction required
// otherwise, for month forward and backward, it must be avoided
if( mSelStart > NUMDAYS || mSelStart < 0 )
mSelStart = mSelStart + tmp;
if( mSelEnd > NUMDAYS || mSelEnd < 0 )
mSelEnd = mSelEnd + tmp;
}
}
startdate = actdate;
mDayChanged = true;
recalculateToday();
}
- //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
+ qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
if ( !isVisible() ) {
mPendingUpdateBeforeRepaint = true;
} else {
#ifdef DESKTOP_VERSION
- mRepaintTimer->start( 250 );
- mUpdateTimer->start( 2000 );
+ //mRepaintTimer->start( 250 );
+ mUpdateTimer->start( 250 );
#else
mRepaintTimer->start( 350 );
- mUpdateTimer->start( 4000 );
+ mUpdateTimer->start( 2000 );
#endif
}
}
const QDate& KODayMatrix::getDate(int offset)
{
if (offset < 0 || offset > NUMDAYS-1) {
qDebug("Wrong offset2 ");
return days[0];
}
return days[offset];
}
QString KODayMatrix::getHolidayLabel(int offset)
{
if (offset < 0 || offset > NUMDAYS-1) {
qDebug("Wrong offset1 ");
return 0;
}
return mHolidays[offset];
}
int KODayMatrix::getDayIndexFrom(int x, int y)
{
return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ?
6 - x/daysize.width() : x/daysize.width());
}
// ----------------------------------------------------------------------------
// M O U S E E V E N T H A N D L I N G
// ----------------------------------------------------------------------------
void KODayMatrix::mousePressEvent (QMouseEvent* e)
{
mSelStart = getDayIndexFrom(e->x(), e->y());
if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1;
mSelInit = mSelStart;
}
void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
{
int tmp = getDayIndexFrom(e->x(), e->y());
if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
if (mSelInit > tmp) {
mSelEnd = mSelInit;
if (tmp != mSelStart) {