summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-08 11:56:30 (UTC)
committer zautrix <zautrix>2005-04-08 11:56:30 (UTC)
commitafb896709be49326ca9d9ad1656153cc27a60ffe (patch) (unidiff)
treed9dc3976e60435b4c8116fff596358e97f100996
parentba04f6a4b6b651dcff11ca17103cba42330e52be (diff)
downloadkdepimpi-afb896709be49326ca9d9ad1656153cc27a60ffe.zip
kdepimpi-afb896709be49326ca9d9ad1656153cc27a60ffe.tar.gz
kdepimpi-afb896709be49326ca9d9ad1656153cc27a60ffe.tar.bz2
wn fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp4
-rw-r--r--korganizer/kowhatsnextview.h1
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
@@ -1,512 +1,514 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qtextbrowser.h> 21#include <qtextbrowser.h>
22#include <qtextcodec.h> 22#include <qtextcodec.h>
23#include <qfileinfo.h> 23#include <qfileinfo.h>
24#include <qlabel.h> 24#include <qlabel.h>
25 25
26#include <qapplication.h> 26#include <qapplication.h>
27#ifdef DESKTOP_VERSION 27#ifdef DESKTOP_VERSION
28#include <qpaintdevicemetrics.h> 28#include <qpaintdevicemetrics.h>
29#endif 29#endif
30#include <kglobal.h> 30#include <kglobal.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kmessagebox.h> 34#include <kmessagebox.h>
35 35
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37 37
38#ifndef KORG_NOPRINTER 38#ifndef KORG_NOPRINTER
39#include "calprinter.h" 39#include "calprinter.h"
40#endif 40#endif
41#include "koglobals.h" 41#include "koglobals.h"
42#include "koprefs.h" 42#include "koprefs.h"
43#include "koeventviewerdialog.h" 43#include "koeventviewerdialog.h"
44#include "koeventviewer.h" 44#include "koeventviewer.h"
45#include <qstylesheet.h> 45#include <qstylesheet.h>
46#include "kowhatsnextview.h" 46#include "kowhatsnextview.h"
47using namespace KOrg; 47using namespace KOrg;
48 48
49void WhatsNextTextBrowser::setSource(const QString& n) 49void WhatsNextTextBrowser::setSource(const QString& n)
50{ 50{
51 51
52 if (n.startsWith("event:")) { 52 if (n.startsWith("event:")) {
53 emit showIncidence(n); 53 emit showIncidence(n);
54 return; 54 return;
55 } else if (n.startsWith("todo:")) { 55 } else if (n.startsWith("todo:")) {
56 emit showIncidence(n); 56 emit showIncidence(n);
57 return; 57 return;
58 } else { 58 } else {
59 QTextBrowser::setSource(n); 59 QTextBrowser::setSource(n);
60 } 60 }
61} 61}
62void WhatsNextTextBrowser::printMe() 62void WhatsNextTextBrowser::printMe()
63{ 63{
64#ifdef DESKTOP_VERSION 64#ifdef DESKTOP_VERSION
65 KOPrintPrefs pp ( this ); 65 KOPrintPrefs pp ( this );
66 if (!pp.exec() ) 66 if (!pp.exec() )
67 return; 67 return;
68 int scaleval = pp.printMode() ; 68 int scaleval = pp.printMode() ;
69 69
70 QPrinter printer; 70 QPrinter printer;
71 if (!printer.setup() ) 71 if (!printer.setup() )
72 return; 72 return;
73 QPainter p; 73 QPainter p;
74 p.begin ( &printer ); 74 p.begin ( &printer );
75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
76 float dx, dy; 76 float dx, dy;
77 int wid = (m.width() * 9)/10; 77 int wid = (m.width() * 9)/10;
78 dx = (float) wid/(float)contentsWidth (); 78 dx = (float) wid/(float)contentsWidth ();
79 dy = (float)(m.height()) / (float)contentsHeight (); 79 dy = (float)(m.height()) / (float)contentsHeight ();
80 float scale; 80 float scale;
81 // scale to fit the width or height of the paper 81 // scale to fit the width or height of the paper
82 if ( dx < dy ) 82 if ( dx < dy )
83 scale = dx; 83 scale = dx;
84 else 84 else
85 scale = dy; 85 scale = dy;
86 p.translate( m.width()/10,0 ); 86 p.translate( m.width()/10,0 );
87 qDebug("Scale: %f ", scale ); 87 qDebug("Scale: %f ", scale );
88 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 88 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
89 qDebug("SCALE "); 89 qDebug("SCALE ");
90 p.scale( scale, scale ); 90 p.scale( scale, scale );
91 } 91 }
92 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 92 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
93 p.end(); 93 p.end();
94#endif 94#endif
95} 95}
96 96
97KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 97KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
98 const char *name) 98 const char *name)
99 : KOrg::BaseView(calendar, parent, name) 99 : KOrg::BaseView(calendar, parent, name)
100{ 100{
101 // mDateLabel = 101 // mDateLabel =
102 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 102 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
103 // mDateLabel->setMargin(2); 103 // mDateLabel->setMargin(2);
104 // mDateLabel->setAlignment(AlignCenter); 104 // mDateLabel->setAlignment(AlignCenter);
105 setFont( KOPrefs::instance()->mWhatsNextFont ); 105 setFont( KOPrefs::instance()->mWhatsNextFont );
106 mView = new WhatsNextTextBrowser(this); 106 mView = new WhatsNextTextBrowser(this);
107 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 107 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
108 QStyleSheet* stsh = mView->styleSheet(); 108 QStyleSheet* stsh = mView->styleSheet();
109 QStyleSheetItem * style ; 109 QStyleSheetItem * style ;
110 style = stsh->item ("h2" ); 110 style = stsh->item ("h2" );
111 if ( style ) { 111 if ( style ) {
112 style->setMargin(QStyleSheetItem::MarginAll,0); 112 style->setMargin(QStyleSheetItem::MarginAll,0);
113 } 113 }
114 style = stsh->item ("h3" ); 114 style = stsh->item ("h3" );
115 if ( style ) { 115 if ( style ) {
116 style->setMargin(QStyleSheetItem::MarginAll,0); 116 style->setMargin(QStyleSheetItem::MarginAll,0);
117 } 117 }
118 mEventViewer = 0; 118 mEventViewer = 0;
119 119
120 QBoxLayout *topLayout = new QVBoxLayout(this); 120 QBoxLayout *topLayout = new QVBoxLayout(this);
121 // topLayout->addWidget(mDateLabel); 121 // topLayout->addWidget(mDateLabel);
122 topLayout->addWidget(mView); 122 topLayout->addWidget(mView);
123 mTimer = new QTimer( this ); 123 mTimer = new QTimer( this );
124 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 124 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
125 125
126 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 126 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
127 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 127 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
128} 128}
129 129
130KOWhatsNextView::~KOWhatsNextView() 130KOWhatsNextView::~KOWhatsNextView()
131{ 131{
132} 132}
133 133
134int KOWhatsNextView::maxDatesHint() 134int KOWhatsNextView::maxDatesHint()
135{ 135{
136 return 0; 136 return 0;
137} 137}
138 138
139int KOWhatsNextView::currentDateCount() 139int KOWhatsNextView::currentDateCount()
140{ 140{
141 return 0; 141 return 0;
142} 142}
143 143
144QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 144QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
145{ 145{
146 QPtrList<Incidence> eventList; 146 QPtrList<Incidence> eventList;
147 147
148 return eventList; 148 return eventList;
149} 149}
150 150
151void KOWhatsNextView::printMe() 151void KOWhatsNextView::printMe()
152{ 152{
153#ifdef DESKTOP_VERSION 153#ifdef DESKTOP_VERSION
154 mView->printMe(); 154 mView->printMe();
155#endif 155#endif
156} 156}
157void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 157void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
158 const QDate &td) 158 const QDate &td)
159{ 159{
160#ifndef KORG_NOPRINTER 160#ifndef KORG_NOPRINTER
161 calPrinter->preview(CalPrinter::Day, fd, td); 161 calPrinter->preview(CalPrinter::Day, fd, td);
162#endif 162#endif
163} 163}
164void KOWhatsNextView::updateConfig() 164void KOWhatsNextView::updateConfig()
165{ 165{
166 setFont( KOPrefs::instance()->mWhatsNextFont ); 166 setFont( KOPrefs::instance()->mWhatsNextFont );
167 updateView(); 167 updateView();
168 168
169} 169}
170void KOWhatsNextView::showEvent ( QShowEvent * e ) 170void KOWhatsNextView::showEvent ( QShowEvent * e )
171{ 171{
172 //qDebug("KOWhatsNextView::showEvent "); 172 //qDebug("KOWhatsNextView::showEvent ");
173 restartTimer(); 173 restartTimer();
174 QWidget::showEvent ( e ); 174 QWidget::showEvent ( e );
175} 175}
176void KOWhatsNextView::hideEvent ( QHideEvent * e) 176void 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}
182void KOWhatsNextView::restartTimer() 182void 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}
188void KOWhatsNextView::updateView() 188void 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 += "\">";
209 mEventDate = QDate::currentDate(); 210 mEventDate = QDate::currentDate();
210#ifdef DESKTOP_VERSION 211#ifdef DESKTOP_VERSION
211 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; 212 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
212#else 213#else
213 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; 214 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
214#endif 215#endif
215 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 216 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
216 int iii; 217 int iii;
217 mTodos.clear(); 218 mTodos.clear();
218 QPtrList<Event> events; 219 QPtrList<Event> events;
219 QPtrList<Todo> todos = calendar()->todos(); 220 QPtrList<Todo> todos = calendar()->todos();
220 Todo * todo; 221 Todo * todo;
221 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 222 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
222 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 223 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
223 bool itemAdded = false; 224 bool itemAdded = false;
224 for ( iii = 0; iii < daysToShow; ++iii ) { 225 for ( iii = 0; iii < daysToShow; ++iii ) {
225 QString date; 226 QString date;
226 itemAdded = false; 227 itemAdded = false;
227 events = calendar()->events( mEventDate, true ); 228 events = calendar()->events( mEventDate, true );
228 229
229 if ( iii == 0 ) { // today !!! 230 if ( iii == 0 ) { // today !!!
230 todo = todos.first(); 231 todo = todos.first();
231 while(todo) { 232 while(todo) {
232 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 233 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
233 if ( ! itemAdded ) { 234 if ( ! itemAdded ) {
234 appendDay ( iii, mEventDate ); 235 appendDay ( iii, mEventDate );
235 //itemAdded = true; 236 //itemAdded = true;
236 237
237 } //bool reply=false, bool notRed = true, bool appendTable = false); 238 } //bool reply=false, bool notRed = true, bool appendTable = false);
238 appendEvent(todo, false, false, !itemAdded ); 239 appendEvent(todo, false, false, !itemAdded );
239 itemAdded = true; 240 itemAdded = true;
240 } 241 }
241 todo = todos.next(); 242 todo = todos.next();
242 } 243 }
243 } 244 }
244 245
245 246
246 if (events.count() > 0) { 247 if (events.count() > 0) {
247 // mText += "<p></p>"; 248 // mText += "<p></p>";
248 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 249 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
249 // mText += "<h2>"; 250 // mText += "<h2>";
250 //mText += " <img src=\""; 251 //mText += " <img src=\"";
251 //mText += ipath; 252 //mText += ipath;
252 //mText += "\">"; 253 //mText += "\">";
253 if ( ! itemAdded ) { 254 if ( ! itemAdded ) {
254 appendDay ( iii, mEventDate ); 255 appendDay ( iii, mEventDate );
255 256
256 } 257 }
257 // for first day (iii == 0) 258 // for first day (iii == 0)
258 // we may have syncevents, or events in the past, which maybe should not be diaplayed 259 // we may have syncevents, or events in the past, which maybe should not be diaplayed
259 // for that reason we cannot append <table> in appendDay () for iii == 0 260 // for that reason we cannot append <table> in appendDay () for iii == 0
260 // we must append it in the first successful call of appendEvent() 261 // we must append it in the first successful call of appendEvent()
261 Event *ev = events.first(); 262 Event *ev = events.first();
262 while(ev) { 263 while(ev) {
263 //qDebug("+++++event append %s", ev->summary().latin1()); 264 //qDebug("+++++event append %s", ev->summary().latin1());
264 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { 265 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
265 if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) 266 if ( appendEvent(ev, false , iii!= 0,!itemAdded ) )
266 itemAdded = true; 267 itemAdded = true;
267 } 268 }
268 ev = events.next(); 269 ev = events.next();
269 } 270 }
270 271
271 //mText += "</table>\n"; 272 //mText += "</table>\n";
272 } 273 }
273 274
274 todo = todos.first(); 275 todo = todos.first();
275 while(todo) { 276 while(todo) {
276 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { 277 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) {
277 if ( ! itemAdded ) { 278 if ( ! itemAdded ) {
278 appendDay ( iii, mEventDate ); 279 appendDay ( iii, mEventDate );
279 //itemAdded = true; 280 //itemAdded = true;
280 } 281 }
281 appendEvent(todo, false , iii!= 0,!itemAdded); 282 appendEvent(todo, false , iii!= 0,!itemAdded);
282 itemAdded = true; 283 itemAdded = true;
283 } 284 }
284 todo = todos.next(); 285 todo = todos.next();
285 } 286 }
286 if ( !itemAdded && iii == 0 ) { 287 if ( !itemAdded && iii == 0 ) {
287 // appendDay ( iii, mEventDate ); 288 // appendDay ( iii, mEventDate );
288 //mText += "<table>"; 289 //mText += "<table>";
289 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; 290 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n";
290 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; 291 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n";
291 //mText +="</table>"; 292 //mText +="</table>";
292 } 293 }
293 if ( itemAdded ) 294 if ( itemAdded )
294 mText += "</table>\n"; 295 mText += "</table>\n";
295 mEventDate = mEventDate.addDays( 1 ); 296 mEventDate = mEventDate.addDays( 1 );
296 } 297 }
297 298
298 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 299 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
299 if (todos.count() > 0 && topmostPrios > 0 ) { 300 if (todos.count() > 0 && topmostPrios > 0 ) {
300 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 301 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
301 // mText += "<h2>"; 302 // mText += "<h2>";
302 //<img src=\""; 303 //<img src=\"";
303 // mText += ipath; 304 // mText += ipath;
304 // mText += "\">"; 305 // mText += "\">";
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 }
337 339
338 int replys = 0; 340 int replys = 0;
339 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); 341 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
340 if (events.count() > 0) { 342 if (events.count() > 0) {
341 Event *ev = events.first(); 343 Event *ev = events.first();
342 while(ev) { 344 while(ev) {
343 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 345 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
344 if (me!=0) { 346 if (me!=0) {
345 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 347 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
346 if (replys == 0) { 348 if (replys == 0) {
347 mText += "<p></p>"; 349 mText += "<p></p>";
348 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 350 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
349 //mText += "<h2>"; 351 //mText += "<h2>";
350 //<img src=\""; 352 //<img src=\"";
351 // mText += ipath; 353 // mText += ipath;
352 // mText += "\">"; 354 // mText += "\">";
353 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 355 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
354 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; 356 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n";
355 mText += "<table>\n"; 357 mText += "<table>\n";
356 } 358 }
357 replys++; 359 replys++;
358 appendEvent(ev,true); 360 appendEvent(ev,true);
359 } 361 }
360 } 362 }
361 ev = events.next(); 363 ev = events.next();
362 } 364 }
363 } 365 }
364 todos = calendar()->todos(); 366 todos = calendar()->todos();
365 if (todos.count() > 0) { 367 if (todos.count() > 0) {
366 Todo *to = todos.first(); 368 Todo *to = todos.first();
367 while(to) { 369 while(to) {
368 if ( !to->isCompleted() ){ 370 if ( !to->isCompleted() ){
369 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 371 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
370 if (me!=0) { 372 if (me!=0) {
371 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 373 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
372 if (replys == 0) { 374 if (replys == 0) {
373 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; 375 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n";
374 mText += "<table>\n"; 376 mText += "<table>\n";
375 } 377 }
376 replys++; 378 replys++;
377 appendEvent(to, true); 379 appendEvent(to, true);
378 } 380 }
379 } 381 }
380 } 382 }
381 to = todos.next(); 383 to = todos.next();
382 } 384 }
383 } 385 }
384 if (replys > 0 ) mText += "</table>\n"; 386 if (replys > 0 ) mText += "</table>\n";
385 387
386 388
387 mText += "</td></tr>\n</table>\n"; 389 mText += "</td></tr>\n</table>\n";
388 390
389 mView->setText(mText); 391 mView->setText(mText);
390 mView->setFocus(); 392 mView->setFocus();
391 393
392 // QPixmap bPix = SmallIcon( "back" ); 394 // QPixmap bPix = SmallIcon( "back" );
393 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 395 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
394 // QWidget* test = new QWidget(); 396 // QWidget* test = new QWidget();
395 // test->setBackgroundMode(FixedPixmap ); 397 // test->setBackgroundMode(FixedPixmap );
396 // test->setBackgroundPixmap ( bPix ); 398 // test->setBackgroundPixmap ( bPix );
397 // test->resize( 300, 400 ); 399 // test->resize( 300, 400 );
398 // test->show(); 400 // test->show();
399 // mView->setBackgroundMode(FixedPixmap ); 401 // mView->setBackgroundMode(FixedPixmap );
400 // mView->setBackgroundPixmap ( bPix ); 402 // mView->setBackgroundPixmap ( bPix );
401 // qDebug("%s ",mText.latin1()); 403 // qDebug("%s ",mText.latin1());
402} 404}
403 405
404void KOWhatsNextView::appendDay( int i, QDate eventDate ) 406void KOWhatsNextView::appendDay( int i, QDate eventDate )
405{ 407{
406 QString date; 408 QString date;
407 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 409 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
408 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 410 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
409 if ( i == 0 ) { 411 if ( i == 0 ) {
410 //mText += "<table>\n"; 412 //mText += "<table>\n";
411 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 413 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
412 } 414 }
413 else if ( i == 1 ) 415 else if ( i == 1 )
414 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 416 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
415 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 417 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
416 mText += "<h2>" + date + "</h2>\n"; 418 mText += "<h2>" + date + "</h2>\n";
417 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 419 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
418 mText += "<table>\n"; 420 mText += "<table>\n";
419 421
420 422
421 423
422 } else { 424 } else {
423 if ( i == 0 ) { 425 if ( i == 0 ) {
424 //mText += "<table>\n"; 426 //mText += "<table>\n";
425 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 427 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
426 } 428 }
427 429
428#ifdef DESKTOP_VERSION 430#ifdef DESKTOP_VERSION
429 else if ( i == 1 ) { 431 else if ( i == 1 ) {
430 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 432 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
431 } 433 }
432 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 434 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
433#else 435#else
434 else if ( i == 1 ) { 436 else if ( i == 1 ) {
435 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 437 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
436 } 438 }
437 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 439 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
438 440
439#endif 441#endif
440 mText += "<h2>" + date + "</h2>\n"; 442 mText += "<h2>" + date + "</h2>\n";
441 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 443 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
442 mText += "<table>\n"; 444 mText += "<table>\n";
443 } 445 }
444} 446}
445 447
446 448
447void KOWhatsNextView::showDates(const QDate &, const QDate &) 449void KOWhatsNextView::showDates(const QDate &, const QDate &)
448{ 450{
449 updateView(); 451 updateView();
450} 452}
451 453
452void KOWhatsNextView::showEvents(QPtrList<Event>) 454void KOWhatsNextView::showEvents(QPtrList<Event>)
453{ 455{
454} 456}
455 457
456void KOWhatsNextView::changeEventDisplay(Event *, int action) 458void KOWhatsNextView::changeEventDisplay(Event *, int action)
457{ 459{
458 switch(action) { 460 switch(action) {
459 case KOGlobals::EVENTADDED: 461 case KOGlobals::EVENTADDED:
460 updateView(); 462 updateView();
461 break; 463 break;
462 case KOGlobals::EVENTEDITED: 464 case KOGlobals::EVENTEDITED:
463 updateView(); 465 updateView();
464 break; 466 break;
465 case KOGlobals::EVENTDELETED: 467 case KOGlobals::EVENTDELETED:
466 updateView(); 468 updateView();
467 break; 469 break;
468 default: 470 default:
469 updateView(); 471 updateView();
470 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 472 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
471 } 473 }
472} 474}
473 475
474bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) 476bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
475{ 477{
476 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 478 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
477 return false; 479 return false;
478 QDateTime cdt = QDateTime::currentDateTime(); 480 QDateTime cdt = QDateTime::currentDateTime();
479 QDateTime noc; 481 QDateTime noc;
480 QString tempText; 482 QString tempText;
481 if ( appendTable && !notRed ) { 483 if ( appendTable && !notRed ) {
482 tempText = "<table>"; 484 tempText = "<table>";
483 } 485 }
484 bool ok = true; 486 bool ok = true;
485 if ( reply ) { 487 if ( reply ) {
486 noc = ev->getNextOccurence( cdt, &ok ); 488 noc = ev->getNextOccurence( cdt, &ok );
487 if (! ok && ev->type() == "Event") 489 if (! ok && ev->type() == "Event")
488 return false; 490 return false;
489 } 491 }
490 bool bDay = false; 492 bool bDay = false;
491 if ( ev->isBirthday() || ev->isAnniversary() ) 493 if ( ev->isBirthday() || ev->isAnniversary() )
492 bDay = true; 494 bDay = true;
493 tempText += "<tr><td><b>"; 495 tempText += "<tr><td><b>";
494 if (ev->type()=="Event") { 496 if (ev->type()=="Event") {
495 if (reply) { 497 if (reply) {
496 if (!ev->doesFloat()) 498 if (!ev->doesFloat())
497 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 499 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
498 else 500 else
499 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 501 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
500 502
501 } else { 503 } else {
502 if (!ev->doesFloat()) { 504 if (!ev->doesFloat()) {
503 Event *event = static_cast<Event *>(ev); 505 Event *event = static_cast<Event *>(ev);
504 QDateTime st,end; 506 QDateTime st,end;
505 if ( event->recurrence()->doesRecur() ) { 507 if ( event->recurrence()->doesRecur() ) {
506 QDate recDate= mEventDate; 508 QDate recDate= mEventDate;
507 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 509 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
508 while ( ! event->recursOn( recDate ) ) { 510 while ( ! event->recursOn( recDate ) ) {
509 recDate = recDate.addDays( -1 ); 511 recDate = recDate.addDays( -1 );
510 512
511 } 513 }
512 st = QDateTime ( recDate, event->dtStart().time() ); 514 st = QDateTime ( recDate, event->dtStart().time() );
@@ -536,249 +538,249 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
536 return false; 538 return false;
537 tempText += "<font color=\"#F00000\">" + dateText + "</font>"; 539 tempText += "<font color=\"#F00000\">" + dateText + "</font>";
538 } 540 }
539 else if ( st < cdt ) 541 else if ( st < cdt )
540 tempText += "<font color=\"#008000\">" + dateText + "</font>"; 542 tempText += "<font color=\"#008000\">" + dateText + "</font>";
541 else 543 else
542 tempText += dateText; 544 tempText += dateText;
543 545
544 } 546 }
545 547
546 } else { 548 } else {
547 if ( bDay ) { 549 if ( bDay ) {
548 550
549 if ( ev->isBirthday()) 551 if ( ev->isBirthday())
550 tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; 552 tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>";
551 else 553 else
552 tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; 554 tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>";
553 } else { 555 } else {
554 tempText += i18n("Allday:"); 556 tempText += i18n("Allday:");
555 } 557 }
556 558
557 } 559 }
558 } 560 }
559 } else { 561 } else {
560 mTodos.append( ev ); 562 mTodos.append( ev );
561 tempText += i18n("ToDo:"); 563 tempText += i18n("ToDo:");
562 if (reply) { 564 if (reply) {
563 tempText += " "; 565 tempText += " ";
564 if ( noc != cdt ) { 566 if ( noc != cdt ) {
565 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 567 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
566 } 568 }
567 } else { 569 } else {
568 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 570 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
569 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 571 // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
570 QString dfs = KGlobal::locale()->dateFormatShort(); 572 QString dfs = KGlobal::locale()->dateFormatShort();
571 KGlobal::locale()->setDateFormatShort("%d.%b"); 573 KGlobal::locale()->setDateFormatShort("%d.%b");
572 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 574 tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
573 KGlobal::locale()->setDateFormatShort(dfs); 575 KGlobal::locale()->setDateFormatShort(dfs);
574 } else { 576 } else {
575 if (!ev->doesFloat() ) 577 if (!ev->doesFloat() )
576 if( ( (Todo*)ev)->dtDue() < cdt ) { 578 if( ( (Todo*)ev)->dtDue() < cdt ) {
577 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 579 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
578 580
579 581
580 } else 582 } else
581 tempText +=((Todo*)ev)->dtDueTimeStr(); 583 tempText +=((Todo*)ev)->dtDueTimeStr();
582 mTodos.append( ev ); 584 mTodos.append( ev );
583 } 585 }
584 } 586 }
585 } 587 }
586 tempText += "</b></td><td>"; 588 tempText += "</b></td><td>";
587 bool needClose = false; 589 bool needClose = false;
588 if ( ev->cancelled() ) { 590 if ( ev->cancelled() ) {
589 tempText += "<font color=\"#F00000\">[c"; 591 tempText += "<font color=\"#F00000\">[c";
590 needClose =true; 592 needClose =true;
591 593
592 } 594 }
593 if ( ev->isAlarmEnabled() ) { 595 if ( ev->isAlarmEnabled() ) {
594 if ( !needClose) 596 if ( !needClose)
595 tempText +="["; 597 tempText +="[";
596 tempText += "a"; 598 tempText += "a";
597 needClose =true; 599 needClose =true;
598 600
599 } 601 }
600 if ( ev->description().length() > 0 ) { 602 if ( ev->description().length() > 0 ) {
601 if ( !needClose) 603 if ( !needClose)
602 tempText +="["; 604 tempText +="[";
603 tempText += "i"; 605 tempText += "i";
604 needClose =true; 606 needClose =true;
605 } 607 }
606 if ( ev->recurrence()->doesRecur() ) { 608 if ( ev->recurrence()->doesRecur() ) {
607 if ( !needClose) 609 if ( !needClose)
608 tempText +="["; 610 tempText +="[";
609 tempText += "r"; 611 tempText += "r";
610 needClose =true; 612 needClose =true;
611 } 613 }
612 if ( needClose ) { 614 if ( needClose ) {
613 tempText += "] "; 615 tempText += "] ";
614 } 616 }
615 if ( ev->cancelled() ) 617 if ( ev->cancelled() )
616 tempText += "</font>"; 618 tempText += "</font>";
617 tempText += "<a "; 619 tempText += "<a ";
618 if (ev->type()=="Event") tempText += "href=\"event:"; 620 if (ev->type()=="Event") tempText += "href=\"event:";
619 if (ev->type()=="Todo") tempText += "href=\"todo:"; 621 if (ev->type()=="Todo") tempText += "href=\"todo:";
620 tempText += ev->uid() + "\">"; 622 tempText += ev->uid() + "\">";
621 if ( ev->summary().length() > 0 ) 623 if ( ev->summary().length() > 0 )
622 tempText += ev->summary(); 624 tempText += ev->summary();
623 else 625 else
624 tempText += i18n("-no summary-"); 626 tempText += i18n("-no summary-");
625 if ( bDay ) { 627 if ( bDay ) {
626 noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); 628 noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
627 if ( ok ) { 629 if ( ok ) {
628 int years = 0; 630 int years = 0;
629 if ( ev->type() =="Todo" ) { 631 if ( ev->type() =="Todo" ) {
630 years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); 632 years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
631 } else 633 } else
632 years = noc.date().year() - ev->dtStart().date().year(); 634 years = noc.date().year() - ev->dtStart().date().year();
633 tempText += i18n(" (%1 y.)"). arg( years ); 635 tempText += i18n(" (%1 y.)"). arg( years );
634 } 636 }
635 } 637 }
636 638
637 tempText += "</a>"; 639 tempText += "</a>";
638 if ( KOPrefs::instance()->mWNViewShowLocation ) 640 if ( KOPrefs::instance()->mWNViewShowLocation )
639 if ( !ev->location().isEmpty() ) 641 if ( !ev->location().isEmpty() )
640 tempText += " ("+ev->location() +")"; 642 tempText += " ("+ev->location() +")";
641 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 643 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
642 tempText += " ["+ev->relatedTo()->summary() +"]"; 644 tempText += " ["+ev->relatedTo()->summary() +"]";
643 tempText += "</td></tr>\n"; 645 tempText += "</td></tr>\n";
644 mText += tempText; 646 mText += tempText;
645 return true; 647 return true;
646} 648}
647 649
648bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 650bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
649{ 651{
650 if ( mTodos.find( ev ) != mTodos.end() ) return false; 652 if ( mTodos.find( ev ) != mTodos.end() ) return false;
651 653
652 mTodos.append( ev ); 654 mTodos.append( ev );
653 if ( !isSub ) 655 if ( !isSub )
654 mText += "<p>"; 656 mText += "<p>";
655 else 657 else
656 mText += "<li>"; 658 mText += "<li>";
657 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 659 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
658 660
659 661
660 mText += ind; 662 mText += ind;
661 bool needClose = false; 663 bool needClose = false;
662 if ( ev->cancelled() ) { 664 if ( ev->cancelled() ) {
663 mText += "<font color=\"#F00000\">[c"; 665 mText += "<font color=\"#F00000\">[c";
664 needClose =true; 666 needClose =true;
665 667
666 } 668 }
667 if ( ev->isAlarmEnabled() ) { 669 if ( ev->isAlarmEnabled() ) {
668 if ( !needClose) 670 if ( !needClose)
669 mText +="["; 671 mText +="[";
670 mText += "a"; 672 mText += "a";
671 needClose =true; 673 needClose =true;
672 674
673 } 675 }
674 676
675 if ( ev->description().length() > 0 ) { 677 if ( ev->description().length() > 0 ) {
676 if ( !needClose) 678 if ( !needClose)
677 mText +="["; 679 mText +="[";
678 mText += "i"; 680 mText += "i";
679 needClose =true; 681 needClose =true;
680 } 682 }
681 if ( ev->doesRecur() ) { 683 if ( ev->doesRecur() ) {
682 if ( !needClose) 684 if ( !needClose)
683 mText +="["; 685 mText +="[";
684 mText += "r"; 686 mText += "r";
685 needClose =true; 687 needClose =true;
686 } 688 }
687 // if ( ev->recurrence()->doesRecur() ) { 689 // if ( ev->recurrence()->doesRecur() ) {
688 // if ( !needClose) 690 // if ( !needClose)
689 // mText +="("; 691 // mText +="(";
690 // mText += "r"; 692 // mText += "r";
691 // needClose =true; 693 // needClose =true;
692 // } 694 // }
693 if ( needClose ) 695 if ( needClose )
694 mText += "] "; 696 mText += "] ";
695 if ( ev->cancelled() ) 697 if ( ev->cancelled() )
696 mText += "</font>"; 698 mText += "</font>";
697 mText += "<a href=\"todo:" + ev->uid() + "\">"; 699 mText += "<a href=\"todo:" + ev->uid() + "\">";
698 if ( ev->summary().length() > 0 ) 700 if ( ev->summary().length() > 0 )
699 mText += ev->summary(); 701 mText += ev->summary();
700 else 702 else
701 mText += i18n("-no summary-"); 703 mText += i18n("-no summary-");
702 mText += "</a>"; 704 mText += "</a>";
703 if ( ((Todo*)ev)->hasDueDate () ) { 705 if ( ((Todo*)ev)->hasDueDate () ) {
704 QString year = ""; 706 QString year = "";
705 int ye = ((Todo*)ev)->dtDue().date().year(); 707 int ye = ((Todo*)ev)->dtDue().date().year();
706 if ( QDateTime::currentDateTime().date().year() != ye ) 708 if ( QDateTime::currentDateTime().date().year() != ye )
707 year = QString::number( ye ); 709 year = QString::number( ye );
708 QString dfs = KGlobal::locale()->dateFormatShort(); 710 QString dfs = KGlobal::locale()->dateFormatShort();
709 KGlobal::locale()->setDateFormatShort("%d.%b"); 711 KGlobal::locale()->setDateFormatShort("%d.%b");
710 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 712 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
711 KGlobal::locale()->setDateFormatShort(dfs); 713 KGlobal::locale()->setDateFormatShort(dfs);
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*/
744void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 746void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
745{ 747{
746 mEventViewer = v; 748 mEventViewer = v;
747} 749}
748 750
749// TODO: Create this function in CalendarView and remove it from here 751// TODO: Create this function in CalendarView and remove it from here
750void KOWhatsNextView::showIncidence(const QString &uid) 752void KOWhatsNextView::showIncidence(const QString &uid)
751{ 753{
752 754
753 if ( !mEventViewer ) { 755 if ( !mEventViewer ) {
754 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); 756 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
755 return; 757 return;
756 } 758 }
757 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; 759 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
758 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); 760 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
759 if (uid.startsWith("event:")) { 761 if (uid.startsWith("event:")) {
760#ifdef DESKTOP_VERSION 762#ifdef DESKTOP_VERSION
761 Event *event = calendar()->event(uid.mid(8)); 763 Event *event = calendar()->event(uid.mid(8));
762#else 764#else
763 Event *event = calendar()->event(uid.mid(6)); 765 Event *event = calendar()->event(uid.mid(6));
764#endif 766#endif
765 //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); 767 //qDebug("event %d uid %s ", event, uid.mid(6).latin1());
766 if (!event) return; 768 if (!event) return;
767 //createEventViewer(); 769 //createEventViewer();
768 mEventViewer->setEvent(event); 770 mEventViewer->setEvent(event);
769 } else if (uid.startsWith("todo:")) { 771 } else if (uid.startsWith("todo:")) {
770#ifdef DESKTOP_VERSION 772#ifdef DESKTOP_VERSION
771 Todo *todo = calendar()->todo(uid.mid(7)); 773 Todo *todo = calendar()->todo(uid.mid(7));
772#else 774#else
773 Todo *todo = calendar()->todo(uid.mid(5)); 775 Todo *todo = calendar()->todo(uid.mid(5));
774#endif 776#endif
775 if (!todo) return; 777 if (!todo) return;
776 //createEventViewer(); 778 //createEventViewer();
777 mEventViewer->setTodo(todo); 779 mEventViewer->setTodo(todo);
778 } else { 780 } else {
779 return; 781 return;
780 782
781 } 783 }
782 mEventViewer->showMe(); 784 mEventViewer->showMe();
783 mEventViewer->raise(); 785 mEventViewer->raise();
784} 786}
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 715037f..d6727ac 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -1,100 +1,101 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
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#include <qtimer.h>
24 24
25#include <korganizer/baseview.h> 25#include <korganizer/baseview.h>
26 26
27class QListView; 27class QListView;
28class QLabel; 28class QLabel;
29 29
30class KOEventViewerDialog; 30class KOEventViewerDialog;
31 31
32#include <qpainter.h> 32#include <qpainter.h>
33#include <qwidget.h> 33#include <qwidget.h>
34class WhatsNextTextBrowser : public QTextBrowser { 34class WhatsNextTextBrowser : public QTextBrowser {
35 Q_OBJECT 35 Q_OBJECT
36 public: 36 public:
37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}; 37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
38 38
39 void setSource(const QString &); 39 void setSource(const QString &);
40 void printMe(); 40 void printMe();
41 41
42 signals: 42 signals:
43 void showIncidence(const QString &uid); 43 void showIncidence(const QString &uid);
44}; 44};
45 45
46 46
47/** 47/**
48 This class provides a view of the next events and todos 48 This class provides a view of the next events and todos
49*/ 49*/
50class KOWhatsNextView : public KOrg::BaseView 50class KOWhatsNextView : public KOrg::BaseView
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 public: 53 public:
54 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, 54 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
55 const char *name = 0); 55 const char *name = 0);
56 ~KOWhatsNextView(); 56 ~KOWhatsNextView();
57 57
58 virtual int maxDatesHint(); 58 virtual int maxDatesHint();
59 virtual int currentDateCount(); 59 virtual int currentDateCount();
60 void setEventViewer(KOEventViewerDialog* v ); 60 void setEventViewer(KOEventViewerDialog* v );
61 virtual QPtrList<Incidence> selectedIncidences(); 61 virtual QPtrList<Incidence> selectedIncidences();
62 DateList selectedDates() 62 DateList selectedDates()
63 {DateList q; 63 {DateList q;
64 return q;} 64 return q;}
65 virtual void printPreview(CalPrinter *calPrinter, 65 virtual void printPreview(CalPrinter *calPrinter,
66 const QDate &, const QDate &); 66 const QDate &, const QDate &);
67 67
68 public slots: 68 public slots:
69 virtual void updateView(); 69 virtual void updateView();
70 void printMe(); 70 void printMe();
71 virtual void showDates(const QDate &start, const QDate &end); 71 virtual void showDates(const QDate &start, const QDate &end);
72 virtual void showEvents(QPtrList<Event> eventList); 72 virtual void showEvents(QPtrList<Event> eventList);
73 void updateConfig(); 73 void updateConfig();
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