author | zautrix <zautrix> | 2005-01-31 23:43:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 23:43:35 (UTC) |
commit | fce3fd8accec495a2deda6fe3cd55375fac46432 (patch) (side-by-side diff) | |
tree | 24231254fa729b1b546f0475759fcba24455e1f5 | |
parent | 336678d691a8c3346c92a4e561ac7938ed532003 (diff) | |
download | kdepimpi-fce3fd8accec495a2deda6fe3cd55375fac46432.zip kdepimpi-fce3fd8accec495a2deda6fe3cd55375fac46432.tar.gz kdepimpi-fce3fd8accec495a2deda6fe3cd55375fac46432.tar.bz2 |
mf
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 7 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 170 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 17 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 4 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 1 |
7 files changed, 116 insertions, 91 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 178f92d..2858d9c 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -6,12 +6,13 @@ Info about the changes in new versions of KDE-Pim/Pi Oooops ... I forgot to test on the Zaurus 5500 ... Fixed many problems of new (english) strings (and german translations) introduced in the latest versions, where the text was not fitting on the 240x320 display of the Zaurus 5500. +KO/Pi: Added a popup menu ( press pen and hold to get popup ) to the agenda view with many useful items (add event/todo, show next week, two weeks, month, journal). Added items to the todolist popup menu for: Display all opened, all closed or all todos flat. The "flat" view makes is possible to sort all todos after ,e.g., prio or date. @@ -25,12 +26,18 @@ Fixed behaviour of automatic setting completion of todos with sub-todos/parent t Now the behaviour is: Setting a parent to complete sets all (sub)childs to complete. Setting a parent to uncomplete does not change the childs. Setting a child to uncomplete sets all parent to uncomplete. Setting a child to complete does not change the parents. +Smart updating and double buffering of the daymatrix. +Showing holidays in the day matrix. +Many other small performance updates. + +Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. + Now the translation file usertranslation.txt is supposed to be in utf8 format. If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. ********** VERSION 2.0.0 ************ diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ca896b5..549ef2a 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -209,56 +209,49 @@ void KODayMatrix::recalculateToday() void KODayMatrix::updateView() { updateView(startdate); } void KODayMatrix::repaintViewTimed() { - qDebug("KODayMatrix::repaintViewTimed "); mRepaintTimer->stop(); repaint(false); } void KODayMatrix::updateViewTimed() { mUpdateTimer->stop(); - 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(); - + QString holiStr = ""; 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--; } + if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { + if ( !holiStr.isEmpty() ) + holiStr += "\n"; + holiStr += event->summary(); + } } 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; @@ -285,13 +278,13 @@ void KODayMatrix::updateView(QDate actdate) } } 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( 250 ); @@ -484,18 +477,22 @@ void KODayMatrix::dropEvent(QDropEvent *e) // ---------------------------------------------------------------------------- // P A I N T E V E N T H A N D L I N G // ---------------------------------------------------------------------------- void KODayMatrix::paintEvent(QPaintEvent * pevent) { -//kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; - if ( mPendingUpdateBeforeRepaint ) { - updateViewTimed(); - mPendingUpdateBeforeRepaint = false; + if ( width() <= 0 || height() <= 0 ) + return; + if ( mPendingUpdateBeforeRepaint ) { + updateViewTimed(); + mPendingUpdateBeforeRepaint = false; + } + if ( myPix.width() != width() || myPix.height()!=height() ) { + myPix.resize(size() ); } - QPainter p(this); + QPainter p(&myPix); QRect sz = frameRect(); int dheight = daysize.height(); int dwidth = daysize.width(); int row,col; int selw, selh; @@ -535,90 +532,91 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) // iterate over all days in the matrix and draw the day label in appropriate colors QColor actcol = mDefaultTextColorShaded; p.setPen(actcol); QPen tmppen; for(int i = 0; i < NUMDAYS; i++) { - row = i/7; - col = isRTL ? 6-(i-row*7) : i-row*7; - - // if it is the first day of a month switch color from normal to shaded and vice versa - if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { - if (actcol == mDefaultTextColorShaded) { - actcol = mDefaultTextColor; - } else { - actcol = mDefaultTextColorShaded; + row = i/7; + col = isRTL ? 6-(i-row*7) : i-row*7; + + // if it is the first day of a month switch color from normal to shaded and vice versa + if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { + if (actcol == mDefaultTextColorShaded) { + actcol = mDefaultTextColor; + } else { + actcol = mDefaultTextColorShaded; + } + p.setPen(actcol); } - p.setPen(actcol); - } - //Reset pen color after selected days block - if (i == mSelEnd+1) { - p.setPen(actcol); - } + //Reset pen color after selected days block + if (i == mSelEnd+1) { + p.setPen(actcol); + } + + // if today then draw rectangle around day + if (today == i) { + tmppen = p.pen(); + QPen mTodayPen(p.pen()); + + mTodayPen.setWidth(mTodayMarginWidth); + //draw red rectangle for holidays + if (!mHolidays[i].isNull()) { + if (actcol == mDefaultTextColor) { + mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); + } else { + mTodayPen.setColor(mHolidayColorShaded); + } + } + //draw gray rectangle for today if in selection + if (i >= mSelStart && i <= mSelEnd) { + QColor grey("grey"); + mTodayPen.setColor(grey); + } + p.setPen(mTodayPen); + p.drawRect(col*dwidth, row*dheight, dwidth, dheight); + p.setPen(tmppen); + } - // if today then draw rectangle around day - if (today == i) { - tmppen = p.pen(); - QPen mTodayPen(p.pen()); + // if any events are on that day then draw it using a bold font + if (events[i] > 0) { + QFont myFont = font(); + myFont.setBold(true); + p.setFont(myFont); + } - mTodayPen.setWidth(mTodayMarginWidth); - //draw red rectangle for holidays + // if it is a holiday then use the default holiday color if (!mHolidays[i].isNull()) { - if (actcol == mDefaultTextColor) { - mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); - } else { - mTodayPen.setColor(mHolidayColorShaded); - } + if (actcol == mDefaultTextColor) { + p.setPen(KOPrefs::instance()->mHolidayColor); + } else { + p.setPen(mHolidayColorShaded); + } } - //draw gray rectangle for today if in selection + + // draw selected days with special color + // DO NOT specially highlight holidays in selection ! if (i >= mSelStart && i <= mSelEnd) { - QColor grey("grey"); - mTodayPen.setColor(grey); + p.setPen(mSelectedDaysColor); } - p.setPen(mTodayPen); - p.drawRect(col*dwidth, row*dheight, dwidth, dheight); - p.setPen(tmppen); - } - // if any events are on that day then draw it using a bold font - if (events[i] > 0) { - QFont myFont = font(); - myFont.setBold(true); - p.setFont(myFont); - } + p.drawText(col*dwidth, row*dheight, dwidth, dheight, + Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); - // if it is a holiday then use the default holiday color - if (!mHolidays[i].isNull()) { - if (actcol == mDefaultTextColor) { - p.setPen(KOPrefs::instance()->mHolidayColor); - } else { - p.setPen(mHolidayColorShaded); + // reset color to actual color + if (!mHolidays[i].isNull()) { + p.setPen(actcol); + } + // reset bold font to plain font + if (events[i] > 0) { + QFont myFont = font(); + myFont.setBold(false); + p.setFont(myFont); } - } - - // draw selected days with special color - // DO NOT specially highlight holidays in selection ! - if (i >= mSelStart && i <= mSelEnd) { - p.setPen(mSelectedDaysColor); - } - - p.drawText(col*dwidth, row*dheight, dwidth, dheight, - Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); - - // reset color to actual color - if (!mHolidays[i].isNull()) { - p.setPen(actcol); - } - // reset bold font to plain font - if (events[i] > 0) { - QFont myFont = font(); - myFont.setBold(false); - p.setFont(myFont); - } } + bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); } // ---------------------------------------------------------------------------- // R E SI Z E E V E N T H A N D L I N G // ---------------------------------------------------------------------------- diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index ac2f59c..2dd112a 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h @@ -28,12 +28,13 @@ #include <qstring.h> #include <qframe.h> #include <qcolor.h> #include <qpen.h> #include <qdatetime.h> #include <qtooltip.h> +#include <qpixmap.h> #include <qmap.h> class QDragEnterEvent; class QDragMoveEvent; class QDragLeaveEvent; @@ -218,12 +219,13 @@ protected: void dropEvent(QDropEvent *); void resizeEvent(QResizeEvent *); private: + QPixmap myPix; QTimer* mUpdateTimer; QTimer* mRepaintTimer; bool mDayChanged; bool mPendingUpdateBeforeRepaint; /** returns the index of the day located at the matrix's widget (x,y) position. diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4cff23a..6411156 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -973,14 +973,14 @@ void KOMonthView::changeEventDisplay(Event *, int) void KOMonthView::updateView() { if ( !updatePossible ) return; - QTime ti; - ti.start(); + //QTime ti; + //ti.start(); #if 1 int i; for( i = 0; i < mCells.count(); ++i ) { mCells[i]->startUpdateCell(); } @@ -1077,13 +1077,13 @@ void KOMonthView::updateView() //qDebug("KOMonthView::updateView() "); processSelectionChange(); // qDebug("---------------------------------------------------------------------+ "); mCells[0]->setFocus(); #endif - qDebug("update time %d ", ti.elapsed()); + //qDebug("update time %d ", ti.elapsed()); } void KOMonthView::resizeEvent(QResizeEvent * e) { computeLayout(); mCells[0]->setFocus(); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 82437d8..99402c4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -206,13 +206,17 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) } } } #endif QListView::contentsMousePressEvent(e); } - +void KOTodoListView::paintEvent(QPaintEvent* e) +{ + emit paintNeeded(); + QListView::paintEvent( e); +} void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) { #ifndef KORG_NODND QListView::contentsMouseMoveEvent(e); if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > @@ -498,12 +502,14 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), SLOT( todoModified(Todo *, int) ) ); connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); + connect( mTodoListView, SIGNAL( paintNeeded() ), + SLOT( paintNeeded()) ); #if 0 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); @@ -531,21 +537,28 @@ void KOTodoView::jumpToDate () { // if (mActiveItem) { // mActiveItem->todo()); // if ( mActiveItem->todo()->hasDueDate() ) // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); } +void KOTodoView::paintNeeded() +{ + if ( mPendingUpdateBeforeRepaint ) { + updateView(); + mPendingUpdateBeforeRepaint = false; + } +} void KOTodoView::paintEvent(QPaintEvent * pevent) { if ( mPendingUpdateBeforeRepaint ) { updateView(); mPendingUpdateBeforeRepaint = false; } KOrg::BaseView::paintEvent( pevent); } - bool mPendingUpdateBeforeRepaint; + void KOTodoView::updateView() { pendingSubtodo = 0; if ( mBlockUpdate ) { return; } diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 16bc133..2a9e737 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -57,12 +57,13 @@ class KOTodoListView : public KListView Q_OBJECT public: KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); virtual ~KOTodoListView() {} signals: + void paintNeeded(); void todoDropped(Todo *, int); void double_Clicked(QListViewItem *item); void reparentTodoSignal( Todo *,Todo * ); void unparentTodoSignal(Todo *); void deleteTodo( Todo * ); protected: @@ -74,12 +75,13 @@ class KOTodoListView : public KListView void contentsMousePressEvent(QMouseEvent *); void contentsMouseMoveEvent(QMouseEvent *); void contentsMouseReleaseEvent(QMouseEvent *); void contentsMouseDoubleClickEvent(QMouseEvent *); private: + void paintEvent(QPaintEvent * pevent); bool internalDrop; QString mName; Calendar *mCalendar; QPoint mPressPos; bool mMousePressed; QListViewItem *mOldCurrent; @@ -195,12 +197,13 @@ class KOTodoView : public KOrg::BaseView void cancelTodoSignal( Incidence * ); void moveTodoSignal( Incidence * ); void beamTodoSignal( Incidence * ); void purgeCompletedSignal(); protected slots: + void paintNeeded(); void processSelectionChange(); void addQuickTodo(); void setTodoModified( Todo* ); void todoModified(Todo *, int ); private: @@ -210,12 +213,13 @@ class KOTodoView : public KOrg::BaseView * Korganizer keeps it in memory and we need to update * 1. make KOTodoViewItem a QObject again? * 2. add a public method for setting one todo modified? * 3. add a private method for setting a todo modified + friend here? * -- zecke 2002-07-08 */ + friend class KOTodoListView; void paintEvent(QPaintEvent * pevent); bool mPendingUpdateBeforeRepaint; friend class KOTodoViewItem; QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); void restoreItemState( QListViewItem * ); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 30f5fb1..188ad23 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -601,12 +601,13 @@ void KOViewManager::showJournalView() SLOT( updateConfig() ) ); connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); addView(mJournalView); } showView(mJournalView); + mMainView->dateNavigator()->selectDates( 1 ); } void KOViewManager::showTimeSpanView() { //mFlagShowNextxDays = false; if (!mTimeSpanView) { |