summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp22
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/komonthview.cpp89
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp6
5 files changed, 85 insertions, 42 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 12af655..f9af769 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -232,8 +232,9 @@ CalendarView::CalendarView( Calendar *calendar,
init();}
void CalendarView::init()
{
+ mBlockShowDates = false;
beamDialog = new KOBeamPrefs();
mDatePickerMode = 0;
mCurrentSyncDevice = "";
writeLocale();
@@ -345,23 +346,23 @@ void CalendarView::init()
#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() ) );
-
+
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
-
+
connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
mNavigator, SLOT( selectWeek( const QDate & ) ) );
connect( mDateNavigator, SIGNAL( goPrevYear() ),
@@ -496,9 +497,11 @@ CalendarView::~CalendarView()
}
void CalendarView::showDay( QDate d )
{
+ dateNavigator()->blockSignals( true );
dateNavigator()->selectDate( d );
+ dateNavigator()->blockSignals( false );
mViewManager->showWeekView();
dateNavigator()->selectDate( d );
}
void CalendarView::timerAlarm()
@@ -671,9 +674,11 @@ void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
mAlarmTimer->stop();
}
void CalendarView::selectWeekNum ( int num )
{
+ dateNavigator()->blockSignals( true );
dateNavigator()->selectWeek( num );
+ dateNavigator()->blockSignals( false );
mViewManager->showWeekView();
}
KOViewManager *CalendarView::viewManager()
{
@@ -3464,12 +3469,15 @@ void CalendarView::checkClipboard()
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;
selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 646973d..e27da9a 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -479,8 +479,9 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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()
@@ -490,8 +491,9 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void writeLocale();
Todo *selectedTodo();
private:
+ bool mBlockShowDates;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9344567..842f6eb 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -78,11 +78,14 @@ 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 );
if ( ! item ) {
@@ -307,22 +310,11 @@ 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 );
}
@@ -391,17 +383,24 @@ 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() ) {
mItemList->setLineWidth( 3 );
} else {
mItemList->setLineWidth( 1 );
}
mItemList->clear();
+
+
+
#ifdef DESKTOP_VERSION
QToolTip::remove(this);
#endif
QString tipText("");
@@ -414,9 +413,18 @@ void MonthViewCell::updateCell()
}
//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 )
@@ -482,8 +490,9 @@ void MonthViewCell::updateCell()
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())
@@ -491,22 +500,12 @@ void MonthViewCell::updateCell()
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 ) {
- mItemList->insertItem( item );
- tipText += "\n";
- } else
- tipText = "";
+#endif
+ mItemList->insertItem( item );
+ tipText += "\n";
+
}
// insert due todos
QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
@@ -556,11 +555,22 @@ void MonthViewCell::updateCell()
#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()
{
@@ -637,8 +647,13 @@ 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 );
size = width() - mLabel->width();
@@ -712,8 +727,9 @@ 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
@@ -919,9 +935,12 @@ 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();
}
@@ -953,9 +972,9 @@ void KOMonthView::computeLayout()
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;
@@ -1031,8 +1050,12 @@ void KOMonthView::computeLayout()
// 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 )
{
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 4c1567c..727f511 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -39,8 +39,9 @@
#ifdef DESKTOP_VERSION
class QToolTipGroup;
#endif
+class KNOWhatsThis;
class KOWeekButton : public QPushButton
{
Q_OBJECT
public:
@@ -64,9 +65,9 @@ class KNoScrollListBox: public QListBox
{
Q_OBJECT
public:
KNoScrollListBox(QWidget *parent=0, const char *name=0);
- ~KNoScrollListBox() {}
+ ~KNoScrollListBox();
QString getWhatsThisText(QPoint p) ;
signals:
void shiftDown();
@@ -76,8 +77,11 @@ class KNoScrollListBox: public QListBox
protected slots:
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
void mousePressEvent(QMouseEvent *);
+
+ private:
+ KNOWhatsThis * mWT;
};
class MonthViewItem: public QListBoxItem
@@ -211,8 +215,9 @@ 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:
virtual void updateView();
@@ -238,8 +243,9 @@ class KOMonthView: public KOEventView
void viewChanged();
void updateDayLabels();
private:
+ bool updatePossible;
int mDaysPerWeek;
int mNumWeeks;
int mNumCells;
bool mWeekStartsMonday;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index cf56fcf..00a5842 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -44,8 +44,9 @@
#include "kojournalview.h"
#include "kotimespanview.h"
#include "koprefs.h"
#include "navigatorbar.h"
+#include "kdatenavigator.h"
#include "koviewmanager.h"
//extern bool externFlagMonthviewBlockPainting;
@@ -275,10 +276,13 @@ 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;
}