summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp30
-rw-r--r--korganizer/koagenda.h4
-rw-r--r--korganizer/koagendaitem.cpp5
-rw-r--r--korganizer/koagendaview.cpp31
-rw-r--r--korganizer/koagendaview.h5
5 files changed, 65 insertions, 10 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0280c74..c339b57 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -60,6 +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)
@@ -178,6 +179,7 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
#endif
mHolidayMask = 0;
init();
+ connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) );
}
/*
@@ -317,8 +319,24 @@ void KOAgenda::init()
}
mPopupKind = 0;
mPopupItem = 0;
+ mInvalidPixmap = false;
+
}
+void KOAgenda::shrinkPixmap()
+{
+ mPaintPixmap.resize( 20,20);
+ mInvalidPixmap = true;
+}
+void KOAgenda::slotContentMove(int,int)
+{
+ if ( mActionType == NOP )
+ slotClearSelection();
+ if ( mSelectedItem && !mActionItem ) {
+ deselectItem();
+ emit incidenceSelected( 0 );
+ }
+}
void KOAgenda::clear()
{
KOAgendaItem *item;
@@ -922,6 +940,7 @@ void KOAgenda::performItemAction(QPoint viewportPos)
gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
moveItem->resize(mGridSpacingX * moveItem->cellWidth(),
mGridSpacingY * moveItem->cellHeight());
+ moveItem->raise();
moveChild(moveItem,x,y);
moveItem = moveItem->nextMultiItem();
}
@@ -1244,6 +1263,13 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
{
if ( globalFlagBlockAgenda )
return;
+
+ if ( mInvalidPixmap ) {
+ mInvalidPixmap = false;
+ qDebug("InvalidPixmap ");
+ QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() ));
+ return;
+ }
if ( ! mAllDayMode ) {
// currently not working for
@@ -1916,13 +1942,13 @@ void KOAgenda::computeSizes()
if ( mAllDayMode ) {
QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) {
- //qDebug("paintPixAll->resize ");
+ qDebug("paintPixAll->resize ");
paintPixAll->resize( cw, ch );
}
} else {
QPixmap* paintPix = KOAgendaItem::paintPix();
if ( paintPix->width() < cw || paintPix->height() < ch ) {
- //qDebug("paintPix->resize ");
+ qDebug("paintPix->resize ");
paintPix->resize( cw , ch );
}
}
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index de6acac..5d813b2 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -75,6 +75,7 @@ class KOAgenda : public QScrollView
KOAgenda ( int columns, QWidget * parent=0,
const char * name=0, WFlags f=0 );
virtual ~KOAgenda();
+ static bool mInvalidPixmap;
Incidence *selectedIncidence() const;
QDate selectedIncidenceDate() const;
@@ -125,8 +126,10 @@ class KOAgenda : public QScrollView
void storePosition();
void restorePosition();
void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
+ void shrinkPixmap();
public slots:
+ void slotContentMove(int,int);
void categoryChanged(Incidence * inc);
void slotClearSelection();
void popupMenu();
@@ -170,6 +173,7 @@ class KOAgenda : public QScrollView
void startDragSignal(Incidence *);
void addToCalSignal(Incidence *, Incidence *);
void resizedSignal();
+ void updateViewSignal();
protected:
KOEventPopupMenu * mAllAgendaPopup;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 8675ff6..303a92a 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -496,18 +496,15 @@ void KOAgendaItem::repaintItem()
{
globalFlagBlockAgendaItemPaint = 0;
globalFlagBlockAgenda = 0;
- //qDebug("AAA ");
repaint( false );
- //qDebug("BBB ");
}
void KOAgendaItem::paintEvent ( QPaintEvent *e )
{
- qDebug("CCC ");
+
if ( globalFlagBlockAgendaItemPaint )
return;
if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
return;
- qDebug("DDD ");
int yy;
if ( mAllDay )
yy = y();
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f811fba..488d9d4 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
TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
QScrollView(parent,name,f)
@@ -573,9 +573,32 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
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() )
@@ -1298,6 +1321,8 @@ void KOAgendaView::fillAgenda()
mAllDayAgenda->drawContentsToPainter();
mAgenda->drawContentsToPainter();
repaintAgenda();
+ mIdleTimer->start ( IDLETIMEOUT *1000 );
+ mIdleStart = QDateTime::currentDateTime();
onlyOne = false;
}
void KOAgendaView::repaintAgenda()
@@ -1341,7 +1366,7 @@ void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
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];
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index a1cf308..effd7a3 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -210,6 +210,7 @@ class KOAgendaView : public KOEventView {
void scrollOneHourDown();
void addToCalSlot(Incidence *, Incidence *);
void slotShowDateView( int, int );
+ void fillAgenda();
signals:
void showDateView( int, QDate );
@@ -228,7 +229,6 @@ class KOAgendaView : public KOEventView {
void fillAgenda(const QDate &startDate);
void resizeEvent( QResizeEvent* e );
/** Fill agenda using the current set value for the start date */
- void fillAgenda();
/** Create labels for the selected dates. */
void createDayLabels();
@@ -239,6 +239,7 @@ class KOAgendaView : public KOEventView {
void setHolidayMasks();
protected slots:
+ void slotIdleTimeout();
void categoryChanged( Incidence * );
void slotDaylabelClicked( int );
/** Update event belonging to agenda item */
@@ -254,6 +255,8 @@ class KOAgendaView : public KOEventView {
void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
private:
+ QTimer* mIdleTimer;
+ QDateTime mIdleStart;
// view widgets
QFrame *mDayLabels;
QHBox *mDayLabelsFrame;