summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp29
-rw-r--r--korganizer/kowhatsnextview.h9
3 files changed, 34 insertions, 6 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ba77b45..8e6cc53 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -195,97 +195,97 @@ void KOViewManager::raiseCurrentView( bool fullScreen )
195 qApp->processEvents(); 195 qApp->processEvents();
196 //qDebug("qApp->processEvents() "); 196 //qDebug("qApp->processEvents() ");
197 globalFlagBlockAgenda = 0; 197 globalFlagBlockAgenda = 0;
198 mAgendaView->repaintAgenda(); 198 mAgendaView->repaintAgenda();
199 199
200 } 200 }
201 globalFlagBlockAgenda = 0; 201 globalFlagBlockAgenda = 0;
202 } 202 }
203 //qDebug("raiseCurrentView ende "); 203 //qDebug("raiseCurrentView ende ");
204} 204}
205 205
206void KOViewManager::updateView() 206void KOViewManager::updateView()
207{ 207{
208 // qDebug("KOViewManager::updateView() "); 208 // qDebug("KOViewManager::updateView() ");
209 // if we are updating mTodoView, we get endless recursion 209 // if we are updating mTodoView, we get endless recursion
210 if ( mTodoView == mCurrentView ) 210 if ( mTodoView == mCurrentView )
211 return; 211 return;
212 if ( mCurrentView ) mCurrentView->updateView(); 212 if ( mCurrentView ) mCurrentView->updateView();
213 213
214} 214}
215 215
216void KOViewManager::updateView(const QDate &start, const QDate &end) 216void KOViewManager::updateView(const QDate &start, const QDate &end)
217{ 217{
218 // kdDebug() << "KOViewManager::updateView()" << endl; 218 // kdDebug() << "KOViewManager::updateView()" << endl;
219 219
220 if (mCurrentView) mCurrentView->showDates(start, end); 220 if (mCurrentView) mCurrentView->showDates(start, end);
221 221
222 if (mTodoView) mTodoView->updateView(); 222 if (mTodoView) mTodoView->updateView();
223} 223}
224 224
225 225
226void KOViewManager::updateWNview() 226void KOViewManager::updateWNview()
227{ 227{
228 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 228 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
229 mWhatsNextView->updateView(); 229 mWhatsNextView->updateView();
230 230
231} 231}
232void KOViewManager::showWhatsNextView() 232void KOViewManager::showWhatsNextView()
233{ 233{
234 if (!mWhatsNextView) { 234 if (!mWhatsNextView) {
235 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 235 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
236 "KOViewManager::WhatsNextView"); 236 "KOViewManager::WhatsNextView");
237 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 237 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
238 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 238 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
239 addView(mWhatsNextView); 239 addView(mWhatsNextView);
240 } 240 }
241 globalFlagBlockAgenda = 1; 241 globalFlagBlockAgenda = 1;
242 showView(mWhatsNextView, true ); 242 showView(mWhatsNextView, true );
243 mWhatsNextView->updateView(); 243 //mWhatsNextView->updateView();
244 244
245} 245}
246 246
247void KOViewManager::showListView() 247void KOViewManager::showListView()
248{ 248{
249 if (!mListView) { 249 if (!mListView) {
250 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 250 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
251 addView(mListView); 251 addView(mListView);
252 252
253 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 253 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
254 mMainView, SLOT(showIncidence(Incidence *))); 254 mMainView, SLOT(showIncidence(Incidence *)));
255 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 255 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
256 mMainView, SLOT(editIncidence(Incidence *))); 256 mMainView, SLOT(editIncidence(Incidence *)));
257 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 257 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
258 mMainView, SLOT(deleteIncidence(Incidence *))); 258 mMainView, SLOT(deleteIncidence(Incidence *)));
259 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 259 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
260 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 260 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
261 connect( mListView, SIGNAL( signalNewEvent() ), 261 connect( mListView, SIGNAL( signalNewEvent() ),
262 mMainView, SLOT( newEvent() ) ); 262 mMainView, SLOT( newEvent() ) );
263 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 263 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
264 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 264 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
265 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 265 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
266 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 266 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
267 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 267 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
268 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 268 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
269 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 269 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
270 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 270 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
271 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 271 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
272 } 272 }
273 // bool temp = mFlagShowNextxDays; 273 // bool temp = mFlagShowNextxDays;
274 //globalFlagBlockPainting = true; 274 //globalFlagBlockPainting = true;
275 globalFlagBlockAgenda = 1; 275 globalFlagBlockAgenda = 1;
276 if ( KOPrefs::instance()->mListViewMonthTimespan ) 276 if ( KOPrefs::instance()->mListViewMonthTimespan )
277 mMainView->dateNavigator()->selectMonth(); 277 mMainView->dateNavigator()->selectMonth();
278 showView(mListView, KOPrefs::instance()->mFullViewTodo); 278 showView(mListView, KOPrefs::instance()->mFullViewTodo);
279 //mFlagShowNextxDays = temp; 279 //mFlagShowNextxDays = temp;
280} 280}
281 281
282void KOViewManager::showAgendaView( bool fullScreen ) 282void KOViewManager::showAgendaView( bool fullScreen )
283{ 283{
284 284
285 mMainView->dialogManager()->hideSearchDialog(); 285 mMainView->dialogManager()->hideSearchDialog();
286 // qDebug("KOViewManager::showAgendaView "); 286 // qDebug("KOViewManager::showAgendaView ");
287 bool full; 287 bool full;
288 full = fullScreen; 288 full = fullScreen;
289 if (!mAgendaView) { 289 if (!mAgendaView) {
290 full = false; 290 full = false;
291 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 291 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 2a8a7c1..9b53110 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -29,136 +29,161 @@
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 );
78 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
79
80 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
81 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
77} 82}
78 83
79KOWhatsNextView::~KOWhatsNextView() 84KOWhatsNextView::~KOWhatsNextView()
80{ 85{
81} 86}
82 87
83int KOWhatsNextView::maxDatesHint() 88int KOWhatsNextView::maxDatesHint()
84{ 89{
85 return 0; 90 return 0;
86} 91}
87 92
88int KOWhatsNextView::currentDateCount() 93int KOWhatsNextView::currentDateCount()
89{ 94{
90 return 0; 95 return 0;
91} 96}
92 97
93QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 98QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
94{ 99{
95 QPtrList<Incidence> eventList; 100 QPtrList<Incidence> eventList;
96 101
97 return eventList; 102 return eventList;
98} 103}
99 104
100 105
101void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 106void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
102 const QDate &td) 107 const QDate &td)
103{ 108{
104#ifndef KORG_NOPRINTER 109#ifndef KORG_NOPRINTER
105 calPrinter->preview(CalPrinter::Day, fd, td); 110 calPrinter->preview(CalPrinter::Day, fd, td);
106#endif 111#endif
107} 112}
108void KOWhatsNextView::updateConfig() 113void KOWhatsNextView::updateConfig()
109{ 114{
110 setFont( KOPrefs::instance()->mWhatsNextFont ); 115 setFont( KOPrefs::instance()->mWhatsNextFont );
111 updateView(); 116 updateView();
112 117
113} 118}
119void KOWhatsNextView::showEvent ( QShowEvent * e )
120{
121 //qDebug("KOWhatsNextView::showEvent ");
122 restartTimer();
123 QWidget::showEvent ( e );
124}
125void KOWhatsNextView::hideEvent ( QHideEvent * e)
126{
127 //qDebug(" KOWhatsNextView::hideEvent");
128 mTimer->stop();
129 QWidget::hideEvent ( e );
130}
131void KOWhatsNextView::restartTimer()
132{
133 //qDebug("KOWhatsNextView::restartTimer() ");
134 mTimer->start( 180000 );
135 //mTimer->start( 5000 );
136}
114void KOWhatsNextView::updateView() 137void KOWhatsNextView::updateView()
115{ 138{
116 139 if ( mTimer->isActive() )
140 restartTimer();
141 //qDebug("KOWhatsNextView::updateView() ");
117 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 142 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
118 KIconLoader kil("korganizer"); 143 KIconLoader kil("korganizer");
119 QString ipath;// = new QString(); 144 QString ipath;// = new QString();
120 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 145 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
121 //<big><big><strong>" + date + "</strong></big></big>\n"; 146 //<big><big><strong>" + date + "</strong></big></big>\n";
122 mText = "<table width=\"100%\">\n"; 147 mText = "<table width=\"100%\">\n";
123 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
124#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
125 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
126#else 151#else
127 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
128#endif 153#endif
129 // mText += "<img src=\""; 154 // mText += "<img src=\"";
130 // mText += ipath; 155 // mText += ipath;
131 // mText += "\">"; 156 // mText += "\">";
132 mEventDate = QDate::currentDate(); 157 mEventDate = QDate::currentDate();
133#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
134 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>";
135#else 160#else
136 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>";
137#endif 162#endif
138 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 163 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
139 int iii; 164 int iii;
140 mTodos.clear(); 165 mTodos.clear();
141 QPtrList<Event> events; 166 QPtrList<Event> events;
142 QPtrList<Todo> todos = calendar()->todos(); 167 QPtrList<Todo> todos = calendar()->todos();
143 Todo * todo; 168 Todo * todo;
144 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 169 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
145 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 170 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
146 bool itemAdded = false; 171 bool itemAdded = false;
147 for ( iii = 0; iii < daysToShow; ++iii ) { 172 for ( iii = 0; iii < daysToShow; ++iii ) {
148 QString date; 173 QString date;
149 itemAdded = false; 174 itemAdded = false;
150 events = calendar()->events( mEventDate, true ); 175 events = calendar()->events( mEventDate, true );
151 176
152 if ( iii == 0 ) { // today !!! 177 if ( iii == 0 ) { // today !!!
153 todo = todos.first(); 178 todo = todos.first();
154 while(todo) { 179 while(todo) {
155 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 180 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
156 if ( ! itemAdded ) { 181 if ( ! itemAdded ) {
157 appendDay ( iii, mEventDate ); 182 appendDay ( iii, mEventDate );
158 itemAdded = true; 183 itemAdded = true;
159 184
160 } 185 }
161 appendEvent(todo); 186 appendEvent(todo);
162 } 187 }
163 todo = todos.next(); 188 todo = todos.next();
164 } 189 }
@@ -573,88 +598,86 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
573 if ( ev->cancelled() ) 598 if ( ev->cancelled() )
574 mText += "</font>"; 599 mText += "</font>";
575 mText += "<a href=\"todo:" + ev->uid() + "\">"; 600 mText += "<a href=\"todo:" + ev->uid() + "\">";
576 mText += ev->summary(); 601 mText += ev->summary();
577 mText += "</a>"; 602 mText += "</a>";
578 if ( ((Todo*)ev)->hasDueDate () ) { 603 if ( ((Todo*)ev)->hasDueDate () ) {
579 QString year = ""; 604 QString year = "";
580 int ye = ((Todo*)ev)->dtDue().date().year(); 605 int ye = ((Todo*)ev)->dtDue().date().year();
581 if ( QDateTime::currentDateTime().date().year() != ye ) 606 if ( QDateTime::currentDateTime().date().year() != ye )
582 year = QString::number( ye ); 607 year = QString::number( ye );
583 QString dfs = KGlobal::locale()->dateFormatShort(); 608 QString dfs = KGlobal::locale()->dateFormatShort();
584 KGlobal::locale()->setDateFormatShort("%d.%b"); 609 KGlobal::locale()->setDateFormatShort("%d.%b");
585 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>";
586 KGlobal::locale()->setDateFormatShort(dfs); 611 KGlobal::locale()->setDateFormatShort(dfs);
587 } 612 }
588 if ( KOPrefs::instance()->mWNViewShowLocation ) 613 if ( KOPrefs::instance()->mWNViewShowLocation )
589 if ( !ev->location().isEmpty() ) 614 if ( !ev->location().isEmpty() )
590 mText += " ("+ev->location() +")"; 615 mText += " ("+ev->location() +")";
591 if ( !isSub ) { 616 if ( !isSub ) {
592 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 617 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
593 mText += " ["+ev->relatedTo()->summary() +"]"; 618 mText += " ["+ev->relatedTo()->summary() +"]";
594 mText += "</p>\n"; 619 mText += "</p>\n";
595 } 620 }
596 else { 621 else {
597 ind += "-"; 622 ind += "-";
598 mText += "</li>\n"; 623 mText += "</li>\n";
599 } 624 }
600 QPtrList<Incidence> Relations = ev->relations(); 625 QPtrList<Incidence> Relations = ev->relations();
601 Incidence *to; 626 Incidence *to;
602 for (to=Relations.first();to;to=Relations.next()) { 627 for (to=Relations.first();to;to=Relations.next()) {
603 if (!((Todo*)to)->isCompleted()) 628 if (!((Todo*)to)->isCompleted())
604 appendTodo( to, ind , true ); 629 appendTodo( to, ind , true );
605 } 630 }
606 631
607 return true; 632 return true;
608} 633}
609 634
610/* 635/*
611 void KOWhatsNextView::createEventViewer() 636 void KOWhatsNextView::createEventViewer()
612 { 637 {
613 if (!mEventViewer) { 638 if (!mEventViewer) {
614 639
615 mEventViewer = new KOEventViewerDialog(this); 640 mEventViewer = new KOEventViewerDialog(this);
616 } 641 }
617 } 642 }
618*/ 643*/
619void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 644void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
620{ 645{
621 if ( mEventViewer )
622 delete mEventViewer;
623 mEventViewer = v; 646 mEventViewer = v;
624} 647}
625 648
626// TODO: Create this function in CalendarView and remove it from here 649// TODO: Create this function in CalendarView and remove it from here
627void KOWhatsNextView::showIncidence(const QString &uid) 650void KOWhatsNextView::showIncidence(const QString &uid)
628{ 651{
629 if ( !mEventViewer ) { 652 if ( !mEventViewer ) {
630 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); 653 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
631 return; 654 return;
632 } 655 }
633 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; 656 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
634 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); 657 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
635 if (uid.startsWith("event:")) { 658 if (uid.startsWith("event:")) {
636#ifdef DESKTOP_VERSION 659#ifdef DESKTOP_VERSION
637 Event *event = calendar()->event(uid.mid(8)); 660 Event *event = calendar()->event(uid.mid(8));
638#else 661#else
639 Event *event = calendar()->event(uid.mid(6)); 662 Event *event = calendar()->event(uid.mid(6));
640#endif 663#endif
641 //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); 664 //qDebug("event %d uid %s ", event, uid.mid(6).latin1());
642 if (!event) return; 665 if (!event) return;
643 //createEventViewer(); 666 //createEventViewer();
644 mEventViewer->setEvent(event); 667 mEventViewer->setEvent(event);
645 } else if (uid.startsWith("todo:")) { 668 } else if (uid.startsWith("todo:")) {
646#ifdef DESKTOP_VERSION 669#ifdef DESKTOP_VERSION
647 Todo *todo = calendar()->todo(uid.mid(7)); 670 Todo *todo = calendar()->todo(uid.mid(7));
648#else 671#else
649 Todo *todo = calendar()->todo(uid.mid(5)); 672 Todo *todo = calendar()->todo(uid.mid(5));
650#endif 673#endif
651 if (!todo) return; 674 if (!todo) return;
652 //createEventViewer(); 675 //createEventViewer();
653 mEventViewer->setTodo(todo); 676 mEventViewer->setTodo(todo);
654 } else { 677 } else {
655 return; 678 return;
656 679
657 } 680 }
658 mEventViewer->showMe(); 681 mEventViewer->showMe();
659 mEventViewer->raise(); 682 mEventViewer->raise();
660} 683}
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index fff769a..1118bdd 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -1,91 +1,96 @@
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 24
24#include <korganizer/baseview.h> 25#include <korganizer/baseview.h>
25 26
26class QListView; 27class QListView;
27class QLabel; 28class QLabel;
28 29
29class KOEventViewerDialog; 30class KOEventViewerDialog;
30 31
31class WhatsNextTextBrowser : public QTextBrowser { 32class WhatsNextTextBrowser : public QTextBrowser {
32 Q_OBJECT 33 Q_OBJECT
33 public: 34 public:
34 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} 35 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
35 36
36 void setSource(const QString &); 37 void setSource(const QString &);
37 38
38 signals: 39 signals:
39 void showIncidence(const QString &uid); 40 void showIncidence(const QString &uid);
40}; 41};
41 42
42 43
43/** 44/**
44 This class provides a view of the next events and todos 45 This class provides a view of the next events and todos
45*/ 46*/
46class KOWhatsNextView : public KOrg::BaseView 47class KOWhatsNextView : public KOrg::BaseView
47{ 48{
48 Q_OBJECT 49 Q_OBJECT
49 public: 50 public:
50 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, 51 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
51 const char *name = 0); 52 const char *name = 0);
52 ~KOWhatsNextView(); 53 ~KOWhatsNextView();
53 54
54 virtual int maxDatesHint(); 55 virtual int maxDatesHint();
55 virtual int currentDateCount(); 56 virtual int currentDateCount();
56 void setEventViewer(KOEventViewerDialog* v ); 57 void setEventViewer(KOEventViewerDialog* v );
57 virtual QPtrList<Incidence> selectedIncidences(); 58 virtual QPtrList<Incidence> selectedIncidences();
58 DateList selectedDates() 59 DateList selectedDates()
59 {DateList q; 60 {DateList q;
60 return q;} 61 return q;}
61 virtual void printPreview(CalPrinter *calPrinter, 62 virtual void printPreview(CalPrinter *calPrinter,
62 const QDate &, const QDate &); 63 const QDate &, const QDate &);
63 64
64 public slots: 65 public slots:
65 virtual void updateView(); 66 virtual void updateView();
66 virtual void showDates(const QDate &start, const QDate &end); 67 virtual void showDates(const QDate &start, const QDate &end);
67 virtual void showEvents(QPtrList<Event> eventList); 68 virtual void showEvents(QPtrList<Event> eventList);
68 void updateConfig(); 69 void updateConfig();
69 void changeEventDisplay(Event *, int); 70 void changeEventDisplay(Event *, int);
70 71
71 protected: 72 protected:
72 void appendEvent(Incidence *, bool reply=false, bool notRed = true); 73 void appendEvent(Incidence *, bool reply=false, bool notRed = true);
73 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
74 void appendDay( int i, QDate date ); 75 void appendDay( int i, QDate date );
75 QDate mEventDate; 76 QDate mEventDate;
77 virtual void showEvent ( QShowEvent * );
78 virtual void hideEvent ( QHideEvent * );
76 79
77 private slots: 80 private slots:
78 void showIncidence(const QString &); 81 void showIncidence(const QString &);
82 void restartTimer();
83
79 84
80 private: 85 private:
81 //void createEventViewer(); 86 //void createEventViewer();
82 87 QTimer* mTimer;
83 QTextBrowser *mView; 88 QTextBrowser *mView;
84 QString mText; 89 QString mText;
85 // QLabel *mDateLabel; 90 // QLabel *mDateLabel;
86 KOEventViewerDialog *mEventViewer; 91 KOEventViewerDialog *mEventViewer;
87 92
88 QValueList<Incidence *> mTodos; 93 QValueList<Incidence *> mTodos;
89}; 94};
90 95
91#endif 96#endif