-rw-r--r-- | korganizer/koagendaview.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 488d9d4..1b21a71 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -67,25 +67,25 @@ | |||
67 | 67 | ||
68 | #include "koagendaview.h" | 68 | #include "koagendaview.h" |
69 | //#include "koagendaview.moc" | 69 | //#include "koagendaview.moc" |
70 | 70 | ||
71 | //extern bool globalFlagBlockPainting; | 71 | //extern bool globalFlagBlockPainting; |
72 | extern int globalFlagBlockAgenda; | 72 | extern int globalFlagBlockAgenda; |
73 | extern int globalFlagBlockStartup; | 73 | extern int globalFlagBlockStartup; |
74 | extern int globalFlagBlockAgendaItemPaint; | 74 | extern int globalFlagBlockAgendaItemPaint; |
75 | extern int globalFlagBlockAgendaItemUpdate; | 75 | extern int globalFlagBlockAgendaItemUpdate; |
76 | extern int globalFlagBlockLabel; | 76 | extern int globalFlagBlockLabel; |
77 | using namespace KOrg; | 77 | using namespace KOrg; |
78 | 78 | ||
79 | #define IDLETIMEOUT 3 | 79 | #define IDLETIMEOUT 15 |
80 | 80 | ||
81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : |
82 | QScrollView(parent,name,f) | 82 | QScrollView(parent,name,f) |
83 | { | 83 | { |
84 | myPix.resize( 1, 1 ); | 84 | myPix.resize( 1, 1 ); |
85 | mRows = rows; | 85 | mRows = rows; |
86 | 86 | ||
87 | mRedrawNeeded = true; | 87 | mRedrawNeeded = true; |
88 | setMinimumHeight( 20 ); | 88 | setMinimumHeight( 20 ); |
89 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 89 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
90 | 90 | ||
91 | enableClipper(true); | 91 | enableClipper(true); |
@@ -567,38 +567,47 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
573 | 573 | ||
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 | } |
586 | void KOAgendaView::startIdleTimeout() | ||
587 | { | ||
588 | mIdleStart = QDateTime::currentDateTime(); | ||
589 | mIdleTimer->start( IDLETIMEOUT * 1000 ); | ||
590 | } | ||
582 | void KOAgendaView::slotIdleTimeout() | 591 | void 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(); |
597 | mAllDayAgenda->shrinkPixmap(); | 606 | mAllDayAgenda->shrinkPixmap(); |
598 | KOAgendaItem::paintPix()->resize( 20,20); | 607 | KOAgendaItem::paintPix()->resize( 20,20); |
599 | KOAgendaItem::paintPixAllday()->resize( 20,20); | 608 | KOAgendaItem::paintPixAllday()->resize( 20,20); |
600 | 609 | ||
601 | } | 610 | } |
602 | void KOAgendaView::toggleAllDay() | 611 | void KOAgendaView::toggleAllDay() |
603 | { | 612 | { |
604 | if ( mSplitterAgenda->firstHandle() ) | 613 | if ( mSplitterAgenda->firstHandle() ) |
@@ -1312,26 +1321,25 @@ void KOAgendaView::fillAgenda() | |||
1312 | 1321 | ||
1313 | if ( globalFlagBlockAgenda == 2 ) { | 1322 | if ( globalFlagBlockAgenda == 2 ) { |
1314 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1323 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1315 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1324 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1316 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1325 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1317 | setStartHour( QTime::currentTime ().hour() ); | 1326 | setStartHour( QTime::currentTime ().hour() ); |
1318 | } | 1327 | } |
1319 | qApp->processEvents(); | 1328 | qApp->processEvents(); |
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 | } |
1328 | void KOAgendaView::repaintAgenda() | 1336 | void KOAgendaView::repaintAgenda() |
1329 | { | 1337 | { |
1330 | mAgenda->viewport()->repaint( false ); | 1338 | mAgenda->viewport()->repaint( false ); |
1331 | mAllDayAgenda->viewport()->repaint( false ); | 1339 | mAllDayAgenda->viewport()->repaint( false ); |
1332 | mAgenda->finishUpdate(); | 1340 | mAgenda->finishUpdate(); |
1333 | mAllDayAgenda->finishUpdate(); | 1341 | mAllDayAgenda->finishUpdate(); |
1334 | } | 1342 | } |
1335 | 1343 | ||
1336 | 1344 | ||
1337 | void KOAgendaView::clearView() | 1345 | void KOAgendaView::clearView() |