-rw-r--r-- | korganizer/koagendaview.cpp | 45 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 33 |
2 files changed, 50 insertions, 28 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index d3db89a..c8cef44 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1,270 +1,272 @@ | |||
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 | |||
80 | |||
79 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : |
80 | QScrollView(parent,name,f) | 82 | QScrollView(parent,name,f) |
81 | { | 83 | { |
82 | mRows = rows; | 84 | mRows = rows; |
83 | 85 | ||
84 | setMinimumHeight( 20 ); | 86 | setMinimumHeight( 20 ); |
85 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 87 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
86 | 88 | ||
87 | enableClipper(true); | 89 | enableClipper(true); |
88 | 90 | ||
89 | setHScrollBarMode(AlwaysOff); | 91 | setHScrollBarMode(AlwaysOff); |
90 | setVScrollBarMode(AlwaysOff); | 92 | setVScrollBarMode(AlwaysOff); |
91 | 93 | ||
92 | resizeContents(50,mRows * mCellHeight); | 94 | resizeContents(50,mRows * mCellHeight); |
93 | 95 | ||
94 | viewport()->setBackgroundMode( PaletteBackground ); | 96 | viewport()->setBackgroundMode( PaletteBackground ); |
95 | } | 97 | } |
96 | 98 | ||
97 | void TimeLabels::setCellHeight(int height) | 99 | void TimeLabels::setCellHeight(int height) |
98 | { | 100 | { |
99 | mCellHeight = height; | 101 | mCellHeight = height; |
100 | } | 102 | } |
101 | 103 | ||
102 | /* | 104 | /* |
103 | Optimization so that only the "dirty" portion of the scroll view | 105 | Optimization so that only the "dirty" portion of the scroll view |
104 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 106 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
105 | */ | 107 | */ |
106 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 108 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
107 | { | 109 | { |
108 | 110 | ||
109 | // if ( globalFlagBlockAgenda ) | 111 | // if ( globalFlagBlockAgenda ) |
110 | // return; | 112 | // return; |
111 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 113 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
112 | // redrawn, not the area of the widget. unfortunately, this | 114 | // redrawn, not the area of the widget. unfortunately, this |
113 | // code assumes the latter... | 115 | // code assumes the latter... |
114 | 116 | ||
115 | // now, for a workaround... | 117 | // now, for a workaround... |
116 | // these two assignments fix the weird redraw bug | 118 | // these two assignments fix the weird redraw bug |
117 | cx = contentsX() + 2; | 119 | cx = contentsX() + 2; |
118 | cw = contentsWidth() - 2; | 120 | cw = contentsWidth() - 2; |
119 | // end of workaround | 121 | // end of workaround |
120 | 122 | ||
121 | int cell = ((int)(cy/mCellHeight)); | 123 | int cell = ((int)(cy/mCellHeight)); |
122 | int y = cell * mCellHeight; | 124 | int y = cell * mCellHeight; |
123 | QFontMetrics fm = fontMetrics(); | 125 | QFontMetrics fm = fontMetrics(); |
124 | QString hour; | 126 | QString hour; |
125 | QString suffix; | 127 | QString suffix; |
126 | QString fullTime; | 128 | QString fullTime; |
127 | int tW = fm.width("24:00i"); | 129 | int tW = fm.width("24:00i"); |
128 | 130 | ||
129 | while (y < cy + ch) { | 131 | while (y < cy + ch) { |
130 | p->drawLine(cx,y,cx+tW,y); | 132 | p->drawLine(cx,y,cx+tW,y); |
131 | hour.setNum(cell); | 133 | hour.setNum(cell); |
132 | suffix = "am"; | 134 | suffix = "am"; |
133 | 135 | ||
134 | // handle 24h and am/pm time formats | 136 | // handle 24h and am/pm time formats |
135 | if (KGlobal::locale()->use12Clock()) { | 137 | if (KGlobal::locale()->use12Clock()) { |
136 | if (cell > 11) suffix = "pm"; | 138 | if (cell > 11) suffix = "pm"; |
137 | if (cell == 0) hour.setNum(12); | 139 | if (cell == 0) hour.setNum(12); |
138 | if (cell > 12) hour.setNum(cell - 12); | 140 | if (cell > 12) hour.setNum(cell - 12); |
139 | } else { | 141 | } else { |
140 | suffix = ":00"; | 142 | suffix = ":00"; |
141 | } | 143 | } |
142 | 144 | ||
143 | // create string in format of "XX:XX" or "XXpm/am" | 145 | // create string in format of "XX:XX" or "XXpm/am" |
144 | fullTime = hour + suffix; | 146 | fullTime = hour + suffix; |
145 | 147 | ||
146 | // center and draw the time label | 148 | // center and draw the time label |
147 | int timeWidth = fm.width(fullTime+"i"); | 149 | int timeWidth = fm.width(fullTime+"i"); |
148 | int offset = this->width() - timeWidth; | 150 | int offset = this->width() - timeWidth; |
149 | int borderWidth = 5; | 151 | int borderWidth = 5; |
150 | int timeHeight = fm.height(); | 152 | int timeHeight = fm.height(); |
151 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); | 153 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); |
152 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); | 154 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); |
153 | 155 | ||
154 | // increment indices | 156 | // increment indices |
155 | y += mCellHeight; | 157 | y += mCellHeight; |
156 | cell++; | 158 | cell++; |
157 | } | 159 | } |
158 | } | 160 | } |
159 | 161 | ||
160 | /** | 162 | /** |
161 | Calculates the minimum width. | 163 | Calculates the minimum width. |
162 | */ | 164 | */ |
163 | int TimeLabels::minimumWidth() const | 165 | int TimeLabels::minimumWidth() const |
164 | { | 166 | { |
165 | QFontMetrics fm = fontMetrics(); | 167 | QFontMetrics fm = fontMetrics(); |
166 | 168 | ||
167 | //TODO: calculate this value | 169 | //TODO: calculate this value |
168 | int borderWidth = 4; | 170 | int borderWidth = 4; |
169 | 171 | ||
170 | // the maximum width possible | 172 | // the maximum width possible |
171 | int width = fm.width("88:88x") + borderWidth; | 173 | int width = fm.width("88:88x") + borderWidth; |
172 | 174 | ||
173 | return width; | 175 | return width; |
174 | } | 176 | } |
175 | 177 | ||
176 | /** updates widget's internal state */ | 178 | /** updates widget's internal state */ |
177 | void TimeLabels::updateConfig() | 179 | void TimeLabels::updateConfig() |
178 | { | 180 | { |
179 | // set the font | 181 | // set the font |
180 | // config->setGroup("Fonts"); | 182 | // config->setGroup("Fonts"); |
181 | // QFont font = config->readFontEntry("TimeBar Font"); | 183 | // QFont font = config->readFontEntry("TimeBar Font"); |
182 | setFont(KOPrefs::instance()->mTimeBarFont); | 184 | setFont(KOPrefs::instance()->mTimeBarFont); |
183 | 185 | ||
184 | // update geometry restrictions based on new settings | 186 | // update geometry restrictions based on new settings |
185 | setFixedWidth(minimumWidth()); | 187 | setFixedWidth(minimumWidth()); |
186 | 188 | ||
187 | // update HourSize | 189 | // update HourSize |
188 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 190 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
189 | resizeContents(50,mRows * mCellHeight); | 191 | resizeContents(50,mRows * mCellHeight); |
190 | } | 192 | } |
191 | 193 | ||
192 | /** update time label positions */ | 194 | /** update time label positions */ |
193 | void TimeLabels::positionChanged() | 195 | void TimeLabels::positionChanged() |
194 | { | 196 | { |
195 | int adjustment = mAgenda->contentsY(); | 197 | int adjustment = mAgenda->contentsY(); |
196 | setContentsPos(0, adjustment); | 198 | setContentsPos(0, adjustment); |
197 | } | 199 | } |
198 | 200 | ||
199 | /** */ | 201 | /** */ |
200 | void TimeLabels::setAgenda(KOAgenda* agenda) | 202 | void TimeLabels::setAgenda(KOAgenda* agenda) |
201 | { | 203 | { |
202 | mAgenda = agenda; | 204 | mAgenda = agenda; |
203 | } | 205 | } |
204 | 206 | ||
205 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 207 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
206 | { | 208 | { |
207 | mMouseDownY = e->pos().y(); | 209 | mMouseDownY = e->pos().y(); |
208 | mOrgCap = topLevelWidget()->caption(); | 210 | mOrgCap = topLevelWidget()->caption(); |
209 | } | 211 | } |
210 | 212 | ||
211 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 213 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
212 | { | 214 | { |
213 | int diff = mMouseDownY - e->pos().y(); | 215 | int diff = mMouseDownY - e->pos().y(); |
214 | if ( diff < 10 && diff > -10 ) | 216 | if ( diff < 10 && diff > -10 ) |
215 | return; | 217 | return; |
216 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 218 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
217 | if ( tSize < 4 ) | 219 | if ( tSize < 4 ) |
218 | tSize = 4; | 220 | tSize = 4; |
219 | if ( tSize > 22 ) | 221 | if ( tSize > 22 ) |
220 | tSize = 22; | 222 | tSize = 22; |
221 | tSize = (tSize-2)/2; | 223 | tSize = (tSize-2)/2; |
222 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 224 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
223 | 225 | ||
224 | } | 226 | } |
225 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 227 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
226 | { | 228 | { |
227 | topLevelWidget()->setCaption( mOrgCap ); | 229 | topLevelWidget()->setCaption( mOrgCap ); |
228 | int diff = mMouseDownY - e->pos().y(); | 230 | int diff = mMouseDownY - e->pos().y(); |
229 | if ( diff < 10 && diff > -10 ) | 231 | if ( diff < 10 && diff > -10 ) |
230 | return; | 232 | return; |
231 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 233 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
232 | if ( tSize < 4 ) | 234 | if ( tSize < 4 ) |
233 | tSize = 4; | 235 | tSize = 4; |
234 | if ( tSize > 22 ) | 236 | if ( tSize > 22 ) |
235 | tSize = 22; | 237 | tSize = 22; |
236 | tSize = (tSize/2)*2; | 238 | tSize = (tSize/2)*2; |
237 | if ( tSize == KOPrefs::instance()->mHourSize ) | 239 | if ( tSize == KOPrefs::instance()->mHourSize ) |
238 | return; | 240 | return; |
239 | KOPrefs::instance()->mHourSize = tSize; | 241 | KOPrefs::instance()->mHourSize = tSize; |
240 | emit scaleChanged(); | 242 | emit scaleChanged(); |
241 | } | 243 | } |
242 | 244 | ||
243 | /** This is called in response to repaint() */ | 245 | /** This is called in response to repaint() */ |
244 | void TimeLabels::paintEvent(QPaintEvent*) | 246 | void TimeLabels::paintEvent(QPaintEvent*) |
245 | { | 247 | { |
246 | 248 | ||
247 | // kdDebug() << "paintevent..." << endl; | 249 | // kdDebug() << "paintevent..." << endl; |
248 | // this is another hack! | 250 | // this is another hack! |
249 | // QPainter painter(this); | 251 | // QPainter painter(this); |
250 | //QString c | 252 | //QString c |
251 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 253 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
252 | } | 254 | } |
253 | 255 | ||
254 | //////////////////////////////////////////////////////////////////////////// | 256 | //////////////////////////////////////////////////////////////////////////// |
255 | 257 | ||
256 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 258 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
257 | : QFrame(parent,name) | 259 | : QFrame(parent,name) |
258 | { | 260 | { |
259 | mColumns = 1; | 261 | mColumns = 1; |
260 | mTopBox = 0; | 262 | mTopBox = 0; |
261 | mLocation = loc; | 263 | mLocation = loc; |
262 | mTopLayout = 0; | 264 | mTopLayout = 0; |
263 | mPaintWidget = 0; | 265 | mPaintWidget = 0; |
264 | mXOffset = 0; | 266 | mXOffset = 0; |
265 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 267 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
266 | else mPixmap = SmallIcon("1downarrow"); | 268 | else mPixmap = SmallIcon("1downarrow"); |
267 | mEnabled.resize(mColumns); | 269 | mEnabled.resize(mColumns); |
268 | if (mLocation == Top) | 270 | if (mLocation == Top) |
269 | setMaximumHeight(0); | 271 | setMaximumHeight(0); |
270 | else | 272 | else |
@@ -420,600 +422,595 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
420 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
421 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
423 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
425 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
426 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); | 428 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); |
427 | 429 | ||
428 | // Create event context menu for all day agenda | 430 | // Create event context menu for all day agenda |
429 | mAllDayAgendaPopup = eventPopup(); | 431 | mAllDayAgendaPopup = eventPopup(); |
430 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 432 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
431 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 433 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
432 | 434 | ||
433 | // Create agenda frame | 435 | // Create agenda frame |
434 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 436 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
435 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 437 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
436 | 438 | ||
437 | // create event indicator bars | 439 | // create event indicator bars |
438 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 440 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
439 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 441 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
440 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 442 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
441 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 443 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
442 | agendaFrame); | 444 | agendaFrame); |
443 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 445 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
444 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 446 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
445 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 447 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
446 | 448 | ||
447 | // Create time labels | 449 | // Create time labels |
448 | mTimeLabels = new TimeLabels(24,agendaFrame); | 450 | mTimeLabels = new TimeLabels(24,agendaFrame); |
449 | agendaLayout->addWidget(mTimeLabels,1,0); | 451 | agendaLayout->addWidget(mTimeLabels,1,0); |
450 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 452 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
451 | this,SLOT(updateConfig())); | 453 | this,SLOT(updateConfig())); |
452 | 454 | ||
453 | // Create agenda | 455 | // Create agenda |
454 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 456 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
455 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 457 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
456 | agendaLayout->setColStretch(1,1); | 458 | agendaLayout->setColStretch(1,1); |
457 | mAgenda->setFocusPolicy(NoFocus); | 459 | mAgenda->setFocusPolicy(NoFocus); |
458 | // Create event context menu for agenda | 460 | // Create event context menu for agenda |
459 | mAgendaPopup = eventPopup(); | 461 | mAgendaPopup = eventPopup(); |
460 | 462 | ||
461 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 463 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
462 | i18n("Toggle Alarm"),mAgenda, | 464 | i18n("Toggle Alarm"),mAgenda, |
463 | SLOT(popupAlarm()),true); | 465 | SLOT(popupAlarm()),true); |
464 | 466 | ||
465 | 467 | ||
466 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 468 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
467 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 469 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
468 | 470 | ||
469 | // make connections between dependent widgets | 471 | // make connections between dependent widgets |
470 | mTimeLabels->setAgenda(mAgenda); | 472 | mTimeLabels->setAgenda(mAgenda); |
471 | 473 | ||
472 | // Update widgets to reflect user preferences | 474 | // Update widgets to reflect user preferences |
473 | // updateConfig(); | 475 | // updateConfig(); |
474 | 476 | ||
475 | // createDayLabels(); | 477 | // createDayLabels(); |
476 | 478 | ||
477 | // these blank widgets make the All Day Event box line up with the agenda | 479 | // these blank widgets make the All Day Event box line up with the agenda |
478 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 480 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
479 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 481 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
480 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 482 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
481 | 483 | ||
482 | // Scrolling | 484 | // Scrolling |
483 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 485 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
484 | mTimeLabels, SLOT(positionChanged())); | 486 | mTimeLabels, SLOT(positionChanged())); |
485 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 487 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
486 | SLOT(setContentsPos(int))); | 488 | SLOT(setContentsPos(int))); |
487 | 489 | ||
488 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 490 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
489 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 491 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
490 | 492 | ||
491 | // Create/Show/Edit/Delete Event | 493 | // Create/Show/Edit/Delete Event |
492 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 494 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
493 | SLOT(newEvent(int,int))); | 495 | SLOT(newEvent(int,int))); |
494 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 496 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
495 | SLOT(newTodo(int,int))); | 497 | SLOT(newTodo(int,int))); |
496 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 498 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
497 | SLOT(newEvent(int,int,int,int))); | 499 | SLOT(newEvent(int,int,int,int))); |
498 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 500 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
499 | SLOT(newEventAllDay(int,int))); | 501 | SLOT(newEventAllDay(int,int))); |
500 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 502 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
501 | SLOT(newTodoAllDay(int,int))); | 503 | SLOT(newTodoAllDay(int,int))); |
502 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 504 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
503 | SLOT(newEventAllDay(int,int))); | 505 | SLOT(newEventAllDay(int,int))); |
504 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 506 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
505 | SLOT(newTimeSpanSelected(int,int,int,int))); | 507 | SLOT(newTimeSpanSelected(int,int,int,int))); |
506 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 508 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
507 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 509 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
508 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 510 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
509 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 511 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
510 | 512 | ||
511 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 513 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
512 | SIGNAL(editIncidenceSignal(Incidence *))); | 514 | SIGNAL(editIncidenceSignal(Incidence *))); |
513 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 515 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
514 | SIGNAL(editIncidenceSignal(Incidence *))); | 516 | SIGNAL(editIncidenceSignal(Incidence *))); |
515 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 517 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
516 | SIGNAL(showIncidenceSignal(Incidence *))); | 518 | SIGNAL(showIncidenceSignal(Incidence *))); |
517 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 519 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
518 | SIGNAL(showIncidenceSignal(Incidence *))); | 520 | SIGNAL(showIncidenceSignal(Incidence *))); |
519 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 521 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
520 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 522 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
521 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 523 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
522 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 524 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
523 | 525 | ||
524 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 526 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
525 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 527 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
526 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 528 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
527 | SLOT(updateEventDates(KOAgendaItem *, int))); | 529 | SLOT(updateEventDates(KOAgendaItem *, int))); |
528 | 530 | ||
529 | // event indicator update | 531 | // event indicator update |
530 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 532 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
531 | SLOT(updateEventIndicatorTop(int))); | 533 | SLOT(updateEventIndicatorTop(int))); |
532 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 534 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
533 | SLOT(updateEventIndicatorBottom(int))); | 535 | SLOT(updateEventIndicatorBottom(int))); |
534 | // drag signals | 536 | // drag signals |
535 | /* | 537 | /* |
536 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 538 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
537 | SLOT(startDrag(Event *))); | 539 | SLOT(startDrag(Event *))); |
538 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 540 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
539 | SLOT(startDrag(Event *))); | 541 | SLOT(startDrag(Event *))); |
540 | */ | 542 | */ |
541 | // synchronize selections | 543 | // synchronize selections |
542 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 544 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
543 | mAllDayAgenda, SLOT( deselectItem() ) ); | 545 | mAllDayAgenda, SLOT( deselectItem() ) ); |
544 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 546 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
545 | mAgenda, SLOT( deselectItem() ) ); | 547 | mAgenda, SLOT( deselectItem() ) ); |
546 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 548 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
547 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 549 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
548 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 550 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
549 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 551 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
550 | connect( mAgenda, SIGNAL( resizedSignal() ), | 552 | connect( mAgenda, SIGNAL( resizedSignal() ), |
551 | SLOT( updateConfig( ) ) ); | 553 | SLOT( updateConfig( ) ) ); |
552 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 554 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
553 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 555 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
554 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 556 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
555 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 557 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
556 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 558 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
557 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 559 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
558 | 560 | ||
559 | 561 | ||
560 | } | 562 | } |
561 | 563 | ||
562 | void KOAgendaView::toggleAllDay() | 564 | void KOAgendaView::toggleAllDay() |
563 | { | 565 | { |
564 | if ( mSplitterAgenda->firstHandle() ) | 566 | if ( mSplitterAgenda->firstHandle() ) |
565 | mSplitterAgenda->firstHandle()->toggle(); | 567 | mSplitterAgenda->firstHandle()->toggle(); |
566 | } | 568 | } |
567 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 569 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
568 | { | 570 | { |
569 | calendar()->addIncidence( inc ); | 571 | calendar()->addIncidence( inc ); |
570 | 572 | ||
571 | if ( incOld ) { | 573 | if ( incOld ) { |
572 | if ( incOld->type() == "Todo" ) | 574 | if ( incOld->type() == "Todo" ) |
573 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 575 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
574 | else | 576 | else |
575 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 577 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
576 | } | 578 | } |
577 | 579 | ||
578 | } | 580 | } |
579 | 581 | ||
580 | KOAgendaView::~KOAgendaView() | 582 | KOAgendaView::~KOAgendaView() |
581 | { | 583 | { |
582 | delete mAgendaPopup; | 584 | delete mAgendaPopup; |
583 | delete mAllDayAgendaPopup; | 585 | delete mAllDayAgendaPopup; |
584 | delete KOAgendaItem::paintPix(); | 586 | delete KOAgendaItem::paintPix(); |
585 | delete KOAgendaItem::paintPixSel(); | 587 | delete KOAgendaItem::paintPixSel(); |
586 | } | 588 | } |
587 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 589 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
588 | { | 590 | { |
589 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 591 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
590 | bool uc = false; | 592 | bool uc = false; |
591 | int ow = e->oldSize().width(); | 593 | int ow = e->oldSize().width(); |
592 | int oh = e->oldSize().height(); | 594 | int oh = e->oldSize().height(); |
593 | int w = e->size().width(); | 595 | int w = e->size().width(); |
594 | int h = e->size().height(); | 596 | int h = e->size().height(); |
595 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 597 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
596 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 598 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
597 | uc = true; | 599 | uc = true; |
598 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 600 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
599 | } | 601 | } |
600 | mUpcomingWidth = e->size().width() ; | 602 | mUpcomingWidth = e->size().width() ; |
601 | if ( mBlockUpdating || uc ) { | 603 | if ( mBlockUpdating || uc ) { |
602 | mBlockUpdating = false; | 604 | mBlockUpdating = false; |
603 | //mAgenda->setMinimumSize(800 , 600 ); | 605 | //mAgenda->setMinimumSize(800 , 600 ); |
604 | //qDebug("mAgenda->resize+++++++++++++++ "); | 606 | //qDebug("mAgenda->resize+++++++++++++++ "); |
605 | updateConfig(); | 607 | updateConfig(); |
606 | //qDebug("KOAgendaView::Updating now possible "); | 608 | //qDebug("KOAgendaView::Updating now possible "); |
607 | } else | 609 | } else |
608 | createDayLabels(); | 610 | createDayLabels(); |
609 | //qDebug("resizeEvent end "); | 611 | //qDebug("resizeEvent end "); |
610 | 612 | ||
611 | } | 613 | } |
612 | void KOAgendaView::slotDaylabelClicked() | 614 | void KOAgendaView::slotDaylabelClicked( int num ) |
613 | { | 615 | { |
614 | QString cap = ((QPushButton*) sender() )->caption(); | 616 | |
615 | |||
616 | QDate firstDate = mSelectedDates.first(); | 617 | QDate firstDate = mSelectedDates.first(); |
617 | if ( cap == "0" ) | 618 | if ( num == -1 ) |
618 | emit showDateView( 6, firstDate ); | 619 | emit showDateView( 6, firstDate ); |
619 | else if ( cap != "last" ) { | 620 | else if (num >= 0 ) { |
620 | if ( mSelectedDates.count() == 1) | 621 | if ( mSelectedDates.count() == 1) |
621 | emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) ); | 622 | emit showDateView( 9, firstDate.addDays( num ) ); |
622 | else | 623 | else |
623 | emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); | 624 | emit showDateView( 3, firstDate.addDays( num ) ); |
624 | } | 625 | } |
625 | else | 626 | else |
626 | showDateView( 10, firstDate.addDays(1) ); | 627 | showDateView( 10, firstDate.addDays(1) ); |
627 | } | 628 | } |
628 | 629 | ||
629 | QPushButton* KOAgendaView::getNewDaylabel() | 630 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
630 | { | 631 | { |
631 | 632 | ||
632 | QPushButton * dayLabel = new QPushButton(mDayLabels); | 633 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
633 | dayLabel->setFlat( true ); | 634 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
634 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
635 | dayLabel->setFocusPolicy(NoFocus); | ||
636 | dayLabel->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | ||
637 | mDayLabelsList.append( dayLabel ); | 635 | mDayLabelsList.append( dayLabel ); |
638 | mLayoutDayLabels->addWidget(dayLabel); | 636 | mLayoutDayLabels->addWidget(dayLabel); |
639 | //mLayoutDayLabels->setStretchFactor(dayLabel, 100); | ||
640 | return dayLabel ; | 637 | return dayLabel ; |
641 | } | 638 | } |
642 | 639 | ||
643 | void KOAgendaView::createDayLabels() | 640 | void KOAgendaView::createDayLabels() |
644 | { | 641 | { |
645 | 642 | ||
646 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 643 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
647 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 644 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
648 | return; | 645 | return; |
649 | 646 | ||
650 | } | 647 | } |
651 | int newHight; | 648 | int newHight; |
652 | 649 | ||
653 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 650 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
654 | // It would remove some flickering and gain speed (since this is called by | 651 | // It would remove some flickering and gain speed (since this is called by |
655 | // each updateView() call) | 652 | // each updateView() call) |
656 | 653 | ||
657 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 654 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
658 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 655 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
659 | if ( maxWid < 0 ) | 656 | if ( maxWid < 0 ) |
660 | maxWid = 20; | 657 | maxWid = 20; |
661 | 658 | ||
662 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 659 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
663 | QFontMetrics fm ( dlf ); | 660 | QFontMetrics fm ( dlf ); |
664 | int selCount = mSelectedDates.count(); | 661 | int selCount = mSelectedDates.count(); |
665 | QString dayTest = "Won 20"; | 662 | QString dayTest = "Mon 20"; |
666 | //QString dayTest = "Mon 20"; | 663 | //QString dayTest = "Mon 20"; |
667 | int wid = fm.width( dayTest ); | 664 | int wid = fm.width( dayTest ); |
668 | //maxWid -= ( selCount * 3 ); //working for QLabels | 665 | //maxWid -= ( selCount * 3 ); //working for QLabels |
669 | maxWid -= ( selCount * 5 ); //working for QPushButton | 666 | maxWid -= ( selCount * 3 ); //working for QPushButton |
670 | if ( maxWid < 0 ) | 667 | if ( maxWid < 0 ) |
671 | maxWid = 20; | 668 | maxWid = 20; |
672 | int needWid = wid * selCount; | 669 | int needWid = wid * selCount; |
673 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 670 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
674 | //if ( needWid > maxWid ) | 671 | //if ( needWid > maxWid ) |
675 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 672 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
676 | while ( needWid > maxWid ) { | 673 | while ( needWid > maxWid ) { |
677 | dayTest = dayTest.left( dayTest.length() - 1 ); | 674 | dayTest = dayTest.left( dayTest.length() - 1 ); |
678 | wid = fm.width( dayTest )+1; | 675 | wid = fm.width( dayTest ); |
679 | needWid = wid * selCount; | 676 | needWid = wid * selCount; |
680 | } | 677 | } |
681 | int maxLen = dayTest.length(); | 678 | int maxLen = dayTest.length(); |
682 | int fontPoint = dlf.pointSize(); | 679 | int fontPoint = dlf.pointSize(); |
683 | if ( maxLen < 2 ) { | 680 | if ( maxLen < 2 ) { |
684 | int fontPoint = dlf.pointSize(); | 681 | int fontPoint = dlf.pointSize(); |
685 | while ( fontPoint > 4 ) { | 682 | while ( fontPoint > 4 ) { |
686 | --fontPoint; | 683 | --fontPoint; |
687 | dlf.setPointSize( fontPoint ); | 684 | dlf.setPointSize( fontPoint ); |
688 | QFontMetrics f( dlf ); | 685 | QFontMetrics f( dlf ); |
689 | wid = f.width( "30" )+3; | 686 | wid = f.width( "30" ); |
690 | needWid = wid * selCount; | 687 | needWid = wid * selCount; |
691 | if ( needWid < maxWid ) | 688 | if ( needWid < maxWid ) |
692 | break; | 689 | break; |
693 | } | 690 | } |
694 | maxLen = 2; | 691 | maxLen = 2; |
695 | } | 692 | } |
696 | //qDebug("Max len %d ", dayTest.length() ); | 693 | //qDebug("Max len %d ", dayTest.length() ); |
697 | 694 | ||
698 | QFontMetrics tempF( dlf ); | 695 | QFontMetrics tempF( dlf ); |
699 | newHight = tempF.height(); | 696 | newHight = tempF.height(); |
700 | mDayLabels->setFont( dlf ); | 697 | mDayLabels->setFont( dlf ); |
701 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 698 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
702 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 699 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
703 | //mLayoutDayLabels->addSpacing( 2 ); | 700 | //mLayoutDayLabels->addSpacing( 2 ); |
704 | // QFont lFont = dlf; | 701 | // QFont lFont = dlf; |
705 | bool appendLabels = false; | 702 | bool appendLabels = false; |
706 | QPushButton *dayLabel; | 703 | KOAgendaButton *dayLabel; |
707 | dayLabel = mDayLabelsList.first(); | 704 | dayLabel = mDayLabelsList.first(); |
708 | if ( !dayLabel ) { | 705 | if ( !dayLabel ) { |
709 | appendLabels = true; | 706 | appendLabels = true; |
710 | dayLabel = getNewDaylabel(); | 707 | dayLabel = getNewDaylabel(); |
711 | } | 708 | } |
712 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 709 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
713 | dayLabel->setFont( dlf ); | 710 | dayLabel->setFont( dlf ); |
714 | dayLabel->setCaption("0"); | 711 | dayLabel->setNum( -1 ); |
715 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 712 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
716 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 713 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
717 | dayLabel->show(); | 714 | dayLabel->show(); |
718 | DateList::ConstIterator dit; | 715 | DateList::ConstIterator dit; |
719 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 716 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
720 | int counter = 0; | 717 | int counter = -1; |
721 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 718 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
722 | ++counter; | 719 | ++counter; |
723 | QDate date = *dit; | 720 | QDate date = *dit; |
724 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 721 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
725 | if ( ! appendLabels ) { | 722 | if ( ! appendLabels ) { |
726 | dayLabel = mDayLabelsList.next(); | 723 | dayLabel = mDayLabelsList.next(); |
727 | if ( !dayLabel ) | 724 | if ( !dayLabel ) |
728 | appendLabels = true; | 725 | appendLabels = true; |
729 | } | 726 | } |
730 | if ( appendLabels ) { | 727 | if ( appendLabels ) { |
731 | dayLabel = getNewDaylabel(); | 728 | dayLabel = getNewDaylabel(); |
732 | } | 729 | } |
733 | dayLabel->setMinimumWidth( 1 ); | 730 | dayLabel->setMinimumWidth( 1 ); |
734 | dayLabel->setMaximumWidth( 2048 ); | 731 | dayLabel->setMaximumWidth( 1024 ); |
735 | dayLabel->setFont( dlf ); | 732 | dayLabel->setFont( dlf ); |
736 | dayLabel->show(); | 733 | dayLabel->show(); |
737 | dayLabel->setCaption(QString::number( counter )); | 734 | dayLabel->setNum( counter ); |
738 | QString str; | 735 | QString str; |
739 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 736 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
740 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 737 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
741 | switch ( maxLen ) { | 738 | switch ( maxLen ) { |
742 | case 2: | 739 | case 2: |
743 | str = QString::number( date.day() ); | 740 | str = QString::number( date.day() ); |
744 | break; | 741 | break; |
745 | 742 | ||
746 | case 3: | 743 | case 3: |
747 | str = dayName.left( 1 ) +QString::number( date.day()); | 744 | str = dayName.left( 1 ) +QString::number( date.day()); |
748 | 745 | ||
749 | break; | 746 | break; |
750 | case 4: | 747 | case 4: |
751 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 748 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
752 | 749 | ||
753 | break; | 750 | break; |
754 | case 5: | 751 | case 5: |
755 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 752 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
756 | 753 | ||
757 | break; | 754 | break; |
758 | case 6: | 755 | case 6: |
759 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 756 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
760 | break; | 757 | break; |
761 | 758 | ||
762 | default: | 759 | default: |
763 | break; | 760 | break; |
764 | } | 761 | } |
765 | if ( oneday ) { | 762 | if ( oneday ) { |
766 | QString addString; | 763 | QString addString; |
767 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 764 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
768 | addString = i18n("Today"); | 765 | addString = i18n("Today"); |
769 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 766 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
770 | addString = i18n("Tomorrow"); | 767 | addString = i18n("Tomorrow"); |
771 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 768 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
772 | addString = i18n("Yesterday"); | 769 | addString = i18n("Yesterday"); |
773 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 770 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
774 | addString = i18n("Day before yesterday"); | 771 | addString = i18n("Day before yesterday"); |
775 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 772 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
776 | addString = i18n("Day after tomorrow"); | 773 | addString = i18n("Day after tomorrow"); |
777 | if ( !addString.isEmpty() ) { | 774 | if ( !addString.isEmpty() ) { |
778 | str = addString+", " + str; | 775 | str = addString+", " + str; |
779 | } | 776 | } |
780 | } | 777 | } |
781 | dayLabel->setText(str); | 778 | dayLabel->setText(str); |
782 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 779 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
783 | if (date == QDate::currentDate()) { | 780 | if (date == QDate::currentDate()) { |
784 | QFont bFont = dlf; | 781 | QFont bFont = dlf; |
785 | bFont.setBold( true ); | 782 | bFont.setBold( true ); |
786 | dayLabel->setFont(bFont); | 783 | dayLabel->setFont(bFont); |
787 | } | 784 | } |
788 | //dayLayout->addWidget(dayLabel); | 785 | //dayLayout->addWidget(dayLabel); |
789 | 786 | ||
790 | #ifndef KORG_NOPLUGINS | 787 | #ifndef KORG_NOPLUGINS |
791 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 788 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
792 | CalendarDecoration *it; | 789 | CalendarDecoration *it; |
793 | for(it = cds.first(); it; it = cds.next()) { | 790 | for(it = cds.first(); it; it = cds.next()) { |
794 | QString text = it->shortText( date ); | 791 | QString text = it->shortText( date ); |
795 | if ( !text.isEmpty() ) { | 792 | if ( !text.isEmpty() ) { |
796 | QLabel *label = new QLabel(text,mDayLabels); | 793 | QLabel *label = new QLabel(text,mDayLabels); |
797 | label->setAlignment(AlignCenter); | 794 | label->setAlignment(AlignCenter); |
798 | dayLayout->addWidget(label); | 795 | dayLayout->addWidget(label); |
799 | } | 796 | } |
800 | } | 797 | } |
801 | 798 | ||
802 | for(it = cds.first(); it; it = cds.next()) { | 799 | for(it = cds.first(); it; it = cds.next()) { |
803 | QWidget *wid = it->smallWidget(mDayLabels,date); | 800 | QWidget *wid = it->smallWidget(mDayLabels,date); |
804 | if ( wid ) { | 801 | if ( wid ) { |
805 | // wid->setHeight(20); | 802 | // wid->setHeight(20); |
806 | dayLayout->addWidget(wid); | 803 | dayLayout->addWidget(wid); |
807 | } | 804 | } |
808 | } | 805 | } |
809 | #endif | 806 | #endif |
810 | } | 807 | } |
811 | if ( ! appendLabels ) { | 808 | if ( ! appendLabels ) { |
812 | dayLabel = mDayLabelsList.next(); | 809 | dayLabel = mDayLabelsList.next(); |
813 | if ( !dayLabel ) | 810 | if ( !dayLabel ) |
814 | appendLabels = true; | 811 | appendLabels = true; |
815 | } | 812 | } |
816 | if ( appendLabels ) { | 813 | if ( appendLabels ) { |
817 | dayLabel = getNewDaylabel(); | 814 | dayLabel = getNewDaylabel(); |
818 | } | 815 | } |
819 | //dayLabel->hide();//test only | 816 | //dayLabel->hide();//test only |
820 | 817 | ||
821 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 818 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
822 | if ( offset < 0 ) offset = 0; | 819 | if ( offset < 0 ) offset = 0; |
823 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 820 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
824 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 821 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
825 | dayLabel->setFont( dlf ); | 822 | dayLabel->setFont( dlf ); |
826 | dayLabel->show(); | 823 | dayLabel->show(); |
827 | dayLabel->setCaption("last"); | 824 | dayLabel->setNum( -2 ); |
828 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 825 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
829 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 826 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
830 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 827 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
831 | if ( !appendLabels ) { | 828 | if ( !appendLabels ) { |
832 | dayLabel = mDayLabelsList.next(); | 829 | dayLabel = mDayLabelsList.next(); |
833 | while ( dayLabel ) { | 830 | while ( dayLabel ) { |
834 | //qDebug("!dayLabel %d",dayLabel ); | 831 | //qDebug("!dayLabel %d",dayLabel ); |
835 | dayLabel->hide(); | 832 | dayLabel->hide(); |
836 | dayLabel = mDayLabelsList.next(); | 833 | dayLabel = mDayLabelsList.next(); |
837 | } | 834 | } |
838 | } | 835 | } |
839 | //mDayLabelsFrame->show(); | 836 | //mDayLabelsFrame->show(); |
840 | //mDayLabels->show(); | 837 | //mDayLabels->show(); |
841 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | 838 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); |
842 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | 839 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); |
843 | mDayLabelsFrame->setFixedHeight( newHight ); | 840 | mDayLabelsFrame->setFixedHeight( newHight ); |
844 | } | 841 | } |
845 | 842 | ||
846 | int KOAgendaView::maxDatesHint() | 843 | int KOAgendaView::maxDatesHint() |
847 | { | 844 | { |
848 | // Not sure about the max number of events, so return 0 for now. | 845 | // Not sure about the max number of events, so return 0 for now. |
849 | return 0; | 846 | return 0; |
850 | } | 847 | } |
851 | 848 | ||
852 | int KOAgendaView::currentDateCount() | 849 | int KOAgendaView::currentDateCount() |
853 | { | 850 | { |
854 | return mSelectedDates.count(); | 851 | return mSelectedDates.count(); |
855 | } | 852 | } |
856 | 853 | ||
857 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 854 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
858 | { | 855 | { |
859 | QPtrList<Incidence> selected; | 856 | QPtrList<Incidence> selected; |
860 | Incidence *incidence; | 857 | Incidence *incidence; |
861 | 858 | ||
862 | incidence = mAgenda->selectedIncidence(); | 859 | incidence = mAgenda->selectedIncidence(); |
863 | if (incidence) selected.append(incidence); | 860 | if (incidence) selected.append(incidence); |
864 | 861 | ||
865 | incidence = mAllDayAgenda->selectedIncidence(); | 862 | incidence = mAllDayAgenda->selectedIncidence(); |
866 | if (incidence) selected.append(incidence); | 863 | if (incidence) selected.append(incidence); |
867 | 864 | ||
868 | return selected; | 865 | return selected; |
869 | } | 866 | } |
870 | 867 | ||
871 | DateList KOAgendaView::selectedDates() | 868 | DateList KOAgendaView::selectedDates() |
872 | { | 869 | { |
873 | DateList selected; | 870 | DateList selected; |
874 | QDate qd; | 871 | QDate qd; |
875 | 872 | ||
876 | qd = mAgenda->selectedIncidenceDate(); | 873 | qd = mAgenda->selectedIncidenceDate(); |
877 | if (qd.isValid()) selected.append(qd); | 874 | if (qd.isValid()) selected.append(qd); |
878 | 875 | ||
879 | qd = mAllDayAgenda->selectedIncidenceDate(); | 876 | qd = mAllDayAgenda->selectedIncidenceDate(); |
880 | if (qd.isValid()) selected.append(qd); | 877 | if (qd.isValid()) selected.append(qd); |
881 | 878 | ||
882 | return selected; | 879 | return selected; |
883 | } | 880 | } |
884 | 881 | ||
885 | 882 | ||
886 | void KOAgendaView::updateView() | 883 | void KOAgendaView::updateView() |
887 | { | 884 | { |
888 | if ( mBlockUpdating ) | 885 | if ( mBlockUpdating ) |
889 | return; | 886 | return; |
890 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 887 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
891 | fillAgenda(); | 888 | fillAgenda(); |
892 | 889 | ||
893 | } | 890 | } |
894 | 891 | ||
895 | 892 | ||
896 | /* | 893 | /* |
897 | Update configuration settings for the agenda view. This method is not | 894 | Update configuration settings for the agenda view. This method is not |
898 | complete. | 895 | complete. |
899 | */ | 896 | */ |
900 | void KOAgendaView::updateConfig() | 897 | void KOAgendaView::updateConfig() |
901 | { | 898 | { |
902 | if ( mBlockUpdating ) | 899 | if ( mBlockUpdating ) |
903 | return; | 900 | return; |
904 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; | 901 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; |
905 | 902 | ||
906 | // update config for children | 903 | // update config for children |
907 | mTimeLabels->updateConfig(); | 904 | mTimeLabels->updateConfig(); |
908 | mAgenda->storePosition(); | 905 | mAgenda->storePosition(); |
909 | mAgenda->updateConfig(); | 906 | mAgenda->updateConfig(); |
910 | mAllDayAgenda->updateConfig(); | 907 | mAllDayAgenda->updateConfig(); |
911 | // widget synchronization | 908 | // widget synchronization |
912 | //TODO: find a better way, maybe signal/slot | 909 | //TODO: find a better way, maybe signal/slot |
913 | mTimeLabels->positionChanged(); | 910 | mTimeLabels->positionChanged(); |
914 | 911 | ||
915 | // for some reason, this needs to be called explicitly | 912 | // for some reason, this needs to be called explicitly |
916 | mTimeLabels->repaint(); | 913 | mTimeLabels->repaint(); |
917 | 914 | ||
918 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 915 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
919 | 916 | ||
920 | // ToolTips displaying summary of events | 917 | // ToolTips displaying summary of events |
921 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 918 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
922 | ->mEnableToolTips); | 919 | ->mEnableToolTips); |
923 | 920 | ||
924 | //setHolidayMasks(); | 921 | //setHolidayMasks(); |
925 | 922 | ||
926 | //createDayLabels(); called by via updateView(); | 923 | //createDayLabels(); called by via updateView(); |
927 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 924 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
928 | updateView(); | 925 | updateView(); |
929 | mAgenda->restorePosition(); | 926 | mAgenda->restorePosition(); |
930 | } | 927 | } |
931 | 928 | ||
932 | 929 | ||
933 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 930 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
934 | { | 931 | { |
935 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 932 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
936 | //qDebug("KOAgendaView::updateEventDates "); | 933 | //qDebug("KOAgendaView::updateEventDates "); |
937 | QDateTime startDt,endDt; | 934 | QDateTime startDt,endDt; |
938 | QDate startDate; | 935 | QDate startDate; |
939 | int lenInSecs; | 936 | int lenInSecs; |
940 | // if ( type == KOAgenda::RESIZETOP ) | 937 | // if ( type == KOAgenda::RESIZETOP ) |
941 | // qDebug("RESIZETOP "); | 938 | // qDebug("RESIZETOP "); |
942 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 939 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
943 | // qDebug("RESIZEBOTTOM "); | 940 | // qDebug("RESIZEBOTTOM "); |
944 | // if ( type == KOAgenda::MOVE ) | 941 | // if ( type == KOAgenda::MOVE ) |
945 | // qDebug("MOVE "); | 942 | // qDebug("MOVE "); |
946 | if ( item->incidence()->type() == "Event" ) { | 943 | if ( item->incidence()->type() == "Event" ) { |
947 | startDt =item->incidence()->dtStart(); | 944 | startDt =item->incidence()->dtStart(); |
948 | endDt = item->incidence()->dtEnd(); | 945 | endDt = item->incidence()->dtEnd(); |
949 | lenInSecs = startDt.secsTo( endDt ); | 946 | lenInSecs = startDt.secsTo( endDt ); |
950 | } | 947 | } |
951 | 948 | ||
952 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 949 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
953 | 950 | ||
954 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 951 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
955 | startDate = mSelectedDates[item->mLastMoveXPos]; | 952 | startDate = mSelectedDates[item->mLastMoveXPos]; |
956 | } else { | 953 | } else { |
957 | if (item->cellX() < 0) { | 954 | if (item->cellX() < 0) { |
958 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 955 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
959 | } else { | 956 | } else { |
960 | startDate = mSelectedDates[item->cellX()]; | 957 | startDate = mSelectedDates[item->cellX()]; |
961 | } | 958 | } |
962 | } | 959 | } |
963 | startDt.setDate(startDate); | 960 | startDt.setDate(startDate); |
964 | 961 | ||
965 | if (item->incidence()->doesFloat()) { | 962 | if (item->incidence()->doesFloat()) { |
966 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 963 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
967 | } else { | 964 | } else { |
968 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 965 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
969 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 966 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
970 | if ( item->incidence()->type() == "Event" ) { | 967 | if ( item->incidence()->type() == "Event" ) { |
971 | if ( type == KOAgenda::MOVE ) { | 968 | if ( type == KOAgenda::MOVE ) { |
972 | endDt = startDt.addSecs(lenInSecs); | 969 | endDt = startDt.addSecs(lenInSecs); |
973 | 970 | ||
974 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 971 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
975 | if (item->lastMultiItem()) { | 972 | if (item->lastMultiItem()) { |
976 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 973 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
977 | endDt.setDate(startDate. | 974 | endDt.setDate(startDate. |
978 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 975 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
979 | } else { | 976 | } else { |
980 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 977 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
981 | endDt.setDate(startDate); | 978 | endDt.setDate(startDate); |
982 | } | 979 | } |
983 | } | 980 | } |
984 | } else { | 981 | } else { |
985 | // todo | 982 | // todo |
986 | qDebug("tooooodoooooo "); | 983 | qDebug("tooooodoooooo "); |
987 | if (item->lastMultiItem()) { | 984 | if (item->lastMultiItem()) { |
988 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 985 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
989 | endDt.setDate(startDate. | 986 | endDt.setDate(startDate. |
990 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 987 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
991 | } else { | 988 | } else { |
992 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 989 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
993 | if ( item->cellYBottom() > 0 ) | 990 | if ( item->cellYBottom() > 0 ) |
994 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 991 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
995 | else | 992 | else |
996 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 993 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
997 | endDt.setDate(startDate); | 994 | endDt.setDate(startDate); |
998 | } | 995 | } |
999 | } | 996 | } |
1000 | } | 997 | } |
1001 | if ( item->incidence()->type() == "Event" ) { | 998 | if ( item->incidence()->type() == "Event" ) { |
1002 | item->incidence()->setDtStart(startDt); | 999 | item->incidence()->setDtStart(startDt); |
1003 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1000 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1004 | } else if ( item->incidence()->type() == "Todo" ) { | 1001 | } else if ( item->incidence()->type() == "Todo" ) { |
1005 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); | 1002 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); |
1006 | } | 1003 | } |
1007 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1004 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1008 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1005 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1009 | item->setItemDate(startDt.date()); | 1006 | item->setItemDate(startDt.date()); |
1010 | //item->updateItem(); | 1007 | //item->updateItem(); |
1011 | if ( item->incidence()->type() == "Todo" ) { | 1008 | if ( item->incidence()->type() == "Todo" ) { |
1012 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1009 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1013 | 1010 | ||
1014 | } | 1011 | } |
1015 | else | 1012 | else |
1016 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1013 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1017 | item->updateItem(); | 1014 | item->updateItem(); |
1018 | } | 1015 | } |
1019 | 1016 | ||
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index cbe86b6..e9e85cc 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -1,264 +1,289 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 | #ifndef KOAGENDAVIEW_H | 23 | #ifndef KOAGENDAVIEW_H |
24 | #define KOAGENDAVIEW_H | 24 | #define KOAGENDAVIEW_H |
25 | 25 | ||
26 | #include <qscrollview.h> | 26 | #include <qscrollview.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qpushbutton.h> | ||
28 | #include <qlayout.h> | 29 | #include <qlayout.h> |
29 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
30 | #include <qksplitter.h> | 31 | #include <qksplitter.h> |
31 | #else | 32 | #else |
32 | #include <qsplitter.h> | 33 | #include <qsplitter.h> |
33 | #endif | 34 | #endif |
34 | #include <qmemarray.h> | 35 | #include <qmemarray.h> |
35 | 36 | ||
36 | #include "koeventview.h" | 37 | #include "koeventview.h" |
37 | 38 | ||
38 | |||
39 | class QHBox; | 39 | class QHBox; |
40 | class QFrame; | 40 | class QFrame; |
41 | class QLabel; | 41 | class QLabel; |
42 | class QPushButton; | 42 | class QPushButton; |
43 | class CalendarView; | 43 | class CalendarView; |
44 | class KOAgenda; | 44 | class KOAgenda; |
45 | class KOAgendaItem; | 45 | class KOAgendaItem; |
46 | class KConfig; | 46 | class KConfig; |
47 | class KDGanttMinimizeSplitter; | 47 | class KDGanttMinimizeSplitter; |
48 | |||
49 | class KOAgendaButton : public QPushButton | ||
50 | { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | KOAgendaButton( QWidget *parent=0, const char *name=0 ) : | ||
54 | QPushButton( parent, name ) | ||
55 | { | ||
56 | mNum = -3; | ||
57 | setFlat( true ); | ||
58 | setFocusPolicy(NoFocus); | ||
59 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | ||
60 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); | ||
61 | }; | ||
62 | |||
63 | QSize sizeHint () const { return QSize( 5,5) ;} | ||
64 | void setNum( int n) { mNum = n; } | ||
65 | private slots: | ||
66 | void bClicked() {emit numClicked( mNum);} | ||
67 | signals: | ||
68 | void numClicked( int ); | ||
69 | private: | ||
70 | int mNum; | ||
71 | }; | ||
72 | |||
48 | class TimeLabels : public QScrollView { | 73 | class TimeLabels : public QScrollView { |
49 | Q_OBJECT | 74 | Q_OBJECT |
50 | public: | 75 | public: |
51 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); | 76 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); |
52 | 77 | ||
53 | void setCellHeight(int height); | 78 | void setCellHeight(int height); |
54 | 79 | ||
55 | /** Calculates the minimum width */ | 80 | /** Calculates the minimum width */ |
56 | virtual int minimumWidth() const; | 81 | virtual int minimumWidth() const; |
57 | 82 | ||
58 | /** updates widget's internal state */ | 83 | /** updates widget's internal state */ |
59 | void updateConfig(); | 84 | void updateConfig(); |
60 | 85 | ||
61 | /** */ | 86 | /** */ |
62 | void setAgenda(KOAgenda* agenda); | 87 | void setAgenda(KOAgenda* agenda); |
63 | 88 | ||
64 | /** */ | 89 | /** */ |
65 | virtual void paintEvent(QPaintEvent* e); | 90 | virtual void paintEvent(QPaintEvent* e); |
66 | void contentsMousePressEvent ( QMouseEvent * ) ; | 91 | void contentsMousePressEvent ( QMouseEvent * ) ; |
67 | void contentsMouseReleaseEvent ( QMouseEvent * ); | 92 | void contentsMouseReleaseEvent ( QMouseEvent * ); |
68 | void contentsMouseMoveEvent ( QMouseEvent * ); | 93 | void contentsMouseMoveEvent ( QMouseEvent * ); |
69 | 94 | ||
70 | public slots: | 95 | public slots: |
71 | /** update time label positions */ | 96 | /** update time label positions */ |
72 | void positionChanged(); | 97 | void positionChanged(); |
73 | signals: | 98 | signals: |
74 | void scaleChanged(); | 99 | void scaleChanged(); |
75 | protected: | 100 | protected: |
76 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
77 | 102 | ||
78 | private: | 103 | private: |
79 | int mMouseDownY; | 104 | int mMouseDownY; |
80 | QString mOrgCap; | 105 | QString mOrgCap; |
81 | int mRows; | 106 | int mRows; |
82 | int mCellHeight; | 107 | int mCellHeight; |
83 | 108 | ||
84 | /** */ | 109 | /** */ |
85 | KOAgenda* mAgenda; | 110 | KOAgenda* mAgenda; |
86 | }; | 111 | }; |
87 | 112 | ||
88 | class EventIndicator : public QFrame { | 113 | class EventIndicator : public QFrame { |
89 | Q_OBJECT | 114 | Q_OBJECT |
90 | public: | 115 | public: |
91 | enum Location { Top, Bottom }; | 116 | enum Location { Top, Bottom }; |
92 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 117 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
93 | virtual ~EventIndicator(); | 118 | virtual ~EventIndicator(); |
94 | 119 | ||
95 | void changeColumns(int columns); | 120 | void changeColumns(int columns); |
96 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 121 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
97 | void setXOffset( int ); | 122 | void setXOffset( int ); |
98 | void enableColumn(int column, bool enable); | 123 | void enableColumn(int column, bool enable); |
99 | 124 | ||
100 | protected: | 125 | protected: |
101 | void drawContents(QPainter *); | 126 | void drawContents(QPainter *); |
102 | 127 | ||
103 | private: | 128 | private: |
104 | int mXOffset; | 129 | int mXOffset; |
105 | KDGanttMinimizeSplitter* mPaintWidget; | 130 | KDGanttMinimizeSplitter* mPaintWidget; |
106 | int mColumns; | 131 | int mColumns; |
107 | QHBox *mTopBox; | 132 | QHBox *mTopBox; |
108 | QBoxLayout *mTopLayout; | 133 | QBoxLayout *mTopLayout; |
109 | Location mLocation; | 134 | Location mLocation; |
110 | QPixmap mPixmap; | 135 | QPixmap mPixmap; |
111 | QMemArray<bool> mEnabled; | 136 | QMemArray<bool> mEnabled; |
112 | }; | 137 | }; |
113 | 138 | ||
114 | /** | 139 | /** |
115 | KOAgendaView is the agenda-like view used to display events in an one or | 140 | KOAgendaView is the agenda-like view used to display events in an one or |
116 | multi-day view. | 141 | multi-day view. |
117 | */ | 142 | */ |
118 | class KOAgendaView : public KOEventView { | 143 | class KOAgendaView : public KOEventView { |
119 | Q_OBJECT | 144 | Q_OBJECT |
120 | public: | 145 | public: |
121 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 146 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
122 | virtual ~KOAgendaView(); | 147 | virtual ~KOAgendaView(); |
123 | void setStartHour( int ); | 148 | void setStartHour( int ); |
124 | void toggleAllDay(); | 149 | void toggleAllDay(); |
125 | 150 | ||
126 | 151 | ||
127 | /** Returns maximum number of days supported by the koagendaview */ | 152 | /** Returns maximum number of days supported by the koagendaview */ |
128 | virtual int maxDatesHint(); | 153 | virtual int maxDatesHint(); |
129 | 154 | ||
130 | /** Returns number of currently shown dates. */ | 155 | /** Returns number of currently shown dates. */ |
131 | virtual int currentDateCount(); | 156 | virtual int currentDateCount(); |
132 | 157 | ||
133 | /** returns the currently selected events */ | 158 | /** returns the currently selected events */ |
134 | virtual QPtrList<Incidence> selectedIncidences(); | 159 | virtual QPtrList<Incidence> selectedIncidences(); |
135 | 160 | ||
136 | /** returns the currently selected events */ | 161 | /** returns the currently selected events */ |
137 | virtual DateList selectedDates(); | 162 | virtual DateList selectedDates(); |
138 | 163 | ||
139 | /** Remove all events from view */ | 164 | /** Remove all events from view */ |
140 | void clearView(); | 165 | void clearView(); |
141 | KOAgenda *agenda() { return mAgenda;} | 166 | KOAgenda *agenda() { return mAgenda;} |
142 | virtual void printPreview(CalPrinter *calPrinter, | 167 | virtual void printPreview(CalPrinter *calPrinter, |
143 | const QDate &, const QDate &); | 168 | const QDate &, const QDate &); |
144 | 169 | ||
145 | /** start-datetime of selection */ | 170 | /** start-datetime of selection */ |
146 | QDateTime selectionStart() {return mTimeSpanBegin;} | 171 | QDateTime selectionStart() {return mTimeSpanBegin;} |
147 | /** end-datetime of selection */ | 172 | /** end-datetime of selection */ |
148 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 173 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
149 | /** returns true if selection is for whole day */ | 174 | /** returns true if selection is for whole day */ |
150 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
151 | /** make selected start/end invalid */ | 176 | /** make selected start/end invalid */ |
152 | void deleteSelectedDateTime(); | 177 | void deleteSelectedDateTime(); |
153 | void repaintAgenda(); | 178 | void repaintAgenda(); |
154 | public slots: | 179 | public slots: |
155 | virtual void updateView(); | 180 | virtual void updateView(); |
156 | virtual void updateConfig(); | 181 | virtual void updateConfig(); |
157 | virtual void showDates(const QDate &start, const QDate &end); | 182 | virtual void showDates(const QDate &start, const QDate &end); |
158 | virtual void showEvents(QPtrList<Event> eventList); | 183 | virtual void showEvents(QPtrList<Event> eventList); |
159 | 184 | ||
160 | void updateTodo( Todo *, int ); | 185 | void updateTodo( Todo *, int ); |
161 | void changeEventDisplay(Event *, int); | 186 | void changeEventDisplay(Event *, int); |
162 | 187 | ||
163 | void clearSelection(); | 188 | void clearSelection(); |
164 | 189 | ||
165 | void newTodo(int gx,int gy); | 190 | void newTodo(int gx,int gy); |
166 | void newEvent(int gx,int gy); | 191 | void newEvent(int gx,int gy); |
167 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
168 | void newEventAllDay(int gx, int gy); | 193 | void newEventAllDay(int gx, int gy); |
169 | void newTodoAllDay(int gx, int gy); | 194 | void newTodoAllDay(int gx, int gy); |
170 | 195 | ||
171 | void startDrag(Event *); | 196 | void startDrag(Event *); |
172 | 197 | ||
173 | void readSettings(); | 198 | void readSettings(); |
174 | void readSettings(KConfig *); | 199 | void readSettings(KConfig *); |
175 | void writeSettings(KConfig *); | 200 | void writeSettings(KConfig *); |
176 | 201 | ||
177 | void setContentsPos(int y); | 202 | void setContentsPos(int y); |
178 | 203 | ||
179 | void setExpandedButton( bool expanded ); | 204 | void setExpandedButton( bool expanded ); |
180 | void scrollOneHourUp(); | 205 | void scrollOneHourUp(); |
181 | void scrollOneHourDown(); | 206 | void scrollOneHourDown(); |
182 | void addToCalSlot(Incidence *, Incidence *); | 207 | void addToCalSlot(Incidence *, Incidence *); |
183 | 208 | ||
184 | signals: | 209 | signals: |
185 | void showDateView( int, QDate ); | 210 | void showDateView( int, QDate ); |
186 | void newTodoSignal( QDateTime ,bool ); | 211 | void newTodoSignal( QDateTime ,bool ); |
187 | void toggleExpand(); | 212 | void toggleExpand(); |
188 | void todoMoved( Todo *, int ); | 213 | void todoMoved( Todo *, int ); |
189 | void incidenceChanged(Incidence * , int ); | 214 | void incidenceChanged(Incidence * , int ); |
190 | // void cloneIncidenceSignal(Incidence *); | 215 | // void cloneIncidenceSignal(Incidence *); |
191 | 216 | ||
192 | protected: | 217 | protected: |
193 | QPushButton* getNewDaylabel(); | 218 | KOAgendaButton* getNewDaylabel(); |
194 | bool mBlockUpdating; | 219 | bool mBlockUpdating; |
195 | int mUpcomingWidth; | 220 | int mUpcomingWidth; |
196 | /** Fill agenda beginning with date startDate */ | 221 | /** Fill agenda beginning with date startDate */ |
197 | void fillAgenda(const QDate &startDate); | 222 | void fillAgenda(const QDate &startDate); |
198 | void resizeEvent( QResizeEvent* e ); | 223 | void resizeEvent( QResizeEvent* e ); |
199 | /** Fill agenda using the current set value for the start date */ | 224 | /** Fill agenda using the current set value for the start date */ |
200 | void fillAgenda(); | 225 | void fillAgenda(); |
201 | 226 | ||
202 | /** Create labels for the selected dates. */ | 227 | /** Create labels for the selected dates. */ |
203 | void createDayLabels(); | 228 | void createDayLabels(); |
204 | 229 | ||
205 | /** | 230 | /** |
206 | Set the masks on the agenda widgets indicating, which days are holidays. | 231 | Set the masks on the agenda widgets indicating, which days are holidays. |
207 | */ | 232 | */ |
208 | void setHolidayMasks(); | 233 | void setHolidayMasks(); |
209 | 234 | ||
210 | protected slots: | 235 | protected slots: |
211 | void slotDaylabelClicked(); | 236 | void slotDaylabelClicked( int ); |
212 | /** Update event belonging to agenda item */ | 237 | /** Update event belonging to agenda item */ |
213 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 238 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
214 | //void updateMovedTodo(); | 239 | //void updateMovedTodo(); |
215 | 240 | ||
216 | void updateEventIndicatorTop(int newY); | 241 | void updateEventIndicatorTop(int newY); |
217 | void updateEventIndicatorBottom(int newY); | 242 | void updateEventIndicatorBottom(int newY); |
218 | 243 | ||
219 | /** Updates data for selected timespan */ | 244 | /** Updates data for selected timespan */ |
220 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 245 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
221 | /** Updates data for selected timespan for all day event*/ | 246 | /** Updates data for selected timespan for all day event*/ |
222 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 247 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
223 | 248 | ||
224 | private: | 249 | private: |
225 | // view widgets | 250 | // view widgets |
226 | QFrame *mDayLabels; | 251 | QFrame *mDayLabels; |
227 | QHBox *mDayLabelsFrame; | 252 | QHBox *mDayLabelsFrame; |
228 | QBoxLayout *mLayoutDayLabels; | 253 | QBoxLayout *mLayoutDayLabels; |
229 | QFrame *mAllDayFrame; | 254 | QFrame *mAllDayFrame; |
230 | KOAgenda *mAllDayAgenda; | 255 | KOAgenda *mAllDayAgenda; |
231 | KOAgenda *mAgenda; | 256 | KOAgenda *mAgenda; |
232 | TimeLabels *mTimeLabels; | 257 | TimeLabels *mTimeLabels; |
233 | QWidget *mDummyAllDayLeft; | 258 | QWidget *mDummyAllDayLeft; |
234 | 259 | ||
235 | KDGanttMinimizeSplitter* mSplitterAgenda; | 260 | KDGanttMinimizeSplitter* mSplitterAgenda; |
236 | QPushButton *mExpandButton; | 261 | QPushButton *mExpandButton; |
237 | 262 | ||
238 | DateList mSelectedDates; // List of dates to be displayed | 263 | DateList mSelectedDates; // List of dates to be displayed |
239 | int mViewType; | 264 | int mViewType; |
240 | 265 | ||
241 | bool mWeekStartsMonday; | 266 | bool mWeekStartsMonday; |
242 | int mStartHour; | 267 | int mStartHour; |
243 | 268 | ||
244 | KOEventPopupMenu *mAgendaPopup; | 269 | KOEventPopupMenu *mAgendaPopup; |
245 | KOEventPopupMenu *mAllDayAgendaPopup; | 270 | KOEventPopupMenu *mAllDayAgendaPopup; |
246 | 271 | ||
247 | EventIndicator *mEventIndicatorTop; | 272 | EventIndicator *mEventIndicatorTop; |
248 | EventIndicator *mEventIndicatorBottom; | 273 | EventIndicator *mEventIndicatorBottom; |
249 | 274 | ||
250 | QMemArray<int> mMinY; | 275 | QMemArray<int> mMinY; |
251 | QMemArray<int> mMaxY; | 276 | QMemArray<int> mMaxY; |
252 | 277 | ||
253 | QMemArray<bool> mHolidayMask; | 278 | QMemArray<bool> mHolidayMask; |
254 | 279 | ||
255 | QPixmap mExpandedPixmap; | 280 | QPixmap mExpandedPixmap; |
256 | QPixmap mNotExpandedPixmap; | 281 | QPixmap mNotExpandedPixmap; |
257 | QPtrList<QPushButton> mDayLabelsList; | 282 | QPtrList<KOAgendaButton> mDayLabelsList; |
258 | QDateTime mTimeSpanBegin; | 283 | QDateTime mTimeSpanBegin; |
259 | QDateTime mTimeSpanEnd; | 284 | QDateTime mTimeSpanEnd; |
260 | bool mTimeSpanInAllDay; | 285 | bool mTimeSpanInAllDay; |
261 | void keyPressEvent ( QKeyEvent * e ); | 286 | void keyPressEvent ( QKeyEvent * e ); |
262 | }; | 287 | }; |
263 | 288 | ||
264 | #endif // KOAGENDAVIEW_H | 289 | #endif // KOAGENDAVIEW_H |