author | zautrix <zautrix> | 2005-04-01 20:32:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-01 20:32:33 (UTC) |
commit | 12fc62df25e15f6b20d8026ceb09118ca3ed7205 (patch) (unidiff) | |
tree | 8686600dc4ed5e5f6e9c79e007b818bfb4546750 | |
parent | b1e3bf53b1c4cc46ef0a2ded04338bc38a640161 (diff) | |
download | kdepimpi-12fc62df25e15f6b20d8026ceb09118ca3ed7205.zip kdepimpi-12fc62df25e15f6b20d8026ceb09118ca3ed7205.tar.gz kdepimpi-12fc62df25e15f6b20d8026ceb09118ca3ed7205.tar.bz2 |
filterfix
-rw-r--r-- | bin/kdepim/korganizer/icons16/filter.png | bin | 0 -> 820 bytes | |||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
2 files changed, 1 insertions, 1 deletions
diff --git a/bin/kdepim/korganizer/icons16/filter.png b/bin/kdepim/korganizer/icons16/filter.png new file mode 100644 index 0000000..83890a8 --- a/dev/null +++ b/bin/kdepim/korganizer/icons16/filter.png | |||
Binary files differ | |||
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 667ff2a..1627dba 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1,1622 +1,1622 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #ifndef KORG_NOSPLITTER | 29 | #ifndef KORG_NOSPLITTER |
30 | #include <qsplitter.h> | 30 | #include <qsplitter.h> |
31 | #endif | 31 | #endif |
32 | #include <qfont.h> | 32 | #include <qfont.h> |
33 | #include <qfontmetrics.h> | 33 | #include <qfontmetrics.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qtooltip.h> | 35 | #include <qtooltip.h> |
36 | #include <qpainter.h> | 36 | #include <qpainter.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | 39 | ||
40 | #include <kapplication.h> | 40 | #include <kapplication.h> |
41 | #include <KDGanttMinimizeSplitter.h> | 41 | #include <KDGanttMinimizeSplitter.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | #include <kiconloader.h> | 44 | #include <kiconloader.h> |
45 | #include <klocale.h> | 45 | #include <klocale.h> |
46 | #include <kconfig.h> | 46 | #include <kconfig.h> |
47 | #include <kglobal.h> | 47 | #include <kglobal.h> |
48 | #include "calendarview.h" | 48 | #include "calendarview.h" |
49 | #include "koviewmanager.h" | 49 | #include "koviewmanager.h" |
50 | 50 | ||
51 | #include <libkcal/calendar.h> | 51 | #include <libkcal/calendar.h> |
52 | #include <libkcal/icaldrag.h> | 52 | #include <libkcal/icaldrag.h> |
53 | #include <libkcal/dndfactory.h> | 53 | #include <libkcal/dndfactory.h> |
54 | 54 | ||
55 | #include <kcalendarsystem.h> | 55 | #include <kcalendarsystem.h> |
56 | 56 | ||
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #ifndef KORG_NOPLUGINS | 58 | #ifndef KORG_NOPLUGINS |
59 | #include "kocore.h" | 59 | #include "kocore.h" |
60 | #endif | 60 | #endif |
61 | #include "koprefs.h" | 61 | #include "koprefs.h" |
62 | #include "koagenda.h" | 62 | #include "koagenda.h" |
63 | #include "koagendaitem.h" | 63 | #include "koagendaitem.h" |
64 | #ifndef KORG_NOPRINTER | 64 | #ifndef KORG_NOPRINTER |
65 | #include "calprinter.h" | 65 | #include "calprinter.h" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include "koagendaview.h" | 68 | #include "koagendaview.h" |
69 | //#include "koagendaview.moc" | 69 | //#include "koagendaview.moc" |
70 | 70 | ||
71 | //extern bool globalFlagBlockPainting; | 71 | //extern bool globalFlagBlockPainting; |
72 | extern int globalFlagBlockAgenda; | 72 | extern int globalFlagBlockAgenda; |
73 | extern int globalFlagBlockStartup; | 73 | extern int globalFlagBlockStartup; |
74 | extern int globalFlagBlockAgendaItemPaint; | 74 | extern int globalFlagBlockAgendaItemPaint; |
75 | extern int globalFlagBlockAgendaItemUpdate; | 75 | extern int globalFlagBlockAgendaItemUpdate; |
76 | extern int globalFlagBlockLabel; | 76 | extern int globalFlagBlockLabel; |
77 | using namespace KOrg; | 77 | using namespace KOrg; |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : |
82 | QScrollView(parent,name,f) | 82 | QScrollView(parent,name,f) |
83 | { | 83 | { |
84 | myPix.resize( 1, 1 ); | 84 | myPix.resize( 1, 1 ); |
85 | mRows = rows; | 85 | mRows = rows; |
86 | 86 | ||
87 | mRedrawNeeded = true; | 87 | mRedrawNeeded = true; |
88 | setMinimumHeight( 20 ); | 88 | setMinimumHeight( 20 ); |
89 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 89 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
90 | 90 | ||
91 | enableClipper(true); | 91 | enableClipper(true); |
92 | 92 | ||
93 | setHScrollBarMode(AlwaysOff); | 93 | setHScrollBarMode(AlwaysOff); |
94 | setVScrollBarMode(AlwaysOff); | 94 | setVScrollBarMode(AlwaysOff); |
95 | 95 | ||
96 | resizeContents(50,mRows * mCellHeight); | 96 | resizeContents(50,mRows * mCellHeight); |
97 | 97 | ||
98 | viewport()->setBackgroundMode( PaletteBackground ); | 98 | viewport()->setBackgroundMode( PaletteBackground ); |
99 | } | 99 | } |
100 | 100 | ||
101 | void TimeLabels::setCellHeight(int height) | 101 | void TimeLabels::setCellHeight(int height) |
102 | { | 102 | { |
103 | mCellHeight = height; | 103 | mCellHeight = height; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | 106 | /* |
107 | Optimization so that only the "dirty" portion of the scroll view | 107 | Optimization so that only the "dirty" portion of the scroll view |
108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
109 | */ | 109 | */ |
110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
111 | { | 111 | { |
112 | 112 | ||
113 | // if ( globalFlagBlockAgenda ) | 113 | // if ( globalFlagBlockAgenda ) |
114 | // return; | 114 | // return; |
115 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 115 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
116 | // redrawn, not the area of the widget. unfortunately, this | 116 | // redrawn, not the area of the widget. unfortunately, this |
117 | // code assumes the latter... | 117 | // code assumes the latter... |
118 | 118 | ||
119 | // now, for a workaround... | 119 | // now, for a workaround... |
120 | // these two assignments fix the weird redraw bug | 120 | // these two assignments fix the weird redraw bug |
121 | mRedrawNeeded = true; | 121 | mRedrawNeeded = true; |
122 | if ( mRedrawNeeded ) { | 122 | if ( mRedrawNeeded ) { |
123 | cx = contentsX() + frameWidth()*2; | 123 | cx = contentsX() + frameWidth()*2; |
124 | cw = contentsWidth() ; | 124 | cw = contentsWidth() ; |
125 | // end of workaround | 125 | // end of workaround |
126 | 126 | ||
127 | int cell = ((int)(cy/mCellHeight)); | 127 | int cell = ((int)(cy/mCellHeight)); |
128 | int y = cell * mCellHeight; | 128 | int y = cell * mCellHeight; |
129 | QFontMetrics fm = fontMetrics(); | 129 | QFontMetrics fm = fontMetrics(); |
130 | QString hour; | 130 | QString hour; |
131 | QString suffix; | 131 | QString suffix; |
132 | int timeHeight = fm.ascent(); | 132 | int timeHeight = fm.ascent(); |
133 | QFont nFont = p->font(); | 133 | QFont nFont = p->font(); |
134 | 134 | ||
135 | if (!KGlobal::locale()->use12Clock()) | 135 | if (!KGlobal::locale()->use12Clock()) |
136 | suffix = "00"; | 136 | suffix = "00"; |
137 | 137 | ||
138 | if ( timeHeight > mCellHeight ) { | 138 | if ( timeHeight > mCellHeight ) { |
139 | timeHeight = mCellHeight-1; | 139 | timeHeight = mCellHeight-1; |
140 | int pointS = nFont.pointSize(); | 140 | int pointS = nFont.pointSize(); |
141 | while ( pointS > 4 ) { | 141 | while ( pointS > 4 ) { |
142 | nFont.setPointSize( pointS ); | 142 | nFont.setPointSize( pointS ); |
143 | fm = QFontMetrics( nFont ); | 143 | fm = QFontMetrics( nFont ); |
144 | if ( fm.ascent() < mCellHeight ) | 144 | if ( fm.ascent() < mCellHeight ) |
145 | break; | 145 | break; |
146 | -- pointS; | 146 | -- pointS; |
147 | } | 147 | } |
148 | fm = QFontMetrics( nFont ); | 148 | fm = QFontMetrics( nFont ); |
149 | timeHeight = fm.ascent(); | 149 | timeHeight = fm.ascent(); |
150 | } | 150 | } |
151 | //timeHeight -= (timeHeight/4-2); | 151 | //timeHeight -= (timeHeight/4-2); |
152 | QFont sFont = nFont; | 152 | QFont sFont = nFont; |
153 | sFont.setPointSize( sFont.pointSize()/2 ); | 153 | sFont.setPointSize( sFont.pointSize()/2 ); |
154 | QFontMetrics fmS( sFont ); | 154 | QFontMetrics fmS( sFont ); |
155 | int sHei = fmS.ascent() ; | 155 | int sHei = fmS.ascent() ; |
156 | //sHei -= (sHei/4-2); | 156 | //sHei -= (sHei/4-2); |
157 | int startW = this->width() - frameWidth()-2; | 157 | int startW = this->width() - frameWidth()-2; |
158 | int tw2 = fmS.width(suffix); | 158 | int tw2 = fmS.width(suffix); |
159 | while (y < cy + ch) { | 159 | while (y < cy + ch) { |
160 | p->drawLine(cx,y,cw,y); | 160 | p->drawLine(cx,y,cw,y); |
161 | hour.setNum(cell); | 161 | hour.setNum(cell); |
162 | 162 | ||
163 | // handle 24h and am/pm time formats | 163 | // handle 24h and am/pm time formats |
164 | if (KGlobal::locale()->use12Clock()) { | 164 | if (KGlobal::locale()->use12Clock()) { |
165 | if (cell > 11) suffix = "pm"; | 165 | if (cell > 11) suffix = "pm"; |
166 | else | 166 | else |
167 | suffix = "am"; | 167 | suffix = "am"; |
168 | if (cell == 0) hour.setNum(12); | 168 | if (cell == 0) hour.setNum(12); |
169 | if (cell > 12) hour.setNum(cell - 12); | 169 | if (cell > 12) hour.setNum(cell - 12); |
170 | tw2 = fmS.width(suffix); | 170 | tw2 = fmS.width(suffix); |
171 | } | 171 | } |
172 | 172 | ||
173 | // center and draw the time label | 173 | // center and draw the time label |
174 | int timeWidth = fm.width(hour); | 174 | int timeWidth = fm.width(hour); |
175 | int offset = startW - timeWidth - tw2 ; | 175 | int offset = startW - timeWidth - tw2 ; |
176 | p->setFont( nFont ); | 176 | p->setFont( nFont ); |
177 | p->drawText( offset, y+ timeHeight, hour); | 177 | p->drawText( offset, y+ timeHeight, hour); |
178 | p->setFont( sFont ); | 178 | p->setFont( sFont ); |
179 | offset = startW - tw2+1; | 179 | offset = startW - tw2+1; |
180 | p->drawText( offset, y+ sHei, suffix); | 180 | p->drawText( offset, y+ sHei, suffix); |
181 | 181 | ||
182 | // increment indices | 182 | // increment indices |
183 | y += mCellHeight; | 183 | y += mCellHeight; |
184 | cell++; | 184 | cell++; |
185 | } | 185 | } |
186 | } else { | 186 | } else { |
187 | //qDebug("NO redraw "); | 187 | //qDebug("NO redraw "); |
188 | } | 188 | } |
189 | // double buffer not yet implemented | 189 | // double buffer not yet implemented |
190 | //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | 190 | //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); |
191 | //mRedrawNeeded = false; | 191 | //mRedrawNeeded = false; |
192 | } | 192 | } |
193 | 193 | ||
194 | /** | 194 | /** |
195 | Calculates the minimum width. | 195 | Calculates the minimum width. |
196 | */ | 196 | */ |
197 | int TimeLabels::minimumWidth() const | 197 | int TimeLabels::minimumWidth() const |
198 | { | 198 | { |
199 | return mMiniWidth; | 199 | return mMiniWidth; |
200 | } | 200 | } |
201 | 201 | ||
202 | /** updates widget's internal state */ | 202 | /** updates widget's internal state */ |
203 | void TimeLabels::updateConfig() | 203 | void TimeLabels::updateConfig() |
204 | { | 204 | { |
205 | mRedrawNeeded = true; | 205 | mRedrawNeeded = true; |
206 | // set the font | 206 | // set the font |
207 | // config->setGroup("Fonts"); | 207 | // config->setGroup("Fonts"); |
208 | // QFont font = config->readFontEntry("TimeBar Font"); | 208 | // QFont font = config->readFontEntry("TimeBar Font"); |
209 | setFont(KOPrefs::instance()->mTimeBarFont); | 209 | setFont(KOPrefs::instance()->mTimeBarFont); |
210 | QString test = "20"; | 210 | QString test = "20"; |
211 | if (KGlobal::locale()->use12Clock()) | 211 | if (KGlobal::locale()->use12Clock()) |
212 | test = "12"; | 212 | test = "12"; |
213 | mMiniWidth = fontMetrics().width(test); | 213 | mMiniWidth = fontMetrics().width(test); |
214 | if (KGlobal::locale()->use12Clock()) | 214 | if (KGlobal::locale()->use12Clock()) |
215 | test = "pm"; | 215 | test = "pm"; |
216 | else | 216 | else |
217 | test = "00"; | 217 | test = "00"; |
218 | QFont sFont = font(); | 218 | QFont sFont = font(); |
219 | sFont.setPointSize( sFont.pointSize()/2 ); | 219 | sFont.setPointSize( sFont.pointSize()/2 ); |
220 | QFontMetrics fmS( sFont ); | 220 | QFontMetrics fmS( sFont ); |
221 | mMiniWidth += fmS.width( test ) + frameWidth()*2 +4 ; | 221 | mMiniWidth += fmS.width( test ) + frameWidth()*2 +4 ; |
222 | // update geometry restrictions based on new settings | 222 | // update geometry restrictions based on new settings |
223 | setFixedWidth( mMiniWidth ); | 223 | setFixedWidth( mMiniWidth ); |
224 | 224 | ||
225 | // update HourSize | 225 | // update HourSize |
226 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 226 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
227 | resizeContents(50,mRows * mCellHeight); | 227 | resizeContents(50,mRows * mCellHeight); |
228 | } | 228 | } |
229 | 229 | ||
230 | /** update time label positions */ | 230 | /** update time label positions */ |
231 | void TimeLabels::positionChanged() | 231 | void TimeLabels::positionChanged() |
232 | { | 232 | { |
233 | int adjustment = mAgenda->contentsY(); | 233 | int adjustment = mAgenda->contentsY(); |
234 | setContentsPos(0, adjustment); | 234 | setContentsPos(0, adjustment); |
235 | } | 235 | } |
236 | 236 | ||
237 | /** */ | 237 | /** */ |
238 | void TimeLabels::setAgenda(KOAgenda* agenda) | 238 | void TimeLabels::setAgenda(KOAgenda* agenda) |
239 | { | 239 | { |
240 | mAgenda = agenda; | 240 | mAgenda = agenda; |
241 | } | 241 | } |
242 | 242 | ||
243 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 243 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
244 | { | 244 | { |
245 | mMouseDownY = e->pos().y(); | 245 | mMouseDownY = e->pos().y(); |
246 | mOrgCap = topLevelWidget()->caption(); | 246 | mOrgCap = topLevelWidget()->caption(); |
247 | } | 247 | } |
248 | 248 | ||
249 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 249 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
250 | { | 250 | { |
251 | int diff = mMouseDownY - e->pos().y(); | 251 | int diff = mMouseDownY - e->pos().y(); |
252 | if ( diff < 10 && diff > -10 ) | 252 | if ( diff < 10 && diff > -10 ) |
253 | return; | 253 | return; |
254 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 254 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
255 | if ( tSize < 4 ) | 255 | if ( tSize < 4 ) |
256 | tSize = 4; | 256 | tSize = 4; |
257 | if ( tSize > 22 ) | 257 | if ( tSize > 22 ) |
258 | tSize = 22; | 258 | tSize = 22; |
259 | tSize = (tSize-2)/2; | 259 | tSize = (tSize-2)/2; |
260 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 260 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
261 | 261 | ||
262 | } | 262 | } |
263 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 263 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
264 | { | 264 | { |
265 | topLevelWidget()->setCaption( mOrgCap ); | 265 | topLevelWidget()->setCaption( mOrgCap ); |
266 | int diff = mMouseDownY - e->pos().y(); | 266 | int diff = mMouseDownY - e->pos().y(); |
267 | if ( diff < 10 && diff > -10 ) | 267 | if ( diff < 10 && diff > -10 ) |
268 | return; | 268 | return; |
269 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 269 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
270 | if ( tSize < 4 ) | 270 | if ( tSize < 4 ) |
271 | tSize = 4; | 271 | tSize = 4; |
272 | if ( tSize > 22 ) | 272 | if ( tSize > 22 ) |
273 | tSize = 22; | 273 | tSize = 22; |
274 | tSize = (tSize/2)*2; | 274 | tSize = (tSize/2)*2; |
275 | if ( tSize == KOPrefs::instance()->mHourSize ) | 275 | if ( tSize == KOPrefs::instance()->mHourSize ) |
276 | return; | 276 | return; |
277 | KOPrefs::instance()->mHourSize = tSize; | 277 | KOPrefs::instance()->mHourSize = tSize; |
278 | emit scaleChanged(); | 278 | emit scaleChanged(); |
279 | } | 279 | } |
280 | 280 | ||
281 | /** This is called in response to repaint() */ | 281 | /** This is called in response to repaint() */ |
282 | void TimeLabels::paintEvent(QPaintEvent*) | 282 | void TimeLabels::paintEvent(QPaintEvent*) |
283 | { | 283 | { |
284 | 284 | ||
285 | // kdDebug() << "paintevent..." << endl; | 285 | // kdDebug() << "paintevent..." << endl; |
286 | // this is another hack! | 286 | // this is another hack! |
287 | // QPainter painter(this); | 287 | // QPainter painter(this); |
288 | //QString c | 288 | //QString c |
289 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 289 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
290 | } | 290 | } |
291 | 291 | ||
292 | //////////////////////////////////////////////////////////////////////////// | 292 | //////////////////////////////////////////////////////////////////////////// |
293 | 293 | ||
294 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 294 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
295 | : QFrame(parent,name) | 295 | : QFrame(parent,name) |
296 | { | 296 | { |
297 | mColumns = 1; | 297 | mColumns = 1; |
298 | mTopBox = 0; | 298 | mTopBox = 0; |
299 | mLocation = loc; | 299 | mLocation = loc; |
300 | mTopLayout = 0; | 300 | mTopLayout = 0; |
301 | mPaintWidget = 0; | 301 | mPaintWidget = 0; |
302 | mXOffset = 0; | 302 | mXOffset = 0; |
303 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 303 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
304 | else mPixmap = SmallIcon("1downarrow"); | 304 | else mPixmap = SmallIcon("1downarrow"); |
305 | mEnabled.resize(mColumns); | 305 | mEnabled.resize(mColumns); |
306 | mEnabled.fill( false ); | 306 | mEnabled.fill( false ); |
307 | setMinimumHeight(mPixmap.height()); | 307 | setMinimumHeight(mPixmap.height()); |
308 | } | 308 | } |
309 | 309 | ||
310 | EventIndicator::~EventIndicator() | 310 | EventIndicator::~EventIndicator() |
311 | { | 311 | { |
312 | } | 312 | } |
313 | 313 | ||
314 | void EventIndicator::drawContents(QPainter *p) | 314 | void EventIndicator::drawContents(QPainter *p) |
315 | { | 315 | { |
316 | 316 | ||
317 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 317 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
318 | KDGanttSplitterHandle* han = 0; | 318 | KDGanttSplitterHandle* han = 0; |
319 | if ( mPaintWidget ) | 319 | if ( mPaintWidget ) |
320 | han = mPaintWidget->firstHandle(); | 320 | han = mPaintWidget->firstHandle(); |
321 | if ( ! han ) { | 321 | if ( ! han ) { |
322 | int i; | 322 | int i; |
323 | for(i=0;i<mColumns;++i) { | 323 | for(i=0;i<mColumns;++i) { |
324 | if (mEnabled[i]) { | 324 | if (mEnabled[i]) { |
325 | int cellWidth = contentsRect().right()/mColumns; | 325 | int cellWidth = contentsRect().right()/mColumns; |
326 | int xOffset = KOGlobals::self()->reverseLayout() ? | 326 | int xOffset = KOGlobals::self()->reverseLayout() ? |
327 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : | 327 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : |
328 | i*cellWidth + (cellWidth -mPixmap.width()) /2; | 328 | i*cellWidth + (cellWidth -mPixmap.width()) /2; |
329 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); | 329 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); |
330 | } | 330 | } |
331 | } | 331 | } |
332 | } else { | 332 | } else { |
333 | han->repaint(); | 333 | han->repaint(); |
334 | //mPaintWidget->setBackgroundColor( red ); | 334 | //mPaintWidget->setBackgroundColor( red ); |
335 | 335 | ||
336 | QPainter pa( han ); | 336 | QPainter pa( han ); |
337 | int i; | 337 | int i; |
338 | bool setColor = false; | 338 | bool setColor = false; |
339 | for(i=0;i<mColumns;++i) { | 339 | for(i=0;i<mColumns;++i) { |
340 | if (mEnabled[i]) { | 340 | if (mEnabled[i]) { |
341 | setColor = true; | 341 | setColor = true; |
342 | 342 | ||
343 | int cellWidth = contentsRect().right()/mColumns; | 343 | int cellWidth = contentsRect().right()/mColumns; |
344 | int xOffset = KOGlobals::self()->reverseLayout() ? | 344 | int xOffset = KOGlobals::self()->reverseLayout() ? |
345 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 345 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
346 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 346 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
347 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 347 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
348 | //qDebug("222draw pix %d ",xOffset ); | 348 | //qDebug("222draw pix %d ",xOffset ); |
349 | 349 | ||
350 | } | 350 | } |
351 | 351 | ||
352 | } | 352 | } |
353 | pa.end(); | 353 | pa.end(); |
354 | 354 | ||
355 | } | 355 | } |
356 | } | 356 | } |
357 | 357 | ||
358 | void EventIndicator::setXOffset( int x ) | 358 | void EventIndicator::setXOffset( int x ) |
359 | { | 359 | { |
360 | mXOffset = x; | 360 | mXOffset = x; |
361 | } | 361 | } |
362 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 362 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
363 | { | 363 | { |
364 | mPaintWidget = w; | 364 | mPaintWidget = w; |
365 | setMaximumHeight(0); | 365 | setMaximumHeight(0); |
366 | setMinimumHeight(0); | 366 | setMinimumHeight(0); |
367 | } | 367 | } |
368 | void EventIndicator::changeColumns(int columns) | 368 | void EventIndicator::changeColumns(int columns) |
369 | { | 369 | { |
370 | mColumns = columns; | 370 | mColumns = columns; |
371 | mEnabled.resize(mColumns); | 371 | mEnabled.resize(mColumns); |
372 | 372 | ||
373 | update(); | 373 | update(); |
374 | } | 374 | } |
375 | 375 | ||
376 | void EventIndicator::enableColumn(int column, bool enable) | 376 | void EventIndicator::enableColumn(int column, bool enable) |
377 | { | 377 | { |
378 | mEnabled[column] = enable; | 378 | mEnabled[column] = enable; |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | //////////////////////////////////////////////////////////////////////////// | 382 | //////////////////////////////////////////////////////////////////////////// |
383 | //////////////////////////////////////////////////////////////////////////// | 383 | //////////////////////////////////////////////////////////////////////////// |
384 | //////////////////////////////////////////////////////////////////////////// | 384 | //////////////////////////////////////////////////////////////////////////// |
385 | 385 | ||
386 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 386 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
387 | KOEventView (cal,parent,name) | 387 | KOEventView (cal,parent,name) |
388 | { | 388 | { |
389 | mBlockUpdating = true; | 389 | mBlockUpdating = true; |
390 | mStartHour = 8; | 390 | mStartHour = 8; |
391 | mSelectedDates.append(QDate::currentDate()); | 391 | mSelectedDates.append(QDate::currentDate()); |
392 | 392 | ||
393 | mLayoutDayLabels = 0; | 393 | mLayoutDayLabels = 0; |
394 | mDayLabelsFrame = 0; | 394 | mDayLabelsFrame = 0; |
395 | mDayLabels = 0; | 395 | mDayLabels = 0; |
396 | bool isRTL = KOGlobals::self()->reverseLayout(); | 396 | bool isRTL = KOGlobals::self()->reverseLayout(); |
397 | QPixmap expandPix; | 397 | QPixmap expandPix; |
398 | if ( KOPrefs::instance()->mVerticalScreen ) { | 398 | if ( KOPrefs::instance()->mVerticalScreen ) { |
399 | expandPix = SmallIcon( "1updownarrow" ); | 399 | expandPix = SmallIcon( "1updownarrow" ); |
400 | } else { | 400 | } else { |
401 | expandPix = SmallIcon("1leftrightarrow" ); | 401 | expandPix = SmallIcon("1leftrightarrow" ); |
402 | } | 402 | } |
403 | 403 | ||
404 | QBoxLayout *topLayout = new QVBoxLayout(this); | 404 | QBoxLayout *topLayout = new QVBoxLayout(this); |
405 | 405 | ||
406 | // Create day name labels for agenda columns | 406 | // Create day name labels for agenda columns |
407 | // Create agenda splitter | 407 | // Create agenda splitter |
408 | 408 | ||
409 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 409 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
410 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 410 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
411 | topLayout->addWidget( mSplitterAgenda ); | 411 | topLayout->addWidget( mSplitterAgenda ); |
412 | mAllDayFrame = new QHBox(mSplitterAgenda); | 412 | mAllDayFrame = new QHBox(mSplitterAgenda); |
413 | mAllDayFrame->setFocusPolicy(NoFocus); | 413 | mAllDayFrame->setFocusPolicy(NoFocus); |
414 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 414 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
415 | agendaFrame->setFocusPolicy(NoFocus); | 415 | agendaFrame->setFocusPolicy(NoFocus); |
416 | 416 | ||
417 | // Create all-day agenda widget | 417 | // Create all-day agenda widget |
418 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 418 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
419 | 419 | ||
420 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 420 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
421 | mExpandButton->setPixmap( expandPix ); | 421 | mExpandButton->setPixmap( expandPix ); |
422 | int widebut = mExpandButton->sizeHint().width()+4; | 422 | int widebut = mExpandButton->sizeHint().width()+4; |
423 | int heibut = mExpandButton->sizeHint().height()+4; | 423 | int heibut = mExpandButton->sizeHint().height()+4; |
424 | if ( heibut > widebut ) | 424 | if ( heibut > widebut ) |
425 | widebut = heibut ; | 425 | widebut = heibut ; |
426 | 426 | ||
427 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 427 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
428 | // QSizePolicy::Fixed ) ); | 428 | // QSizePolicy::Fixed ) ); |
429 | mExpandButton->setFixedSize( widebut, widebut); | 429 | mExpandButton->setFixedSize( widebut, widebut); |
430 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 430 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
431 | mExpandButton->setFocusPolicy(NoFocus); | 431 | mExpandButton->setFocusPolicy(NoFocus); |
432 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 432 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
433 | mAllDayAgenda->setFocusPolicy(NoFocus); | 433 | mAllDayAgenda->setFocusPolicy(NoFocus); |
434 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 434 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
435 | 435 | ||
436 | // Create event context menu for all day agenda | 436 | // Create event context menu for all day agenda |
437 | mAllDayAgendaPopup = eventPopup(); | 437 | mAllDayAgendaPopup = eventPopup(); |
438 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 438 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
439 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 439 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
440 | 440 | ||
441 | // Create agenda frame | 441 | // Create agenda frame |
442 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 442 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
443 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 443 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
444 | 444 | ||
445 | // create event indicator bars | 445 | // create event indicator bars |
446 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 446 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
447 | #ifndef DESKTOP_VERSION | 447 | #ifndef DESKTOP_VERSION |
448 | // FIX | 448 | // FIX |
449 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 449 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
450 | #endif | 450 | #endif |
451 | mDayLabelsFrame = new QHBox(agendaFrame); | 451 | mDayLabelsFrame = new QHBox(agendaFrame); |
452 | //topLayout->addWidget(mDayLabelsFrame); | 452 | //topLayout->addWidget(mDayLabelsFrame); |
453 | mDayLabels = new QFrame (mDayLabelsFrame); | 453 | mDayLabels = new QFrame (mDayLabelsFrame); |
454 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 454 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
455 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 455 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
456 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 456 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
457 | 457 | ||
458 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 458 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
459 | agendaFrame); | 459 | agendaFrame); |
460 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 460 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
461 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 461 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
462 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 462 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
463 | 463 | ||
464 | // Create time labels | 464 | // Create time labels |
465 | mTimeLabels = new TimeLabels(24,agendaFrame); | 465 | mTimeLabels = new TimeLabels(24,agendaFrame); |
466 | agendaLayout->addWidget(mTimeLabels,2,0); | 466 | agendaLayout->addWidget(mTimeLabels,2,0); |
467 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 467 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
468 | this,SLOT(updateConfig())); | 468 | this,SLOT(updateConfig())); |
469 | 469 | ||
470 | // Create agenda | 470 | // Create agenda |
471 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 471 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
472 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 472 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
473 | agendaLayout->setColStretch(1,1); | 473 | agendaLayout->setColStretch(1,1); |
474 | mAgenda->setFocusPolicy(NoFocus); | 474 | mAgenda->setFocusPolicy(NoFocus); |
475 | // Create event context menu for agenda | 475 | // Create event context menu for agenda |
476 | mAgendaPopup = eventPopup(); | 476 | mAgendaPopup = eventPopup(); |
477 | 477 | ||
478 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 478 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
479 | i18n("Toggle Alarm"),mAgenda, | 479 | i18n("Toggle Alarm"),mAgenda, |
480 | SLOT(popupAlarm()),true); | 480 | SLOT(popupAlarm()),true); |
481 | 481 | ||
482 | 482 | ||
483 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 483 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
484 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 484 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
485 | 485 | ||
486 | // make connections between dependent widgets | 486 | // make connections between dependent widgets |
487 | mTimeLabels->setAgenda(mAgenda); | 487 | mTimeLabels->setAgenda(mAgenda); |
488 | 488 | ||
489 | // Update widgets to reflect user preferences | 489 | // Update widgets to reflect user preferences |
490 | // updateConfig(); | 490 | // updateConfig(); |
491 | 491 | ||
492 | // createDayLabels(); | 492 | // createDayLabels(); |
493 | 493 | ||
494 | // these blank widgets make the All Day Event box line up with the agenda | 494 | // these blank widgets make the All Day Event box line up with the agenda |
495 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 495 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
496 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 496 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
497 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 497 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
498 | 498 | ||
499 | // Scrolling | 499 | // Scrolling |
500 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 500 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
501 | mTimeLabels, SLOT(positionChanged())); | 501 | mTimeLabels, SLOT(positionChanged())); |
502 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 502 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
503 | SLOT(setContentsPos(int))); | 503 | SLOT(setContentsPos(int))); |
504 | 504 | ||
505 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); | 505 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); |
506 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); | 506 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); |
507 | 507 | ||
508 | // Create/Show/Edit/Delete Event | 508 | // Create/Show/Edit/Delete Event |
509 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 509 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
510 | SLOT(newEvent(int,int))); | 510 | SLOT(newEvent(int,int))); |
511 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 511 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
512 | SLOT(newTodo(int,int))); | 512 | SLOT(newTodo(int,int))); |
513 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 513 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
514 | SLOT(newEvent(int,int,int,int))); | 514 | SLOT(newEvent(int,int,int,int))); |
515 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 515 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
516 | SLOT(newEventAllDay(int,int))); | 516 | SLOT(newEventAllDay(int,int))); |
517 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 517 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
518 | SLOT(newTodoAllDay(int,int))); | 518 | SLOT(newTodoAllDay(int,int))); |
519 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 519 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
520 | SLOT(newEventAllDay(int,int))); | 520 | SLOT(newEventAllDay(int,int))); |
521 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 521 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
522 | SLOT(newTimeSpanSelected(int,int,int,int))); | 522 | SLOT(newTimeSpanSelected(int,int,int,int))); |
523 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 523 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
524 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 524 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
525 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 525 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
526 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 526 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
527 | 527 | ||
528 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 528 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
529 | SIGNAL(editIncidenceSignal(Incidence *))); | 529 | SIGNAL(editIncidenceSignal(Incidence *))); |
530 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 530 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
531 | SIGNAL(editIncidenceSignal(Incidence *))); | 531 | SIGNAL(editIncidenceSignal(Incidence *))); |
532 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 532 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
533 | SIGNAL(showIncidenceSignal(Incidence *))); | 533 | SIGNAL(showIncidenceSignal(Incidence *))); |
534 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 534 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
535 | SIGNAL(showIncidenceSignal(Incidence *))); | 535 | SIGNAL(showIncidenceSignal(Incidence *))); |
536 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 536 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
537 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 537 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
538 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 538 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
539 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 539 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
540 | 540 | ||
541 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 541 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
542 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 542 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
543 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 543 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
544 | SLOT(updateEventDates(KOAgendaItem *, int))); | 544 | SLOT(updateEventDates(KOAgendaItem *, int))); |
545 | 545 | ||
546 | // event indicator update | 546 | // event indicator update |
547 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 547 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
548 | SLOT(updateEventIndicatorTop(int))); | 548 | SLOT(updateEventIndicatorTop(int))); |
549 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 549 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
550 | SLOT(updateEventIndicatorBottom(int))); | 550 | SLOT(updateEventIndicatorBottom(int))); |
551 | // drag signals | 551 | // drag signals |
552 | /* | 552 | /* |
553 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 553 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
554 | SLOT(startDrag(Event *))); | 554 | SLOT(startDrag(Event *))); |
555 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 555 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
556 | SLOT(startDrag(Event *))); | 556 | SLOT(startDrag(Event *))); |
557 | */ | 557 | */ |
558 | // synchronize selections | 558 | // synchronize selections |
559 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 559 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
560 | mAllDayAgenda, SLOT( deselectItem() ) ); | 560 | mAllDayAgenda, SLOT( deselectItem() ) ); |
561 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 561 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
562 | mAgenda, SLOT( deselectItem() ) ); | 562 | mAgenda, SLOT( deselectItem() ) ); |
563 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 563 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
564 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 564 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
565 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 565 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
566 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 566 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
567 | connect( mAgenda, SIGNAL( resizedSignal() ), | 567 | connect( mAgenda, SIGNAL( resizedSignal() ), |
568 | SLOT( updateConfig( ) ) ); | 568 | SLOT( updateConfig( ) ) ); |
569 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 569 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
570 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 570 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
571 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 571 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
572 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 572 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
573 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 573 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
574 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 574 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
575 | 575 | ||
576 | 576 | ||
577 | } | 577 | } |
578 | 578 | ||
579 | void KOAgendaView::toggleAllDay() | 579 | void KOAgendaView::toggleAllDay() |
580 | { | 580 | { |
581 | if ( mSplitterAgenda->firstHandle() ) | 581 | if ( mSplitterAgenda->firstHandle() ) |
582 | mSplitterAgenda->firstHandle()->toggle(); | 582 | mSplitterAgenda->firstHandle()->toggle(); |
583 | } | 583 | } |
584 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 584 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
585 | { | 585 | { |
586 | calendar()->addIncidence( inc ); | 586 | calendar()->addIncidence( inc ); |
587 | 587 | ||
588 | if ( incOld ) { | 588 | if ( incOld ) { |
589 | if ( incOld->type() == "Todo" ) | 589 | if ( incOld->type() == "Todo" ) |
590 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 590 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
591 | else | 591 | else |
592 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 592 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
593 | } | 593 | } |
594 | 594 | ||
595 | } | 595 | } |
596 | 596 | ||
597 | KOAgendaView::~KOAgendaView() | 597 | KOAgendaView::~KOAgendaView() |
598 | { | 598 | { |
599 | delete mAgendaPopup; | 599 | delete mAgendaPopup; |
600 | delete mAllDayAgendaPopup; | 600 | delete mAllDayAgendaPopup; |
601 | delete KOAgendaItem::paintPix(); | 601 | delete KOAgendaItem::paintPix(); |
602 | delete KOAgendaItem::paintPixSel(); | 602 | delete KOAgendaItem::paintPixSel(); |
603 | } | 603 | } |
604 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 604 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
605 | { | 605 | { |
606 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 606 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
607 | bool uc = false; | 607 | bool uc = false; |
608 | int ow = e->oldSize().width(); | 608 | int ow = e->oldSize().width(); |
609 | int oh = e->oldSize().height(); | 609 | int oh = e->oldSize().height(); |
610 | int w = e->size().width(); | 610 | int w = e->size().width(); |
611 | int h = e->size().height(); | 611 | int h = e->size().height(); |
612 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 612 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
613 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 613 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
614 | uc = true; | 614 | uc = true; |
615 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 615 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
616 | } | 616 | } |
617 | mUpcomingWidth = e->size().width() ; | 617 | mUpcomingWidth = e->size().width() ; |
618 | if ( mBlockUpdating || uc ) { | 618 | if ( mBlockUpdating || uc ) { |
619 | mBlockUpdating = false; | 619 | mBlockUpdating = false; |
620 | //mAgenda->setMinimumSize(800 , 600 ); | 620 | //mAgenda->setMinimumSize(800 , 600 ); |
621 | //qDebug("mAgenda->resize+++++++++++++++ "); | 621 | //qDebug("mAgenda->resize+++++++++++++++ "); |
622 | updateConfig(); | 622 | updateConfig(); |
623 | //qDebug("KOAgendaView::Updating now possible "); | 623 | //qDebug("KOAgendaView::Updating now possible "); |
624 | } else | 624 | } else |
625 | createDayLabels(); | 625 | createDayLabels(); |
626 | //qDebug("resizeEvent end "); | 626 | //qDebug("resizeEvent end "); |
627 | 627 | ||
628 | } | 628 | } |
629 | void KOAgendaView::slotDaylabelClicked( int num ) | 629 | void KOAgendaView::slotDaylabelClicked( int num ) |
630 | { | 630 | { |
631 | 631 | ||
632 | QDate firstDate = mSelectedDates.first(); | 632 | QDate firstDate = mSelectedDates.first(); |
633 | if ( num == -1 ) | 633 | if ( num == -1 ) |
634 | emit showDateView( 6, firstDate ); | 634 | emit showDateView( 6, firstDate ); |
635 | else if (num >= 0 ) { | 635 | else if (num >= 0 ) { |
636 | if ( mSelectedDates.count() == 1) | 636 | if ( mSelectedDates.count() == 1) |
637 | emit showDateView( 9, firstDate.addDays( num ) ); | 637 | emit showDateView( 9, firstDate.addDays( num ) ); |
638 | else | 638 | else |
639 | emit showDateView( 3, firstDate.addDays( num ) ); | 639 | emit showDateView( 3, firstDate.addDays( num ) ); |
640 | } | 640 | } |
641 | else | 641 | else |
642 | showDateView( 10, firstDate.addDays(1) ); | 642 | showDateView( 10, firstDate.addDays(1) ); |
643 | } | 643 | } |
644 | 644 | ||
645 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 645 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
646 | { | 646 | { |
647 | 647 | ||
648 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 648 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
649 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 649 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
650 | mDayLabelsList.append( dayLabel ); | 650 | mDayLabelsList.append( dayLabel ); |
651 | mLayoutDayLabels->addWidget(dayLabel); | 651 | mLayoutDayLabels->addWidget(dayLabel); |
652 | return dayLabel ; | 652 | return dayLabel ; |
653 | } | 653 | } |
654 | 654 | ||
655 | void KOAgendaView::createDayLabels() | 655 | void KOAgendaView::createDayLabels() |
656 | { | 656 | { |
657 | 657 | ||
658 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 658 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
659 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 659 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
660 | return; | 660 | return; |
661 | 661 | ||
662 | } | 662 | } |
663 | int newHight; | 663 | int newHight; |
664 | 664 | ||
665 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 665 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
666 | // It would remove some flickering and gain speed (since this is called by | 666 | // It would remove some flickering and gain speed (since this is called by |
667 | // each updateView() call) | 667 | // each updateView() call) |
668 | 668 | ||
669 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 669 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; |
670 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 670 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
671 | if ( maxWid < 0 ) | 671 | if ( maxWid < 0 ) |
672 | maxWid = 20; | 672 | maxWid = 20; |
673 | 673 | ||
674 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 674 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
675 | QFontMetrics fm ( dlf ); | 675 | QFontMetrics fm ( dlf ); |
676 | int selCount = mSelectedDates.count(); | 676 | int selCount = mSelectedDates.count(); |
677 | QString dayTest = "Mon 20"; | 677 | QString dayTest = "Mon 20"; |
678 | //QString dayTest = "Mon 20"; | 678 | //QString dayTest = "Mon 20"; |
679 | int wid = fm.width( dayTest ); | 679 | int wid = fm.width( dayTest ); |
680 | //maxWid -= ( selCount * 3 ); //working for QLabels | 680 | //maxWid -= ( selCount * 3 ); //working for QLabels |
681 | maxWid -= ( selCount * 3 ); //working for QPushButton | 681 | maxWid -= ( selCount * 3 ); //working for QPushButton |
682 | if ( maxWid < 0 ) | 682 | if ( maxWid < 0 ) |
683 | maxWid = 20; | 683 | maxWid = 20; |
684 | int needWid = wid * selCount; | 684 | int needWid = wid * selCount; |
685 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 685 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
686 | //if ( needWid > maxWid ) | 686 | //if ( needWid > maxWid ) |
687 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 687 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
688 | while ( needWid > maxWid ) { | 688 | while ( needWid > maxWid ) { |
689 | dayTest = dayTest.left( dayTest.length() - 1 ); | 689 | dayTest = dayTest.left( dayTest.length() - 1 ); |
690 | wid = fm.width( dayTest ); | 690 | wid = fm.width( dayTest ); |
691 | needWid = wid * selCount; | 691 | needWid = wid * selCount; |
692 | } | 692 | } |
693 | int maxLen = dayTest.length(); | 693 | int maxLen = dayTest.length(); |
694 | int fontPoint = dlf.pointSize(); | 694 | int fontPoint = dlf.pointSize(); |
695 | if ( maxLen < 2 ) { | 695 | if ( maxLen < 2 ) { |
696 | int fontPoint = dlf.pointSize(); | 696 | int fontPoint = dlf.pointSize(); |
697 | while ( fontPoint > 4 ) { | 697 | while ( fontPoint > 4 ) { |
698 | --fontPoint; | 698 | --fontPoint; |
699 | dlf.setPointSize( fontPoint ); | 699 | dlf.setPointSize( fontPoint ); |
700 | QFontMetrics f( dlf ); | 700 | QFontMetrics f( dlf ); |
701 | wid = f.width( "30" ); | 701 | wid = f.width( "30" ); |
702 | needWid = wid * selCount; | 702 | needWid = wid * selCount; |
703 | if ( needWid < maxWid ) | 703 | if ( needWid < maxWid ) |
704 | break; | 704 | break; |
705 | } | 705 | } |
706 | maxLen = 2; | 706 | maxLen = 2; |
707 | } | 707 | } |
708 | //qDebug("Max len %d ", dayTest.length() ); | 708 | //qDebug("Max len %d ", dayTest.length() ); |
709 | 709 | ||
710 | QFontMetrics tempF( dlf ); | 710 | QFontMetrics tempF( dlf ); |
711 | newHight = tempF.height(); | 711 | newHight = tempF.height(); |
712 | mDayLabels->setFont( dlf ); | 712 | mDayLabels->setFont( dlf ); |
713 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 713 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
714 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 714 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
715 | //mLayoutDayLabels->addSpacing( 2 ); | 715 | //mLayoutDayLabels->addSpacing( 2 ); |
716 | // QFont lFont = dlf; | 716 | // QFont lFont = dlf; |
717 | bool appendLabels = false; | 717 | bool appendLabels = false; |
718 | KOAgendaButton *dayLabel; | 718 | KOAgendaButton *dayLabel; |
719 | dayLabel = mDayLabelsList.first(); | 719 | dayLabel = mDayLabelsList.first(); |
720 | if ( !dayLabel ) { | 720 | if ( !dayLabel ) { |
721 | appendLabels = true; | 721 | appendLabels = true; |
722 | dayLabel = getNewDaylabel(); | 722 | dayLabel = getNewDaylabel(); |
723 | } | 723 | } |
724 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); | 724 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); |
725 | dayLabel->setFont( dlf ); | 725 | dayLabel->setFont( dlf ); |
726 | dayLabel->setNum( -1 ); | 726 | dayLabel->setNum( -1 ); |
727 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 727 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
728 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 728 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
729 | dayLabel->show(); | 729 | dayLabel->show(); |
730 | DateList::ConstIterator dit; | 730 | DateList::ConstIterator dit; |
731 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 731 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
732 | int counter = -1; | 732 | int counter = -1; |
733 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 733 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
734 | ++counter; | 734 | ++counter; |
735 | QDate date = *dit; | 735 | QDate date = *dit; |
736 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 736 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
737 | if ( ! appendLabels ) { | 737 | if ( ! appendLabels ) { |
738 | dayLabel = mDayLabelsList.next(); | 738 | dayLabel = mDayLabelsList.next(); |
739 | if ( !dayLabel ) | 739 | if ( !dayLabel ) |
740 | appendLabels = true; | 740 | appendLabels = true; |
741 | } | 741 | } |
742 | if ( appendLabels ) { | 742 | if ( appendLabels ) { |
743 | dayLabel = getNewDaylabel(); | 743 | dayLabel = getNewDaylabel(); |
744 | } | 744 | } |
745 | dayLabel->setMinimumWidth( 1 ); | 745 | dayLabel->setMinimumWidth( 1 ); |
746 | dayLabel->setMaximumWidth( 10240 ); | 746 | dayLabel->setMaximumWidth( 10240 ); |
747 | dayLabel->setFont( dlf ); | 747 | dayLabel->setFont( dlf ); |
748 | dayLabel->show(); | 748 | dayLabel->show(); |
749 | dayLabel->setAutoRepeat( false ); | 749 | dayLabel->setAutoRepeat( false ); |
750 | dayLabel->setNum( counter ); | 750 | dayLabel->setNum( counter ); |
751 | QString str; | 751 | QString str; |
752 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 752 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
753 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 753 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
754 | switch ( maxLen ) { | 754 | switch ( maxLen ) { |
755 | case 2: | 755 | case 2: |
756 | str = QString::number( date.day() ); | 756 | str = QString::number( date.day() ); |
757 | break; | 757 | break; |
758 | 758 | ||
759 | case 3: | 759 | case 3: |
760 | str = dayName.left( 1 ) +QString::number( date.day()); | 760 | str = dayName.left( 1 ) +QString::number( date.day()); |
761 | 761 | ||
762 | break; | 762 | break; |
763 | case 4: | 763 | case 4: |
764 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 764 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
765 | 765 | ||
766 | break; | 766 | break; |
767 | case 5: | 767 | case 5: |
768 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 768 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
769 | 769 | ||
770 | break; | 770 | break; |
771 | case 6: | 771 | case 6: |
772 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 772 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
773 | break; | 773 | break; |
774 | 774 | ||
775 | default: | 775 | default: |
776 | break; | 776 | break; |
777 | } | 777 | } |
778 | if ( oneday ) { | 778 | if ( oneday ) { |
779 | QString addString; | 779 | QString addString; |
780 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 780 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
781 | addString = i18n("Today"); | 781 | addString = i18n("Today"); |
782 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 782 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
783 | addString = i18n("Tomorrow"); | 783 | addString = i18n("Tomorrow"); |
784 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 784 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
785 | addString = i18n("Yesterday"); | 785 | addString = i18n("Yesterday"); |
786 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 786 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
787 | addString = i18n("Day before yesterday"); | 787 | addString = i18n("Day before yesterday"); |
788 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 788 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
789 | addString = i18n("Day after tomorrow"); | 789 | addString = i18n("Day after tomorrow"); |
790 | if ( !addString.isEmpty() ) { | 790 | if ( !addString.isEmpty() ) { |
791 | str = addString+", " + str; | 791 | str = addString+", " + str; |
792 | } else { | 792 | } else { |
793 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); | 793 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); |
794 | } | 794 | } |
795 | } | 795 | } |
796 | dayLabel->setText(str); | 796 | dayLabel->setText(str); |
797 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 797 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
798 | if (date == QDate::currentDate()) { | 798 | if (date == QDate::currentDate()) { |
799 | QFont bFont = dlf; | 799 | QFont bFont = dlf; |
800 | bFont.setBold( true ); | 800 | bFont.setBold( true ); |
801 | dayLabel->setFont(bFont); | 801 | dayLabel->setFont(bFont); |
802 | } | 802 | } |
803 | //dayLayout->addWidget(dayLabel); | 803 | //dayLayout->addWidget(dayLabel); |
804 | 804 | ||
805 | #ifndef KORG_NOPLUGINS | 805 | #ifndef KORG_NOPLUGINS |
806 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 806 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
807 | CalendarDecoration *it; | 807 | CalendarDecoration *it; |
808 | for(it = cds.first(); it; it = cds.next()) { | 808 | for(it = cds.first(); it; it = cds.next()) { |
809 | QString text = it->shortText( date ); | 809 | QString text = it->shortText( date ); |
810 | if ( !text.isEmpty() ) { | 810 | if ( !text.isEmpty() ) { |
811 | QLabel *label = new QLabel(text,mDayLabels); | 811 | QLabel *label = new QLabel(text,mDayLabels); |
812 | label->setAlignment(AlignCenter); | 812 | label->setAlignment(AlignCenter); |
813 | dayLayout->addWidget(label); | 813 | dayLayout->addWidget(label); |
814 | } | 814 | } |
815 | } | 815 | } |
816 | 816 | ||
817 | for(it = cds.first(); it; it = cds.next()) { | 817 | for(it = cds.first(); it; it = cds.next()) { |
818 | QWidget *wid = it->smallWidget(mDayLabels,date); | 818 | QWidget *wid = it->smallWidget(mDayLabels,date); |
819 | if ( wid ) { | 819 | if ( wid ) { |
820 | // wid->setHeight(20); | 820 | // wid->setHeight(20); |
821 | dayLayout->addWidget(wid); | 821 | dayLayout->addWidget(wid); |
822 | } | 822 | } |
823 | } | 823 | } |
824 | #endif | 824 | #endif |
825 | } | 825 | } |
826 | if ( ! appendLabels ) { | 826 | if ( ! appendLabels ) { |
827 | dayLabel = mDayLabelsList.next(); | 827 | dayLabel = mDayLabelsList.next(); |
828 | if ( !dayLabel ) | 828 | if ( !dayLabel ) |
829 | appendLabels = true; | 829 | appendLabels = true; |
830 | } | 830 | } |
831 | if ( appendLabels ) { | 831 | if ( appendLabels ) { |
832 | dayLabel = getNewDaylabel(); | 832 | dayLabel = getNewDaylabel(); |
833 | } | 833 | } |
834 | //dayLabel->hide();//test only | 834 | //dayLabel->hide();//test only |
835 | qDebug("fremwidd %d ", mAgenda->frameWidth()); | 835 | qDebug("fremwidd %d ", mAgenda->frameWidth()); |
836 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()- (mAgenda->frameWidth()*2) ) % mSelectedDates.count() ; | 836 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()- (mAgenda->frameWidth()*2) ) % mSelectedDates.count() ; |
837 | if ( offset < 0 ) offset = 0; | 837 | if ( offset < 0 ) offset = 0; |
838 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 838 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
839 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 839 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
840 | dayLabel->setFont( dlf ); | 840 | dayLabel->setFont( dlf ); |
841 | dayLabel->setAutoRepeat( true ); | 841 | dayLabel->setAutoRepeat( true ); |
842 | dayLabel->show(); | 842 | dayLabel->show(); |
843 | dayLabel->setNum( -2 ); | 843 | dayLabel->setNum( -2 ); |
844 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 844 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
845 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 845 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
846 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 846 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
847 | if ( !appendLabels ) { | 847 | if ( !appendLabels ) { |
848 | dayLabel = mDayLabelsList.next(); | 848 | dayLabel = mDayLabelsList.next(); |
849 | while ( dayLabel ) { | 849 | while ( dayLabel ) { |
850 | //qDebug("!dayLabel %d",dayLabel ); | 850 | //qDebug("!dayLabel %d",dayLabel ); |
851 | dayLabel->hide(); | 851 | dayLabel->hide(); |
852 | dayLabel = mDayLabelsList.next(); | 852 | dayLabel = mDayLabelsList.next(); |
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||
856 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); | 856 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); |
857 | } | 857 | } |
858 | 858 | ||
859 | int KOAgendaView::maxDatesHint() | 859 | int KOAgendaView::maxDatesHint() |
860 | { | 860 | { |
861 | // Not sure about the max number of events, so return 0 for now. | 861 | // Not sure about the max number of events, so return 0 for now. |
862 | return 0; | 862 | return 0; |
863 | } | 863 | } |
864 | 864 | ||
865 | int KOAgendaView::currentDateCount() | 865 | int KOAgendaView::currentDateCount() |
866 | { | 866 | { |
867 | return mSelectedDates.count(); | 867 | return mSelectedDates.count(); |
868 | } | 868 | } |
869 | 869 | ||
870 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 870 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
871 | { | 871 | { |
872 | QPtrList<Incidence> selected; | 872 | QPtrList<Incidence> selected; |
873 | Incidence *incidence; | 873 | Incidence *incidence; |
874 | 874 | ||
875 | incidence = mAgenda->selectedIncidence(); | 875 | incidence = mAgenda->selectedIncidence(); |
876 | if (incidence) selected.append(incidence); | 876 | if (incidence) selected.append(incidence); |
877 | 877 | ||
878 | incidence = mAllDayAgenda->selectedIncidence(); | 878 | incidence = mAllDayAgenda->selectedIncidence(); |
879 | if (incidence) selected.append(incidence); | 879 | if (incidence) selected.append(incidence); |
880 | 880 | ||
881 | return selected; | 881 | return selected; |
882 | } | 882 | } |
883 | 883 | ||
884 | DateList KOAgendaView::selectedDates() | 884 | DateList KOAgendaView::selectedDates() |
885 | { | 885 | { |
886 | DateList selected; | 886 | DateList selected; |
887 | QDate qd; | 887 | QDate qd; |
888 | 888 | ||
889 | qd = mAgenda->selectedIncidenceDate(); | 889 | qd = mAgenda->selectedIncidenceDate(); |
890 | if (qd.isValid()) selected.append(qd); | 890 | if (qd.isValid()) selected.append(qd); |
891 | 891 | ||
892 | qd = mAllDayAgenda->selectedIncidenceDate(); | 892 | qd = mAllDayAgenda->selectedIncidenceDate(); |
893 | if (qd.isValid()) selected.append(qd); | 893 | if (qd.isValid()) selected.append(qd); |
894 | 894 | ||
895 | return selected; | 895 | return selected; |
896 | } | 896 | } |
897 | 897 | ||
898 | 898 | ||
899 | void KOAgendaView::updateView() | 899 | void KOAgendaView::updateView() |
900 | { | 900 | { |
901 | if ( mBlockUpdating ) | 901 | if ( mBlockUpdating ) |
902 | return; | 902 | return; |
903 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 903 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
904 | fillAgenda(); | 904 | fillAgenda(); |
905 | 905 | ||
906 | } | 906 | } |
907 | 907 | ||
908 | 908 | ||
909 | /* | 909 | /* |
910 | Update configuration settings for the agenda view. This method is not | 910 | Update configuration settings for the agenda view. This method is not |
911 | complete. | 911 | complete. |
912 | */ | 912 | */ |
913 | void KOAgendaView::updateConfig() | 913 | void KOAgendaView::updateConfig() |
914 | { | 914 | { |
915 | if ( mBlockUpdating ) | 915 | if ( mBlockUpdating ) |
916 | return; | 916 | return; |
917 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { | 917 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { |
918 | int old = KOPrefs::instance()->mHourSize; | 918 | int old = KOPrefs::instance()->mHourSize; |
919 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; | 919 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; |
920 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); | 920 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); |
921 | } | 921 | } |
922 | 922 | ||
923 | 923 | ||
924 | // update config for children | 924 | // update config for children |
925 | mTimeLabels->updateConfig(); | 925 | mTimeLabels->updateConfig(); |
926 | mAgenda->storePosition(); | 926 | mAgenda->storePosition(); |
927 | mAgenda->updateConfig(); | 927 | mAgenda->updateConfig(); |
928 | mAllDayAgenda->updateConfig(); | 928 | mAllDayAgenda->updateConfig(); |
929 | // widget synchronization | 929 | // widget synchronization |
930 | //TODO: find a better way, maybe signal/slot | 930 | //TODO: find a better way, maybe signal/slot |
931 | mTimeLabels->positionChanged(); | 931 | mTimeLabels->positionChanged(); |
932 | 932 | ||
933 | // for some reason, this needs to be called explicitly | 933 | // for some reason, this needs to be called explicitly |
934 | mTimeLabels->repaint(); | 934 | mTimeLabels->repaint(); |
935 | 935 | ||
936 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 936 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
937 | 937 | ||
938 | // ToolTips displaying summary of events | 938 | // ToolTips displaying summary of events |
939 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 939 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
940 | ->mEnableToolTips); | 940 | ->mEnableToolTips); |
941 | 941 | ||
942 | //setHolidayMasks(); | 942 | //setHolidayMasks(); |
943 | 943 | ||
944 | //createDayLabels(); called by via updateView(); | 944 | //createDayLabels(); called by via updateView(); |
945 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 945 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
946 | updateView(); | 946 | updateView(); |
947 | mAgenda->restorePosition(); | 947 | mAgenda->restorePosition(); |
948 | } | 948 | } |
949 | 949 | ||
950 | 950 | ||
951 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 951 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
952 | { | 952 | { |
953 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 953 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
954 | //qDebug("KOAgendaView::updateEventDates "); | 954 | //qDebug("KOAgendaView::updateEventDates "); |
955 | QDateTime startDt,endDt; | 955 | QDateTime startDt,endDt; |
956 | QDate startDate; | 956 | QDate startDate; |
957 | int lenInSecs; | 957 | int lenInSecs; |
958 | // if ( type == KOAgenda::RESIZETOP ) | 958 | // if ( type == KOAgenda::RESIZETOP ) |
959 | // qDebug("RESIZETOP "); | 959 | // qDebug("RESIZETOP "); |
960 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 960 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
961 | // qDebug("RESIZEBOTTOM "); | 961 | // qDebug("RESIZEBOTTOM "); |
962 | // if ( type == KOAgenda::MOVE ) | 962 | // if ( type == KOAgenda::MOVE ) |
963 | // qDebug("MOVE "); | 963 | // qDebug("MOVE "); |
964 | if ( item->incidence()->type() == "Event" ) { | 964 | if ( item->incidence()->type() == "Event" ) { |
965 | startDt =item->incidence()->dtStart(); | 965 | startDt =item->incidence()->dtStart(); |
966 | endDt = item->incidence()->dtEnd(); | 966 | endDt = item->incidence()->dtEnd(); |
967 | lenInSecs = startDt.secsTo( endDt ); | 967 | lenInSecs = startDt.secsTo( endDt ); |
968 | } | 968 | } |
969 | 969 | ||
970 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 970 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
971 | 971 | ||
972 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 972 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
973 | startDate = mSelectedDates[item->mLastMoveXPos]; | 973 | startDate = mSelectedDates[item->mLastMoveXPos]; |
974 | } else { | 974 | } else { |
975 | if (item->cellX() < 0) { | 975 | if (item->cellX() < 0) { |
976 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 976 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
977 | } else { | 977 | } else { |
978 | startDate = mSelectedDates[item->cellX()]; | 978 | startDate = mSelectedDates[item->cellX()]; |
979 | } | 979 | } |
980 | } | 980 | } |
981 | startDt.setDate(startDate); | 981 | startDt.setDate(startDate); |
982 | 982 | ||
983 | if (item->incidence()->doesFloat()) { | 983 | if (item->incidence()->doesFloat()) { |
984 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 984 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
985 | } else { | 985 | } else { |
986 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 986 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
987 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 987 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
988 | if ( item->incidence()->type() == "Event" ) { | 988 | if ( item->incidence()->type() == "Event" ) { |
989 | if ( type == KOAgenda::MOVE ) { | 989 | if ( type == KOAgenda::MOVE ) { |
990 | endDt = startDt.addSecs(lenInSecs); | 990 | endDt = startDt.addSecs(lenInSecs); |
991 | 991 | ||
992 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 992 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
993 | if (item->lastMultiItem()) { | 993 | if (item->lastMultiItem()) { |
994 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 994 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
995 | endDt.setDate(startDate. | 995 | endDt.setDate(startDate. |
996 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 996 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
997 | } else { | 997 | } else { |
998 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 998 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
999 | endDt.setDate(startDate); | 999 | endDt.setDate(startDate); |
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | } else { | 1002 | } else { |
1003 | // todo | 1003 | // todo |
1004 | if (item->lastMultiItem()) { | 1004 | if (item->lastMultiItem()) { |
1005 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1005 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1006 | endDt.setDate(startDate. | 1006 | endDt.setDate(startDate. |
1007 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1007 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1008 | } else { | 1008 | } else { |
1009 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 1009 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
1010 | if ( item->cellYBottom() > 0 ) | 1010 | if ( item->cellYBottom() > 0 ) |
1011 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1011 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1012 | else | 1012 | else |
1013 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1013 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1014 | endDt.setDate(startDate); | 1014 | endDt.setDate(startDate); |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
1017 | } | 1017 | } |
1018 | if ( item->incidence()->type() == "Event" ) { | 1018 | if ( item->incidence()->type() == "Event" ) { |
1019 | item->incidence()->setDtStart(startDt); | 1019 | item->incidence()->setDtStart(startDt); |
1020 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1020 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1021 | } else if ( item->incidence()->type() == "Todo" ) { | 1021 | } else if ( item->incidence()->type() == "Todo" ) { |
1022 | Todo* to = static_cast<Todo*>(item->incidence()); | 1022 | Todo* to = static_cast<Todo*>(item->incidence()); |
1023 | 1023 | ||
1024 | to->setDtDue(endDt); | 1024 | to->setDtDue(endDt); |
1025 | if ( to->hasStartDate() ) { | 1025 | if ( to->hasStartDate() ) { |
1026 | if (to->dtStart() >= to->dtDue() ) | 1026 | if (to->dtStart() >= to->dtDue() ) |
1027 | to->setDtStart(to->dtDue().addDays( -2 )); | 1027 | to->setDtStart(to->dtDue().addDays( -2 )); |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | } | 1030 | } |
1031 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1031 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1032 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1032 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1033 | item->setItemDate(startDt.date()); | 1033 | item->setItemDate(startDt.date()); |
1034 | //item->updateItem(); | 1034 | //item->updateItem(); |
1035 | if ( item->incidence()->type() == "Todo" ) { | 1035 | if ( item->incidence()->type() == "Todo" ) { |
1036 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1036 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1037 | 1037 | ||
1038 | } | 1038 | } |
1039 | else | 1039 | else |
1040 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1040 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1041 | item->updateItem(); | 1041 | item->updateItem(); |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1044 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1045 | { | 1045 | { |
1046 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1046 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1047 | 1047 | ||
1048 | mSelectedDates.clear(); | 1048 | mSelectedDates.clear(); |
1049 | // qDebug("KOAgendaView::showDates "); | 1049 | // qDebug("KOAgendaView::showDates "); |
1050 | QDate d = start; | 1050 | QDate d = start; |
1051 | while (d <= end) { | 1051 | while (d <= end) { |
1052 | mSelectedDates.append(d); | 1052 | mSelectedDates.append(d); |
1053 | d = d.addDays( 1 ); | 1053 | d = d.addDays( 1 ); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | // and update the view | 1056 | // and update the view |
1057 | fillAgenda(); | 1057 | fillAgenda(); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | 1060 | ||
1061 | void KOAgendaView::showEvents(QPtrList<Event>) | 1061 | void KOAgendaView::showEvents(QPtrList<Event>) |
1062 | { | 1062 | { |
1063 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1063 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | void KOAgendaView::changeEventDisplay(Event *, int) | 1066 | void KOAgendaView::changeEventDisplay(Event *, int) |
1067 | { | 1067 | { |
1068 | // qDebug("KOAgendaView::changeEventDisplay "); | 1068 | // qDebug("KOAgendaView::changeEventDisplay "); |
1069 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1069 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1070 | // this should be re-written to be MUCH smarter. Right now we | 1070 | // this should be re-written to be MUCH smarter. Right now we |
1071 | // are just playing dumb. | 1071 | // are just playing dumb. |
1072 | fillAgenda(); | 1072 | fillAgenda(); |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | void KOAgendaView::fillAgenda(const QDate &) | 1075 | void KOAgendaView::fillAgenda(const QDate &) |
1076 | { | 1076 | { |
1077 | // qDebug("KOAgendaView::fillAgenda "); | 1077 | // qDebug("KOAgendaView::fillAgenda "); |
1078 | fillAgenda(); | 1078 | fillAgenda(); |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | void KOAgendaView::fillAgenda() | 1081 | void KOAgendaView::fillAgenda() |
1082 | { | 1082 | { |
1083 | if ( globalFlagBlockStartup ) | 1083 | if ( globalFlagBlockStartup ) |
1084 | return; | 1084 | return; |
1085 | if ( globalFlagBlockAgenda == 1 ) | 1085 | if ( globalFlagBlockAgenda == 1 ) |
1086 | return; | 1086 | return; |
1087 | static bool onlyOne = false; | 1087 | static bool onlyOne = false; |
1088 | if ( onlyOne ) | 1088 | if ( onlyOne ) |
1089 | return; | 1089 | return; |
1090 | onlyOne = true; | 1090 | onlyOne = true; |
1091 | //if ( globalFlagBlockAgenda == 2 ) | 1091 | //if ( globalFlagBlockAgenda == 2 ) |
1092 | //globalFlagBlockAgenda = 0; | 1092 | //globalFlagBlockAgenda = 0; |
1093 | // globalFlagBlockPainting = false; | 1093 | // globalFlagBlockPainting = false; |
1094 | if ( globalFlagBlockAgenda == 0 ) | 1094 | if ( globalFlagBlockAgenda == 0 ) |
1095 | globalFlagBlockAgenda = 1; | 1095 | globalFlagBlockAgenda = 1; |
1096 | // clearView(); | 1096 | // clearView(); |
1097 | //qDebug("fillAgenda()++++ "); | 1097 | //qDebug("fillAgenda()++++ "); |
1098 | globalFlagBlockAgendaItemPaint = 1; | 1098 | globalFlagBlockAgendaItemPaint = 1; |
1099 | 1099 | ||
1100 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1100 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1101 | mAgenda->changeColumns(mSelectedDates.count()); | 1101 | mAgenda->changeColumns(mSelectedDates.count()); |
1102 | qApp->processEvents(); | 1102 | qApp->processEvents(); |
1103 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1103 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1104 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1104 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1105 | setHolidayMasks(); | 1105 | setHolidayMasks(); |
1106 | 1106 | ||
1107 | //mAgenda->hideUnused(); | 1107 | //mAgenda->hideUnused(); |
1108 | //mAllDayAgenda->hideUnused(); | 1108 | //mAllDayAgenda->hideUnused(); |
1109 | 1109 | ||
1110 | // mAgenda->blockNextRepaint( false ); | 1110 | // mAgenda->blockNextRepaint( false ); |
1111 | // mAgenda->viewport()->repaint(); | 1111 | // mAgenda->viewport()->repaint(); |
1112 | // mAgenda->blockNextRepaint( true ); | 1112 | // mAgenda->blockNextRepaint( true ); |
1113 | mMinY.resize(mSelectedDates.count()); | 1113 | mMinY.resize(mSelectedDates.count()); |
1114 | mMaxY.resize(mSelectedDates.count()); | 1114 | mMaxY.resize(mSelectedDates.count()); |
1115 | 1115 | ||
1116 | QPtrList<Event> dayEvents; | 1116 | QPtrList<Event> dayEvents; |
1117 | 1117 | ||
1118 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1118 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1119 | // Therefore, gtodoset all of them. | 1119 | // Therefore, gtodoset all of them. |
1120 | QPtrList<Todo> todos = calendar()->todos(); | 1120 | QPtrList<Todo> todos = calendar()->todos(); |
1121 | 1121 | ||
1122 | mAgenda->setDateList(mSelectedDates); | 1122 | mAgenda->setDateList(mSelectedDates); |
1123 | 1123 | ||
1124 | QDate today = QDate::currentDate(); | 1124 | QDate today = QDate::currentDate(); |
1125 | 1125 | ||
1126 | DateList::ConstIterator dit; | 1126 | DateList::ConstIterator dit; |
1127 | int curCol = 0; | 1127 | int curCol = 0; |
1128 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1128 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1129 | QDate currentDate = *dit; | 1129 | QDate currentDate = *dit; |
1130 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1130 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1131 | // << endl; | 1131 | // << endl; |
1132 | 1132 | ||
1133 | dayEvents = calendar()->events(currentDate,true); | 1133 | dayEvents = calendar()->events(currentDate,true); |
1134 | 1134 | ||
1135 | // Default values, which can never be reached | 1135 | // Default values, which can never be reached |
1136 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1136 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1137 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1137 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1138 | 1138 | ||
1139 | unsigned int numEvent; | 1139 | unsigned int numEvent; |
1140 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1140 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1141 | Event *event = dayEvents.at(numEvent); | 1141 | Event *event = dayEvents.at(numEvent); |
1142 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1142 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1143 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1143 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1144 | continue; | 1144 | continue; |
1145 | // kdDebug() << " Event: " << event->summary() << endl; | 1145 | // kdDebug() << " Event: " << event->summary() << endl; |
1146 | 1146 | ||
1147 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1147 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1148 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1148 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1149 | 1149 | ||
1150 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1150 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1151 | 1151 | ||
1152 | if (event->doesFloat()) { | 1152 | if (event->doesFloat()) { |
1153 | if (event->recurrence()->doesRecur()) { | 1153 | if (event->recurrence()->doesRecur()) { |
1154 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1154 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1155 | } else { | 1155 | } else { |
1156 | if (beginX <= 0 && curCol == 0) { | 1156 | if (beginX <= 0 && curCol == 0) { |
1157 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1157 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1158 | } else if (beginX == curCol) { | 1158 | } else if (beginX == curCol) { |
1159 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1159 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1160 | } | 1160 | } |
1161 | } | 1161 | } |
1162 | } else if (event->isMultiDay()) { | 1162 | } else if (event->isMultiDay()) { |
1163 | if ( event->doesRecur () ) { | 1163 | if ( event->doesRecur () ) { |
1164 | QDate dateit = currentDate; | 1164 | QDate dateit = currentDate; |
1165 | int count = 0; | 1165 | int count = 0; |
1166 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1166 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1167 | while (! event->recursOn( dateit ) && count <= max ) { | 1167 | while (! event->recursOn( dateit ) && count <= max ) { |
1168 | ++count; | 1168 | ++count; |
1169 | dateit = dateit.addDays( -1 ); | 1169 | dateit = dateit.addDays( -1 ); |
1170 | } | 1170 | } |
1171 | bool ok; | 1171 | bool ok; |
1172 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1172 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1173 | if ( ok ) | 1173 | if ( ok ) |
1174 | { | 1174 | { |
1175 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1175 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1176 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1176 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1177 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1177 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1178 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1178 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1179 | 1179 | ||
1180 | } | 1180 | } |
1181 | } | 1181 | } |
1182 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1182 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1183 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1183 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1184 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1184 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1185 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1185 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1186 | //qDebug("insert!!! "); | 1186 | //qDebug("insert!!! "); |
1187 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1187 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1188 | } | 1188 | } |
1189 | if (beginX == curCol) { | 1189 | if (beginX == curCol) { |
1190 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1190 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1191 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1191 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1192 | } else if (endX == curCol) { | 1192 | } else if (endX == curCol) { |
1193 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1193 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1194 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1194 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1195 | } else { | 1195 | } else { |
1196 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1196 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1197 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1197 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1198 | } | 1198 | } |
1199 | } else { | 1199 | } else { |
1200 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1200 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1201 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1201 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1202 | if (endY < startY) endY = startY; | 1202 | if (endY < startY) endY = startY; |
1203 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1203 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1204 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1204 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1205 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1205 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1206 | } | 1206 | } |
1207 | } | 1207 | } |
1208 | // ---------- [display Todos -------------- | 1208 | // ---------- [display Todos -------------- |
1209 | unsigned int numTodo; | 1209 | unsigned int numTodo; |
1210 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1210 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1211 | Todo *todo = todos.at(numTodo); | 1211 | Todo *todo = todos.at(numTodo); |
1212 | 1212 | ||
1213 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1213 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1214 | 1214 | ||
1215 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1215 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1216 | // Already completed items can be displayed on their original due date | 1216 | // Already completed items can be displayed on their original due date |
1217 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1217 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1218 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1218 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1219 | bool fillIn = false; | 1219 | bool fillIn = false; |
1220 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1220 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1221 | fillIn = true; | 1221 | fillIn = true; |
1222 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1222 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1223 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1223 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1224 | if ( fillIn ) { | 1224 | if ( fillIn ) { |
1225 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1225 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1226 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1226 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1227 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1227 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1228 | } | 1228 | } |
1229 | else { | 1229 | else { |
1230 | QDateTime dt; | 1230 | QDateTime dt; |
1231 | if ( todo->hasCompletedDate() ) | 1231 | if ( todo->hasCompletedDate() ) |
1232 | dt = todo->completed(); | 1232 | dt = todo->completed(); |
1233 | else | 1233 | else |
1234 | dt = todo->dtDue();; | 1234 | dt = todo->dtDue();; |
1235 | 1235 | ||
1236 | 1236 | ||
1237 | int endY = mAgenda->timeToY(dt.time()) - 1; | 1237 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1238 | int hi = (18/KOPrefs::instance()->mHourSize); | 1238 | int hi = (18/KOPrefs::instance()->mHourSize); |
1239 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1239 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1240 | int startY = endY -hi; | 1240 | int startY = endY -hi; |
1241 | 1241 | ||
1242 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1242 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1243 | 1243 | ||
1244 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1244 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1245 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1245 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1246 | } | 1246 | } |
1247 | } | 1247 | } |
1248 | } | 1248 | } |
1249 | // ---------- display Todos] -------------- | 1249 | // ---------- display Todos] -------------- |
1250 | 1250 | ||
1251 | ++curCol; | 1251 | ++curCol; |
1252 | } | 1252 | } |
1253 | mAgenda->hideUnused(); | 1253 | mAgenda->hideUnused(); |
1254 | mAllDayAgenda->hideUnused(); | 1254 | mAllDayAgenda->hideUnused(); |
1255 | mAgenda->checkScrollBoundaries(); | 1255 | mAgenda->checkScrollBoundaries(); |
1256 | 1256 | ||
1257 | deleteSelectedDateTime(); | 1257 | deleteSelectedDateTime(); |
1258 | 1258 | ||
1259 | createDayLabels(); | 1259 | createDayLabels(); |
1260 | emit incidenceSelected( 0 ); | 1260 | emit incidenceSelected( 0 ); |
1261 | 1261 | ||
1262 | if ( globalFlagBlockAgenda == 2 ) { | 1262 | if ( globalFlagBlockAgenda == 2 ) { |
1263 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1263 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1264 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1264 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1265 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1265 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1266 | setStartHour( QTime::currentTime ().hour() ); | 1266 | setStartHour( QTime::currentTime ().hour() ); |
1267 | // qApp->processEvents(); | 1267 | // qApp->processEvents(); |
1268 | } | 1268 | } |
1269 | qApp->processEvents(); | 1269 | qApp->processEvents(); |
1270 | //qDebug("qApp->processEvents(); END "); | 1270 | //qDebug("qApp->processEvents(); END "); |
1271 | globalFlagBlockAgenda = 0; | 1271 | globalFlagBlockAgenda = 0; |
1272 | 1272 | ||
1273 | // mAgenda->hideUnused(); | 1273 | // mAgenda->hideUnused(); |
1274 | //mAllDayAgenda->hideUnused(); | 1274 | //mAllDayAgenda->hideUnused(); |
1275 | mAllDayAgenda->drawContentsToPainter(); | 1275 | mAllDayAgenda->drawContentsToPainter(); |
1276 | mAgenda->drawContentsToPainter(); | 1276 | mAgenda->drawContentsToPainter(); |
1277 | repaintAgenda(); | 1277 | repaintAgenda(); |
1278 | onlyOne = false; | 1278 | onlyOne = false; |
1279 | // mAgenda->finishUpdate(); | 1279 | // mAgenda->finishUpdate(); |
1280 | //mAllDayAgenda->finishUpdate(); | 1280 | //mAllDayAgenda->finishUpdate(); |
1281 | 1281 | ||
1282 | // repaintAgenda(); | 1282 | // repaintAgenda(); |
1283 | //qApp->processEvents(); | 1283 | //qApp->processEvents(); |
1284 | // globalFlagBlockAgenda = 0; | 1284 | // globalFlagBlockAgenda = 0; |
1285 | } | 1285 | } |
1286 | void KOAgendaView::repaintAgenda() | 1286 | void KOAgendaView::repaintAgenda() |
1287 | { | 1287 | { |
1288 | // mAllDayAgenda->drawContentsToPainter(); | 1288 | // mAllDayAgenda->drawContentsToPainter(); |
1289 | // mAllDayAgenda->viewport()->repaint( false ); | 1289 | // mAllDayAgenda->viewport()->repaint( false ); |
1290 | // mAgenda->drawContentsToPainter(); | 1290 | // mAgenda->drawContentsToPainter(); |
1291 | // mAgenda->viewport()->repaint( false ); | 1291 | // mAgenda->viewport()->repaint( false ); |
1292 | // qApp->processEvents(); | 1292 | // qApp->processEvents(); |
1293 | 1293 | ||
1294 | //qDebug("KOAgendaView::repaintAgenda() "); | 1294 | //qDebug("KOAgendaView::repaintAgenda() "); |
1295 | //qApp->processEvents(); | 1295 | //qApp->processEvents(); |
1296 | mAgenda->viewport()->repaint( false ); | 1296 | mAgenda->viewport()->repaint( false ); |
1297 | mAllDayAgenda->viewport()->repaint( false ); | 1297 | mAllDayAgenda->viewport()->repaint( false ); |
1298 | mAgenda->finishUpdate(); | 1298 | mAgenda->finishUpdate(); |
1299 | mAllDayAgenda->finishUpdate(); | 1299 | mAllDayAgenda->finishUpdate(); |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | 1302 | ||
1303 | void KOAgendaView::clearView() | 1303 | void KOAgendaView::clearView() |
1304 | { | 1304 | { |
1305 | // kdDebug() << "ClearView" << endl; | 1305 | // kdDebug() << "ClearView" << endl; |
1306 | mAllDayAgenda->clear(); | 1306 | mAllDayAgenda->clear(); |
1307 | mAgenda->clear(); | 1307 | mAgenda->clear(); |
1308 | } | 1308 | } |
1309 | 1309 | ||
1310 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1310 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1311 | const QDate &td) | 1311 | const QDate &td) |
1312 | { | 1312 | { |
1313 | #ifndef KORG_NOPRINTER | 1313 | #ifndef KORG_NOPRINTER |
1314 | if (fd == td) | 1314 | if (fd == td) |
1315 | calPrinter->preview(CalPrinter::Day, fd, td); | 1315 | calPrinter->preview(CalPrinter::Day, fd, td); |
1316 | else | 1316 | else |
1317 | calPrinter->preview(CalPrinter::Week, fd, td); | 1317 | calPrinter->preview(CalPrinter::Week, fd, td); |
1318 | #endif | 1318 | #endif |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | // void KOAgendaView::updateMovedTodo() | 1321 | // void KOAgendaView::updateMovedTodo() |
1322 | // { | 1322 | // { |
1323 | // // updateConfig(); | 1323 | // // updateConfig(); |
1324 | // // emit updateTodoViews(); | 1324 | // // emit updateTodoViews(); |
1325 | // } | 1325 | // } |
1326 | 1326 | ||
1327 | void KOAgendaView::slotShowDateView( int mode , int d ) | 1327 | void KOAgendaView::slotShowDateView( int mode , int d ) |
1328 | { | 1328 | { |
1329 | if ( d >= mSelectedDates.count() ) { | 1329 | if ( d >= mSelectedDates.count() ) { |
1330 | qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); | 1330 | qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); |
1331 | 1331 | ||
1332 | } else { | 1332 | } else { |
1333 | QDate day = mSelectedDates[d]; | 1333 | QDate day = mSelectedDates[d]; |
1334 | emit showDateView(mode , day ); | 1334 | emit showDateView(mode , day ); |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | } | 1337 | } |
1338 | void KOAgendaView::newEvent(int gx, int gy) | 1338 | void KOAgendaView::newEvent(int gx, int gy) |
1339 | { | 1339 | { |
1340 | if (!mSelectedDates.count()) return; | 1340 | if (!mSelectedDates.count()) return; |
1341 | 1341 | ||
1342 | QDate day = mSelectedDates[gx]; | 1342 | QDate day = mSelectedDates[gx]; |
1343 | 1343 | ||
1344 | QTime time = mAgenda->gyToTime(gy); | 1344 | QTime time = mAgenda->gyToTime(gy); |
1345 | QDateTime dt(day,time); | 1345 | QDateTime dt(day,time); |
1346 | // if ( dt < QDateTime::currentDateTime () ) | 1346 | // if ( dt < QDateTime::currentDateTime () ) |
1347 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1347 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1348 | emit newEventSignal(dt); | 1348 | emit newEventSignal(dt); |
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1351 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1352 | { | 1352 | { |
1353 | if (!mSelectedDates.count()) return; | 1353 | if (!mSelectedDates.count()) return; |
1354 | 1354 | ||
1355 | QDate dayStart = mSelectedDates[gxStart]; | 1355 | QDate dayStart = mSelectedDates[gxStart]; |
1356 | QDate dayEnd = mSelectedDates[gxEnd]; | 1356 | QDate dayEnd = mSelectedDates[gxEnd]; |
1357 | 1357 | ||
1358 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1358 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1359 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1359 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1360 | 1360 | ||
1361 | QDateTime dtStart(dayStart,timeStart); | 1361 | QDateTime dtStart(dayStart,timeStart); |
1362 | QDateTime dtEnd(dayEnd,timeEnd); | 1362 | QDateTime dtEnd(dayEnd,timeEnd); |
1363 | 1363 | ||
1364 | emit newEventSignal(dtStart,dtEnd); | 1364 | emit newEventSignal(dtStart,dtEnd); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | void KOAgendaView::newEventAllDay(int gx, int ) | 1367 | void KOAgendaView::newEventAllDay(int gx, int ) |
1368 | { | 1368 | { |
1369 | if (!mSelectedDates.count()) return; | 1369 | if (!mSelectedDates.count()) return; |
1370 | 1370 | ||
1371 | QDate day = mSelectedDates[gx]; | 1371 | QDate day = mSelectedDates[gx]; |
1372 | 1372 | ||
1373 | emit newEventSignal(day); | 1373 | emit newEventSignal(day); |
1374 | } | 1374 | } |
1375 | void KOAgendaView::newTodoAllDay(int gx, int ) | 1375 | void KOAgendaView::newTodoAllDay(int gx, int ) |
1376 | { | 1376 | { |
1377 | if (!mSelectedDates.count()) return; | 1377 | if (!mSelectedDates.count()) return; |
1378 | 1378 | ||
1379 | QDateTime day (mSelectedDates[gx] ); | 1379 | QDateTime day (mSelectedDates[gx] ); |
1380 | emit newTodoSignal(day, true); | 1380 | emit newTodoSignal(day, true); |
1381 | } | 1381 | } |
1382 | void KOAgendaView::newTodo(int gx, int gy ) | 1382 | void KOAgendaView::newTodo(int gx, int gy ) |
1383 | { | 1383 | { |
1384 | if (!mSelectedDates.count()) return; | 1384 | if (!mSelectedDates.count()) return; |
1385 | QDate dayStart = mSelectedDates[gx]; | 1385 | QDate dayStart = mSelectedDates[gx]; |
1386 | QTime timeStart = mAgenda->gyToTime(gy); | 1386 | QTime timeStart = mAgenda->gyToTime(gy); |
1387 | QDateTime dt (dayStart,timeStart); | 1387 | QDateTime dt (dayStart,timeStart); |
1388 | emit newTodoSignal( dt, false ); | 1388 | emit newTodoSignal( dt, false ); |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1391 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1392 | { | 1392 | { |
1393 | uint i; | 1393 | uint i; |
1394 | for(i=0;i<mMinY.size();++i) { | 1394 | for(i=0;i<mMinY.size();++i) { |
1395 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1395 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1396 | else mEventIndicatorTop->enableColumn(i,false); | 1396 | else mEventIndicatorTop->enableColumn(i,false); |
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | mEventIndicatorTop->update(); | 1399 | mEventIndicatorTop->update(); |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | void KOAgendaView::updateEventIndicatorBottom(int newY) | 1402 | void KOAgendaView::updateEventIndicatorBottom(int newY) |
1403 | { | 1403 | { |
1404 | uint i; | 1404 | uint i; |
1405 | for(i=0;i<mMaxY.size();++i) { | 1405 | for(i=0;i<mMaxY.size();++i) { |
1406 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); | 1406 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); |
1407 | else mEventIndicatorBottom->enableColumn(i,false); | 1407 | else mEventIndicatorBottom->enableColumn(i,false); |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | mEventIndicatorBottom->update(); | 1410 | mEventIndicatorBottom->update(); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | void KOAgendaView::startDrag(Event *event) | 1413 | void KOAgendaView::startDrag(Event *event) |
1414 | { | 1414 | { |
1415 | #ifndef KORG_NODND | 1415 | #ifndef KORG_NODND |
1416 | DndFactory factory( calendar() ); | 1416 | DndFactory factory( calendar() ); |
1417 | ICalDrag *vd = factory.createDrag(event,this); | 1417 | ICalDrag *vd = factory.createDrag(event,this); |
1418 | if (vd->drag()) { | 1418 | if (vd->drag()) { |
1419 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; | 1419 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; |
1420 | } | 1420 | } |
1421 | #endif | 1421 | #endif |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | void KOAgendaView::readSettings() | 1424 | void KOAgendaView::readSettings() |
1425 | { | 1425 | { |
1426 | readSettings(KOGlobals::config()); | 1426 | readSettings(KOGlobals::config()); |
1427 | } | 1427 | } |
1428 | 1428 | ||
1429 | void KOAgendaView::readSettings(KConfig *config) | 1429 | void KOAgendaView::readSettings(KConfig *config) |
1430 | { | 1430 | { |
1431 | // kdDebug() << "KOAgendaView::readSettings()" << endl; | 1431 | // kdDebug() << "KOAgendaView::readSettings()" << endl; |
1432 | 1432 | ||
1433 | config->setGroup("Views"); | 1433 | config->setGroup("Views"); |
1434 | 1434 | ||
1435 | //#ifndef KORG_NOSPLITTER | 1435 | //#ifndef KORG_NOSPLITTER |
1436 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); | 1436 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); |
1437 | if (sizes.count() == 2) { | 1437 | if (sizes.count() == 2) { |
1438 | if ( sizes[0] < 20 ) { | 1438 | if ( sizes[0] < 20 ) { |
1439 | sizes[1] = sizes[1] +20 - sizes[0]; | 1439 | sizes[1] = sizes[1] +20 - sizes[0]; |
1440 | sizes[0] = 20; | 1440 | sizes[0] = 20; |
1441 | } | 1441 | } |
1442 | mSplitterAgenda->setSizes(sizes); | 1442 | mSplitterAgenda->setSizes(sizes); |
1443 | // qDebug("read %d %d ",sizes[0],sizes[1] ); | 1443 | // qDebug("read %d %d ",sizes[0],sizes[1] ); |
1444 | } | 1444 | } |
1445 | //#endif | 1445 | //#endif |
1446 | 1446 | ||
1447 | // updateConfig(); | 1447 | // updateConfig(); |
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | void KOAgendaView::writeSettings(KConfig *config) | 1450 | void KOAgendaView::writeSettings(KConfig *config) |
1451 | { | 1451 | { |
1452 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; | 1452 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; |
1453 | 1453 | ||
1454 | config->setGroup("Views"); | 1454 | config->setGroup("Views"); |
1455 | 1455 | ||
1456 | //#ifndef KORG_NOSPLITTER | 1456 | //#ifndef KORG_NOSPLITTER |
1457 | QValueList<int> list = mSplitterAgenda->sizes(); | 1457 | QValueList<int> list = mSplitterAgenda->sizes(); |
1458 | config->writeEntry("Separator AgendaView",list); | 1458 | config->writeEntry("Separator AgendaView",list); |
1459 | //qDebug("write %d %d ", list[0],list[1] ); | 1459 | //qDebug("write %d %d ", list[0],list[1] ); |
1460 | //#endif | 1460 | //#endif |
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | void KOAgendaView::setHolidayMasks() | 1463 | void KOAgendaView::setHolidayMasks() |
1464 | { | 1464 | { |
1465 | mHolidayMask.resize(mSelectedDates.count()); | 1465 | mHolidayMask.resize(mSelectedDates.count()); |
1466 | 1466 | ||
1467 | uint i; | 1467 | uint i; |
1468 | for(i=0;i<mSelectedDates.count();++i) { | 1468 | for(i=0;i<mSelectedDates.count();++i) { |
1469 | QDate date = mSelectedDates[i]; | 1469 | QDate date = mSelectedDates[i]; |
1470 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); | 1470 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); |
1471 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1471 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1472 | bool showHoliday = false; | 1472 | bool showHoliday = false; |
1473 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1473 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1474 | QPtrList<Event> events = calendar()->events( date, true ); | 1474 | QPtrList<Event> events = calendar()->events( date, true ); |
1475 | Event *event; | 1475 | Event *event; |
1476 | for( event = events.first(); event; event = events.next() ) { | 1476 | for( event = events.first(); event; event = events.next() ) { |
1477 | if ( event->isHoliday()) { | 1477 | if ( event->isHoliday()) { |
1478 | showHoliday = true; | 1478 | showHoliday = true; |
1479 | break; | 1479 | break; |
1480 | } | 1480 | } |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | #ifndef KORG_NOPLUGINS | 1485 | #ifndef KORG_NOPLUGINS |
1486 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && | 1486 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && |
1487 | !KOCore::self()->holiday(date).isEmpty(); | 1487 | !KOCore::self()->holiday(date).isEmpty(); |
1488 | #endif | 1488 | #endif |
1489 | bool showDay = showSaturday || showSunday || showHoliday; | 1489 | bool showDay = showSaturday || showSunday || showHoliday; |
1490 | 1490 | ||
1491 | if (showDay) { | 1491 | if (showDay) { |
1492 | mHolidayMask.at(i) = true; | 1492 | mHolidayMask.at(i) = true; |
1493 | } else { | 1493 | } else { |
1494 | mHolidayMask.at(i) = false; | 1494 | mHolidayMask.at(i) = false; |
1495 | } | 1495 | } |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | mAgenda->setHolidayMask(&mHolidayMask); | 1498 | mAgenda->setHolidayMask(&mHolidayMask); |
1499 | mAllDayAgenda->setHolidayMask(&mHolidayMask); | 1499 | mAllDayAgenda->setHolidayMask(&mHolidayMask); |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | void KOAgendaView::setContentsPos(int y) | 1502 | void KOAgendaView::setContentsPos(int y) |
1503 | { | 1503 | { |
1504 | mAgenda->setContentsPos(0,y); | 1504 | mAgenda->setContentsPos(0,y); |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | void KOAgendaView::clearSelection() | 1507 | void KOAgendaView::clearSelection() |
1508 | { | 1508 | { |
1509 | mAgenda->deselectItem(); | 1509 | mAgenda->deselectItem(); |
1510 | mAllDayAgenda->deselectItem(); | 1510 | mAllDayAgenda->deselectItem(); |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, | 1513 | void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, |
1514 | int gxEnd, int gyEnd) | 1514 | int gxEnd, int gyEnd) |
1515 | { | 1515 | { |
1516 | mTimeSpanInAllDay = true; | 1516 | mTimeSpanInAllDay = true; |
1517 | newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); | 1517 | newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | 1520 | ||
1521 | 1521 | ||
1522 | 1522 | ||
1523 | void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, | 1523 | void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, |
1524 | int gxEnd, int gyEnd) | 1524 | int gxEnd, int gyEnd) |
1525 | { | 1525 | { |
1526 | if (!mSelectedDates.count()) return; | 1526 | if (!mSelectedDates.count()) return; |
1527 | 1527 | ||
1528 | QDate dayStart = mSelectedDates[gxStart]; | 1528 | QDate dayStart = mSelectedDates[gxStart]; |
1529 | QDate dayEnd = mSelectedDates[gxEnd]; | 1529 | QDate dayEnd = mSelectedDates[gxEnd]; |
1530 | 1530 | ||
1531 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1531 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1532 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1532 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1533 | 1533 | ||
1534 | QDateTime dtStart(dayStart,timeStart); | 1534 | QDateTime dtStart(dayStart,timeStart); |
1535 | QDateTime dtEnd(dayEnd,timeEnd); | 1535 | QDateTime dtEnd(dayEnd,timeEnd); |
1536 | 1536 | ||
1537 | mTimeSpanBegin = dtStart; | 1537 | mTimeSpanBegin = dtStart; |
1538 | mTimeSpanEnd = dtEnd; | 1538 | mTimeSpanEnd = dtEnd; |
1539 | 1539 | ||
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | void KOAgendaView::deleteSelectedDateTime() | 1542 | void KOAgendaView::deleteSelectedDateTime() |
1543 | { | 1543 | { |
1544 | mTimeSpanBegin.setDate(QDate()); | 1544 | mTimeSpanBegin.setDate(QDate()); |
1545 | mTimeSpanEnd.setDate(QDate()); | 1545 | mTimeSpanEnd.setDate(QDate()); |
1546 | mTimeSpanInAllDay = false; | 1546 | mTimeSpanInAllDay = false; |
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) | 1549 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) |
1550 | { | 1550 | { |
1551 | e->ignore(); | 1551 | e->ignore(); |
1552 | } | 1552 | } |
1553 | 1553 | ||
1554 | void KOAgendaView::scrollOneHourUp() | 1554 | void KOAgendaView::scrollOneHourUp() |
1555 | { | 1555 | { |
1556 | 1556 | ||
1557 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); | 1557 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); |
1558 | } | 1558 | } |
1559 | void KOAgendaView::scrollOneHourDown() | 1559 | void KOAgendaView::scrollOneHourDown() |
1560 | { | 1560 | { |
1561 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); | 1561 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | void KOAgendaView::setStartHour( int h ) | 1564 | void KOAgendaView::setStartHour( int h ) |
1565 | { | 1565 | { |
1566 | mAgenda->setStartHour( h ); | 1566 | mAgenda->setStartHour( h ); |
1567 | 1567 | ||
1568 | } | 1568 | } |
1569 | void KOAgendaView::setInitStartHour() | 1569 | void KOAgendaView::setInitStartHour() |
1570 | { | 1570 | { |
1571 | 1571 | ||
1572 | if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1572 | if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1573 | setStartHour( QTime::currentTime ().hour() ); | 1573 | setStartHour( QTime::currentTime ().hour() ); |
1574 | else | 1574 | else |
1575 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1575 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1576 | 1576 | ||
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | 1579 | ||
1580 | void KOAgendaView::updateTodo( Todo * t, int ) | 1580 | void KOAgendaView::updateTodo( Todo * t, int ) |
1581 | { | 1581 | { |
1582 | if ( !isVisible() ) | 1582 | if ( !isVisible() ) |
1583 | return; | 1583 | return; |
1584 | bool remove = false; | 1584 | bool remove = false; |
1585 | bool removeAD = false; | 1585 | bool removeAD = false; |
1586 | QDate da; | 1586 | QDate da; |
1587 | if ( t->hasCompletedDate() ) | 1587 | if ( t->hasCompletedDate() ) |
1588 | da = t->completed().date(); | 1588 | da = t->completed().date(); |
1589 | else | 1589 | else |
1590 | da = t->dtDue().date(); | 1590 | da = t->dtDue().date(); |
1591 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { | 1591 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { |
1592 | remove = true; | 1592 | remove = true; |
1593 | removeAD = true; | 1593 | removeAD = true; |
1594 | } | 1594 | } |
1595 | else { | 1595 | else { |
1596 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; | 1596 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; |
1597 | if ( overdue && | 1597 | if ( overdue && |
1598 | QDate::currentDate() >= mSelectedDates.first() && | 1598 | QDate::currentDate() >= mSelectedDates.first() && |
1599 | QDate::currentDate() <= mSelectedDates.last()) { | 1599 | QDate::currentDate() <= mSelectedDates.last()) { |
1600 | removeAD = false; | 1600 | removeAD = false; |
1601 | remove = true; | 1601 | remove = true; |
1602 | } | 1602 | } |
1603 | else { | 1603 | else { |
1604 | 1604 | ||
1605 | if ( da < mSelectedDates.first() || | 1605 | if ( da < mSelectedDates.first() || |
1606 | da > mSelectedDates.last() ) { | 1606 | da > mSelectedDates.last() ) { |
1607 | remove = true; | 1607 | remove = true; |
1608 | removeAD = true; | 1608 | removeAD = true; |
1609 | } else { | 1609 | } else { |
1610 | remove = t->doesFloat() && !t->hasCompletedDate(); | 1610 | remove = t->doesFloat() && !t->hasCompletedDate(); |
1611 | removeAD = !remove; | 1611 | removeAD = !remove; |
1612 | } | 1612 | } |
1613 | } | 1613 | } |
1614 | } | 1614 | } |
1615 | int days = mSelectedDates.first().daysTo( da ); | 1615 | int days = mSelectedDates.first().daysTo( da ); |
1616 | //qDebug("daysto %d %d %d", days, remove,removeAD ); | 1616 | //qDebug("daysto %d %d %d", days, remove,removeAD ); |
1617 | mAgenda->updateTodo( t , days, remove); | 1617 | mAgenda->updateTodo( t , days, remove); |
1618 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1618 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1619 | mAllDayAgenda->updateTodo( t , days, removeAD); | 1619 | mAllDayAgenda->updateTodo( t , days, removeAD); |
1620 | //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); | 1620 | //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); |
1621 | 1621 | ||
1622 | } | 1622 | } |