summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp10
-rw-r--r--korganizer/kowhatsnextview.cpp19
2 files changed, 23 insertions, 6 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 3aae076..749204b 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -329,98 +329,104 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
329 } 329 }
330 330
331 QBoxLayout *topLayout = new QVBoxLayout(this); 331 QBoxLayout *topLayout = new QVBoxLayout(this);
332 332
333 // Create day name labels for agenda columns 333 // Create day name labels for agenda columns
334 mDayLabelsFrame = new QHBox(this); 334 mDayLabelsFrame = new QHBox(this);
335 topLayout->addWidget(mDayLabelsFrame); 335 topLayout->addWidget(mDayLabelsFrame);
336 mDayLabels = new QFrame (mDayLabelsFrame); 336 mDayLabels = new QFrame (mDayLabelsFrame);
337 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 337 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
338 // Create agenda splitter 338 // Create agenda splitter
339#ifndef KORG_NOSPLITTER 339#ifndef KORG_NOSPLITTER
340 mSplitterAgenda = new QSplitter(Vertical,this); 340 mSplitterAgenda = new QSplitter(Vertical,this);
341 topLayout->addWidget(mSplitterAgenda); 341 topLayout->addWidget(mSplitterAgenda);
342 mSplitterAgenda->setOpaqueResize(); 342 mSplitterAgenda->setOpaqueResize();
343 343
344 mAllDayFrame = new QHBox(mSplitterAgenda); 344 mAllDayFrame = new QHBox(mSplitterAgenda);
345 345
346 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 346 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
347#else 347#else
348#if 0 348#if 0
349 QWidget *mainBox = new QWidget( this ); 349 QWidget *mainBox = new QWidget( this );
350 topLayout->addWidget( mainBox ); 350 topLayout->addWidget( mainBox );
351 QBoxLayout *mainLayout = new QVBoxLayout(mainBox); 351 QBoxLayout *mainLayout = new QVBoxLayout(mainBox);
352 mAllDayFrame = new QHBox(mainBox); 352 mAllDayFrame = new QHBox(mainBox);
353 mainLayout->addWidget(mAllDayFrame); 353 mainLayout->addWidget(mAllDayFrame);
354 mainLayout->setStretchFactor( mAllDayFrame, 0 ); 354 mainLayout->setStretchFactor( mAllDayFrame, 0 );
355 mAllDayFrame->setFocusPolicy(NoFocus); 355 mAllDayFrame->setFocusPolicy(NoFocus);
356 QWidget *agendaFrame = new QWidget(mainBox); 356 QWidget *agendaFrame = new QWidget(mainBox);
357 mainLayout->addWidget(agendaFrame); 357 mainLayout->addWidget(agendaFrame);
358 mainLayout->setStretchFactor( agendaFrame, 10 ); 358 mainLayout->setStretchFactor( agendaFrame, 10 );
359 359
360 agendaFrame->setFocusPolicy(NoFocus); 360 agendaFrame->setFocusPolicy(NoFocus);
361#endif 361#endif
362 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 362 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
363 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 363 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
364 topLayout->addWidget( mSplitterAgenda ); 364 topLayout->addWidget( mSplitterAgenda );
365 mAllDayFrame = new QHBox(mSplitterAgenda); 365 mAllDayFrame = new QHBox(mSplitterAgenda);
366 mAllDayFrame->setFocusPolicy(NoFocus); 366 mAllDayFrame->setFocusPolicy(NoFocus);
367 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 367 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
368 agendaFrame->setFocusPolicy(NoFocus); 368 agendaFrame->setFocusPolicy(NoFocus);
369 369
370#endif 370#endif
371 371
372 // Create all-day agenda widget 372 // Create all-day agenda widget
373 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 373 mDummyAllDayLeft = new QVBox( mAllDayFrame );
374 374
375 mExpandButton = new QPushButton(mDummyAllDayLeft); 375 mExpandButton = new QPushButton(mDummyAllDayLeft);
376 mExpandButton->setPixmap( mNotExpandedPixmap ); 376 mExpandButton->setPixmap( mNotExpandedPixmap );
377 mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 377 int widebut = mExpandButton->sizeHint().width();
378 QSizePolicy::Fixed ) ); 378 if ( QApplication::desktop()->width() < 480 )
379 widebut = widebut*2;
380 else
381 widebut = (widebut*3) / 2;
382 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
383 // QSizePolicy::Fixed ) );
384 mExpandButton->setFixedSize( widebut, widebut);
379 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 385 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
380 mExpandButton->setFocusPolicy(NoFocus); 386 mExpandButton->setFocusPolicy(NoFocus);
381 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 387 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
382 mAllDayAgenda->setFocusPolicy(NoFocus); 388 mAllDayAgenda->setFocusPolicy(NoFocus);
383 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); 389 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame);
384 390
385 // Create event context menu for all day agenda 391 // Create event context menu for all day agenda
386 mAllDayAgendaPopup = eventPopup(); 392 mAllDayAgendaPopup = eventPopup();
387 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 393 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
388 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 394 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
389 395
390 // Create agenda frame 396 // Create agenda frame
391 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 397 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
392 // QHBox *agendaFrame = new QHBox(splitterAgenda); 398 // QHBox *agendaFrame = new QHBox(splitterAgenda);
393 399
394 // create event indicator bars 400 // create event indicator bars
395 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 401 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
396 agendaLayout->addWidget(mEventIndicatorTop,0,1); 402 agendaLayout->addWidget(mEventIndicatorTop,0,1);
397 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 403 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
398 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 404 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
399 agendaFrame); 405 agendaFrame);
400 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 406 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
401 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 407 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
402 agendaLayout->addWidget(dummyAgendaRight,0,2); 408 agendaLayout->addWidget(dummyAgendaRight,0,2);
403 409
404 // Create time labels 410 // Create time labels
405 mTimeLabels = new TimeLabels(24,agendaFrame); 411 mTimeLabels = new TimeLabels(24,agendaFrame);
406 agendaLayout->addWidget(mTimeLabels,1,0); 412 agendaLayout->addWidget(mTimeLabels,1,0);
407 413
408 // Create agenda 414 // Create agenda
409 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 415 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
410 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); 416 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2);
411 agendaLayout->setColStretch(1,1); 417 agendaLayout->setColStretch(1,1);
412 mAgenda->setFocusPolicy(NoFocus); 418 mAgenda->setFocusPolicy(NoFocus);
413 // Create event context menu for agenda 419 // Create event context menu for agenda
414 mAgendaPopup = eventPopup(); 420 mAgendaPopup = eventPopup();
415 421
416 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 422 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
417 i18n("Toggle Alarm"),mAgenda, 423 i18n("Toggle Alarm"),mAgenda,
418 SLOT(popupAlarm()),true); 424 SLOT(popupAlarm()),true);
419 425
420 426
421 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 427 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
422 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 428 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
423 429
424 // make connections between dependent widgets 430 // make connections between dependent widgets
425 mTimeLabels->setAgenda(mAgenda); 431 mTimeLabels->setAgenda(mAgenda);
426 432
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0fea9be..59b864c 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -1,195 +1,205 @@
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#include <qstylesheet.h>
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 QStyleSheet* stsh = mView->styleSheet();
72 QStyleSheetItem * style ;
73
74 style = stsh->item ("h2" );
75 if ( style ) {
76 style->setMargin(QStyleSheetItem::MarginAll,0);
77 }
78 style = stsh->item ("table" );
79 if ( style ) {
80 style->setMargin(QStyleSheetItem::MarginAll,0);
81 }
72 mEventViewer = 0; 82 mEventViewer = 0;
73 83
74 QBoxLayout *topLayout = new QVBoxLayout(this); 84 QBoxLayout *topLayout = new QVBoxLayout(this);
75 // topLayout->addWidget(mDateLabel); 85 // topLayout->addWidget(mDateLabel);
76 topLayout->addWidget(mView); 86 topLayout->addWidget(mView);
77 mTimer = new QTimer( this ); 87 mTimer = new QTimer( this );
78 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 88 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
79 89
80 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 90 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
81 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 91 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
82} 92}
83 93
84KOWhatsNextView::~KOWhatsNextView() 94KOWhatsNextView::~KOWhatsNextView()
85{ 95{
86} 96}
87 97
88int KOWhatsNextView::maxDatesHint() 98int KOWhatsNextView::maxDatesHint()
89{ 99{
90 return 0; 100 return 0;
91} 101}
92 102
93int KOWhatsNextView::currentDateCount() 103int KOWhatsNextView::currentDateCount()
94{ 104{
95 return 0; 105 return 0;
96} 106}
97 107
98QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 108QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
99{ 109{
100 QPtrList<Incidence> eventList; 110 QPtrList<Incidence> eventList;
101 111
102 return eventList; 112 return eventList;
103} 113}
104 114
105 115
106void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 116void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
107 const QDate &td) 117 const QDate &td)
108{ 118{
109#ifndef KORG_NOPRINTER 119#ifndef KORG_NOPRINTER
110 calPrinter->preview(CalPrinter::Day, fd, td); 120 calPrinter->preview(CalPrinter::Day, fd, td);
111#endif 121#endif
112} 122}
113void KOWhatsNextView::updateConfig() 123void KOWhatsNextView::updateConfig()
114{ 124{
115 setFont( KOPrefs::instance()->mWhatsNextFont ); 125 setFont( KOPrefs::instance()->mWhatsNextFont );
116 updateView(); 126 updateView();
117 127
118} 128}
119void KOWhatsNextView::showEvent ( QShowEvent * e ) 129void KOWhatsNextView::showEvent ( QShowEvent * e )
120{ 130{
121 //qDebug("KOWhatsNextView::showEvent "); 131 //qDebug("KOWhatsNextView::showEvent ");
122 restartTimer(); 132 restartTimer();
123 QWidget::showEvent ( e ); 133 QWidget::showEvent ( e );
124} 134}
125void KOWhatsNextView::hideEvent ( QHideEvent * e) 135void KOWhatsNextView::hideEvent ( QHideEvent * e)
126{ 136{
127 //qDebug(" KOWhatsNextView::hideEvent"); 137 //qDebug(" KOWhatsNextView::hideEvent");
128 mTimer->stop(); 138 mTimer->stop();
129 QWidget::hideEvent ( e ); 139 QWidget::hideEvent ( e );
130} 140}
131void KOWhatsNextView::restartTimer() 141void KOWhatsNextView::restartTimer()
132{ 142{
133 //qDebug("KOWhatsNextView::restartTimer() "); 143 //qDebug("KOWhatsNextView::restartTimer() ");
134 mTimer->start( 300000 ); 144 mTimer->start( 300000 );
135 //mTimer->start( 5000 ); 145 //mTimer->start( 5000 );
136} 146}
137void KOWhatsNextView::updateView() 147void KOWhatsNextView::updateView()
138{ 148{
139 if ( mTimer->isActive() ) 149 if ( mTimer->isActive() )
140 restartTimer(); 150 restartTimer();
141 //qDebug("KOWhatsNextView::updateView() "); 151 //qDebug("KOWhatsNextView::updateView() ");
142 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 152 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
143 KIconLoader kil("korganizer"); 153 KIconLoader kil("korganizer");
144 QString ipath;// = new QString(); 154 QString ipath;// = new QString();
145 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 155 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
146 //<big><big><strong>" + date + "</strong></big></big>\n"; 156 //<big><big><strong>" + date + "</strong></big></big>\n";
147 mText = "<table width=\"100%\">\n"; 157 mText = "<qt><table width=\"100%\">\n";
148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 158 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
149#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 160 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
151#else 161#else
152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 162 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
153#endif 163#endif
154 // mText += "<img src=\""; 164 // mText += "<img src=\"";
155 // mText += ipath; 165 // mText += ipath;
156 // mText += "\">"; 166 // mText += "\">";
157 mEventDate = QDate::currentDate(); 167 mEventDate = QDate::currentDate();
158#ifdef DESKTOP_VERSION 168#ifdef DESKTOP_VERSION
159 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; 169 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
160#else 170#else
161 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; 171 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
162#endif 172#endif
163 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 173 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
164 int iii; 174 int iii;
165 mTodos.clear(); 175 mTodos.clear();
166 QPtrList<Event> events; 176 QPtrList<Event> events;
167 QPtrList<Todo> todos = calendar()->todos(); 177 QPtrList<Todo> todos = calendar()->todos();
168 Todo * todo; 178 Todo * todo;
169 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 179 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
170 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 180 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
171 bool itemAdded = false; 181 bool itemAdded = false;
172 for ( iii = 0; iii < daysToShow; ++iii ) { 182 for ( iii = 0; iii < daysToShow; ++iii ) {
173 QString date; 183 QString date;
174 itemAdded = false; 184 itemAdded = false;
175 events = calendar()->events( mEventDate, true ); 185 events = calendar()->events( mEventDate, true );
176 186
177 if ( iii == 0 ) { // today !!! 187 if ( iii == 0 ) { // today !!!
178 todo = todos.first(); 188 todo = todos.first();
179 while(todo) { 189 while(todo) {
180 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 190 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
181 if ( ! itemAdded ) { 191 if ( ! itemAdded ) {
182 appendDay ( iii, mEventDate ); 192 appendDay ( iii, mEventDate );
183 itemAdded = true; 193 itemAdded = true;
184 194
185 } 195 }
186 appendEvent(todo); 196 appendEvent(todo);
187 } 197 }
188 todo = todos.next(); 198 todo = todos.next();
189 } 199 }
190 } 200 }
191 201
192 202
193 if (events.count() > 0) { 203 if (events.count() > 0) {
194 // mText += "<p></p>"; 204 // mText += "<p></p>";
195 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 205 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
@@ -281,110 +291,111 @@ void KOWhatsNextView::updateView()
281 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); 291 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
282 if (events.count() > 0) { 292 if (events.count() > 0) {
283 Event *ev = events.first(); 293 Event *ev = events.first();
284 while(ev) { 294 while(ev) {
285 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 295 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
286 if (me!=0) { 296 if (me!=0) {
287 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 297 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
288 if (replys == 0) { 298 if (replys == 0) {
289 mText += "<p></p>"; 299 mText += "<p></p>";
290 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 300 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
291 //mText += "<h2>"; 301 //mText += "<h2>";
292 //<img src=\""; 302 //<img src=\"";
293 // mText += ipath; 303 // mText += ipath;
294 // mText += "\">"; 304 // mText += "\">";
295 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 305 //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"; 306 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"; 307 mText += "<table>\n";
298 } 308 }
299 replys++; 309 replys++;
300 appendEvent(ev,true); 310 appendEvent(ev,true);
301 } 311 }
302 } 312 }
303 ev = events.next(); 313 ev = events.next();
304 } 314 }
305 } 315 }
306 todos = calendar()->todos(); 316 todos = calendar()->todos();
307 if (todos.count() > 0) { 317 if (todos.count() > 0) {
308 Todo *to = todos.first(); 318 Todo *to = todos.first();
309 while(to) { 319 while(to) {
310 if ( !to->isCompleted() ){ 320 if ( !to->isCompleted() ){
311 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 321 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
312 if (me!=0) { 322 if (me!=0) {
313 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 323 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
314 if (replys == 0) { 324 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"; 325 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"; 326 mText += "<table>\n";
317 } 327 }
318 replys++; 328 replys++;
319 appendEvent(to, true); 329 appendEvent(to, true);
320 } 330 }
321 } 331 }
322 } 332 }
323 to = todos.next(); 333 to = todos.next();
324 } 334 }
325 } 335 }
326 if (replys > 0 ) mText += "</table>\n"; 336 if (replys > 0 ) mText += "</table>\n";
327 337
328 338
329 mText += "</td></tr>\n</table>\n"; 339 mText += "</td></tr>\n</table></qt>\n";
330 340
331 mView->setText(mText); 341 mView->setText(mText);
332 mView->setFocus(); 342 mView->setFocus();
333 343
334 // QPixmap bPix = SmallIcon( "back" ); 344 // QPixmap bPix = SmallIcon( "back" );
335 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 345 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
336 // QWidget* test = new QWidget(); 346 // QWidget* test = new QWidget();
337 // test->setBackgroundMode(FixedPixmap ); 347 // test->setBackgroundMode(FixedPixmap );
338 // test->setBackgroundPixmap ( bPix ); 348 // test->setBackgroundPixmap ( bPix );
339 // test->resize( 300, 400 ); 349 // test->resize( 300, 400 );
340 // test->show(); 350 // test->show();
341 // mView->setBackgroundMode(FixedPixmap ); 351 // mView->setBackgroundMode(FixedPixmap );
342 // mView->setBackgroundPixmap ( bPix ); 352 // mView->setBackgroundPixmap ( bPix );
353 qDebug("%s ",mText.latin1());
343} 354}
344 355
345void KOWhatsNextView::appendDay( int i, QDate eventDate ) 356void KOWhatsNextView::appendDay( int i, QDate eventDate )
346{ 357{
347 QString date; 358 QString date;
348 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 359 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
349 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 360 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
350 if ( i == 0 ) { 361 if ( i == 0 ) {
351 mText += "<table>\n"; 362 mText += "<table>\n";
352 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 363 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
353 } 364 }
354 else if ( i == 1 ) 365 else if ( i == 1 )
355 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 366 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
356 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 367 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
357 //mText += "<h2>" + date + "</h2>\n"; 368 //mText += "<h2>" + date + "</h2>\n";
358 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 369 mText += "<big><big><strong>" + date + "</strong></big></big>\n";
359 mText += "<table>\n"; 370 mText += "<table>\n";
360 371
361 372
362 373
363 } else { 374 } else {
364 if ( i == 0 ) { 375 if ( i == 0 ) {
365 mText += "<table>\n"; 376 mText += "<table>\n";
366 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 377 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
367 } 378 }
368 379
369#ifdef DESKTOP_VERSION 380#ifdef DESKTOP_VERSION
370 else if ( i == 1 ) { 381 else if ( i == 1 ) {
371 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 382 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
372 } 383 }
373 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 384 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
374#else 385#else
375 else if ( i == 1 ) { 386 else if ( i == 1 ) {
376 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 387 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
377 } 388 }
378 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 389 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
379 390
380#endif 391#endif
381 //mText += "<h2>" + date + "</h2>\n"; 392 //mText += "<h2>" + date + "</h2>\n";
382 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 393 mText += "<big><big><strong>" + date + "</strong></big></big>\n";
383 mText += "<table>\n"; 394 mText += "<table>\n";
384 } 395 }
385} 396}
386 397
387 398
388void KOWhatsNextView::showDates(const QDate &, const QDate &) 399void KOWhatsNextView::showDates(const QDate &, const QDate &)
389{ 400{
390 updateView(); 401 updateView();