author | zautrix <zautrix> | 2005-03-19 12:41:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-19 12:41:09 (UTC) |
commit | 0aa5a7dce6ac1224395f7cb3fae488ba566f0e38 (patch) (unidiff) | |
tree | b0950df228b2d9d2486977f7906ce4f0d9284cba | |
parent | ea9e00a1f70e9c3c855707213b51c6b6d43c330c (diff) | |
download | kdepimpi-0aa5a7dce6ac1224395f7cb3fae488ba566f0e38.zip kdepimpi-0aa5a7dce6ac1224395f7cb3fae488ba566f0e38.tar.gz kdepimpi-0aa5a7dce6ac1224395f7cb3fae488ba566f0e38.tar.bz2 |
agenda fixes
-rw-r--r-- | korganizer/koagendaview.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index d7ea4d4..e029fdb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -258,50 +258,47 @@ void TimeLabels::paintEvent(QPaintEvent*) | |||
258 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 258 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
259 | : QFrame(parent,name) | 259 | : QFrame(parent,name) |
260 | { | 260 | { |
261 | mColumns = 1; | 261 | mColumns = 1; |
262 | mTopBox = 0; | 262 | mTopBox = 0; |
263 | mLocation = loc; | 263 | mLocation = loc; |
264 | mTopLayout = 0; | 264 | mTopLayout = 0; |
265 | mPaintWidget = 0; | 265 | mPaintWidget = 0; |
266 | mXOffset = 0; | 266 | mXOffset = 0; |
267 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 267 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
268 | else mPixmap = SmallIcon("1downarrow"); | 268 | else mPixmap = SmallIcon("1downarrow"); |
269 | mEnabled.resize(mColumns); | 269 | mEnabled.resize(mColumns); |
270 | if (mLocation == Top) | 270 | setMinimumHeight(mPixmap.height()); |
271 | setMaximumHeight(0); | ||
272 | else | ||
273 | setMinimumHeight(mPixmap.height()); | ||
274 | } | 271 | } |
275 | 272 | ||
276 | EventIndicator::~EventIndicator() | 273 | EventIndicator::~EventIndicator() |
277 | { | 274 | { |
278 | } | 275 | } |
279 | 276 | ||
280 | void EventIndicator::drawContents(QPainter *p) | 277 | void EventIndicator::drawContents(QPainter *p) |
281 | { | 278 | { |
282 | 279 | ||
283 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 280 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
284 | KDGanttSplitterHandle* han = 0; | 281 | KDGanttSplitterHandle* han = 0; |
285 | if ( mPaintWidget ) | 282 | if ( mPaintWidget ) |
286 | han = mPaintWidget->firstHandle(); | 283 | han = mPaintWidget->firstHandle(); |
287 | if ( ! han ) { | 284 | if ( ! han ) { |
288 | int i; | 285 | int i; |
289 | for(i=0;i<mColumns;++i) { | 286 | for(i=0;i<mColumns;++i) { |
290 | if (mEnabled[i]) { | 287 | if (mEnabled[i]) { |
291 | int cellWidth = contentsRect().right()/mColumns; | 288 | int cellWidth = contentsRect().right()/mColumns; |
292 | int xOffset = KOGlobals::self()->reverseLayout() ? | 289 | int xOffset = KOGlobals::self()->reverseLayout() ? |
293 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 290 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : |
294 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 291 | i*cellWidth + (cellWidth -mPixmap.width()) /2; |
295 | p->drawPixmap(QPoint(xOffset,0),mPixmap); | 292 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); |
296 | } | 293 | } |
297 | } | 294 | } |
298 | } else { | 295 | } else { |
299 | han->repaint(); | 296 | han->repaint(); |
300 | //mPaintWidget->setBackgroundColor( red ); | 297 | //mPaintWidget->setBackgroundColor( red ); |
301 | 298 | ||
302 | QPainter pa( han ); | 299 | QPainter pa( han ); |
303 | int i; | 300 | int i; |
304 | bool setColor = false; | 301 | bool setColor = false; |
305 | for(i=0;i<mColumns;++i) { | 302 | for(i=0;i<mColumns;++i) { |
306 | if (mEnabled[i]) { | 303 | if (mEnabled[i]) { |
307 | setColor = true; | 304 | setColor = true; |
@@ -319,24 +316,26 @@ void EventIndicator::drawContents(QPainter *p) | |||
319 | pa.end(); | 316 | pa.end(); |
320 | 317 | ||
321 | } | 318 | } |
322 | } | 319 | } |
323 | 320 | ||
324 | void EventIndicator::setXOffset( int x ) | 321 | void EventIndicator::setXOffset( int x ) |
325 | { | 322 | { |
326 | mXOffset = x; | 323 | mXOffset = x; |
327 | } | 324 | } |
328 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 325 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
329 | { | 326 | { |
330 | mPaintWidget = w; | 327 | mPaintWidget = w; |
328 | setMaximumHeight(0); | ||
329 | setMinimumHeight(0); | ||
331 | } | 330 | } |
332 | void EventIndicator::changeColumns(int columns) | 331 | void EventIndicator::changeColumns(int columns) |
333 | { | 332 | { |
334 | mColumns = columns; | 333 | mColumns = columns; |
335 | mEnabled.resize(mColumns); | 334 | mEnabled.resize(mColumns); |
336 | 335 | ||
337 | update(); | 336 | update(); |
338 | } | 337 | } |
339 | 338 | ||
340 | void EventIndicator::enableColumn(int column, bool enable) | 339 | void EventIndicator::enableColumn(int column, bool enable) |
341 | { | 340 | { |
342 | mEnabled[column] = enable; | 341 | mEnabled[column] = enable; |
@@ -401,37 +400,40 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
401 | 400 | ||
402 | // Create event context menu for all day agenda | 401 | // Create event context menu for all day agenda |
403 | mAllDayAgendaPopup = eventPopup(); | 402 | mAllDayAgendaPopup = eventPopup(); |
404 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 403 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
405 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 404 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
406 | 405 | ||
407 | // Create agenda frame | 406 | // Create agenda frame |
408 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 407 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
409 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 408 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
410 | 409 | ||
411 | // create event indicator bars | 410 | // create event indicator bars |
412 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 411 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
413 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 412 | #ifndef DESKTOP_VERSION |
414 | 413 | // FIX | |
414 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | ||
415 | #endif | ||
415 | mDayLabelsFrame = new QHBox(agendaFrame); | 416 | mDayLabelsFrame = new QHBox(agendaFrame); |
416 | //topLayout->addWidget(mDayLabelsFrame); | 417 | //topLayout->addWidget(mDayLabelsFrame); |
417 | mDayLabels = new QFrame (mDayLabelsFrame); | 418 | mDayLabels = new QFrame (mDayLabelsFrame); |
418 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 419 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
419 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,1,1,0,2); | 420 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
420 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 421 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
422 | |||
421 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 423 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
422 | agendaFrame); | 424 | agendaFrame); |
423 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 425 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
424 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 426 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
425 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 427 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
426 | 428 | ||
427 | // Create time labels | 429 | // Create time labels |
428 | mTimeLabels = new TimeLabels(24,agendaFrame); | 430 | mTimeLabels = new TimeLabels(24,agendaFrame); |
429 | agendaLayout->addWidget(mTimeLabels,2,0); | 431 | agendaLayout->addWidget(mTimeLabels,2,0); |
430 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 432 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
431 | this,SLOT(updateConfig())); | 433 | this,SLOT(updateConfig())); |
432 | 434 | ||
433 | // Create agenda | 435 | // Create agenda |
434 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 436 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
435 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 437 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
436 | agendaLayout->setColStretch(1,1); | 438 | agendaLayout->setColStretch(1,1); |
437 | mAgenda->setFocusPolicy(NoFocus); | 439 | mAgenda->setFocusPolicy(NoFocus); |