summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-10 21:45:08 (UTC)
committer zautrix <zautrix>2004-10-10 21:45:08 (UTC)
commit80ecf83fe91a61792576b5538891953cd19c4fec (patch) (unidiff)
tree4cf30a58546834f7ed5889b37f352703ad603826
parentad409bf71ce6c3733f9e5ae4e4aa38765329d7d8 (diff)
downloadkdepimpi-80ecf83fe91a61792576b5538891953cd19c4fec.zip
kdepimpi-80ecf83fe91a61792576b5538891953cd19c4fec.tar.gz
kdepimpi-80ecf83fe91a61792576b5538891953cd19c4fec.tar.bz2
added timer in WN view
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp29
-rw-r--r--korganizer/kowhatsnextview.h9
3 files changed, 34 insertions, 6 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ba77b45..8e6cc53 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -231,25 +231,25 @@ void KOViewManager::updateWNview()
231} 231}
232void KOViewManager::showWhatsNextView() 232void KOViewManager::showWhatsNextView()
233{ 233{
234 if (!mWhatsNextView) { 234 if (!mWhatsNextView) {
235 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 235 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
236 "KOViewManager::WhatsNextView"); 236 "KOViewManager::WhatsNextView");
237 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 237 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
238 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 238 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
239 addView(mWhatsNextView); 239 addView(mWhatsNextView);
240 } 240 }
241 globalFlagBlockAgenda = 1; 241 globalFlagBlockAgenda = 1;
242 showView(mWhatsNextView, true ); 242 showView(mWhatsNextView, true );
243 mWhatsNextView->updateView(); 243 //mWhatsNextView->updateView();
244 244
245} 245}
246 246
247void KOViewManager::showListView() 247void KOViewManager::showListView()
248{ 248{
249 if (!mListView) { 249 if (!mListView) {
250 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 250 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
251 addView(mListView); 251 addView(mListView);
252 252
253 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 253 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
254 mMainView, SLOT(showIncidence(Incidence *))); 254 mMainView, SLOT(showIncidence(Incidence *)));
255 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 255 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 2a8a7c1..9b53110 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -65,24 +65,29 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
66 // mDateLabel->setMargin(2); 66 // mDateLabel->setMargin(2);
67 // mDateLabel->setAlignment(AlignCenter); 67 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 68 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 69 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
71 71
72 mEventViewer = 0; 72 mEventViewer = 0;
73 73
74 QBoxLayout *topLayout = new QVBoxLayout(this); 74 QBoxLayout *topLayout = new QVBoxLayout(this);
75 // topLayout->addWidget(mDateLabel); 75 // topLayout->addWidget(mDateLabel);
76 topLayout->addWidget(mView); 76 topLayout->addWidget(mView);
77 mTimer = new QTimer( this );
78 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
79
80 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
81 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
77} 82}
78 83
79KOWhatsNextView::~KOWhatsNextView() 84KOWhatsNextView::~KOWhatsNextView()
80{ 85{
81} 86}
82 87
83int KOWhatsNextView::maxDatesHint() 88int KOWhatsNextView::maxDatesHint()
84{ 89{
85 return 0; 90 return 0;
86} 91}
87 92
88int KOWhatsNextView::currentDateCount() 93int KOWhatsNextView::currentDateCount()
@@ -102,27 +107,47 @@ void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
102 const QDate &td) 107 const QDate &td)
103{ 108{
104#ifndef KORG_NOPRINTER 109#ifndef KORG_NOPRINTER
105 calPrinter->preview(CalPrinter::Day, fd, td); 110 calPrinter->preview(CalPrinter::Day, fd, td);
106#endif 111#endif
107} 112}
108void KOWhatsNextView::updateConfig() 113void KOWhatsNextView::updateConfig()
109{ 114{
110 setFont( KOPrefs::instance()->mWhatsNextFont ); 115 setFont( KOPrefs::instance()->mWhatsNextFont );
111 updateView(); 116 updateView();
112 117
113} 118}
119void KOWhatsNextView::showEvent ( QShowEvent * e )
120{
121 //qDebug("KOWhatsNextView::showEvent ");
122 restartTimer();
123 QWidget::showEvent ( e );
124}
125void KOWhatsNextView::hideEvent ( QHideEvent * e)
126{
127 //qDebug(" KOWhatsNextView::hideEvent");
128 mTimer->stop();
129 QWidget::hideEvent ( e );
130}
131void KOWhatsNextView::restartTimer()
132{
133 //qDebug("KOWhatsNextView::restartTimer() ");
134 mTimer->start( 180000 );
135 //mTimer->start( 5000 );
136}
114void KOWhatsNextView::updateView() 137void KOWhatsNextView::updateView()
115{ 138{
116 139 if ( mTimer->isActive() )
140 restartTimer();
141 //qDebug("KOWhatsNextView::updateView() ");
117 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 142 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
118 KIconLoader kil("korganizer"); 143 KIconLoader kil("korganizer");
119 QString ipath;// = new QString(); 144 QString ipath;// = new QString();
120 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 145 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
121 //<big><big><strong>" + date + "</strong></big></big>\n"; 146 //<big><big><strong>" + date + "</strong></big></big>\n";
122 mText = "<table width=\"100%\">\n"; 147 mText = "<table width=\"100%\">\n";
123 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
124#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
125 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
126#else 151#else
127 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
128#endif 153#endif
@@ -609,26 +634,24 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
609 634
610/* 635/*
611 void KOWhatsNextView::createEventViewer() 636 void KOWhatsNextView::createEventViewer()
612 { 637 {
613 if (!mEventViewer) { 638 if (!mEventViewer) {
614 639
615 mEventViewer = new KOEventViewerDialog(this); 640 mEventViewer = new KOEventViewerDialog(this);
616 } 641 }
617 } 642 }
618*/ 643*/
619void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 644void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
620{ 645{
621 if ( mEventViewer )
622 delete mEventViewer;
623 mEventViewer = v; 646 mEventViewer = v;
624} 647}
625 648
626// TODO: Create this function in CalendarView and remove it from here 649// TODO: Create this function in CalendarView and remove it from here
627void KOWhatsNextView::showIncidence(const QString &uid) 650void KOWhatsNextView::showIncidence(const QString &uid)
628{ 651{
629 if ( !mEventViewer ) { 652 if ( !mEventViewer ) {
630 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); 653 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
631 return; 654 return;
632 } 655 }
633 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; 656 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
634 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); 657 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index fff769a..1118bdd 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -11,24 +11,25 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOWHATSNEXTVIEW_H 19#ifndef KOWHATSNEXTVIEW_H
20#define KOWHATSNEXTVIEW_H 20#define KOWHATSNEXTVIEW_H
21 21
22#include <qtextbrowser.h> 22#include <qtextbrowser.h>
23#include <qtimer.h>
23 24
24#include <korganizer/baseview.h> 25#include <korganizer/baseview.h>
25 26
26class QListView; 27class QListView;
27class QLabel; 28class QLabel;
28 29
29class KOEventViewerDialog; 30class KOEventViewerDialog;
30 31
31class WhatsNextTextBrowser : public QTextBrowser { 32class WhatsNextTextBrowser : public QTextBrowser {
32 Q_OBJECT 33 Q_OBJECT
33 public: 34 public:
34 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} 35 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
@@ -63,29 +64,33 @@ class KOWhatsNextView : public KOrg::BaseView
63 64
64 public slots: 65 public slots:
65 virtual void updateView(); 66 virtual void updateView();
66 virtual void showDates(const QDate &start, const QDate &end); 67 virtual void showDates(const QDate &start, const QDate &end);
67 virtual void showEvents(QPtrList<Event> eventList); 68 virtual void showEvents(QPtrList<Event> eventList);
68 void updateConfig(); 69 void updateConfig();
69 void changeEventDisplay(Event *, int); 70 void changeEventDisplay(Event *, int);
70 71
71 protected: 72 protected:
72 void appendEvent(Incidence *, bool reply=false, bool notRed = true); 73 void appendEvent(Incidence *, bool reply=false, bool notRed = true);
73 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
74 void appendDay( int i, QDate date ); 75 void appendDay( int i, QDate date );
75 QDate mEventDate; 76 QDate mEventDate;
77 virtual void showEvent ( QShowEvent * );
78 virtual void hideEvent ( QHideEvent * );
76 79
77 private slots: 80 private slots:
78 void showIncidence(const QString &); 81 void showIncidence(const QString &);
82 void restartTimer();
83
79 84
80 private: 85 private:
81 //void createEventViewer(); 86 //void createEventViewer();
82 87 QTimer* mTimer;
83 QTextBrowser *mView; 88 QTextBrowser *mView;
84 QString mText; 89 QString mText;
85 // QLabel *mDateLabel; 90 // QLabel *mDateLabel;
86 KOEventViewerDialog *mEventViewer; 91 KOEventViewerDialog *mEventViewer;
87 92
88 QValueList<Incidence *> mTodos; 93 QValueList<Incidence *> mTodos;
89}; 94};
90 95
91#endif 96#endif