summaryrefslogtreecommitdiffabout
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
parenta9f8ad6916ea1a849a43fe49c4085f6c44b5c47b (diff)
downloadkdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.zip
kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.gz
kdepimpi-ade7e8fcdcf45d5bc73ea73da6f9a1b06964a64e.tar.bz2
many view fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp10
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/komonthview.cpp85
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp6
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
@@ -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() ),
@@ -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 &noti )
}
void CalendarView::selectWeekNum ( int num )
{
+ dateNavigator()->blockSignals( true );
dateNavigator()->selectWeek( num );
+ dateNavigator()->blockSignals( false );
mViewManager->showWeekView();
}
KOViewManager *CalendarView::viewManager()
@@ -3465,11 +3470,14 @@ 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);
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<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 );
@@ -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 ) {
+#endif
mItemList->insertItem( item );
tipText += "\n";
- } else
- tipText = "";
+
}
// 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;
}