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
@@ -57,12 +57,13 @@
//extern bool globalFlagBlockPainting;
extern int globalFlagBlockAgenda;
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)
{
setLineWidth(0);
setMargin(0);
@@ -175,12 +176,13 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
mAllDayMode = false;
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
mHolidayMask = 0;
init();
+ connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) );
}
/*
Create an agenda widget with columns columns and one row. This is used for
all-day events.
*/
@@ -314,14 +316,30 @@ void KOAgenda::init()
else {
mMarcusBains = new MarcusBains(this);
addChild(mMarcusBains);
}
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;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
mUnusedItems.append( item );
//item->hide();
@@ -919,12 +937,13 @@ void KOAgenda::performItemAction(QPoint viewportPos)
else dy = gy - mCurrentCellY;
moveItem->moveRelative(gx - mCurrentCellX,dy);
int x,y;
gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
moveItem->resize(mGridSpacingX * moveItem->cellWidth(),
mGridSpacingY * moveItem->cellHeight());
+ moveItem->raise();
moveChild(moveItem,x,y);
moveItem = moveItem->nextMultiItem();
}
} else if (mActionType == RESIZETOP) {
if (mCurrentCellY <= mActionItem->cellYBottom()) {
mActionItem->expandTop(gy - mCurrentCellY);
@@ -1241,12 +1260,19 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
}
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
//qDebug("KOAgenda::drawContents ");
if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
;//drawContentsToPainter();
@@ -1913,19 +1939,19 @@ void KOAgenda::computeSizes()
}
int cw = contentsWidth();
int ch = contentsHeight();
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 );
}
}
checkScrollBoundaries();
marcus_bains();
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index de6acac..5d813b2 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -72,12 +72,13 @@ class KOAgenda : public QScrollView
KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
const char * name=0, WFlags f=0 );
KOAgenda ( int columns, QWidget * parent=0,
const char * name=0, WFlags f=0 );
virtual ~KOAgenda();
+ static bool mInvalidPixmap;
Incidence *selectedIncidence() const;
QDate selectedIncidenceDate() const;
virtual bool eventFilter ( QObject *, QEvent * );
@@ -122,14 +123,16 @@ class KOAgenda : public QScrollView
void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
void finishUpdate();
void printSelection();
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();
void newItem( int );
void moveChild( QWidget *, int, int );
void scrollUp();
@@ -167,12 +170,13 @@ class KOAgenda : public QScrollView
void lowerYChanged(int);
void upperYChanged(int);
void startDragSignal(Incidence *);
void addToCalSignal(Incidence *, Incidence *);
void resizedSignal();
+ void updateViewSignal();
protected:
KOEventPopupMenu * mAllAgendaPopup;
QPainter mPixPainter;
QPixmap mPaintPixmap;
QPixmap mHighlightPixmap;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 8675ff6..303a92a 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -493,24 +493,21 @@ QPixmap * KOAgendaItem::paintPixAllday()
}
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();
else
yy = mCellYTop * ( height() / cellHeight() );
int xx = x();
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f811fba..488d9d4 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -73,13 +73,13 @@ 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;
@@ -570,15 +570,38 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
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 )
@@ -1295,12 +1318,14 @@ void KOAgendaView::fillAgenda()
}
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 );
@@ -1338,13 +1363,13 @@ void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
// // 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 );
}
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index a1cf308..effd7a3 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -207,12 +207,13 @@ class KOAgendaView : public KOEventView {
void setContentsPos(int y);
void scrollOneHourUp();
void scrollOneHourDown();
void addToCalSlot(Incidence *, Incidence *);
void slotShowDateView( int, int );
+ void fillAgenda();
signals:
void showDateView( int, QDate );
void newTodoSignal( QDateTime ,bool );
void toggleExpand();
void selectWeekNum( int );
@@ -225,23 +226,23 @@ class KOAgendaView : public KOEventView {
bool mBlockUpdating;
int mUpcomingWidth;
/** Fill agenda beginning with date startDate */
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();
/**
Set the masks on the agenda widgets indicating, which days are holidays.
*/
void setHolidayMasks();
protected slots:
+ void slotIdleTimeout();
void categoryChanged( Incidence * );
void slotDaylabelClicked( int );
/** Update event belonging to agenda item */
void updateEventDates(KOAgendaItem *item, int mode = -1);
//void updateMovedTodo();
@@ -251,12 +252,14 @@ class KOAgendaView : public KOEventView {
/** Updates data for selected timespan */
void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
/** Updates data for selected timespan for all day event*/
void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
private:
+ QTimer* mIdleTimer;
+ QDateTime mIdleStart;
// view widgets
QFrame *mDayLabels;
QHBox *mDayLabelsFrame;
QBoxLayout *mLayoutDayLabels;
QFrame *mAllDayFrame;
KOAgenda *mAllDayAgenda;