summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-25 05:47:45 (UTC)
committer zautrix <zautrix>2005-03-25 05:47:45 (UTC)
commite3b935f4e24086117213662e670ab26cb2ad8822 (patch) (side-by-side diff)
treed20ad8e8dd09cc3efb9f9e57568d4d009048d518
parent658354b7112aff72f0fadd924c82b977d803bc27 (diff)
downloadkdepimpi-e3b935f4e24086117213662e670ab26cb2ad8822.zip
kdepimpi-e3b935f4e24086117213662e670ab26cb2ad8822.tar.gz
kdepimpi-e3b935f4e24086117213662e670ab26cb2ad8822.tar.bz2
mal sehn...
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kdatenavigator.cpp3
-rw-r--r--korganizer/komonthview.cpp222
-rw-r--r--korganizer/komonthview.h14
-rw-r--r--korganizer/koviewmanager.cpp3
4 files changed, 173 insertions, 69 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 6438c9a..0cb767f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -120,5 +120,6 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
myFullSizeHint = sizeHintTwoButtons( 4 );
mFontChanged = false;
- resize ( 0,0 );
+ resize ( 3,3 );
+
}
void KDateNavigator::changeFont ( QFont fo )
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 050bfb9..38cfda7 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -195,4 +195,5 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
: QListBoxItem()
{
+ mblockRepaint = true;
setText( s );
mMultiday = 0;
@@ -203,8 +204,26 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
mReply = false;
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 ");
}
void MonthViewItem::paint(QPainter *p)
{
+ if ( mblockRepaint ) {
+ //qDebug("block ");
+ return;
+ }
+ //qDebug("NON block ");
#if QT_VERSION >= 0x030000
bool sel = isSelected();
@@ -354,10 +373,11 @@ int MonthViewItem::width(const QListBox *lb) const
MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
- : QWidget( par ),
+ : KNoScrollListBox( par ),
mMonthView( parent )
{
+ mCurrentAvailItem = 0;
//QVBoxLayout *topLayout = new QVBoxLayout( this );
-
+ currentPalette = 0;
// mLabel = new QLabel( this );QPushButton
mLabel = new QPushButton( this );
@@ -367,8 +387,8 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
mLabel->setFlat( true );
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 );
mLabel->raise();
@@ -381,14 +401,14 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
//connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
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 * ) ) );
}
@@ -425,13 +445,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 );
+ 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;
}
}
@@ -472,18 +503,16 @@ void MonthViewCell::setHoliday( const QString &holiday )
}
}
-void MonthViewCell::keyPressEvent ( QKeyEvent * e )
-{
-
- e->ignore();
-
-}
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();
+ }
/*
if ( !isVisible() ){
@@ -495,9 +524,10 @@ void MonthViewCell::startUpdateCell()
setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
if ( mDate == QDate::currentDate() ) {
- mItemList->setLineWidth( 3 );
+ setLineWidth( 3 );
} else {
- mItemList->setLineWidth( 1 );
+ setLineWidth( 1 );
}
- mItemList->clear();
+ mCurrentAvailItem = (MonthViewItem*) firstItem ();
+ //clear();
#ifdef DESKTOP_VERSION
@@ -506,10 +536,12 @@ void MonthViewCell::startUpdateCell()
mToolTip.clear();
//qApp->processEvents();
+#if 0
if ( !mHolidayString.isEmpty() ) {
MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
item->setPalette( mHolidayPalette );
- mItemList->insertItem( item );
+ insertItem( item );
mToolTip.append ( mHolidayString );
}
+#endif
}
@@ -517,5 +549,6 @@ void MonthViewCell::insertEvent(Event *event)
{
QString mToolTipText;
- mItemList->setFocusPolicy(WheelFocus);
+ bool insertNewItem = false;
+ setFocusPolicy(WheelFocus);
if ( !(event->doesRecur() == Recurrence::rNone) ) {
if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
@@ -529,5 +562,5 @@ void MonthViewCell::insertEvent(Event *event)
setHoliday( true );
if ( mDate.dayOfWeek() == 7 )
- mItemList->setLineWidth( 3 );
+ setLineWidth( 3 );
}
QString text;
@@ -574,6 +607,20 @@ 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;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
@@ -615,10 +662,12 @@ void MonthViewCell::insertEvent(Event *event)
#endif
item->setMultiDay( multiday );
- mItemList->insertItem( item );
+ if ( insertNewItem)
+ insertItem( item );
mToolTip.append( mToolTipText );
}
void MonthViewCell::insertTodo(Todo *todo)
{
- mItemList->setFocusPolicy(WheelFocus);
+ bool insertNewItem = false;
+ setFocusPolicy(WheelFocus);
QString text;
if (todo->hasDueDate()) {
@@ -629,6 +678,21 @@ 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 );
QPalette pal;
@@ -659,9 +723,27 @@ void MonthViewCell::insertTodo(Todo *todo)
item->setAlarm( todo->isAlarmEnabled() );
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
if (mToolTip.count() > 0 ) {
@@ -670,5 +752,5 @@ void MonthViewCell::finishUpdateCell()
}
#endif
- mItemList->sort();
+ sort();
//setMyPalette();
setMyPalette();
@@ -747,17 +829,24 @@ 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
+ setVScrollBarMode(QScrollView::Auto);
+ if ( ihei *3 > height() )
+ setHScrollBarMode(QScrollView::AlwaysOff);
else
- mItemList->setVScrollBarMode(QScrollView::Auto);
+ 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);
}
}
@@ -765,13 +854,13 @@ void MonthViewCell::enableScrollBars( bool enabled )
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();
}
@@ -779,18 +868,18 @@ 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();
}
void MonthViewCell::deselect()
{
- mItemList->clearSelection();
+ clearSelection();
enableScrollBars( false );
// updateCell();
@@ -807,14 +896,16 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
//qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
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 );
}
@@ -1261,4 +1352,5 @@ void KOMonthView::updateView()
if ( !updatePossible )
return;
+ //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
//QTime ti;
//ti.start();
@@ -1357,4 +1449,8 @@ 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
@@ -94,5 +94,5 @@ class MonthViewItem: public QListBoxItem
public:
MonthViewItem( Incidence *, QDate qd, const QString & title );
-
+ void recycle( Incidence *incidence, QDate qd, const QString & s);
void setRecur(bool on) { mRecur = on; }
void setAlarm(bool on) { mAlarm = on; }
@@ -100,4 +100,5 @@ class MonthViewItem: public QListBoxItem
void setMoreInfo(bool on) { mInfo = on; }
void setMultiDay(int type) { mMultiday = type; }
+ void setBlockRepaint(bool on) { mblockRepaint = on; }
@@ -114,4 +115,5 @@ class MonthViewItem: public QListBoxItem
private:
+ bool mblockRepaint;
int mMultiday;
bool mRecur;
@@ -129,9 +131,10 @@ class MonthViewItem: public QListBoxItem
class KOMonthView;
-class MonthViewCell : public QWidget
+class MonthViewCell : public KNoScrollListBox
{
Q_OBJECT
public:
MonthViewCell(KOMonthView *,QWidget* );
+ ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
void setDate( const QDate & );
@@ -147,4 +150,5 @@ class MonthViewCell : public QWidget
void startUpdateCell();
void finishUpdateCell();
+ void repaintfinishUpdateCell();
void insertEvent(Event *);
void insertTodo(Todo *);
@@ -184,5 +188,8 @@ public slots:
private:
+ MonthViewItem* mCurrentAvailItem;
+ QPtrList <MonthViewItem> mAvailItemList;
KOMonthView *mMonthView;
+ int currentPalette;
QDate mDate;
@@ -193,5 +200,5 @@ public slots:
//QLabel *mLabel;
QPushButton *mLabel;
- QListBox *mItemList;
+ //QListBox *mItemList;
#ifdef DESKTOP_VERSION
static QToolTipGroup *mToolTipGroup;
@@ -205,5 +212,4 @@ public slots:
void setMyPalette();
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
@@ -209,4 +209,5 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
return;
}
+ bool callupdate = !(view == mCurrentView);
bool full = fullScreen;
if(view == mCurrentView && view != mWhatsNextView ) {
@@ -230,5 +231,5 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
mMainView->processIncidenceSelection( 0 );
//mMainView->updateView();
- raiseCurrentView( full, true );
+ raiseCurrentView( full, callupdate );
mMainView->adaptNavigationUnits();
}