summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1b21a71..ef5c4dd 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -55,49 +55,49 @@
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
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;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern 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 15 79#define IDLETIMEOUT 45
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{
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);
92 92
93 setHScrollBarMode(AlwaysOff); 93 setHScrollBarMode(AlwaysOff);
94 setVScrollBarMode(AlwaysOff); 94 setVScrollBarMode(AlwaysOff);
95 95
96 resizeContents(50,mRows * mCellHeight); 96 resizeContents(50,mRows * mCellHeight);
97 97
98 viewport()->setBackgroundMode( PaletteBackground ); 98 viewport()->setBackgroundMode( PaletteBackground );
99} 99}
100 100
101void TimeLabels::setCellHeight(int height) 101void TimeLabels::setCellHeight(int height)
102{ 102{
103 mCellHeight = height; 103 mCellHeight = height;
@@ -552,81 +552,84 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
552 SLOT(startDrag(Event *))); 552 SLOT(startDrag(Event *)));
553 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 553 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
554 SLOT(startDrag(Event *))); 554 SLOT(startDrag(Event *)));
555 */ 555 */
556 // synchronize selections 556 // synchronize selections
557 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 557 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
558 mAllDayAgenda, SLOT( deselectItem() ) ); 558 mAllDayAgenda, SLOT( deselectItem() ) );
559 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 559 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
560 mAgenda, SLOT( deselectItem() ) ); 560 mAgenda, SLOT( deselectItem() ) );
561 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 561 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
562 SIGNAL( incidenceSelected( Incidence * ) ) ); 562 SIGNAL( incidenceSelected( Incidence * ) ) );
563 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 563 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
564 SIGNAL( incidenceSelected( Incidence * ) ) ); 564 SIGNAL( incidenceSelected( Incidence * ) ) );
565 connect( mAgenda, SIGNAL( resizedSignal() ), 565 connect( mAgenda, SIGNAL( resizedSignal() ),
566 SLOT( updateConfig( ) ) ); 566 SLOT( updateConfig( ) ) );
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#ifndef DESKTOP_VERSION
576 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); 577 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) );
577 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); 578 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) );
578
579 connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) ); 579 connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) );
580 connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) ); 580 connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) );
581
582
583 mIdleTimer = new QTimer ( this );; 581 mIdleTimer = new QTimer ( this );;
584 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); 582 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout()));
583#endif
585} 584}
586void KOAgendaView::startIdleTimeout() 585void KOAgendaView::startIdleTimeout()
587{ 586{
587#ifndef DESKTOP_VERSION
588 mIdleStart = QDateTime::currentDateTime(); 588 mIdleStart = QDateTime::currentDateTime();
589 mIdleTimer->start( IDLETIMEOUT * 1000 ); 589 mIdleTimer->start( IDLETIMEOUT * 1000 );
590#endif
590} 591}
591void KOAgendaView::slotIdleTimeout() 592void KOAgendaView::slotIdleTimeout()
592{ 593{
593 qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); 594#ifndef DESKTOP_VERSION
595 //qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) );
594 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); 596 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() );
595 mIdleTimer->stop(); 597 mIdleTimer->stop();
596 bool isActice = topLevelWidget()->isActiveWindow(); 598 bool isActice = topLevelWidget()->isActiveWindow();
597 qDebug("KO: Active Window %d %d", isActice, isVisible()); 599 //qDebug("KO: Active Window %d %d", isActice, isVisible());
598 // we do nothing if we wake up from a suspend 600 // we do nothing if we wake up from a suspend
599 if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { 601 if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) {
600 qDebug("KO: Wakeup from suspend "); 602 qDebug("KO: Wakeup from suspend ");
601 startIdleTimeout(); 603 startIdleTimeout();
602 return; 604 return;
603 } 605 }
604 qDebug("KO: Downsizing Pixmaps "); 606 qDebug("KO: Downsizing Pixmaps ");
605 mAgenda->shrinkPixmap(); 607 mAgenda->shrinkPixmap();
606 mAllDayAgenda->shrinkPixmap(); 608 mAllDayAgenda->shrinkPixmap();
607 KOAgendaItem::paintPix()->resize( 20,20); 609 KOAgendaItem::paintPix()->resize( 20,20);
608 KOAgendaItem::paintPixAllday()->resize( 20,20); 610 KOAgendaItem::paintPixAllday()->resize( 20,20);
611#endif
609 612
610} 613}
611void KOAgendaView::toggleAllDay() 614void KOAgendaView::toggleAllDay()
612{ 615{
613 if ( mSplitterAgenda->firstHandle() ) 616 if ( mSplitterAgenda->firstHandle() )
614 mSplitterAgenda->firstHandle()->toggle(); 617 mSplitterAgenda->firstHandle()->toggle();
615} 618}
616void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 619void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
617{ 620{
618 calendar()->addIncidence( inc ); 621 calendar()->addIncidence( inc );
619 622
620 if ( incOld ) { 623 if ( incOld ) {
621 if ( incOld->typeID() == todoID ) 624 if ( incOld->typeID() == todoID )
622 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 625 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
623 else 626 else
624 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 627 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
625 } 628 }
626 629
627} 630}
628void KOAgendaView::categoryChanged(Incidence * inc) 631void KOAgendaView::categoryChanged(Incidence * inc)
629{ 632{
630 mAgenda->categoryChanged( inc ); 633 mAgenda->categoryChanged( inc );
631 mAllDayAgenda->categoryChanged( inc ); 634 mAllDayAgenda->categoryChanged( inc );
632} 635}