summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp35
-rw-r--r--korganizer/koagenda.h3
-rw-r--r--korganizer/koagendaview.cpp22
-rw-r--r--korganizer/koagendaview.h1
4 files changed, 44 insertions, 17 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index c339b57..662576f 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -57,13 +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);
@@ -327,12 +327,13 @@ void KOAgenda::shrinkPixmap()
{
mPaintPixmap.resize( 20,20);
mInvalidPixmap = true;
}
void KOAgenda::slotContentMove(int,int)
{
+ emit sendPing();
if ( mActionType == NOP )
slotClearSelection();
if ( mSelectedItem && !mActionItem ) {
deselectItem();
emit incidenceSelected( 0 );
}
@@ -435,12 +436,21 @@ void KOAgenda::categoryChanged(Incidence * inc)
item->updateItem();
}
}
}
bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
{
+
+ if ( mInvalidPixmap ) {
+ mInvalidPixmap = false;
+ qDebug("InvalidPixmap ");
+ computeSizes();
+ emit updateViewSignal();
+ return true;
+ }
+ emit sendPing();
static int startX = 0;
static int startY = 0;
int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 );
static bool blockMoving = true;
//qDebug("KOAgenda::eventFilter_mous ");
@@ -1264,22 +1274,26 @@ 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() ));
+ computeSizes();
+ emit updateViewSignal();
return;
}
if ( ! mAllDayMode ) {
// currently not working for
//qDebug("KOAgenda::drawContents ");
- if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
- ;//drawContentsToPainter();
-
+#if 0
+ if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
+ qDebug("WAU ");
+ drawContentsToPainter();
+ }
+#endif
QPaintDevice* pd = p->device();
p->end();
int vx, vy;
int selectionX = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - mSelectionCellX) * mGridSpacingX :
mSelectionCellX * mGridSpacingX;
@@ -1317,16 +1331,19 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
offset += 5;
}
}
}
p->begin( pd );
} else {
-
- if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
- ;//drawContentsToPainter();
-
+#if 0
+ qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() );
+ if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
+ qDebug("WAUWAU ");
+ drawContentsToPainter();
+ }
+#endif
QPaintDevice* pd = p->device();
p->end();
int vx, vy;
int selectionX = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - mSelectionCellX) * mGridSpacingX :
mSelectionCellX * mGridSpacingX;
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 5d813b2..0e3aed8 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -72,13 +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;
+ bool mInvalidPixmap;
Incidence *selectedIncidence() const;
QDate selectedIncidenceDate() const;
virtual bool eventFilter ( QObject *, QEvent * );
@@ -171,12 +171,13 @@ class KOAgenda : public QScrollView
void upperYChanged(int);
void startDragSignal(Incidence *);
void addToCalSignal(Incidence *, Incidence *);
void resizedSignal();
void updateViewSignal();
+ void sendPing();
protected:
KOEventPopupMenu * mAllAgendaPopup;
QPainter mPixPainter;
QPixmap mPaintPixmap;
QPixmap mHighlightPixmap;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 488d9d4..1b21a71 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
+#define IDLETIMEOUT 15
TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
QScrollView(parent,name,f)
{
myPix.resize( 1, 1 );
mRows = rows;
@@ -572,27 +572,36 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
//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()) );
-
+
+ connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) );
+ connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) );
+
+
mIdleTimer = new QTimer ( this );;
connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout()));
}
+void KOAgendaView::startIdleTimeout()
+{
+ mIdleStart = QDateTime::currentDateTime();
+ mIdleTimer->start( IDLETIMEOUT * 1000 );
+}
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);
+ qDebug("KO: Active Window %d %d", isActice, isVisible());
// we do nothing if we wake up from a suspend
- if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) {
+ if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) {
qDebug("KO: Wakeup from suspend ");
- mIdleTimer->start( IDLETIMEOUT * 1000 );
+ startIdleTimeout();
return;
}
qDebug("KO: Downsizing Pixmaps ");
mAgenda->shrinkPixmap();
mAllDayAgenda->shrinkPixmap();
KOAgendaItem::paintPix()->resize( 20,20);
@@ -1318,14 +1327,13 @@ void KOAgendaView::fillAgenda()
}
qApp->processEvents();
globalFlagBlockAgenda = 0;
mAllDayAgenda->drawContentsToPainter();
mAgenda->drawContentsToPainter();
repaintAgenda();
- mIdleTimer->start ( IDLETIMEOUT *1000 );
- mIdleStart = QDateTime::currentDateTime();
+ startIdleTimeout();
onlyOne = false;
}
void KOAgendaView::repaintAgenda()
{
mAgenda->viewport()->repaint( false );
mAllDayAgenda->viewport()->repaint( false );
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index effd7a3..4b7ef5b 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -208,12 +208,13 @@ class KOAgendaView : public KOEventView {
void scrollOneHourUp();
void scrollOneHourDown();
void addToCalSlot(Incidence *, Incidence *);
void slotShowDateView( int, int );
void fillAgenda();
+ void startIdleTimeout();
signals:
void showDateView( int, QDate );
void newTodoSignal( QDateTime ,bool );
void toggleExpand();
void selectWeekNum( int );