summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-01-19 22:57:42 (UTC)
committer zautrix <zautrix>2005-01-19 22:57:42 (UTC)
commitade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e (patch) (side-by-side diff)
tree990ed560fbf9126fba2abdaf98c036cddad2d94f /korganizer/komonthview.cpp
parenta9f8ad6916ea1a849a43fe49c4085f6c44b5c47b (diff)
downloadkdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.zip
kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.gz
kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.bz2
many view fixes
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp89
1 files changed, 56 insertions, 33 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9344567..842f6eb 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -80,7 +80,10 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
- new KNOWhatsThis(this);
+ mWT = new KNOWhatsThis(this);
+}
+KNoScrollListBox::~KNoScrollListBox()
+{
+ delete mWT;
}
-
QString KNoScrollListBox::getWhatsThisText(QPoint p)
{
@@ -309,18 +312,7 @@ void MonthViewCell::setDate( const QDate &date )
{
// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
-
mDate = date;
- QString text;
- bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
- if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
- text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " ";
- mLabel->resize( mLabelBigSize );
- text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
- } else {
- mLabel->resize( mLabelSize );
- text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
- }
- mLabel->setText( text );
+
//resizeEvent( 0 );
@@ -393,5 +385,9 @@ void MonthViewCell::keyPressEvent ( QKeyEvent * e )
void MonthViewCell::updateCell()
{
-
+ if ( !mMonthView->isUpdatePossible() )
+ return;
+ if ( !isVisible() ){
+ return;
+ }
setPrimary( mDate.month()%2 );
setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
@@ -402,4 +398,7 @@ void MonthViewCell::updateCell()
}
mItemList->clear();
+
+
+
#ifdef DESKTOP_VERSION
QToolTip::remove(this);
@@ -416,5 +415,14 @@ void MonthViewCell::updateCell()
QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
Event *event;
- for( event = events.first(); event; event = events.next() ) {
+ for( event = events.first(); event; event = events.next() ) { // for event
+
+ if ( !(event->doesRecur() == Recurrence::rNone) ) {
+ if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
+ continue;
+ else
+ if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
+ continue;
+ }
+
if ( event->categories().contains("Holiday") ||
event->categories().contains(i18n("Holiday"))) {
@@ -484,4 +492,5 @@ void MonthViewCell::updateCell()
item->setAlarm( event->isAlarmEnabled() );
item->setMoreInfo( event->description().length() > 0 );
+#ifdef DESKTOP_VERSION
Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
KOPrefs::instance()->email());
@@ -493,18 +502,8 @@ void MonthViewCell::updateCell()
} else
item->setReply(false);
- bool insert = true;
- if ( !(event->doesRecur() == Recurrence::rNone) ) {
- if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
- insert = false;
- else
- if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
- insert = false;
-
- }
- if ( insert ) {
- mItemList->insertItem( item );
- tipText += "\n";
- } else
- tipText = "";
+#endif
+ mItemList->insertItem( item );
+ tipText += "\n";
+
}
@@ -558,7 +557,18 @@ void MonthViewCell::updateCell()
//setMyPalette();
setMyPalette();
+ QString text;
+ bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
+ if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
+ text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
+ mLabel->resize( mLabelBigSize );
+ text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
+ } else {
+ mLabel->resize( mLabelSize );
+ text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
+ }
+ mLabel->setText( text );
resizeEvent( 0 );
// if ( isVisible())
- // qApp->processEvents();
+ qApp->processEvents();
}
@@ -639,4 +649,9 @@ void MonthViewCell::select()
void MonthViewCell::resizeEvent ( QResizeEvent * )
{
+ if ( !mMonthView->isUpdatePossible() )
+ return;
+ if ( !isVisible() ){
+ return;
+ }
int size = height() - mLabel->height();
if ( size > 0 )
@@ -714,4 +729,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
{
+ updatePossible = false;
mCells.setAutoDelete( true );
mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
@@ -921,5 +937,8 @@ void KOMonthView::changeEventDisplay(Event *, int)
void KOMonthView::updateView()
{
-
+ static int iii = 0;
+ ++iii;
+ if ( !updatePossible )
+ return;
uint i;
for( i = 0; i < mCells.count(); ++i ) {
@@ -955,5 +974,5 @@ void KOMonthView::computeLayout()
if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
return;
-
+ //qDebug("KOMonthView::computeLayout()------------------------------------ ");
QFontMetrics fm ( mWeekLabels[0]->font() );
int weeklabelwid = fm.width( "888" );
@@ -1033,4 +1052,8 @@ void KOMonthView::computeLayout()
mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
updateDayLabels();
+ bool forceUpdate = !updatePossible;
+ updatePossible = true;
+ if ( forceUpdate )
+ updateView();
}