author | zautrix <zautrix> | 2005-07-05 08:37:52 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-05 08:37:52 (UTC) |
commit | 7e49703511de87f624cc8813b18ebbfcc01752cd (patch) (unidiff) | |
tree | 896918396dbf518f6358a066f93a04bd4185f535 | |
parent | 28ca4c37fb0e131b2978584992840b3fdca21d3e (diff) | |
download | kdepimpi-7e49703511de87f624cc8813b18ebbfcc01752cd.zip kdepimpi-7e49703511de87f624cc8813b18ebbfcc01752cd.tar.gz kdepimpi-7e49703511de87f624cc8813b18ebbfcc01752cd.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/koagenda.cpp | 35 | ||||
-rw-r--r-- | korganizer/koagenda.h | 3 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 22 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 |
4 files changed, 44 insertions, 17 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index c339b57..662576f 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1,632 +1,642 @@ | |||
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 | Marcus Bains line. | 5 | Marcus Bains line. |
6 | Copyright (c) 2001 Ali Rahimi | 6 | Copyright (c) 2001 Ali Rahimi |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #define protected public | 28 | #define protected public |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #undef protected | 30 | #undef protected |
31 | #endif | 31 | #endif |
32 | #include <qintdict.h> | 32 | #include <qintdict.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | 43 | ||
44 | #include "koagendaitem.h" | 44 | #include "koagendaitem.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "koagenda.h" | 48 | #include "koagenda.h" |
49 | 49 | ||
50 | #include <libkcal/event.h> | 50 | #include <libkcal/event.h> |
51 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
52 | 52 | ||
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | //extern bool globalFlagBlockPainting; | 57 | //extern bool globalFlagBlockPainting; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | bool KOAgenda::mInvalidPixmap = false; | 63 | |
64 | //////////////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////////////// |
65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 65 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) |
66 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 66 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
67 | { | 67 | { |
68 | setLineWidth(0); | 68 | setLineWidth(0); |
69 | setMargin(0); | 69 | setMargin(0); |
70 | setBackgroundColor(Qt::red); | 70 | setBackgroundColor(Qt::red); |
71 | minutes = new QTimer(this); | 71 | minutes = new QTimer(this); |
72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 72 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
73 | minutes->start(0, true); | 73 | minutes->start(0, true); |
74 | mTimeBox = new QLabel(this); | 74 | mTimeBox = new QLabel(this); |
75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
76 | QPalette pal = mTimeBox->palette(); | 76 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 77 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 78 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 79 | //mTimeBox->setAutoMask(true); |
80 | 80 | ||
81 | agenda->addChild(mTimeBox); | 81 | agenda->addChild(mTimeBox); |
82 | 82 | ||
83 | oldToday = -1; | 83 | oldToday = -1; |
84 | } | 84 | } |
85 | 85 | ||
86 | MarcusBains::~MarcusBains() | 86 | MarcusBains::~MarcusBains() |
87 | { | 87 | { |
88 | delete minutes; | 88 | delete minutes; |
89 | } | 89 | } |
90 | 90 | ||
91 | int MarcusBains::todayColumn() | 91 | int MarcusBains::todayColumn() |
92 | { | 92 | { |
93 | QDate currentDate = QDate::currentDate(); | 93 | QDate currentDate = QDate::currentDate(); |
94 | 94 | ||
95 | DateList dateList = agenda->dateList(); | 95 | DateList dateList = agenda->dateList(); |
96 | DateList::ConstIterator it; | 96 | DateList::ConstIterator it; |
97 | int col = 0; | 97 | int col = 0; |
98 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 98 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
99 | if((*it) == currentDate) | 99 | if((*it) == currentDate) |
100 | return KOGlobals::self()->reverseLayout() ? | 100 | return KOGlobals::self()->reverseLayout() ? |
101 | agenda->columns() - 1 - col : col; | 101 | agenda->columns() - 1 - col : col; |
102 | ++col; | 102 | ++col; |
103 | } | 103 | } |
104 | 104 | ||
105 | return -1; | 105 | return -1; |
106 | } | 106 | } |
107 | void MarcusBains::updateLoc() | 107 | void MarcusBains::updateLoc() |
108 | { | 108 | { |
109 | updateLocation(); | 109 | updateLocation(); |
110 | } | 110 | } |
111 | void MarcusBains::updateLocation(bool recalculate) | 111 | void MarcusBains::updateLocation(bool recalculate) |
112 | { | 112 | { |
113 | 113 | ||
114 | QTime tim = QTime::currentTime(); | 114 | QTime tim = QTime::currentTime(); |
115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
116 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 116 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
117 | recalculate = true; | 117 | recalculate = true; |
118 | 118 | ||
119 | int mins = tim.hour()*60 + tim.minute(); | 119 | int mins = tim.hour()*60 + tim.minute(); |
120 | int minutesPerCell = 24 * 60 / agenda->rows(); | 120 | int minutesPerCell = 24 * 60 / agenda->rows(); |
121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
122 | int today = recalculate ? todayColumn() : oldToday; | 122 | int today = recalculate ? todayColumn() : oldToday; |
123 | int x = agenda->gridSpacingX()*today; | 123 | int x = agenda->gridSpacingX()*today; |
124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
125 | 125 | ||
126 | oldTime = tim; | 126 | oldTime = tim; |
127 | oldToday = today; | 127 | oldToday = today; |
128 | 128 | ||
129 | if(disabled || (today<0)) { | 129 | if(disabled || (today<0)) { |
130 | hide(); mTimeBox->hide(); | 130 | hide(); mTimeBox->hide(); |
131 | return; | 131 | return; |
132 | } else { | 132 | } else { |
133 | show(); mTimeBox->show(); | 133 | show(); mTimeBox->show(); |
134 | } | 134 | } |
135 | 135 | ||
136 | if(recalculate) | 136 | if(recalculate) |
137 | setFixedSize(agenda->gridSpacingX(),1); | 137 | setFixedSize(agenda->gridSpacingX(),1); |
138 | agenda->moveChild(this, x, y); | 138 | agenda->moveChild(this, x, y); |
139 | raise(); | 139 | raise(); |
140 | 140 | ||
141 | if(recalculate) | 141 | if(recalculate) |
142 | //mTimeBox->setFont(QFont("helvetica",10)); | 142 | //mTimeBox->setFont(QFont("helvetica",10)); |
143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
144 | 144 | ||
145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
146 | mTimeBox->adjustSize(); | 146 | mTimeBox->adjustSize(); |
147 | // the -2 below is there because there is a bug in this program | 147 | // the -2 below is there because there is a bug in this program |
148 | // somewhere, where the last column of this widget is a few pixels | 148 | // somewhere, where the last column of this widget is a few pixels |
149 | // narrower than the other columns. | 149 | // narrower than the other columns. |
150 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 150 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
151 | agenda->moveChild(mTimeBox, | 151 | agenda->moveChild(mTimeBox, |
152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
153 | y-mTimeBox->height()); | 153 | y-mTimeBox->height()); |
154 | 154 | ||
155 | mTimeBox->raise(); | 155 | mTimeBox->raise(); |
156 | //mTimeBox->setAutoMask(true); | 156 | //mTimeBox->setAutoMask(true); |
157 | minutes->start(5000,true); | 157 | minutes->start(5000,true); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | //////////////////////////////////////////////////////////////////////////// | 161 | //////////////////////////////////////////////////////////////////////////// |
162 | 162 | ||
163 | 163 | ||
164 | /* | 164 | /* |
165 | Create an agenda widget with rows rows and columns columns. | 165 | Create an agenda widget with rows rows and columns columns. |
166 | */ | 166 | */ |
167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
168 | const char *name,WFlags f) : | 168 | const char *name,WFlags f) : |
169 | QScrollView(parent,name,f) | 169 | QScrollView(parent,name,f) |
170 | { | 170 | { |
171 | 171 | ||
172 | mAllAgendaPopup = 0; | 172 | mAllAgendaPopup = 0; |
173 | mColumns = columns; | 173 | mColumns = columns; |
174 | mRows = rows; | 174 | mRows = rows; |
175 | mGridSpacingY = rowSize; | 175 | mGridSpacingY = rowSize; |
176 | mAllDayMode = false; | 176 | mAllDayMode = false; |
177 | #ifndef DESKTOP_VERSION | 177 | #ifndef DESKTOP_VERSION |
178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
179 | #endif | 179 | #endif |
180 | mHolidayMask = 0; | 180 | mHolidayMask = 0; |
181 | init(); | 181 | init(); |
182 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); | 182 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
186 | Create an agenda widget with columns columns and one row. This is used for | 186 | Create an agenda widget with columns columns and one row. This is used for |
187 | all-day events. | 187 | all-day events. |
188 | */ | 188 | */ |
189 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 189 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
190 | QScrollView(parent,name,f) | 190 | QScrollView(parent,name,f) |
191 | { | 191 | { |
192 | mAllAgendaPopup = 0; | 192 | mAllAgendaPopup = 0; |
193 | blockResize = false; | 193 | blockResize = false; |
194 | mColumns = columns; | 194 | mColumns = columns; |
195 | mRows = 1; | 195 | mRows = 1; |
196 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 196 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
197 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 197 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
198 | mAllDayMode = true; | 198 | mAllDayMode = true; |
199 | #ifndef DESKTOP_VERSION | 199 | #ifndef DESKTOP_VERSION |
200 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 200 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
201 | #endif | 201 | #endif |
202 | mHolidayMask = 0; | 202 | mHolidayMask = 0; |
203 | init(); | 203 | init(); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | KOAgenda::~KOAgenda() | 207 | KOAgenda::~KOAgenda() |
208 | { | 208 | { |
209 | if(mMarcusBains) delete mMarcusBains; | 209 | if(mMarcusBains) delete mMarcusBains; |
210 | 210 | ||
211 | } | 211 | } |
212 | 212 | ||
213 | Incidence *KOAgenda::selectedIncidence() const | 213 | Incidence *KOAgenda::selectedIncidence() const |
214 | { | 214 | { |
215 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 215 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | QDate KOAgenda::selectedIncidenceDate() const | 219 | QDate KOAgenda::selectedIncidenceDate() const |
220 | { | 220 | { |
221 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 221 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | void KOAgenda::init() | 225 | void KOAgenda::init() |
226 | { | 226 | { |
227 | mPopupTimer = new QTimer(this); | 227 | mPopupTimer = new QTimer(this); |
228 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 228 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
229 | 229 | ||
230 | mNewItemPopup = new QPopupMenu( this ); | 230 | mNewItemPopup = new QPopupMenu( this ); |
231 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 231 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
232 | QString pathString = ""; | 232 | QString pathString = ""; |
233 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 233 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
234 | if ( QApplication::desktop()->width() < 480 ) | 234 | if ( QApplication::desktop()->width() < 480 ) |
235 | pathString += "icons16/"; | 235 | pathString += "icons16/"; |
236 | } else | 236 | } else |
237 | pathString += "iconsmini/"; | 237 | pathString += "iconsmini/"; |
238 | 238 | ||
239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); | 240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); |
241 | mNewItemPopup->insertSeparator ( ); | 241 | mNewItemPopup->insertSeparator ( ); |
242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); | 243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); |
244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); | 244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); |
245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); | 245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); |
246 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); | 246 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); |
247 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 247 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
248 | #ifndef _WIN32_ | 248 | #ifndef _WIN32_ |
249 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 249 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
250 | viewport()->setWFlags ( wflags); | 250 | viewport()->setWFlags ( wflags); |
251 | #endif | 251 | #endif |
252 | mGridSpacingX = 80; | 252 | mGridSpacingX = 80; |
253 | mResizeBorderWidth = 8; | 253 | mResizeBorderWidth = 8; |
254 | mScrollBorderWidth = 8; | 254 | mScrollBorderWidth = 8; |
255 | mScrollDelay = 30; | 255 | mScrollDelay = 30; |
256 | mScrollOffset = 10; | 256 | mScrollOffset = 10; |
257 | mPaintPixmap.resize( 20,20); | 257 | mPaintPixmap.resize( 20,20); |
258 | //enableClipper(true); | 258 | //enableClipper(true); |
259 | 259 | ||
260 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 260 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
261 | // effect. Has to be fixed. | 261 | // effect. Has to be fixed. |
262 | setFocusPolicy(WheelFocus); | 262 | setFocusPolicy(WheelFocus); |
263 | 263 | ||
264 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 264 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
265 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 265 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
266 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 266 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
267 | 267 | ||
268 | mStartCellX = 0; | 268 | mStartCellX = 0; |
269 | mStartCellY = 0; | 269 | mStartCellY = 0; |
270 | mCurrentCellX = 0; | 270 | mCurrentCellX = 0; |
271 | mCurrentCellY = 0; | 271 | mCurrentCellY = 0; |
272 | 272 | ||
273 | mSelectionCellX = 0; | 273 | mSelectionCellX = 0; |
274 | mSelectionYTop = 0; | 274 | mSelectionYTop = 0; |
275 | mSelectionHeight = 0; | 275 | mSelectionHeight = 0; |
276 | 276 | ||
277 | mOldLowerScrollValue = -1; | 277 | mOldLowerScrollValue = -1; |
278 | mOldUpperScrollValue = -1; | 278 | mOldUpperScrollValue = -1; |
279 | 279 | ||
280 | mClickedItem = 0; | 280 | mClickedItem = 0; |
281 | 281 | ||
282 | mActionItem = 0; | 282 | mActionItem = 0; |
283 | mActionType = NOP; | 283 | mActionType = NOP; |
284 | mItemMoved = false; | 284 | mItemMoved = false; |
285 | 285 | ||
286 | mSelectedItem = 0; | 286 | mSelectedItem = 0; |
287 | 287 | ||
288 | // mItems.setAutoDelete(true); | 288 | // mItems.setAutoDelete(true); |
289 | 289 | ||
290 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 290 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
291 | 291 | ||
292 | viewport()->update(); | 292 | viewport()->update(); |
293 | 293 | ||
294 | setMinimumSize(30, 1); | 294 | setMinimumSize(30, 1); |
295 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 295 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
296 | 296 | ||
297 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 297 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
298 | // controlled in a way that the contents horizontally always fits. Then it is | 298 | // controlled in a way that the contents horizontally always fits. Then it is |
299 | // not necessary to turn off the scrollbar. | 299 | // not necessary to turn off the scrollbar. |
300 | setHScrollBarMode(AlwaysOff); | 300 | setHScrollBarMode(AlwaysOff); |
301 | if ( ! mAllDayMode ) | 301 | if ( ! mAllDayMode ) |
302 | setVScrollBarMode(AlwaysOn); | 302 | setVScrollBarMode(AlwaysOn); |
303 | else | 303 | else |
304 | setVScrollBarMode(AlwaysOff); | 304 | setVScrollBarMode(AlwaysOff); |
305 | 305 | ||
306 | setStartHour(KOPrefs::instance()->mDayBegins); | 306 | setStartHour(KOPrefs::instance()->mDayBegins); |
307 | 307 | ||
308 | calculateWorkingHours(); | 308 | calculateWorkingHours(); |
309 | 309 | ||
310 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 310 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
311 | SLOT(checkScrollBoundaries(int))); | 311 | SLOT(checkScrollBoundaries(int))); |
312 | 312 | ||
313 | // Create the Marcus Bains line. | 313 | // Create the Marcus Bains line. |
314 | if(mAllDayMode) | 314 | if(mAllDayMode) |
315 | mMarcusBains = 0; | 315 | mMarcusBains = 0; |
316 | else { | 316 | else { |
317 | mMarcusBains = new MarcusBains(this); | 317 | mMarcusBains = new MarcusBains(this); |
318 | addChild(mMarcusBains); | 318 | addChild(mMarcusBains); |
319 | } | 319 | } |
320 | mPopupKind = 0; | 320 | mPopupKind = 0; |
321 | mPopupItem = 0; | 321 | mPopupItem = 0; |
322 | mInvalidPixmap = false; | 322 | mInvalidPixmap = false; |
323 | 323 | ||
324 | } | 324 | } |
325 | 325 | ||
326 | void KOAgenda::shrinkPixmap() | 326 | void KOAgenda::shrinkPixmap() |
327 | { | 327 | { |
328 | mPaintPixmap.resize( 20,20); | 328 | mPaintPixmap.resize( 20,20); |
329 | mInvalidPixmap = true; | 329 | mInvalidPixmap = true; |
330 | } | 330 | } |
331 | void KOAgenda::slotContentMove(int,int) | 331 | void KOAgenda::slotContentMove(int,int) |
332 | { | 332 | { |
333 | emit sendPing(); | ||
333 | if ( mActionType == NOP ) | 334 | if ( mActionType == NOP ) |
334 | slotClearSelection(); | 335 | slotClearSelection(); |
335 | if ( mSelectedItem && !mActionItem ) { | 336 | if ( mSelectedItem && !mActionItem ) { |
336 | deselectItem(); | 337 | deselectItem(); |
337 | emit incidenceSelected( 0 ); | 338 | emit incidenceSelected( 0 ); |
338 | } | 339 | } |
339 | } | 340 | } |
340 | void KOAgenda::clear() | 341 | void KOAgenda::clear() |
341 | { | 342 | { |
342 | KOAgendaItem *item; | 343 | KOAgendaItem *item; |
343 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 344 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
344 | mUnusedItems.append( item ); | 345 | mUnusedItems.append( item ); |
345 | //item->hide(); | 346 | //item->hide(); |
346 | } | 347 | } |
347 | mItems.clear(); | 348 | mItems.clear(); |
348 | mSelectedItem = 0; | 349 | mSelectedItem = 0; |
349 | clearSelection(); | 350 | clearSelection(); |
350 | } | 351 | } |
351 | 352 | ||
352 | void KOAgenda::clearSelection() | 353 | void KOAgenda::clearSelection() |
353 | { | 354 | { |
354 | mSelectionCellX = 0; | 355 | mSelectionCellX = 0; |
355 | mSelectionYTop = 0; | 356 | mSelectionYTop = 0; |
356 | mSelectionHeight = 0; | 357 | mSelectionHeight = 0; |
357 | } | 358 | } |
358 | 359 | ||
359 | void KOAgenda::marcus_bains() | 360 | void KOAgenda::marcus_bains() |
360 | { | 361 | { |
361 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 362 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
362 | } | 363 | } |
363 | 364 | ||
364 | 365 | ||
365 | void KOAgenda::changeColumns(int columns) | 366 | void KOAgenda::changeColumns(int columns) |
366 | { | 367 | { |
367 | if (columns == 0) { | 368 | if (columns == 0) { |
368 | qDebug("KOAgenda::changeColumns() called with argument 0 "); | 369 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
369 | return; | 370 | return; |
370 | } | 371 | } |
371 | clear(); | 372 | clear(); |
372 | mColumns = columns; | 373 | mColumns = columns; |
373 | computeSizes(); | 374 | computeSizes(); |
374 | } | 375 | } |
375 | 376 | ||
376 | /* | 377 | /* |
377 | This is the eventFilter function, which gets all events from the KOAgendaItems | 378 | This is the eventFilter function, which gets all events from the KOAgendaItems |
378 | contained in the agenda. It has to handle moving and resizing for all items. | 379 | contained in the agenda. It has to handle moving and resizing for all items. |
379 | */ | 380 | */ |
380 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 381 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
381 | { | 382 | { |
382 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 383 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
383 | switch(event->type()) { | 384 | switch(event->type()) { |
384 | case QEvent::MouseButtonPress: | 385 | case QEvent::MouseButtonPress: |
385 | case QEvent::MouseButtonDblClick: | 386 | case QEvent::MouseButtonDblClick: |
386 | case QEvent::MouseButtonRelease: | 387 | case QEvent::MouseButtonRelease: |
387 | case QEvent::MouseMove: | 388 | case QEvent::MouseMove: |
388 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 389 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
389 | 390 | ||
390 | case (QEvent::Leave): | 391 | case (QEvent::Leave): |
391 | if (!mActionItem) | 392 | if (!mActionItem) |
392 | setCursor(arrowCursor); | 393 | setCursor(arrowCursor); |
393 | return true; | 394 | return true; |
394 | 395 | ||
395 | default: | 396 | default: |
396 | return QScrollView::eventFilter(object,event); | 397 | return QScrollView::eventFilter(object,event); |
397 | } | 398 | } |
398 | } | 399 | } |
399 | void KOAgenda::popupMenu() | 400 | void KOAgenda::popupMenu() |
400 | { | 401 | { |
401 | mPopupTimer->stop(); | 402 | mPopupTimer->stop(); |
402 | if ( mPopupKind == 1 || mPopupKind == 3 ) { | 403 | if ( mPopupKind == 1 || mPopupKind == 3 ) { |
403 | if (mActionItem ) { | 404 | if (mActionItem ) { |
404 | endItemAction(); | 405 | endItemAction(); |
405 | } | 406 | } |
406 | mLeftMouseDown = false; // no more leftMouse computation | 407 | mLeftMouseDown = false; // no more leftMouse computation |
407 | if (mPopupItem) { | 408 | if (mPopupItem) { |
408 | //mClickedItem = mPopupItem; | 409 | //mClickedItem = mPopupItem; |
409 | selectItem(mPopupItem); | 410 | selectItem(mPopupItem); |
410 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) | 411 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) |
411 | mAllAgendaPopup->installEventFilter( this ); | 412 | mAllAgendaPopup->installEventFilter( this ); |
412 | emit showIncidencePopupSignal(mPopupItem->incidence()); | 413 | emit showIncidencePopupSignal(mPopupItem->incidence()); |
413 | 414 | ||
414 | } | 415 | } |
415 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { | 416 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { |
416 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | 417 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action |
417 | endSelectAction( false ); // do not emit new event signal | 418 | endSelectAction( false ); // do not emit new event signal |
418 | mLeftMouseDown = false; // no more leftMouse computation | 419 | mLeftMouseDown = false; // no more leftMouse computation |
419 | } | 420 | } |
420 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) | 421 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) |
421 | mNewItemPopup->installEventFilter( this ); | 422 | mNewItemPopup->installEventFilter( this ); |
422 | mNewItemPopup->popup( mPopupPos); | 423 | mNewItemPopup->popup( mPopupPos); |
423 | 424 | ||
424 | } | 425 | } |
425 | mLeftMouseDown = false; | 426 | mLeftMouseDown = false; |
426 | mPopupItem = 0; | 427 | mPopupItem = 0; |
427 | mPopupKind = 0; | 428 | mPopupKind = 0; |
428 | } | 429 | } |
429 | void KOAgenda::categoryChanged(Incidence * inc) | 430 | void KOAgenda::categoryChanged(Incidence * inc) |
430 | { | 431 | { |
431 | KOAgendaItem *item; | 432 | KOAgendaItem *item; |
432 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 433 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
433 | if ( item->incidence() == inc ) { | 434 | if ( item->incidence() == inc ) { |
434 | item->initColor (); | 435 | item->initColor (); |
435 | item->updateItem(); | 436 | item->updateItem(); |
436 | } | 437 | } |
437 | } | 438 | } |
438 | } | 439 | } |
439 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 440 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
440 | { | 441 | { |
442 | |||
443 | if ( mInvalidPixmap ) { | ||
444 | mInvalidPixmap = false; | ||
445 | qDebug("InvalidPixmap "); | ||
446 | computeSizes(); | ||
447 | emit updateViewSignal(); | ||
448 | return true; | ||
449 | } | ||
450 | emit sendPing(); | ||
441 | static int startX = 0; | 451 | static int startX = 0; |
442 | static int startY = 0; | 452 | static int startY = 0; |
443 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); | 453 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
444 | static bool blockMoving = true; | 454 | static bool blockMoving = true; |
445 | 455 | ||
446 | //qDebug("KOAgenda::eventFilter_mous "); | 456 | //qDebug("KOAgenda::eventFilter_mous "); |
447 | if ( object == mNewItemPopup ) { | 457 | if ( object == mNewItemPopup ) { |
448 | //qDebug("mNewItemPopup "); | 458 | //qDebug("mNewItemPopup "); |
449 | if ( me->type() == QEvent::MouseButtonRelease ) { | 459 | if ( me->type() == QEvent::MouseButtonRelease ) { |
450 | mNewItemPopup->removeEventFilter( this ); | 460 | mNewItemPopup->removeEventFilter( this ); |
451 | int dX = me->globalPos().x() - mPopupPos.x();; | 461 | int dX = me->globalPos().x() - mPopupPos.x();; |
452 | if ( dX < 0 ) | 462 | if ( dX < 0 ) |
453 | dX = -dX; | 463 | dX = -dX; |
454 | int dY = me->globalPos().y() - mPopupPos.y(); | 464 | int dY = me->globalPos().y() - mPopupPos.y(); |
455 | if ( dY < 0 ) | 465 | if ( dY < 0 ) |
456 | dY = -dY; | 466 | dY = -dY; |
457 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 467 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
458 | mNewItemPopup->hide(); | 468 | mNewItemPopup->hide(); |
459 | } | 469 | } |
460 | } | 470 | } |
461 | return true; | 471 | return true; |
462 | } | 472 | } |
463 | if ( object == mAllAgendaPopup ) { | 473 | if ( object == mAllAgendaPopup ) { |
464 | //qDebug(" mAllAgendaPopup "); | 474 | //qDebug(" mAllAgendaPopup "); |
465 | if ( me->type() == QEvent::MouseButtonRelease ) { | 475 | if ( me->type() == QEvent::MouseButtonRelease ) { |
466 | mAllAgendaPopup->removeEventFilter( this ); | 476 | mAllAgendaPopup->removeEventFilter( this ); |
467 | int dX = me->globalPos().x() - mPopupPos.x();; | 477 | int dX = me->globalPos().x() - mPopupPos.x();; |
468 | if ( dX < 0 ) | 478 | if ( dX < 0 ) |
469 | dX = -dX; | 479 | dX = -dX; |
470 | int dY = me->globalPos().y() - mPopupPos.y(); | 480 | int dY = me->globalPos().y() - mPopupPos.y(); |
471 | if ( dY < 0 ) | 481 | if ( dY < 0 ) |
472 | dY = -dY; | 482 | dY = -dY; |
473 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 483 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
474 | mAllAgendaPopup->hide(); | 484 | mAllAgendaPopup->hide(); |
475 | } | 485 | } |
476 | } | 486 | } |
477 | return true; | 487 | return true; |
478 | } | 488 | } |
479 | QPoint viewportPos; | 489 | QPoint viewportPos; |
480 | if (object != viewport()) { | 490 | if (object != viewport()) { |
481 | blockmoveDist = blockmoveDist*2; | 491 | blockmoveDist = blockmoveDist*2; |
482 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 492 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
483 | } else { | 493 | } else { |
484 | viewportPos = me->pos(); | 494 | viewportPos = me->pos(); |
485 | } | 495 | } |
486 | bool objIsNotViewport = (object != viewport()); | 496 | bool objIsNotViewport = (object != viewport()); |
487 | bool leftButt = false; | 497 | bool leftButt = false; |
488 | #ifdef DESKTOP_VERSION | 498 | #ifdef DESKTOP_VERSION |
489 | leftButt = (me->button() == LeftButton); | 499 | leftButt = (me->button() == LeftButton); |
490 | #endif | 500 | #endif |
491 | switch (me->type()) { | 501 | switch (me->type()) { |
492 | case QEvent::MouseButtonPress: | 502 | case QEvent::MouseButtonPress: |
493 | if (me->button() == LeftButton) { | 503 | if (me->button() == LeftButton) { |
494 | mPopupTimer->start( 600 ); | 504 | mPopupTimer->start( 600 ); |
495 | mLeftMouseDown = true; | 505 | mLeftMouseDown = true; |
496 | } | 506 | } |
497 | blockMoving = true; | 507 | blockMoving = true; |
498 | startX = viewportPos.x(); | 508 | startX = viewportPos.x(); |
499 | startY = viewportPos.y(); | 509 | startY = viewportPos.y(); |
500 | mPopupPos = me->globalPos(); | 510 | mPopupPos = me->globalPos(); |
501 | if ( objIsNotViewport && !leftButt ) { | 511 | if ( objIsNotViewport && !leftButt ) { |
502 | KOAgendaItem * tempItem = (KOAgendaItem *)object; | 512 | KOAgendaItem * tempItem = (KOAgendaItem *)object; |
503 | if (mAllDayMode) { | 513 | if (mAllDayMode) { |
504 | if ( tempItem->height() > 10 ) { | 514 | if ( tempItem->height() > 10 ) { |
505 | int minV = tempItem->height()/4; | 515 | int minV = tempItem->height()/4; |
506 | if ( minV > (blockmoveDist/2)-2 ) { | 516 | if ( minV > (blockmoveDist/2)-2 ) { |
507 | if ( minV > blockmoveDist ) | 517 | if ( minV > blockmoveDist ) |
508 | minV = blockmoveDist; | 518 | minV = blockmoveDist; |
509 | else | 519 | else |
510 | minV = (blockmoveDist/2); | 520 | minV = (blockmoveDist/2); |
511 | } | 521 | } |
512 | bool border = false; | 522 | bool border = false; |
513 | int diff = tempItem->y() - viewportPos.y(); | 523 | int diff = tempItem->y() - viewportPos.y(); |
514 | if ( diff < 0 ) | 524 | if ( diff < 0 ) |
515 | diff *= -1; | 525 | diff *= -1; |
516 | if ( diff < minV ) { | 526 | if ( diff < minV ) { |
517 | border = true; | 527 | border = true; |
518 | objIsNotViewport = false; | 528 | objIsNotViewport = false; |
519 | } | 529 | } |
520 | if ( ! border ) { | 530 | if ( ! border ) { |
521 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); | 531 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); |
522 | if ( diff < 0 ) | 532 | if ( diff < 0 ) |
523 | diff *= -1; | 533 | diff *= -1; |
524 | if ( diff < minV ) { | 534 | if ( diff < minV ) { |
525 | border = true; | 535 | border = true; |
526 | objIsNotViewport = false; | 536 | objIsNotViewport = false; |
527 | } | 537 | } |
528 | } | 538 | } |
529 | } | 539 | } |
530 | } else { // not allday | 540 | } else { // not allday |
531 | if ( tempItem->width() > 10 ) { | 541 | if ( tempItem->width() > 10 ) { |
532 | int minH = tempItem->width()/4; | 542 | int minH = tempItem->width()/4; |
533 | if ( minH > (blockmoveDist/2)-2 ) { | 543 | if ( minH > (blockmoveDist/2)-2 ) { |
534 | if ( minH > blockmoveDist ) | 544 | if ( minH > blockmoveDist ) |
535 | minH = blockmoveDist; | 545 | minH = blockmoveDist; |
536 | else | 546 | else |
537 | minH = (blockmoveDist/2); | 547 | minH = (blockmoveDist/2); |
538 | } | 548 | } |
539 | bool border = false; | 549 | bool border = false; |
540 | int diff = tempItem->x() - viewportPos.x(); | 550 | int diff = tempItem->x() - viewportPos.x(); |
541 | if ( diff < 0 ) | 551 | if ( diff < 0 ) |
542 | diff *= -1; | 552 | diff *= -1; |
543 | if ( diff < minH ) { | 553 | if ( diff < minH ) { |
544 | border = true; | 554 | border = true; |
545 | objIsNotViewport = false; | 555 | objIsNotViewport = false; |
546 | } | 556 | } |
547 | if ( ! border ) { | 557 | if ( ! border ) { |
548 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); | 558 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); |
549 | if ( diff < 0 ) | 559 | if ( diff < 0 ) |
550 | diff *= -1; | 560 | diff *= -1; |
551 | if ( diff < minH ) { | 561 | if ( diff < minH ) { |
552 | border = true; | 562 | border = true; |
553 | objIsNotViewport = false; | 563 | objIsNotViewport = false; |
554 | } | 564 | } |
555 | } | 565 | } |
556 | } | 566 | } |
557 | } | 567 | } |
558 | } | 568 | } |
559 | if ( objIsNotViewport ) { | 569 | if ( objIsNotViewport ) { |
560 | mPopupItem = (KOAgendaItem *)object; | 570 | mPopupItem = (KOAgendaItem *)object; |
561 | mPopupKind = 1; | 571 | mPopupKind = 1; |
562 | if (me->button() == RightButton) { | 572 | if (me->button() == RightButton) { |
563 | mPopupKind = 3; | 573 | mPopupKind = 3; |
564 | popupMenu(); | 574 | popupMenu(); |
565 | } else if (me->button() == LeftButton) { | 575 | } else if (me->button() == LeftButton) { |
566 | mActionItem = (KOAgendaItem *)object; | 576 | mActionItem = (KOAgendaItem *)object; |
567 | if (mActionItem) { | 577 | if (mActionItem) { |
568 | emit signalClearSelection(); | 578 | emit signalClearSelection(); |
569 | slotClearSelection(); | 579 | slotClearSelection(); |
570 | selectItem(mActionItem); | 580 | selectItem(mActionItem); |
571 | Incidence *incidence = mActionItem->incidence(); | 581 | Incidence *incidence = mActionItem->incidence(); |
572 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 582 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
573 | mActionItem = 0; | 583 | mActionItem = 0; |
574 | } else { | 584 | } else { |
575 | startItemAction(viewportPos); | 585 | startItemAction(viewportPos); |
576 | } | 586 | } |
577 | } | 587 | } |
578 | } | 588 | } |
579 | } else { // ---------- viewport() | 589 | } else { // ---------- viewport() |
580 | mPopupItem = 0; | 590 | mPopupItem = 0; |
581 | mPopupKind = 2; | 591 | mPopupKind = 2; |
582 | selectItem(0); | 592 | selectItem(0); |
583 | mActionItem = 0; | 593 | mActionItem = 0; |
584 | if (me->button() == RightButton) { | 594 | if (me->button() == RightButton) { |
585 | int x,y; | 595 | int x,y; |
586 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 596 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
587 | int gx,gy; | 597 | int gx,gy; |
588 | contentsToGrid(x,y,gx,gy); | 598 | contentsToGrid(x,y,gx,gy); |
589 | mCurrentCellX = gx; | 599 | mCurrentCellX = gx; |
590 | mCurrentCellY = gy; | 600 | mCurrentCellY = gy; |
591 | mStartCellX = gx; | 601 | mStartCellX = gx; |
592 | mStartCellY = gy; | 602 | mStartCellY = gy; |
593 | mPopupKind = 4; | 603 | mPopupKind = 4; |
594 | popupMenu(); | 604 | popupMenu(); |
595 | } else if (me->button() == LeftButton) { | 605 | } else if (me->button() == LeftButton) { |
596 | setCursor(arrowCursor); | 606 | setCursor(arrowCursor); |
597 | startSelectAction(viewportPos); | 607 | startSelectAction(viewportPos); |
598 | } | 608 | } |
599 | } | 609 | } |
600 | break; | 610 | break; |
601 | 611 | ||
602 | case QEvent::MouseButtonRelease: | 612 | case QEvent::MouseButtonRelease: |
603 | if (me->button() == LeftButton ) { | 613 | if (me->button() == LeftButton ) { |
604 | mPopupTimer->stop(); | 614 | mPopupTimer->stop(); |
605 | } | 615 | } |
606 | if (object != viewport()) { | 616 | if (object != viewport()) { |
607 | if (me->button() == LeftButton && mLeftMouseDown) { | 617 | if (me->button() == LeftButton && mLeftMouseDown) { |
608 | if (mActionItem) { | 618 | if (mActionItem) { |
609 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 619 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
610 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 620 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
611 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 621 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
612 | mScrollUpTimer.stop(); | 622 | mScrollUpTimer.stop(); |
613 | mScrollDownTimer.stop(); | 623 | mScrollDownTimer.stop(); |
614 | mActionItem->resetMove(); | 624 | mActionItem->resetMove(); |
615 | placeSubCells( mActionItem ); | 625 | placeSubCells( mActionItem ); |
616 | // emit startDragSignal( mActionItem->incidence() ); | 626 | // emit startDragSignal( mActionItem->incidence() ); |
617 | setCursor( arrowCursor ); | 627 | setCursor( arrowCursor ); |
618 | mActionItem = 0; | 628 | mActionItem = 0; |
619 | mActionType = NOP; | 629 | mActionType = NOP; |
620 | mItemMoved = 0; | 630 | mItemMoved = 0; |
621 | mLeftMouseDown = false; | 631 | mLeftMouseDown = false; |
622 | return true; | 632 | return true; |
623 | } | 633 | } |
624 | endItemAction(); | 634 | endItemAction(); |
625 | } | 635 | } |
626 | } | 636 | } |
627 | 637 | ||
628 | } else { // ---------- viewport() | 638 | } else { // ---------- viewport() |
629 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | 639 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click |
630 | endSelectAction( true ); // emit new event signal | 640 | endSelectAction( true ); // emit new event signal |
631 | } | 641 | } |
632 | } | 642 | } |
@@ -1078,441 +1088,448 @@ void KOAgenda::endItemAction() | |||
1078 | globalFlagBlockAgendaItemUpdate = 0; | 1088 | globalFlagBlockAgendaItemUpdate = 0; |
1079 | item->paintMe(false); | 1089 | item->paintMe(false); |
1080 | globalFlagBlockAgendaItemUpdate = 1; | 1090 | globalFlagBlockAgendaItemUpdate = 1; |
1081 | item->repaint(false); | 1091 | item->repaint(false); |
1082 | } | 1092 | } |
1083 | */ | 1093 | */ |
1084 | 1094 | ||
1085 | 1095 | ||
1086 | } | 1096 | } |
1087 | 1097 | ||
1088 | } | 1098 | } |
1089 | 1099 | ||
1090 | mScrollUpTimer.stop(); | 1100 | mScrollUpTimer.stop(); |
1091 | mScrollDownTimer.stop(); | 1101 | mScrollDownTimer.stop(); |
1092 | setCursor( arrowCursor ); | 1102 | setCursor( arrowCursor ); |
1093 | mActionItem = 0; | 1103 | mActionItem = 0; |
1094 | mActionType = NOP; | 1104 | mActionType = NOP; |
1095 | mItemMoved = 0; | 1105 | mItemMoved = 0; |
1096 | 1106 | ||
1097 | } | 1107 | } |
1098 | 1108 | ||
1099 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | 1109 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) |
1100 | { | 1110 | { |
1101 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 1111 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
1102 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 1112 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
1103 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 1113 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
1104 | // point = clipper()->mapFromGlobal(point); | 1114 | // point = clipper()->mapFromGlobal(point); |
1105 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 1115 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
1106 | 1116 | ||
1107 | int x,y; | 1117 | int x,y; |
1108 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 1118 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
1109 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 1119 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
1110 | int gx,gy; | 1120 | int gx,gy; |
1111 | contentsToGrid(x,y,gx,gy); | 1121 | contentsToGrid(x,y,gx,gy); |
1112 | 1122 | ||
1113 | // Change cursor to resize cursor if appropriate | 1123 | // Change cursor to resize cursor if appropriate |
1114 | if (mAllDayMode) { | 1124 | if (mAllDayMode) { |
1115 | int gridDistanceX = (x - gx * mGridSpacingX); | 1125 | int gridDistanceX = (x - gx * mGridSpacingX); |
1116 | if (gridDistanceX < mResizeBorderWidth && | 1126 | if (gridDistanceX < mResizeBorderWidth && |
1117 | moveItem->cellX() == gx) { | 1127 | moveItem->cellX() == gx) { |
1118 | setCursor(sizeHorCursor); | 1128 | setCursor(sizeHorCursor); |
1119 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 1129 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
1120 | moveItem->cellXWidth() == gx) { | 1130 | moveItem->cellXWidth() == gx) { |
1121 | setCursor(sizeHorCursor); | 1131 | setCursor(sizeHorCursor); |
1122 | } else { | 1132 | } else { |
1123 | setCursor(arrowCursor); | 1133 | setCursor(arrowCursor); |
1124 | } | 1134 | } |
1125 | } else { | 1135 | } else { |
1126 | int gridDistanceY = (y - gy * mGridSpacingY); | 1136 | int gridDistanceY = (y - gy * mGridSpacingY); |
1127 | if (gridDistanceY < mResizeBorderWidth && | 1137 | if (gridDistanceY < mResizeBorderWidth && |
1128 | moveItem->cellYTop() == gy && | 1138 | moveItem->cellYTop() == gy && |
1129 | !moveItem->firstMultiItem()) { | 1139 | !moveItem->firstMultiItem()) { |
1130 | setCursor(sizeVerCursor); | 1140 | setCursor(sizeVerCursor); |
1131 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 1141 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
1132 | moveItem->cellYBottom() == gy && | 1142 | moveItem->cellYBottom() == gy && |
1133 | !moveItem->lastMultiItem()) { | 1143 | !moveItem->lastMultiItem()) { |
1134 | setCursor(sizeVerCursor); | 1144 | setCursor(sizeVerCursor); |
1135 | } else { | 1145 | } else { |
1136 | setCursor(arrowCursor); | 1146 | setCursor(arrowCursor); |
1137 | } | 1147 | } |
1138 | } | 1148 | } |
1139 | } | 1149 | } |
1140 | 1150 | ||
1141 | 1151 | ||
1142 | /* | 1152 | /* |
1143 | Place item in cell and take care that multiple items using the same cell do | 1153 | Place item in cell and take care that multiple items using the same cell do |
1144 | not overlap. This method is not yet optimal. It doesn´t use the maximum space | 1154 | not overlap. This method is not yet optimal. It doesn´t use the maximum space |
1145 | it can get in all cases. | 1155 | it can get in all cases. |
1146 | At the moment the method has a bug: When an item is placed only the sub cell | 1156 | At the moment the method has a bug: When an item is placed only the sub cell |
1147 | widths of the items are changed, which are within the Y region the item to | 1157 | widths of the items are changed, which are within the Y region the item to |
1148 | place spans. When the sub cell width change of one of this items affects a | 1158 | place spans. When the sub cell width change of one of this items affects a |
1149 | cell, where other items are, which do not overlap in Y with the item to place, | 1159 | cell, where other items are, which do not overlap in Y with the item to place, |
1150 | the display gets corrupted, although the corruption looks quite nice. | 1160 | the display gets corrupted, although the corruption looks quite nice. |
1151 | */ | 1161 | */ |
1152 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 1162 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) |
1153 | { | 1163 | { |
1154 | 1164 | ||
1155 | QPtrList<KOAgendaItem> conflictItems; | 1165 | QPtrList<KOAgendaItem> conflictItems; |
1156 | int maxSubCells = 0; | 1166 | int maxSubCells = 0; |
1157 | QIntDict<KOAgendaItem> subCellDict(7); | 1167 | QIntDict<KOAgendaItem> subCellDict(7); |
1158 | 1168 | ||
1159 | KOAgendaItem *item; | 1169 | KOAgendaItem *item; |
1160 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1170 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1161 | if (item != placeItem) { | 1171 | if (item != placeItem) { |
1162 | if (placeItem->cellX() <= item->cellXWidth() && | 1172 | if (placeItem->cellX() <= item->cellXWidth() && |
1163 | placeItem->cellXWidth() >= item->cellX()) { | 1173 | placeItem->cellXWidth() >= item->cellX()) { |
1164 | if ((placeItem->cellYTop() <= item->cellYBottom()) && | 1174 | if ((placeItem->cellYTop() <= item->cellYBottom()) && |
1165 | (placeItem->cellYBottom() >= item->cellYTop())) { | 1175 | (placeItem->cellYBottom() >= item->cellYTop())) { |
1166 | conflictItems.append(item); | 1176 | conflictItems.append(item); |
1167 | if (item->subCells() > maxSubCells) | 1177 | if (item->subCells() > maxSubCells) |
1168 | maxSubCells = item->subCells(); | 1178 | maxSubCells = item->subCells(); |
1169 | subCellDict.insert(item->subCell(),item); | 1179 | subCellDict.insert(item->subCell(),item); |
1170 | } | 1180 | } |
1171 | } | 1181 | } |
1172 | } | 1182 | } |
1173 | } | 1183 | } |
1174 | 1184 | ||
1175 | if (conflictItems.count() > 0) { | 1185 | if (conflictItems.count() > 0) { |
1176 | // Look for unused sub cell and insert item | 1186 | // Look for unused sub cell and insert item |
1177 | int i; | 1187 | int i; |
1178 | for(i=0;i<maxSubCells;++i) { | 1188 | for(i=0;i<maxSubCells;++i) { |
1179 | if (!subCellDict.find(i)) { | 1189 | if (!subCellDict.find(i)) { |
1180 | placeItem->setSubCell(i); | 1190 | placeItem->setSubCell(i); |
1181 | break; | 1191 | break; |
1182 | } | 1192 | } |
1183 | } | 1193 | } |
1184 | if (i == maxSubCells) { | 1194 | if (i == maxSubCells) { |
1185 | placeItem->setSubCell(maxSubCells); | 1195 | placeItem->setSubCell(maxSubCells); |
1186 | maxSubCells++; // add new item to number of sub cells | 1196 | maxSubCells++; // add new item to number of sub cells |
1187 | } | 1197 | } |
1188 | 1198 | ||
1189 | // Prepare for sub cell geometry adjustment | 1199 | // Prepare for sub cell geometry adjustment |
1190 | int newSubCellWidth; | 1200 | int newSubCellWidth; |
1191 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1201 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1192 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1202 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1193 | conflictItems.append(placeItem); | 1203 | conflictItems.append(placeItem); |
1194 | 1204 | ||
1195 | 1205 | ||
1196 | // Adjust sub cell geometry of all direct conflict items | 1206 | // Adjust sub cell geometry of all direct conflict items |
1197 | for ( item=conflictItems.first(); item != 0; | 1207 | for ( item=conflictItems.first(); item != 0; |
1198 | item=conflictItems.next() ) { | 1208 | item=conflictItems.next() ) { |
1199 | item->setSubCells(maxSubCells); | 1209 | item->setSubCells(maxSubCells); |
1200 | if (mAllDayMode) { | 1210 | if (mAllDayMode) { |
1201 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1211 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1202 | } else { | 1212 | } else { |
1203 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1213 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1204 | } | 1214 | } |
1205 | int x,y; | 1215 | int x,y; |
1206 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1216 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1207 | if (mAllDayMode) { | 1217 | if (mAllDayMode) { |
1208 | y += item->subCell() * newSubCellWidth; | 1218 | y += item->subCell() * newSubCellWidth; |
1209 | } else { | 1219 | } else { |
1210 | x += item->subCell() * newSubCellWidth; | 1220 | x += item->subCell() * newSubCellWidth; |
1211 | } | 1221 | } |
1212 | moveChild(item,x,y); | 1222 | moveChild(item,x,y); |
1213 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1223 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1214 | //item->updateItem(); | 1224 | //item->updateItem(); |
1215 | } | 1225 | } |
1216 | // Adjust sub cell geometry of all conflict items of all conflict items | 1226 | // Adjust sub cell geometry of all conflict items of all conflict items |
1217 | for ( item=conflictItems.first(); item != 0; | 1227 | for ( item=conflictItems.first(); item != 0; |
1218 | item=conflictItems.next() ) { | 1228 | item=conflictItems.next() ) { |
1219 | if ( placeItem != item ) { | 1229 | if ( placeItem != item ) { |
1220 | KOAgendaItem *item2; | 1230 | KOAgendaItem *item2; |
1221 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | 1231 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); |
1222 | for ( item2=conflictItems2.first(); item2 != 0; | 1232 | for ( item2=conflictItems2.first(); item2 != 0; |
1223 | item2=conflictItems2.next() ) { | 1233 | item2=conflictItems2.next() ) { |
1224 | if ( item2->subCells() != maxSubCells) { | 1234 | if ( item2->subCells() != maxSubCells) { |
1225 | item2->setSubCells(maxSubCells); | 1235 | item2->setSubCells(maxSubCells); |
1226 | if (mAllDayMode) { | 1236 | if (mAllDayMode) { |
1227 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1237 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1228 | } else { | 1238 | } else { |
1229 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1239 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
1230 | } | 1240 | } |
1231 | int x,y; | 1241 | int x,y; |
1232 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | 1242 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); |
1233 | if (mAllDayMode) { | 1243 | if (mAllDayMode) { |
1234 | y += item2->subCell() * newSubCellWidth; | 1244 | y += item2->subCell() * newSubCellWidth; |
1235 | } else { | 1245 | } else { |
1236 | x += item2->subCell() * newSubCellWidth; | 1246 | x += item2->subCell() * newSubCellWidth; |
1237 | } | 1247 | } |
1238 | moveChild(item2,x,y); | 1248 | moveChild(item2,x,y); |
1239 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1249 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1240 | } | 1250 | } |
1241 | } | 1251 | } |
1242 | } | 1252 | } |
1243 | } | 1253 | } |
1244 | } else { | 1254 | } else { |
1245 | placeItem->setSubCell(0); | 1255 | placeItem->setSubCell(0); |
1246 | placeItem->setSubCells(1); | 1256 | placeItem->setSubCells(1); |
1247 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1257 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1248 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1258 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1249 | int x,y; | 1259 | int x,y; |
1250 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1260 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1251 | moveChild(placeItem,x,y); | 1261 | moveChild(placeItem,x,y); |
1252 | } | 1262 | } |
1253 | placeItem->setConflictItems(conflictItems); | 1263 | placeItem->setConflictItems(conflictItems); |
1254 | // for ( item=conflictItems.first(); item != 0; | 1264 | // for ( item=conflictItems.first(); item != 0; |
1255 | // item=conflictItems.next() ) { | 1265 | // item=conflictItems.next() ) { |
1256 | // //item->updateItem(); | 1266 | // //item->updateItem(); |
1257 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1267 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1258 | // } | 1268 | // } |
1259 | // placeItem->updateItem(); | 1269 | // placeItem->updateItem(); |
1260 | } | 1270 | } |
1261 | 1271 | ||
1262 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1272 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1263 | { | 1273 | { |
1264 | if ( globalFlagBlockAgenda ) | 1274 | if ( globalFlagBlockAgenda ) |
1265 | return; | 1275 | return; |
1266 | 1276 | ||
1267 | if ( mInvalidPixmap ) { | 1277 | if ( mInvalidPixmap ) { |
1268 | mInvalidPixmap = false; | 1278 | mInvalidPixmap = false; |
1269 | qDebug("InvalidPixmap "); | 1279 | qDebug("InvalidPixmap "); |
1270 | QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() )); | 1280 | computeSizes(); |
1281 | emit updateViewSignal(); | ||
1271 | return; | 1282 | return; |
1272 | } | 1283 | } |
1273 | if ( ! mAllDayMode ) { | 1284 | if ( ! mAllDayMode ) { |
1274 | // currently not working for | 1285 | // currently not working for |
1275 | 1286 | ||
1276 | //qDebug("KOAgenda::drawContents "); | 1287 | //qDebug("KOAgenda::drawContents "); |
1277 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1288 | #if 0 |
1278 | ;//drawContentsToPainter(); | 1289 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1279 | 1290 | qDebug("WAU "); | |
1291 | drawContentsToPainter(); | ||
1292 | } | ||
1293 | #endif | ||
1280 | QPaintDevice* pd = p->device(); | 1294 | QPaintDevice* pd = p->device(); |
1281 | p->end(); | 1295 | p->end(); |
1282 | int vx, vy; | 1296 | int vx, vy; |
1283 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1297 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1284 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1298 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1285 | mSelectionCellX * mGridSpacingX; | 1299 | mSelectionCellX * mGridSpacingX; |
1286 | contentsToViewport ( cx, cy, vx,vy); | 1300 | contentsToViewport ( cx, cy, vx,vy); |
1287 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1301 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1288 | 1302 | ||
1289 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1303 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1290 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1304 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1291 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1305 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1292 | 1306 | ||
1293 | int vxSel, vySel; | 1307 | int vxSel, vySel; |
1294 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1308 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1295 | int off = mSelectionHeight; | 1309 | int off = mSelectionHeight; |
1296 | if ( vySel < 0 ) | 1310 | if ( vySel < 0 ) |
1297 | off += vySel; | 1311 | off += vySel; |
1298 | //qDebug("OFF %d %d %d", off,vySel, vy ); | 1312 | //qDebug("OFF %d %d %d", off,vySel, vy ); |
1299 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); | 1313 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); |
1300 | } else { | 1314 | } else { |
1301 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1315 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1302 | } | 1316 | } |
1303 | } | 1317 | } |
1304 | if ( mSelectionHeight > 0 ) { | 1318 | if ( mSelectionHeight > 0 ) { |
1305 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1319 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1306 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1320 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1307 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1321 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1308 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1322 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1309 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1323 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1310 | int hei = mSelectionHeight; | 1324 | int hei = mSelectionHeight; |
1311 | int offset = 0; | 1325 | int offset = 0; |
1312 | while ( hei > 0 ) { | 1326 | while ( hei > 0 ) { |
1313 | int p_hei = 5; | 1327 | int p_hei = 5; |
1314 | if ( hei < 5 ) p_hei = hei; | 1328 | if ( hei < 5 ) p_hei = hei; |
1315 | hei -= 5; | 1329 | hei -= 5; |
1316 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1330 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1317 | offset += 5; | 1331 | offset += 5; |
1318 | } | 1332 | } |
1319 | } | 1333 | } |
1320 | } | 1334 | } |
1321 | p->begin( pd ); | 1335 | p->begin( pd ); |
1322 | } else { | 1336 | } else { |
1323 | 1337 | #if 0 | |
1324 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1338 | qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); |
1325 | ;//drawContentsToPainter(); | 1339 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1326 | 1340 | qDebug("WAUWAU "); | |
1341 | drawContentsToPainter(); | ||
1342 | } | ||
1343 | #endif | ||
1327 | QPaintDevice* pd = p->device(); | 1344 | QPaintDevice* pd = p->device(); |
1328 | p->end(); | 1345 | p->end(); |
1329 | int vx, vy; | 1346 | int vx, vy; |
1330 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1347 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1331 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1348 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1332 | mSelectionCellX * mGridSpacingX; | 1349 | mSelectionCellX * mGridSpacingX; |
1333 | contentsToViewport ( cx, cy, vx,vy); | 1350 | contentsToViewport ( cx, cy, vx,vy); |
1334 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1351 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1335 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1352 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1336 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1353 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1337 | 1354 | ||
1338 | if ( mSelectionHeight > 0 ) { | 1355 | if ( mSelectionHeight > 0 ) { |
1339 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1356 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1340 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1357 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1341 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1358 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1342 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1359 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1343 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1360 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1344 | int hei = mSelectionHeight; | 1361 | int hei = mSelectionHeight; |
1345 | int offset = 0; | 1362 | int offset = 0; |
1346 | while ( hei > 0 ) { | 1363 | while ( hei > 0 ) { |
1347 | int p_hei = 5; | 1364 | int p_hei = 5; |
1348 | if ( hei < 5 ) p_hei = hei; | 1365 | if ( hei < 5 ) p_hei = hei; |
1349 | hei -= 5; | 1366 | hei -= 5; |
1350 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1367 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1351 | offset += 5; | 1368 | offset += 5; |
1352 | } | 1369 | } |
1353 | } | 1370 | } |
1354 | } | 1371 | } |
1355 | p->begin( pd ); | 1372 | p->begin( pd ); |
1356 | } | 1373 | } |
1357 | 1374 | ||
1358 | } | 1375 | } |
1359 | 1376 | ||
1360 | void KOAgenda::finishUpdate() | 1377 | void KOAgenda::finishUpdate() |
1361 | { | 1378 | { |
1362 | 1379 | ||
1363 | KOAgendaItem *item; | 1380 | KOAgendaItem *item; |
1364 | globalFlagBlockAgendaItemPaint = 1; | 1381 | globalFlagBlockAgendaItemPaint = 1; |
1365 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems | 1382 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems |
1366 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1383 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1367 | if ( !item->checkLayout() ) { | 1384 | if ( !item->checkLayout() ) { |
1368 | //qDebug(" conflictitem found "); | 1385 | //qDebug(" conflictitem found "); |
1369 | int newSubCellWidth; | 1386 | int newSubCellWidth; |
1370 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); | 1387 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); |
1371 | else newSubCellWidth = mGridSpacingX / item->subCells(); | 1388 | else newSubCellWidth = mGridSpacingX / item->subCells(); |
1372 | 1389 | ||
1373 | if (mAllDayMode) { | 1390 | if (mAllDayMode) { |
1374 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1391 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1375 | } else { | 1392 | } else { |
1376 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1393 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1377 | } | 1394 | } |
1378 | int x,y; | 1395 | int x,y; |
1379 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1396 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1380 | if (mAllDayMode) { | 1397 | if (mAllDayMode) { |
1381 | y += item->subCell() * newSubCellWidth; | 1398 | y += item->subCell() * newSubCellWidth; |
1382 | } else { | 1399 | } else { |
1383 | x += item->subCell() * newSubCellWidth; | 1400 | x += item->subCell() * newSubCellWidth; |
1384 | } | 1401 | } |
1385 | moveChild(item,x,y); | 1402 | moveChild(item,x,y); |
1386 | } | 1403 | } |
1387 | } | 1404 | } |
1388 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1405 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1389 | if ( !item->isVisible() ) | 1406 | if ( !item->isVisible() ) |
1390 | item->show(); | 1407 | item->show(); |
1391 | 1408 | ||
1392 | } | 1409 | } |
1393 | globalFlagBlockAgendaItemUpdate = 0; | 1410 | globalFlagBlockAgendaItemUpdate = 0; |
1394 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1411 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1395 | item->repaintMe( ); | 1412 | item->repaintMe( ); |
1396 | } | 1413 | } |
1397 | globalFlagBlockAgendaItemUpdate = 1; | 1414 | globalFlagBlockAgendaItemUpdate = 1; |
1398 | qApp->processEvents(); | 1415 | qApp->processEvents(); |
1399 | globalFlagBlockAgendaItemPaint = 0; | 1416 | globalFlagBlockAgendaItemPaint = 0; |
1400 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1417 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1401 | item->repaint( false ); | 1418 | item->repaint( false ); |
1402 | } | 1419 | } |
1403 | 1420 | ||
1404 | } | 1421 | } |
1405 | 1422 | ||
1406 | /* | 1423 | /* |
1407 | Draw grid in the background of the agenda. | 1424 | Draw grid in the background of the agenda. |
1408 | */ | 1425 | */ |
1409 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1426 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1410 | { | 1427 | { |
1411 | 1428 | ||
1412 | 1429 | ||
1413 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1430 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1414 | return; | 1431 | return; |
1415 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1432 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1416 | return; | 1433 | return; |
1417 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1434 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1418 | if ( ch < 1 ) | 1435 | if ( ch < 1 ) |
1419 | ch = 1; | 1436 | ch = 1; |
1420 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1437 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1421 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1438 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1422 | } | 1439 | } |
1423 | mCurPixWid = contentsWidth(); | 1440 | mCurPixWid = contentsWidth(); |
1424 | mCurPixHei = ch; | 1441 | mCurPixHei = ch; |
1425 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { | 1442 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { |
1426 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); | 1443 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); |
1427 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1444 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1428 | } | 1445 | } |
1429 | mPixPainter.begin( &mPaintPixmap) ; | 1446 | mPixPainter.begin( &mPaintPixmap) ; |
1430 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1447 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1431 | QPainter * p ; | 1448 | QPainter * p ; |
1432 | if (paint == 0) { | 1449 | if (paint == 0) { |
1433 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1450 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1434 | p = &mPixPainter; | 1451 | p = &mPixPainter; |
1435 | } | 1452 | } |
1436 | else | 1453 | else |
1437 | p = paint ; | 1454 | p = paint ; |
1438 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1455 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1439 | 1456 | ||
1440 | //--cx;++cw; | 1457 | //--cx;++cw; |
1441 | int lGridSpacingY = mGridSpacingY*2; | 1458 | int lGridSpacingY = mGridSpacingY*2; |
1442 | int selDay; | 1459 | int selDay; |
1443 | QDate curDate = QDate::currentDate(); | 1460 | QDate curDate = QDate::currentDate(); |
1444 | if ( !backgroundOnly ) { | 1461 | if ( !backgroundOnly ) { |
1445 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1462 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1446 | { | 1463 | { |
1447 | if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { | 1464 | if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { |
1448 | int x1 = cx; | 1465 | int x1 = cx; |
1449 | int y1 = 0; | 1466 | int y1 = 0; |
1450 | if (y1 < cy) y1 = cy; | 1467 | if (y1 < cy) y1 = cy; |
1451 | int x2 = cx+cw-1; | 1468 | int x2 = cx+cw-1; |
1452 | int y2 = contentsHeight(); | 1469 | int y2 = contentsHeight(); |
1453 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1470 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1454 | if (x2 >= x1 && y2 >= y1) { | 1471 | if (x2 >= x1 && y2 >= y1) { |
1455 | int gxStart = selDay; | 1472 | int gxStart = selDay; |
1456 | int gxEnd = gxStart ; | 1473 | int gxEnd = gxStart ; |
1457 | int xStart = KOGlobals::self()->reverseLayout() ? | 1474 | int xStart = KOGlobals::self()->reverseLayout() ? |
1458 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1475 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1459 | gxStart*mGridSpacingX; | 1476 | gxStart*mGridSpacingX; |
1460 | if (xStart < x1) xStart = x1; | 1477 | if (xStart < x1) xStart = x1; |
1461 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1478 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1462 | (mColumns - gxStart)*mGridSpacingX-1 : | 1479 | (mColumns - gxStart)*mGridSpacingX-1 : |
1463 | (gxStart+1)*mGridSpacingX-1; | 1480 | (gxStart+1)*mGridSpacingX-1; |
1464 | if (xEnd > x2) xEnd = x2; | 1481 | if (xEnd > x2) xEnd = x2; |
1465 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1482 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1466 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1483 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1467 | KOPrefs::instance()->mAgendaBgColor.light()); | 1484 | KOPrefs::instance()->mAgendaBgColor.light()); |
1468 | else | 1485 | else |
1469 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1486 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1470 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1487 | KOPrefs::instance()->mAgendaBgColor.dark()); |
1471 | 1488 | ||
1472 | } | 1489 | } |
1473 | } | 1490 | } |
1474 | } | 1491 | } |
1475 | } | 1492 | } |
1476 | // Highlight working hours | 1493 | // Highlight working hours |
1477 | 1494 | ||
1478 | if ( !backgroundOnly ) | 1495 | if ( !backgroundOnly ) |
1479 | if (mWorkingHoursEnable) { | 1496 | if (mWorkingHoursEnable) { |
1480 | int x1 = cx; | 1497 | int x1 = cx; |
1481 | int y1 = mWorkingHoursYTop; | 1498 | int y1 = mWorkingHoursYTop; |
1482 | if (y1 < cy) y1 = cy; | 1499 | if (y1 < cy) y1 = cy; |
1483 | int x2 = cx+cw-1; | 1500 | int x2 = cx+cw-1; |
1484 | // int x2 = mGridSpacingX * 5 - 1; | 1501 | // int x2 = mGridSpacingX * 5 - 1; |
1485 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1502 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1486 | int y2 = mWorkingHoursYBottom; | 1503 | int y2 = mWorkingHoursYBottom; |
1487 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1504 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1488 | 1505 | ||
1489 | if (x2 >= x1 && y2 >= y1) { | 1506 | if (x2 >= x1 && y2 >= y1) { |
1490 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1507 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1491 | int gxStart = x1/mGridSpacingX; | 1508 | int gxStart = x1/mGridSpacingX; |
1492 | int gxEnd = x2/mGridSpacingX; | 1509 | int gxEnd = x2/mGridSpacingX; |
1493 | while(gxStart <= gxEnd) { | 1510 | while(gxStart <= gxEnd) { |
1494 | if (gxStart < int(mHolidayMask->count()) && | 1511 | if (gxStart < int(mHolidayMask->count()) && |
1495 | !mHolidayMask->at(gxStart)) { | 1512 | !mHolidayMask->at(gxStart)) { |
1496 | int xStart = KOGlobals::self()->reverseLayout() ? | 1513 | int xStart = KOGlobals::self()->reverseLayout() ? |
1497 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1514 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1498 | gxStart*mGridSpacingX; | 1515 | gxStart*mGridSpacingX; |
1499 | if (xStart < x1) xStart = x1; | 1516 | if (xStart < x1) xStart = x1; |
1500 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1517 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1501 | (mColumns - gxStart)*mGridSpacingX-1 : | 1518 | (mColumns - gxStart)*mGridSpacingX-1 : |
1502 | (gxStart+1)*mGridSpacingX-1; | 1519 | (gxStart+1)*mGridSpacingX-1; |
1503 | if (xEnd > x2) xEnd = x2; | 1520 | if (xEnd > x2) xEnd = x2; |
1504 | if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { | 1521 | if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { |
1505 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1522 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1506 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1523 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1507 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1524 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1508 | else | 1525 | else |
1509 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1526 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1510 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1527 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1511 | } else { | 1528 | } else { |
1512 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1529 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1513 | KOPrefs::instance()->mWorkingHoursColor); | 1530 | KOPrefs::instance()->mWorkingHoursColor); |
1514 | } | 1531 | } |
1515 | } | 1532 | } |
1516 | ++gxStart; | 1533 | ++gxStart; |
1517 | } | 1534 | } |
1518 | } | 1535 | } |
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index 5d813b2..0e3aed8 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -1,305 +1,306 @@ | |||
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 | #ifndef KOAGENDA_H | 23 | #ifndef KOAGENDA_H |
24 | #define KOAGENDA_H | 24 | #define KOAGENDA_H |
25 | 25 | ||
26 | #include <qscrollview.h> | 26 | #include <qscrollview.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <qmemarray.h> | 28 | #include <qmemarray.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qpixmap.h> | 30 | #include <qpixmap.h> |
31 | #include <qguardedptr.h> | 31 | #include <qguardedptr.h> |
32 | 32 | ||
33 | #include "koagendaitem.h" | 33 | #include "koagendaitem.h" |
34 | #include "koeventview.h" | 34 | #include "koeventview.h" |
35 | 35 | ||
36 | class QPopupMenu; | 36 | class QPopupMenu; |
37 | class QTime; | 37 | class QTime; |
38 | class KConfig; | 38 | class KConfig; |
39 | class QFrame; | 39 | class QFrame; |
40 | class KOAgenda; | 40 | class KOAgenda; |
41 | class KCal::Event; | 41 | class KCal::Event; |
42 | class KCal::Todo; | 42 | class KCal::Todo; |
43 | 43 | ||
44 | using namespace KCal; | 44 | using namespace KCal; |
45 | 45 | ||
46 | class MarcusBains : public QFrame { | 46 | class MarcusBains : public QFrame { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | public: | 48 | public: |
49 | MarcusBains(KOAgenda *agenda=0,const char *name=0); | 49 | MarcusBains(KOAgenda *agenda=0,const char *name=0); |
50 | virtual ~MarcusBains(); | 50 | virtual ~MarcusBains(); |
51 | 51 | ||
52 | public slots: | 52 | public slots: |
53 | void updateLocation(bool recalculate=false); | 53 | void updateLocation(bool recalculate=false); |
54 | void updateLoc(); | 54 | void updateLoc(); |
55 | 55 | ||
56 | private: | 56 | private: |
57 | int todayColumn(); | 57 | int todayColumn(); |
58 | QTimer *minutes; | 58 | QTimer *minutes; |
59 | QLabel *mTimeBox; | 59 | QLabel *mTimeBox; |
60 | KOAgenda *agenda; | 60 | KOAgenda *agenda; |
61 | QTime oldTime; | 61 | QTime oldTime; |
62 | int oldToday; | 62 | int oldToday; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | 65 | ||
66 | class KOAgenda : public QScrollView | 66 | class KOAgenda : public QScrollView |
67 | { | 67 | { |
68 | Q_OBJECT | 68 | Q_OBJECT |
69 | public: | 69 | public: |
70 | enum MouseActionType { NOP, MOVE, SELECT, | 70 | enum MouseActionType { NOP, MOVE, SELECT, |
71 | RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; | 71 | RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; |
72 | 72 | ||
73 | KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, | 73 | KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, |
74 | const char * name=0, WFlags f=0 ); | 74 | const char * name=0, WFlags f=0 ); |
75 | KOAgenda ( int columns, QWidget * parent=0, | 75 | KOAgenda ( int columns, QWidget * parent=0, |
76 | const char * name=0, WFlags f=0 ); | 76 | const char * name=0, WFlags f=0 ); |
77 | virtual ~KOAgenda(); | 77 | virtual ~KOAgenda(); |
78 | static bool mInvalidPixmap; | 78 | bool mInvalidPixmap; |
79 | 79 | ||
80 | Incidence *selectedIncidence() const; | 80 | Incidence *selectedIncidence() const; |
81 | QDate selectedIncidenceDate() const; | 81 | QDate selectedIncidenceDate() const; |
82 | 82 | ||
83 | virtual bool eventFilter ( QObject *, QEvent * ); | 83 | virtual bool eventFilter ( QObject *, QEvent * ); |
84 | 84 | ||
85 | void contentsToGrid (int x, int y, int& gx, int& gy); | 85 | void contentsToGrid (int x, int y, int& gx, int& gy); |
86 | void gridToContents (int gx, int gy, int& x, int& y); | 86 | void gridToContents (int gx, int gy, int& x, int& y); |
87 | 87 | ||
88 | int timeToY (const QTime &time); | 88 | int timeToY (const QTime &time); |
89 | QTime gyToTime (int y); | 89 | QTime gyToTime (int y); |
90 | 90 | ||
91 | void setStartHour(int startHour); | 91 | void setStartHour(int startHour); |
92 | 92 | ||
93 | KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); | 93 | KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); |
94 | KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); | 94 | KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); |
95 | void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | 95 | void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, |
96 | int YTop,int YBottom); | 96 | int YTop,int YBottom); |
97 | 97 | ||
98 | void changeColumns(int columns); | 98 | void changeColumns(int columns); |
99 | 99 | ||
100 | int columns() { return mColumns; } | 100 | int columns() { return mColumns; } |
101 | int rows() { return mRows; } | 101 | int rows() { return mRows; } |
102 | 102 | ||
103 | int gridSpacingX() const { return mGridSpacingX; } | 103 | int gridSpacingX() const { return mGridSpacingX; } |
104 | int gridSpacingY() const { return mGridSpacingY; } | 104 | int gridSpacingY() const { return mGridSpacingY; } |
105 | 105 | ||
106 | // virtual QSizePolicy sizePolicy() const; | 106 | // virtual QSizePolicy sizePolicy() const; |
107 | 107 | ||
108 | void clear(); | 108 | void clear(); |
109 | 109 | ||
110 | void clearSelection(); | 110 | void clearSelection(); |
111 | void hideUnused(); | 111 | void hideUnused(); |
112 | 112 | ||
113 | /** Calculates the minimum width */ | 113 | /** Calculates the minimum width */ |
114 | virtual int minimumWidth() const; | 114 | virtual int minimumWidth() const; |
115 | /** Update configuration from preference settings */ | 115 | /** Update configuration from preference settings */ |
116 | void updateConfig(); | 116 | void updateConfig(); |
117 | 117 | ||
118 | void checkScrollBoundaries(); | 118 | void checkScrollBoundaries(); |
119 | 119 | ||
120 | void setHolidayMask(QMemArray<bool> *); | 120 | void setHolidayMask(QMemArray<bool> *); |
121 | void setDateList(const DateList &selectedDates); | 121 | void setDateList(const DateList &selectedDates); |
122 | DateList dateList() const; | 122 | DateList dateList() const; |
123 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); | 123 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); |
124 | void finishUpdate(); | 124 | void finishUpdate(); |
125 | void printSelection(); | 125 | void printSelection(); |
126 | void storePosition(); | 126 | void storePosition(); |
127 | void restorePosition(); | 127 | void restorePosition(); |
128 | void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } | 128 | void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } |
129 | void shrinkPixmap(); | 129 | void shrinkPixmap(); |
130 | 130 | ||
131 | public slots: | 131 | public slots: |
132 | void slotContentMove(int,int); | 132 | void slotContentMove(int,int); |
133 | void categoryChanged(Incidence * inc); | 133 | void categoryChanged(Incidence * inc); |
134 | void slotClearSelection(); | 134 | void slotClearSelection(); |
135 | void popupMenu(); | 135 | void popupMenu(); |
136 | void newItem( int ); | 136 | void newItem( int ); |
137 | void moveChild( QWidget *, int, int ); | 137 | void moveChild( QWidget *, int, int ); |
138 | void scrollUp(); | 138 | void scrollUp(); |
139 | void scrollDown(); | 139 | void scrollDown(); |
140 | void updateTodo( Todo * t, int , bool ); | 140 | void updateTodo( Todo * t, int , bool ); |
141 | void popupAlarm(); | 141 | void popupAlarm(); |
142 | 142 | ||
143 | void checkScrollBoundaries(int); | 143 | void checkScrollBoundaries(int); |
144 | 144 | ||
145 | /** Deselect selected items. This function does not emit any signals. */ | 145 | /** Deselect selected items. This function does not emit any signals. */ |
146 | void deselectItem(); | 146 | void deselectItem(); |
147 | /** Select item. If the argument is 0, the currently selected item gets | 147 | /** Select item. If the argument is 0, the currently selected item gets |
148 | deselected. This function emits the itemSelected(bool) signal to inform | 148 | deselected. This function emits the itemSelected(bool) signal to inform |
149 | about selection/deseelction of events. */ | 149 | about selection/deseelction of events. */ |
150 | void selectItem(KOAgendaItem *); | 150 | void selectItem(KOAgendaItem *); |
151 | void finishResize(); | 151 | void finishResize(); |
152 | 152 | ||
153 | signals: | 153 | signals: |
154 | void signalClearSelection(); | 154 | void signalClearSelection(); |
155 | void showDateView( int, int); | 155 | void showDateView( int, int); |
156 | void newEventSignal(); | 156 | void newEventSignal(); |
157 | void newEventSignal(int gx,int gy); | 157 | void newEventSignal(int gx,int gy); |
158 | void newTodoSignal(int gx,int gy); | 158 | void newTodoSignal(int gx,int gy); |
159 | void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); | 159 | void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); |
160 | void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); | 160 | void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); |
161 | void newStartSelectSignal(); | 161 | void newStartSelectSignal(); |
162 | void showIncidenceSignal(Incidence *); | 162 | void showIncidenceSignal(Incidence *); |
163 | void editIncidenceSignal(Incidence *); | 163 | void editIncidenceSignal(Incidence *); |
164 | void deleteIncidenceSignal(Incidence *); | 164 | void deleteIncidenceSignal(Incidence *); |
165 | void showIncidencePopupSignal(Incidence *); | 165 | void showIncidencePopupSignal(Incidence *); |
166 | 166 | ||
167 | void itemModified(KOAgendaItem *item, int ); | 167 | void itemModified(KOAgendaItem *item, int ); |
168 | void incidenceSelected(Incidence *); | 168 | void incidenceSelected(Incidence *); |
169 | 169 | ||
170 | void lowerYChanged(int); | 170 | void lowerYChanged(int); |
171 | void upperYChanged(int); | 171 | void upperYChanged(int); |
172 | 172 | ||
173 | void startDragSignal(Incidence *); | 173 | void startDragSignal(Incidence *); |
174 | void addToCalSignal(Incidence *, Incidence *); | 174 | void addToCalSignal(Incidence *, Incidence *); |
175 | void resizedSignal(); | 175 | void resizedSignal(); |
176 | void updateViewSignal(); | 176 | void updateViewSignal(); |
177 | void sendPing(); | ||
177 | 178 | ||
178 | protected: | 179 | protected: |
179 | KOEventPopupMenu * mAllAgendaPopup; | 180 | KOEventPopupMenu * mAllAgendaPopup; |
180 | QPainter mPixPainter; | 181 | QPainter mPixPainter; |
181 | QPixmap mPaintPixmap; | 182 | QPixmap mPaintPixmap; |
182 | QPixmap mHighlightPixmap; | 183 | QPixmap mHighlightPixmap; |
183 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 184 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
184 | virtual void resizeEvent ( QResizeEvent * ); | 185 | virtual void resizeEvent ( QResizeEvent * ); |
185 | 186 | ||
186 | /** Handles mouse events. Called from eventFilter */ | 187 | /** Handles mouse events. Called from eventFilter */ |
187 | virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); | 188 | virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); |
188 | 189 | ||
189 | /** Start selecting time span. */ | 190 | /** Start selecting time span. */ |
190 | void startSelectAction(QPoint viewportPos); | 191 | void startSelectAction(QPoint viewportPos); |
191 | 192 | ||
192 | /** Select time span. */ | 193 | /** Select time span. */ |
193 | void performSelectAction(QPoint viewportPos); | 194 | void performSelectAction(QPoint viewportPos); |
194 | 195 | ||
195 | /** Emd selecting time span. */ | 196 | /** Emd selecting time span. */ |
196 | void endSelectAction( bool emitNewEvent = false ); | 197 | void endSelectAction( bool emitNewEvent = false ); |
197 | 198 | ||
198 | /** Start moving/resizing agenda item */ | 199 | /** Start moving/resizing agenda item */ |
199 | void startItemAction(QPoint viewportPos); | 200 | void startItemAction(QPoint viewportPos); |
200 | 201 | ||
201 | /** Move/resize agenda item */ | 202 | /** Move/resize agenda item */ |
202 | void performItemAction(QPoint viewportPos); | 203 | void performItemAction(QPoint viewportPos); |
203 | 204 | ||
204 | /** End moving/resizing agenda item */ | 205 | /** End moving/resizing agenda item */ |
205 | void endItemAction(); | 206 | void endItemAction(); |
206 | 207 | ||
207 | /** Set cursor, when no item action is in progress */ | 208 | /** Set cursor, when no item action is in progress */ |
208 | void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); | 209 | void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); |
209 | 210 | ||
210 | /** Place agenda item in agenda and adjust other cells if necessary */ | 211 | /** Place agenda item in agenda and adjust other cells if necessary */ |
211 | void placeSubCells(KOAgendaItem *placeItem); | 212 | void placeSubCells(KOAgendaItem *placeItem); |
212 | 213 | ||
213 | /** Process the keyevent, including the ignored keyevents of eventwidgets. | 214 | /** Process the keyevent, including the ignored keyevents of eventwidgets. |
214 | * Implements pgup/pgdn and cursor key navigation in the view. | 215 | * Implements pgup/pgdn and cursor key navigation in the view. |
215 | */ | 216 | */ |
216 | void keyPressEvent( QKeyEvent * ); | 217 | void keyPressEvent( QKeyEvent * ); |
217 | 218 | ||
218 | void calculateWorkingHours(); | 219 | void calculateWorkingHours(); |
219 | 220 | ||
220 | virtual void contentsMousePressEvent ( QMouseEvent * ); | 221 | virtual void contentsMousePressEvent ( QMouseEvent * ); |
221 | 222 | ||
222 | private: | 223 | private: |
223 | void init(); | 224 | void init(); |
224 | void marcus_bains(); | 225 | void marcus_bains(); |
225 | bool mAllDayMode; | 226 | bool mAllDayMode; |
226 | bool blockResize; | 227 | bool blockResize; |
227 | bool mLeftMouseDown; | 228 | bool mLeftMouseDown; |
228 | KOAgendaItem *mPopupItem; | 229 | KOAgendaItem *mPopupItem; |
229 | QTimer* mPopupTimer; | 230 | QTimer* mPopupTimer; |
230 | int mPopupKind; | 231 | int mPopupKind; |
231 | QPoint mPopupPos; | 232 | QPoint mPopupPos; |
232 | QTimer mResizeTimer; | 233 | QTimer mResizeTimer; |
233 | double mContentPosition; | 234 | double mContentPosition; |
234 | 235 | ||
235 | // Width and height of agenda cells | 236 | // Width and height of agenda cells |
236 | int mGridSpacingX; | 237 | int mGridSpacingX; |
237 | int mGridSpacingY; | 238 | int mGridSpacingY; |
238 | 239 | ||
239 | // size of border, where mouse action will resize the KOAgendaItem | 240 | // size of border, where mouse action will resize the KOAgendaItem |
240 | int mResizeBorderWidth; | 241 | int mResizeBorderWidth; |
241 | 242 | ||
242 | // size of border, where mouse mve will cause a scroll of the agenda | 243 | // size of border, where mouse mve will cause a scroll of the agenda |
243 | int mScrollBorderWidth; | 244 | int mScrollBorderWidth; |
244 | int mScrollDelay; | 245 | int mScrollDelay; |
245 | int mScrollOffset; | 246 | int mScrollOffset; |
246 | 247 | ||
247 | QTimer mScrollUpTimer; | 248 | QTimer mScrollUpTimer; |
248 | QTimer mScrollDownTimer; | 249 | QTimer mScrollDownTimer; |
249 | 250 | ||
250 | // Number of Columns/Rows of agenda grid | 251 | // Number of Columns/Rows of agenda grid |
251 | int mColumns; | 252 | int mColumns; |
252 | int mRows; | 253 | int mRows; |
253 | 254 | ||
254 | // Cells to store Move and Resize coordiantes | 255 | // Cells to store Move and Resize coordiantes |
255 | int mStartCellX; | 256 | int mStartCellX; |
256 | int mStartCellY; | 257 | int mStartCellY; |
257 | int mCurrentCellX; | 258 | int mCurrentCellX; |
258 | int mCurrentCellY; | 259 | int mCurrentCellY; |
259 | 260 | ||
260 | // Working Hour coordiantes | 261 | // Working Hour coordiantes |
261 | bool mWorkingHoursEnable; | 262 | bool mWorkingHoursEnable; |
262 | int mWorkingHoursYTop; | 263 | int mWorkingHoursYTop; |
263 | int mWorkingHoursYBottom; | 264 | int mWorkingHoursYBottom; |
264 | 265 | ||
265 | // Selection | 266 | // Selection |
266 | int mSelectionCellX; | 267 | int mSelectionCellX; |
267 | int mSelectionYTop; | 268 | int mSelectionYTop; |
268 | int mSelectionHeight; | 269 | int mSelectionHeight; |
269 | 270 | ||
270 | // List of dates to be displayed | 271 | // List of dates to be displayed |
271 | DateList mSelectedDates; | 272 | DateList mSelectedDates; |
272 | 273 | ||
273 | // The KOAgendaItem, which has been right-clicked last | 274 | // The KOAgendaItem, which has been right-clicked last |
274 | KOAgendaItem *mClickedItem; | 275 | KOAgendaItem *mClickedItem; |
275 | 276 | ||
276 | // The KOAgendaItem, which is being moved/resized | 277 | // The KOAgendaItem, which is being moved/resized |
277 | QGuardedPtr<KOAgendaItem> mActionItem; | 278 | QGuardedPtr<KOAgendaItem> mActionItem; |
278 | 279 | ||
279 | // Currently selected item | 280 | // Currently selected item |
280 | QGuardedPtr<KOAgendaItem> mSelectedItem; | 281 | QGuardedPtr<KOAgendaItem> mSelectedItem; |
281 | 282 | ||
282 | // The Marcus Bains Line widget. | 283 | // The Marcus Bains Line widget. |
283 | MarcusBains *mMarcusBains; | 284 | MarcusBains *mMarcusBains; |
284 | void computeSizes(); | 285 | void computeSizes(); |
285 | 286 | ||
286 | MouseActionType mActionType; | 287 | MouseActionType mActionType; |
287 | 288 | ||
288 | bool mItemMoved; | 289 | bool mItemMoved; |
289 | 290 | ||
290 | // List of all Items contained in agenda | 291 | // List of all Items contained in agenda |
291 | QPtrList<KOAgendaItem> mItems; | 292 | QPtrList<KOAgendaItem> mItems; |
292 | QPtrList<KOAgendaItem> mUnusedItems; | 293 | QPtrList<KOAgendaItem> mUnusedItems; |
293 | KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); | 294 | KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); |
294 | QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems | 295 | QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems |
295 | QPopupMenu *mNewItemPopup; | 296 | QPopupMenu *mNewItemPopup; |
296 | 297 | ||
297 | int mOldLowerScrollValue; | 298 | int mOldLowerScrollValue; |
298 | int mOldUpperScrollValue; | 299 | int mOldUpperScrollValue; |
299 | KOAgendaItem * getItemForTodo ( Todo * todo ); | 300 | KOAgendaItem * getItemForTodo ( Todo * todo ); |
300 | QMemArray<bool> *mHolidayMask; | 301 | QMemArray<bool> *mHolidayMask; |
301 | int mCurPixWid; | 302 | int mCurPixWid; |
302 | int mCurPixHei; | 303 | int mCurPixHei; |
303 | }; | 304 | }; |
304 | 305 | ||
305 | #endif // KOAGENDA_H | 306 | #endif // KOAGENDA_H |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 488d9d4..1b21a71 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1,271 +1,271 @@ | |||
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 | #define IDLETIMEOUT 3 | 79 | #define IDLETIMEOUT 15 |
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 | cx = contentsX() + frameWidth()*2; | 113 | cx = contentsX() + frameWidth()*2; |
114 | cw = contentsWidth() ; | 114 | cw = contentsWidth() ; |
115 | // end of workaround | 115 | // end of workaround |
116 | 116 | ||
117 | int cell = ((int)(cy/mCellHeight)); | 117 | int cell = ((int)(cy/mCellHeight)); |
118 | int y = cell * mCellHeight; | 118 | int y = cell * mCellHeight; |
119 | QFontMetrics fm = fontMetrics(); | 119 | QFontMetrics fm = fontMetrics(); |
120 | QString hour; | 120 | QString hour; |
121 | QString suffix = "am"; | 121 | QString suffix = "am"; |
122 | int timeHeight = fm.ascent(); | 122 | int timeHeight = fm.ascent(); |
123 | QFont nFont = font(); | 123 | QFont nFont = font(); |
124 | p->setFont( font()); | 124 | p->setFont( font()); |
125 | 125 | ||
126 | if (!KGlobal::locale()->use12Clock()) { | 126 | if (!KGlobal::locale()->use12Clock()) { |
127 | suffix = "00"; | 127 | suffix = "00"; |
128 | } else | 128 | } else |
129 | if (cell > 11) suffix = "pm"; | 129 | if (cell > 11) suffix = "pm"; |
130 | 130 | ||
131 | if ( timeHeight > mCellHeight ) { | 131 | if ( timeHeight > mCellHeight ) { |
132 | timeHeight = mCellHeight-1; | 132 | timeHeight = mCellHeight-1; |
133 | int pointS = nFont.pointSize(); | 133 | int pointS = nFont.pointSize(); |
134 | while ( pointS > 4 ) { | 134 | while ( pointS > 4 ) { |
135 | nFont.setPointSize( pointS ); | 135 | nFont.setPointSize( pointS ); |
136 | fm = QFontMetrics( nFont ); | 136 | fm = QFontMetrics( nFont ); |
137 | if ( fm.ascent() < mCellHeight ) | 137 | if ( fm.ascent() < mCellHeight ) |
138 | break; | 138 | break; |
139 | -- pointS; | 139 | -- pointS; |
140 | } | 140 | } |
141 | fm = QFontMetrics( nFont ); | 141 | fm = QFontMetrics( nFont ); |
142 | timeHeight = fm.ascent(); | 142 | timeHeight = fm.ascent(); |
143 | } | 143 | } |
144 | //timeHeight -= (timeHeight/4-2); | 144 | //timeHeight -= (timeHeight/4-2); |
145 | QFont sFont = nFont; | 145 | QFont sFont = nFont; |
146 | sFont.setPointSize( sFont.pointSize()/2 ); | 146 | sFont.setPointSize( sFont.pointSize()/2 ); |
147 | QFontMetrics fmS( sFont ); | 147 | QFontMetrics fmS( sFont ); |
148 | int sHei = fmS.ascent() ; | 148 | int sHei = fmS.ascent() ; |
149 | //sHei -= (sHei/4-2); | 149 | //sHei -= (sHei/4-2); |
150 | int startW = mMiniWidth - frameWidth()-2 ; | 150 | int startW = mMiniWidth - frameWidth()-2 ; |
151 | int tw2 = fmS.width(suffix); | 151 | int tw2 = fmS.width(suffix); |
152 | timeHeight = (timeHeight-1) /2 -1; | 152 | timeHeight = (timeHeight-1) /2 -1; |
153 | //testline | 153 | //testline |
154 | //p->drawLine(0,0,0,contentsHeight()); | 154 | //p->drawLine(0,0,0,contentsHeight()); |
155 | while (y < cy + ch+mCellHeight) { | 155 | while (y < cy + ch+mCellHeight) { |
156 | p->drawLine(startW-tw2+1 ,y,cw+2,y); | 156 | p->drawLine(startW-tw2+1 ,y,cw+2,y); |
157 | hour.setNum(cell); | 157 | hour.setNum(cell); |
158 | // handle 24h and am/pm time formats | 158 | // handle 24h and am/pm time formats |
159 | if (KGlobal::locale()->use12Clock()) { | 159 | if (KGlobal::locale()->use12Clock()) { |
160 | if (cell == 12) suffix = "pm"; | 160 | if (cell == 12) suffix = "pm"; |
161 | if (cell == 0) hour.setNum(12); | 161 | if (cell == 0) hour.setNum(12); |
162 | if (cell > 12) hour.setNum(cell - 12); | 162 | if (cell > 12) hour.setNum(cell - 12); |
163 | } | 163 | } |
164 | 164 | ||
165 | // center and draw the time label | 165 | // center and draw the time label |
166 | int timeWidth = fm.width(hour); | 166 | int timeWidth = fm.width(hour); |
167 | int offset = startW - timeWidth - tw2 -1 ; | 167 | int offset = startW - timeWidth - tw2 -1 ; |
168 | p->setFont( nFont ); | 168 | p->setFont( nFont ); |
169 | p->drawText( offset, y+ timeHeight, hour); | 169 | p->drawText( offset, y+ timeHeight, hour); |
170 | p->setFont( sFont ); | 170 | p->setFont( sFont ); |
171 | offset = startW - tw2; | 171 | offset = startW - tw2; |
172 | p->drawText( offset, y -1, suffix); | 172 | p->drawText( offset, y -1, suffix); |
173 | 173 | ||
174 | // increment indices | 174 | // increment indices |
175 | y += mCellHeight; | 175 | y += mCellHeight; |
176 | cell++; | 176 | cell++; |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | 180 | ||
181 | 181 | ||
182 | } | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | Calculates the minimum width. | 185 | Calculates the minimum width. |
186 | */ | 186 | */ |
187 | int TimeLabels::minimumWidth() const | 187 | int TimeLabels::minimumWidth() const |
188 | { | 188 | { |
189 | return mMiniWidth; | 189 | return mMiniWidth; |
190 | } | 190 | } |
191 | 191 | ||
192 | /** updates widget's internal state */ | 192 | /** updates widget's internal state */ |
193 | void TimeLabels::updateConfig() | 193 | void TimeLabels::updateConfig() |
194 | { | 194 | { |
195 | mRedrawNeeded = true; | 195 | mRedrawNeeded = true; |
196 | // set the font | 196 | // set the font |
197 | // config->setGroup("Fonts"); | 197 | // config->setGroup("Fonts"); |
198 | // QFont font = config->readFontEntry("TimeBar Font"); | 198 | // QFont font = config->readFontEntry("TimeBar Font"); |
199 | setFont(KOPrefs::instance()->mTimeBarFont); | 199 | setFont(KOPrefs::instance()->mTimeBarFont); |
200 | QString test = "20"; | 200 | QString test = "20"; |
201 | if (KGlobal::locale()->use12Clock()) | 201 | if (KGlobal::locale()->use12Clock()) |
202 | test = "12"; | 202 | test = "12"; |
203 | mMiniWidth = fontMetrics().width(test); | 203 | mMiniWidth = fontMetrics().width(test); |
204 | if (KGlobal::locale()->use12Clock()) | 204 | if (KGlobal::locale()->use12Clock()) |
205 | test = "pm"; | 205 | test = "pm"; |
206 | else { | 206 | else { |
207 | test = "00"; | 207 | test = "00"; |
208 | } | 208 | } |
209 | QFont sFont = font(); | 209 | QFont sFont = font(); |
210 | sFont.setPointSize( sFont.pointSize()/2 ); | 210 | sFont.setPointSize( sFont.pointSize()/2 ); |
211 | QFontMetrics fmS( sFont ); | 211 | QFontMetrics fmS( sFont ); |
212 | mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ; | 212 | mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ; |
213 | // update geometry restrictions based on new settings | 213 | // update geometry restrictions based on new settings |
214 | setFixedWidth( mMiniWidth ); | 214 | setFixedWidth( mMiniWidth ); |
215 | 215 | ||
216 | // update HourSize | 216 | // update HourSize |
217 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 217 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
218 | resizeContents(mMiniWidth,mRows * mCellHeight+1); | 218 | resizeContents(mMiniWidth,mRows * mCellHeight+1); |
219 | } | 219 | } |
220 | 220 | ||
221 | /** update time label positions */ | 221 | /** update time label positions */ |
222 | void TimeLabels::positionChanged() | 222 | void TimeLabels::positionChanged() |
223 | { | 223 | { |
224 | int adjustment = mAgenda->contentsY(); | 224 | int adjustment = mAgenda->contentsY(); |
225 | setContentsPos(0, adjustment); | 225 | setContentsPos(0, adjustment); |
226 | } | 226 | } |
227 | 227 | ||
228 | /** */ | 228 | /** */ |
229 | void TimeLabels::setAgenda(KOAgenda* agenda) | 229 | void TimeLabels::setAgenda(KOAgenda* agenda) |
230 | { | 230 | { |
231 | mAgenda = agenda; | 231 | mAgenda = agenda; |
232 | } | 232 | } |
233 | 233 | ||
234 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 234 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
235 | { | 235 | { |
236 | mMouseDownY = e->pos().y(); | 236 | mMouseDownY = e->pos().y(); |
237 | mOrgCap = topLevelWidget()->caption(); | 237 | mOrgCap = topLevelWidget()->caption(); |
238 | } | 238 | } |
239 | 239 | ||
240 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 240 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
241 | { | 241 | { |
242 | int diff = mMouseDownY - e->pos().y(); | 242 | int diff = mMouseDownY - e->pos().y(); |
243 | if ( diff < 10 && diff > -10 ) | 243 | if ( diff < 10 && diff > -10 ) |
244 | return; | 244 | return; |
245 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 245 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
246 | if ( tSize < 4 ) | 246 | if ( tSize < 4 ) |
247 | tSize = 4; | 247 | tSize = 4; |
248 | if ( tSize > 22 ) | 248 | if ( tSize > 22 ) |
249 | tSize = 22; | 249 | tSize = 22; |
250 | tSize = (tSize-2)/2; | 250 | tSize = (tSize-2)/2; |
251 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 251 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
252 | 252 | ||
253 | } | 253 | } |
254 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 254 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
255 | { | 255 | { |
256 | topLevelWidget()->setCaption( mOrgCap ); | 256 | topLevelWidget()->setCaption( mOrgCap ); |
257 | int diff = mMouseDownY - e->pos().y(); | 257 | int diff = mMouseDownY - e->pos().y(); |
258 | if ( diff < 10 && diff > -10 ) | 258 | if ( diff < 10 && diff > -10 ) |
259 | return; | 259 | return; |
260 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 260 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
261 | if ( tSize < 4 ) | 261 | if ( tSize < 4 ) |
262 | tSize = 4; | 262 | tSize = 4; |
263 | if ( tSize > 22 ) | 263 | if ( tSize > 22 ) |
264 | tSize = 22; | 264 | tSize = 22; |
265 | tSize = (tSize/2)*2; | 265 | tSize = (tSize/2)*2; |
266 | if ( tSize == KOPrefs::instance()->mHourSize ) | 266 | if ( tSize == KOPrefs::instance()->mHourSize ) |
267 | return; | 267 | return; |
268 | KOPrefs::instance()->mHourSize = tSize; | 268 | KOPrefs::instance()->mHourSize = tSize; |
269 | emit scaleChanged(); | 269 | emit scaleChanged(); |
270 | } | 270 | } |
271 | 271 | ||
@@ -386,399 +386,408 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
386 | mDayLabels = 0; | 386 | mDayLabels = 0; |
387 | bool isRTL = KOGlobals::self()->reverseLayout(); | 387 | bool isRTL = KOGlobals::self()->reverseLayout(); |
388 | QPixmap expandPix; | 388 | QPixmap expandPix; |
389 | if ( KOPrefs::instance()->mVerticalScreen ) { | 389 | if ( KOPrefs::instance()->mVerticalScreen ) { |
390 | expandPix = SmallIcon( "1updownarrow" ); | 390 | expandPix = SmallIcon( "1updownarrow" ); |
391 | } else { | 391 | } else { |
392 | expandPix = SmallIcon("1leftrightarrow" ); | 392 | expandPix = SmallIcon("1leftrightarrow" ); |
393 | } | 393 | } |
394 | 394 | ||
395 | QBoxLayout *topLayout = new QVBoxLayout(this); | 395 | QBoxLayout *topLayout = new QVBoxLayout(this); |
396 | 396 | ||
397 | // Create day name labels for agenda columns | 397 | // Create day name labels for agenda columns |
398 | // Create agenda splitter | 398 | // Create agenda splitter |
399 | 399 | ||
400 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 400 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
401 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 401 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
402 | topLayout->addWidget( mSplitterAgenda ); | 402 | topLayout->addWidget( mSplitterAgenda ); |
403 | mAllDayFrame = new QHBox(mSplitterAgenda); | 403 | mAllDayFrame = new QHBox(mSplitterAgenda); |
404 | mAllDayFrame->setFocusPolicy(NoFocus); | 404 | mAllDayFrame->setFocusPolicy(NoFocus); |
405 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 405 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
406 | agendaFrame->setFocusPolicy(NoFocus); | 406 | agendaFrame->setFocusPolicy(NoFocus); |
407 | 407 | ||
408 | // Create all-day agenda widget | 408 | // Create all-day agenda widget |
409 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 409 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
410 | 410 | ||
411 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 411 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
412 | mExpandButton->setPixmap( expandPix ); | 412 | mExpandButton->setPixmap( expandPix ); |
413 | int widebut = mExpandButton->sizeHint().width()+4; | 413 | int widebut = mExpandButton->sizeHint().width()+4; |
414 | int heibut = mExpandButton->sizeHint().height()+4; | 414 | int heibut = mExpandButton->sizeHint().height()+4; |
415 | if ( heibut > widebut ) | 415 | if ( heibut > widebut ) |
416 | widebut = heibut ; | 416 | widebut = heibut ; |
417 | 417 | ||
418 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 418 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
419 | // QSizePolicy::Fixed ) ); | 419 | // QSizePolicy::Fixed ) ); |
420 | mExpandButton->setFixedSize( widebut, widebut); | 420 | mExpandButton->setFixedSize( widebut, widebut); |
421 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 421 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
422 | mExpandButton->setFocusPolicy(NoFocus); | 422 | mExpandButton->setFocusPolicy(NoFocus); |
423 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 423 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
424 | mAllDayAgenda->setFocusPolicy(NoFocus); | 424 | mAllDayAgenda->setFocusPolicy(NoFocus); |
425 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 425 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
426 | 426 | ||
427 | // Create event context menu for all day agenda | 427 | // Create event context menu for all day agenda |
428 | //mAllDayAgendaPopup = eventPopup(); | 428 | //mAllDayAgendaPopup = eventPopup(); |
429 | 429 | ||
430 | // Create agenda frame | 430 | // Create agenda frame |
431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
433 | 433 | ||
434 | // create event indicator bars | 434 | // create event indicator bars |
435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
436 | #ifndef DESKTOP_VERSION | 436 | #ifndef DESKTOP_VERSION |
437 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 437 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
438 | #endif | 438 | #endif |
439 | mDayLabelsFrame = new QHBox(agendaFrame); | 439 | mDayLabelsFrame = new QHBox(agendaFrame); |
440 | //topLayout->addWidget(mDayLabelsFrame); | 440 | //topLayout->addWidget(mDayLabelsFrame); |
441 | mDayLabels = new QFrame (mDayLabelsFrame); | 441 | mDayLabels = new QFrame (mDayLabelsFrame); |
442 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 442 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
443 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 443 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
444 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 444 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
445 | 445 | ||
446 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 446 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
447 | agendaFrame); | 447 | agendaFrame); |
448 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 448 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
449 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 449 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
450 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 450 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
451 | 451 | ||
452 | // Create time labels | 452 | // Create time labels |
453 | mTimeLabels = new TimeLabels(24,agendaFrame); | 453 | mTimeLabels = new TimeLabels(24,agendaFrame); |
454 | agendaLayout->addWidget(mTimeLabels,2,0); | 454 | agendaLayout->addWidget(mTimeLabels,2,0); |
455 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 455 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
456 | this,SLOT(updateConfig())); | 456 | this,SLOT(updateConfig())); |
457 | 457 | ||
458 | // Create agenda | 458 | // Create agenda |
459 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 459 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
460 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 460 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
461 | agendaLayout->setColStretch(1,1); | 461 | agendaLayout->setColStretch(1,1); |
462 | mAgenda->setFocusPolicy(NoFocus); | 462 | mAgenda->setFocusPolicy(NoFocus); |
463 | // Create event context menu for agenda | 463 | // Create event context menu for agenda |
464 | mAllAgendaPopup = eventPopup(); | 464 | mAllAgendaPopup = eventPopup(); |
465 | 465 | ||
466 | #if 0 | 466 | #if 0 |
467 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 467 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
468 | i18n("Toggle Alarm"),mAgenda, | 468 | i18n("Toggle Alarm"),mAgenda, |
469 | SLOT(popupAlarm()),true); | 469 | SLOT(popupAlarm()),true); |
470 | 470 | ||
471 | #endif | 471 | #endif |
472 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 472 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
473 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 473 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
474 | 474 | ||
475 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 475 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
476 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 476 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
477 | 477 | ||
478 | connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)), | 478 | connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)), |
479 | this,SLOT(categoryChanged(Incidence *))); | 479 | this,SLOT(categoryChanged(Incidence *))); |
480 | 480 | ||
481 | 481 | ||
482 | mAgenda->setPopup( mAllAgendaPopup ); | 482 | mAgenda->setPopup( mAllAgendaPopup ); |
483 | mAllDayAgenda->setPopup( mAllAgendaPopup ); | 483 | mAllDayAgenda->setPopup( mAllAgendaPopup ); |
484 | // make connections between dependent widgets | 484 | // make connections between dependent widgets |
485 | mTimeLabels->setAgenda(mAgenda); | 485 | mTimeLabels->setAgenda(mAgenda); |
486 | 486 | ||
487 | // Update widgets to reflect user preferences | 487 | // Update widgets to reflect user preferences |
488 | // updateConfig(); | 488 | // updateConfig(); |
489 | 489 | ||
490 | // createDayLabels(); | 490 | // createDayLabels(); |
491 | 491 | ||
492 | // these blank widgets make the All Day Event box line up with the agenda | 492 | // these blank widgets make the All Day Event box line up with the agenda |
493 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 493 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
494 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 494 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
495 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 495 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
496 | 496 | ||
497 | // Scrolling | 497 | // Scrolling |
498 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 498 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
499 | mTimeLabels, SLOT(positionChanged())); | 499 | mTimeLabels, SLOT(positionChanged())); |
500 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 500 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
501 | SLOT(setContentsPos(int))); | 501 | SLOT(setContentsPos(int))); |
502 | 502 | ||
503 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); | 503 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); |
504 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); | 504 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); |
505 | 505 | ||
506 | // Create/Show/Edit/Delete Event | 506 | // Create/Show/Edit/Delete Event |
507 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 507 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
508 | SLOT(newEvent(int,int))); | 508 | SLOT(newEvent(int,int))); |
509 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 509 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
510 | SLOT(newTodo(int,int))); | 510 | SLOT(newTodo(int,int))); |
511 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 511 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
512 | SLOT(newEvent(int,int,int,int))); | 512 | SLOT(newEvent(int,int,int,int))); |
513 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 513 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
514 | SLOT(newEventAllDay(int,int))); | 514 | SLOT(newEventAllDay(int,int))); |
515 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 515 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
516 | SLOT(newTodoAllDay(int,int))); | 516 | SLOT(newTodoAllDay(int,int))); |
517 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 517 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
518 | SLOT(newEventAllDay(int,int))); | 518 | SLOT(newEventAllDay(int,int))); |
519 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 519 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
520 | SLOT(newTimeSpanSelected(int,int,int,int))); | 520 | SLOT(newTimeSpanSelected(int,int,int,int))); |
521 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 521 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
522 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 522 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
523 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 523 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
524 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 524 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
525 | 525 | ||
526 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 526 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
527 | SIGNAL(editIncidenceSignal(Incidence *))); | 527 | SIGNAL(editIncidenceSignal(Incidence *))); |
528 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 528 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
529 | SIGNAL(editIncidenceSignal(Incidence *))); | 529 | SIGNAL(editIncidenceSignal(Incidence *))); |
530 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 530 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
531 | SIGNAL(showIncidenceSignal(Incidence *))); | 531 | SIGNAL(showIncidenceSignal(Incidence *))); |
532 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 532 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
533 | SIGNAL(showIncidenceSignal(Incidence *))); | 533 | SIGNAL(showIncidenceSignal(Incidence *))); |
534 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 534 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
535 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 535 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
536 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 536 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
537 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 537 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
538 | 538 | ||
539 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 539 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
540 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 540 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
541 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 541 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
542 | SLOT(updateEventDates(KOAgendaItem *, int))); | 542 | SLOT(updateEventDates(KOAgendaItem *, int))); |
543 | 543 | ||
544 | // event indicator update | 544 | // event indicator update |
545 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 545 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
546 | SLOT(updateEventIndicatorTop(int))); | 546 | SLOT(updateEventIndicatorTop(int))); |
547 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 547 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
548 | SLOT(updateEventIndicatorBottom(int))); | 548 | SLOT(updateEventIndicatorBottom(int))); |
549 | // drag signals | 549 | // drag signals |
550 | /* | 550 | /* |
551 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 551 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
552 | SLOT(startDrag(Event *))); | 552 | SLOT(startDrag(Event *))); |
553 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 553 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
554 | SLOT(startDrag(Event *))); | 554 | SLOT(startDrag(Event *))); |
555 | */ | 555 | */ |
556 | // synchronize selections | 556 | // synchronize selections |
557 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 557 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
558 | mAllDayAgenda, SLOT( deselectItem() ) ); | 558 | mAllDayAgenda, SLOT( deselectItem() ) ); |
559 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 559 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
560 | mAgenda, SLOT( deselectItem() ) ); | 560 | mAgenda, SLOT( deselectItem() ) ); |
561 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 561 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
562 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 562 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
563 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 563 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
564 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 564 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
565 | connect( mAgenda, SIGNAL( resizedSignal() ), | 565 | connect( mAgenda, SIGNAL( resizedSignal() ), |
566 | SLOT( updateConfig( ) ) ); | 566 | SLOT( updateConfig( ) ) ); |
567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
573 | 573 | ||
574 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); | 574 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); |
575 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); | 575 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); |
576 | connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); | 576 | connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); |
577 | connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); | 577 | connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); |
578 | 578 | ||
579 | connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) ); | ||
580 | connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) ); | ||
581 | |||
582 | |||
579 | mIdleTimer = new QTimer ( this );; | 583 | mIdleTimer = new QTimer ( this );; |
580 | connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); | 584 | connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); |
581 | } | 585 | } |
586 | void KOAgendaView::startIdleTimeout() | ||
587 | { | ||
588 | mIdleStart = QDateTime::currentDateTime(); | ||
589 | mIdleTimer->start( IDLETIMEOUT * 1000 ); | ||
590 | } | ||
582 | void KOAgendaView::slotIdleTimeout() | 591 | void KOAgendaView::slotIdleTimeout() |
583 | { | 592 | { |
584 | qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); | 593 | qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); |
585 | int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); | 594 | int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); |
586 | mIdleTimer->stop(); | 595 | mIdleTimer->stop(); |
587 | bool isActice = topLevelWidget()->isActiveWindow(); | 596 | bool isActice = topLevelWidget()->isActiveWindow(); |
588 | qDebug("KO: Active Window %d ", isActice); | 597 | qDebug("KO: Active Window %d %d", isActice, isVisible()); |
589 | // we do nothing if we wake up from a suspend | 598 | // we do nothing if we wake up from a suspend |
590 | if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) { | 599 | if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { |
591 | qDebug("KO: Wakeup from suspend "); | 600 | qDebug("KO: Wakeup from suspend "); |
592 | mIdleTimer->start( IDLETIMEOUT * 1000 ); | 601 | startIdleTimeout(); |
593 | return; | 602 | return; |
594 | } | 603 | } |
595 | qDebug("KO: Downsizing Pixmaps "); | 604 | qDebug("KO: Downsizing Pixmaps "); |
596 | mAgenda->shrinkPixmap(); | 605 | mAgenda->shrinkPixmap(); |
597 | mAllDayAgenda->shrinkPixmap(); | 606 | mAllDayAgenda->shrinkPixmap(); |
598 | KOAgendaItem::paintPix()->resize( 20,20); | 607 | KOAgendaItem::paintPix()->resize( 20,20); |
599 | KOAgendaItem::paintPixAllday()->resize( 20,20); | 608 | KOAgendaItem::paintPixAllday()->resize( 20,20); |
600 | 609 | ||
601 | } | 610 | } |
602 | void KOAgendaView::toggleAllDay() | 611 | void KOAgendaView::toggleAllDay() |
603 | { | 612 | { |
604 | if ( mSplitterAgenda->firstHandle() ) | 613 | if ( mSplitterAgenda->firstHandle() ) |
605 | mSplitterAgenda->firstHandle()->toggle(); | 614 | mSplitterAgenda->firstHandle()->toggle(); |
606 | } | 615 | } |
607 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 616 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
608 | { | 617 | { |
609 | calendar()->addIncidence( inc ); | 618 | calendar()->addIncidence( inc ); |
610 | 619 | ||
611 | if ( incOld ) { | 620 | if ( incOld ) { |
612 | if ( incOld->typeID() == todoID ) | 621 | if ( incOld->typeID() == todoID ) |
613 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 622 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
614 | else | 623 | else |
615 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 624 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
616 | } | 625 | } |
617 | 626 | ||
618 | } | 627 | } |
619 | void KOAgendaView::categoryChanged(Incidence * inc) | 628 | void KOAgendaView::categoryChanged(Incidence * inc) |
620 | { | 629 | { |
621 | mAgenda->categoryChanged( inc ); | 630 | mAgenda->categoryChanged( inc ); |
622 | mAllDayAgenda->categoryChanged( inc ); | 631 | mAllDayAgenda->categoryChanged( inc ); |
623 | } | 632 | } |
624 | KOAgendaView::~KOAgendaView() | 633 | KOAgendaView::~KOAgendaView() |
625 | { | 634 | { |
626 | delete mAllAgendaPopup; | 635 | delete mAllAgendaPopup; |
627 | //delete mAllDayAgendaPopup; | 636 | //delete mAllDayAgendaPopup; |
628 | delete KOAgendaItem::paintPix(); | 637 | delete KOAgendaItem::paintPix(); |
629 | delete KOAgendaItem::paintPixAllday(); | 638 | delete KOAgendaItem::paintPixAllday(); |
630 | } | 639 | } |
631 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 640 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
632 | { | 641 | { |
633 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 642 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
634 | bool uc = false; | 643 | bool uc = false; |
635 | int ow = e->oldSize().width(); | 644 | int ow = e->oldSize().width(); |
636 | int oh = e->oldSize().height(); | 645 | int oh = e->oldSize().height(); |
637 | int w = e->size().width(); | 646 | int w = e->size().width(); |
638 | int h = e->size().height(); | 647 | int h = e->size().height(); |
639 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 648 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
640 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 649 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
641 | uc = true; | 650 | uc = true; |
642 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 651 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
643 | } | 652 | } |
644 | mUpcomingWidth = e->size().width() ; | 653 | mUpcomingWidth = e->size().width() ; |
645 | if ( mBlockUpdating || uc ) { | 654 | if ( mBlockUpdating || uc ) { |
646 | mBlockUpdating = false; | 655 | mBlockUpdating = false; |
647 | //mAgenda->setMinimumSize(800 , 600 ); | 656 | //mAgenda->setMinimumSize(800 , 600 ); |
648 | //qDebug("mAgenda->resize+++++++++++++++ "); | 657 | //qDebug("mAgenda->resize+++++++++++++++ "); |
649 | updateConfig(); | 658 | updateConfig(); |
650 | //qDebug("KOAgendaView::Updating now possible "); | 659 | //qDebug("KOAgendaView::Updating now possible "); |
651 | } else | 660 | } else |
652 | createDayLabels(); | 661 | createDayLabels(); |
653 | //qDebug("resizeEvent end "); | 662 | //qDebug("resizeEvent end "); |
654 | 663 | ||
655 | } | 664 | } |
656 | void KOAgendaView::slotDaylabelClicked( int num ) | 665 | void KOAgendaView::slotDaylabelClicked( int num ) |
657 | { | 666 | { |
658 | 667 | ||
659 | QDate firstDate = mSelectedDates.first(); | 668 | QDate firstDate = mSelectedDates.first(); |
660 | if ( num == -1 ) | 669 | if ( num == -1 ) |
661 | emit showDateView( 6, firstDate ); | 670 | emit showDateView( 6, firstDate ); |
662 | else if (num >= 0 ) { | 671 | else if (num >= 0 ) { |
663 | if ( mSelectedDates.count() == 1) | 672 | if ( mSelectedDates.count() == 1) |
664 | emit showDateView( 9, firstDate.addDays( num ) ); | 673 | emit showDateView( 9, firstDate.addDays( num ) ); |
665 | else | 674 | else |
666 | emit showDateView( 3, firstDate.addDays( num ) ); | 675 | emit showDateView( 3, firstDate.addDays( num ) ); |
667 | } | 676 | } |
668 | else | 677 | else |
669 | showDateView( 10, firstDate.addDays(1) ); | 678 | showDateView( 10, firstDate.addDays(1) ); |
670 | } | 679 | } |
671 | 680 | ||
672 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 681 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
673 | { | 682 | { |
674 | 683 | ||
675 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 684 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
676 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 685 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
677 | mDayLabelsList.append( dayLabel ); | 686 | mDayLabelsList.append( dayLabel ); |
678 | mLayoutDayLabels->addWidget(dayLabel); | 687 | mLayoutDayLabels->addWidget(dayLabel); |
679 | return dayLabel ; | 688 | return dayLabel ; |
680 | } | 689 | } |
681 | 690 | ||
682 | void KOAgendaView::createDayLabels() | 691 | void KOAgendaView::createDayLabels() |
683 | { | 692 | { |
684 | 693 | ||
685 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 694 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
686 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 695 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
687 | return; | 696 | return; |
688 | 697 | ||
689 | } | 698 | } |
690 | int newHight; | 699 | int newHight; |
691 | if ( !mSelectedDates.count()) | 700 | if ( !mSelectedDates.count()) |
692 | return; | 701 | return; |
693 | 702 | ||
694 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 703 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
695 | // It would remove some flickering and gain speed (since this is called by | 704 | // It would remove some flickering and gain speed (since this is called by |
696 | // each updateView() call) | 705 | // each updateView() call) |
697 | 706 | ||
698 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; | 707 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; |
699 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 708 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
700 | if ( maxWid < 20 ) | 709 | if ( maxWid < 20 ) |
701 | maxWid = 20; | 710 | maxWid = 20; |
702 | 711 | ||
703 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 712 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
704 | QFontMetrics fm ( dlf ); | 713 | QFontMetrics fm ( dlf ); |
705 | dlf.setBold( true ); | 714 | dlf.setBold( true ); |
706 | int selCount = mSelectedDates.count(); | 715 | int selCount = mSelectedDates.count(); |
707 | int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; | 716 | int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; |
708 | QString dayTest = "Mon 20"; | 717 | QString dayTest = "Mon 20"; |
709 | //QString dayTest = "Mon 20"; | 718 | //QString dayTest = "Mon 20"; |
710 | int wid = fm.width( dayTest ); | 719 | int wid = fm.width( dayTest ); |
711 | //maxWid -= ( selCount * 3 ); //working for QLabels | 720 | //maxWid -= ( selCount * 3 ); //working for QLabels |
712 | if ( QApplication::desktop()->width() <= 320 ) | 721 | if ( QApplication::desktop()->width() <= 320 ) |
713 | maxWid -= ( selCount * 3 ); //working for QPushButton | 722 | maxWid -= ( selCount * 3 ); //working for QPushButton |
714 | else | 723 | else |
715 | maxWid -= ( selCount * 4 ); //working for QPushButton | 724 | maxWid -= ( selCount * 4 ); //working for QPushButton |
716 | if ( maxWid < 0 ) | 725 | if ( maxWid < 0 ) |
717 | maxWid = 20; | 726 | maxWid = 20; |
718 | int needWid = wid * selCount; | 727 | int needWid = wid * selCount; |
719 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 728 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
720 | //if ( needWid > maxWid ) | 729 | //if ( needWid > maxWid ) |
721 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 730 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
722 | while ( needWid > maxWid ) { | 731 | while ( needWid > maxWid ) { |
723 | dayTest = dayTest.left( dayTest.length() - 1 ); | 732 | dayTest = dayTest.left( dayTest.length() - 1 ); |
724 | wid = fm.width( dayTest ); | 733 | wid = fm.width( dayTest ); |
725 | needWid = wid * selCount; | 734 | needWid = wid * selCount; |
726 | } | 735 | } |
727 | int maxLen = dayTest.length(); | 736 | int maxLen = dayTest.length(); |
728 | int fontPoint = dlf.pointSize(); | 737 | int fontPoint = dlf.pointSize(); |
729 | if ( maxLen < 2 ) { | 738 | if ( maxLen < 2 ) { |
730 | int fontPoint = dlf.pointSize(); | 739 | int fontPoint = dlf.pointSize(); |
731 | while ( fontPoint > 4 ) { | 740 | while ( fontPoint > 4 ) { |
732 | --fontPoint; | 741 | --fontPoint; |
733 | dlf.setPointSize( fontPoint ); | 742 | dlf.setPointSize( fontPoint ); |
734 | QFontMetrics f( dlf ); | 743 | QFontMetrics f( dlf ); |
735 | wid = f.width( "30" ); | 744 | wid = f.width( "30" ); |
736 | needWid = wid * selCount; | 745 | needWid = wid * selCount; |
737 | if ( needWid < maxWid ) | 746 | if ( needWid < maxWid ) |
738 | break; | 747 | break; |
739 | } | 748 | } |
740 | maxLen = 2; | 749 | maxLen = 2; |
741 | } | 750 | } |
742 | //qDebug("Max len %d ", dayTest.length() ); | 751 | //qDebug("Max len %d ", dayTest.length() ); |
743 | if ( !KOPrefs::instance()->mTimeLabelsFont.bold() ) | 752 | if ( !KOPrefs::instance()->mTimeLabelsFont.bold() ) |
744 | dlf.setBold( false ); | 753 | dlf.setBold( false ); |
745 | QFontMetrics tempF( dlf ); | 754 | QFontMetrics tempF( dlf ); |
746 | newHight = tempF.height(); | 755 | newHight = tempF.height(); |
747 | mDayLabels->setFont( dlf ); | 756 | mDayLabels->setFont( dlf ); |
748 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 757 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
749 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 758 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
750 | //mLayoutDayLabels->addSpacing( 2 ); | 759 | //mLayoutDayLabels->addSpacing( 2 ); |
751 | // QFont lFont = dlf; | 760 | // QFont lFont = dlf; |
752 | bool appendLabels = false; | 761 | bool appendLabels = false; |
753 | KOAgendaButton *dayLabel; | 762 | KOAgendaButton *dayLabel; |
754 | dayLabel = mDayLabelsList.first(); | 763 | dayLabel = mDayLabelsList.first(); |
755 | if ( !dayLabel ) { | 764 | if ( !dayLabel ) { |
756 | appendLabels = true; | 765 | appendLabels = true; |
757 | dayLabel = getNewDaylabel(); | 766 | dayLabel = getNewDaylabel(); |
758 | } | 767 | } |
759 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); | 768 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); |
760 | dayLabel->setFont( dlf ); | 769 | dayLabel->setFont( dlf ); |
761 | dayLabel->setNum( -1 ); | 770 | dayLabel->setNum( -1 ); |
762 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 771 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
763 | 772 | ||
764 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 773 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
765 | dayLabel->show(); | 774 | dayLabel->show(); |
766 | DateList::ConstIterator dit; | 775 | DateList::ConstIterator dit; |
767 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 776 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
768 | int counter = -1; | 777 | int counter = -1; |
769 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 778 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
770 | ++counter; | 779 | ++counter; |
771 | QDate date = *dit; | 780 | QDate date = *dit; |
772 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 781 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
773 | if ( ! appendLabels ) { | 782 | if ( ! appendLabels ) { |
774 | dayLabel = mDayLabelsList.next(); | 783 | dayLabel = mDayLabelsList.next(); |
775 | if ( !dayLabel ) | 784 | if ( !dayLabel ) |
776 | appendLabels = true; | 785 | appendLabels = true; |
777 | } | 786 | } |
778 | if ( appendLabels ) { | 787 | if ( appendLabels ) { |
779 | dayLabel = getNewDaylabel(); | 788 | dayLabel = getNewDaylabel(); |
780 | } | 789 | } |
781 | dayLabel->setMinimumWidth( 1 ); | 790 | dayLabel->setMinimumWidth( 1 ); |
782 | dayLabel->setMaximumWidth( 10240 ); | 791 | dayLabel->setMaximumWidth( 10240 ); |
783 | dayLabel->setFont( dlf ); | 792 | dayLabel->setFont( dlf ); |
784 | dayLabel->show(); | 793 | dayLabel->show(); |
@@ -1132,386 +1141,385 @@ void KOAgendaView::fillAgenda() | |||
1132 | //globalFlagBlockAgenda = 0; | 1141 | //globalFlagBlockAgenda = 0; |
1133 | // globalFlagBlockPainting = false; | 1142 | // globalFlagBlockPainting = false; |
1134 | if ( globalFlagBlockAgenda == 0 ) | 1143 | if ( globalFlagBlockAgenda == 0 ) |
1135 | globalFlagBlockAgenda = 1; | 1144 | globalFlagBlockAgenda = 1; |
1136 | // clearView(); | 1145 | // clearView(); |
1137 | //qDebug("fillAgenda()++++ "); | 1146 | //qDebug("fillAgenda()++++ "); |
1138 | globalFlagBlockAgendaItemPaint = 1; | 1147 | globalFlagBlockAgendaItemPaint = 1; |
1139 | 1148 | ||
1140 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1149 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1141 | mAgenda->changeColumns(mSelectedDates.count()); | 1150 | mAgenda->changeColumns(mSelectedDates.count()); |
1142 | qApp->processEvents(); | 1151 | qApp->processEvents(); |
1143 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1152 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1144 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1153 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1145 | setHolidayMasks(); | 1154 | setHolidayMasks(); |
1146 | 1155 | ||
1147 | mMinY.resize(mSelectedDates.count()); | 1156 | mMinY.resize(mSelectedDates.count()); |
1148 | mMaxY.resize(mSelectedDates.count()); | 1157 | mMaxY.resize(mSelectedDates.count()); |
1149 | 1158 | ||
1150 | QPtrList<Event> dayEvents; | 1159 | QPtrList<Event> dayEvents; |
1151 | 1160 | ||
1152 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1161 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1153 | // Therefore, gtodoset all of them. | 1162 | // Therefore, gtodoset all of them. |
1154 | QPtrList<Todo> todos = calendar()->todos(); | 1163 | QPtrList<Todo> todos = calendar()->todos(); |
1155 | 1164 | ||
1156 | mAgenda->setDateList(mSelectedDates); | 1165 | mAgenda->setDateList(mSelectedDates); |
1157 | 1166 | ||
1158 | QDate today = QDate::currentDate(); | 1167 | QDate today = QDate::currentDate(); |
1159 | 1168 | ||
1160 | DateList::ConstIterator dit; | 1169 | DateList::ConstIterator dit; |
1161 | int curCol = 0; | 1170 | int curCol = 0; |
1162 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1171 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1163 | QDate currentDate = *dit; | 1172 | QDate currentDate = *dit; |
1164 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1173 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1165 | // << endl; | 1174 | // << endl; |
1166 | 1175 | ||
1167 | dayEvents = calendar()->events(currentDate,false); | 1176 | dayEvents = calendar()->events(currentDate,false); |
1168 | 1177 | ||
1169 | // Default values, which can never be reached | 1178 | // Default values, which can never be reached |
1170 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1179 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1171 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1180 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1172 | 1181 | ||
1173 | unsigned int numEvent; | 1182 | unsigned int numEvent; |
1174 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1183 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1175 | Event *event = dayEvents.at(numEvent); | 1184 | Event *event = dayEvents.at(numEvent); |
1176 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1185 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1177 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1186 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1178 | continue; | 1187 | continue; |
1179 | // kdDebug() << " Event: " << event->summary() << endl; | 1188 | // kdDebug() << " Event: " << event->summary() << endl; |
1180 | 1189 | ||
1181 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1190 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1182 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1191 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1183 | 1192 | ||
1184 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1193 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1185 | 1194 | ||
1186 | if (event->doesFloat()) { | 1195 | if (event->doesFloat()) { |
1187 | if (event->recurrence()->doesRecur()) { | 1196 | if (event->recurrence()->doesRecur()) { |
1188 | if (event->isMultiDay() ) { | 1197 | if (event->isMultiDay() ) { |
1189 | endX = endX - beginX;// endX is now number of days | 1198 | endX = endX - beginX;// endX is now number of days |
1190 | if ( event->recursOn( currentDate ) ) { | 1199 | if ( event->recursOn( currentDate ) ) { |
1191 | endX += curCol; | 1200 | endX += curCol; |
1192 | beginX = curCol; | 1201 | beginX = curCol; |
1193 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1202 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1194 | } else { | 1203 | } else { |
1195 | //qDebug("days %d %s",endX , currentDate.toString().latin1()); | 1204 | //qDebug("days %d %s",endX , currentDate.toString().latin1()); |
1196 | QDate dateit = currentDate.addDays( -endX ); | 1205 | QDate dateit = currentDate.addDays( -endX ); |
1197 | if ( event->recursOn( dateit ) ) { | 1206 | if ( event->recursOn( dateit ) ) { |
1198 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); | 1207 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); |
1199 | if ( curCol-endX < 0 ) { | 1208 | if ( curCol-endX < 0 ) { |
1200 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1209 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1201 | } | 1210 | } |
1202 | } | 1211 | } |
1203 | } | 1212 | } |
1204 | } else { | 1213 | } else { |
1205 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1214 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1206 | } | 1215 | } |
1207 | 1216 | ||
1208 | } else { | 1217 | } else { |
1209 | if (beginX <= 0 && curCol == 0) { | 1218 | if (beginX <= 0 && curCol == 0) { |
1210 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1219 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1211 | } else if (beginX == curCol) { | 1220 | } else if (beginX == curCol) { |
1212 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1221 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1213 | } | 1222 | } |
1214 | } | 1223 | } |
1215 | } else if (event->isMultiDay()) { | 1224 | } else if (event->isMultiDay()) { |
1216 | if ( event->doesRecur () ) { | 1225 | if ( event->doesRecur () ) { |
1217 | QDate dateit = currentDate; | 1226 | QDate dateit = currentDate; |
1218 | int count = 0; | 1227 | int count = 0; |
1219 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1228 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1220 | while (! event->recursOn( dateit ) && count <= max ) { | 1229 | while (! event->recursOn( dateit ) && count <= max ) { |
1221 | ++count; | 1230 | ++count; |
1222 | dateit = dateit.addDays( -1 ); | 1231 | dateit = dateit.addDays( -1 ); |
1223 | } | 1232 | } |
1224 | bool ok; | 1233 | bool ok; |
1225 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1234 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1226 | if ( ok ) | 1235 | if ( ok ) |
1227 | { | 1236 | { |
1228 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1237 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1229 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1238 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1230 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1239 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1231 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1240 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1232 | 1241 | ||
1233 | } | 1242 | } |
1234 | } | 1243 | } |
1235 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1244 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1236 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1245 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1237 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1246 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1238 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1247 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1239 | //qDebug("insert!!! "); | 1248 | //qDebug("insert!!! "); |
1240 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1249 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1241 | } | 1250 | } |
1242 | if (beginX == curCol) { | 1251 | if (beginX == curCol) { |
1243 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1252 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1244 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1253 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1245 | } else if (endX == curCol) { | 1254 | } else if (endX == curCol) { |
1246 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1255 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1247 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1256 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1248 | } else { | 1257 | } else { |
1249 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1258 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1250 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1259 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1251 | } | 1260 | } |
1252 | } else { | 1261 | } else { |
1253 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1262 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1254 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1263 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1255 | if (endY < startY) endY = startY; | 1264 | if (endY < startY) endY = startY; |
1256 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1265 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1257 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1266 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1258 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1267 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1259 | } | 1268 | } |
1260 | } | 1269 | } |
1261 | // ---------- [display Todos -------------- | 1270 | // ---------- [display Todos -------------- |
1262 | unsigned int numTodo; | 1271 | unsigned int numTodo; |
1263 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1272 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1264 | Todo *todo = todos.at(numTodo); | 1273 | Todo *todo = todos.at(numTodo); |
1265 | 1274 | ||
1266 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1275 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1267 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; | 1276 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; |
1268 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1277 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1269 | // Already completed items can be displayed on their original due date | 1278 | // Already completed items can be displayed on their original due date |
1270 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1279 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1271 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1280 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1272 | bool fillIn = false; | 1281 | bool fillIn = false; |
1273 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1282 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1274 | fillIn = true; | 1283 | fillIn = true; |
1275 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1284 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1276 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1285 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1277 | if ( fillIn ) { | 1286 | if ( fillIn ) { |
1278 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1287 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1279 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1288 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1280 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1289 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1281 | } | 1290 | } |
1282 | else { | 1291 | else { |
1283 | QDateTime dt; | 1292 | QDateTime dt; |
1284 | if ( todo->hasCompletedDate() ) | 1293 | if ( todo->hasCompletedDate() ) |
1285 | dt = todo->completed(); | 1294 | dt = todo->completed(); |
1286 | else | 1295 | else |
1287 | dt = todo->dtDue();; | 1296 | dt = todo->dtDue();; |
1288 | 1297 | ||
1289 | 1298 | ||
1290 | int endY = mAgenda->timeToY(dt.time()) - 1; | 1299 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1291 | int hi = (18/KOPrefs::instance()->mHourSize); | 1300 | int hi = (18/KOPrefs::instance()->mHourSize); |
1292 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1301 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1293 | int startY = endY -hi; | 1302 | int startY = endY -hi; |
1294 | 1303 | ||
1295 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1304 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1296 | 1305 | ||
1297 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1306 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1298 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1307 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1299 | } | 1308 | } |
1300 | } | 1309 | } |
1301 | } | 1310 | } |
1302 | // ---------- display Todos] -------------- | 1311 | // ---------- display Todos] -------------- |
1303 | 1312 | ||
1304 | ++curCol; | 1313 | ++curCol; |
1305 | } | 1314 | } |
1306 | mAgenda->hideUnused(); | 1315 | mAgenda->hideUnused(); |
1307 | mAllDayAgenda->hideUnused(); | 1316 | mAllDayAgenda->hideUnused(); |
1308 | mAgenda->checkScrollBoundaries(); | 1317 | mAgenda->checkScrollBoundaries(); |
1309 | deleteSelectedDateTime(); | 1318 | deleteSelectedDateTime(); |
1310 | createDayLabels(); | 1319 | createDayLabels(); |
1311 | emit incidenceSelected( 0 ); | 1320 | emit incidenceSelected( 0 ); |
1312 | 1321 | ||
1313 | if ( globalFlagBlockAgenda == 2 ) { | 1322 | if ( globalFlagBlockAgenda == 2 ) { |
1314 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1323 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1315 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1324 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1316 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1325 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1317 | setStartHour( QTime::currentTime ().hour() ); | 1326 | setStartHour( QTime::currentTime ().hour() ); |
1318 | } | 1327 | } |
1319 | qApp->processEvents(); | 1328 | qApp->processEvents(); |
1320 | globalFlagBlockAgenda = 0; | 1329 | globalFlagBlockAgenda = 0; |
1321 | mAllDayAgenda->drawContentsToPainter(); | 1330 | mAllDayAgenda->drawContentsToPainter(); |
1322 | mAgenda->drawContentsToPainter(); | 1331 | mAgenda->drawContentsToPainter(); |
1323 | repaintAgenda(); | 1332 | repaintAgenda(); |
1324 | mIdleTimer->start ( IDLETIMEOUT *1000 ); | 1333 | startIdleTimeout(); |
1325 | mIdleStart = QDateTime::currentDateTime(); | ||
1326 | onlyOne = false; | 1334 | onlyOne = false; |
1327 | } | 1335 | } |
1328 | void KOAgendaView::repaintAgenda() | 1336 | void KOAgendaView::repaintAgenda() |
1329 | { | 1337 | { |
1330 | mAgenda->viewport()->repaint( false ); | 1338 | mAgenda->viewport()->repaint( false ); |
1331 | mAllDayAgenda->viewport()->repaint( false ); | 1339 | mAllDayAgenda->viewport()->repaint( false ); |
1332 | mAgenda->finishUpdate(); | 1340 | mAgenda->finishUpdate(); |
1333 | mAllDayAgenda->finishUpdate(); | 1341 | mAllDayAgenda->finishUpdate(); |
1334 | } | 1342 | } |
1335 | 1343 | ||
1336 | 1344 | ||
1337 | void KOAgendaView::clearView() | 1345 | void KOAgendaView::clearView() |
1338 | { | 1346 | { |
1339 | mAllDayAgenda->clear(); | 1347 | mAllDayAgenda->clear(); |
1340 | mAgenda->clear(); | 1348 | mAgenda->clear(); |
1341 | } | 1349 | } |
1342 | void KOAgendaView::clearList() | 1350 | void KOAgendaView::clearList() |
1343 | { | 1351 | { |
1344 | clearView(); | 1352 | clearView(); |
1345 | mAllDayAgenda->hideUnused(); | 1353 | mAllDayAgenda->hideUnused(); |
1346 | mAgenda->hideUnused(); | 1354 | mAgenda->hideUnused(); |
1347 | } | 1355 | } |
1348 | 1356 | ||
1349 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1357 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1350 | const QDate &td) | 1358 | const QDate &td) |
1351 | { | 1359 | { |
1352 | #ifndef KORG_NOPRINTER | 1360 | #ifndef KORG_NOPRINTER |
1353 | if (fd == td) | 1361 | if (fd == td) |
1354 | calPrinter->preview(CalPrinter::Day, fd, td); | 1362 | calPrinter->preview(CalPrinter::Day, fd, td); |
1355 | else | 1363 | else |
1356 | calPrinter->preview(CalPrinter::Week, fd, td); | 1364 | calPrinter->preview(CalPrinter::Week, fd, td); |
1357 | #endif | 1365 | #endif |
1358 | } | 1366 | } |
1359 | 1367 | ||
1360 | // void KOAgendaView::updateMovedTodo() | 1368 | // void KOAgendaView::updateMovedTodo() |
1361 | // { | 1369 | // { |
1362 | // // updateConfig(); | 1370 | // // updateConfig(); |
1363 | // // emit updateTodoViews(); | 1371 | // // emit updateTodoViews(); |
1364 | // } | 1372 | // } |
1365 | 1373 | ||
1366 | void KOAgendaView::slotShowDateView( int mode , int d ) | 1374 | void KOAgendaView::slotShowDateView( int mode , int d ) |
1367 | { | 1375 | { |
1368 | if ( d >= mSelectedDates.count() ) { | 1376 | if ( d >= mSelectedDates.count() ) { |
1369 | qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() ); | 1377 | qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() ); |
1370 | 1378 | ||
1371 | } else { | 1379 | } else { |
1372 | QDate day = mSelectedDates[d]; | 1380 | QDate day = mSelectedDates[d]; |
1373 | emit showDateView(mode , day ); | 1381 | emit showDateView(mode , day ); |
1374 | } | 1382 | } |
1375 | 1383 | ||
1376 | } | 1384 | } |
1377 | void KOAgendaView::newEvent(int gx, int gy) | 1385 | void KOAgendaView::newEvent(int gx, int gy) |
1378 | { | 1386 | { |
1379 | if (!mSelectedDates.count()) return; | 1387 | if (!mSelectedDates.count()) return; |
1380 | 1388 | ||
1381 | QDate day = mSelectedDates[gx]; | 1389 | QDate day = mSelectedDates[gx]; |
1382 | 1390 | ||
1383 | QTime time = mAgenda->gyToTime(gy); | 1391 | QTime time = mAgenda->gyToTime(gy); |
1384 | QDateTime dt(day,time); | 1392 | QDateTime dt(day,time); |
1385 | // if ( dt < QDateTime::currentDateTime () ) | 1393 | // if ( dt < QDateTime::currentDateTime () ) |
1386 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1394 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1387 | emit newEventSignal(dt); | 1395 | emit newEventSignal(dt); |
1388 | } | 1396 | } |
1389 | 1397 | ||
1390 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1398 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1391 | { | 1399 | { |
1392 | if (!mSelectedDates.count()) return; | 1400 | if (!mSelectedDates.count()) return; |
1393 | 1401 | ||
1394 | QDate dayStart = mSelectedDates[gxStart]; | 1402 | QDate dayStart = mSelectedDates[gxStart]; |
1395 | QDate dayEnd = mSelectedDates[gxEnd]; | 1403 | QDate dayEnd = mSelectedDates[gxEnd]; |
1396 | 1404 | ||
1397 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1405 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1398 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1406 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1399 | 1407 | ||
1400 | QDateTime dtStart(dayStart,timeStart); | 1408 | QDateTime dtStart(dayStart,timeStart); |
1401 | QDateTime dtEnd(dayEnd,timeEnd); | 1409 | QDateTime dtEnd(dayEnd,timeEnd); |
1402 | 1410 | ||
1403 | emit newEventSignal(dtStart,dtEnd); | 1411 | emit newEventSignal(dtStart,dtEnd); |
1404 | } | 1412 | } |
1405 | 1413 | ||
1406 | void KOAgendaView::newEventAllDay(int gx, int ) | 1414 | void KOAgendaView::newEventAllDay(int gx, int ) |
1407 | { | 1415 | { |
1408 | if (!mSelectedDates.count()) return; | 1416 | if (!mSelectedDates.count()) return; |
1409 | 1417 | ||
1410 | QDate day = mSelectedDates[gx]; | 1418 | QDate day = mSelectedDates[gx]; |
1411 | 1419 | ||
1412 | emit newEventSignal(day); | 1420 | emit newEventSignal(day); |
1413 | } | 1421 | } |
1414 | void KOAgendaView::newTodoAllDay(int gx, int ) | 1422 | void KOAgendaView::newTodoAllDay(int gx, int ) |
1415 | { | 1423 | { |
1416 | if (!mSelectedDates.count()) return; | 1424 | if (!mSelectedDates.count()) return; |
1417 | 1425 | ||
1418 | QDateTime day (mSelectedDates[gx] ); | 1426 | QDateTime day (mSelectedDates[gx] ); |
1419 | emit newTodoSignal(day, true); | 1427 | emit newTodoSignal(day, true); |
1420 | } | 1428 | } |
1421 | void KOAgendaView::newTodo(int gx, int gy ) | 1429 | void KOAgendaView::newTodo(int gx, int gy ) |
1422 | { | 1430 | { |
1423 | if (!mSelectedDates.count()) return; | 1431 | if (!mSelectedDates.count()) return; |
1424 | QDate dayStart = mSelectedDates[gx]; | 1432 | QDate dayStart = mSelectedDates[gx]; |
1425 | QTime timeStart = mAgenda->gyToTime(gy); | 1433 | QTime timeStart = mAgenda->gyToTime(gy); |
1426 | QDateTime dt (dayStart,timeStart); | 1434 | QDateTime dt (dayStart,timeStart); |
1427 | emit newTodoSignal( dt, false ); | 1435 | emit newTodoSignal( dt, false ); |
1428 | } | 1436 | } |
1429 | 1437 | ||
1430 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1438 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1431 | { | 1439 | { |
1432 | uint i; | 1440 | uint i; |
1433 | for(i=0;i<mMinY.size();++i) { | 1441 | for(i=0;i<mMinY.size();++i) { |
1434 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1442 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1435 | else mEventIndicatorTop->enableColumn(i,false); | 1443 | else mEventIndicatorTop->enableColumn(i,false); |
1436 | } | 1444 | } |
1437 | 1445 | ||
1438 | mEventIndicatorTop->update(); | 1446 | mEventIndicatorTop->update(); |
1439 | } | 1447 | } |
1440 | 1448 | ||
1441 | void KOAgendaView::updateEventIndicatorBottom(int newY) | 1449 | void KOAgendaView::updateEventIndicatorBottom(int newY) |
1442 | { | 1450 | { |
1443 | uint i; | 1451 | uint i; |
1444 | for(i=0;i<mMaxY.size();++i) { | 1452 | for(i=0;i<mMaxY.size();++i) { |
1445 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); | 1453 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); |
1446 | else mEventIndicatorBottom->enableColumn(i,false); | 1454 | else mEventIndicatorBottom->enableColumn(i,false); |
1447 | } | 1455 | } |
1448 | 1456 | ||
1449 | mEventIndicatorBottom->update(); | 1457 | mEventIndicatorBottom->update(); |
1450 | } | 1458 | } |
1451 | 1459 | ||
1452 | void KOAgendaView::startDrag(Event *event) | 1460 | void KOAgendaView::startDrag(Event *event) |
1453 | { | 1461 | { |
1454 | #ifndef KORG_NODND | 1462 | #ifndef KORG_NODND |
1455 | DndFactory factory( calendar() ); | 1463 | DndFactory factory( calendar() ); |
1456 | ICalDrag *vd = factory.createDrag(event,this); | 1464 | ICalDrag *vd = factory.createDrag(event,this); |
1457 | if (vd->drag()) { | 1465 | if (vd->drag()) { |
1458 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; | 1466 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; |
1459 | } | 1467 | } |
1460 | #endif | 1468 | #endif |
1461 | } | 1469 | } |
1462 | 1470 | ||
1463 | void KOAgendaView::readSettings() | 1471 | void KOAgendaView::readSettings() |
1464 | { | 1472 | { |
1465 | readSettings(KOGlobals::config()); | 1473 | readSettings(KOGlobals::config()); |
1466 | } | 1474 | } |
1467 | 1475 | ||
1468 | void KOAgendaView::readSettings(KConfig *config) | 1476 | void KOAgendaView::readSettings(KConfig *config) |
1469 | { | 1477 | { |
1470 | // kdDebug() << "KOAgendaView::readSettings()" << endl; | 1478 | // kdDebug() << "KOAgendaView::readSettings()" << endl; |
1471 | 1479 | ||
1472 | config->setGroup("Views"); | 1480 | config->setGroup("Views"); |
1473 | 1481 | ||
1474 | //#ifndef KORG_NOSPLITTER | 1482 | //#ifndef KORG_NOSPLITTER |
1475 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); | 1483 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); |
1476 | if (sizes.count() == 2) { | 1484 | if (sizes.count() == 2) { |
1477 | if ( sizes[0] < 20 ) { | 1485 | if ( sizes[0] < 20 ) { |
1478 | sizes[1] = sizes[1] +20 - sizes[0]; | 1486 | sizes[1] = sizes[1] +20 - sizes[0]; |
1479 | sizes[0] = 20; | 1487 | sizes[0] = 20; |
1480 | } | 1488 | } |
1481 | mSplitterAgenda->setSizes(sizes); | 1489 | mSplitterAgenda->setSizes(sizes); |
1482 | // qDebug("read %d %d ",sizes[0],sizes[1] ); | 1490 | // qDebug("read %d %d ",sizes[0],sizes[1] ); |
1483 | } | 1491 | } |
1484 | //#endif | 1492 | //#endif |
1485 | 1493 | ||
1486 | // updateConfig(); | 1494 | // updateConfig(); |
1487 | } | 1495 | } |
1488 | 1496 | ||
1489 | void KOAgendaView::writeSettings(KConfig *config) | 1497 | void KOAgendaView::writeSettings(KConfig *config) |
1490 | { | 1498 | { |
1491 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; | 1499 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; |
1492 | 1500 | ||
1493 | config->setGroup("Views"); | 1501 | config->setGroup("Views"); |
1494 | 1502 | ||
1495 | //#ifndef KORG_NOSPLITTER | 1503 | //#ifndef KORG_NOSPLITTER |
1496 | QValueList<int> list = mSplitterAgenda->sizes(); | 1504 | QValueList<int> list = mSplitterAgenda->sizes(); |
1497 | config->writeEntry("Separator AgendaView",list); | 1505 | config->writeEntry("Separator AgendaView",list); |
1498 | //qDebug("write %d %d ", list[0],list[1] ); | 1506 | //qDebug("write %d %d ", list[0],list[1] ); |
1499 | //#endif | 1507 | //#endif |
1500 | } | 1508 | } |
1501 | 1509 | ||
1502 | void KOAgendaView::setHolidayMasks() | 1510 | void KOAgendaView::setHolidayMasks() |
1503 | { | 1511 | { |
1504 | mHolidayMask.resize(mSelectedDates.count()); | 1512 | mHolidayMask.resize(mSelectedDates.count()); |
1505 | 1513 | ||
1506 | uint i; | 1514 | uint i; |
1507 | for(i=0;i<mSelectedDates.count();++i) { | 1515 | for(i=0;i<mSelectedDates.count();++i) { |
1508 | QDate date = mSelectedDates[i]; | 1516 | QDate date = mSelectedDates[i]; |
1509 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); | 1517 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); |
1510 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1518 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1511 | bool showHoliday = false; | 1519 | bool showHoliday = false; |
1512 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1520 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1513 | QPtrList<Event> events = calendar()->events( date, true ); | 1521 | QPtrList<Event> events = calendar()->events( date, true ); |
1514 | Event *event; | 1522 | Event *event; |
1515 | for( event = events.first(); event; event = events.next() ) { | 1523 | for( event = events.first(); event; event = events.next() ) { |
1516 | if ( event->isHoliday()) { | 1524 | if ( event->isHoliday()) { |
1517 | showHoliday = true; | 1525 | showHoliday = true; |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index effd7a3..4b7ef5b 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -22,276 +22,277 @@ | |||
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 <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qksplitter.h> | 31 | #include <qksplitter.h> |
32 | #else | 32 | #else |
33 | #include <qsplitter.h> | 33 | #include <qsplitter.h> |
34 | #endif | 34 | #endif |
35 | #include <qmemarray.h> | 35 | #include <qmemarray.h> |
36 | 36 | ||
37 | #include "koeventview.h" | 37 | #include "koeventview.h" |
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 | 48 | ||
49 | class KOAgendaButton : public QPushButton | 49 | class KOAgendaButton : public QPushButton |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | KOAgendaButton( QWidget *parent=0, const char *name=0 ) : | 53 | KOAgendaButton( QWidget *parent=0, const char *name=0 ) : |
54 | QPushButton( parent, name ) | 54 | QPushButton( parent, name ) |
55 | { | 55 | { |
56 | mNum = -3; | 56 | mNum = -3; |
57 | setFlat( true ); | 57 | setFlat( true ); |
58 | setFocusPolicy(NoFocus); | 58 | setFocusPolicy(NoFocus); |
59 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | 59 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); |
60 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); | 60 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); |
61 | }; | 61 | }; |
62 | 62 | ||
63 | QSize sizeHint () const { return QSize( 5,5) ;} | 63 | QSize sizeHint () const { return QSize( 5,5) ;} |
64 | void setNum( int n) { mNum = n; } | 64 | void setNum( int n) { mNum = n; } |
65 | private slots: | 65 | private slots: |
66 | void bClicked() {emit numClicked( mNum);} | 66 | void bClicked() {emit numClicked( mNum);} |
67 | signals: | 67 | signals: |
68 | void numClicked( int ); | 68 | void numClicked( int ); |
69 | private: | 69 | private: |
70 | int mNum; | 70 | int mNum; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | class TimeLabels : public QScrollView { | 73 | class TimeLabels : public QScrollView { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | public: | 75 | public: |
76 | 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); |
77 | 77 | ||
78 | void setCellHeight(int height); | 78 | void setCellHeight(int height); |
79 | 79 | ||
80 | /** Calculates the minimum width */ | 80 | /** Calculates the minimum width */ |
81 | virtual int minimumWidth() const; | 81 | virtual int minimumWidth() const; |
82 | 82 | ||
83 | /** updates widget's internal state */ | 83 | /** updates widget's internal state */ |
84 | void updateConfig(); | 84 | void updateConfig(); |
85 | 85 | ||
86 | /** */ | 86 | /** */ |
87 | void setAgenda(KOAgenda* agenda); | 87 | void setAgenda(KOAgenda* agenda); |
88 | 88 | ||
89 | /** */ | 89 | /** */ |
90 | virtual void paintEvent(QPaintEvent* e); | 90 | virtual void paintEvent(QPaintEvent* e); |
91 | void contentsMousePressEvent ( QMouseEvent * ) ; | 91 | void contentsMousePressEvent ( QMouseEvent * ) ; |
92 | void contentsMouseReleaseEvent ( QMouseEvent * ); | 92 | void contentsMouseReleaseEvent ( QMouseEvent * ); |
93 | void contentsMouseMoveEvent ( QMouseEvent * ); | 93 | void contentsMouseMoveEvent ( QMouseEvent * ); |
94 | 94 | ||
95 | public slots: | 95 | public slots: |
96 | /** update time label positions */ | 96 | /** update time label positions */ |
97 | void positionChanged(); | 97 | void positionChanged(); |
98 | signals: | 98 | signals: |
99 | void scaleChanged(); | 99 | void scaleChanged(); |
100 | protected: | 100 | protected: |
101 | 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); |
102 | 102 | ||
103 | private: | 103 | private: |
104 | QPixmap myPix; | 104 | QPixmap myPix; |
105 | bool mRedrawNeeded; | 105 | bool mRedrawNeeded; |
106 | int mMiniWidth; | 106 | int mMiniWidth; |
107 | int mMouseDownY; | 107 | int mMouseDownY; |
108 | QString mOrgCap; | 108 | QString mOrgCap; |
109 | int mRows; | 109 | int mRows; |
110 | int mCellHeight; | 110 | int mCellHeight; |
111 | 111 | ||
112 | /** */ | 112 | /** */ |
113 | KOAgenda* mAgenda; | 113 | KOAgenda* mAgenda; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | class EventIndicator : public QFrame { | 116 | class EventIndicator : public QFrame { |
117 | Q_OBJECT | 117 | Q_OBJECT |
118 | public: | 118 | public: |
119 | enum Location { Top, Bottom }; | 119 | enum Location { Top, Bottom }; |
120 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 120 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
121 | virtual ~EventIndicator(); | 121 | virtual ~EventIndicator(); |
122 | 122 | ||
123 | void changeColumns(int columns); | 123 | void changeColumns(int columns); |
124 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 124 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
125 | void setXOffset( int ); | 125 | void setXOffset( int ); |
126 | void enableColumn(int column, bool enable); | 126 | void enableColumn(int column, bool enable); |
127 | 127 | ||
128 | protected: | 128 | protected: |
129 | void drawContents(QPainter *); | 129 | void drawContents(QPainter *); |
130 | 130 | ||
131 | private: | 131 | private: |
132 | int mXOffset; | 132 | int mXOffset; |
133 | KDGanttMinimizeSplitter* mPaintWidget; | 133 | KDGanttMinimizeSplitter* mPaintWidget; |
134 | int mColumns; | 134 | int mColumns; |
135 | QHBox *mTopBox; | 135 | QHBox *mTopBox; |
136 | QBoxLayout *mTopLayout; | 136 | QBoxLayout *mTopLayout; |
137 | Location mLocation; | 137 | Location mLocation; |
138 | QPixmap mPixmap; | 138 | QPixmap mPixmap; |
139 | QMemArray<bool> mEnabled; | 139 | QMemArray<bool> mEnabled; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | KOAgendaView is the agenda-like view used to display events in an one or | 143 | KOAgendaView is the agenda-like view used to display events in an one or |
144 | multi-day view. | 144 | multi-day view. |
145 | */ | 145 | */ |
146 | class KOAgendaView : public KOEventView { | 146 | class KOAgendaView : public KOEventView { |
147 | Q_OBJECT | 147 | Q_OBJECT |
148 | public: | 148 | public: |
149 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 149 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
150 | virtual ~KOAgendaView(); | 150 | virtual ~KOAgendaView(); |
151 | void setStartHour( int ); | 151 | void setStartHour( int ); |
152 | void toggleAllDay(); | 152 | void toggleAllDay(); |
153 | 153 | ||
154 | 154 | ||
155 | /** Returns maximum number of days supported by the koagendaview */ | 155 | /** Returns maximum number of days supported by the koagendaview */ |
156 | virtual int maxDatesHint(); | 156 | virtual int maxDatesHint(); |
157 | 157 | ||
158 | /** Returns number of currently shown dates. */ | 158 | /** Returns number of currently shown dates. */ |
159 | virtual int currentDateCount(); | 159 | virtual int currentDateCount(); |
160 | 160 | ||
161 | /** returns the currently selected events */ | 161 | /** returns the currently selected events */ |
162 | virtual QPtrList<Incidence> selectedIncidences(); | 162 | virtual QPtrList<Incidence> selectedIncidences(); |
163 | 163 | ||
164 | /** returns the currently selected events */ | 164 | /** returns the currently selected events */ |
165 | virtual DateList selectedDates(); | 165 | virtual DateList selectedDates(); |
166 | 166 | ||
167 | /** Remove all events from view */ | 167 | /** Remove all events from view */ |
168 | void clearView(); | 168 | void clearView(); |
169 | void clearList(); | 169 | void clearList(); |
170 | KOAgenda *agenda() { return mAgenda;} | 170 | KOAgenda *agenda() { return mAgenda;} |
171 | virtual void printPreview(CalPrinter *calPrinter, | 171 | virtual void printPreview(CalPrinter *calPrinter, |
172 | const QDate &, const QDate &); | 172 | const QDate &, const QDate &); |
173 | 173 | ||
174 | /** start-datetime of selection */ | 174 | /** start-datetime of selection */ |
175 | QDateTime selectionStart() {return mTimeSpanBegin;} | 175 | QDateTime selectionStart() {return mTimeSpanBegin;} |
176 | /** end-datetime of selection */ | 176 | /** end-datetime of selection */ |
177 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 177 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
178 | /** returns true if selection is for whole day */ | 178 | /** returns true if selection is for whole day */ |
179 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 179 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
180 | /** make selected start/end invalid */ | 180 | /** make selected start/end invalid */ |
181 | void deleteSelectedDateTime(); | 181 | void deleteSelectedDateTime(); |
182 | void repaintAgenda(); | 182 | void repaintAgenda(); |
183 | public slots: | 183 | public slots: |
184 | void setInitStartHour(); | 184 | void setInitStartHour(); |
185 | virtual void updateView(); | 185 | virtual void updateView(); |
186 | virtual void updateConfig(); | 186 | virtual void updateConfig(); |
187 | virtual void showDates(const QDate &start, const QDate &end); | 187 | virtual void showDates(const QDate &start, const QDate &end); |
188 | virtual void showEvents(QPtrList<Event> eventList); | 188 | virtual void showEvents(QPtrList<Event> eventList); |
189 | 189 | ||
190 | void updateTodo( Todo *, int ); | 190 | void updateTodo( Todo *, int ); |
191 | void changeEventDisplay(Event *, int); | 191 | void changeEventDisplay(Event *, int); |
192 | 192 | ||
193 | void clearSelection(); | 193 | void clearSelection(); |
194 | 194 | ||
195 | void newTodo(int gx,int gy); | 195 | void newTodo(int gx,int gy); |
196 | void newEvent(int gx,int gy); | 196 | void newEvent(int gx,int gy); |
197 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 197 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
198 | void newEventAllDay(int gx, int gy); | 198 | void newEventAllDay(int gx, int gy); |
199 | void newTodoAllDay(int gx, int gy); | 199 | void newTodoAllDay(int gx, int gy); |
200 | 200 | ||
201 | void startDrag(Event *); | 201 | void startDrag(Event *); |
202 | 202 | ||
203 | void readSettings(); | 203 | void readSettings(); |
204 | void readSettings(KConfig *); | 204 | void readSettings(KConfig *); |
205 | void writeSettings(KConfig *); | 205 | void writeSettings(KConfig *); |
206 | 206 | ||
207 | void setContentsPos(int y); | 207 | void setContentsPos(int y); |
208 | 208 | ||
209 | void scrollOneHourUp(); | 209 | void scrollOneHourUp(); |
210 | void scrollOneHourDown(); | 210 | void scrollOneHourDown(); |
211 | void addToCalSlot(Incidence *, Incidence *); | 211 | void addToCalSlot(Incidence *, Incidence *); |
212 | void slotShowDateView( int, int ); | 212 | void slotShowDateView( int, int ); |
213 | void fillAgenda(); | 213 | void fillAgenda(); |
214 | void startIdleTimeout(); | ||
214 | 215 | ||
215 | signals: | 216 | signals: |
216 | void showDateView( int, QDate ); | 217 | void showDateView( int, QDate ); |
217 | void newTodoSignal( QDateTime ,bool ); | 218 | void newTodoSignal( QDateTime ,bool ); |
218 | void toggleExpand(); | 219 | void toggleExpand(); |
219 | void selectWeekNum( int ); | 220 | void selectWeekNum( int ); |
220 | void todoMoved( Todo *, int ); | 221 | void todoMoved( Todo *, int ); |
221 | void incidenceChanged(Incidence * , int ); | 222 | void incidenceChanged(Incidence * , int ); |
222 | // void cloneIncidenceSignal(Incidence *); | 223 | // void cloneIncidenceSignal(Incidence *); |
223 | 224 | ||
224 | protected: | 225 | protected: |
225 | KOAgendaButton* getNewDaylabel(); | 226 | KOAgendaButton* getNewDaylabel(); |
226 | bool mBlockUpdating; | 227 | bool mBlockUpdating; |
227 | int mUpcomingWidth; | 228 | int mUpcomingWidth; |
228 | /** Fill agenda beginning with date startDate */ | 229 | /** Fill agenda beginning with date startDate */ |
229 | void fillAgenda(const QDate &startDate); | 230 | void fillAgenda(const QDate &startDate); |
230 | void resizeEvent( QResizeEvent* e ); | 231 | void resizeEvent( QResizeEvent* e ); |
231 | /** Fill agenda using the current set value for the start date */ | 232 | /** Fill agenda using the current set value for the start date */ |
232 | 233 | ||
233 | /** Create labels for the selected dates. */ | 234 | /** Create labels for the selected dates. */ |
234 | void createDayLabels(); | 235 | void createDayLabels(); |
235 | 236 | ||
236 | /** | 237 | /** |
237 | Set the masks on the agenda widgets indicating, which days are holidays. | 238 | Set the masks on the agenda widgets indicating, which days are holidays. |
238 | */ | 239 | */ |
239 | void setHolidayMasks(); | 240 | void setHolidayMasks(); |
240 | 241 | ||
241 | protected slots: | 242 | protected slots: |
242 | void slotIdleTimeout(); | 243 | void slotIdleTimeout(); |
243 | void categoryChanged( Incidence * ); | 244 | void categoryChanged( Incidence * ); |
244 | void slotDaylabelClicked( int ); | 245 | void slotDaylabelClicked( int ); |
245 | /** Update event belonging to agenda item */ | 246 | /** Update event belonging to agenda item */ |
246 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 247 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
247 | //void updateMovedTodo(); | 248 | //void updateMovedTodo(); |
248 | 249 | ||
249 | void updateEventIndicatorTop(int newY); | 250 | void updateEventIndicatorTop(int newY); |
250 | void updateEventIndicatorBottom(int newY); | 251 | void updateEventIndicatorBottom(int newY); |
251 | 252 | ||
252 | /** Updates data for selected timespan */ | 253 | /** Updates data for selected timespan */ |
253 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 254 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
254 | /** Updates data for selected timespan for all day event*/ | 255 | /** Updates data for selected timespan for all day event*/ |
255 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 256 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
256 | 257 | ||
257 | private: | 258 | private: |
258 | QTimer* mIdleTimer; | 259 | QTimer* mIdleTimer; |
259 | QDateTime mIdleStart; | 260 | QDateTime mIdleStart; |
260 | // view widgets | 261 | // view widgets |
261 | QFrame *mDayLabels; | 262 | QFrame *mDayLabels; |
262 | QHBox *mDayLabelsFrame; | 263 | QHBox *mDayLabelsFrame; |
263 | QBoxLayout *mLayoutDayLabels; | 264 | QBoxLayout *mLayoutDayLabels; |
264 | QFrame *mAllDayFrame; | 265 | QFrame *mAllDayFrame; |
265 | KOAgenda *mAllDayAgenda; | 266 | KOAgenda *mAllDayAgenda; |
266 | KOAgenda *mAgenda; | 267 | KOAgenda *mAgenda; |
267 | TimeLabels *mTimeLabels; | 268 | TimeLabels *mTimeLabels; |
268 | QWidget *mDummyAllDayLeft; | 269 | QWidget *mDummyAllDayLeft; |
269 | 270 | ||
270 | KDGanttMinimizeSplitter* mSplitterAgenda; | 271 | KDGanttMinimizeSplitter* mSplitterAgenda; |
271 | QPushButton *mExpandButton; | 272 | QPushButton *mExpandButton; |
272 | 273 | ||
273 | DateList mSelectedDates; // List of dates to be displayed | 274 | DateList mSelectedDates; // List of dates to be displayed |
274 | int mViewType; | 275 | int mViewType; |
275 | 276 | ||
276 | bool mWeekStartsMonday; | 277 | bool mWeekStartsMonday; |
277 | int mStartHour; | 278 | int mStartHour; |
278 | 279 | ||
279 | KOEventPopupMenu *mAllAgendaPopup; | 280 | KOEventPopupMenu *mAllAgendaPopup; |
280 | //KOEventPopupMenu *mAllDayAgendaPopup; | 281 | //KOEventPopupMenu *mAllDayAgendaPopup; |
281 | 282 | ||
282 | EventIndicator *mEventIndicatorTop; | 283 | EventIndicator *mEventIndicatorTop; |
283 | EventIndicator *mEventIndicatorBottom; | 284 | EventIndicator *mEventIndicatorBottom; |
284 | 285 | ||
285 | QMemArray<int> mMinY; | 286 | QMemArray<int> mMinY; |
286 | QMemArray<int> mMaxY; | 287 | QMemArray<int> mMaxY; |
287 | 288 | ||
288 | QMemArray<bool> mHolidayMask; | 289 | QMemArray<bool> mHolidayMask; |
289 | 290 | ||
290 | QPtrList<KOAgendaButton> mDayLabelsList; | 291 | QPtrList<KOAgendaButton> mDayLabelsList; |
291 | QDateTime mTimeSpanBegin; | 292 | QDateTime mTimeSpanBegin; |
292 | QDateTime mTimeSpanEnd; | 293 | QDateTime mTimeSpanEnd; |
293 | bool mTimeSpanInAllDay; | 294 | bool mTimeSpanInAllDay; |
294 | void keyPressEvent ( QKeyEvent * e ); | 295 | void keyPressEvent ( QKeyEvent * e ); |
295 | }; | 296 | }; |
296 | 297 | ||
297 | #endif // KOAGENDAVIEW_H | 298 | #endif // KOAGENDAVIEW_H |