author | zautrix <zautrix> | 2005-01-19 22:57:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-19 22:57:42 (UTC) |
commit | ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e (patch) (side-by-side diff) | |
tree | 990ed560fbf9126fba2abdaf98c036cddad2d94f | |
parent | a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b (diff) | |
download | kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.zip kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.gz kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.bz2 |
many view fixes
-rw-r--r-- | korganizer/calendarview.cpp | 10 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 85 | ||||
-rw-r--r-- | korganizer/komonthview.h | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 6 |
5 files changed, 77 insertions, 34 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 12af655..f9af769 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -228,16 +228,17 @@ CalendarView::CalendarView( Calendar *calendar, { mEventEditor = 0; mTodoEditor = 0; init();} void CalendarView::init() { + mBlockShowDates = false; beamDialog = new KOBeamPrefs(); mDatePickerMode = 0; mCurrentSyncDevice = ""; writeLocale(); mViewManager = new KOViewManager( this ); mDialogManager = new KODialogManager( this ); mEventViewerDialog = 0; mModified = false; @@ -341,19 +342,19 @@ void CalendarView::init() } if ( !KOPrefs::instance()->mShowDateNavigator) mDateNavigator->hide(); //qDebug("Calendarview Size %d %d ", width(), height()); #endif 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() ), mNavigator, SLOT( selectNextYear() ) ); connect( mNavigatorBar, SIGNAL( goPrevMonth() ), mNavigator, SLOT( selectPreviousMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextMonth() ), mNavigator, SLOT( selectNextMonth() ) ); @@ -492,17 +493,19 @@ CalendarView::~CalendarView() delete mStorage; delete mDateFrame ; delete beamDialog; //kdDebug() << "~CalendarView() done" << endl; } void CalendarView::showDay( QDate d ) { + dateNavigator()->blockSignals( true ); dateNavigator()->selectDate( d ); + dateNavigator()->blockSignals( false ); mViewManager->showWeekView(); dateNavigator()->selectDate( d ); } void CalendarView::timerAlarm() { //qDebug("CalendarView::timerAlarm() "); computeAlarm(mAlarmNotification ); } @@ -667,17 +670,19 @@ void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); #endif return; } mAlarmTimer->stop(); } void CalendarView::selectWeekNum ( int num ) { + dateNavigator()->blockSignals( true ); dateNavigator()->selectWeek( num ); + dateNavigator()->blockSignals( false ); mViewManager->showWeekView(); } KOViewManager *CalendarView::viewManager() { return mViewManager; } KODialogManager *CalendarView::dialogManager() @@ -3460,21 +3465,24 @@ void CalendarView::checkClipboard() } #endif } void CalendarView::showDates(const DateList &selectedDates) { // kdDebug() << "CalendarView::selectDates()" << endl; + + if ( !mBlockShowDates ) { if ( mViewManager->currentView() ) { updateView( selectedDates.first(), selectedDates.last() ); } else { mViewManager->showAgendaView(); } + } QString selDates; selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); if (selectedDates.first() < selectedDates.last() ) selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); } diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 646973d..e27da9a 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -475,27 +475,29 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser Event* getLastSyncEvent(); /** Adapt navigation units correpsonding to step size of navigation of the * current view. */ void adaptNavigationUnits(); 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); // returns KMsgBox::OKCandel() int msgItemDelete(); void showEventEditor(); void showTodoEditor(); void writeLocale(); Todo *selectedTodo(); private: + bool mBlockShowDates; KSyncManager* mSyncManager; AlarmDialog * mAlarmDialog; QString mAlarmNotification; QString mSuspendAlarmNotification; QTimer* mSuspendTimer; QTimer* mAlarmTimer; QTimer* mRecheckAlarmTimer; void computeAlarm( QString ); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9344567..842f6eb 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -74,19 +74,22 @@ private: KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) : QListBox(parent, 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 ); if ( ! item ) { return i18n("Click in the cell\nto add an event!"); } return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); } @@ -303,30 +306,19 @@ QToolTipGroup *MonthViewCell::toolTipGroup() if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); return mToolTipGroup; } #endif 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 ); } QDate MonthViewCell::date() const { return mDate; } @@ -387,40 +379,56 @@ void MonthViewCell::setHoliday( const QString &holiday ) void MonthViewCell::keyPressEvent ( QKeyEvent * e ) { e->ignore(); } 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() ) { mItemList->setLineWidth( 3 ); } else { mItemList->setLineWidth( 1 ); } mItemList->clear(); + + + #ifdef DESKTOP_VERSION QToolTip::remove(this); #endif QString tipText(""); //qApp->processEvents(); if ( !mHolidayString.isEmpty() ) { MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); item->setPalette( mHolidayPalette ); mItemList->insertItem( item ); tipText += mHolidayString+"\n"; } //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 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"))) { setHoliday( true ); if ( mDate.dayOfWeek() == 7 ) mItemList->setLineWidth( 3 ); } QString text; if (event->isMultiDay()) { @@ -478,39 +486,30 @@ void MonthViewCell::updateCell() } else { pal = mStandardPalette ; } item->setPalette( pal ); 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 ) { if ( me->status() == Attendee::NeedsAction && me->RSVP()) item->setReply(true); else 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 ) { +#endif mItemList->insertItem( item ); tipText += "\n"; - } else - tipText = ""; + } // insert due todos QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); Todo *todo; for(todo = todos.first(); todo; todo = todos.next()) { QString text; if (todo->hasDueDate()) { @@ -552,19 +551,30 @@ void MonthViewCell::updateCell() } #ifdef DESKTOP_VERSION if (tipText != "") QToolTip::add(this,tipText,toolTipGroup(),""); #endif //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() { setFont( KOPrefs::instance()->mMonthViewFont ); QFontMetrics fm( font() ); @@ -633,16 +643,21 @@ void MonthViewCell::deselect() } void MonthViewCell::select() { ;// updateCell(); } void MonthViewCell::resizeEvent ( QResizeEvent * ) { + if ( !mMonthView->isUpdatePossible() ) + return; + if ( !isVisible() ){ + return; + } int size = height() - mLabel->height(); if ( size > 0 ) mItemList->verticalScrollBar()->setMaximumHeight( size ); size = width() - mLabel->width(); if ( size > 0 ) mItemList->horizontalScrollBar()->setMaximumWidth( size ); mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); @@ -708,16 +723,17 @@ void MonthViewCell::selection( QListBoxItem *item ) // ******************************************************************************* KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) : KOEventView( calendar, parent, 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 ); // create the day of the week labels (Sun, Mon, etc) and add them to // the layout. mDayLabels.resize( mDaysPerWeek ); QFont bfont = font(); if ( QApplication::desktop()->width() < 650 ) { @@ -915,17 +931,20 @@ void KOMonthView::changeEventDisplay(Event *, int) { // this should be re-written to be much more efficient, but this // quick-and-dirty-hack gets the job done for right now. updateView(); } void KOMonthView::updateView() { - + static int iii = 0; + ++iii; + if ( !updatePossible ) + return; uint i; for( i = 0; i < mCells.count(); ++i ) { mCells[i]->updateCell(); } //qDebug("KOMonthView::updateView() "); processSelectionChange(); } @@ -949,17 +968,17 @@ void KOMonthView::computeLayout() int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); int wid = size().width();//e int hei = size().height()-1; 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; int colWid = wid / daysToShow; int lastCol = wid - ( colWid*6 ); int dayLabelHei = mDayLabels[0]->sizeHint().height(); int cellHei = (hei - dayLabelHei) /6; @@ -1027,16 +1046,20 @@ void KOMonthView::computeLayout() mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); y += h; } mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //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 ) { mContextMenu->showIncidencePopup(incidence); /* if( incidence && incidence->type() == "Event" ) { Event *event = static_cast<Event *>(incidence); diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 4c1567c..727f511 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -35,16 +35,17 @@ #include <libkcal/event.h> #include "koeventview.h" #ifdef DESKTOP_VERSION class QToolTipGroup; #endif +class KNOWhatsThis; class KOWeekButton : public QPushButton { Q_OBJECT public: KOWeekButton( QWidget *parent=0, const char *name=0 ) : QPushButton( parent, name) { connect( this, SIGNAL( clicked() ), @@ -60,28 +61,31 @@ private slots : void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } }; class KNoScrollListBox: public QListBox { Q_OBJECT public: KNoScrollListBox(QWidget *parent=0, const char *name=0); - ~KNoScrollListBox() {} + ~KNoScrollListBox(); QString getWhatsThisText(QPoint p) ; signals: void shiftDown(); void shiftUp(); void rightClick(); protected slots: void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void mousePressEvent(QMouseEvent *); + + private: + KNOWhatsThis * mWT; }; class MonthViewItem: public QListBoxItem { public: MonthViewItem( Incidence *, QDate qd, const QString & title ); @@ -207,16 +211,17 @@ class KOMonthView: public KOEventView virtual QPtrList<Incidence> selectedIncidences(); /** returns dates of the currently selected events */ virtual DateList selectedDates(); virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); bool isMonthView() { return true; } + bool isUpdatePossible() { return updatePossible; } MonthViewCell * selectedCell(); public slots: virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); @@ -234,16 +239,17 @@ class KOMonthView: public KOEventView void selectWeekNum ( int ); void showDaySignal( QDate ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); void updateDayLabels(); private: + bool updatePossible; int mDaysPerWeek; int mNumWeeks; int mNumCells; bool mWeekStartsMonday; bool mShowSatSunComp; void computeLayout(); QPtrVector<MonthViewCell> mCells; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index cf56fcf..00a5842 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -40,16 +40,17 @@ #include "kodialogmanager.h" #include "komonthview.h" #include "kolistview.h" #include "kowhatsnextview.h" #include "kojournalview.h" #include "kotimespanview.h" #include "koprefs.h" #include "navigatorbar.h" +#include "kdatenavigator.h" #include "koviewmanager.h" //extern bool externFlagMonthviewBlockPainting; //bool globalFlagBlockPainting = false; int globalFlagBlockAgenda = 0; int globalFlagBlockLabel = 0; int globalFlagBlockAgendaItemPaint = 1; @@ -271,18 +272,21 @@ void KOViewManager::showListView() connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); } // 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; } void KOViewManager::showAgendaView( bool fullScreen ) { mMainView->dialogManager()->hideSearchDialog(); |