summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
authorzautrix <zautrix>2005-07-05 07:37:53 (UTC)
committer zautrix <zautrix>2005-07-05 07:37:53 (UTC)
commit28ca4c37fb0e131b2978584992840b3fdca21d3e (patch) (side-by-side diff)
treefb4f7e51c0995b71e2a26a7300747b6b1b3acb23 /korganizer/koagendaview.cpp
parent5992ea9025ebddde8be72322c90aac8edeaf4d1c (diff)
downloadkdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.zip
kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.tar.gz
kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.tar.bz2
fixesss
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f811fba..488d9d4 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -67,25 +67,25 @@
#include "koagendaview.h"
//#include "koagendaview.moc"
//extern bool globalFlagBlockPainting;
extern int globalFlagBlockAgenda;
extern int globalFlagBlockStartup;
extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
extern int globalFlagBlockLabel;
using namespace KOrg;
-
+#define IDLETIMEOUT 3
TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
QScrollView(parent,name,f)
{
myPix.resize( 1, 1 );
mRows = rows;
mRedrawNeeded = true;
setMinimumHeight( 20 );
mCellHeight = KOPrefs::instance()->mHourSize*4;
enableClipper(true);
@@ -564,27 +564,50 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
SIGNAL( incidenceSelected( Incidence * ) ) );
connect( mAgenda, SIGNAL( resizedSignal() ),
SLOT( updateConfig( ) ) );
connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
SLOT( addToCalSlot(Incidence * , Incidence *) ) );
// connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
//connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
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()) );
+ mIdleTimer = new QTimer ( this );;
+ connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout()));
+}
+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);
+ // we do nothing if we wake up from a suspend
+ if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) {
+ qDebug("KO: Wakeup from suspend ");
+ mIdleTimer->start( IDLETIMEOUT * 1000 );
+ return;
+ }
+ qDebug("KO: Downsizing Pixmaps ");
+ mAgenda->shrinkPixmap();
+ mAllDayAgenda->shrinkPixmap();
+ KOAgendaItem::paintPix()->resize( 20,20);
+ KOAgendaItem::paintPixAllday()->resize( 20,20);
+
}
-
void KOAgendaView::toggleAllDay()
{
if ( mSplitterAgenda->firstHandle() )
mSplitterAgenda->firstHandle()->toggle();
}
void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
{
calendar()->addIncidence( inc );
if ( incOld ) {
if ( incOld->typeID() == todoID )
emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
@@ -1289,24 +1312,26 @@ void KOAgendaView::fillAgenda()
if ( globalFlagBlockAgenda == 2 ) {
if ( KOPrefs::instance()->mSetTimeToDayStartAt )
setStartHour( KOPrefs::instance()->mDayBegins );
else if ( KOPrefs::instance()->mCenterOnCurrentTime )
setStartHour( QTime::currentTime ().hour() );
}
qApp->processEvents();
globalFlagBlockAgenda = 0;
mAllDayAgenda->drawContentsToPainter();
mAgenda->drawContentsToPainter();
repaintAgenda();
+ mIdleTimer->start ( IDLETIMEOUT *1000 );
+ mIdleStart = QDateTime::currentDateTime();
onlyOne = false;
}
void KOAgendaView::repaintAgenda()
{
mAgenda->viewport()->repaint( false );
mAllDayAgenda->viewport()->repaint( false );
mAgenda->finishUpdate();
mAllDayAgenda->finishUpdate();
}
void KOAgendaView::clearView()
@@ -1332,25 +1357,25 @@ void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
#endif
}
// void KOAgendaView::updateMovedTodo()
// {
// // updateConfig();
// // emit updateTodoViews();
// }
void KOAgendaView::slotShowDateView( int mode , int d )
{
if ( d >= mSelectedDates.count() ) {
- qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
+ qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() );
} else {
QDate day = mSelectedDates[d];
emit showDateView(mode , day );
}
}
void KOAgendaView::newEvent(int gx, int gy)
{
if (!mSelectedDates.count()) return;
QDate day = mSelectedDates[gx];