-rw-r--r-- | korganizer/koagenda.cpp | 35 | ||||
-rw-r--r-- | korganizer/koagenda.h | 3 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 22 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 |
4 files changed, 44 insertions, 17 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index c339b57..662576f 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -59,9 +59,9 @@ extern int globalFlagBlockAgenda; extern int globalFlagBlockAgendaItemPaint; extern int globalFlagBlockAgendaItemUpdate; extern int globalFlagBlockStartup; -bool KOAgenda::mInvalidPixmap = false; + //////////////////////////////////////////////////////////////////////////// MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) : QFrame(_agenda->viewport(),name), agenda(_agenda) { @@ -329,8 +329,9 @@ void KOAgenda::shrinkPixmap() mInvalidPixmap = true; } void KOAgenda::slotContentMove(int,int) { + emit sendPing(); if ( mActionType == NOP ) slotClearSelection(); if ( mSelectedItem && !mActionItem ) { deselectItem(); @@ -437,8 +438,17 @@ void KOAgenda::categoryChanged(Incidence * inc) } } bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) { + + if ( mInvalidPixmap ) { + mInvalidPixmap = false; + qDebug("InvalidPixmap "); + computeSizes(); + emit updateViewSignal(); + return true; + } + emit sendPing(); static int startX = 0; static int startY = 0; int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); static bool blockMoving = true; @@ -1266,18 +1276,22 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) if ( mInvalidPixmap ) { mInvalidPixmap = false; qDebug("InvalidPixmap "); - QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() )); + computeSizes(); + emit updateViewSignal(); return; } if ( ! mAllDayMode ) { // currently not working for //qDebug("KOAgenda::drawContents "); - if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) - ;//drawContentsToPainter(); - +#if 0 + if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { + qDebug("WAU "); + drawContentsToPainter(); + } +#endif QPaintDevice* pd = p->device(); p->end(); int vx, vy; int selectionX = KOGlobals::self()->reverseLayout() ? @@ -1319,12 +1333,15 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) } } p->begin( pd ); } else { - - if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) - ;//drawContentsToPainter(); - +#if 0 + qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); + if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { + qDebug("WAUWAU "); + drawContentsToPainter(); + } +#endif QPaintDevice* pd = p->device(); p->end(); int vx, vy; int selectionX = KOGlobals::self()->reverseLayout() ? diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index 5d813b2..0e3aed8 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h @@ -74,9 +74,9 @@ class KOAgenda : public QScrollView const char * name=0, WFlags f=0 ); KOAgenda ( int columns, QWidget * parent=0, const char * name=0, WFlags f=0 ); virtual ~KOAgenda(); - static bool mInvalidPixmap; + bool mInvalidPixmap; Incidence *selectedIncidence() const; QDate selectedIncidenceDate() const; @@ -173,8 +173,9 @@ class KOAgenda : public QScrollView void startDragSignal(Incidence *); void addToCalSignal(Incidence *, Incidence *); void resizedSignal(); void updateViewSignal(); + void sendPing(); protected: KOEventPopupMenu * mAllAgendaPopup; QPainter mPixPainter; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 488d9d4..1b21a71 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -75,9 +75,9 @@ extern int globalFlagBlockAgendaItemPaint; extern int globalFlagBlockAgendaItemUpdate; extern int globalFlagBlockLabel; using namespace KOrg; -#define IDLETIMEOUT 3 +#define IDLETIMEOUT 15 TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : QScrollView(parent,name,f) { @@ -574,23 +574,32 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); - + + connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) ); + connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) ); + + mIdleTimer = new QTimer ( this );; connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); } +void KOAgendaView::startIdleTimeout() +{ + mIdleStart = QDateTime::currentDateTime(); + mIdleTimer->start( IDLETIMEOUT * 1000 ); +} 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); + qDebug("KO: Active Window %d %d", isActice, isVisible()); // we do nothing if we wake up from a suspend - if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) { + if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { qDebug("KO: Wakeup from suspend "); - mIdleTimer->start( IDLETIMEOUT * 1000 ); + startIdleTimeout(); return; } qDebug("KO: Downsizing Pixmaps "); mAgenda->shrinkPixmap(); @@ -1320,10 +1329,9 @@ void KOAgendaView::fillAgenda() globalFlagBlockAgenda = 0; mAllDayAgenda->drawContentsToPainter(); mAgenda->drawContentsToPainter(); repaintAgenda(); - mIdleTimer->start ( IDLETIMEOUT *1000 ); - mIdleStart = QDateTime::currentDateTime(); + startIdleTimeout(); onlyOne = false; } void KOAgendaView::repaintAgenda() { diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index effd7a3..4b7ef5b 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -210,8 +210,9 @@ class KOAgendaView : public KOEventView { void scrollOneHourDown(); void addToCalSlot(Incidence *, Incidence *); void slotShowDateView( int, int ); void fillAgenda(); + void startIdleTimeout(); signals: void showDateView( int, QDate ); void newTodoSignal( QDateTime ,bool ); |