-rw-r--r-- | korganizer/kowhatsnextview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 53fe7d0..8473db9 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -177,32 +177,33 @@ void KOWhatsNextView::hideEvent ( QHideEvent * e) | |||
177 | { | 177 | { |
178 | //qDebug(" KOWhatsNextView::hideEvent"); | 178 | //qDebug(" KOWhatsNextView::hideEvent"); |
179 | mTimer->stop(); | 179 | mTimer->stop(); |
180 | QWidget::hideEvent ( e ); | 180 | QWidget::hideEvent ( e ); |
181 | } | 181 | } |
182 | void KOWhatsNextView::restartTimer() | 182 | void KOWhatsNextView::restartTimer() |
183 | { | 183 | { |
184 | //qDebug("KOWhatsNextView::restartTimer() "); | 184 | //qDebug("KOWhatsNextView::restartTimer() "); |
185 | mTimer->start( 300000 ); | 185 | mTimer->start( 300000 ); |
186 | //mTimer->start( 5000 ); | 186 | //mTimer->start( 5000 ); |
187 | } | 187 | } |
188 | void KOWhatsNextView::updateView() | 188 | void KOWhatsNextView::updateView() |
189 | { | 189 | { |
190 | //qDebug("KOWhatsNextView::updateView() "); | 190 | //qDebug("KOWhatsNextView::updateView() "); |
191 | if ( mTimer->isActive() ) | 191 | if ( mTimer->isActive() ) |
192 | restartTimer(); | 192 | restartTimer(); |
193 | mCurrentMaxPrio = 5; | ||
193 | //qDebug("KOWhatsNextView::updateView() "); | 194 | //qDebug("KOWhatsNextView::updateView() "); |
194 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 195 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
195 | KIconLoader kil("korganizer"); | 196 | KIconLoader kil("korganizer"); |
196 | QString ipath;// = new QString(); | 197 | QString ipath;// = new QString(); |
197 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 198 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
198 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 199 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
199 | mText = "<table width=\"100%\">\n"; | 200 | mText = "<table width=\"100%\">\n"; |
200 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 201 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
201 | #ifdef DESKTOP_VERSION | 202 | #ifdef DESKTOP_VERSION |
202 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 203 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
203 | #else | 204 | #else |
204 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 205 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
205 | #endif | 206 | #endif |
206 | // mText += "<img src=\""; | 207 | // mText += "<img src=\""; |
207 | // mText += ipath; | 208 | // mText += ipath; |
208 | // mText += "\">"; | 209 | // mText += "\">"; |
@@ -305,32 +306,33 @@ void KOWhatsNextView::updateView() | |||
305 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 306 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
306 | 307 | ||
307 | //mText += "<ul>\n"; | 308 | //mText += "<ul>\n"; |
308 | bool gotone = false; | 309 | bool gotone = false; |
309 | int priority = 1; | 310 | int priority = 1; |
310 | int priosFound = 0; | 311 | int priosFound = 0; |
311 | #ifdef DESKTOP_VERSION | 312 | #ifdef DESKTOP_VERSION |
312 | mText +="<p></p>"; | 313 | mText +="<p></p>"; |
313 | #endif | 314 | #endif |
314 | 315 | ||
315 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 316 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
316 | mText += "<ul>\n"; | 317 | mText += "<ul>\n"; |
317 | while (!gotone && priority<6) { | 318 | while (!gotone && priority<6) { |
318 | todo = todos.first(); | 319 | todo = todos.first(); |
319 | while(todo) { | 320 | while(todo) { |
320 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 321 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
322 | mCurrentMaxPrio = priority - priosFound + topmostPrios -1; | ||
321 | if ( appendTodo(todo) ) | 323 | if ( appendTodo(todo) ) |
322 | gotone = true; | 324 | gotone = true; |
323 | } | 325 | } |
324 | todo = todos.next(); | 326 | todo = todos.next(); |
325 | } | 327 | } |
326 | if ( gotone ) { | 328 | if ( gotone ) { |
327 | gotone = false; | 329 | gotone = false; |
328 | ++priosFound; | 330 | ++priosFound; |
329 | if ( priosFound == topmostPrios ) | 331 | if ( priosFound == topmostPrios ) |
330 | break; | 332 | break; |
331 | } | 333 | } |
332 | priority++; | 334 | priority++; |
333 | // kdDebug() << "adding the todos..." << endl; | 335 | // kdDebug() << "adding the todos..." << endl; |
334 | } | 336 | } |
335 | mText += "</ul>\n"; | 337 | mText += "</ul>\n"; |
336 | } | 338 | } |
@@ -712,33 +714,33 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | |||
712 | } | 714 | } |
713 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 715 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
714 | if ( !ev->location().isEmpty() ) | 716 | if ( !ev->location().isEmpty() ) |
715 | mText += " ("+ev->location() +")"; | 717 | mText += " ("+ev->location() +")"; |
716 | if ( !isSub ) { | 718 | if ( !isSub ) { |
717 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 719 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
718 | mText += " ["+ev->relatedTo()->summary() +"]"; | 720 | mText += " ["+ev->relatedTo()->summary() +"]"; |
719 | mText += "</p>\n"; | 721 | mText += "</p>\n"; |
720 | } | 722 | } |
721 | else { | 723 | else { |
722 | ind += "-"; | 724 | ind += "-"; |
723 | mText += "</li>\n"; | 725 | mText += "</li>\n"; |
724 | } | 726 | } |
725 | QPtrList<Incidence> Relations = ev->relations(); | 727 | QPtrList<Incidence> Relations = ev->relations(); |
726 | Incidence *to; | 728 | Incidence *to; |
727 | for (to=Relations.first();to;to=Relations.next()) { | 729 | for (to=Relations.first();to;to=Relations.next()) { |
728 | if (!((Todo*)to)->isCompleted()) | 730 | if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio ) |
729 | appendTodo( to, ind , true ); | 731 | appendTodo( to, ind , true ); |
730 | } | 732 | } |
731 | 733 | ||
732 | return true; | 734 | return true; |
733 | } | 735 | } |
734 | 736 | ||
735 | /* | 737 | /* |
736 | void KOWhatsNextView::createEventViewer() | 738 | void KOWhatsNextView::createEventViewer() |
737 | { | 739 | { |
738 | if (!mEventViewer) { | 740 | if (!mEventViewer) { |
739 | 741 | ||
740 | mEventViewer = new KOEventViewerDialog(this); | 742 | mEventViewer = new KOEventViewerDialog(this); |
741 | } | 743 | } |
742 | } | 744 | } |
743 | */ | 745 | */ |
744 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 746 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index 715037f..d6727ac 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h | |||
@@ -74,27 +74,28 @@ class KOWhatsNextView : public KOrg::BaseView | |||
74 | void changeEventDisplay(Event *, int); | 74 | void changeEventDisplay(Event *, int); |
75 | 75 | ||
76 | protected: | 76 | protected: |
77 | bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); | 77 | bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); |
78 | bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); | 78 | bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); |
79 | void appendDay( int i, QDate date ); | 79 | void appendDay( int i, QDate date ); |
80 | QDate mEventDate; | 80 | QDate mEventDate; |
81 | virtual void showEvent ( QShowEvent * ); | 81 | virtual void showEvent ( QShowEvent * ); |
82 | virtual void hideEvent ( QHideEvent * ); | 82 | virtual void hideEvent ( QHideEvent * ); |
83 | 83 | ||
84 | private slots: | 84 | private slots: |
85 | void showIncidence(const QString &); | 85 | void showIncidence(const QString &); |
86 | void restartTimer(); | 86 | void restartTimer(); |
87 | 87 | ||
88 | 88 | ||
89 | private: | 89 | private: |
90 | int mCurrentMaxPrio; | ||
90 | //void createEventViewer(); | 91 | //void createEventViewer(); |
91 | QTimer* mTimer; | 92 | QTimer* mTimer; |
92 | WhatsNextTextBrowser *mView; | 93 | WhatsNextTextBrowser *mView; |
93 | QString mText; | 94 | QString mText; |
94 | // QLabel *mDateLabel; | 95 | // QLabel *mDateLabel; |
95 | KOEventViewerDialog *mEventViewer; | 96 | KOEventViewerDialog *mEventViewer; |
96 | 97 | ||
97 | QValueList<Incidence *> mTodos; | 98 | QValueList<Incidence *> mTodos; |
98 | }; | 99 | }; |
99 | 100 | ||
100 | #endif | 101 | #endif |