summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-10 21:54:49 (UTC)
committer zautrix <zautrix>2004-10-10 21:54:49 (UTC)
commit640874bb21ea348edb33a54690ad225e0efdd1e4 (patch) (unidiff)
treea56ba08e3f091574af76bc0d37bb097eee686827
parent80ecf83fe91a61792576b5538891953cd19c4fec (diff)
downloadkdepimpi-640874bb21ea348edb33a54690ad225e0efdd1e4.zip
kdepimpi-640874bb21ea348edb33a54690ad225e0efdd1e4.tar.gz
kdepimpi-640874bb21ea348edb33a54690ad225e0efdd1e4.tar.bz2
added timer in WN view
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 9b53110..0fea9be 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -1,683 +1,683 @@
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 27
28#include <kglobal.h> 28#include <kglobal.h>
29#include <klocale.h> 29#include <klocale.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kiconloader.h> 31#include <kiconloader.h>
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35 35
36#ifndef KORG_NOPRINTER 36#ifndef KORG_NOPRINTER
37#include "calprinter.h" 37#include "calprinter.h"
38#endif 38#endif
39#include "koglobals.h" 39#include "koglobals.h"
40#include "koprefs.h" 40#include "koprefs.h"
41#include "koeventviewerdialog.h" 41#include "koeventviewerdialog.h"
42 42
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44using namespace KOrg; 44using namespace KOrg;
45 45
46void WhatsNextTextBrowser::setSource(const QString& n) 46void WhatsNextTextBrowser::setSource(const QString& n)
47{ 47{
48 48
49 if (n.startsWith("event:")) { 49 if (n.startsWith("event:")) {
50 emit showIncidence(n); 50 emit showIncidence(n);
51 return; 51 return;
52 } else if (n.startsWith("todo:")) { 52 } else if (n.startsWith("todo:")) {
53 emit showIncidence(n); 53 emit showIncidence(n);
54 return; 54 return;
55 } else { 55 } else {
56 QTextBrowser::setSource(n); 56 QTextBrowser::setSource(n);
57 } 57 }
58} 58}
59 59
60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
61 const char *name) 61 const char *name)
62 : KOrg::BaseView(calendar, parent, name) 62 : KOrg::BaseView(calendar, parent, name)
63{ 63{
64 // mDateLabel = 64 // mDateLabel =
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 ); 77 mTimer = new QTimer( this );
78 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 78 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
79 79
80 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 80 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
81 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 81 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
82} 82}
83 83
84KOWhatsNextView::~KOWhatsNextView() 84KOWhatsNextView::~KOWhatsNextView()
85{ 85{
86} 86}
87 87
88int KOWhatsNextView::maxDatesHint() 88int KOWhatsNextView::maxDatesHint()
89{ 89{
90 return 0; 90 return 0;
91} 91}
92 92
93int KOWhatsNextView::currentDateCount() 93int KOWhatsNextView::currentDateCount()
94{ 94{
95 return 0; 95 return 0;
96} 96}
97 97
98QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 98QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
99{ 99{
100 QPtrList<Incidence> eventList; 100 QPtrList<Incidence> eventList;
101 101
102 return eventList; 102 return eventList;
103} 103}
104 104
105 105
106void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 106void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
107 const QDate &td) 107 const QDate &td)
108{ 108{
109#ifndef KORG_NOPRINTER 109#ifndef KORG_NOPRINTER
110 calPrinter->preview(CalPrinter::Day, fd, td); 110 calPrinter->preview(CalPrinter::Day, fd, td);
111#endif 111#endif
112} 112}
113void KOWhatsNextView::updateConfig() 113void KOWhatsNextView::updateConfig()
114{ 114{
115 setFont( KOPrefs::instance()->mWhatsNextFont ); 115 setFont( KOPrefs::instance()->mWhatsNextFont );
116 updateView(); 116 updateView();
117 117
118} 118}
119void KOWhatsNextView::showEvent ( QShowEvent * e ) 119void KOWhatsNextView::showEvent ( QShowEvent * e )
120{ 120{
121 //qDebug("KOWhatsNextView::showEvent "); 121 //qDebug("KOWhatsNextView::showEvent ");
122 restartTimer(); 122 restartTimer();
123 QWidget::showEvent ( e ); 123 QWidget::showEvent ( e );
124} 124}
125void KOWhatsNextView::hideEvent ( QHideEvent * e) 125void KOWhatsNextView::hideEvent ( QHideEvent * e)
126{ 126{
127 //qDebug(" KOWhatsNextView::hideEvent"); 127 //qDebug(" KOWhatsNextView::hideEvent");
128 mTimer->stop(); 128 mTimer->stop();
129 QWidget::hideEvent ( e ); 129 QWidget::hideEvent ( e );
130} 130}
131void KOWhatsNextView::restartTimer() 131void KOWhatsNextView::restartTimer()
132{ 132{
133 //qDebug("KOWhatsNextView::restartTimer() "); 133 //qDebug("KOWhatsNextView::restartTimer() ");
134 mTimer->start( 180000 ); 134 mTimer->start( 300000 );
135 //mTimer->start( 5000 ); 135 //mTimer->start( 5000 );
136} 136}
137void KOWhatsNextView::updateView() 137void KOWhatsNextView::updateView()
138{ 138{
139 if ( mTimer->isActive() ) 139 if ( mTimer->isActive() )
140 restartTimer(); 140 restartTimer();
141 //qDebug("KOWhatsNextView::updateView() "); 141 //qDebug("KOWhatsNextView::updateView() ");
142 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 142 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
143 KIconLoader kil("korganizer"); 143 KIconLoader kil("korganizer");
144 QString ipath;// = new QString(); 144 QString ipath;// = new QString();
145 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 145 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
146 //<big><big><strong>" + date + "</strong></big></big>\n"; 146 //<big><big><strong>" + date + "</strong></big></big>\n";
147 mText = "<table width=\"100%\">\n"; 147 mText = "<table width=\"100%\">\n";
148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
149#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
151#else 151#else
152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
153#endif 153#endif
154 // mText += "<img src=\""; 154 // mText += "<img src=\"";
155 // mText += ipath; 155 // mText += ipath;
156 // mText += "\">"; 156 // mText += "\">";
157 mEventDate = QDate::currentDate(); 157 mEventDate = QDate::currentDate();
158#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
159 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; 159 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
160#else 160#else
161 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; 161 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
162#endif 162#endif
163 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 163 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
164 int iii; 164 int iii;
165 mTodos.clear(); 165 mTodos.clear();
166 QPtrList<Event> events; 166 QPtrList<Event> events;
167 QPtrList<Todo> todos = calendar()->todos(); 167 QPtrList<Todo> todos = calendar()->todos();
168 Todo * todo; 168 Todo * todo;
169 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 169 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
170 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 170 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
171 bool itemAdded = false; 171 bool itemAdded = false;
172 for ( iii = 0; iii < daysToShow; ++iii ) { 172 for ( iii = 0; iii < daysToShow; ++iii ) {
173 QString date; 173 QString date;
174 itemAdded = false; 174 itemAdded = false;
175 events = calendar()->events( mEventDate, true ); 175 events = calendar()->events( mEventDate, true );
176 176
177 if ( iii == 0 ) { // today !!! 177 if ( iii == 0 ) { // today !!!
178 todo = todos.first(); 178 todo = todos.first();
179 while(todo) { 179 while(todo) {
180 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 180 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
181 if ( ! itemAdded ) { 181 if ( ! itemAdded ) {
182 appendDay ( iii, mEventDate ); 182 appendDay ( iii, mEventDate );
183 itemAdded = true; 183 itemAdded = true;
184 184
185 } 185 }
186 appendEvent(todo); 186 appendEvent(todo);
187 } 187 }
188 todo = todos.next(); 188 todo = todos.next();
189 } 189 }
190 } 190 }
191 191
192 192
193 if (events.count() > 0) { 193 if (events.count() > 0) {
194 // mText += "<p></p>"; 194 // mText += "<p></p>";
195 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 195 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
196 // mText += "<h2>"; 196 // mText += "<h2>";
197 //mText += " <img src=\""; 197 //mText += " <img src=\"";
198 //mText += ipath; 198 //mText += ipath;
199 //mText += "\">"; 199 //mText += "\">";
200 if ( ! itemAdded ) { 200 if ( ! itemAdded ) {
201 appendDay ( iii, mEventDate ); 201 appendDay ( iii, mEventDate );
202 itemAdded = true; 202 itemAdded = true;
203 203
204 } 204 }
205 Event *ev = events.first(); 205 Event *ev = events.first();
206 while(ev) { 206 while(ev) {
207 //qDebug("+++++event append %s", ev->summary().latin1()); 207 //qDebug("+++++event append %s", ev->summary().latin1());
208 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { 208 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
209 appendEvent(ev, false , iii!= 0 ); 209 appendEvent(ev, false , iii!= 0 );
210 } 210 }
211 ev = events.next(); 211 ev = events.next();
212 } 212 }
213 213
214 //mText += "</table>\n"; 214 //mText += "</table>\n";
215 } 215 }
216 216
217 todo = todos.first(); 217 todo = todos.first();
218 while(todo) { 218 while(todo) {
219 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { 219 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) {
220 if ( ! itemAdded ) { 220 if ( ! itemAdded ) {
221 appendDay ( iii, mEventDate ); 221 appendDay ( iii, mEventDate );
222 itemAdded = true; 222 itemAdded = true;
223 } 223 }
224 appendEvent(todo); 224 appendEvent(todo);
225 } 225 }
226 todo = todos.next(); 226 todo = todos.next();
227 } 227 }
228 if ( !itemAdded && iii == 0 ) { 228 if ( !itemAdded && iii == 0 ) {
229 // appendDay ( iii, mEventDate ); 229 // appendDay ( iii, mEventDate );
230 //mText += "<table>"; 230 //mText += "<table>";
231 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; 231 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n";
232 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; 232 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n";
233 //mText +="</table>"; 233 //mText +="</table>";
234 } 234 }
235 if ( itemAdded ) 235 if ( itemAdded )
236 mText += "</table>\n"; 236 mText += "</table>\n";
237 mEventDate = mEventDate.addDays( 1 ); 237 mEventDate = mEventDate.addDays( 1 );
238 } 238 }
239 239
240 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 240 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
241 if (todos.count() > 0 && topmostPrios > 0 ) { 241 if (todos.count() > 0 && topmostPrios > 0 ) {
242 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 242 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
243 // mText += "<h2>"; 243 // mText += "<h2>";
244 //<img src=\""; 244 //<img src=\"";
245 // mText += ipath; 245 // mText += ipath;
246 // mText += "\">"; 246 // mText += "\">";
247 // mText += i18n("Overdue To-Do:") + "</h2>\n"; 247 // mText += i18n("Overdue To-Do:") + "</h2>\n";
248 248
249 //mText += "<ul>\n"; 249 //mText += "<ul>\n";
250 bool gotone = false; 250 bool gotone = false;
251 int priority = 1; 251 int priority = 1;
252 int priosFound = 0; 252 int priosFound = 0;
253#ifdef DESKTOP_VERSION 253#ifdef DESKTOP_VERSION
254 mText +="<p></p>"; 254 mText +="<p></p>";
255#endif 255#endif
256 256
257 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; 257 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n";
258 mText += "<ul>\n"; 258 mText += "<ul>\n";
259 while (!gotone && priority<6) { 259 while (!gotone && priority<6) {
260 todo = todos.first(); 260 todo = todos.first();
261 while(todo) { 261 while(todo) {
262 if (!todo->isCompleted() && (todo->priority() == priority) ) { 262 if (!todo->isCompleted() && (todo->priority() == priority) ) {
263 if ( appendTodo(todo) ) 263 if ( appendTodo(todo) )
264 gotone = true; 264 gotone = true;
265 } 265 }
266 todo = todos.next(); 266 todo = todos.next();
267 } 267 }
268 if ( gotone ) { 268 if ( gotone ) {
269 gotone = false; 269 gotone = false;
270 ++priosFound; 270 ++priosFound;
271 if ( priosFound == topmostPrios ) 271 if ( priosFound == topmostPrios )
272 break; 272 break;
273 } 273 }
274 priority++; 274 priority++;
275 // kdDebug() << "adding the todos..." << endl; 275 // kdDebug() << "adding the todos..." << endl;
276 } 276 }
277 mText += "</ul>\n"; 277 mText += "</ul>\n";
278 } 278 }
279 279
280 int replys = 0; 280 int replys = 0;
281 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); 281 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
282 if (events.count() > 0) { 282 if (events.count() > 0) {
283 Event *ev = events.first(); 283 Event *ev = events.first();
284 while(ev) { 284 while(ev) {
285 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 285 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
286 if (me!=0) { 286 if (me!=0) {
287 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 287 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
288 if (replys == 0) { 288 if (replys == 0) {
289 mText += "<p></p>"; 289 mText += "<p></p>";
290 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 290 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
291 //mText += "<h2>"; 291 //mText += "<h2>";
292 //<img src=\""; 292 //<img src=\"";
293 // mText += ipath; 293 // mText += ipath;
294 // mText += "\">"; 294 // mText += "\">";
295 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 295 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
296 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; 296 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
297 mText += "<table>\n"; 297 mText += "<table>\n";
298 } 298 }
299 replys++; 299 replys++;
300 appendEvent(ev,true); 300 appendEvent(ev,true);
301 } 301 }
302 } 302 }
303 ev = events.next(); 303 ev = events.next();
304 } 304 }
305 } 305 }
306 todos = calendar()->todos(); 306 todos = calendar()->todos();
307 if (todos.count() > 0) { 307 if (todos.count() > 0) {
308 Todo *to = todos.first(); 308 Todo *to = todos.first();
309 while(to) { 309 while(to) {
310 if ( !to->isCompleted() ){ 310 if ( !to->isCompleted() ){
311 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 311 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
312 if (me!=0) { 312 if (me!=0) {
313 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 313 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
314 if (replys == 0) { 314 if (replys == 0) {
315 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; 315 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
316 mText += "<table>\n"; 316 mText += "<table>\n";
317 } 317 }
318 replys++; 318 replys++;
319 appendEvent(to, true); 319 appendEvent(to, true);
320 } 320 }
321 } 321 }
322 } 322 }
323 to = todos.next(); 323 to = todos.next();
324 } 324 }
325 } 325 }
326 if (replys > 0 ) mText += "</table>\n"; 326 if (replys > 0 ) mText += "</table>\n";
327 327
328 328
329 mText += "</td></tr>\n</table>\n"; 329 mText += "</td></tr>\n</table>\n";
330 330
331 mView->setText(mText); 331 mView->setText(mText);
332 mView->setFocus(); 332 mView->setFocus();
333 333
334 // QPixmap bPix = SmallIcon( "back" ); 334 // QPixmap bPix = SmallIcon( "back" );
335 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 335 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
336 // QWidget* test = new QWidget(); 336 // QWidget* test = new QWidget();
337 // test->setBackgroundMode(FixedPixmap ); 337 // test->setBackgroundMode(FixedPixmap );
338 // test->setBackgroundPixmap ( bPix ); 338 // test->setBackgroundPixmap ( bPix );
339 // test->resize( 300, 400 ); 339 // test->resize( 300, 400 );
340 // test->show(); 340 // test->show();
341 // mView->setBackgroundMode(FixedPixmap ); 341 // mView->setBackgroundMode(FixedPixmap );
342 // mView->setBackgroundPixmap ( bPix ); 342 // mView->setBackgroundPixmap ( bPix );
343} 343}
344 344
345void KOWhatsNextView::appendDay( int i, QDate eventDate ) 345void KOWhatsNextView::appendDay( int i, QDate eventDate )
346{ 346{
347 QString date; 347 QString date;
348 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 348 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
349 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 349 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
350 if ( i == 0 ) { 350 if ( i == 0 ) {
351 mText += "<table>\n"; 351 mText += "<table>\n";
352 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 352 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
353 } 353 }
354 else if ( i == 1 ) 354 else if ( i == 1 )
355 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 355 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
356 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 356 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
357 //mText += "<h2>" + date + "</h2>\n"; 357 //mText += "<h2>" + date + "</h2>\n";
358 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 358 mText += "<big><big><strong>" + date + "</strong></big></big>\n";
359 mText += "<table>\n"; 359 mText += "<table>\n";
360 360
361 361
362 362
363 } else { 363 } else {
364 if ( i == 0 ) { 364 if ( i == 0 ) {
365 mText += "<table>\n"; 365 mText += "<table>\n";
366 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 366 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
367 } 367 }
368 368
369#ifdef DESKTOP_VERSION 369#ifdef DESKTOP_VERSION
370 else if ( i == 1 ) { 370 else if ( i == 1 ) {
371 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 371 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
372 } 372 }
373 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 373 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
374#else 374#else
375 else if ( i == 1 ) { 375 else if ( i == 1 ) {
376 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 376 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
377 } 377 }
378 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 378 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
379 379
380#endif 380#endif
381 //mText += "<h2>" + date + "</h2>\n"; 381 //mText += "<h2>" + date + "</h2>\n";
382 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 382 mText += "<big><big><strong>" + date + "</strong></big></big>\n";
383 mText += "<table>\n"; 383 mText += "<table>\n";
384 } 384 }
385} 385}
386 386
387 387
388void KOWhatsNextView::showDates(const QDate &, const QDate &) 388void KOWhatsNextView::showDates(const QDate &, const QDate &)
389{ 389{
390 updateView(); 390 updateView();
391} 391}
392 392
393void KOWhatsNextView::showEvents(QPtrList<Event>) 393void KOWhatsNextView::showEvents(QPtrList<Event>)
394{ 394{
395} 395}
396 396
397void KOWhatsNextView::changeEventDisplay(Event *, int action) 397void KOWhatsNextView::changeEventDisplay(Event *, int action)
398{ 398{
399 switch(action) { 399 switch(action) {
400 case KOGlobals::EVENTADDED: 400 case KOGlobals::EVENTADDED:
401 updateView(); 401 updateView();
402 break; 402 break;
403 case KOGlobals::EVENTEDITED: 403 case KOGlobals::EVENTEDITED:
404 updateView(); 404 updateView();
405 break; 405 break;
406 case KOGlobals::EVENTDELETED: 406 case KOGlobals::EVENTDELETED:
407 updateView(); 407 updateView();
408 break; 408 break;
409 default: 409 default:
410 updateView(); 410 updateView();
411 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 411 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
412 } 412 }
413} 413}
414 414
415void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 415void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
416{ 416{
417 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 417 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
418 return; 418 return;
419 QDateTime cdt = QDateTime::currentDateTime(); 419 QDateTime cdt = QDateTime::currentDateTime();
420 QDateTime noc; 420 QDateTime noc;
421 bool ok = true; 421 bool ok = true;
422 if ( reply ) { 422 if ( reply ) {
423 noc = ev->getNextOccurence( cdt, &ok ); 423 noc = ev->getNextOccurence( cdt, &ok );
424 if (! ok && ev->type() == "Event") 424 if (! ok && ev->type() == "Event")
425 return; 425 return;
426 } 426 }
427 mText += "<tr><td><b>"; 427 mText += "<tr><td><b>";
428 if (ev->type()=="Event") { 428 if (ev->type()=="Event") {
429 if (reply) { 429 if (reply) {
430 if (!ev->doesFloat()) 430 if (!ev->doesFloat())
431 mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 431 mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
432 else 432 else
433 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 433 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
434 434
435 } else { 435 } else {
436 if (!ev->doesFloat()) { 436 if (!ev->doesFloat()) {
437 Event *event = static_cast<Event *>(ev); 437 Event *event = static_cast<Event *>(ev);
438 QDateTime st,end; 438 QDateTime st,end;
439 if ( event->recurrence()->doesRecur() ) { 439 if ( event->recurrence()->doesRecur() ) {
440 QDate recDate= mEventDate; 440 QDate recDate= mEventDate;
441 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 441 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
442 while ( ! event->recursOn( recDate ) ) { 442 while ( ! event->recursOn( recDate ) ) {
443 recDate = recDate.addDays( -1 ); 443 recDate = recDate.addDays( -1 );
444 444
445 } 445 }
446 st = QDateTime ( recDate, event->dtStart().time() ); 446 st = QDateTime ( recDate, event->dtStart().time() );
447 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 447 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
448 } 448 }
449 else { 449 else {
450 st = event->dtStart(); 450 st = event->dtStart();
451 end = event->dtEnd(); 451 end = event->dtEnd();
452 } 452 }
453 453
454 454
455 QString dateText; 455 QString dateText;
456 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); 456 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
457 if ( st.date() < mEventDate ) 457 if ( st.date() < mEventDate )
458 dateText = "++:++-"; 458 dateText = "++:++-";
459 else 459 else
460 dateText = event->dtStartTimeStr() + "-"; 460 dateText = event->dtStartTimeStr() + "-";
461 if ( end.date() > mEventDate ) 461 if ( end.date() > mEventDate )
462 dateText += "++:++"; 462 dateText += "++:++";
463 else 463 else
464 dateText += event->dtEndTimeStr(); 464 dateText += event->dtEndTimeStr();
465 if ( notRed ) 465 if ( notRed )
466 mText += dateText; 466 mText += dateText;
467 else { 467 else {
468 if ( end < cdt ) 468 if ( end < cdt )
469 mText += "<font color=\"#F00000\">" + dateText + "</font>"; 469 mText += "<font color=\"#F00000\">" + dateText + "</font>";
470 else if ( st < cdt ) 470 else if ( st < cdt )
471 mText += "<font color=\"#008000\">" + dateText + "</font>"; 471 mText += "<font color=\"#008000\">" + dateText + "</font>";
472 else 472 else
473 mText += dateText; 473 mText += dateText;
474 474
475 } 475 }
476 476
477 } else { 477 } else {
478 mText += i18n("Allday:"); 478 mText += i18n("Allday:");
479 479
480 } 480 }
481 } 481 }
482 } else { 482 } else {
483 mTodos.append( ev ); 483 mTodos.append( ev );
484 mText += i18n("ToDo:"); 484 mText += i18n("ToDo:");
485 if (reply) { 485 if (reply) {
486 mText += " "; 486 mText += " ";
487 if ( noc != cdt ) { 487 if ( noc != cdt ) {
488 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 488 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
489 } 489 }
490 } else { 490 } else {
491 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 491 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
492 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 492 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
493 QString dfs = KGlobal::locale()->dateFormatShort(); 493 QString dfs = KGlobal::locale()->dateFormatShort();
494 KGlobal::locale()->setDateFormatShort("%d.%b"); 494 KGlobal::locale()->setDateFormatShort("%d.%b");
495 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 495 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
496 KGlobal::locale()->setDateFormatShort(dfs); 496 KGlobal::locale()->setDateFormatShort(dfs);
497 } else { 497 } else {
498 if (!ev->doesFloat() ) 498 if (!ev->doesFloat() )
499 if( ( (Todo*)ev)->dtDue() < cdt ) { 499 if( ( (Todo*)ev)->dtDue() < cdt ) {
500 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 500 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
501 501
502 502
503 } else 503 } else
504 mText +=((Todo*)ev)->dtDueTimeStr(); 504 mText +=((Todo*)ev)->dtDueTimeStr();
505 mTodos.append( ev ); 505 mTodos.append( ev );
506 } 506 }
507 } 507 }
508 } 508 }
509 mText += "</b></td><td>"; 509 mText += "</b></td><td>";
510 bool needClose = false; 510 bool needClose = false;
511 if ( ev->cancelled() ) { 511 if ( ev->cancelled() ) {
512 mText += "<font color=\"#F00000\">[c"; 512 mText += "<font color=\"#F00000\">[c";
513 needClose =true; 513 needClose =true;
514 514
515 } 515 }
516 if ( ev->isAlarmEnabled() ) { 516 if ( ev->isAlarmEnabled() ) {
517 if ( !needClose) 517 if ( !needClose)
518 mText +="["; 518 mText +="[";
519 mText += "a"; 519 mText += "a";
520 needClose =true; 520 needClose =true;
521 521
522 } 522 }
523 if ( ev->description().length() > 0 ) { 523 if ( ev->description().length() > 0 ) {
524 if ( !needClose) 524 if ( !needClose)
525 mText +="["; 525 mText +="[";
526 mText += "i"; 526 mText += "i";
527 needClose =true; 527 needClose =true;
528 } 528 }
529 if ( ev->recurrence()->doesRecur() ) { 529 if ( ev->recurrence()->doesRecur() ) {
530 if ( !needClose) 530 if ( !needClose)
531 mText +="["; 531 mText +="[";
532 mText += "r"; 532 mText += "r";
533 needClose =true; 533 needClose =true;
534 } 534 }
535 if ( needClose ) { 535 if ( needClose ) {
536 mText += "] "; 536 mText += "] ";
537 } 537 }
538 if ( ev->cancelled() ) 538 if ( ev->cancelled() )
539 mText += "</font>"; 539 mText += "</font>";
540 mText += "<a "; 540 mText += "<a ";
541 if (ev->type()=="Event") mText += "href=\"event:"; 541 if (ev->type()=="Event") mText += "href=\"event:";
542 if (ev->type()=="Todo") mText += "href=\"todo:"; 542 if (ev->type()=="Todo") mText += "href=\"todo:";
543 mText += ev->uid() + "\">"; 543 mText += ev->uid() + "\">";
544 if ( ev->summary().length() > 0 ) 544 if ( ev->summary().length() > 0 )
545 mText += ev->summary(); 545 mText += ev->summary();
546 else 546 else
547 mText += i18n("-no summary-"); 547 mText += i18n("-no summary-");
548 mText += "</a>"; 548 mText += "</a>";
549 if ( KOPrefs::instance()->mWNViewShowLocation ) 549 if ( KOPrefs::instance()->mWNViewShowLocation )
550 if ( !ev->location().isEmpty() ) 550 if ( !ev->location().isEmpty() )
551 mText += " ("+ev->location() +")"; 551 mText += " ("+ev->location() +")";
552 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 552 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
553 mText += " ["+ev->relatedTo()->summary() +"]"; 553 mText += " ["+ev->relatedTo()->summary() +"]";
554 mText += "</td></tr>\n"; 554 mText += "</td></tr>\n";
555} 555}
556 556
557bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 557bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
558{ 558{
559 if ( mTodos.find( ev ) != mTodos.end() ) return false; 559 if ( mTodos.find( ev ) != mTodos.end() ) return false;
560 560
561 mTodos.append( ev ); 561 mTodos.append( ev );
562 if ( !isSub ) 562 if ( !isSub )
563 mText += "<p>"; 563 mText += "<p>";
564 else 564 else
565 mText += "<li>"; 565 mText += "<li>";
566 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 566 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
567 567
568 568
569 mText += ind; 569 mText += ind;
570 bool needClose = false; 570 bool needClose = false;
571 if ( ev->cancelled() ) { 571 if ( ev->cancelled() ) {
572 mText += "<font color=\"#F00000\">[c"; 572 mText += "<font color=\"#F00000\">[c";
573 needClose =true; 573 needClose =true;
574 574
575 } 575 }
576 if ( ev->isAlarmEnabled() ) { 576 if ( ev->isAlarmEnabled() ) {
577 if ( !needClose) 577 if ( !needClose)
578 mText +="["; 578 mText +="[";
579 mText += "a"; 579 mText += "a";
580 needClose =true; 580 needClose =true;
581 581
582 } 582 }
583 583
584 if ( ev->description().length() > 0 ) { 584 if ( ev->description().length() > 0 ) {
585 if ( !needClose) 585 if ( !needClose)
586 mText +="["; 586 mText +="[";
587 mText += "i"; 587 mText += "i";
588 needClose =true; 588 needClose =true;
589 } 589 }
590 // if ( ev->recurrence()->doesRecur() ) { 590 // if ( ev->recurrence()->doesRecur() ) {
591 // if ( !needClose) 591 // if ( !needClose)
592 // mText +="("; 592 // mText +="(";
593 // mText += "r"; 593 // mText += "r";
594 // needClose =true; 594 // needClose =true;
595 // } 595 // }
596 if ( needClose ) 596 if ( needClose )
597 mText += "] "; 597 mText += "] ";
598 if ( ev->cancelled() ) 598 if ( ev->cancelled() )
599 mText += "</font>"; 599 mText += "</font>";
600 mText += "<a href=\"todo:" + ev->uid() + "\">"; 600 mText += "<a href=\"todo:" + ev->uid() + "\">";
601 mText += ev->summary(); 601 mText += ev->summary();
602 mText += "</a>"; 602 mText += "</a>";
603 if ( ((Todo*)ev)->hasDueDate () ) { 603 if ( ((Todo*)ev)->hasDueDate () ) {
604 QString year = ""; 604 QString year = "";
605 int ye = ((Todo*)ev)->dtDue().date().year(); 605 int ye = ((Todo*)ev)->dtDue().date().year();
606 if ( QDateTime::currentDateTime().date().year() != ye ) 606 if ( QDateTime::currentDateTime().date().year() != ye )
607 year = QString::number( ye ); 607 year = QString::number( ye );
608 QString dfs = KGlobal::locale()->dateFormatShort(); 608 QString dfs = KGlobal::locale()->dateFormatShort();
609 KGlobal::locale()->setDateFormatShort("%d.%b"); 609 KGlobal::locale()->setDateFormatShort("%d.%b");
610 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 610 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
611 KGlobal::locale()->setDateFormatShort(dfs); 611 KGlobal::locale()->setDateFormatShort(dfs);
612 } 612 }
613 if ( KOPrefs::instance()->mWNViewShowLocation ) 613 if ( KOPrefs::instance()->mWNViewShowLocation )
614 if ( !ev->location().isEmpty() ) 614 if ( !ev->location().isEmpty() )
615 mText += " ("+ev->location() +")"; 615 mText += " ("+ev->location() +")";
616 if ( !isSub ) { 616 if ( !isSub ) {
617 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 617 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
618 mText += " ["+ev->relatedTo()->summary() +"]"; 618 mText += " ["+ev->relatedTo()->summary() +"]";
619 mText += "</p>\n"; 619 mText += "</p>\n";
620 } 620 }
621 else { 621 else {
622 ind += "-"; 622 ind += "-";
623 mText += "</li>\n"; 623 mText += "</li>\n";
624 } 624 }
625 QPtrList<Incidence> Relations = ev->relations(); 625 QPtrList<Incidence> Relations = ev->relations();
626 Incidence *to; 626 Incidence *to;
627 for (to=Relations.first();to;to=Relations.next()) { 627 for (to=Relations.first();to;to=Relations.next()) {
628 if (!((Todo*)to)->isCompleted()) 628 if (!((Todo*)to)->isCompleted())
629 appendTodo( to, ind , true ); 629 appendTodo( to, ind , true );
630 } 630 }
631 631
632 return true; 632 return true;
633} 633}
634 634
635/* 635/*
636 void KOWhatsNextView::createEventViewer() 636 void KOWhatsNextView::createEventViewer()
637 { 637 {
638 if (!mEventViewer) { 638 if (!mEventViewer) {
639 639
640 mEventViewer = new KOEventViewerDialog(this); 640 mEventViewer = new KOEventViewerDialog(this);
641 } 641 }
642 } 642 }
643*/ 643*/
644void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 644void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
645{ 645{
646 mEventViewer = v; 646 mEventViewer = v;
647} 647}
648 648
649// TODO: Create this function in CalendarView and remove it from here 649// TODO: Create this function in CalendarView and remove it from here
650void KOWhatsNextView::showIncidence(const QString &uid) 650void KOWhatsNextView::showIncidence(const QString &uid)
651{ 651{
652 if ( !mEventViewer ) { 652 if ( !mEventViewer ) {
653 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); 653 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
654 return; 654 return;
655 } 655 }
656 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; 656 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
657 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); 657 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
658 if (uid.startsWith("event:")) { 658 if (uid.startsWith("event:")) {
659#ifdef DESKTOP_VERSION 659#ifdef DESKTOP_VERSION
660 Event *event = calendar()->event(uid.mid(8)); 660 Event *event = calendar()->event(uid.mid(8));
661#else 661#else
662 Event *event = calendar()->event(uid.mid(6)); 662 Event *event = calendar()->event(uid.mid(6));
663#endif 663#endif
664 //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); 664 //qDebug("event %d uid %s ", event, uid.mid(6).latin1());
665 if (!event) return; 665 if (!event) return;
666 //createEventViewer(); 666 //createEventViewer();
667 mEventViewer->setEvent(event); 667 mEventViewer->setEvent(event);
668 } else if (uid.startsWith("todo:")) { 668 } else if (uid.startsWith("todo:")) {
669#ifdef DESKTOP_VERSION 669#ifdef DESKTOP_VERSION
670 Todo *todo = calendar()->todo(uid.mid(7)); 670 Todo *todo = calendar()->todo(uid.mid(7));
671#else 671#else
672 Todo *todo = calendar()->todo(uid.mid(5)); 672 Todo *todo = calendar()->todo(uid.mid(5));
673#endif 673#endif
674 if (!todo) return; 674 if (!todo) return;
675 //createEventViewer(); 675 //createEventViewer();
676 mEventViewer->setTodo(todo); 676 mEventViewer->setTodo(todo);
677 } else { 677 } else {
678 return; 678 return;
679 679
680 } 680 }
681 mEventViewer->showMe(); 681 mEventViewer->showMe();
682 mEventViewer->raise(); 682 mEventViewer->raise();
683} 683}