author | umopapisdn <umopapisdn> | 2003-03-28 12:06:00 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-28 12:06:00 (UTC) |
commit | 8e8803488d2c11b12449e785802da4a5a9adad0f (patch) (unidiff) | |
tree | 2c7b5ae7e1d6151a3ee89e755f5afb649c1c653c | |
parent | 6cee1b34ffc7b3b8a0c8e1831fff0cc1af0e708a (diff) | |
download | opie-8e8803488d2c11b12449e785802da4a5a9adad0f.zip opie-8e8803488d2c11b12449e785802da4a5a9adad0f.tar.gz opie-8e8803488d2c11b12449e785802da4a5a9adad0f.tar.bz2 |
Minimum size in weekview should be dependant on the height of the window.
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index 874cf24..8241655 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -165,78 +165,76 @@ void DateBookWeekView::slotChangeClock( bool c ) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | static inline int db_round30min( int m ) | 167 | static inline int db_round30min( int m ) |
168 | { | 168 | { |
169 | if ( m < 15 ) | 169 | if ( m < 15 ) |
170 | m = 0; | 170 | m = 0; |
171 | else if ( m < 45 ) | 171 | else if ( m < 45 ) |
172 | m = 1; | 172 | m = 1; |
173 | else | 173 | else |
174 | m = 2; | 174 | m = 2; |
175 | 175 | ||
176 | return m; | 176 | return m; |
177 | } | 177 | } |
178 | 178 | ||
179 | void DateBookWeekView::alterDay( int day ) | 179 | void DateBookWeekView::alterDay( int day ) |
180 | { | 180 | { |
181 | if ( !bOnMonday ) { | 181 | if ( !bOnMonday ) { |
182 | day--; | 182 | day--; |
183 | } | 183 | } |
184 | emit showDay( day ); | 184 | emit showDay( day ); |
185 | } | 185 | } |
186 | 186 | ||
187 | void DateBookWeekView::positionItem( DateBookWeekItem *i ) | 187 | void DateBookWeekView::positionItem( DateBookWeekItem *i ) |
188 | { | 188 | { |
189 | const int Width = 8; | 189 | const int Width = 8; |
190 | const EffectiveEvent ev = i->event(); | 190 | const EffectiveEvent ev = i->event(); |
191 | 191 | ||
192 | // 30 minute intervals | 192 | // 30 minute intervals |
193 | int y = ev.start().hour() * 2; | 193 | int y = ev.start().hour() * 2; |
194 | y += db_round30min( ev.start().minute() ); | 194 | y += db_round30min( ev.start().minute() ); |
195 | int y2 = ev.end().hour() * 2; | 195 | int y2 = ev.end().hour() * 2; |
196 | y2 += db_round30min( ev.end().minute() ); | 196 | y2 += db_round30min( ev.end().minute() ); |
197 | if ( y > 47 ) | 197 | if ( y > 47 ) y = 47; |
198 | y = 47; | 198 | if ( y2 > 48 ) y2 = 48; |
199 | if ( y2 > 48 ) | 199 | y = (y * rowHeight) / 2; |
200 | y2 = 48; | 200 | y2 = (y2 * rowHeight) / 2; |
201 | y = y * rowHeight / 2; | ||
202 | y2 = y2 * rowHeight / 2; | ||
203 | 201 | ||
204 | int h; | 202 | int h; |
205 | if ( ev.event().type() == Event::AllDay ) { | 203 | if ( ev.event().type() == Event::AllDay ) { |
206 | h = 48 * rowHeight / 2; | 204 | h = (48 * rowHeight) / 2; |
207 | y = 0; | 205 | y = 0; |
208 | } else { | 206 | } else { |
209 | h=y2-y; | 207 | h=y2-y; |
210 | if ( h < 1 ) h = 1; | 208 | if ( h < (1*rowHeight)/2 ) h = (1*rowHeight)/2; |
211 | } | 209 | } |
212 | 210 | ||
213 | int dow = ev.date().dayOfWeek(); | 211 | int dow = ev.date().dayOfWeek(); |
214 | if ( !bOnMonday ) { | 212 | if ( !bOnMonday ) { |
215 | if ( dow == 7 ) | 213 | if ( dow == 7 ) |
216 | dow = 1; | 214 | dow = 1; |
217 | else | 215 | else |
218 | dow++; | 216 | dow++; |
219 | } | 217 | } |
220 | int x = header->sectionPos( dow ) - 1; | 218 | int x = header->sectionPos( dow ) - 1; |
221 | int xlim = header->sectionPos( dow ) + header->sectionSize( dow ); | 219 | int xlim = header->sectionPos( dow ) + header->sectionSize( dow ); |
222 | DateBookWeekItem *isect = 0; | 220 | DateBookWeekItem *isect = 0; |
223 | do { | 221 | do { |
224 | i->setGeometry( x, y, Width, h ); | 222 | i->setGeometry( x, y, Width, h ); |
225 | isect = intersects( i ); | 223 | isect = intersects( i ); |
226 | x += Width - 1; | 224 | x += Width - 1; |
227 | } while ( isect && x < xlim ); | 225 | } while ( isect && x < xlim ); |
228 | } | 226 | } |
229 | 227 | ||
230 | DateBookWeekItem *DateBookWeekView::intersects( const DateBookWeekItem *item ) | 228 | DateBookWeekItem *DateBookWeekView::intersects( const DateBookWeekItem *item ) |
231 | { | 229 | { |
232 | QRect geom = item->geometry(); | 230 | QRect geom = item->geometry(); |
233 | 231 | ||
234 | // We allow the edges to overlap | 232 | // We allow the edges to overlap |
235 | geom.moveBy( 1, 1 ); | 233 | geom.moveBy( 1, 1 ); |
236 | geom.setSize( geom.size()-QSize(2,2) ); | 234 | geom.setSize( geom.size()-QSize(2,2) ); |
237 | 235 | ||
238 | QListIterator<DateBookWeekItem> it(items); | 236 | QListIterator<DateBookWeekItem> it(items); |
239 | for ( ; it.current(); ++it ) { | 237 | for ( ; it.current(); ++it ) { |
240 | DateBookWeekItem *i = it.current(); | 238 | DateBookWeekItem *i = it.current(); |
241 | if ( i != item ) { | 239 | if ( i != item ) { |
242 | if ( i->geometry().intersects( geom ) ) { | 240 | if ( i->geometry().intersects( geom ) ) { |