From ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 19 Jan 2005 22:57:42 +0000 Subject: many view fixes --- (limited to 'korganizer') diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 12af655..f9af769 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -233,6 +233,7 @@ CalendarView::CalendarView( Calendar *calendar, void CalendarView::init() { + mBlockShowDates = false; beamDialog = new KOBeamPrefs(); mDatePickerMode = 0; mCurrentSyncDevice = ""; @@ -346,9 +347,9 @@ void CalendarView::init() connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( showDates( const KCal::DateList & ) ) ); + connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); - connect( mNavigatorBar, SIGNAL( goPrevYear() ), mNavigator, SLOT( selectPreviousYear() ) ); connect( mNavigatorBar, SIGNAL( goNextYear() ), @@ -357,10 +358,10 @@ void CalendarView::init() mNavigator, SLOT( selectPreviousMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextMonth() ), mNavigator, SLOT( selectNextMonth() ) ); - + connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); - + connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), mNavigator, SLOT( selectWeek( const QDate & ) ) ); @@ -497,7 +498,9 @@ CalendarView::~CalendarView() void CalendarView::showDay( QDate d ) { + dateNavigator()->blockSignals( true ); dateNavigator()->selectDate( d ); + dateNavigator()->blockSignals( false ); mViewManager->showWeekView(); dateNavigator()->selectDate( d ); } @@ -672,7 +675,9 @@ void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) } void CalendarView::selectWeekNum ( int num ) { + dateNavigator()->blockSignals( true ); dateNavigator()->selectWeek( num ); + dateNavigator()->blockSignals( false ); mViewManager->showWeekView(); } KOViewManager *CalendarView::viewManager() @@ -3465,10 +3470,13 @@ void CalendarView::showDates(const DateList &selectedDates) { // kdDebug() << "CalendarView::selectDates()" << endl; - if ( mViewManager->currentView() ) { - updateView( selectedDates.first(), selectedDates.last() ); - } else { - mViewManager->showAgendaView(); + + if ( !mBlockShowDates ) { + if ( mViewManager->currentView() ) { + updateView( selectedDates.first(), selectedDates.last() ); + } else { + mViewManager->showAgendaView(); + } } QString selDates; diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 646973d..e27da9a 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -480,6 +480,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); //Attendee* getYourAttendee(Event *event); + void setBlockShowDates( bool b ) { mBlockShowDates = b ;} protected: void schedule(Scheduler::Method, Incidence *incidence = 0); @@ -491,6 +492,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser Todo *selectedTodo(); private: + bool mBlockShowDates; KSyncManager* mSyncManager; AlarmDialog * mAlarmDialog; QString mAlarmNotification; diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9344567..842f6eb 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -79,9 +79,12 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif - new KNOWhatsThis(this); + mWT = new KNOWhatsThis(this); +} +KNoScrollListBox::~KNoScrollListBox() +{ + delete mWT; } - QString KNoScrollListBox::getWhatsThisText(QPoint p) { QListBoxItem* item = itemAt ( p ); @@ -308,20 +311,9 @@ QToolTipGroup *MonthViewCell::toolTipGroup() 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 ); } @@ -392,7 +384,11 @@ 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); if ( mDate == QDate::currentDate() ) { @@ -401,6 +397,9 @@ void MonthViewCell::updateCell() mItemList->setLineWidth( 1 ); } mItemList->clear(); + + + #ifdef DESKTOP_VERSION QToolTip::remove(this); #endif @@ -415,7 +414,16 @@ void MonthViewCell::updateCell() //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); QPtrList 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"))) { setHoliday( true ); @@ -483,6 +491,7 @@ void MonthViewCell::updateCell() item->setRecur( event->recurrence()->doesRecur() ); item->setAlarm( event->isAlarmEnabled() ); item->setMoreInfo( event->description().length() > 0 ); +#ifdef DESKTOP_VERSION Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, KOPrefs::instance()->email()); if ( me != 0 ) { @@ -492,20 +501,10 @@ void MonthViewCell::updateCell() item->setReply(false); } 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"; + } // insert due todos @@ -557,9 +556,20 @@ 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(); } void MonthViewCell::updateConfig() @@ -638,6 +648,11 @@ void MonthViewCell::select() void MonthViewCell::resizeEvent ( QResizeEvent * ) { + if ( !mMonthView->isUpdatePossible() ) + return; + if ( !isVisible() ){ + return; + } int size = height() - mLabel->height(); if ( size > 0 ) mItemList->verticalScrollBar()->setMaximumHeight( size ); @@ -713,6 +728,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) { + updatePossible = false; mCells.setAutoDelete( true ); mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; // mDayLayout = new QGridLayout( this ); @@ -920,7 +936,10 @@ 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 ) { mCells[i]->updateCell(); @@ -954,7 +973,7 @@ 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" ); wid -= weeklabelwid; @@ -1032,6 +1051,10 @@ void KOMonthView::computeLayout() //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; updateDayLabels(); + bool forceUpdate = !updatePossible; + updatePossible = true; + if ( forceUpdate ) + updateView(); } void KOMonthView::showContextMenu( Incidence *incidence ) diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 4c1567c..727f511 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -40,6 +40,7 @@ class QToolTipGroup; #endif +class KNOWhatsThis; class KOWeekButton : public QPushButton { Q_OBJECT @@ -65,7 +66,7 @@ class KNoScrollListBox: public QListBox Q_OBJECT public: KNoScrollListBox(QWidget *parent=0, const char *name=0); - ~KNoScrollListBox() {} + ~KNoScrollListBox(); QString getWhatsThisText(QPoint p) ; signals: @@ -77,6 +78,9 @@ class KNoScrollListBox: public QListBox void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void mousePressEvent(QMouseEvent *); + + private: + KNOWhatsThis * mWT; }; @@ -212,6 +216,7 @@ class KOMonthView: public KOEventView virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); bool isMonthView() { return true; } + bool isUpdatePossible() { return updatePossible; } MonthViewCell * selectedCell(); public slots: @@ -239,6 +244,7 @@ class KOMonthView: public KOEventView void updateDayLabels(); private: + bool updatePossible; int mDaysPerWeek; int mNumWeeks; int mNumCells; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index cf56fcf..00a5842 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -45,6 +45,7 @@ #include "kotimespanview.h" #include "koprefs.h" #include "navigatorbar.h" +#include "kdatenavigator.h" #include "koviewmanager.h" //extern bool externFlagMonthviewBlockPainting; @@ -276,8 +277,11 @@ void KOViewManager::showListView() // bool temp = mFlagShowNextxDays; //globalFlagBlockPainting = true; globalFlagBlockAgenda = 1; - if ( KOPrefs::instance()->mListViewMonthTimespan ) + if ( KOPrefs::instance()->mListViewMonthTimespan ) { + mMainView->setBlockShowDates( true ); mMainView->dateNavigator()->selectMonth(); + mMainView->setBlockShowDates( false ); + } showView(mListView, KOPrefs::instance()->mFullViewTodo); //mFlagShowNextxDays = temp; } -- cgit v0.9.0.2