-rw-r--r-- | korganizer/koagenda.cpp | 30 | ||||
-rw-r--r-- | korganizer/koagenda.h | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 5 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 31 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 5 |
5 files changed, 65 insertions, 10 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 0280c74..c339b57 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -62,2 +62,3 @@ extern int globalFlagBlockStartup; +bool KOAgenda::mInvalidPixmap = false; //////////////////////////////////////////////////////////////////////////// @@ -180,2 +181,3 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, init(); + connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); } @@ -319,4 +321,20 @@ void KOAgenda::init() mPopupItem = 0; + mInvalidPixmap = false; + } +void KOAgenda::shrinkPixmap() +{ + mPaintPixmap.resize( 20,20); + mInvalidPixmap = true; +} +void KOAgenda::slotContentMove(int,int) +{ + if ( mActionType == NOP ) + slotClearSelection(); + if ( mSelectedItem && !mActionItem ) { + deselectItem(); + emit incidenceSelected( 0 ); + } +} void KOAgenda::clear() @@ -924,2 +942,3 @@ void KOAgenda::performItemAction(QPoint viewportPos) mGridSpacingY * moveItem->cellHeight()); + moveItem->raise(); moveChild(moveItem,x,y); @@ -1246,2 +1265,9 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) return; + + if ( mInvalidPixmap ) { + mInvalidPixmap = false; + qDebug("InvalidPixmap "); + QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() )); + return; + } if ( ! mAllDayMode ) { @@ -1918,3 +1944,3 @@ void KOAgenda::computeSizes() if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { - //qDebug("paintPixAll->resize "); + qDebug("paintPixAll->resize "); paintPixAll->resize( cw, ch ); @@ -1924,3 +1950,3 @@ void KOAgenda::computeSizes() if ( paintPix->width() < cw || paintPix->height() < ch ) { - //qDebug("paintPix->resize "); + qDebug("paintPix->resize "); paintPix->resize( cw , ch ); diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index de6acac..5d813b2 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h @@ -77,2 +77,3 @@ class KOAgenda : public QScrollView virtual ~KOAgenda(); + static bool mInvalidPixmap; @@ -127,4 +128,6 @@ class KOAgenda : public QScrollView void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } + void shrinkPixmap(); public slots: + void slotContentMove(int,int); void categoryChanged(Incidence * inc); @@ -172,2 +175,3 @@ class KOAgenda : public QScrollView void resizedSignal(); + void updateViewSignal(); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 8675ff6..303a92a 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -498,5 +498,3 @@ void KOAgendaItem::repaintItem() globalFlagBlockAgenda = 0; - //qDebug("AAA "); repaint( false ); - //qDebug("BBB "); } @@ -504,3 +502,3 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) { - qDebug("CCC "); + if ( globalFlagBlockAgendaItemPaint ) @@ -509,3 +507,2 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) return; - qDebug("DDD "); int yy; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index f811fba..488d9d4 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -78,3 +78,3 @@ using namespace KOrg; - +#define IDLETIMEOUT 3 @@ -575,5 +575,28 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); + connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); + connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); + mIdleTimer = new QTimer ( this );; + connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); +} +void KOAgendaView::slotIdleTimeout() +{ + qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); + int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); + mIdleTimer->stop(); + bool isActice = topLevelWidget()->isActiveWindow(); + qDebug("KO: Active Window %d ", isActice); + // we do nothing if we wake up from a suspend + if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) { + qDebug("KO: Wakeup from suspend "); + mIdleTimer->start( IDLETIMEOUT * 1000 ); + return; + } + qDebug("KO: Downsizing Pixmaps "); + mAgenda->shrinkPixmap(); + mAllDayAgenda->shrinkPixmap(); + KOAgendaItem::paintPix()->resize( 20,20); + KOAgendaItem::paintPixAllday()->resize( 20,20); + } - void KOAgendaView::toggleAllDay() @@ -1300,2 +1323,4 @@ void KOAgendaView::fillAgenda() repaintAgenda(); + mIdleTimer->start ( IDLETIMEOUT *1000 ); + mIdleStart = QDateTime::currentDateTime(); onlyOne = false; @@ -1343,3 +1368,3 @@ void KOAgendaView::slotShowDateView( int mode , int d ) if ( d >= mSelectedDates.count() ) { - qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); + qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() ); diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index a1cf308..effd7a3 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -212,2 +212,3 @@ class KOAgendaView : public KOEventView { void slotShowDateView( int, int ); + void fillAgenda(); @@ -230,3 +231,2 @@ class KOAgendaView : public KOEventView { /** Fill agenda using the current set value for the start date */ - void fillAgenda(); @@ -241,2 +241,3 @@ class KOAgendaView : public KOEventView { protected slots: + void slotIdleTimeout(); void categoryChanged( Incidence * ); @@ -256,2 +257,4 @@ class KOAgendaView : public KOEventView { private: + QTimer* mIdleTimer; + QDateTime mIdleStart; // view widgets |