summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kdatenavigator.cpp3
-rw-r--r--korganizer/komonthview.cpp226
-rw-r--r--korganizer/komonthview.h14
-rw-r--r--korganizer/koviewmanager.cpp3
4 files changed, 175 insertions, 71 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 6438c9a..0cb767f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -121,3 +121,4 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
mFontChanged = false;
- resize ( 0,0 );
+ resize ( 3,3 );
+
}
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 050bfb9..38cfda7 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -196,2 +196,3 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
{
+ mblockRepaint = true;
setText( s );
@@ -204,2 +205,15 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
mInfo = false;
+ //qDebug("NEWWWWWWWWWWWWW ");
+}
+void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
+{
+ setText( s );
+ mMultiday = 0;
+ mIncidence = incidence;
+ mDate = qd;
+ mRecur = false;
+ mAlarm = false;
+ mReply = false;
+ mInfo = false;
+ //qDebug("recucleeeeeeeeeeeeeeeee ");
}
@@ -208,2 +222,7 @@ void MonthViewItem::paint(QPainter *p)
{
+ if ( mblockRepaint ) {
+ //qDebug("block ");
+ return;
+ }
+ //qDebug("NON block ");
#if QT_VERSION >= 0x030000
@@ -355,3 +374,3 @@ int MonthViewItem::width(const QListBox *lb) const
MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
- : QWidget( par ),
+ : KNoScrollListBox( par ),
mMonthView( parent )
@@ -359,4 +378,5 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
+ mCurrentAvailItem = 0;
//QVBoxLayout *topLayout = new QVBoxLayout( this );
-
+ currentPalette = 0;
// mLabel = new QLabel( this );QPushButton
@@ -368,6 +388,6 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
mLabel->setFocusPolicy(NoFocus);
- mItemList = new KNoScrollListBox( this );
- mItemList->setMinimumSize( 10, 10 );
- mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
- mItemList->setLineWidth( 1 );
+ //mItemList = new KNoScrollListBox( this );
+ setMinimumSize( 10, 10 );
+ setFrameStyle( QFrame::Panel | QFrame::Plain );
+ setLineWidth( 1 );
//topLayout->addWidget( mItemList );
@@ -382,12 +402,12 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
- connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ),
+ connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
SLOT( defaultAction( QListBoxItem * ) ) );
- connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *,
+ connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
const QPoint &) ),
SLOT( contextMenu( QListBoxItem * ) ) );
- connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
+ connect( this, SIGNAL( highlighted( QListBoxItem *) ),
SLOT( selection( QListBoxItem * ) ) );
- connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
+ connect( this, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( cellClicked( QListBoxItem * ) ) );
- connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
+ connect( this, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( selection( QListBoxItem * ) ) );
@@ -424,13 +444,24 @@ void MonthViewCell::setMyPalette()
{
-
+
if ( mHoliday) {
+ if ( currentPalette == 1 ) return;
mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
- mItemList->setPalette( mHolidayPalette );
+ setPalette( mHolidayPalette );
+ //mLabel->setPalette( mHolidayPalette );
+ currentPalette = 1;
+
} else {
if ( mPrimary ) {
+ if ( currentPalette == 2 ) return;
mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
- mItemList->setPalette( mPrimaryPalette );
+ //mLabel->setPalette( mPrimaryPalette );
+ setPalette( mPrimaryPalette );
+ currentPalette = 2;
+
} else {
- mItemList->setPalette( mNonPrimaryPalette );
- mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
+ if ( currentPalette == 3 ) return;
+ setPalette( mNonPrimaryPalette );
+ mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
+ //mLabel->setPalette( mNonPrimaryPalette );;
+ currentPalette = 3;
}
@@ -473,8 +504,2 @@ void MonthViewCell::setHoliday( const QString &holiday )
}
-void MonthViewCell::keyPressEvent ( QKeyEvent * e )
-{
-
- e->ignore();
-
-}
@@ -483,6 +508,10 @@ void MonthViewCell::startUpdateCell()
- mItemList->setFocusPolicy(NoFocus);
+ setFocusPolicy(NoFocus);
if ( !mMonthView->isUpdatePossible() )
return;
-
+ MonthViewItem *mitem = (MonthViewItem*) firstItem ();
+ while ( mitem ) {
+ mitem->setBlockRepaint( true );
+ mitem = (MonthViewItem *)mitem->next();
+ }
/*
@@ -496,7 +525,8 @@ void MonthViewCell::startUpdateCell()
if ( mDate == QDate::currentDate() ) {
- mItemList->setLineWidth( 3 );
+ setLineWidth( 3 );
} else {
- mItemList->setLineWidth( 1 );
+ setLineWidth( 1 );
}
- mItemList->clear();
+ mCurrentAvailItem = (MonthViewItem*) firstItem ();
+ //clear();
@@ -507,2 +537,3 @@ void MonthViewCell::startUpdateCell()
//qApp->processEvents();
+#if 0
if ( !mHolidayString.isEmpty() ) {
@@ -510,5 +541,6 @@ void MonthViewCell::startUpdateCell()
item->setPalette( mHolidayPalette );
- mItemList->insertItem( item );
+ insertItem( item );
mToolTip.append ( mHolidayString );
}
+#endif
}
@@ -518,3 +550,4 @@ void MonthViewCell::insertEvent(Event *event)
QString mToolTipText;
- mItemList->setFocusPolicy(WheelFocus);
+ bool insertNewItem = false;
+ setFocusPolicy(WheelFocus);
if ( !(event->doesRecur() == Recurrence::rNone) ) {
@@ -530,3 +563,3 @@ void MonthViewCell::insertEvent(Event *event)
if ( mDate.dayOfWeek() == 7 )
- mItemList->setLineWidth( 3 );
+ setLineWidth( 3 );
}
@@ -575,4 +608,18 @@ void MonthViewCell::insertEvent(Event *event)
}
-
- MonthViewItem *item = new MonthViewItem( event, mDate, text );
+ MonthViewItem *item ;
+ if ( mCurrentAvailItem ) {
+ item = mCurrentAvailItem;
+ mCurrentAvailItem = (MonthViewItem*) item->next();
+ item->recycle( event, mDate, text );
+ } else {
+ if ( mAvailItemList.count() ) {
+ item = mAvailItemList.first();
+ mAvailItemList.remove( item );
+ item->recycle( event, mDate, text );
+ insertNewItem = true;
+ } else {
+ insertNewItem = true;
+ item = new MonthViewItem( event, mDate, text );
+ }
+ }
QPalette pal;
@@ -616,3 +663,4 @@ void MonthViewCell::insertEvent(Event *event)
item->setMultiDay( multiday );
- mItemList->insertItem( item );
+ if ( insertNewItem)
+ insertItem( item );
mToolTip.append( mToolTipText );
@@ -621,3 +669,4 @@ void MonthViewCell::insertTodo(Todo *todo)
{
- mItemList->setFocusPolicy(WheelFocus);
+ bool insertNewItem = false;
+ setFocusPolicy(WheelFocus);
QString text;
@@ -630,4 +679,19 @@ void MonthViewCell::insertTodo(Todo *todo)
text += todo->summary();
-
- MonthViewItem *item = new MonthViewItem( todo, mDate, text );
+ MonthViewItem *item ;
+ if ( mCurrentAvailItem ) {
+ item = mCurrentAvailItem;
+ mCurrentAvailItem = (MonthViewItem*) item->next();
+ item->recycle( todo, mDate, text );
+ } else {
+ if ( mAvailItemList.count() ) {
+ item = mAvailItemList.first();
+ mAvailItemList.remove( item );
+ item->recycle( todo, mDate, text );
+ insertNewItem = true;
+ } else {
+ insertNewItem = true;
+ item = new MonthViewItem( todo, mDate, text );
+ }
+ }
+ //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
//item->setPalette( mStandardPalette );
@@ -660,7 +724,25 @@ void MonthViewCell::insertTodo(Todo *todo)
item->setMoreInfo( todo->description().length() > 0 );
- mItemList->insertItem( item );
+ if ( insertNewItem)
+ insertItem( item );
mToolTip.append( text );
}
+void MonthViewCell::repaintfinishUpdateCell()
+{
+ MonthViewItem *mitem = (MonthViewItem*) firstItem ();
+ while ( mitem ) {
+ mitem->setBlockRepaint( false );
+ updateItem ( mitem );
+ mitem = (MonthViewItem *)mitem->next();
+ }
+}
void MonthViewCell::finishUpdateCell()
{
+ while ( mCurrentAvailItem ) {
+ MonthViewItem *item = mCurrentAvailItem;
+ mCurrentAvailItem = (MonthViewItem *)item->next();
+ mAvailItemList.append( item );
+ takeItem ( item );
+ }
+
+
#ifdef DESKTOP_VERSION
@@ -671,3 +753,3 @@ void MonthViewCell::finishUpdateCell()
#endif
- mItemList->sort();
+ sort();
//setMyPalette();
@@ -748,15 +830,22 @@ void MonthViewCell::enableScrollBars( bool enabled )
if ( enabled ) {
- //mItemList->setVScrollBarMode(QScrollView::Auto);
- mItemList->setHScrollBarMode(QScrollView::Auto);
- QListBoxItem *fi = mItemList->firstItem ();
+
+ QListBoxItem *fi = firstItem ();
if (fi ) {
- int hei = mItemList->numRows () * fi->height(mItemList);
- if ( hei < height() - mItemList->horizontalScrollBar()->height () )
- mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
+ int ihei = fi->height( this );
+ int hei = numRows () * ihei;
+ if ( hei < height() - horizontalScrollBar()->height () )
+ setVScrollBarMode(QScrollView::AlwaysOff);
else
- mItemList->setVScrollBarMode(QScrollView::Auto);
+ setVScrollBarMode(QScrollView::Auto);
+ if ( ihei *3 > height() )
+ setHScrollBarMode(QScrollView::AlwaysOff);
+ else
+ setHScrollBarMode(QScrollView::Auto);
+ } else {
+ setVScrollBarMode(QScrollView::Auto);
+ setHScrollBarMode(QScrollView::Auto);
}
} else {
- mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
- mItemList->setHScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(QScrollView::AlwaysOff);
+ setHScrollBarMode(QScrollView::AlwaysOff);
}
@@ -766,11 +855,11 @@ Incidence *MonthViewCell::selectedIncidence()
{
- int index = mItemList->currentItem();
+ int index = currentItem();
if ( index < 0 ) return 0;
- MonthViewItem *item =
- static_cast<MonthViewItem *>( mItemList->item( index ) );
+ MonthViewItem *mitem =
+ static_cast<MonthViewItem *>( item( index ) );
- if ( !item ) return 0;
+ if ( !mitem ) return 0;
- return item->incidence();
+ return mitem->incidence();
}
@@ -780,11 +869,11 @@ QDate MonthViewCell::selectedIncidenceDate()
QDate qd;
- int index = mItemList->currentItem();
+ int index = currentItem();
if ( index < 0 ) return qd;
- MonthViewItem *item =
- static_cast<MonthViewItem *>( mItemList->item( index ) );
+ MonthViewItem *mitem =
+ static_cast<MonthViewItem *>( item( index ) );
- if ( !item ) return qd;
+ if ( !mitem ) return qd;
- return item->incidenceDate();
+ return mitem->incidenceDate();
}
@@ -793,3 +882,3 @@ void MonthViewCell::deselect()
{
- mItemList->clearSelection();
+ clearSelection();
enableScrollBars( false );
@@ -808,12 +897,14 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
deselect();
- int size = height() - mLabel->height() - 2;
+ int size = height() - mLabel->height() - lineWidth()-1;
+ //qDebug("LW %d ", lineWidth());
if ( size > 0 )
- mItemList->verticalScrollBar()->setMaximumHeight( size );
- size = width() - mLabel->width() -2;
+ verticalScrollBar()->setMaximumHeight( size );
+ size = width() - mLabel->width() -lineWidth()-1;
if ( size > 0 )
- mItemList->horizontalScrollBar()->setMaximumWidth( size );
- mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
+ horizontalScrollBar()->setMaximumWidth( size );
+ mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
- mItemList->resize ( width(), height () );
-
+ // mItemList->resize ( width(), height () );
+ if ( e )
+ KNoScrollListBox::resizeEvent ( e );
}
@@ -1262,2 +1353,3 @@ void KOMonthView::updateView()
return;
+ //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
//QTime ti;
@@ -1358,2 +1450,6 @@ void KOMonthView::updateView()
processSelectionChange();
+ qApp->processEvents();
+ for( i = 0; i < timeSpan+1; ++i ) {
+ (*cells)[i]->repaintfinishUpdateCell();
+ }
(*cells)[0]->setFocus();
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 89912e0..b997c1a 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -95,3 +95,3 @@ class MonthViewItem: public QListBoxItem
MonthViewItem( Incidence *, QDate qd, const QString & title );
-
+ void recycle( Incidence *incidence, QDate qd, const QString & s);
void setRecur(bool on) { mRecur = on; }
@@ -101,2 +101,3 @@ class MonthViewItem: public QListBoxItem
void setMultiDay(int type) { mMultiday = type; }
+ void setBlockRepaint(bool on) { mblockRepaint = on; }
@@ -115,2 +116,3 @@ class MonthViewItem: public QListBoxItem
private:
+ bool mblockRepaint;
int mMultiday;
@@ -130,3 +132,3 @@ class KOMonthView;
-class MonthViewCell : public QWidget
+class MonthViewCell : public KNoScrollListBox
{
@@ -135,2 +137,3 @@ class MonthViewCell : public QWidget
MonthViewCell(KOMonthView *,QWidget* );
+ ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
@@ -148,2 +151,3 @@ class MonthViewCell : public QWidget
void finishUpdateCell();
+ void repaintfinishUpdateCell();
void insertEvent(Event *);
@@ -185,3 +189,6 @@ public slots:
private:
+ MonthViewItem* mCurrentAvailItem;
+ QPtrList <MonthViewItem> mAvailItemList;
KOMonthView *mMonthView;
+ int currentPalette;
@@ -194,3 +201,3 @@ public slots:
QPushButton *mLabel;
- QListBox *mItemList;
+ //QListBox *mItemList;
#ifdef DESKTOP_VERSION
@@ -206,3 +213,2 @@ public slots:
QPalette getPalette ();
- void keyPressEvent ( QKeyEvent * ) ;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 94d74f1..c6e76c4 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -210,2 +210,3 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
}
+ bool callupdate = !(view == mCurrentView);
bool full = fullScreen;
@@ -231,3 +232,3 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
//mMainView->updateView();
- raiseCurrentView( full, true );
+ raiseCurrentView( full, callupdate );
mMainView->adaptNavigationUnits();