author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/kowhatsnextview.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
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,319 +1,325 @@ | |||
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"); |
182 | mTimer->stop(); | 188 | mTimer->stop(); |
183 | QWidget::hideEvent ( e ); | 189 | QWidget::hideEvent ( e ); |
184 | } | 190 | } |
185 | void KOWhatsNextView::restartTimer() | 191 | void KOWhatsNextView::restartTimer() |
186 | { | 192 | { |
187 | //qDebug("KOWhatsNextView::restartTimer() "); | 193 | //qDebug("KOWhatsNextView::restartTimer() "); |
188 | mTimer->start( 300000 ); | 194 | mTimer->start( 300000 ); |
189 | //mTimer->start( 5000 ); | 195 | //mTimer->start( 5000 ); |
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; |
256 | //mText += "\">"; | 262 | //mText += "\">"; |
257 | if ( ! itemAdded ) { | 263 | if ( ! itemAdded ) { |
258 | appendDay ( iii, mEventDate ); | 264 | appendDay ( iii, mEventDate ); |
259 | 265 | ||
260 | } | 266 | } |
261 | // for first day (iii == 0) | 267 | // for first day (iii == 0) |
262 | // we may have syncevents, or events in the past, which maybe should not be diaplayed | 268 | // we may have syncevents, or events in the past, which maybe should not be diaplayed |
263 | // for that reason we cannot append <table> in appendDay () for iii == 0 | 269 | // for that reason we cannot append <table> in appendDay () for iii == 0 |
264 | // we must append it in the first successful call of appendEvent() | 270 | // we must append it in the first successful call of appendEvent() |
265 | Event *ev = events.first(); | 271 | Event *ev = events.first(); |
266 | while(ev) { | 272 | while(ev) { |
267 | //qDebug("+++++event append %s", ev->summary().latin1()); | 273 | //qDebug("+++++event append %s", ev->summary().latin1()); |
268 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 274 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
269 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) | 275 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) |
270 | itemAdded = true; | 276 | itemAdded = true; |
271 | } | 277 | } |
272 | ev = events.next(); | 278 | ev = events.next(); |
273 | } | 279 | } |
274 | 280 | ||
275 | //mText += "</table>\n"; | 281 | //mText += "</table>\n"; |
276 | } | 282 | } |
277 | 283 | ||
278 | todo = todos.first(); | 284 | todo = todos.first(); |
279 | while(todo) { | 285 | while(todo) { |
280 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 286 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
281 | if ( ! itemAdded ) { | 287 | if ( ! itemAdded ) { |
282 | appendDay ( iii, mEventDate ); | 288 | appendDay ( iii, mEventDate ); |
283 | //itemAdded = true; | 289 | //itemAdded = true; |
284 | } | 290 | } |
285 | appendEvent(todo, false , iii!= 0,!itemAdded); | 291 | appendEvent(todo, false , iii!= 0,!itemAdded); |
286 | itemAdded = true; | 292 | itemAdded = true; |
287 | } | 293 | } |
288 | todo = todos.next(); | 294 | todo = todos.next(); |
289 | } | 295 | } |
290 | if ( !itemAdded && iii == 0 ) { | 296 | if ( !itemAdded && iii == 0 ) { |
291 | // appendDay ( iii, mEventDate ); | 297 | // appendDay ( iii, mEventDate ); |
292 | //mText += "<table>"; | 298 | //mText += "<table>"; |
293 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 299 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
294 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; | 300 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; |
295 | //mText +="</table>"; | 301 | //mText +="</table>"; |
296 | } | 302 | } |
297 | if ( itemAdded ) | 303 | if ( itemAdded ) |
298 | mText += "</table>\n"; | 304 | mText += "</table>\n"; |
299 | mEventDate = mEventDate.addDays( 1 ); | 305 | mEventDate = mEventDate.addDays( 1 ); |
300 | } | 306 | } |
301 | 307 | ||
302 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 308 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
303 | if (todos.count() > 0 && topmostPrios > 0 ) { | 309 | if (todos.count() > 0 && topmostPrios > 0 ) { |
304 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 310 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
305 | // mText += "<h2>"; | 311 | // mText += "<h2>"; |
306 | //<img src=\""; | 312 | //<img src=\""; |
307 | // mText += ipath; | 313 | // mText += ipath; |
308 | // mText += "\">"; | 314 | // mText += "\">"; |
309 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 315 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
310 | 316 | ||
311 | //mText += "<ul>\n"; | 317 | //mText += "<ul>\n"; |
312 | bool gotone = false; | 318 | bool gotone = false; |
313 | int priority = 1; | 319 | int priority = 1; |
314 | int priosFound = 0; | 320 | int priosFound = 0; |
315 | #ifdef DESKTOP_VERSION | 321 | #ifdef DESKTOP_VERSION |
316 | mText +="<p></p>"; | 322 | mText +="<p></p>"; |
317 | #endif | 323 | #endif |
318 | 324 | ||
319 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 325 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
@@ -361,193 +367,193 @@ void KOWhatsNextView::updateView() | |||
361 | } | 367 | } |
362 | replys++; | 368 | replys++; |
363 | appendEvent(ev,true); | 369 | appendEvent(ev,true); |
364 | } | 370 | } |
365 | } | 371 | } |
366 | ev = events.next(); | 372 | ev = events.next(); |
367 | } | 373 | } |
368 | } | 374 | } |
369 | todos = calendar()->todos(); | 375 | todos = calendar()->todos(); |
370 | if (todos.count() > 0) { | 376 | if (todos.count() > 0) { |
371 | Todo *to = todos.first(); | 377 | Todo *to = todos.first(); |
372 | while(to) { | 378 | while(to) { |
373 | if ( !to->isCompleted() ){ | 379 | if ( !to->isCompleted() ){ |
374 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 380 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
375 | if (me!=0) { | 381 | if (me!=0) { |
376 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 382 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
377 | if (replys == 0) { | 383 | if (replys == 0) { |
378 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 384 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
379 | mText += "<table>\n"; | 385 | mText += "<table>\n"; |
380 | } | 386 | } |
381 | replys++; | 387 | replys++; |
382 | appendEvent(to, true); | 388 | appendEvent(to, true); |
383 | } | 389 | } |
384 | } | 390 | } |
385 | } | 391 | } |
386 | to = todos.next(); | 392 | to = todos.next(); |
387 | } | 393 | } |
388 | } | 394 | } |
389 | if (replys > 0 ) mText += "</table>\n"; | 395 | if (replys > 0 ) mText += "</table>\n"; |
390 | 396 | ||
391 | 397 | ||
392 | mText += "</td></tr>\n</table>\n"; | 398 | mText += "</td></tr>\n</table>\n"; |
393 | 399 | ||
394 | mView->setText(mText); | 400 | mView->setText(mText); |
395 | mView->setFocus(); | 401 | mView->setFocus(); |
396 | 402 | ||
397 | // QPixmap bPix = SmallIcon( "back" ); | 403 | // QPixmap bPix = SmallIcon( "back" ); |
398 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 404 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
399 | // QWidget* test = new QWidget(); | 405 | // QWidget* test = new QWidget(); |
400 | // test->setBackgroundMode(FixedPixmap ); | 406 | // test->setBackgroundMode(FixedPixmap ); |
401 | // test->setBackgroundPixmap ( bPix ); | 407 | // test->setBackgroundPixmap ( bPix ); |
402 | // test->resize( 300, 400 ); | 408 | // test->resize( 300, 400 ); |
403 | // test->show(); | 409 | // test->show(); |
404 | // mView->setBackgroundMode(FixedPixmap ); | 410 | // mView->setBackgroundMode(FixedPixmap ); |
405 | // mView->setBackgroundPixmap ( bPix ); | 411 | // mView->setBackgroundPixmap ( bPix ); |
406 | // qDebug("%s ",mText.latin1()); | 412 | // qDebug("%s ",mText.latin1()); |
407 | } | 413 | } |
408 | 414 | ||
409 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 415 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
410 | { | 416 | { |
411 | QString date; | 417 | QString date; |
412 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 418 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
413 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 419 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
414 | if ( i == 0 ) { | 420 | if ( i == 0 ) { |
415 | //mText += "<table>\n"; | 421 | //mText += "<table>\n"; |
416 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 422 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
417 | } | 423 | } |
418 | else if ( i == 1 ) | 424 | else if ( i == 1 ) |
419 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 425 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
420 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 426 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
421 | mText += "<h2>" + date + "</h2>\n"; | 427 | mText += "<h2>" + date + "</h2>\n"; |
422 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 428 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
423 | mText += "<table>\n"; | 429 | mText += "<table>\n"; |
424 | 430 | ||
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; |
490 | if ( reply ) { | 496 | if ( reply ) { |
491 | noc = ev->getNextOccurence( cdt, &ok ); | 497 | noc = ev->getNextOccurence( cdt, &ok ); |
492 | if (! ok && ev->typeID() == eventID) | 498 | if (! ok && ev->typeID() == eventID) |
493 | return false; | 499 | return false; |
494 | } | 500 | } |
495 | bool bDay = false; | 501 | bool bDay = false; |
496 | if ( ev->isBirthday() || ev->isAnniversary() ) | 502 | if ( ev->isBirthday() || ev->isAnniversary() ) |
497 | bDay = true; | 503 | bDay = true; |
498 | tempText += "<tr><td><b>"; | 504 | tempText += "<tr><td><b>"; |
499 | if (ev->typeID() == eventID ) { | 505 | if (ev->typeID() == eventID ) { |
500 | if (reply) { | 506 | if (reply) { |
501 | if (!ev->doesFloat()) | 507 | if (!ev->doesFloat()) |
502 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 508 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
503 | else | 509 | else |
504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 510 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
505 | 511 | ||
506 | } else { | 512 | } else { |
507 | if (!ev->doesFloat()) { | 513 | if (!ev->doesFloat()) { |
508 | Event *event = static_cast<Event *>(ev); | 514 | Event *event = static_cast<Event *>(ev); |
509 | QDateTime st,end; | 515 | QDateTime st,end; |
510 | if ( event->doesRecur() ) { | 516 | if ( event->doesRecur() ) { |
511 | QDate recDate= mEventDate; | 517 | QDate recDate= mEventDate; |
512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 518 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
513 | while ( ! event->recursOn( recDate ) ) { | 519 | while ( ! event->recursOn( recDate ) ) { |
514 | recDate = recDate.addDays( -1 ); | 520 | recDate = recDate.addDays( -1 ); |
515 | 521 | ||
516 | } | 522 | } |
517 | st = QDateTime ( recDate, event->dtStart().time() ); | 523 | st = QDateTime ( recDate, event->dtStart().time() ); |
518 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 524 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
519 | } | 525 | } |
520 | else { | 526 | else { |
521 | st = event->dtStart(); | 527 | st = event->dtStart(); |
522 | end = event->dtEnd(); | 528 | end = event->dtEnd(); |
523 | } | 529 | } |
524 | 530 | ||
525 | 531 | ||
526 | QString dateText; | 532 | QString dateText; |
527 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 533 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
528 | if ( st.date() < mEventDate ) | 534 | if ( st.date() < mEventDate ) |
529 | dateText = "++:++-"; | 535 | dateText = "++:++-"; |
530 | else | 536 | else |
531 | dateText = event->dtStartTimeStr() + "-"; | 537 | dateText = event->dtStartTimeStr() + "-"; |
532 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) | 538 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) |
533 | dateText += " "; | 539 | dateText += " "; |
534 | if ( end.date() > mEventDate ) | 540 | if ( end.date() > mEventDate ) |
535 | dateText += "++:++"; | 541 | dateText += "++:++"; |
536 | else | 542 | else |
537 | dateText += event->dtEndTimeStr(); | 543 | dateText += event->dtEndTimeStr(); |
538 | if ( notRed ) | 544 | if ( notRed ) |
539 | tempText += dateText; | 545 | tempText += dateText; |
540 | else { | 546 | else { |
541 | if ( end < cdt ) { | 547 | if ( end < cdt ) { |
542 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 548 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
543 | return false; | 549 | return false; |
544 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 550 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
545 | } | 551 | } |
546 | else if ( st < cdt ) | 552 | else if ( st < cdt ) |
547 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 553 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
548 | else | 554 | else |
549 | tempText += dateText; | 555 | tempText += dateText; |
550 | 556 | ||
551 | } | 557 | } |
552 | 558 | ||
553 | } else { | 559 | } else { |
@@ -648,156 +654,156 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
648 | if ( ev->typeID() == todoID ) { | 654 | if ( ev->typeID() == todoID ) { |
649 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); | 655 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); |
650 | } else | 656 | } else |
651 | years = noc.date().year() - ev->dtStart().date().year(); | 657 | years = noc.date().year() - ev->dtStart().date().year(); |
652 | tempText += i18n(" (%1 y.)"). arg( years ); | 658 | tempText += i18n(" (%1 y.)"). arg( years ); |
653 | } | 659 | } |
654 | } | 660 | } |
655 | 661 | ||
656 | tempText += "</a>"; | 662 | tempText += "</a>"; |
657 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 663 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
658 | if ( !ev->location().isEmpty() ) | 664 | if ( !ev->location().isEmpty() ) |
659 | tempText += " ("+ev->location() +")"; | 665 | tempText += " ("+ev->location() +")"; |
660 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 666 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
661 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 667 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
662 | tempText += "</td></tr>\n"; | 668 | tempText += "</td></tr>\n"; |
663 | mText += tempText; | 669 | mText += tempText; |
664 | return true; | 670 | return true; |
665 | } | 671 | } |
666 | 672 | ||
667 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 673 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
668 | { | 674 | { |
669 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 675 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
670 | 676 | ||
671 | mTodos.append( ev ); | 677 | mTodos.append( ev ); |
672 | if ( !isSub ) | 678 | if ( !isSub ) |
673 | mText += "<p>"; | 679 | mText += "<p>"; |
674 | else | 680 | else |
675 | mText += "<li>"; | 681 | mText += "<li>"; |
676 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 682 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
677 | 683 | ||
678 | 684 | ||
679 | mText += ind; | 685 | mText += ind; |
680 | bool needClose = false; | 686 | bool needClose = false; |
681 | if ( ev->cancelled() ) { | 687 | if ( ev->cancelled() ) { |
682 | mText += "<font color=\"#F00000\">[c"; | 688 | mText += "<font color=\"#F00000\">[c"; |
683 | needClose =true; | 689 | needClose =true; |
684 | 690 | ||
685 | } | 691 | } |
686 | if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) { | 692 | if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) { |
687 | if ( !needClose) | 693 | if ( !needClose) |
688 | mText +="["; | 694 | mText +="["; |
689 | mText += "a"; | 695 | mText += "a"; |
690 | needClose =true; | 696 | needClose =true; |
691 | 697 | ||
692 | } | 698 | } |
693 | 699 | ||
694 | if ( ev->description().length() > 0 ) { | 700 | if ( ev->description().length() > 0 ) { |
695 | if ( !needClose) | 701 | if ( !needClose) |
696 | mText +="["; | 702 | mText +="["; |
697 | mText += "i"; | 703 | mText += "i"; |
698 | needClose =true; | 704 | needClose =true; |
699 | } | 705 | } |
700 | if ( ev->doesRecur() ) { | 706 | if ( ev->doesRecur() ) { |
701 | if ( !needClose) | 707 | if ( !needClose) |
702 | mText +="["; | 708 | mText +="["; |
703 | mText += "r"; | 709 | mText += "r"; |
704 | needClose =true; | 710 | needClose =true; |
705 | } | 711 | } |
706 | // if ( ev->recurrence()->doesRecur() ) { | 712 | // if ( ev->recurrence()->doesRecur() ) { |
707 | // if ( !needClose) | 713 | // if ( !needClose) |
708 | // mText +="("; | 714 | // mText +="("; |
709 | // mText += "r"; | 715 | // mText += "r"; |
710 | // needClose =true; | 716 | // needClose =true; |
711 | // } | 717 | // } |
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; |
777 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 783 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
778 | if (uid.startsWith("event:")) { | 784 | if (uid.startsWith("event:")) { |
779 | #ifdef DESKTOP_VERSION | 785 | #ifdef DESKTOP_VERSION |
780 | Event *event = calendar()->event(uid.mid(8)); | 786 | Event *event = calendar()->event(uid.mid(8)); |
781 | #else | 787 | #else |
782 | Event *event = calendar()->event(uid.mid(6)); | 788 | Event *event = calendar()->event(uid.mid(6)); |
783 | #endif | 789 | #endif |
784 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 790 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
785 | if (!event) return; | 791 | if (!event) return; |
786 | //createEventViewer(); | 792 | //createEventViewer(); |
787 | mEventViewer->setEvent(event); | 793 | mEventViewer->setEvent(event); |
788 | } else if (uid.startsWith("todo:")) { | 794 | } else if (uid.startsWith("todo:")) { |
789 | #ifdef DESKTOP_VERSION | 795 | #ifdef DESKTOP_VERSION |
790 | Todo *todo = calendar()->todo(uid.mid(7)); | 796 | Todo *todo = calendar()->todo(uid.mid(7)); |
791 | #else | 797 | #else |
792 | Todo *todo = calendar()->todo(uid.mid(5)); | 798 | Todo *todo = calendar()->todo(uid.mid(5)); |
793 | #endif | 799 | #endif |
794 | if (!todo) return; | 800 | if (!todo) return; |
795 | //createEventViewer(); | 801 | //createEventViewer(); |
796 | mEventViewer->setTodo(todo); | 802 | mEventViewer->setTodo(todo); |
797 | } else { | 803 | } else { |
798 | return; | 804 | return; |
799 | 805 | ||
800 | } | 806 | } |
801 | mEventViewer->showMe(); | 807 | mEventViewer->showMe(); |
802 | mEventViewer->raise(); | 808 | mEventViewer->raise(); |
803 | } | 809 | } |