-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 @@ -60,7 +60,7 @@ 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) @@ -330,6 +330,7 @@ void KOAgenda::shrinkPixmap() } void KOAgenda::slotContentMove(int,int) { + emit sendPing(); if ( mActionType == NOP ) slotClearSelection(); if ( mSelectedItem && !mActionItem ) { @@ -438,6 +439,15 @@ 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 ); @@ -1267,16 +1277,20 @@ 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; @@ -1320,10 +1334,13 @@ 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; diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index 5d813b2..0e3aed8 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h @@ -75,7 +75,7 @@ class KOAgenda : public QScrollView 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; @@ -174,6 +174,7 @@ class KOAgenda : public QScrollView void addToCalSignal(Incidence *, Incidence *); void resizedSignal(); void updateViewSignal(); + void sendPing(); protected: KOEventPopupMenu * mAllAgendaPopup; diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 488d9d4..1b21a71 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -76,7 +76,7 @@ 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) @@ -575,21 +575,30 @@ 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()) ); - + + 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 "); @@ -1321,8 +1330,7 @@ void KOAgendaView::fillAgenda() 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 @@ -211,6 +211,7 @@ class KOAgendaView : public KOEventView { void addToCalSlot(Incidence *, Incidence *); void slotShowDateView( int, int ); void fillAgenda(); + void startIdleTimeout(); signals: void showDateView( int, QDate ); |