Diffstat (limited to 'korganizer/kowhatsnextview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index f88403c..bfe930f 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -1,181 +1,187 @@ | |||
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 <q3textbrowser.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 | #include <QDesktopWidget> | ||
27 | #ifdef DESKTOP_VERSION | 28 | #ifdef DESKTOP_VERSION |
28 | #include <qpaintdevicemetrics.h> | 29 | #include <q3paintdevicemetrics.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3PtrList> | ||
32 | #include <QHideEvent> | ||
33 | #include <Q3VBoxLayout> | ||
34 | #include <QShowEvent> | ||
29 | #endif | 35 | #endif |
30 | #include <kglobal.h> | 36 | #include <kglobal.h> |
31 | #include <klocale.h> | 37 | #include <klocale.h> |
32 | #include <kdebug.h> | 38 | #include <kdebug.h> |
33 | #include <kiconloader.h> | 39 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 40 | #include <kmessagebox.h> |
35 | 41 | ||
36 | #include <libkcal/calendar.h> | 42 | #include <libkcal/calendar.h> |
37 | 43 | ||
38 | #ifndef KORG_NOPRINTER | 44 | #ifndef KORG_NOPRINTER |
39 | #include "calprinter.h" | 45 | #include "calprinter.h" |
40 | #endif | 46 | #endif |
41 | #include "koglobals.h" | 47 | #include "koglobals.h" |
42 | #include "koprefs.h" | 48 | #include "koprefs.h" |
43 | #include "koeventviewerdialog.h" | 49 | #include "koeventviewerdialog.h" |
44 | #include "koeventviewer.h" | 50 | #include "koeventviewer.h" |
45 | #include <qstylesheet.h> | 51 | #include <q3stylesheet.h> |
46 | #include "kowhatsnextview.h" | 52 | #include "kowhatsnextview.h" |
47 | using namespace KOrg; | 53 | using namespace KOrg; |
48 | 54 | ||
49 | void WhatsNextTextBrowser::setSource(const QString& n) | 55 | void WhatsNextTextBrowser::setSource(const QString& n) |
50 | { | 56 | { |
51 | 57 | ||
52 | if (n.startsWith("event:")) { | 58 | if (n.startsWith("event:")) { |
53 | emit showIncidence(n); | 59 | emit showIncidence(n); |
54 | return; | 60 | return; |
55 | } else if (n.startsWith("todo:")) { | 61 | } else if (n.startsWith("todo:")) { |
56 | emit showIncidence(n); | 62 | emit showIncidence(n); |
57 | return; | 63 | return; |
58 | } else { | 64 | } else { |
59 | QTextBrowser::setSource(n); | 65 | Q3TextBrowser::setSource(n); |
60 | } | 66 | } |
61 | } | 67 | } |
62 | void WhatsNextTextBrowser::printMe() | 68 | void WhatsNextTextBrowser::printMe() |
63 | { | 69 | { |
64 | #ifdef DESKTOP_VERSION | 70 | #ifdef DESKTOP_VERSION |
65 | KOPrintPrefs pp ( this ); | 71 | KOPrintPrefs pp ( this ); |
66 | if (!pp.exec() ) | 72 | if (!pp.exec() ) |
67 | return; | 73 | return; |
68 | int scaleval = pp.printMode() ; | 74 | int scaleval = pp.printMode() ; |
69 | 75 | ||
70 | QPrinter printer; | 76 | QPrinter printer; |
71 | if (!printer.setup() ) | 77 | if (!printer.setup() ) |
72 | return; | 78 | return; |
73 | QPainter p; | 79 | QPainter p; |
74 | p.begin ( &printer ); | 80 | p.begin ( &printer ); |
75 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 81 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
76 | float dx, dy; | 82 | float dx, dy; |
77 | int wid = (m.width() * 9)/10; | 83 | int wid = (m.width() * 9)/10; |
78 | dx = (float) wid/(float)contentsWidth (); | 84 | dx = (float) wid/(float)contentsWidth (); |
79 | dy = (float)(m.height()) / (float)contentsHeight (); | 85 | dy = (float)(m.height()) / (float)contentsHeight (); |
80 | float scale; | 86 | float scale; |
81 | // scale to fit the width or height of the paper | 87 | // scale to fit the width or height of the paper |
82 | if ( dx < dy ) | 88 | if ( dx < dy ) |
83 | scale = dx; | 89 | scale = dx; |
84 | else | 90 | else |
85 | scale = dy; | 91 | scale = dy; |
86 | p.translate( m.width()/10,0 ); | 92 | p.translate( m.width()/10,0 ); |
87 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | 93 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { |
88 | p.scale( scale, scale ); | 94 | p.scale( scale, scale ); |
89 | } | 95 | } |
90 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 96 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
91 | p.end(); | 97 | p.end(); |
92 | #endif | 98 | #endif |
93 | } | 99 | } |
94 | 100 | ||
95 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 101 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
96 | const char *name) | 102 | const char *name) |
97 | : KOrg::BaseView(calendar, parent, name) | 103 | : KOrg::BaseView(calendar, parent, name) |
98 | { | 104 | { |
99 | // mDateLabel = | 105 | // mDateLabel = |
100 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 106 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
101 | // mDateLabel->setMargin(2); | 107 | // mDateLabel->setMargin(2); |
102 | // mDateLabel->setAlignment(AlignCenter); | 108 | // mDateLabel->setAlignment(AlignCenter); |
103 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 109 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
104 | mView = new WhatsNextTextBrowser(this); | 110 | mView = new WhatsNextTextBrowser(this); |
105 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 111 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
106 | QStyleSheet* stsh = mView->styleSheet(); | 112 | Q3StyleSheet* stsh = mView->styleSheet(); |
107 | QStyleSheetItem * style ; | 113 | Q3StyleSheetItem * style ; |
108 | style = stsh->item ("h2" ); | 114 | style = stsh->item ("h2" ); |
109 | if ( style ) { | 115 | if ( style ) { |
110 | style->setMargin(QStyleSheetItem::MarginAll,0); | 116 | style->setMargin(Q3StyleSheetItem::MarginAll,0); |
111 | } | 117 | } |
112 | style = stsh->item ("h3" ); | 118 | style = stsh->item ("h3" ); |
113 | if ( style ) { | 119 | if ( style ) { |
114 | style->setMargin(QStyleSheetItem::MarginAll,0); | 120 | style->setMargin(Q3StyleSheetItem::MarginAll,0); |
115 | } | 121 | } |
116 | mEventViewer = 0; | 122 | mEventViewer = 0; |
117 | 123 | ||
118 | QBoxLayout *topLayout = new QVBoxLayout(this); | 124 | Q3BoxLayout *topLayout = new Q3VBoxLayout(this); |
119 | // topLayout->addWidget(mDateLabel); | 125 | // topLayout->addWidget(mDateLabel); |
120 | topLayout->addWidget(mView); | 126 | topLayout->addWidget(mView); |
121 | mTimer = new QTimer( this ); | 127 | mTimer = new QTimer( this ); |
122 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | 128 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); |
123 | 129 | ||
124 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 130 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
125 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 131 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
126 | } | 132 | } |
127 | 133 | ||
128 | KOWhatsNextView::~KOWhatsNextView() | 134 | KOWhatsNextView::~KOWhatsNextView() |
129 | { | 135 | { |
130 | } | 136 | } |
131 | 137 | ||
132 | int KOWhatsNextView::maxDatesHint() | 138 | int KOWhatsNextView::maxDatesHint() |
133 | { | 139 | { |
134 | return 0; | 140 | return 0; |
135 | } | 141 | } |
136 | 142 | ||
137 | int KOWhatsNextView::currentDateCount() | 143 | int KOWhatsNextView::currentDateCount() |
138 | { | 144 | { |
139 | return 0; | 145 | return 0; |
140 | } | 146 | } |
141 | 147 | ||
142 | void KOWhatsNextView::clearList() | 148 | void KOWhatsNextView::clearList() |
143 | { | 149 | { |
144 | mTimer->stop(); | 150 | mTimer->stop(); |
145 | mView->setText(" "); | 151 | mView->setText(" "); |
146 | } | 152 | } |
147 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 153 | Q3PtrList<Incidence> KOWhatsNextView::selectedIncidences() |
148 | { | 154 | { |
149 | QPtrList<Incidence> eventList; | 155 | Q3PtrList<Incidence> eventList; |
150 | 156 | ||
151 | return eventList; | 157 | return eventList; |
152 | } | 158 | } |
153 | 159 | ||
154 | void KOWhatsNextView::printMe() | 160 | void KOWhatsNextView::printMe() |
155 | { | 161 | { |
156 | #ifdef DESKTOP_VERSION | 162 | #ifdef DESKTOP_VERSION |
157 | mView->printMe(); | 163 | mView->printMe(); |
158 | #endif | 164 | #endif |
159 | } | 165 | } |
160 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 166 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
161 | const QDate &td) | 167 | const QDate &td) |
162 | { | 168 | { |
163 | #ifndef KORG_NOPRINTER | 169 | #ifndef KORG_NOPRINTER |
164 | calPrinter->preview(CalPrinter::Day, fd, td); | 170 | calPrinter->preview(CalPrinter::Day, fd, td); |
165 | #endif | 171 | #endif |
166 | } | 172 | } |
167 | void KOWhatsNextView::updateConfig() | 173 | void KOWhatsNextView::updateConfig() |
168 | { | 174 | { |
169 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 175 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
170 | updateView(); | 176 | updateView(); |
171 | 177 | ||
172 | } | 178 | } |
173 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | 179 | void KOWhatsNextView::showEvent ( QShowEvent * e ) |
174 | { | 180 | { |
175 | //qDebug("KOWhatsNextView::showEvent "); | 181 | //qDebug("KOWhatsNextView::showEvent "); |
176 | restartTimer(); | 182 | restartTimer(); |
177 | QWidget::showEvent ( e ); | 183 | QWidget::showEvent ( e ); |
178 | } | 184 | } |
179 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | 185 | void KOWhatsNextView::hideEvent ( QHideEvent * e) |
180 | { | 186 | { |
181 | //qDebug(" KOWhatsNextView::hideEvent"); | 187 | //qDebug(" KOWhatsNextView::hideEvent"); |
@@ -190,66 +196,66 @@ void KOWhatsNextView::restartTimer() | |||
190 | } | 196 | } |
191 | void KOWhatsNextView::updateView() | 197 | void KOWhatsNextView::updateView() |
192 | { | 198 | { |
193 | //qDebug("KOWhatsNextView::updateView() "); | 199 | //qDebug("KOWhatsNextView::updateView() "); |
194 | if ( mTimer->isActive() ) | 200 | if ( mTimer->isActive() ) |
195 | restartTimer(); | 201 | restartTimer(); |
196 | mCurrentMaxPrio = 5; | 202 | mCurrentMaxPrio = 5; |
197 | //qDebug("KOWhatsNextView::updateView() "); | 203 | //qDebug("KOWhatsNextView::updateView() "); |
198 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 204 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
199 | KIconLoader kil("korganizer"); | 205 | KIconLoader kil("korganizer"); |
200 | QString ipath;// = new QString(); | 206 | QString ipath;// = new QString(); |
201 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 207 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
202 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 208 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
203 | mText = "<table width=\"100%\">\n"; | 209 | mText = "<table width=\"100%\">\n"; |
204 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 210 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
205 | #ifdef DESKTOP_VERSION | 211 | #ifdef DESKTOP_VERSION |
206 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 212 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
207 | #else | 213 | #else |
208 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 214 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
209 | #endif | 215 | #endif |
210 | // mText += "<img src=\""; | 216 | // mText += "<img src=\""; |
211 | // mText += ipath; | 217 | // mText += ipath; |
212 | // mText += "\">"; | 218 | // mText += "\">"; |
213 | mEventDate = QDate::currentDate(); | 219 | mEventDate = QDate::currentDate(); |
214 | #ifdef DESKTOP_VERSION | 220 | #ifdef DESKTOP_VERSION |
215 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 221 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
216 | #else | 222 | #else |
217 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 223 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
218 | #endif | 224 | #endif |
219 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 225 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
220 | int iii; | 226 | int iii; |
221 | mTodos.clear(); | 227 | mTodos.clear(); |
222 | QPtrList<Event> events; | 228 | Q3PtrList<Event> events; |
223 | QPtrList<Todo> todos = calendar()->todos(); | 229 | Q3PtrList<Todo> todos = calendar()->todos(); |
224 | Todo * todo; | 230 | Todo * todo; |
225 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 231 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
226 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 232 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
227 | bool itemAdded = false; | 233 | bool itemAdded = false; |
228 | for ( iii = 0; iii < daysToShow; ++iii ) { | 234 | for ( iii = 0; iii < daysToShow; ++iii ) { |
229 | QString date; | 235 | QString date; |
230 | itemAdded = false; | 236 | itemAdded = false; |
231 | events = calendar()->events( mEventDate, true ); | 237 | events = calendar()->events( mEventDate, true ); |
232 | 238 | ||
233 | if ( iii == 0 ) { // today !!! | 239 | if ( iii == 0 ) { // today !!! |
234 | todo = todos.first(); | 240 | todo = todos.first(); |
235 | while(todo) { | 241 | while(todo) { |
236 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 242 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
237 | if ( ! itemAdded ) { | 243 | if ( ! itemAdded ) { |
238 | appendDay ( iii, mEventDate ); | 244 | appendDay ( iii, mEventDate ); |
239 | //itemAdded = true; | 245 | //itemAdded = true; |
240 | 246 | ||
241 | } //bool reply=false, bool notRed = true, bool appendTable = false); | 247 | } //bool reply=false, bool notRed = true, bool appendTable = false); |
242 | appendEvent(todo, false, false, !itemAdded ); | 248 | appendEvent(todo, false, false, !itemAdded ); |
243 | itemAdded = true; | 249 | itemAdded = true; |
244 | } | 250 | } |
245 | todo = todos.next(); | 251 | todo = todos.next(); |
246 | } | 252 | } |
247 | } | 253 | } |
248 | 254 | ||
249 | 255 | ||
250 | if (events.count() > 0) { | 256 | if (events.count() > 0) { |
251 | // mText += "<p></p>"; | 257 | // mText += "<p></p>"; |
252 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 258 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
253 | // mText += "<h2>"; | 259 | // mText += "<h2>"; |
254 | //mText += " <img src=\""; | 260 | //mText += " <img src=\""; |
255 | //mText += ipath; | 261 | //mText += ipath; |
@@ -425,65 +431,65 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate ) | |||
425 | 431 | ||
426 | 432 | ||
427 | } else { | 433 | } else { |
428 | if ( i == 0 ) { | 434 | if ( i == 0 ) { |
429 | //mText += "<table>\n"; | 435 | //mText += "<table>\n"; |
430 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 436 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
431 | } | 437 | } |
432 | 438 | ||
433 | #ifdef DESKTOP_VERSION | 439 | #ifdef DESKTOP_VERSION |
434 | else if ( i == 1 ) { | 440 | else if ( i == 1 ) { |
435 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 441 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
436 | } | 442 | } |
437 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 443 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
438 | #else | 444 | #else |
439 | else if ( i == 1 ) { | 445 | else if ( i == 1 ) { |
440 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 446 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
441 | } | 447 | } |
442 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 448 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
443 | 449 | ||
444 | #endif | 450 | #endif |
445 | mText += "<h2>" + date + "</h2>\n"; | 451 | mText += "<h2>" + date + "</h2>\n"; |
446 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 452 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
447 | mText += "<table>\n"; | 453 | mText += "<table>\n"; |
448 | } | 454 | } |
449 | } | 455 | } |
450 | 456 | ||
451 | 457 | ||
452 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 458 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
453 | { | 459 | { |
454 | updateView(); | 460 | updateView(); |
455 | } | 461 | } |
456 | 462 | ||
457 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 463 | void KOWhatsNextView::showEvents(Q3PtrList<Event>) |
458 | { | 464 | { |
459 | } | 465 | } |
460 | 466 | ||
461 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 467 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
462 | { | 468 | { |
463 | switch(action) { | 469 | switch(action) { |
464 | case KOGlobals::EVENTADDED: | 470 | case KOGlobals::EVENTADDED: |
465 | updateView(); | 471 | updateView(); |
466 | break; | 472 | break; |
467 | case KOGlobals::EVENTEDITED: | 473 | case KOGlobals::EVENTEDITED: |
468 | updateView(); | 474 | updateView(); |
469 | break; | 475 | break; |
470 | case KOGlobals::EVENTDELETED: | 476 | case KOGlobals::EVENTDELETED: |
471 | updateView(); | 477 | updateView(); |
472 | break; | 478 | break; |
473 | default: | 479 | default: |
474 | updateView(); | 480 | updateView(); |
475 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 481 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
476 | } | 482 | } |
477 | } | 483 | } |
478 | 484 | ||
479 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) | 485 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) |
480 | { | 486 | { |
481 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 487 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
482 | return false; | 488 | return false; |
483 | QDateTime cdt = QDateTime::currentDateTime(); | 489 | QDateTime cdt = QDateTime::currentDateTime(); |
484 | QDateTime noc; | 490 | QDateTime noc; |
485 | QString tempText; | 491 | QString tempText; |
486 | if ( appendTable && !notRed ) { | 492 | if ( appendTable && !notRed ) { |
487 | tempText = "<table>"; | 493 | tempText = "<table>"; |
488 | } | 494 | } |
489 | bool ok = true; | 495 | bool ok = true; |
@@ -712,65 +718,65 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | |||
712 | if ( needClose ) | 718 | if ( needClose ) |
713 | mText += "] "; | 719 | mText += "] "; |
714 | if ( ev->cancelled() ) | 720 | if ( ev->cancelled() ) |
715 | mText += "</font>"; | 721 | mText += "</font>"; |
716 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 722 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
717 | if ( ev->summary().length() > 0 ) | 723 | if ( ev->summary().length() > 0 ) |
718 | mText += ev->summary(); | 724 | mText += ev->summary(); |
719 | else | 725 | else |
720 | mText += i18n("-no summary-"); | 726 | mText += i18n("-no summary-"); |
721 | mText += "</a>"; | 727 | mText += "</a>"; |
722 | if ( ((Todo*)ev)->hasDueDate () ) { | 728 | if ( ((Todo*)ev)->hasDueDate () ) { |
723 | QString year = ""; | 729 | QString year = ""; |
724 | int ye = ((Todo*)ev)->dtDue().date().year(); | 730 | int ye = ((Todo*)ev)->dtDue().date().year(); |
725 | if ( QDateTime::currentDateTime().date().year() != ye ) | 731 | if ( QDateTime::currentDateTime().date().year() != ye ) |
726 | year = QString::number( ye ); | 732 | year = QString::number( ye ); |
727 | QString dfs = KGlobal::locale()->dateFormatShort(); | 733 | QString dfs = KGlobal::locale()->dateFormatShort(); |
728 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 734 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
729 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 735 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
730 | KGlobal::locale()->setDateFormatShort(dfs); | 736 | KGlobal::locale()->setDateFormatShort(dfs); |
731 | } | 737 | } |
732 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 738 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
733 | if ( !ev->location().isEmpty() ) | 739 | if ( !ev->location().isEmpty() ) |
734 | mText += " ("+ev->location() +")"; | 740 | mText += " ("+ev->location() +")"; |
735 | if ( !isSub ) { | 741 | if ( !isSub ) { |
736 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 742 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
737 | mText += " ["+ev->relatedTo()->summary() +"]"; | 743 | mText += " ["+ev->relatedTo()->summary() +"]"; |
738 | mText += "</p>\n"; | 744 | mText += "</p>\n"; |
739 | } | 745 | } |
740 | else { | 746 | else { |
741 | ind += "-"; | 747 | ind += "-"; |
742 | mText += "</li>\n"; | 748 | mText += "</li>\n"; |
743 | } | 749 | } |
744 | QPtrList<Incidence> Relations = ev->relations(); | 750 | Q3PtrList<Incidence> Relations = ev->relations(); |
745 | Incidence *to; | 751 | Incidence *to; |
746 | for (to=Relations.first();to;to=Relations.next()) { | 752 | for (to=Relations.first();to;to=Relations.next()) { |
747 | if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio ) | 753 | if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio ) |
748 | appendTodo( to, ind , true ); | 754 | appendTodo( to, ind , true ); |
749 | } | 755 | } |
750 | 756 | ||
751 | return true; | 757 | return true; |
752 | } | 758 | } |
753 | 759 | ||
754 | /* | 760 | /* |
755 | void KOWhatsNextView::createEventViewer() | 761 | void KOWhatsNextView::createEventViewer() |
756 | { | 762 | { |
757 | if (!mEventViewer) { | 763 | if (!mEventViewer) { |
758 | 764 | ||
759 | mEventViewer = new KOEventViewerDialog(this); | 765 | mEventViewer = new KOEventViewerDialog(this); |
760 | } | 766 | } |
761 | } | 767 | } |
762 | */ | 768 | */ |
763 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 769 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
764 | { | 770 | { |
765 | mEventViewer = v; | 771 | mEventViewer = v; |
766 | } | 772 | } |
767 | 773 | ||
768 | // TODO: Create this function in CalendarView and remove it from here | 774 | // TODO: Create this function in CalendarView and remove it from here |
769 | void KOWhatsNextView::showIncidence(const QString &uid) | 775 | void KOWhatsNextView::showIncidence(const QString &uid) |
770 | { | 776 | { |
771 | 777 | ||
772 | if ( !mEventViewer ) { | 778 | if ( !mEventViewer ) { |
773 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 779 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
774 | return; | 780 | return; |
775 | } | 781 | } |
776 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 782 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |