-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 @@ -240,7 +240,7 @@ void KOViewManager::showWhatsNextView() } globalFlagBlockAgenda = 1; 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 @@ -74,6 +74,11 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, QBoxLayout *topLayout = new QVBoxLayout(this); // topLayout->addWidget(mDateLabel); 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())); } KOWhatsNextView::~KOWhatsNextView() @@ -111,9 +116,29 @@ void KOWhatsNextView::updateConfig() updateView(); } +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())); KIconLoader kil("korganizer"); QString ipath;// = new QString(); @@ -618,8 +643,6 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) */ 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 @@ -20,6 +20,7 @@ #define KOWHATSNEXTVIEW_H #include <qtextbrowser.h> +#include <qtimer.h> #include <korganizer/baseview.h> @@ -73,13 +74,17 @@ class KOWhatsNextView : public KOrg::BaseView bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); void appendDay( int i, QDate date ); QDate mEventDate; + virtual void showEvent ( QShowEvent * ); + virtual void hideEvent ( QHideEvent * ); private slots: void showIncidence(const QString &); + void restartTimer(); + private: //void createEventViewer(); - + QTimer* mTimer; QTextBrowser *mView; QString mText; // QLabel *mDateLabel; |