-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 29 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 7 |
3 files changed, 33 insertions, 5 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index ba77b45..8e6cc53 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -242,3 +242,3 @@ void KOViewManager::showWhatsNextView() showView(mWhatsNextView, true ); - mWhatsNextView->updateView(); + //mWhatsNextView->updateView(); diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 2a8a7c1..9b53110 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -76,2 +76,7 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, topLayout->addWidget(mView); + mTimer = new QTimer( this ); + connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); + + connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); + connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); } @@ -113,5 +118,25 @@ void KOWhatsNextView::updateConfig() } +void KOWhatsNextView::showEvent ( QShowEvent * e ) +{ + //qDebug("KOWhatsNextView::showEvent "); + restartTimer(); + QWidget::showEvent ( e ); +} +void KOWhatsNextView::hideEvent ( QHideEvent * e) +{ + //qDebug(" KOWhatsNextView::hideEvent"); + mTimer->stop(); + QWidget::hideEvent ( e ); +} +void KOWhatsNextView::restartTimer() +{ + //qDebug("KOWhatsNextView::restartTimer() "); + mTimer->start( 180000 ); + //mTimer->start( 5000 ); +} void KOWhatsNextView::updateView() { - + if ( mTimer->isActive() ) + restartTimer(); + //qDebug("KOWhatsNextView::updateView() "); // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); @@ -620,4 +645,2 @@ void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) { - if ( mEventViewer ) - delete mEventViewer; mEventViewer = v; diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index fff769a..1118bdd 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h @@ -22,2 +22,3 @@ #include <qtextbrowser.h> +#include <qtimer.h> @@ -75,2 +76,4 @@ class KOWhatsNextView : public KOrg::BaseView QDate mEventDate; + virtual void showEvent ( QShowEvent * ); + virtual void hideEvent ( QHideEvent * ); @@ -78,2 +81,4 @@ class KOWhatsNextView : public KOrg::BaseView void showIncidence(const QString &); + void restartTimer(); + @@ -81,3 +86,3 @@ class KOWhatsNextView : public KOrg::BaseView //void createEventViewer(); - + QTimer* mTimer; QTextBrowser *mView; |