summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-10 21:45:08 (UTC)
committer zautrix <zautrix>2004-10-10 21:45:08 (UTC)
commit80ecf83fe91a61792576b5538891953cd19c4fec (patch) (side-by-side diff)
tree4cf30a58546834f7ed5889b37f352703ad603826
parentad409bf71ce6c3733f9e5ae4e4aa38765329d7d8 (diff)
downloadkdepimpi-80ecf83fe91a61792576b5538891953cd19c4fec.zip
kdepimpi-80ecf83fe91a61792576b5538891953cd19c4fec.tar.gz
kdepimpi-80ecf83fe91a61792576b5538891953cd19c4fec.tar.bz2
added timer in WN view
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp29
-rw-r--r--korganizer/kowhatsnextview.h7
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
@@ -237,13 +237,13 @@ void KOViewManager::showWhatsNextView()
mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
addView(mWhatsNextView);
}
globalFlagBlockAgenda = 1;
showView(mWhatsNextView, true );
- mWhatsNextView->updateView();
+ //mWhatsNextView->updateView();
}
void KOViewManager::showListView()
{
if (!mListView) {
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 2a8a7c1..9b53110 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -71,12 +71,17 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
mEventViewer = 0;
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()
{
}
@@ -108,15 +113,35 @@ void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
void KOWhatsNextView::updateConfig()
{
setFont( KOPrefs::instance()->mWhatsNextFont );
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();
// kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
//<big><big><strong>" + date + "</strong></big></big>\n";
mText = "<table width=\"100%\">\n";
@@ -615,14 +640,12 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
mEventViewer = new KOEventViewerDialog(this);
}
}
*/
void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
{
- if ( mEventViewer )
- delete mEventViewer;
mEventViewer = v;
}
// TODO: Create this function in CalendarView and remove it from here
void KOWhatsNextView::showIncidence(const QString &uid)
{
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index fff769a..1118bdd 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -17,12 +17,13 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOWHATSNEXTVIEW_H
#define KOWHATSNEXTVIEW_H
#include <qtextbrowser.h>
+#include <qtimer.h>
#include <korganizer/baseview.h>
class QListView;
class QLabel;
@@ -70,19 +71,23 @@ class KOWhatsNextView : public KOrg::BaseView
protected:
void appendEvent(Incidence *, bool reply=false, bool notRed = true);
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;
KOEventViewerDialog *mEventViewer;
QValueList<Incidence *> mTodos;