summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp35
-rw-r--r--korganizer/koagenda.h3
-rw-r--r--korganizer/koagendaview.cpp22
-rw-r--r--korganizer/koagendaview.h1
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;
59extern int globalFlagBlockAgendaItemPaint; 59extern int globalFlagBlockAgendaItemPaint;
60extern int globalFlagBlockAgendaItemUpdate; 60extern int globalFlagBlockAgendaItemUpdate;
61extern int globalFlagBlockStartup; 61extern int globalFlagBlockStartup;
62 62
63bool KOAgenda::mInvalidPixmap = false; 63
64//////////////////////////////////////////////////////////////////////////// 64////////////////////////////////////////////////////////////////////////////
65MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) 65MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
66 : QFrame(_agenda->viewport(),name), agenda(_agenda) 66 : QFrame(_agenda->viewport(),name), agenda(_agenda)
67{ 67{
@@ -329,8 +329,9 @@ void KOAgenda::shrinkPixmap()
329 mInvalidPixmap = true; 329 mInvalidPixmap = true;
330} 330}
331void KOAgenda::slotContentMove(int,int) 331void KOAgenda::slotContentMove(int,int)
332{ 332{
333 emit sendPing();
333 if ( mActionType == NOP ) 334 if ( mActionType == NOP )
334 slotClearSelection(); 335 slotClearSelection();
335 if ( mSelectedItem && !mActionItem ) { 336 if ( mSelectedItem && !mActionItem ) {
336 deselectItem(); 337 deselectItem();
@@ -437,8 +438,17 @@ void KOAgenda::categoryChanged(Incidence * inc)
437 } 438 }
438} 439}
439bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 440bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
440{ 441{
442
443 if ( mInvalidPixmap ) {
444 mInvalidPixmap = false;
445 qDebug("InvalidPixmap ");
446 computeSizes();
447 emit updateViewSignal();
448 return true;
449 }
450 emit sendPing();
441 static int startX = 0; 451 static int startX = 0;
442 static int startY = 0; 452 static int startY = 0;
443 int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); 453 int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 );
444 static bool blockMoving = true; 454 static bool blockMoving = true;
@@ -1266,18 +1276,22 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1266 1276
1267 if ( mInvalidPixmap ) { 1277 if ( mInvalidPixmap ) {
1268 mInvalidPixmap = false; 1278 mInvalidPixmap = false;
1269 qDebug("InvalidPixmap "); 1279 qDebug("InvalidPixmap ");
1270 QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() )); 1280 computeSizes();
1281 emit updateViewSignal();
1271 return; 1282 return;
1272 } 1283 }
1273 if ( ! mAllDayMode ) { 1284 if ( ! mAllDayMode ) {
1274 // currently not working for 1285 // currently not working for
1275 1286
1276 //qDebug("KOAgenda::drawContents "); 1287 //qDebug("KOAgenda::drawContents ");
1277 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1288#if 0
1278 ;//drawContentsToPainter(); 1289 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
1279 1290 qDebug("WAU ");
1291 drawContentsToPainter();
1292 }
1293#endif
1280 QPaintDevice* pd = p->device(); 1294 QPaintDevice* pd = p->device();
1281 p->end(); 1295 p->end();
1282 int vx, vy; 1296 int vx, vy;
1283 int selectionX = KOGlobals::self()->reverseLayout() ? 1297 int selectionX = KOGlobals::self()->reverseLayout() ?
@@ -1319,12 +1333,15 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1319 } 1333 }
1320 } 1334 }
1321 p->begin( pd ); 1335 p->begin( pd );
1322 } else { 1336 } else {
1323 1337#if 0
1324 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1338 qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() );
1325 ;//drawContentsToPainter(); 1339 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
1326 1340 qDebug("WAUWAU ");
1341 drawContentsToPainter();
1342 }
1343#endif
1327 QPaintDevice* pd = p->device(); 1344 QPaintDevice* pd = p->device();
1328 p->end(); 1345 p->end();
1329 int vx, vy; 1346 int vx, vy;
1330 int selectionX = KOGlobals::self()->reverseLayout() ? 1347 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
74 const char * name=0, WFlags f=0 ); 74 const char * name=0, WFlags f=0 );
75 KOAgenda ( int columns, QWidget * parent=0, 75 KOAgenda ( int columns, QWidget * parent=0,
76 const char * name=0, WFlags f=0 ); 76 const char * name=0, WFlags f=0 );
77 virtual ~KOAgenda(); 77 virtual ~KOAgenda();
78 static bool mInvalidPixmap; 78 bool mInvalidPixmap;
79 79
80 Incidence *selectedIncidence() const; 80 Incidence *selectedIncidence() const;
81 QDate selectedIncidenceDate() const; 81 QDate selectedIncidenceDate() const;
82 82
@@ -173,8 +173,9 @@ class KOAgenda : public QScrollView
173 void startDragSignal(Incidence *); 173 void startDragSignal(Incidence *);
174 void addToCalSignal(Incidence *, Incidence *); 174 void addToCalSignal(Incidence *, Incidence *);
175 void resizedSignal(); 175 void resizedSignal();
176 void updateViewSignal(); 176 void updateViewSignal();
177 void sendPing();
177 178
178 protected: 179 protected:
179 KOEventPopupMenu * mAllAgendaPopup; 180 KOEventPopupMenu * mAllAgendaPopup;
180 QPainter mPixPainter; 181 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;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79#define IDLETIMEOUT 3 79#define IDLETIMEOUT 15
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
@@ -574,23 +574,32 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
574 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); 574 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
575 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); 575 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
576 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); 576 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) );
577 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); 577 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) );
578 578
579 connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) );
580 connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) );
581
582
579 mIdleTimer = new QTimer ( this );; 583 mIdleTimer = new QTimer ( this );;
580 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); 584 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout()));
581} 585}
586void KOAgendaView::startIdleTimeout()
587{
588 mIdleStart = QDateTime::currentDateTime();
589 mIdleTimer->start( IDLETIMEOUT * 1000 );
590}
582void KOAgendaView::slotIdleTimeout() 591void KOAgendaView::slotIdleTimeout()
583{ 592{
584 qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); 593 qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) );
585 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); 594 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() );
586 mIdleTimer->stop(); 595 mIdleTimer->stop();
587 bool isActice = topLevelWidget()->isActiveWindow(); 596 bool isActice = topLevelWidget()->isActiveWindow();
588 qDebug("KO: Active Window %d ", isActice); 597 qDebug("KO: Active Window %d %d", isActice, isVisible());
589 // we do nothing if we wake up from a suspend 598 // we do nothing if we wake up from a suspend
590 if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) { 599 if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) {
591 qDebug("KO: Wakeup from suspend "); 600 qDebug("KO: Wakeup from suspend ");
592 mIdleTimer->start( IDLETIMEOUT * 1000 ); 601 startIdleTimeout();
593 return; 602 return;
594 } 603 }
595 qDebug("KO: Downsizing Pixmaps "); 604 qDebug("KO: Downsizing Pixmaps ");
596 mAgenda->shrinkPixmap(); 605 mAgenda->shrinkPixmap();
@@ -1320,10 +1329,9 @@ void KOAgendaView::fillAgenda()
1320 globalFlagBlockAgenda = 0; 1329 globalFlagBlockAgenda = 0;
1321 mAllDayAgenda->drawContentsToPainter(); 1330 mAllDayAgenda->drawContentsToPainter();
1322 mAgenda->drawContentsToPainter(); 1331 mAgenda->drawContentsToPainter();
1323 repaintAgenda(); 1332 repaintAgenda();
1324 mIdleTimer->start ( IDLETIMEOUT *1000 ); 1333 startIdleTimeout();
1325 mIdleStart = QDateTime::currentDateTime();
1326 onlyOne = false; 1334 onlyOne = false;
1327} 1335}
1328void KOAgendaView::repaintAgenda() 1336void KOAgendaView::repaintAgenda()
1329{ 1337{
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 {
210 void scrollOneHourDown(); 210 void scrollOneHourDown();
211 void addToCalSlot(Incidence *, Incidence *); 211 void addToCalSlot(Incidence *, Incidence *);
212 void slotShowDateView( int, int ); 212 void slotShowDateView( int, int );
213 void fillAgenda(); 213 void fillAgenda();
214 void startIdleTimeout();
214 215
215 signals: 216 signals:
216 void showDateView( int, QDate ); 217 void showDateView( int, QDate );
217 void newTodoSignal( QDateTime ,bool ); 218 void newTodoSignal( QDateTime ,bool );