-rw-r--r-- | korganizer/koagendaview.cpp | 28 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 8 |
4 files changed, 14 insertions, 29 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8001c8f..acf43bd 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -242,288 +242,287 @@ void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | |||
242 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 242 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
243 | if ( tSize < 4 ) | 243 | if ( tSize < 4 ) |
244 | tSize = 4; | 244 | tSize = 4; |
245 | if ( tSize > 22 ) | 245 | if ( tSize > 22 ) |
246 | tSize = 22; | 246 | tSize = 22; |
247 | tSize = (tSize/2)*2; | 247 | tSize = (tSize/2)*2; |
248 | if ( tSize == KOPrefs::instance()->mHourSize ) | 248 | if ( tSize == KOPrefs::instance()->mHourSize ) |
249 | return; | 249 | return; |
250 | KOPrefs::instance()->mHourSize = tSize; | 250 | KOPrefs::instance()->mHourSize = tSize; |
251 | emit scaleChanged(); | 251 | emit scaleChanged(); |
252 | } | 252 | } |
253 | 253 | ||
254 | /** This is called in response to repaint() */ | 254 | /** This is called in response to repaint() */ |
255 | void TimeLabels::paintEvent(QPaintEvent*) | 255 | void TimeLabels::paintEvent(QPaintEvent*) |
256 | { | 256 | { |
257 | 257 | ||
258 | // kdDebug() << "paintevent..." << endl; | 258 | // kdDebug() << "paintevent..." << endl; |
259 | // this is another hack! | 259 | // this is another hack! |
260 | // QPainter painter(this); | 260 | // QPainter painter(this); |
261 | //QString c | 261 | //QString c |
262 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 262 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
263 | } | 263 | } |
264 | 264 | ||
265 | //////////////////////////////////////////////////////////////////////////// | 265 | //////////////////////////////////////////////////////////////////////////// |
266 | 266 | ||
267 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 267 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
268 | : QFrame(parent,name) | 268 | : QFrame(parent,name) |
269 | { | 269 | { |
270 | mColumns = 1; | 270 | mColumns = 1; |
271 | mTopBox = 0; | 271 | mTopBox = 0; |
272 | mLocation = loc; | 272 | mLocation = loc; |
273 | mTopLayout = 0; | 273 | mTopLayout = 0; |
274 | mPaintWidget = 0; | 274 | mPaintWidget = 0; |
275 | mXOffset = 0; | 275 | mXOffset = 0; |
276 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 276 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
277 | else mPixmap = SmallIcon("1downarrow"); | 277 | else mPixmap = SmallIcon("1downarrow"); |
278 | mEnabled.resize(mColumns); | 278 | mEnabled.resize(mColumns); |
279 | mEnabled.fill( false ); | 279 | mEnabled.fill( false ); |
280 | setMinimumHeight(mPixmap.height()); | 280 | setMinimumHeight(mPixmap.height()); |
281 | } | 281 | } |
282 | 282 | ||
283 | EventIndicator::~EventIndicator() | 283 | EventIndicator::~EventIndicator() |
284 | { | 284 | { |
285 | } | 285 | } |
286 | 286 | ||
287 | void EventIndicator::drawContents(QPainter *p) | 287 | void EventIndicator::drawContents(QPainter *p) |
288 | { | 288 | { |
289 | 289 | ||
290 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 290 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
291 | KDGanttSplitterHandle* han = 0; | 291 | KDGanttSplitterHandle* han = 0; |
292 | if ( mPaintWidget ) | 292 | if ( mPaintWidget ) |
293 | han = mPaintWidget->firstHandle(); | 293 | han = mPaintWidget->firstHandle(); |
294 | if ( ! han ) { | 294 | if ( ! han ) { |
295 | int i; | 295 | int i; |
296 | for(i=0;i<mColumns;++i) { | 296 | for(i=0;i<mColumns;++i) { |
297 | if (mEnabled[i]) { | 297 | if (mEnabled[i]) { |
298 | int cellWidth = contentsRect().right()/mColumns; | 298 | int cellWidth = contentsRect().right()/mColumns; |
299 | int xOffset = KOGlobals::self()->reverseLayout() ? | 299 | int xOffset = KOGlobals::self()->reverseLayout() ? |
300 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : | 300 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : |
301 | i*cellWidth + (cellWidth -mPixmap.width()) /2; | 301 | i*cellWidth + (cellWidth -mPixmap.width()) /2; |
302 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); | 302 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | } else { | 305 | } else { |
306 | han->repaint(); | 306 | han->repaint(); |
307 | //mPaintWidget->setBackgroundColor( red ); | 307 | //mPaintWidget->setBackgroundColor( red ); |
308 | 308 | ||
309 | QPainter pa( han ); | 309 | QPainter pa( han ); |
310 | int i; | 310 | int i; |
311 | bool setColor = false; | 311 | bool setColor = false; |
312 | for(i=0;i<mColumns;++i) { | 312 | for(i=0;i<mColumns;++i) { |
313 | if (mEnabled[i]) { | 313 | if (mEnabled[i]) { |
314 | setColor = true; | 314 | setColor = true; |
315 | 315 | ||
316 | int cellWidth = contentsRect().right()/mColumns; | 316 | int cellWidth = contentsRect().right()/mColumns; |
317 | int xOffset = KOGlobals::self()->reverseLayout() ? | 317 | int xOffset = KOGlobals::self()->reverseLayout() ? |
318 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 318 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
319 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 319 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
320 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 320 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
321 | //qDebug("222draw pix %d ",xOffset ); | 321 | //qDebug("222draw pix %d ",xOffset ); |
322 | 322 | ||
323 | } | 323 | } |
324 | 324 | ||
325 | } | 325 | } |
326 | pa.end(); | 326 | pa.end(); |
327 | 327 | ||
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | void EventIndicator::setXOffset( int x ) | 331 | void EventIndicator::setXOffset( int x ) |
332 | { | 332 | { |
333 | mXOffset = x; | 333 | mXOffset = x; |
334 | } | 334 | } |
335 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 335 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
336 | { | 336 | { |
337 | mPaintWidget = w; | 337 | mPaintWidget = w; |
338 | setMaximumHeight(0); | 338 | setMaximumHeight(0); |
339 | setMinimumHeight(0); | 339 | setMinimumHeight(0); |
340 | } | 340 | } |
341 | void EventIndicator::changeColumns(int columns) | 341 | void EventIndicator::changeColumns(int columns) |
342 | { | 342 | { |
343 | mColumns = columns; | 343 | mColumns = columns; |
344 | mEnabled.resize(mColumns); | 344 | mEnabled.resize(mColumns); |
345 | 345 | ||
346 | update(); | 346 | update(); |
347 | } | 347 | } |
348 | 348 | ||
349 | void EventIndicator::enableColumn(int column, bool enable) | 349 | void EventIndicator::enableColumn(int column, bool enable) |
350 | { | 350 | { |
351 | mEnabled[column] = enable; | 351 | mEnabled[column] = enable; |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | //////////////////////////////////////////////////////////////////////////// | 355 | //////////////////////////////////////////////////////////////////////////// |
356 | //////////////////////////////////////////////////////////////////////////// | 356 | //////////////////////////////////////////////////////////////////////////// |
357 | //////////////////////////////////////////////////////////////////////////// | 357 | //////////////////////////////////////////////////////////////////////////// |
358 | 358 | ||
359 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 359 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
360 | KOEventView (cal,parent,name) | 360 | KOEventView (cal,parent,name) |
361 | { | 361 | { |
362 | mBlockUpdating = true; | 362 | mBlockUpdating = true; |
363 | mStartHour = 8; | 363 | mStartHour = 8; |
364 | mSelectedDates.append(QDate::currentDate()); | 364 | mSelectedDates.append(QDate::currentDate()); |
365 | 365 | ||
366 | mLayoutDayLabels = 0; | 366 | mLayoutDayLabels = 0; |
367 | mDayLabelsFrame = 0; | 367 | mDayLabelsFrame = 0; |
368 | mDayLabels = 0; | 368 | mDayLabels = 0; |
369 | bool isRTL = KOGlobals::self()->reverseLayout(); | 369 | bool isRTL = KOGlobals::self()->reverseLayout(); |
370 | 370 | QPixmap expandPix; | |
371 | if ( KOPrefs::instance()->mVerticalScreen ) { | 371 | if ( KOPrefs::instance()->mVerticalScreen ) { |
372 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 372 | expandPix = SmallIcon( "1updownarrow" ); |
373 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | ||
374 | } else { | 373 | } else { |
375 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 374 | expandPix = SmallIcon("1leftrightarrow" ); |
376 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | ||
377 | } | 375 | } |
378 | 376 | ||
379 | QBoxLayout *topLayout = new QVBoxLayout(this); | 377 | QBoxLayout *topLayout = new QVBoxLayout(this); |
380 | 378 | ||
381 | // Create day name labels for agenda columns | 379 | // Create day name labels for agenda columns |
382 | // Create agenda splitter | 380 | // Create agenda splitter |
383 | 381 | ||
384 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 382 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
385 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 383 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
386 | topLayout->addWidget( mSplitterAgenda ); | 384 | topLayout->addWidget( mSplitterAgenda ); |
387 | mAllDayFrame = new QHBox(mSplitterAgenda); | 385 | mAllDayFrame = new QHBox(mSplitterAgenda); |
388 | mAllDayFrame->setFocusPolicy(NoFocus); | 386 | mAllDayFrame->setFocusPolicy(NoFocus); |
389 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 387 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
390 | agendaFrame->setFocusPolicy(NoFocus); | 388 | agendaFrame->setFocusPolicy(NoFocus); |
391 | 389 | ||
392 | // Create all-day agenda widget | 390 | // Create all-day agenda widget |
393 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 391 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
394 | 392 | ||
395 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 393 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
396 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 394 | mExpandButton->setPixmap( expandPix ); |
397 | int widebut = mExpandButton->sizeHint().width(); | 395 | int widebut = mExpandButton->sizeHint().width()+4; |
396 | int heibut = mExpandButton->sizeHint().height()+4; | ||
397 | if ( heibut > widebut ) | ||
398 | widebut = heibut ; | ||
398 | if ( QApplication::desktop()->width() < 480 ) | 399 | if ( QApplication::desktop()->width() < 480 ) |
399 | widebut = widebut*2; | 400 | widebut = widebut*3/2; |
400 | else | ||
401 | widebut = (widebut*3) / 2; | ||
402 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 401 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
403 | // QSizePolicy::Fixed ) ); | 402 | // QSizePolicy::Fixed ) ); |
404 | mExpandButton->setFixedSize( widebut, widebut); | 403 | mExpandButton->setFixedSize( widebut, widebut); |
405 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 404 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
406 | mExpandButton->setFocusPolicy(NoFocus); | 405 | mExpandButton->setFocusPolicy(NoFocus); |
407 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 406 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
408 | mAllDayAgenda->setFocusPolicy(NoFocus); | 407 | mAllDayAgenda->setFocusPolicy(NoFocus); |
409 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 408 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
410 | 409 | ||
411 | // Create event context menu for all day agenda | 410 | // Create event context menu for all day agenda |
412 | mAllDayAgendaPopup = eventPopup(); | 411 | mAllDayAgendaPopup = eventPopup(); |
413 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 412 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
414 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 413 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
415 | 414 | ||
416 | // Create agenda frame | 415 | // Create agenda frame |
417 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 416 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
418 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 417 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
419 | 418 | ||
420 | // create event indicator bars | 419 | // create event indicator bars |
421 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 420 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
422 | #ifndef DESKTOP_VERSION | 421 | #ifndef DESKTOP_VERSION |
423 | // FIX | 422 | // FIX |
424 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 423 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
425 | #endif | 424 | #endif |
426 | mDayLabelsFrame = new QHBox(agendaFrame); | 425 | mDayLabelsFrame = new QHBox(agendaFrame); |
427 | //topLayout->addWidget(mDayLabelsFrame); | 426 | //topLayout->addWidget(mDayLabelsFrame); |
428 | mDayLabels = new QFrame (mDayLabelsFrame); | 427 | mDayLabels = new QFrame (mDayLabelsFrame); |
429 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 428 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
430 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 429 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
431 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 430 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
432 | 431 | ||
433 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 432 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
434 | agendaFrame); | 433 | agendaFrame); |
435 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 434 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
436 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 435 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
437 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 436 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
438 | 437 | ||
439 | // Create time labels | 438 | // Create time labels |
440 | mTimeLabels = new TimeLabels(24,agendaFrame); | 439 | mTimeLabels = new TimeLabels(24,agendaFrame); |
441 | agendaLayout->addWidget(mTimeLabels,2,0); | 440 | agendaLayout->addWidget(mTimeLabels,2,0); |
442 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 441 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
443 | this,SLOT(updateConfig())); | 442 | this,SLOT(updateConfig())); |
444 | 443 | ||
445 | // Create agenda | 444 | // Create agenda |
446 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 445 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
447 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 446 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
448 | agendaLayout->setColStretch(1,1); | 447 | agendaLayout->setColStretch(1,1); |
449 | mAgenda->setFocusPolicy(NoFocus); | 448 | mAgenda->setFocusPolicy(NoFocus); |
450 | // Create event context menu for agenda | 449 | // Create event context menu for agenda |
451 | mAgendaPopup = eventPopup(); | 450 | mAgendaPopup = eventPopup(); |
452 | 451 | ||
453 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 452 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
454 | i18n("Toggle Alarm"),mAgenda, | 453 | i18n("Toggle Alarm"),mAgenda, |
455 | SLOT(popupAlarm()),true); | 454 | SLOT(popupAlarm()),true); |
456 | 455 | ||
457 | 456 | ||
458 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 457 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
459 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 458 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
460 | 459 | ||
461 | // make connections between dependent widgets | 460 | // make connections between dependent widgets |
462 | mTimeLabels->setAgenda(mAgenda); | 461 | mTimeLabels->setAgenda(mAgenda); |
463 | 462 | ||
464 | // Update widgets to reflect user preferences | 463 | // Update widgets to reflect user preferences |
465 | // updateConfig(); | 464 | // updateConfig(); |
466 | 465 | ||
467 | // createDayLabels(); | 466 | // createDayLabels(); |
468 | 467 | ||
469 | // these blank widgets make the All Day Event box line up with the agenda | 468 | // these blank widgets make the All Day Event box line up with the agenda |
470 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 469 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
471 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 470 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
472 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 471 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
473 | 472 | ||
474 | // Scrolling | 473 | // Scrolling |
475 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 474 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
476 | mTimeLabels, SLOT(positionChanged())); | 475 | mTimeLabels, SLOT(positionChanged())); |
477 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 476 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
478 | SLOT(setContentsPos(int))); | 477 | SLOT(setContentsPos(int))); |
479 | 478 | ||
480 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 479 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
481 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 480 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
482 | 481 | ||
483 | // Create/Show/Edit/Delete Event | 482 | // Create/Show/Edit/Delete Event |
484 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 483 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
485 | SLOT(newEvent(int,int))); | 484 | SLOT(newEvent(int,int))); |
486 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 485 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
487 | SLOT(newTodo(int,int))); | 486 | SLOT(newTodo(int,int))); |
488 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 487 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
489 | SLOT(newEvent(int,int,int,int))); | 488 | SLOT(newEvent(int,int,int,int))); |
490 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 489 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
491 | SLOT(newEventAllDay(int,int))); | 490 | SLOT(newEventAllDay(int,int))); |
492 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 491 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
493 | SLOT(newTodoAllDay(int,int))); | 492 | SLOT(newTodoAllDay(int,int))); |
494 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 493 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
495 | SLOT(newEventAllDay(int,int))); | 494 | SLOT(newEventAllDay(int,int))); |
496 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 495 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
497 | SLOT(newTimeSpanSelected(int,int,int,int))); | 496 | SLOT(newTimeSpanSelected(int,int,int,int))); |
498 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 497 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
499 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 498 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
500 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 499 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
501 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 500 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
502 | 501 | ||
503 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 502 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
504 | SIGNAL(editIncidenceSignal(Incidence *))); | 503 | SIGNAL(editIncidenceSignal(Incidence *))); |
505 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 504 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
506 | SIGNAL(editIncidenceSignal(Incidence *))); | 505 | SIGNAL(editIncidenceSignal(Incidence *))); |
507 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 506 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
508 | SIGNAL(showIncidenceSignal(Incidence *))); | 507 | SIGNAL(showIncidenceSignal(Incidence *))); |
509 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 508 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
510 | SIGNAL(showIncidenceSignal(Incidence *))); | 509 | SIGNAL(showIncidenceSignal(Incidence *))); |
511 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 510 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
512 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 511 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
513 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 512 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
514 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 513 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
515 | 514 | ||
516 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 515 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
517 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 516 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
518 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 517 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
519 | SLOT(updateEventDates(KOAgendaItem *, int))); | 518 | SLOT(updateEventDates(KOAgendaItem *, int))); |
520 | 519 | ||
521 | // event indicator update | 520 | // event indicator update |
522 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 521 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
523 | SLOT(updateEventIndicatorTop(int))); | 522 | SLOT(updateEventIndicatorTop(int))); |
524 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 523 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
525 | SLOT(updateEventIndicatorBottom(int))); | 524 | SLOT(updateEventIndicatorBottom(int))); |
526 | // drag signals | 525 | // drag signals |
527 | /* | 526 | /* |
528 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 527 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
529 | SLOT(startDrag(Event *))); | 528 | SLOT(startDrag(Event *))); |
@@ -1331,253 +1330,244 @@ void KOAgendaView::newTodoAllDay(int gx, int ) | |||
1331 | QDateTime day (mSelectedDates[gx] ); | 1330 | QDateTime day (mSelectedDates[gx] ); |
1332 | emit newTodoSignal(day, true); | 1331 | emit newTodoSignal(day, true); |
1333 | } | 1332 | } |
1334 | void KOAgendaView::newTodo(int gx, int gy ) | 1333 | void KOAgendaView::newTodo(int gx, int gy ) |
1335 | { | 1334 | { |
1336 | if (!mSelectedDates.count()) return; | 1335 | if (!mSelectedDates.count()) return; |
1337 | QDate dayStart = mSelectedDates[gx]; | 1336 | QDate dayStart = mSelectedDates[gx]; |
1338 | QTime timeStart = mAgenda->gyToTime(gy); | 1337 | QTime timeStart = mAgenda->gyToTime(gy); |
1339 | QDateTime dt (dayStart,timeStart); | 1338 | QDateTime dt (dayStart,timeStart); |
1340 | emit newTodoSignal( dt, false ); | 1339 | emit newTodoSignal( dt, false ); |
1341 | } | 1340 | } |
1342 | 1341 | ||
1343 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1342 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1344 | { | 1343 | { |
1345 | uint i; | 1344 | uint i; |
1346 | for(i=0;i<mMinY.size();++i) { | 1345 | for(i=0;i<mMinY.size();++i) { |
1347 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1346 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1348 | else mEventIndicatorTop->enableColumn(i,false); | 1347 | else mEventIndicatorTop->enableColumn(i,false); |
1349 | } | 1348 | } |
1350 | 1349 | ||
1351 | mEventIndicatorTop->update(); | 1350 | mEventIndicatorTop->update(); |
1352 | } | 1351 | } |
1353 | 1352 | ||
1354 | void KOAgendaView::updateEventIndicatorBottom(int newY) | 1353 | void KOAgendaView::updateEventIndicatorBottom(int newY) |
1355 | { | 1354 | { |
1356 | uint i; | 1355 | uint i; |
1357 | for(i=0;i<mMaxY.size();++i) { | 1356 | for(i=0;i<mMaxY.size();++i) { |
1358 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); | 1357 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); |
1359 | else mEventIndicatorBottom->enableColumn(i,false); | 1358 | else mEventIndicatorBottom->enableColumn(i,false); |
1360 | } | 1359 | } |
1361 | 1360 | ||
1362 | mEventIndicatorBottom->update(); | 1361 | mEventIndicatorBottom->update(); |
1363 | } | 1362 | } |
1364 | 1363 | ||
1365 | void KOAgendaView::startDrag(Event *event) | 1364 | void KOAgendaView::startDrag(Event *event) |
1366 | { | 1365 | { |
1367 | #ifndef KORG_NODND | 1366 | #ifndef KORG_NODND |
1368 | DndFactory factory( calendar() ); | 1367 | DndFactory factory( calendar() ); |
1369 | ICalDrag *vd = factory.createDrag(event,this); | 1368 | ICalDrag *vd = factory.createDrag(event,this); |
1370 | if (vd->drag()) { | 1369 | if (vd->drag()) { |
1371 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; | 1370 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; |
1372 | } | 1371 | } |
1373 | #endif | 1372 | #endif |
1374 | } | 1373 | } |
1375 | 1374 | ||
1376 | void KOAgendaView::readSettings() | 1375 | void KOAgendaView::readSettings() |
1377 | { | 1376 | { |
1378 | readSettings(KOGlobals::config()); | 1377 | readSettings(KOGlobals::config()); |
1379 | } | 1378 | } |
1380 | 1379 | ||
1381 | void KOAgendaView::readSettings(KConfig *config) | 1380 | void KOAgendaView::readSettings(KConfig *config) |
1382 | { | 1381 | { |
1383 | // kdDebug() << "KOAgendaView::readSettings()" << endl; | 1382 | // kdDebug() << "KOAgendaView::readSettings()" << endl; |
1384 | 1383 | ||
1385 | config->setGroup("Views"); | 1384 | config->setGroup("Views"); |
1386 | 1385 | ||
1387 | //#ifndef KORG_NOSPLITTER | 1386 | //#ifndef KORG_NOSPLITTER |
1388 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); | 1387 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); |
1389 | if (sizes.count() == 2) { | 1388 | if (sizes.count() == 2) { |
1390 | if ( sizes[0] < 20 ) { | 1389 | if ( sizes[0] < 20 ) { |
1391 | sizes[1] = sizes[1] +20 - sizes[0]; | 1390 | sizes[1] = sizes[1] +20 - sizes[0]; |
1392 | sizes[0] = 20; | 1391 | sizes[0] = 20; |
1393 | } | 1392 | } |
1394 | mSplitterAgenda->setSizes(sizes); | 1393 | mSplitterAgenda->setSizes(sizes); |
1395 | // qDebug("read %d %d ",sizes[0],sizes[1] ); | 1394 | // qDebug("read %d %d ",sizes[0],sizes[1] ); |
1396 | } | 1395 | } |
1397 | //#endif | 1396 | //#endif |
1398 | 1397 | ||
1399 | // updateConfig(); | 1398 | // updateConfig(); |
1400 | } | 1399 | } |
1401 | 1400 | ||
1402 | void KOAgendaView::writeSettings(KConfig *config) | 1401 | void KOAgendaView::writeSettings(KConfig *config) |
1403 | { | 1402 | { |
1404 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; | 1403 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; |
1405 | 1404 | ||
1406 | config->setGroup("Views"); | 1405 | config->setGroup("Views"); |
1407 | 1406 | ||
1408 | //#ifndef KORG_NOSPLITTER | 1407 | //#ifndef KORG_NOSPLITTER |
1409 | QValueList<int> list = mSplitterAgenda->sizes(); | 1408 | QValueList<int> list = mSplitterAgenda->sizes(); |
1410 | config->writeEntry("Separator AgendaView",list); | 1409 | config->writeEntry("Separator AgendaView",list); |
1411 | //qDebug("write %d %d ", list[0],list[1] ); | 1410 | //qDebug("write %d %d ", list[0],list[1] ); |
1412 | //#endif | 1411 | //#endif |
1413 | } | 1412 | } |
1414 | 1413 | ||
1415 | void KOAgendaView::setHolidayMasks() | 1414 | void KOAgendaView::setHolidayMasks() |
1416 | { | 1415 | { |
1417 | mHolidayMask.resize(mSelectedDates.count()); | 1416 | mHolidayMask.resize(mSelectedDates.count()); |
1418 | 1417 | ||
1419 | uint i; | 1418 | uint i; |
1420 | for(i=0;i<mSelectedDates.count();++i) { | 1419 | for(i=0;i<mSelectedDates.count();++i) { |
1421 | QDate date = mSelectedDates[i]; | 1420 | QDate date = mSelectedDates[i]; |
1422 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); | 1421 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); |
1423 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1422 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1424 | bool showHoliday = false; | 1423 | bool showHoliday = false; |
1425 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1424 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1426 | QPtrList<Event> events = calendar()->events( date, true ); | 1425 | QPtrList<Event> events = calendar()->events( date, true ); |
1427 | Event *event; | 1426 | Event *event; |
1428 | for( event = events.first(); event; event = events.next() ) { | 1427 | for( event = events.first(); event; event = events.next() ) { |
1429 | if ( event->isHoliday()) { | 1428 | if ( event->isHoliday()) { |
1430 | showHoliday = true; | 1429 | showHoliday = true; |
1431 | break; | 1430 | break; |
1432 | } | 1431 | } |
1433 | } | 1432 | } |
1434 | 1433 | ||
1435 | } | 1434 | } |
1436 | 1435 | ||
1437 | #ifndef KORG_NOPLUGINS | 1436 | #ifndef KORG_NOPLUGINS |
1438 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && | 1437 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && |
1439 | !KOCore::self()->holiday(date).isEmpty(); | 1438 | !KOCore::self()->holiday(date).isEmpty(); |
1440 | #endif | 1439 | #endif |
1441 | bool showDay = showSaturday || showSunday || showHoliday; | 1440 | bool showDay = showSaturday || showSunday || showHoliday; |
1442 | 1441 | ||
1443 | if (showDay) { | 1442 | if (showDay) { |
1444 | mHolidayMask.at(i) = true; | 1443 | mHolidayMask.at(i) = true; |
1445 | } else { | 1444 | } else { |
1446 | mHolidayMask.at(i) = false; | 1445 | mHolidayMask.at(i) = false; |
1447 | } | 1446 | } |
1448 | } | 1447 | } |
1449 | 1448 | ||
1450 | mAgenda->setHolidayMask(&mHolidayMask); | 1449 | mAgenda->setHolidayMask(&mHolidayMask); |
1451 | mAllDayAgenda->setHolidayMask(&mHolidayMask); | 1450 | mAllDayAgenda->setHolidayMask(&mHolidayMask); |
1452 | } | 1451 | } |
1453 | 1452 | ||
1454 | void KOAgendaView::setContentsPos(int y) | 1453 | void KOAgendaView::setContentsPos(int y) |
1455 | { | 1454 | { |
1456 | mAgenda->setContentsPos(0,y); | 1455 | mAgenda->setContentsPos(0,y); |
1457 | } | 1456 | } |
1458 | 1457 | ||
1459 | void KOAgendaView::setExpandedButton( bool expanded ) | ||
1460 | { | ||
1461 | if ( expanded ) { | ||
1462 | mExpandButton->setPixmap( mExpandedPixmap ); | ||
1463 | } else { | ||
1464 | mExpandButton->setPixmap( mNotExpandedPixmap ); | ||
1465 | } | ||
1466 | } | ||
1467 | |||
1468 | void KOAgendaView::clearSelection() | 1458 | void KOAgendaView::clearSelection() |
1469 | { | 1459 | { |
1470 | mAgenda->deselectItem(); | 1460 | mAgenda->deselectItem(); |
1471 | mAllDayAgenda->deselectItem(); | 1461 | mAllDayAgenda->deselectItem(); |
1472 | } | 1462 | } |
1473 | 1463 | ||
1474 | void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, | 1464 | void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, |
1475 | int gxEnd, int gyEnd) | 1465 | int gxEnd, int gyEnd) |
1476 | { | 1466 | { |
1477 | mTimeSpanInAllDay = true; | 1467 | mTimeSpanInAllDay = true; |
1478 | newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); | 1468 | newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); |
1479 | } | 1469 | } |
1480 | 1470 | ||
1481 | 1471 | ||
1482 | 1472 | ||
1483 | 1473 | ||
1484 | void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, | 1474 | void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, |
1485 | int gxEnd, int gyEnd) | 1475 | int gxEnd, int gyEnd) |
1486 | { | 1476 | { |
1487 | if (!mSelectedDates.count()) return; | 1477 | if (!mSelectedDates.count()) return; |
1488 | 1478 | ||
1489 | QDate dayStart = mSelectedDates[gxStart]; | 1479 | QDate dayStart = mSelectedDates[gxStart]; |
1490 | QDate dayEnd = mSelectedDates[gxEnd]; | 1480 | QDate dayEnd = mSelectedDates[gxEnd]; |
1491 | 1481 | ||
1492 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1482 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1493 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1483 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1494 | 1484 | ||
1495 | QDateTime dtStart(dayStart,timeStart); | 1485 | QDateTime dtStart(dayStart,timeStart); |
1496 | QDateTime dtEnd(dayEnd,timeEnd); | 1486 | QDateTime dtEnd(dayEnd,timeEnd); |
1497 | 1487 | ||
1498 | mTimeSpanBegin = dtStart; | 1488 | mTimeSpanBegin = dtStart; |
1499 | mTimeSpanEnd = dtEnd; | 1489 | mTimeSpanEnd = dtEnd; |
1500 | 1490 | ||
1501 | } | 1491 | } |
1502 | 1492 | ||
1503 | void KOAgendaView::deleteSelectedDateTime() | 1493 | void KOAgendaView::deleteSelectedDateTime() |
1504 | { | 1494 | { |
1505 | mTimeSpanBegin.setDate(QDate()); | 1495 | mTimeSpanBegin.setDate(QDate()); |
1506 | mTimeSpanEnd.setDate(QDate()); | 1496 | mTimeSpanEnd.setDate(QDate()); |
1507 | mTimeSpanInAllDay = false; | 1497 | mTimeSpanInAllDay = false; |
1508 | } | 1498 | } |
1509 | 1499 | ||
1510 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) | 1500 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) |
1511 | { | 1501 | { |
1512 | e->ignore(); | 1502 | e->ignore(); |
1513 | } | 1503 | } |
1514 | 1504 | ||
1515 | void KOAgendaView::scrollOneHourUp() | 1505 | void KOAgendaView::scrollOneHourUp() |
1516 | { | 1506 | { |
1517 | 1507 | ||
1518 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); | 1508 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); |
1519 | } | 1509 | } |
1520 | void KOAgendaView::scrollOneHourDown() | 1510 | void KOAgendaView::scrollOneHourDown() |
1521 | { | 1511 | { |
1522 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); | 1512 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); |
1523 | } | 1513 | } |
1524 | 1514 | ||
1525 | void KOAgendaView::setStartHour( int h ) | 1515 | void KOAgendaView::setStartHour( int h ) |
1526 | { | 1516 | { |
1527 | mAgenda->setStartHour( h ); | 1517 | mAgenda->setStartHour( h ); |
1528 | 1518 | ||
1529 | } | 1519 | } |
1530 | void KOAgendaView::setInitStartHour() | 1520 | void KOAgendaView::setInitStartHour() |
1531 | { | 1521 | { |
1532 | 1522 | ||
1533 | if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1523 | if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1534 | setStartHour( QTime::currentTime ().hour() ); | 1524 | setStartHour( QTime::currentTime ().hour() ); |
1535 | else | 1525 | else |
1536 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1526 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1537 | 1527 | ||
1538 | } | 1528 | } |
1539 | 1529 | ||
1540 | 1530 | ||
1541 | void KOAgendaView::updateTodo( Todo * t, int ) | 1531 | void KOAgendaView::updateTodo( Todo * t, int ) |
1542 | { | 1532 | { |
1543 | if ( !isVisible() ) | 1533 | if ( !isVisible() ) |
1544 | return; | 1534 | return; |
1545 | bool remove = false; | 1535 | bool remove = false; |
1546 | bool removeAD = false; | 1536 | bool removeAD = false; |
1547 | QDate da; | 1537 | QDate da; |
1548 | if ( t->hasCompletedDate() ) | 1538 | if ( t->hasCompletedDate() ) |
1549 | da = t->completed().date(); | 1539 | da = t->completed().date(); |
1550 | else | 1540 | else |
1551 | da = t->dtDue().date(); | 1541 | da = t->dtDue().date(); |
1552 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { | 1542 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { |
1553 | remove = true; | 1543 | remove = true; |
1554 | removeAD = true; | 1544 | removeAD = true; |
1555 | } | 1545 | } |
1556 | else { | 1546 | else { |
1557 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; | 1547 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; |
1558 | if ( overdue && | 1548 | if ( overdue && |
1559 | QDate::currentDate() >= mSelectedDates.first() && | 1549 | QDate::currentDate() >= mSelectedDates.first() && |
1560 | QDate::currentDate() <= mSelectedDates.last()) { | 1550 | QDate::currentDate() <= mSelectedDates.last()) { |
1561 | removeAD = false; | 1551 | removeAD = false; |
1562 | remove = true; | 1552 | remove = true; |
1563 | } | 1553 | } |
1564 | else { | 1554 | else { |
1565 | 1555 | ||
1566 | if ( da < mSelectedDates.first() || | 1556 | if ( da < mSelectedDates.first() || |
1567 | da > mSelectedDates.last() ) { | 1557 | da > mSelectedDates.last() ) { |
1568 | remove = true; | 1558 | remove = true; |
1569 | removeAD = true; | 1559 | removeAD = true; |
1570 | } else { | 1560 | } else { |
1571 | remove = t->doesFloat() && !t->hasCompletedDate(); | 1561 | remove = t->doesFloat() && !t->hasCompletedDate(); |
1572 | removeAD = !remove; | 1562 | removeAD = !remove; |
1573 | } | 1563 | } |
1574 | } | 1564 | } |
1575 | } | 1565 | } |
1576 | int days = mSelectedDates.first().daysTo( da ); | 1566 | int days = mSelectedDates.first().daysTo( da ); |
1577 | //qDebug("daysto %d %d %d", days, remove,removeAD ); | 1567 | //qDebug("daysto %d %d %d", days, remove,removeAD ); |
1578 | mAgenda->updateTodo( t , days, remove); | 1568 | mAgenda->updateTodo( t , days, remove); |
1579 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1569 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1580 | mAllDayAgenda->updateTodo( t , days, removeAD); | 1570 | mAllDayAgenda->updateTodo( t , days, removeAD); |
1581 | //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); | 1571 | //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); |
1582 | 1572 | ||
1583 | } | 1573 | } |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 0cb9310..57b4e46 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -78,215 +78,212 @@ class TimeLabels : public QScrollView { | |||
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 | int mMiniWidth; | 104 | int mMiniWidth; |
105 | int mMouseDownY; | 105 | int mMouseDownY; |
106 | QString mOrgCap; | 106 | QString mOrgCap; |
107 | int mRows; | 107 | int mRows; |
108 | int mCellHeight; | 108 | int mCellHeight; |
109 | 109 | ||
110 | /** */ | 110 | /** */ |
111 | KOAgenda* mAgenda; | 111 | KOAgenda* mAgenda; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | class EventIndicator : public QFrame { | 114 | class EventIndicator : public QFrame { |
115 | Q_OBJECT | 115 | Q_OBJECT |
116 | public: | 116 | public: |
117 | enum Location { Top, Bottom }; | 117 | enum Location { Top, Bottom }; |
118 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 118 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
119 | virtual ~EventIndicator(); | 119 | virtual ~EventIndicator(); |
120 | 120 | ||
121 | void changeColumns(int columns); | 121 | void changeColumns(int columns); |
122 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 122 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
123 | void setXOffset( int ); | 123 | void setXOffset( int ); |
124 | void enableColumn(int column, bool enable); | 124 | void enableColumn(int column, bool enable); |
125 | 125 | ||
126 | protected: | 126 | protected: |
127 | void drawContents(QPainter *); | 127 | void drawContents(QPainter *); |
128 | 128 | ||
129 | private: | 129 | private: |
130 | int mXOffset; | 130 | int mXOffset; |
131 | KDGanttMinimizeSplitter* mPaintWidget; | 131 | KDGanttMinimizeSplitter* mPaintWidget; |
132 | int mColumns; | 132 | int mColumns; |
133 | QHBox *mTopBox; | 133 | QHBox *mTopBox; |
134 | QBoxLayout *mTopLayout; | 134 | QBoxLayout *mTopLayout; |
135 | Location mLocation; | 135 | Location mLocation; |
136 | QPixmap mPixmap; | 136 | QPixmap mPixmap; |
137 | QMemArray<bool> mEnabled; | 137 | QMemArray<bool> mEnabled; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | /** | 140 | /** |
141 | KOAgendaView is the agenda-like view used to display events in an one or | 141 | KOAgendaView is the agenda-like view used to display events in an one or |
142 | multi-day view. | 142 | multi-day view. |
143 | */ | 143 | */ |
144 | class KOAgendaView : public KOEventView { | 144 | class KOAgendaView : public KOEventView { |
145 | Q_OBJECT | 145 | Q_OBJECT |
146 | public: | 146 | public: |
147 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 147 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
148 | virtual ~KOAgendaView(); | 148 | virtual ~KOAgendaView(); |
149 | void setStartHour( int ); | 149 | void setStartHour( int ); |
150 | void toggleAllDay(); | 150 | void toggleAllDay(); |
151 | 151 | ||
152 | 152 | ||
153 | /** Returns maximum number of days supported by the koagendaview */ | 153 | /** Returns maximum number of days supported by the koagendaview */ |
154 | virtual int maxDatesHint(); | 154 | virtual int maxDatesHint(); |
155 | 155 | ||
156 | /** Returns number of currently shown dates. */ | 156 | /** Returns number of currently shown dates. */ |
157 | virtual int currentDateCount(); | 157 | virtual int currentDateCount(); |
158 | 158 | ||
159 | /** returns the currently selected events */ | 159 | /** returns the currently selected events */ |
160 | virtual QPtrList<Incidence> selectedIncidences(); | 160 | virtual QPtrList<Incidence> selectedIncidences(); |
161 | 161 | ||
162 | /** returns the currently selected events */ | 162 | /** returns the currently selected events */ |
163 | virtual DateList selectedDates(); | 163 | virtual DateList selectedDates(); |
164 | 164 | ||
165 | /** Remove all events from view */ | 165 | /** Remove all events from view */ |
166 | void clearView(); | 166 | void clearView(); |
167 | KOAgenda *agenda() { return mAgenda;} | 167 | KOAgenda *agenda() { return mAgenda;} |
168 | virtual void printPreview(CalPrinter *calPrinter, | 168 | virtual void printPreview(CalPrinter *calPrinter, |
169 | const QDate &, const QDate &); | 169 | const QDate &, const QDate &); |
170 | 170 | ||
171 | /** start-datetime of selection */ | 171 | /** start-datetime of selection */ |
172 | QDateTime selectionStart() {return mTimeSpanBegin;} | 172 | QDateTime selectionStart() {return mTimeSpanBegin;} |
173 | /** end-datetime of selection */ | 173 | /** end-datetime of selection */ |
174 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 174 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
175 | /** returns true if selection is for whole day */ | 175 | /** returns true if selection is for whole day */ |
176 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 176 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
177 | /** make selected start/end invalid */ | 177 | /** make selected start/end invalid */ |
178 | void deleteSelectedDateTime(); | 178 | void deleteSelectedDateTime(); |
179 | void repaintAgenda(); | 179 | void repaintAgenda(); |
180 | public slots: | 180 | public slots: |
181 | void setInitStartHour(); | 181 | void setInitStartHour(); |
182 | virtual void updateView(); | 182 | virtual void updateView(); |
183 | virtual void updateConfig(); | 183 | virtual void updateConfig(); |
184 | virtual void showDates(const QDate &start, const QDate &end); | 184 | virtual void showDates(const QDate &start, const QDate &end); |
185 | virtual void showEvents(QPtrList<Event> eventList); | 185 | virtual void showEvents(QPtrList<Event> eventList); |
186 | 186 | ||
187 | void updateTodo( Todo *, int ); | 187 | void updateTodo( Todo *, int ); |
188 | void changeEventDisplay(Event *, int); | 188 | void changeEventDisplay(Event *, int); |
189 | 189 | ||
190 | void clearSelection(); | 190 | void clearSelection(); |
191 | 191 | ||
192 | void newTodo(int gx,int gy); | 192 | void newTodo(int gx,int gy); |
193 | void newEvent(int gx,int gy); | 193 | void newEvent(int gx,int gy); |
194 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 194 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
195 | void newEventAllDay(int gx, int gy); | 195 | void newEventAllDay(int gx, int gy); |
196 | void newTodoAllDay(int gx, int gy); | 196 | void newTodoAllDay(int gx, int gy); |
197 | 197 | ||
198 | void startDrag(Event *); | 198 | void startDrag(Event *); |
199 | 199 | ||
200 | void readSettings(); | 200 | void readSettings(); |
201 | void readSettings(KConfig *); | 201 | void readSettings(KConfig *); |
202 | void writeSettings(KConfig *); | 202 | void writeSettings(KConfig *); |
203 | 203 | ||
204 | void setContentsPos(int y); | 204 | void setContentsPos(int y); |
205 | 205 | ||
206 | void setExpandedButton( bool expanded ); | ||
207 | void scrollOneHourUp(); | 206 | void scrollOneHourUp(); |
208 | void scrollOneHourDown(); | 207 | void scrollOneHourDown(); |
209 | void addToCalSlot(Incidence *, Incidence *); | 208 | void addToCalSlot(Incidence *, Incidence *); |
210 | 209 | ||
211 | signals: | 210 | signals: |
212 | void showDateView( int, QDate ); | 211 | void showDateView( int, QDate ); |
213 | void newTodoSignal( QDateTime ,bool ); | 212 | void newTodoSignal( QDateTime ,bool ); |
214 | void toggleExpand(); | 213 | void toggleExpand(); |
215 | void selectWeekNum( int ); | 214 | void selectWeekNum( int ); |
216 | void todoMoved( Todo *, int ); | 215 | void todoMoved( Todo *, int ); |
217 | void incidenceChanged(Incidence * , int ); | 216 | void incidenceChanged(Incidence * , int ); |
218 | // void cloneIncidenceSignal(Incidence *); | 217 | // void cloneIncidenceSignal(Incidence *); |
219 | 218 | ||
220 | protected: | 219 | protected: |
221 | KOAgendaButton* getNewDaylabel(); | 220 | KOAgendaButton* getNewDaylabel(); |
222 | bool mBlockUpdating; | 221 | bool mBlockUpdating; |
223 | int mUpcomingWidth; | 222 | int mUpcomingWidth; |
224 | /** Fill agenda beginning with date startDate */ | 223 | /** Fill agenda beginning with date startDate */ |
225 | void fillAgenda(const QDate &startDate); | 224 | void fillAgenda(const QDate &startDate); |
226 | void resizeEvent( QResizeEvent* e ); | 225 | void resizeEvent( QResizeEvent* e ); |
227 | /** Fill agenda using the current set value for the start date */ | 226 | /** Fill agenda using the current set value for the start date */ |
228 | void fillAgenda(); | 227 | void fillAgenda(); |
229 | 228 | ||
230 | /** Create labels for the selected dates. */ | 229 | /** Create labels for the selected dates. */ |
231 | void createDayLabels(); | 230 | void createDayLabels(); |
232 | 231 | ||
233 | /** | 232 | /** |
234 | Set the masks on the agenda widgets indicating, which days are holidays. | 233 | Set the masks on the agenda widgets indicating, which days are holidays. |
235 | */ | 234 | */ |
236 | void setHolidayMasks(); | 235 | void setHolidayMasks(); |
237 | 236 | ||
238 | protected slots: | 237 | protected slots: |
239 | void slotDaylabelClicked( int ); | 238 | void slotDaylabelClicked( int ); |
240 | /** Update event belonging to agenda item */ | 239 | /** Update event belonging to agenda item */ |
241 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 240 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
242 | //void updateMovedTodo(); | 241 | //void updateMovedTodo(); |
243 | 242 | ||
244 | void updateEventIndicatorTop(int newY); | 243 | void updateEventIndicatorTop(int newY); |
245 | void updateEventIndicatorBottom(int newY); | 244 | void updateEventIndicatorBottom(int newY); |
246 | 245 | ||
247 | /** Updates data for selected timespan */ | 246 | /** Updates data for selected timespan */ |
248 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 247 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
249 | /** Updates data for selected timespan for all day event*/ | 248 | /** Updates data for selected timespan for all day event*/ |
250 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 249 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
251 | 250 | ||
252 | private: | 251 | private: |
253 | // view widgets | 252 | // view widgets |
254 | QFrame *mDayLabels; | 253 | QFrame *mDayLabels; |
255 | QHBox *mDayLabelsFrame; | 254 | QHBox *mDayLabelsFrame; |
256 | QBoxLayout *mLayoutDayLabels; | 255 | QBoxLayout *mLayoutDayLabels; |
257 | QFrame *mAllDayFrame; | 256 | QFrame *mAllDayFrame; |
258 | KOAgenda *mAllDayAgenda; | 257 | KOAgenda *mAllDayAgenda; |
259 | KOAgenda *mAgenda; | 258 | KOAgenda *mAgenda; |
260 | TimeLabels *mTimeLabels; | 259 | TimeLabels *mTimeLabels; |
261 | QWidget *mDummyAllDayLeft; | 260 | QWidget *mDummyAllDayLeft; |
262 | 261 | ||
263 | KDGanttMinimizeSplitter* mSplitterAgenda; | 262 | KDGanttMinimizeSplitter* mSplitterAgenda; |
264 | QPushButton *mExpandButton; | 263 | QPushButton *mExpandButton; |
265 | 264 | ||
266 | DateList mSelectedDates; // List of dates to be displayed | 265 | DateList mSelectedDates; // List of dates to be displayed |
267 | int mViewType; | 266 | int mViewType; |
268 | 267 | ||
269 | bool mWeekStartsMonday; | 268 | bool mWeekStartsMonday; |
270 | int mStartHour; | 269 | int mStartHour; |
271 | 270 | ||
272 | KOEventPopupMenu *mAgendaPopup; | 271 | KOEventPopupMenu *mAgendaPopup; |
273 | KOEventPopupMenu *mAllDayAgendaPopup; | 272 | KOEventPopupMenu *mAllDayAgendaPopup; |
274 | 273 | ||
275 | EventIndicator *mEventIndicatorTop; | 274 | EventIndicator *mEventIndicatorTop; |
276 | EventIndicator *mEventIndicatorBottom; | 275 | EventIndicator *mEventIndicatorBottom; |
277 | 276 | ||
278 | QMemArray<int> mMinY; | 277 | QMemArray<int> mMinY; |
279 | QMemArray<int> mMaxY; | 278 | QMemArray<int> mMaxY; |
280 | 279 | ||
281 | QMemArray<bool> mHolidayMask; | 280 | QMemArray<bool> mHolidayMask; |
282 | 281 | ||
283 | QPixmap mExpandedPixmap; | ||
284 | QPixmap mNotExpandedPixmap; | ||
285 | QPtrList<KOAgendaButton> mDayLabelsList; | 282 | QPtrList<KOAgendaButton> mDayLabelsList; |
286 | QDateTime mTimeSpanBegin; | 283 | QDateTime mTimeSpanBegin; |
287 | QDateTime mTimeSpanEnd; | 284 | QDateTime mTimeSpanEnd; |
288 | bool mTimeSpanInAllDay; | 285 | bool mTimeSpanInAllDay; |
289 | void keyPressEvent ( QKeyEvent * e ); | 286 | void keyPressEvent ( QKeyEvent * e ); |
290 | }; | 287 | }; |
291 | 288 | ||
292 | #endif // KOAGENDAVIEW_H | 289 | #endif // KOAGENDAVIEW_H |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 5a2dce3..31ee5e2 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -271,259 +271,257 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | |||
271 | emit signalAgendaView( mCurrentView == mAgendaView ); | 271 | emit signalAgendaView( mCurrentView == mAgendaView ); |
272 | //qDebug("raiseCurrentView ende "); | 272 | //qDebug("raiseCurrentView ende "); |
273 | 273 | ||
274 | } | 274 | } |
275 | 275 | ||
276 | void KOViewManager::updateView() | 276 | void KOViewManager::updateView() |
277 | { | 277 | { |
278 | // qDebug("KOViewManager::updateView() "); | 278 | // qDebug("KOViewManager::updateView() "); |
279 | // if we are updating mTodoView, we get endless recursion | 279 | // if we are updating mTodoView, we get endless recursion |
280 | if ( mTodoView == mCurrentView ) | 280 | if ( mTodoView == mCurrentView ) |
281 | return; | 281 | return; |
282 | if ( mCurrentView ) mCurrentView->updateView(); | 282 | if ( mCurrentView ) mCurrentView->updateView(); |
283 | 283 | ||
284 | } | 284 | } |
285 | 285 | ||
286 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 286 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
287 | { | 287 | { |
288 | // kdDebug() << "KOViewManager::updateView()" << endl; | 288 | // kdDebug() << "KOViewManager::updateView()" << endl; |
289 | 289 | ||
290 | if (mCurrentView) mCurrentView->showDates(start, end); | 290 | if (mCurrentView) mCurrentView->showDates(start, end); |
291 | 291 | ||
292 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 292 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | void KOViewManager::updateWNview() | 296 | void KOViewManager::updateWNview() |
297 | { | 297 | { |
298 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 298 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
299 | mWhatsNextView->updateView(); | 299 | mWhatsNextView->updateView(); |
300 | 300 | ||
301 | } | 301 | } |
302 | void KOViewManager::showWhatsNextView() | 302 | void KOViewManager::showWhatsNextView() |
303 | { | 303 | { |
304 | if (!mWhatsNextView) { | 304 | if (!mWhatsNextView) { |
305 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 305 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
306 | "KOViewManager::WhatsNextView"); | 306 | "KOViewManager::WhatsNextView"); |
307 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 307 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
308 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 308 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
309 | addView(mWhatsNextView); | 309 | addView(mWhatsNextView); |
310 | connect(this, SIGNAL( printWNV() ), | 310 | connect(this, SIGNAL( printWNV() ), |
311 | mWhatsNextView, SLOT( printMe() ) ); | 311 | mWhatsNextView, SLOT( printMe() ) ); |
312 | } | 312 | } |
313 | globalFlagBlockAgenda = 1; | 313 | globalFlagBlockAgenda = 1; |
314 | showView(mWhatsNextView, true ); | 314 | showView(mWhatsNextView, true ); |
315 | //mWhatsNextView->updateView(); | 315 | //mWhatsNextView->updateView(); |
316 | 316 | ||
317 | } | 317 | } |
318 | 318 | ||
319 | void KOViewManager::showListView() | 319 | void KOViewManager::showListView() |
320 | { | 320 | { |
321 | if (!mListView) { | 321 | if (!mListView) { |
322 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 322 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
323 | addView(mListView); | 323 | addView(mListView); |
324 | 324 | ||
325 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 325 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
326 | mMainView, SLOT(showIncidence(Incidence *))); | 326 | mMainView, SLOT(showIncidence(Incidence *))); |
327 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 327 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
328 | mMainView, SLOT(editIncidence(Incidence *))); | 328 | mMainView, SLOT(editIncidence(Incidence *))); |
329 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 329 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
330 | mMainView, SLOT(deleteIncidence(Incidence *))); | 330 | mMainView, SLOT(deleteIncidence(Incidence *))); |
331 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 331 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
332 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 332 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
333 | connect( mListView, SIGNAL( signalNewEvent() ), | 333 | connect( mListView, SIGNAL( signalNewEvent() ), |
334 | mMainView, SLOT( newEvent() ) ); | 334 | mMainView, SLOT( newEvent() ) ); |
335 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 335 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
336 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 336 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
337 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 337 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
338 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 338 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
339 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 339 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
340 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 340 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
341 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 341 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
342 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 342 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
343 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 343 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
344 | } | 344 | } |
345 | // bool temp = mFlagShowNextxDays; | 345 | // bool temp = mFlagShowNextxDays; |
346 | //globalFlagBlockPainting = true; | 346 | //globalFlagBlockPainting = true; |
347 | globalFlagBlockAgenda = 1; | 347 | globalFlagBlockAgenda = 1; |
348 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 348 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
349 | mMainView->setBlockShowDates( true ); | 349 | mMainView->setBlockShowDates( true ); |
350 | mMainView->dateNavigator()->selectMonth(); | 350 | mMainView->dateNavigator()->selectMonth(); |
351 | mMainView->setBlockShowDates( false ); | 351 | mMainView->setBlockShowDates( false ); |
352 | } | 352 | } |
353 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 353 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
354 | //mFlagShowNextxDays = temp; | 354 | //mFlagShowNextxDays = temp; |
355 | } | 355 | } |
356 | 356 | ||
357 | void KOViewManager::showAgendaView( bool fullScreen ) | 357 | void KOViewManager::showAgendaView( bool fullScreen ) |
358 | { | 358 | { |
359 | 359 | ||
360 | mMainView->dialogManager()->hideSearchDialog(); | 360 | mMainView->dialogManager()->hideSearchDialog(); |
361 | // qDebug("KOViewManager::showAgendaView "); | 361 | // qDebug("KOViewManager::showAgendaView "); |
362 | bool full; | 362 | bool full; |
363 | full = fullScreen; | 363 | full = fullScreen; |
364 | if (!mAgendaView) { | 364 | if (!mAgendaView) { |
365 | full = false; | 365 | full = false; |
366 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 366 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
367 | addView(mAgendaView); | 367 | addView(mAgendaView); |
368 | #ifndef DESKTOP_VERSION | 368 | #ifndef DESKTOP_VERSION |
369 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 369 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
370 | #endif | 370 | #endif |
371 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 371 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
372 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 372 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
373 | 373 | ||
374 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 374 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
375 | 375 | ||
376 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 376 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
377 | 377 | ||
378 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 378 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
379 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 379 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
380 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 380 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
381 | mMainView, SLOT(newEvent(QDateTime))); | 381 | mMainView, SLOT(newEvent(QDateTime))); |
382 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 382 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
383 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 383 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
384 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 384 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
385 | mMainView, SLOT(newEvent(QDate))); | 385 | mMainView, SLOT(newEvent(QDate))); |
386 | 386 | ||
387 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 387 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
388 | mMainView, SLOT(editIncidence(Incidence *))); | 388 | mMainView, SLOT(editIncidence(Incidence *))); |
389 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 389 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
390 | mMainView, SLOT(showIncidence(Incidence *))); | 390 | mMainView, SLOT(showIncidence(Incidence *))); |
391 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 391 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
392 | mMainView, SLOT(deleteIncidence(Incidence *))); | 392 | mMainView, SLOT(deleteIncidence(Incidence *))); |
393 | 393 | ||
394 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 394 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
395 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 395 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
396 | 396 | ||
397 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 397 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
398 | mMainView, SLOT( toggleExpand() ) ); | 398 | mMainView, SLOT( toggleExpand() ) ); |
399 | 399 | ||
400 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | ||
401 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | ||
402 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 400 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
403 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 401 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
404 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 402 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
405 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 403 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
406 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 404 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
407 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 405 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
408 | SLOT( updateTodo( Todo *, int ) ) ); | 406 | SLOT( updateTodo( Todo *, int ) ) ); |
409 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 407 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
410 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 408 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
411 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 409 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
412 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 410 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
413 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 411 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
414 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 412 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
415 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 413 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
416 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 414 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
417 | mAgendaView->readSettings(); | 415 | mAgendaView->readSettings(); |
418 | mAgendaView->updateConfig(); | 416 | mAgendaView->updateConfig(); |
419 | } | 417 | } |
420 | 418 | ||
421 | showView( mAgendaView, full); | 419 | showView( mAgendaView, full); |
422 | 420 | ||
423 | } | 421 | } |
424 | 422 | ||
425 | void KOViewManager::showDayView() | 423 | void KOViewManager::showDayView() |
426 | { | 424 | { |
427 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | 425 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); |
428 | mFlagShowNextxDays = false; | 426 | mFlagShowNextxDays = false; |
429 | globalFlagBlockLabel = 1; | 427 | globalFlagBlockLabel = 1; |
430 | globalFlagBlockAgenda = 1; | 428 | globalFlagBlockAgenda = 1; |
431 | if ( mCurrentAgendaView != 1 ) | 429 | if ( mCurrentAgendaView != 1 ) |
432 | mCurrentAgendaView = -1; | 430 | mCurrentAgendaView = -1; |
433 | showAgendaView(); | 431 | showAgendaView(); |
434 | qApp->processEvents(); | 432 | qApp->processEvents(); |
435 | globalFlagBlockAgenda = 2; | 433 | globalFlagBlockAgenda = 2; |
436 | globalFlagBlockLabel = 0; | 434 | globalFlagBlockLabel = 0; |
437 | mMainView->dateNavigator()->selectDates( 1 ); | 435 | mMainView->dateNavigator()->selectDates( 1 ); |
438 | mCurrentAgendaView = 1 ; | 436 | mCurrentAgendaView = 1 ; |
439 | 437 | ||
440 | } | 438 | } |
441 | 439 | ||
442 | void KOViewManager::showWorkWeekView() | 440 | void KOViewManager::showWorkWeekView() |
443 | { | 441 | { |
444 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | 442 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); |
445 | mFlagShowNextxDays = false; | 443 | mFlagShowNextxDays = false; |
446 | globalFlagBlockAgenda = 1; | 444 | globalFlagBlockAgenda = 1; |
447 | globalFlagBlockLabel = 1; | 445 | globalFlagBlockLabel = 1; |
448 | if ( mCurrentAgendaView != 5 ) | 446 | if ( mCurrentAgendaView != 5 ) |
449 | mCurrentAgendaView = -1; | 447 | mCurrentAgendaView = -1; |
450 | showAgendaView(); | 448 | showAgendaView(); |
451 | qApp->processEvents(); | 449 | qApp->processEvents(); |
452 | globalFlagBlockAgenda = 2; | 450 | globalFlagBlockAgenda = 2; |
453 | globalFlagBlockLabel = 0; | 451 | globalFlagBlockLabel = 0; |
454 | mMainView->dateNavigator()->selectWorkWeek(); | 452 | mMainView->dateNavigator()->selectWorkWeek(); |
455 | mCurrentAgendaView = 5 ; | 453 | mCurrentAgendaView = 5 ; |
456 | 454 | ||
457 | } | 455 | } |
458 | 456 | ||
459 | void KOViewManager::showWeekView() | 457 | void KOViewManager::showWeekView() |
460 | { | 458 | { |
461 | /* | 459 | /* |
462 | globalFlagBlockAgenda = 2; | 460 | globalFlagBlockAgenda = 2; |
463 | qDebug("4globalFlagBlockAgenda = 2; "); | 461 | qDebug("4globalFlagBlockAgenda = 2; "); |
464 | //globalFlagBlockPainting = true; | 462 | //globalFlagBlockPainting = true; |
465 | mMainView->dateNavigator()->selectWeek(); | 463 | mMainView->dateNavigator()->selectWeek(); |
466 | showAgendaView(); | 464 | showAgendaView(); |
467 | */ | 465 | */ |
468 | 466 | ||
469 | 467 | ||
470 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | 468 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); |
471 | mFlagShowNextxDays = false; | 469 | mFlagShowNextxDays = false; |
472 | globalFlagBlockAgenda = 1; | 470 | globalFlagBlockAgenda = 1; |
473 | globalFlagBlockLabel = 1; | 471 | globalFlagBlockLabel = 1; |
474 | if ( mCurrentAgendaView != 7 ) | 472 | if ( mCurrentAgendaView != 7 ) |
475 | mCurrentAgendaView = -1; | 473 | mCurrentAgendaView = -1; |
476 | showAgendaView(); | 474 | showAgendaView(); |
477 | qApp->processEvents(); | 475 | qApp->processEvents(); |
478 | globalFlagBlockAgenda = 2; | 476 | globalFlagBlockAgenda = 2; |
479 | globalFlagBlockLabel = 0; | 477 | globalFlagBlockLabel = 0; |
480 | mMainView->dateNavigator()->selectWeek(); | 478 | mMainView->dateNavigator()->selectWeek(); |
481 | mCurrentAgendaView = 7 ; | 479 | mCurrentAgendaView = 7 ; |
482 | } | 480 | } |
483 | 481 | ||
484 | void KOViewManager::showNextXView() | 482 | void KOViewManager::showNextXView() |
485 | { | 483 | { |
486 | 484 | ||
487 | globalFlagBlockAgenda = 1; | 485 | globalFlagBlockAgenda = 1; |
488 | if ( mCurrentAgendaView != 3 ) | 486 | if ( mCurrentAgendaView != 3 ) |
489 | mCurrentAgendaView = -1; | 487 | mCurrentAgendaView = -1; |
490 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 488 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
491 | globalFlagBlockAgenda = 2; | 489 | globalFlagBlockAgenda = 2; |
492 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 490 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
493 | KOPrefs::instance()->mNextXDays ); | 491 | KOPrefs::instance()->mNextXDays ); |
494 | mFlagShowNextxDays = true; | 492 | mFlagShowNextxDays = true; |
495 | mCurrentAgendaView = 3 ; | 493 | mCurrentAgendaView = 3 ; |
496 | } | 494 | } |
497 | bool KOViewManager::showsNextDays() | 495 | bool KOViewManager::showsNextDays() |
498 | { | 496 | { |
499 | return mFlagShowNextxDays; | 497 | return mFlagShowNextxDays; |
500 | } | 498 | } |
501 | void KOViewManager::createMonthView() | 499 | void KOViewManager::createMonthView() |
502 | { | 500 | { |
503 | if (!mMonthView) { | 501 | if (!mMonthView) { |
504 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 502 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
505 | 503 | ||
506 | addView(mMonthView); | 504 | addView(mMonthView); |
507 | // mMonthView->show(); | 505 | // mMonthView->show(); |
508 | // SIGNALS/SLOTS FOR MONTH VIEW | 506 | // SIGNALS/SLOTS FOR MONTH VIEW |
509 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 507 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
510 | mMainView, SLOT(newEvent(QDateTime))); | 508 | mMainView, SLOT(newEvent(QDateTime))); |
511 | 509 | ||
512 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 510 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
513 | mMainView, SLOT(showIncidence(Incidence *))); | 511 | mMainView, SLOT(showIncidence(Incidence *))); |
514 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 512 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
515 | mMainView, SLOT(editIncidence(Incidence *))); | 513 | mMainView, SLOT(editIncidence(Incidence *))); |
516 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 514 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
517 | mMainView, SLOT(deleteIncidence(Incidence *))); | 515 | mMainView, SLOT(deleteIncidence(Incidence *))); |
518 | 516 | ||
519 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 517 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
520 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 518 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
521 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 519 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
522 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 520 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
523 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 521 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
524 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 522 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
525 | 523 | ||
526 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 524 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
527 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 525 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
528 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 526 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
529 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 527 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 06f5ef8..eca7c14 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,227 +1,227 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 46 | #include "kocore.h" |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
50 | 50 | ||
51 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
52 | 52 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
55 | { | 55 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
57 | 57 | ||
58 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
62 | 62 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | bool isRTL = KOGlobals::self()->reverseLayout(); | 67 | bool isRTL = KOGlobals::self()->reverseLayout(); |
68 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
69 | bool isDesktop = false; | 69 | bool isDesktop = false; |
70 | #else | 70 | #else |
71 | bool isDesktop = true; | 71 | bool isDesktop = true; |
72 | #endif | 72 | #endif |
73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
74 | isDesktop = true; | 74 | isDesktop = true; |
75 | // Create backward navigation buttons | 75 | // Create backward navigation buttons |
76 | mPrevYear = new QPushButton( mCtrlFrame ); | 76 | mPrevYear = new QPushButton( mCtrlFrame ); |
77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); |
78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
79 | 79 | ||
80 | mPrevMonth = new QPushButton( mCtrlFrame ); | 80 | mPrevMonth = new QPushButton( mCtrlFrame ); |
81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); |
82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
83 | 83 | ||
84 | // Create forward navigation buttons | 84 | // Create forward navigation buttons |
85 | mNextMonth = new QPushButton( mCtrlFrame ); | 85 | mNextMonth = new QPushButton( mCtrlFrame ); |
86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); |
87 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 87 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
88 | 88 | ||
89 | mPrevWeek = new QPushButton( mCtrlFrame ); | 89 | mPrevWeek = new QPushButton( mCtrlFrame ); |
90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); | 91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); |
92 | 92 | ||
93 | // Create forward navigation buttons | 93 | // Create forward navigation buttons |
94 | mNextWeek = new QPushButton( mCtrlFrame ); | 94 | mNextWeek = new QPushButton( mCtrlFrame ); |
95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
96 | QToolTip::add( mNextWeek, i18n("Next Week") ); | 96 | QToolTip::add( mNextWeek, i18n("Next Week") ); |
97 | 97 | ||
98 | mNextYear = new QPushButton( mCtrlFrame ); | 98 | mNextYear = new QPushButton( mCtrlFrame ); |
99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") ); |
100 | QToolTip::add( mNextYear, i18n("Next Year") ); | 100 | QToolTip::add( mNextYear, i18n("Next Year") ); |
101 | mSelectMonth = new QPushButton( mCtrlFrame ); | 101 | mSelectMonth = new QPushButton( mCtrlFrame ); |
102 | // Create month name label | 102 | // Create month name label |
103 | //selectMonth->setFont( tfont ); | 103 | //selectMonth->setFont( tfont ); |
104 | // selectMonth->setAlignment( AlignCenter ); | 104 | // selectMonth->setAlignment( AlignCenter ); |
105 | //mDateLabel = new QLabel( selectMonth ); | 105 | //mDateLabel = new QLabel( selectMonth ); |
106 | //mDateLabel->setFont( tfont ); | 106 | //mDateLabel->setFont( tfont ); |
107 | //mDateLabel->setAlignment( AlignCenter ); | 107 | //mDateLabel->setAlignment( AlignCenter ); |
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 108 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 109 | mNextMonth->setFlat( true); |
110 | mNextWeek->setFlat( true); | 110 | mNextWeek->setFlat( true); |
111 | mNextYear->setFlat( true); | 111 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 112 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 113 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
115 | mPrevWeek->setFlat( true); | 115 | mPrevWeek->setFlat( true); |
116 | } else { | 116 | } else { |
117 | mPrevWeek->hide(); | 117 | mPrevWeek->hide(); |
118 | mNextWeek->hide(); | 118 | mNextWeek->hide(); |
119 | } | 119 | } |
120 | 120 | ||
121 | resetFont( font() ); | 121 | resetFont( font() ); |
122 | 122 | ||
123 | 123 | ||
124 | // set up control frame layout | 124 | // set up control frame layout |
125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
126 | ctrlLayout->addWidget( mPrevYear, 3 ); | 126 | ctrlLayout->addWidget( mPrevYear, 3 ); |
127 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 127 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
128 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 128 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
129 | //ctrlLayout->addStretch( 1 ); | 129 | //ctrlLayout->addStretch( 1 ); |
130 | // ctrlLayout->addSpacing( 1 ); | 130 | // ctrlLayout->addSpacing( 1 ); |
131 | // ctrlLayout->addWidget( mDateLabel ); | 131 | // ctrlLayout->addWidget( mDateLabel ); |
132 | ctrlLayout->addWidget( mSelectMonth ); | 132 | ctrlLayout->addWidget( mSelectMonth ); |
133 | // ctrlLayout->addSpacing( 1 ); | 133 | // ctrlLayout->addSpacing( 1 ); |
134 | // ctrlLayout->addStretch( 1 ); | 134 | // ctrlLayout->addStretch( 1 ); |
135 | ctrlLayout->addWidget( mNextWeek, 3 ); | 135 | ctrlLayout->addWidget( mNextWeek, 3 ); |
136 | ctrlLayout->addWidget( mNextMonth, 3 ); | 136 | ctrlLayout->addWidget( mNextMonth, 3 ); |
137 | ctrlLayout->addWidget( mNextYear, 3 ); | 137 | ctrlLayout->addWidget( mNextYear, 3 ); |
138 | 138 | ||
139 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 139 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
140 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 140 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
141 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 141 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
142 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | 142 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); |
143 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | 143 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); |
144 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 144 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
145 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 145 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
146 | mPrevYear->setFocusPolicy(NoFocus); | 146 | mPrevYear->setFocusPolicy(NoFocus); |
147 | mPrevMonth->setFocusPolicy(NoFocus); | 147 | mPrevMonth->setFocusPolicy(NoFocus); |
148 | mNextMonth->setFocusPolicy(NoFocus); | 148 | mNextMonth->setFocusPolicy(NoFocus); |
149 | mPrevWeek->setFocusPolicy(NoFocus); | 149 | mPrevWeek->setFocusPolicy(NoFocus); |
150 | mNextWeek->setFocusPolicy(NoFocus); | 150 | mNextWeek->setFocusPolicy(NoFocus); |
151 | mNextYear->setFocusPolicy(NoFocus); | 151 | mNextYear->setFocusPolicy(NoFocus); |
152 | mSelectMonth->setFocusPolicy(NoFocus); | 152 | mSelectMonth->setFocusPolicy(NoFocus); |
153 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 153 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | NavigatorBar::~NavigatorBar() | 157 | NavigatorBar::~NavigatorBar() |
158 | { | 158 | { |
159 | } | 159 | } |
160 | QSize NavigatorBar::sizeHint() const | 160 | QSize NavigatorBar::sizeHint() const |
161 | { | 161 | { |
162 | int wid = mCurrentMinWid ; | 162 | int wid = mCurrentMinWid ; |
163 | if ( mPrevYear->isVisible() ) | 163 | if ( mPrevYear->isVisible() ) |
164 | wid += mCurrentButtonMinWid; | 164 | wid += mCurrentButtonMinWid; |
165 | if ( mPrevMonth->isVisible() ) | 165 | if ( mPrevMonth->isVisible() ) |
166 | wid += mCurrentButtonMinWid; | 166 | wid += mCurrentButtonMinWid; |
167 | if ( mPrevWeek->isVisible() ) | 167 | if ( mPrevWeek->isVisible() ) |
168 | wid += mCurrentButtonMinWid; | 168 | wid += mCurrentButtonMinWid; |
169 | if ( mNextMonth->isVisible() ) | 169 | if ( mNextMonth->isVisible() ) |
170 | wid += mCurrentButtonMinWid; | 170 | wid += mCurrentButtonMinWid; |
171 | if ( mNextWeek->isVisible() ) | 171 | if ( mNextWeek->isVisible() ) |
172 | wid += mCurrentButtonMinWid; | 172 | wid += mCurrentButtonMinWid; |
173 | if ( mNextYear->isVisible() ) | 173 | if ( mNextYear->isVisible() ) |
174 | wid += mCurrentButtonMinWid; | 174 | wid += mCurrentButtonMinWid; |
175 | //qDebug("ret %d %d ", wid, mCurrentHei); | 175 | //qDebug("ret %d %d ", wid, mCurrentHei); |
176 | return QSize ( wid, mCurrentHei ); | 176 | return QSize ( wid, mCurrentHei ); |
177 | } | 177 | } |
178 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const | 178 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const |
179 | { | 179 | { |
180 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); | 180 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); |
181 | } | 181 | } |
182 | void NavigatorBar::resetFont ( QFont fo ) | 182 | void NavigatorBar::resetFont ( QFont fo ) |
183 | { | 183 | { |
184 | 184 | ||
185 | QFont tfont = fo; | 185 | QFont tfont = fo; |
186 | if ( QApplication::desktop()->width() >= 480 ) | 186 | if ( QApplication::desktop()->width() >= 480 ) |
187 | tfont.setPointSize(tfont.pointSize()+2); | 187 | tfont.setPointSize(tfont.pointSize()+2); |
188 | tfont.setBold(true); | 188 | tfont.setBold(true); |
189 | 189 | ||
190 | mSelectMonth->setFont( tfont ); | 190 | mSelectMonth->setFont( tfont ); |
191 | // Set minimum width to width of widest month name label | 191 | // Set minimum width to width of widest month name label |
192 | int i; | 192 | int i; |
193 | int maxwidth = 0; | 193 | int maxwidth = 0; |
194 | QFontMetrics fm ( mSelectMonth->font() ); | 194 | QFontMetrics fm ( mSelectMonth->font() ); |
195 | int width = fm.width("September '00" ); | 195 | int width = fm.width("September '00" ); |
196 | maxwidth = width+2; | 196 | maxwidth = width+2; |
197 | int size = fm.height()+2; | 197 | int size = fm.height()+2; |
198 | if ( QApplication::desktop()->width() >= 480 ) { | 198 | if ( QApplication::desktop()->width() >= 480 ) { |
199 | size += 6; | 199 | size += 6; |
200 | maxwidth+= 6; | 200 | maxwidth+= 6; |
201 | } | 201 | } |
202 | mSelectMonth->setMinimumWidth( maxwidth ); | 202 | mSelectMonth->setMinimumWidth( maxwidth ); |
203 | mSelectMonth->setFixedHeight( size ); | 203 | mSelectMonth->setFixedHeight( size ); |
204 | mPrevYear->setFixedHeight( size ); | 204 | mPrevYear->setFixedHeight( size ); |
205 | mPrevMonth->setFixedHeight( size ); | 205 | mPrevMonth->setFixedHeight( size ); |
206 | mPrevWeek->setFixedHeight( size ); | 206 | mPrevWeek->setFixedHeight( size ); |
207 | mNextMonth->setFixedHeight( size ); | 207 | mNextMonth->setFixedHeight( size ); |
208 | mNextWeek->setFixedHeight( size ); | 208 | mNextWeek->setFixedHeight( size ); |
209 | mNextYear->setFixedHeight ( size ); | 209 | mNextYear->setFixedHeight ( size ); |
210 | mCurrentHei = size +2; | 210 | mCurrentHei = size +2; |
211 | mCurrentMinWid = maxwidth+2; | 211 | mCurrentMinWid = maxwidth+2; |
212 | mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; | 212 | mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; |
213 | } | 213 | } |
214 | 214 | ||
215 | void NavigatorBar::showButtons( bool left, bool right ) | 215 | void NavigatorBar::showButtons( bool left, bool right ) |
216 | { | 216 | { |
217 | if ( left ) { | 217 | if ( left ) { |
218 | mPrevYear->show(); | 218 | mPrevYear->show(); |
219 | mPrevMonth->show(); | 219 | mPrevMonth->show(); |
220 | } else { | 220 | } else { |
221 | mPrevYear->hide(); | 221 | mPrevYear->hide(); |
222 | mPrevMonth->hide(); | 222 | mPrevMonth->hide(); |
223 | } | 223 | } |
224 | 224 | ||
225 | if ( right ) { | 225 | if ( right ) { |
226 | mNextYear->show(); | 226 | mNextYear->show(); |
227 | mNextMonth->show(); | 227 | mNextMonth->show(); |