author | zautrix <zautrix> | 2005-02-06 01:23:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 01:23:43 (UTC) |
commit | 118f5aab05c9ace5612d5c4fd69e7c5a59bed67b (patch) (unidiff) | |
tree | e097f3fecb6e2ae692b91ac29e58e6d5a51154c8 /korganizer | |
parent | 659f07aa44f44aebb74c83e7319021cfeb87f275 (diff) | |
download | kdepimpi-118f5aab05c9ace5612d5c4fd69e7c5a59bed67b.zip kdepimpi-118f5aab05c9ace5612d5c4fd69e7c5a59bed67b.tar.gz kdepimpi-118f5aab05c9ace5612d5c4fd69e7c5a59bed67b.tar.bz2 |
better week choose
-rw-r--r-- | korganizer/koagendaview.cpp | 72 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 62 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 7 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 39 |
5 files changed, 71 insertions, 110 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 36c66ea..0d36946 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -364,158 +364,129 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
365 | } else { | 365 | } else { |
366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
368 | } | 368 | } |
369 | 369 | ||
370 | QBoxLayout *topLayout = new QVBoxLayout(this); | 370 | QBoxLayout *topLayout = new QVBoxLayout(this); |
371 | 371 | ||
372 | // Create day name labels for agenda columns | 372 | // Create day name labels for agenda columns |
373 | mDayLabelsFrame = new QHBox(this); | 373 | mDayLabelsFrame = new QHBox(this); |
374 | topLayout->addWidget(mDayLabelsFrame); | 374 | topLayout->addWidget(mDayLabelsFrame); |
375 | mDayLabels = new QFrame (mDayLabelsFrame); | 375 | mDayLabels = new QFrame (mDayLabelsFrame); |
376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
377 | // Create agenda splitter | 377 | // Create agenda splitter |
378 | #ifndef KORG_NOSPLITTER | 378 | #ifndef KORG_NOSPLITTER |
379 | mSplitterAgenda = new QSplitter(Vertical,this); | 379 | mSplitterAgenda = new QSplitter(Vertical,this); |
380 | topLayout->addWidget(mSplitterAgenda); | 380 | topLayout->addWidget(mSplitterAgenda); |
381 | mSplitterAgenda->setOpaqueResize(); | 381 | mSplitterAgenda->setOpaqueResize(); |
382 | 382 | ||
383 | mAllDayFrame = new QHBox(mSplitterAgenda); | 383 | mAllDayFrame = new QHBox(mSplitterAgenda); |
384 | 384 | ||
385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
386 | #else | 386 | #else |
387 | #if 0 | 387 | #if 0 |
388 | QWidget *mainBox = new QWidget( this ); | 388 | QWidget *mainBox = new QWidget( this ); |
389 | topLayout->addWidget( mainBox ); | 389 | topLayout->addWidget( mainBox ); |
390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
391 | mAllDayFrame = new QHBox(mainBox); | 391 | mAllDayFrame = new QHBox(mainBox); |
392 | mainLayout->addWidget(mAllDayFrame); | 392 | mainLayout->addWidget(mAllDayFrame); |
393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
394 | mAllDayFrame->setFocusPolicy(NoFocus); | 394 | mAllDayFrame->setFocusPolicy(NoFocus); |
395 | QWidget *agendaFrame = new QWidget(mainBox); | 395 | QWidget *agendaFrame = new QWidget(mainBox); |
396 | mainLayout->addWidget(agendaFrame); | 396 | mainLayout->addWidget(agendaFrame); |
397 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 397 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
398 | 398 | ||
399 | agendaFrame->setFocusPolicy(NoFocus); | 399 | agendaFrame->setFocusPolicy(NoFocus); |
400 | #endif | 400 | #endif |
401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
403 | topLayout->addWidget( mSplitterAgenda ); | 403 | topLayout->addWidget( mSplitterAgenda ); |
404 | mAllDayFrame = new QHBox(mSplitterAgenda); | 404 | mAllDayFrame = new QHBox(mSplitterAgenda); |
405 | mAllDayFrame->setFocusPolicy(NoFocus); | 405 | mAllDayFrame->setFocusPolicy(NoFocus); |
406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
407 | agendaFrame->setFocusPolicy(NoFocus); | 407 | agendaFrame->setFocusPolicy(NoFocus); |
408 | 408 | ||
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | // Create all-day agenda widget | 411 | // Create all-day agenda widget |
412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
413 | 413 | ||
414 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 414 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
415 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 415 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
416 | int widebut = mExpandButton->sizeHint().width(); | 416 | int widebut = mExpandButton->sizeHint().width(); |
417 | if ( QApplication::desktop()->width() < 480 ) | 417 | if ( QApplication::desktop()->width() < 480 ) |
418 | widebut = widebut*2; | 418 | widebut = widebut*2; |
419 | else | 419 | else |
420 | widebut = (widebut*3) / 2; | 420 | widebut = (widebut*3) / 2; |
421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
422 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
423 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
425 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
427 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); | 428 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
429 | |||
430 | mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); | ||
431 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); | ||
432 | new QLabel ( dummyAllDayRight ); | ||
433 | mDummyAllDayRightL->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,QSizePolicy::Fixed ) ); | ||
434 | dummyAllDayRightB->setFlat( true ); | ||
435 | dummyAllDayRightB->setFocusPolicy(NoFocus); | ||
436 | dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); | ||
437 | |||
438 | QPopupMenu * wpo = new QPopupMenu (this); | ||
439 | QPopupMenu * all = new QPopupMenu (this); | ||
440 | //wpo->insertItem( i18n("W#"), 0 ); | ||
441 | int first = 1; | ||
442 | int i; | ||
443 | for ( i = 1; i < 50; ++i ) { | ||
444 | if ( !(i%10) ) { | ||
445 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
446 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | ||
447 | first = i; | ||
448 | wpo = new QPopupMenu (this); | ||
449 | } | ||
450 | wpo->insertItem( QString::number(i), i ); | ||
451 | } | ||
452 | for ( i = 50; i < 53; ++i ) { | ||
453 | wpo->insertItem( QString::number(i), i); | ||
454 | } | ||
455 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
456 | dummyAllDayRightB->setPopup( all ); | ||
457 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | ||
458 | 429 | ||
459 | // Create event context menu for all day agenda | 430 | // Create event context menu for all day agenda |
460 | mAllDayAgendaPopup = eventPopup(); | 431 | mAllDayAgendaPopup = eventPopup(); |
461 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 432 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
462 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 433 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
463 | 434 | ||
464 | // Create agenda frame | 435 | // Create agenda frame |
465 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 436 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
466 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 437 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
467 | 438 | ||
468 | // create event indicator bars | 439 | // create event indicator bars |
469 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 440 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
470 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 441 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
471 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 442 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
472 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 443 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
473 | agendaFrame); | 444 | agendaFrame); |
474 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 445 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
475 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 446 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
476 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 447 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
477 | 448 | ||
478 | // Create time labels | 449 | // Create time labels |
479 | mTimeLabels = new TimeLabels(24,agendaFrame); | 450 | mTimeLabels = new TimeLabels(24,agendaFrame); |
480 | agendaLayout->addWidget(mTimeLabels,1,0); | 451 | agendaLayout->addWidget(mTimeLabels,1,0); |
481 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 452 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
482 | this,SLOT(updateConfig())); | 453 | this,SLOT(updateConfig())); |
483 | 454 | ||
484 | // Create agenda | 455 | // Create agenda |
485 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 456 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
486 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 457 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
487 | agendaLayout->setColStretch(1,1); | 458 | agendaLayout->setColStretch(1,1); |
488 | mAgenda->setFocusPolicy(NoFocus); | 459 | mAgenda->setFocusPolicy(NoFocus); |
489 | // Create event context menu for agenda | 460 | // Create event context menu for agenda |
490 | mAgendaPopup = eventPopup(); | 461 | mAgendaPopup = eventPopup(); |
491 | 462 | ||
492 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 463 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
493 | i18n("Toggle Alarm"),mAgenda, | 464 | i18n("Toggle Alarm"),mAgenda, |
494 | SLOT(popupAlarm()),true); | 465 | SLOT(popupAlarm()),true); |
495 | 466 | ||
496 | 467 | ||
497 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 468 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
498 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 469 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
499 | 470 | ||
500 | // make connections between dependent widgets | 471 | // make connections between dependent widgets |
501 | mTimeLabels->setAgenda(mAgenda); | 472 | mTimeLabels->setAgenda(mAgenda); |
502 | 473 | ||
503 | // Update widgets to reflect user preferences | 474 | // Update widgets to reflect user preferences |
504 | // updateConfig(); | 475 | // updateConfig(); |
505 | 476 | ||
506 | // createDayLabels(); | 477 | // createDayLabels(); |
507 | 478 | ||
508 | // these blank widgets make the All Day Event box line up with the agenda | 479 | // these blank widgets make the All Day Event box line up with the agenda |
509 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 480 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
510 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 481 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
511 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 482 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
512 | 483 | ||
513 | // Scrolling | 484 | // Scrolling |
514 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 485 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
515 | mTimeLabels, SLOT(positionChanged())); | 486 | mTimeLabels, SLOT(positionChanged())); |
516 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 487 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
517 | SLOT(setContentsPos(int))); | 488 | SLOT(setContentsPos(int))); |
518 | 489 | ||
519 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 490 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
520 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 491 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
521 | 492 | ||
@@ -526,142 +497,129 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
526 | SLOT(newTodo(int,int))); | 497 | SLOT(newTodo(int,int))); |
527 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 498 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
528 | SLOT(newEvent(int,int,int,int))); | 499 | SLOT(newEvent(int,int,int,int))); |
529 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 500 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
530 | SLOT(newEventAllDay(int,int))); | 501 | SLOT(newEventAllDay(int,int))); |
531 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 502 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
532 | SLOT(newTodoAllDay(int,int))); | 503 | SLOT(newTodoAllDay(int,int))); |
533 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 504 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
534 | SLOT(newEventAllDay(int,int))); | 505 | SLOT(newEventAllDay(int,int))); |
535 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 506 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
536 | SLOT(newTimeSpanSelected(int,int,int,int))); | 507 | SLOT(newTimeSpanSelected(int,int,int,int))); |
537 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 508 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
538 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 509 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
539 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 510 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
540 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 511 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
541 | 512 | ||
542 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 513 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
543 | SIGNAL(editIncidenceSignal(Incidence *))); | 514 | SIGNAL(editIncidenceSignal(Incidence *))); |
544 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 515 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
545 | SIGNAL(editIncidenceSignal(Incidence *))); | 516 | SIGNAL(editIncidenceSignal(Incidence *))); |
546 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 517 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
547 | SIGNAL(showIncidenceSignal(Incidence *))); | 518 | SIGNAL(showIncidenceSignal(Incidence *))); |
548 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 519 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
549 | SIGNAL(showIncidenceSignal(Incidence *))); | 520 | SIGNAL(showIncidenceSignal(Incidence *))); |
550 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 521 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
551 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 522 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
552 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 523 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
553 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 524 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
554 | 525 | ||
555 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 526 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
556 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 527 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
557 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 528 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
558 | SLOT(updateEventDates(KOAgendaItem *, int))); | 529 | SLOT(updateEventDates(KOAgendaItem *, int))); |
559 | 530 | ||
560 | // event indicator update | 531 | // event indicator update |
561 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 532 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
562 | SLOT(updateEventIndicatorTop(int))); | 533 | SLOT(updateEventIndicatorTop(int))); |
563 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 534 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
564 | SLOT(updateEventIndicatorBottom(int))); | 535 | SLOT(updateEventIndicatorBottom(int))); |
565 | // drag signals | 536 | // drag signals |
566 | /* | 537 | /* |
567 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 538 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
568 | SLOT(startDrag(Event *))); | 539 | SLOT(startDrag(Event *))); |
569 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 540 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
570 | SLOT(startDrag(Event *))); | 541 | SLOT(startDrag(Event *))); |
571 | */ | 542 | */ |
572 | // synchronize selections | 543 | // synchronize selections |
573 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 544 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
574 | mAllDayAgenda, SLOT( deselectItem() ) ); | 545 | mAllDayAgenda, SLOT( deselectItem() ) ); |
575 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 546 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
576 | mAgenda, SLOT( deselectItem() ) ); | 547 | mAgenda, SLOT( deselectItem() ) ); |
577 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 548 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
578 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 549 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
579 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 550 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
580 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 551 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
581 | connect( mAgenda, SIGNAL( resizedSignal() ), | 552 | connect( mAgenda, SIGNAL( resizedSignal() ), |
582 | SLOT( updateConfig( ) ) ); | 553 | SLOT( updateConfig( ) ) ); |
583 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 554 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
584 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 555 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
585 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 556 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
586 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 557 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
587 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 558 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
588 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 559 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
589 | 560 | ||
590 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 561 | |
591 | QFontMetrics fm ( dlf ); | ||
592 | QString dayTest = "30"; | ||
593 | int wid = fm.width( dayTest ); | ||
594 | int maxWid = dummyAllDayRight->width()-2; | ||
595 | int fontPoint = dlf.pointSize(); | ||
596 | while ( wid > maxWid ) { | ||
597 | --fontPoint; | ||
598 | dlf.setPointSize( fontPoint ); | ||
599 | QFontMetrics f( dlf ); | ||
600 | wid = f.width( dayTest ); | ||
601 | } | ||
602 | mDummyAllDayRightL->setFont( dlf ); | ||
603 | mDummyAllDayRightL->setAlignment( AlignHCenter ); | ||
604 | } | 562 | } |
605 | 563 | ||
606 | void KOAgendaView::toggleAllDay() | 564 | void KOAgendaView::toggleAllDay() |
607 | { | 565 | { |
608 | if ( mSplitterAgenda->firstHandle() ) | 566 | if ( mSplitterAgenda->firstHandle() ) |
609 | mSplitterAgenda->firstHandle()->toggle(); | 567 | mSplitterAgenda->firstHandle()->toggle(); |
610 | } | 568 | } |
611 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 569 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
612 | { | 570 | { |
613 | calendar()->addIncidence( inc ); | 571 | calendar()->addIncidence( inc ); |
614 | 572 | ||
615 | if ( incOld ) { | 573 | if ( incOld ) { |
616 | if ( incOld->type() == "Todo" ) | 574 | if ( incOld->type() == "Todo" ) |
617 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 575 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
618 | else | 576 | else |
619 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 577 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
620 | } | 578 | } |
621 | 579 | ||
622 | } | 580 | } |
623 | 581 | ||
624 | KOAgendaView::~KOAgendaView() | 582 | KOAgendaView::~KOAgendaView() |
625 | { | 583 | { |
626 | delete mAgendaPopup; | 584 | delete mAgendaPopup; |
627 | delete mAllDayAgendaPopup; | 585 | delete mAllDayAgendaPopup; |
628 | delete KOAgendaItem::paintPix(); | 586 | delete KOAgendaItem::paintPix(); |
629 | delete KOAgendaItem::paintPixSel(); | 587 | delete KOAgendaItem::paintPixSel(); |
630 | } | 588 | } |
631 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 589 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
632 | { | 590 | { |
633 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 591 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
634 | bool uc = false; | 592 | bool uc = false; |
635 | int ow = e->oldSize().width(); | 593 | int ow = e->oldSize().width(); |
636 | int oh = e->oldSize().height(); | 594 | int oh = e->oldSize().height(); |
637 | int w = e->size().width(); | 595 | int w = e->size().width(); |
638 | int h = e->size().height(); | 596 | int h = e->size().height(); |
639 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 597 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
640 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 598 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
641 | uc = true; | 599 | uc = true; |
642 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 600 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
643 | } | 601 | } |
644 | mUpcomingWidth = e->size().width() ; | 602 | mUpcomingWidth = e->size().width() ; |
645 | if ( mBlockUpdating || uc ) { | 603 | if ( mBlockUpdating || uc ) { |
646 | mBlockUpdating = false; | 604 | mBlockUpdating = false; |
647 | //mAgenda->setMinimumSize(800 , 600 ); | 605 | //mAgenda->setMinimumSize(800 , 600 ); |
648 | //qDebug("mAgenda->resize+++++++++++++++ "); | 606 | //qDebug("mAgenda->resize+++++++++++++++ "); |
649 | updateConfig(); | 607 | updateConfig(); |
650 | //qDebug("KOAgendaView::Updating now possible "); | 608 | //qDebug("KOAgendaView::Updating now possible "); |
651 | } else | 609 | } else |
652 | createDayLabels(); | 610 | createDayLabels(); |
653 | //qDebug("resizeEvent end "); | 611 | //qDebug("resizeEvent end "); |
654 | 612 | ||
655 | } | 613 | } |
656 | void KOAgendaView::slotDaylabelClicked( int num ) | 614 | void KOAgendaView::slotDaylabelClicked( int num ) |
657 | { | 615 | { |
658 | 616 | ||
659 | QDate firstDate = mSelectedDates.first(); | 617 | QDate firstDate = mSelectedDates.first(); |
660 | if ( num == -1 ) | 618 | if ( num == -1 ) |
661 | emit showDateView( 6, firstDate ); | 619 | emit showDateView( 6, firstDate ); |
662 | else if (num >= 0 ) { | 620 | else if (num >= 0 ) { |
663 | if ( mSelectedDates.count() == 1) | 621 | if ( mSelectedDates.count() == 1) |
664 | emit showDateView( 9, firstDate.addDays( num ) ); | 622 | emit showDateView( 9, firstDate.addDays( num ) ); |
665 | else | 623 | else |
666 | emit showDateView( 3, firstDate.addDays( num ) ); | 624 | emit showDateView( 3, firstDate.addDays( num ) ); |
667 | } | 625 | } |
@@ -1047,154 +1005,128 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | |||
1047 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1005 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1048 | item->setItemDate(startDt.date()); | 1006 | item->setItemDate(startDt.date()); |
1049 | //item->updateItem(); | 1007 | //item->updateItem(); |
1050 | if ( item->incidence()->type() == "Todo" ) { | 1008 | if ( item->incidence()->type() == "Todo" ) { |
1051 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1009 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1052 | 1010 | ||
1053 | } | 1011 | } |
1054 | else | 1012 | else |
1055 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1013 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1056 | item->updateItem(); | 1014 | item->updateItem(); |
1057 | } | 1015 | } |
1058 | 1016 | ||
1059 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1017 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1060 | { | 1018 | { |
1061 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1019 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1062 | 1020 | ||
1063 | mSelectedDates.clear(); | 1021 | mSelectedDates.clear(); |
1064 | // qDebug("KOAgendaView::showDates "); | 1022 | // qDebug("KOAgendaView::showDates "); |
1065 | QDate d = start; | 1023 | QDate d = start; |
1066 | while (d <= end) { | 1024 | while (d <= end) { |
1067 | mSelectedDates.append(d); | 1025 | mSelectedDates.append(d); |
1068 | d = d.addDays( 1 ); | 1026 | d = d.addDays( 1 ); |
1069 | } | 1027 | } |
1070 | 1028 | ||
1071 | // and update the view | 1029 | // and update the view |
1072 | fillAgenda(); | 1030 | fillAgenda(); |
1073 | } | 1031 | } |
1074 | 1032 | ||
1075 | 1033 | ||
1076 | void KOAgendaView::showEvents(QPtrList<Event>) | 1034 | void KOAgendaView::showEvents(QPtrList<Event>) |
1077 | { | 1035 | { |
1078 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1036 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1079 | } | 1037 | } |
1080 | 1038 | ||
1081 | void KOAgendaView::changeEventDisplay(Event *, int) | 1039 | void KOAgendaView::changeEventDisplay(Event *, int) |
1082 | { | 1040 | { |
1083 | // qDebug("KOAgendaView::changeEventDisplay "); | 1041 | // qDebug("KOAgendaView::changeEventDisplay "); |
1084 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1042 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1085 | // this should be re-written to be MUCH smarter. Right now we | 1043 | // this should be re-written to be MUCH smarter. Right now we |
1086 | // are just playing dumb. | 1044 | // are just playing dumb. |
1087 | fillAgenda(); | 1045 | fillAgenda(); |
1088 | } | 1046 | } |
1089 | 1047 | ||
1090 | void KOAgendaView::fillAgenda(const QDate &) | 1048 | void KOAgendaView::fillAgenda(const QDate &) |
1091 | { | 1049 | { |
1092 | // qDebug("KOAgendaView::fillAgenda "); | 1050 | // qDebug("KOAgendaView::fillAgenda "); |
1093 | fillAgenda(); | 1051 | fillAgenda(); |
1094 | } | 1052 | } |
1095 | 1053 | ||
1096 | void KOAgendaView::fillAgenda() | 1054 | void KOAgendaView::fillAgenda() |
1097 | { | 1055 | { |
1098 | if ( globalFlagBlockStartup ) | 1056 | if ( globalFlagBlockStartup ) |
1099 | return; | 1057 | return; |
1100 | if ( globalFlagBlockAgenda == 1 ) | 1058 | if ( globalFlagBlockAgenda == 1 ) |
1101 | return; | 1059 | return; |
1102 | //if ( globalFlagBlockAgenda == 2 ) | 1060 | //if ( globalFlagBlockAgenda == 2 ) |
1103 | //globalFlagBlockAgenda = 0; | 1061 | //globalFlagBlockAgenda = 0; |
1104 | // globalFlagBlockPainting = false; | 1062 | // globalFlagBlockPainting = false; |
1105 | if ( globalFlagBlockAgenda == 0 ) | 1063 | if ( globalFlagBlockAgenda == 0 ) |
1106 | globalFlagBlockAgenda = 1; | 1064 | globalFlagBlockAgenda = 1; |
1107 | // clearView(); | 1065 | // clearView(); |
1108 | //qDebug("fillAgenda()++++ "); | 1066 | //qDebug("fillAgenda()++++ "); |
1109 | globalFlagBlockAgendaItemPaint = 1; | 1067 | globalFlagBlockAgendaItemPaint = 1; |
1110 | 1068 | ||
1111 | int weekNum = 0; | ||
1112 | QDate seda = mSelectedDates.first(); | ||
1113 | QDate d = QDate ( seda.year(), 1,1); | ||
1114 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1115 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1116 | if ( seda.year() != d.year() ) { | ||
1117 | if ( d.dayOfWeek() > 4 ) | ||
1118 | d = QDate ( seda.year(), 1,1); | ||
1119 | else | ||
1120 | weekNum = 1; | ||
1121 | } else { | ||
1122 | QDate dd( seda.year()+1, 1,1); | ||
1123 | if ( dd.dayOfWeek() <= 4 ) | ||
1124 | weekNum = 1; | ||
1125 | } | ||
1126 | } | ||
1127 | if ( weekNum == 0 ){ | ||
1128 | int dow = d.dayOfWeek(); | ||
1129 | if ( dow <= 4 ) | ||
1130 | d = d.addDays( 1-dow ); | ||
1131 | else // 5,6,7 | ||
1132 | d = d.addDays( 8-dow ); | ||
1133 | // we have the first week of the year.we are on monday | ||
1134 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1135 | } | ||
1136 | mDummyAllDayRightL->setText( QString::number( weekNum) ); | ||
1137 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1069 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1138 | mAgenda->changeColumns(mSelectedDates.count()); | 1070 | mAgenda->changeColumns(mSelectedDates.count()); |
1139 | qApp->processEvents(); | 1071 | qApp->processEvents(); |
1140 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1072 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1141 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1073 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1142 | setHolidayMasks(); | 1074 | setHolidayMasks(); |
1143 | 1075 | ||
1144 | //mAgenda->hideUnused(); | 1076 | //mAgenda->hideUnused(); |
1145 | //mAllDayAgenda->hideUnused(); | 1077 | //mAllDayAgenda->hideUnused(); |
1146 | 1078 | ||
1147 | // mAgenda->blockNextRepaint( false ); | 1079 | // mAgenda->blockNextRepaint( false ); |
1148 | // mAgenda->viewport()->repaint(); | 1080 | // mAgenda->viewport()->repaint(); |
1149 | // mAgenda->blockNextRepaint( true ); | 1081 | // mAgenda->blockNextRepaint( true ); |
1150 | mMinY.resize(mSelectedDates.count()); | 1082 | mMinY.resize(mSelectedDates.count()); |
1151 | mMaxY.resize(mSelectedDates.count()); | 1083 | mMaxY.resize(mSelectedDates.count()); |
1152 | 1084 | ||
1153 | QPtrList<Event> dayEvents; | 1085 | QPtrList<Event> dayEvents; |
1154 | 1086 | ||
1155 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1087 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1156 | // Therefore, gtodoset all of them. | 1088 | // Therefore, gtodoset all of them. |
1157 | QPtrList<Todo> todos = calendar()->todos(); | 1089 | QPtrList<Todo> todos = calendar()->todos(); |
1158 | 1090 | ||
1159 | mAgenda->setDateList(mSelectedDates); | 1091 | mAgenda->setDateList(mSelectedDates); |
1160 | 1092 | ||
1161 | QDate today = QDate::currentDate(); | 1093 | QDate today = QDate::currentDate(); |
1162 | 1094 | ||
1163 | DateList::ConstIterator dit; | 1095 | DateList::ConstIterator dit; |
1164 | int curCol = 0; | 1096 | int curCol = 0; |
1165 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1097 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1166 | QDate currentDate = *dit; | 1098 | QDate currentDate = *dit; |
1167 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1099 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1168 | // << endl; | 1100 | // << endl; |
1169 | 1101 | ||
1170 | dayEvents = calendar()->events(currentDate,true); | 1102 | dayEvents = calendar()->events(currentDate,true); |
1171 | 1103 | ||
1172 | // Default values, which can never be reached | 1104 | // Default values, which can never be reached |
1173 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1105 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1174 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1106 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1175 | 1107 | ||
1176 | unsigned int numEvent; | 1108 | unsigned int numEvent; |
1177 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1109 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1178 | Event *event = dayEvents.at(numEvent); | 1110 | Event *event = dayEvents.at(numEvent); |
1179 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1111 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1180 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1112 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1181 | continue; | 1113 | continue; |
1182 | // kdDebug() << " Event: " << event->summary() << endl; | 1114 | // kdDebug() << " Event: " << event->summary() << endl; |
1183 | 1115 | ||
1184 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1116 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1185 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1117 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1186 | 1118 | ||
1187 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1119 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1188 | 1120 | ||
1189 | if (event->doesFloat()) { | 1121 | if (event->doesFloat()) { |
1190 | if (event->recurrence()->doesRecur()) { | 1122 | if (event->recurrence()->doesRecur()) { |
1191 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1123 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1192 | } else { | 1124 | } else { |
1193 | if (beginX <= 0 && curCol == 0) { | 1125 | if (beginX <= 0 && curCol == 0) { |
1194 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1126 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1195 | } else if (beginX == curCol) { | 1127 | } else if (beginX == curCol) { |
1196 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1128 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1197 | } | 1129 | } |
1198 | } | 1130 | } |
1199 | } else if (event->isMultiDay()) { | 1131 | } else if (event->isMultiDay()) { |
1200 | if ( event->doesRecur () ) { | 1132 | if ( event->doesRecur () ) { |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index ba9bc93..4a058ce 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -155,129 +155,128 @@ class KOAgendaView : public KOEventView { | |||
155 | /** Returns number of currently shown dates. */ | 155 | /** Returns number of currently shown dates. */ |
156 | virtual int currentDateCount(); | 156 | virtual int currentDateCount(); |
157 | 157 | ||
158 | /** returns the currently selected events */ | 158 | /** returns the currently selected events */ |
159 | virtual QPtrList<Incidence> selectedIncidences(); | 159 | virtual QPtrList<Incidence> selectedIncidences(); |
160 | 160 | ||
161 | /** returns the currently selected events */ | 161 | /** returns the currently selected events */ |
162 | virtual DateList selectedDates(); | 162 | virtual DateList selectedDates(); |
163 | 163 | ||
164 | /** Remove all events from view */ | 164 | /** Remove all events from view */ |
165 | void clearView(); | 165 | void clearView(); |
166 | KOAgenda *agenda() { return mAgenda;} | 166 | KOAgenda *agenda() { return mAgenda;} |
167 | virtual void printPreview(CalPrinter *calPrinter, | 167 | virtual void printPreview(CalPrinter *calPrinter, |
168 | const QDate &, const QDate &); | 168 | const QDate &, const QDate &); |
169 | 169 | ||
170 | /** start-datetime of selection */ | 170 | /** start-datetime of selection */ |
171 | QDateTime selectionStart() {return mTimeSpanBegin;} | 171 | QDateTime selectionStart() {return mTimeSpanBegin;} |
172 | /** end-datetime of selection */ | 172 | /** end-datetime of selection */ |
173 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 173 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
174 | /** returns true if selection is for whole day */ | 174 | /** returns true if selection is for whole day */ |
175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
176 | /** make selected start/end invalid */ | 176 | /** make selected start/end invalid */ |
177 | void deleteSelectedDateTime(); | 177 | void deleteSelectedDateTime(); |
178 | void repaintAgenda(); | 178 | void repaintAgenda(); |
179 | public slots: | 179 | public slots: |
180 | virtual void updateView(); | 180 | virtual void updateView(); |
181 | virtual void updateConfig(); | 181 | virtual void updateConfig(); |
182 | virtual void showDates(const QDate &start, const QDate &end); | 182 | virtual void showDates(const QDate &start, const QDate &end); |
183 | virtual void showEvents(QPtrList<Event> eventList); | 183 | virtual void showEvents(QPtrList<Event> eventList); |
184 | 184 | ||
185 | void updateTodo( Todo *, int ); | 185 | void updateTodo( Todo *, int ); |
186 | void changeEventDisplay(Event *, int); | 186 | void changeEventDisplay(Event *, int); |
187 | 187 | ||
188 | void clearSelection(); | 188 | void clearSelection(); |
189 | 189 | ||
190 | void newTodo(int gx,int gy); | 190 | void newTodo(int gx,int gy); |
191 | void newEvent(int gx,int gy); | 191 | void newEvent(int gx,int gy); |
192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
193 | void newEventAllDay(int gx, int gy); | 193 | void newEventAllDay(int gx, int gy); |
194 | void newTodoAllDay(int gx, int gy); | 194 | void newTodoAllDay(int gx, int gy); |
195 | 195 | ||
196 | void startDrag(Event *); | 196 | void startDrag(Event *); |
197 | 197 | ||
198 | void readSettings(); | 198 | void readSettings(); |
199 | void readSettings(KConfig *); | 199 | void readSettings(KConfig *); |
200 | void writeSettings(KConfig *); | 200 | void writeSettings(KConfig *); |
201 | 201 | ||
202 | void setContentsPos(int y); | 202 | void setContentsPos(int y); |
203 | 203 | ||
204 | void setExpandedButton( bool expanded ); | 204 | void setExpandedButton( bool expanded ); |
205 | void scrollOneHourUp(); | 205 | void scrollOneHourUp(); |
206 | void scrollOneHourDown(); | 206 | void scrollOneHourDown(); |
207 | void addToCalSlot(Incidence *, Incidence *); | 207 | void addToCalSlot(Incidence *, Incidence *); |
208 | 208 | ||
209 | signals: | 209 | signals: |
210 | void showDateView( int, QDate ); | 210 | void showDateView( int, QDate ); |
211 | void newTodoSignal( QDateTime ,bool ); | 211 | void newTodoSignal( QDateTime ,bool ); |
212 | void toggleExpand(); | 212 | void toggleExpand(); |
213 | void selectWeekNum( int ); | 213 | void selectWeekNum( int ); |
214 | void todoMoved( Todo *, int ); | 214 | void todoMoved( Todo *, int ); |
215 | void incidenceChanged(Incidence * , int ); | 215 | void incidenceChanged(Incidence * , int ); |
216 | // void cloneIncidenceSignal(Incidence *); | 216 | // void cloneIncidenceSignal(Incidence *); |
217 | 217 | ||
218 | protected: | 218 | protected: |
219 | QLabel * mDummyAllDayRightL; | ||
220 | KOAgendaButton* getNewDaylabel(); | 219 | KOAgendaButton* getNewDaylabel(); |
221 | bool mBlockUpdating; | 220 | bool mBlockUpdating; |
222 | int mUpcomingWidth; | 221 | int mUpcomingWidth; |
223 | /** Fill agenda beginning with date startDate */ | 222 | /** Fill agenda beginning with date startDate */ |
224 | void fillAgenda(const QDate &startDate); | 223 | void fillAgenda(const QDate &startDate); |
225 | void resizeEvent( QResizeEvent* e ); | 224 | void resizeEvent( QResizeEvent* e ); |
226 | /** Fill agenda using the current set value for the start date */ | 225 | /** Fill agenda using the current set value for the start date */ |
227 | void fillAgenda(); | 226 | void fillAgenda(); |
228 | 227 | ||
229 | /** Create labels for the selected dates. */ | 228 | /** Create labels for the selected dates. */ |
230 | void createDayLabels(); | 229 | void createDayLabels(); |
231 | 230 | ||
232 | /** | 231 | /** |
233 | Set the masks on the agenda widgets indicating, which days are holidays. | 232 | Set the masks on the agenda widgets indicating, which days are holidays. |
234 | */ | 233 | */ |
235 | void setHolidayMasks(); | 234 | void setHolidayMasks(); |
236 | 235 | ||
237 | protected slots: | 236 | protected slots: |
238 | void slotDaylabelClicked( int ); | 237 | void slotDaylabelClicked( int ); |
239 | /** Update event belonging to agenda item */ | 238 | /** Update event belonging to agenda item */ |
240 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 239 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
241 | //void updateMovedTodo(); | 240 | //void updateMovedTodo(); |
242 | 241 | ||
243 | void updateEventIndicatorTop(int newY); | 242 | void updateEventIndicatorTop(int newY); |
244 | void updateEventIndicatorBottom(int newY); | 243 | void updateEventIndicatorBottom(int newY); |
245 | 244 | ||
246 | /** Updates data for selected timespan */ | 245 | /** Updates data for selected timespan */ |
247 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 246 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
248 | /** Updates data for selected timespan for all day event*/ | 247 | /** Updates data for selected timespan for all day event*/ |
249 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 248 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
250 | 249 | ||
251 | private: | 250 | private: |
252 | // view widgets | 251 | // view widgets |
253 | QFrame *mDayLabels; | 252 | QFrame *mDayLabels; |
254 | QHBox *mDayLabelsFrame; | 253 | QHBox *mDayLabelsFrame; |
255 | QBoxLayout *mLayoutDayLabels; | 254 | QBoxLayout *mLayoutDayLabels; |
256 | QFrame *mAllDayFrame; | 255 | QFrame *mAllDayFrame; |
257 | KOAgenda *mAllDayAgenda; | 256 | KOAgenda *mAllDayAgenda; |
258 | KOAgenda *mAgenda; | 257 | KOAgenda *mAgenda; |
259 | TimeLabels *mTimeLabels; | 258 | TimeLabels *mTimeLabels; |
260 | QWidget *mDummyAllDayLeft; | 259 | QWidget *mDummyAllDayLeft; |
261 | 260 | ||
262 | KDGanttMinimizeSplitter* mSplitterAgenda; | 261 | KDGanttMinimizeSplitter* mSplitterAgenda; |
263 | QPushButton *mExpandButton; | 262 | QPushButton *mExpandButton; |
264 | 263 | ||
265 | DateList mSelectedDates; // List of dates to be displayed | 264 | DateList mSelectedDates; // List of dates to be displayed |
266 | int mViewType; | 265 | int mViewType; |
267 | 266 | ||
268 | bool mWeekStartsMonday; | 267 | bool mWeekStartsMonday; |
269 | int mStartHour; | 268 | int mStartHour; |
270 | 269 | ||
271 | KOEventPopupMenu *mAgendaPopup; | 270 | KOEventPopupMenu *mAgendaPopup; |
272 | KOEventPopupMenu *mAllDayAgendaPopup; | 271 | KOEventPopupMenu *mAllDayAgendaPopup; |
273 | 272 | ||
274 | EventIndicator *mEventIndicatorTop; | 273 | EventIndicator *mEventIndicatorTop; |
275 | EventIndicator *mEventIndicatorBottom; | 274 | EventIndicator *mEventIndicatorBottom; |
276 | 275 | ||
277 | QMemArray<int> mMinY; | 276 | QMemArray<int> mMinY; |
278 | QMemArray<int> mMaxY; | 277 | QMemArray<int> mMaxY; |
279 | 278 | ||
280 | QMemArray<bool> mHolidayMask; | 279 | QMemArray<bool> mHolidayMask; |
281 | 280 | ||
282 | QPixmap mExpandedPixmap; | 281 | QPixmap mExpandedPixmap; |
283 | QPixmap mNotExpandedPixmap; | 282 | QPixmap mNotExpandedPixmap; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9e32c18..1c74307 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -223,129 +223,131 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
223 | } | 223 | } |
224 | mView->saveCalendar( defaultFileName() ); | 224 | mView->saveCalendar( defaultFileName() ); |
225 | newFile = true; | 225 | newFile = true; |
226 | } | 226 | } |
227 | 227 | ||
228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
229 | mView->openCalendar( defaultFileName() ); | 229 | mView->openCalendar( defaultFileName() ); |
230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
232 | 232 | ||
233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
234 | KOPrefs::instance()->setCategoryDefaults(); | 234 | KOPrefs::instance()->setCategoryDefaults(); |
235 | int count = mView->addCategories(); | 235 | int count = mView->addCategories(); |
236 | } | 236 | } |
237 | processIncidenceSelection( 0 ); | 237 | processIncidenceSelection( 0 ); |
238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
239 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 239 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
241 | SLOT( slotModifiedChanged( bool ) ) ); | 241 | SLOT( slotModifiedChanged( bool ) ) ); |
242 | 242 | ||
243 | 243 | ||
244 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 244 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
245 | SLOT( disableBR(bool) ) ); | 245 | SLOT( disableBR(bool) ) ); |
246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | mBlockAtStartup = false; | 248 | mBlockAtStartup = false; |
249 | mView->setModified( false ); | 249 | mView->setModified( false ); |
250 | setCentralWidget( mView ); | 250 | setCentralWidget( mView ); |
251 | globalFlagBlockStartup = 0; | 251 | globalFlagBlockStartup = 0; |
252 | mView->show(); | 252 | mView->show(); |
253 | delete splash; | 253 | delete splash; |
254 | if ( newFile ) | 254 | if ( newFile ) |
255 | mView->updateConfig(); | 255 | mView->updateConfig(); |
256 | // qApp->processEvents(); | 256 | // qApp->processEvents(); |
257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
258 | //fillSyncMenu(); | 258 | //fillSyncMenu(); |
259 | 259 | ||
260 | 260 | ||
261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
262 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 262 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
263 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 263 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
264 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 264 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
265 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 265 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
266 | mSyncManager->setDefaultFileName( defaultFileName()); | 266 | mSyncManager->setDefaultFileName( defaultFileName()); |
267 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 267 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
268 | mSyncManager->fillSyncMenu(); | 268 | mSyncManager->fillSyncMenu(); |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
273 | if ( showWarning ) { | 273 | if ( showWarning ) { |
274 | KMessageBox::information( this, | 274 | KMessageBox::information( this, |
275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
276 | qApp->processEvents(); | 276 | qApp->processEvents(); |
277 | mView->dialogManager()->showSyncOptions(); | 277 | mView->dialogManager()->showSyncOptions(); |
278 | } | 278 | } |
279 | 279 | ||
280 | //US listen for result adressed from Ka/Pi | 280 | //US listen for result adressed from Ka/Pi |
281 | #ifndef DESKTOP_VERSION | 281 | #ifndef DESKTOP_VERSION |
282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
283 | #endif | 283 | #endif |
284 | #ifndef DESKTOP_VERSION | 284 | #ifndef DESKTOP_VERSION |
285 | infrared = 0; | 285 | infrared = 0; |
286 | #endif | 286 | #endif |
287 | 287 | updateWeek( mView->startDate() ); | |
288 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | ||
289 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | ||
288 | mBRdisabled = false; | 290 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 291 | //toggleBeamReceive(); |
290 | } | 292 | } |
291 | MainWindow::~MainWindow() | 293 | MainWindow::~MainWindow() |
292 | { | 294 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 295 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 296 | //save toolbar location |
295 | delete mCalendar; | 297 | delete mCalendar; |
296 | delete mSyncManager; | 298 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 299 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 300 | if ( infrared ) |
299 | delete infrared; | 301 | delete infrared; |
300 | #endif | 302 | #endif |
301 | 303 | ||
302 | 304 | ||
303 | } | 305 | } |
304 | 306 | ||
305 | void MainWindow::disableBR(bool b) | 307 | void MainWindow::disableBR(bool b) |
306 | { | 308 | { |
307 | #ifndef DESKTOP_VERSION | 309 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 310 | if ( b ) { |
309 | if ( infrared ) { | 311 | if ( infrared ) { |
310 | toggleBeamReceive(); | 312 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 313 | mBRdisabled = true; |
312 | } | 314 | } |
313 | mBRdisabled = true; | 315 | mBRdisabled = true; |
314 | } else { | 316 | } else { |
315 | if ( mBRdisabled ) { | 317 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 318 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 319 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 320 | // toggleBeamReceive(); |
319 | } | 321 | } |
320 | } | 322 | } |
321 | #endif | 323 | #endif |
322 | 324 | ||
323 | } | 325 | } |
324 | bool MainWindow::beamReceiveEnabled() | 326 | bool MainWindow::beamReceiveEnabled() |
325 | { | 327 | { |
326 | #ifndef DESKTOP_VERSION | 328 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 329 | return ( infrared != 0 ); |
328 | #endif | 330 | #endif |
329 | return false; | 331 | return false; |
330 | } | 332 | } |
331 | 333 | ||
332 | void MainWindow::toggleBeamReceive() | 334 | void MainWindow::toggleBeamReceive() |
333 | { | 335 | { |
334 | if ( mBRdisabled ) | 336 | if ( mBRdisabled ) |
335 | return; | 337 | return; |
336 | #ifndef DESKTOP_VERSION | 338 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 339 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 340 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 341 | delete infrared; |
340 | infrared = 0; | 342 | infrared = 0; |
341 | brAction->setOn(false); | 343 | brAction->setOn(false); |
342 | return; | 344 | return; |
343 | } | 345 | } |
344 | qDebug("enable BeamReceive "); | 346 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 347 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 348 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 349 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
348 | #endif | 350 | #endif |
349 | } | 351 | } |
350 | void MainWindow::showMaximized () | 352 | void MainWindow::showMaximized () |
351 | { | 353 | { |
@@ -493,128 +495,152 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | |||
493 | 495 | ||
494 | 496 | ||
495 | } | 497 | } |
496 | 498 | ||
497 | showMaximized(); | 499 | showMaximized(); |
498 | raise(); | 500 | raise(); |
499 | } | 501 | } |
500 | 502 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 503 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 504 | { |
503 | return SmallIcon( name ); | 505 | return SmallIcon( name ); |
504 | 506 | ||
505 | } | 507 | } |
506 | void MainWindow::initActions() | 508 | void MainWindow::initActions() |
507 | { | 509 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 510 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 511 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 512 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 513 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 514 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 515 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 516 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 517 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | selectFilterMenu = new QPopupMenu( this ); | 518 | selectFilterMenu = new QPopupMenu( this ); |
517 | selectFilterMenu->setCheckable( true ); | 519 | selectFilterMenu->setCheckable( true ); |
518 | syncMenu = new QPopupMenu( this ); | 520 | syncMenu = new QPopupMenu( this ); |
519 | configureAgendaMenu = new QPopupMenu( this ); | 521 | configureAgendaMenu = new QPopupMenu( this ); |
520 | configureToolBarMenu = new QPopupMenu( this ); | 522 | configureToolBarMenu = new QPopupMenu( this ); |
521 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 523 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
522 | if ( KOPrefs::instance()->mShowFullMenu ) { | 524 | if ( KOPrefs::instance()->mShowFullMenu ) { |
523 | QMenuBar *menuBar1; | 525 | QMenuBar *menuBar1; |
524 | menuBar1 = menuBar(); | 526 | menuBar1 = menuBar(); |
525 | menuBar1->insertItem( i18n("File"), importMenu ); | 527 | menuBar1->insertItem( i18n("File"), importMenu ); |
526 | menuBar1->insertItem( i18n("View"), viewMenu ); | 528 | menuBar1->insertItem( i18n("View"), viewMenu ); |
527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 529 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
528 | #ifdef DESKTOP_VERSION | 530 | #ifdef DESKTOP_VERSION |
529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 531 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 532 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
531 | #else | 533 | #else |
532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 534 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 535 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
534 | #endif | 536 | #endif |
535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 537 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 538 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
537 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 539 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
538 | } else { | 540 | } else { |
539 | QPEMenuBar *menuBar1; | 541 | QPEMenuBar *menuBar1; |
540 | menuBar1 = new QPEMenuBar( iconToolBar ); | 542 | menuBar1 = new QPEMenuBar( iconToolBar ); |
541 | QPopupMenu *menuBar = new QPopupMenu( this ); | 543 | QPopupMenu *menuBar = new QPopupMenu( this ); |
542 | menuBar1->insertItem( i18n("ME"), menuBar); | 544 | menuBar1->insertItem( i18n("ME"), menuBar); |
543 | menuBar->insertItem( i18n("File"), importMenu ); | 545 | menuBar->insertItem( i18n("File"), importMenu ); |
544 | menuBar->insertItem( i18n("View"), viewMenu ); | 546 | menuBar->insertItem( i18n("View"), viewMenu ); |
545 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 547 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 548 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 549 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 550 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 551 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
550 | menuBar->insertItem( i18n("Help"), helpMenu ); | 552 | menuBar->insertItem( i18n("Help"), helpMenu ); |
551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 553 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 554 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
553 | } | 555 | } |
554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 556 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 557 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
556 | 558 | ||
559 | menuBarWeek = new QPEMenuBar( iconToolBar ); | ||
560 | QPopupMenu * wpo = new QPopupMenu (this); | ||
561 | QPopupMenu * all = new QPopupMenu (this); | ||
562 | //wpo->insertItem( i18n("W#"), 0 ); | ||
563 | int first = 1; | ||
564 | int i; | ||
565 | for ( i = 1; i < 50; ++i ) { | ||
566 | if ( !(i%10) ) { | ||
567 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
568 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
569 | first = i; | ||
570 | wpo = new QPopupMenu (this); | ||
571 | } | ||
572 | wpo->insertItem( QString::number(i), i ); | ||
573 | } | ||
574 | for ( i = 50; i < 53; ++i ) { | ||
575 | wpo->insertItem( QString::number(i), i); | ||
576 | } | ||
577 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
578 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
579 | menuBarWeek->insertItem( "00",all,1); | ||
580 | menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); | ||
581 | |||
582 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | ||
557 | // ****************** | 583 | // ****************** |
558 | QAction *action; | 584 | QAction *action; |
559 | QIconSet icon; | 585 | QIconSet icon; |
560 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 586 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
561 | configureToolBarMenu->setCheckable( true ); | 587 | configureToolBarMenu->setCheckable( true ); |
562 | 588 | ||
563 | QString pathString = ""; | 589 | QString pathString = ""; |
564 | if ( !p->mToolBarMiniIcons ) { | 590 | if ( !p->mToolBarMiniIcons ) { |
565 | if ( QApplication::desktop()->width() < 480 ) | 591 | if ( QApplication::desktop()->width() < 480 ) |
566 | pathString += "icons16/"; | 592 | pathString += "icons16/"; |
567 | } else | 593 | } else |
568 | pathString += "iconsmini/"; | 594 | pathString += "iconsmini/"; |
569 | configureAgendaMenu->setCheckable( true ); | 595 | configureAgendaMenu->setCheckable( true ); |
570 | int iii ; | 596 | int iii ; |
571 | for ( iii = 1;iii<= 10 ;++iii ){ | 597 | for ( iii = 1;iii<= 10 ;++iii ){ |
572 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 598 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
573 | } | 599 | } |
574 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 600 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
575 | 601 | ||
576 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 602 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
577 | this, SLOT( showConfigureAgenda( ) ) ); | 603 | this, SLOT( showConfigureAgenda( ) ) ); |
578 | 604 | ||
579 | icon = loadPixmap( pathString + "configure" ); | 605 | icon = loadPixmap( pathString + "configure" ); |
580 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 606 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
581 | action->addTo( actionMenu ); | 607 | action->addTo( actionMenu ); |
582 | connect( action, SIGNAL( activated() ), | 608 | connect( action, SIGNAL( activated() ), |
583 | mView, SLOT( edit_options() ) ); | 609 | mView, SLOT( edit_options() ) ); |
584 | actionMenu->insertSeparator(); | 610 | actionMenu->insertSeparator(); |
585 | 611 | ||
586 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 612 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
587 | action->addTo( actionMenu ); | 613 | action->addTo( actionMenu ); |
588 | connect( action, SIGNAL( activated() ), | 614 | connect( action, SIGNAL( activated() ), |
589 | mView, SLOT( undo_delete() ) ); | 615 | mView, SLOT( undo_delete() ) ); |
590 | actionMenu->insertSeparator(); | 616 | actionMenu->insertSeparator(); |
591 | 617 | ||
592 | icon = loadPixmap( pathString + "newevent" ); | 618 | icon = loadPixmap( pathString + "newevent" ); |
593 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 619 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
594 | configureToolBarMenu->insertSeparator(); | 620 | configureToolBarMenu->insertSeparator(); |
595 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 621 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
596 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 622 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
597 | ne_action->addTo( actionMenu ); | 623 | ne_action->addTo( actionMenu ); |
598 | connect( ne_action, SIGNAL( activated() ), | 624 | connect( ne_action, SIGNAL( activated() ), |
599 | mView, SLOT( newEvent() ) ); | 625 | mView, SLOT( newEvent() ) ); |
600 | icon = loadPixmap( pathString + "newtodo" ); | 626 | icon = loadPixmap( pathString + "newtodo" ); |
601 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 627 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
602 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 628 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
603 | nt_action->addTo( actionMenu ); | 629 | nt_action->addTo( actionMenu ); |
604 | connect( nt_action, SIGNAL( activated() ), | 630 | connect( nt_action, SIGNAL( activated() ), |
605 | mView, SLOT( newTodo() ) ); | 631 | mView, SLOT( newTodo() ) ); |
606 | 632 | ||
607 | icon = loadPixmap( pathString + "today" ); | 633 | icon = loadPixmap( pathString + "today" ); |
608 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 634 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
609 | today_action->addTo( viewMenu ); | 635 | today_action->addTo( viewMenu ); |
610 | connect( today_action, SIGNAL( activated() ), | 636 | connect( today_action, SIGNAL( activated() ), |
611 | mView, SLOT( goToday() ) ); | 637 | mView, SLOT( goToday() ) ); |
612 | viewMenu->insertSeparator(); | 638 | viewMenu->insertSeparator(); |
613 | 639 | ||
614 | icon = loadPixmap( pathString + "navi" ); | 640 | icon = loadPixmap( pathString + "navi" ); |
615 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 641 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
616 | action->addTo( viewMenu ); | 642 | action->addTo( viewMenu ); |
617 | connect( action, SIGNAL( activated() ), | 643 | connect( action, SIGNAL( activated() ), |
618 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 644 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
619 | mToggleNav = action ; | 645 | mToggleNav = action ; |
620 | icon = loadPixmap( pathString + "filter" ); | 646 | icon = loadPixmap( pathString + "filter" ); |
@@ -1255,131 +1281,165 @@ void MainWindow::keyBindings() | |||
1255 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1281 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1256 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1282 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1257 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1283 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1258 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1284 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1259 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1285 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1260 | i18n("<p><h3>In list view:</h3></p>\n") + | 1286 | i18n("<p><h3>In list view:</h3></p>\n") + |
1261 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1287 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1262 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1288 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1263 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1289 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1264 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1290 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1265 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1291 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1266 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1292 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1267 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1293 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1268 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1294 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1269 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1295 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1270 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1296 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1271 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1297 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1272 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1298 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1273 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1299 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1274 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1300 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1275 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1301 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1276 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1302 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1277 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1303 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1278 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1304 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1279 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1305 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1280 | displayText( text, cap); | 1306 | displayText( text, cap); |
1281 | } | 1307 | } |
1282 | void MainWindow::aboutAutoSaving() | 1308 | void MainWindow::aboutAutoSaving() |
1283 | { | 1309 | { |
1284 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1310 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1285 | 1311 | ||
1286 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1312 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1287 | 1313 | ||
1288 | } | 1314 | } |
1289 | void MainWindow::aboutKnownBugs() | 1315 | void MainWindow::aboutKnownBugs() |
1290 | { | 1316 | { |
1291 | QMessageBox* msg; | 1317 | QMessageBox* msg; |
1292 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1318 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1293 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1319 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1294 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1320 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1295 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1321 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1296 | i18n("\nor report them in the bugtracker on\n") + | 1322 | i18n("\nor report them in the bugtracker on\n") + |
1297 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1323 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1298 | QMessageBox::NoIcon, | 1324 | QMessageBox::NoIcon, |
1299 | QMessageBox::Ok, | 1325 | QMessageBox::Ok, |
1300 | QMessageBox::NoButton, | 1326 | QMessageBox::NoButton, |
1301 | QMessageBox::NoButton); | 1327 | QMessageBox::NoButton); |
1302 | msg->exec(); | 1328 | msg->exec(); |
1303 | delete msg; | 1329 | delete msg; |
1304 | 1330 | ||
1305 | } | 1331 | } |
1306 | 1332 | ||
1307 | QString MainWindow::defaultFileName() | 1333 | QString MainWindow::defaultFileName() |
1308 | { | 1334 | { |
1309 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1335 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1310 | } | 1336 | } |
1311 | QString MainWindow::syncFileName() | 1337 | QString MainWindow::syncFileName() |
1312 | { | 1338 | { |
1313 | #ifdef DESKTOP_VERSION | 1339 | #ifdef DESKTOP_VERSION |
1314 | return locateLocal( "tmp", "synccalendar.ics" ); | 1340 | return locateLocal( "tmp", "synccalendar.ics" ); |
1315 | #else | 1341 | #else |
1316 | return QString( "/tmp/synccalendar.ics" ); | 1342 | return QString( "/tmp/synccalendar.ics" ); |
1317 | #endif | 1343 | #endif |
1318 | } | 1344 | } |
1345 | void MainWindow::updateWeek(QDate seda) | ||
1346 | { | ||
1347 | int weekNum = 0; | ||
1348 | QDate d = QDate ( seda.year(), 1,1); | ||
1349 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1350 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1351 | if ( seda.year() != d.year() ) { | ||
1352 | if ( d.dayOfWeek() > 4 ) | ||
1353 | d = QDate ( seda.year(), 1,1); | ||
1354 | else | ||
1355 | weekNum = 1; | ||
1356 | } else { | ||
1357 | QDate dd( seda.year()+1, 1,1); | ||
1358 | if ( dd.dayOfWeek() <= 4 ) | ||
1359 | weekNum = 1; | ||
1360 | } | ||
1361 | } | ||
1362 | if ( weekNum == 0 ){ | ||
1363 | int dow = d.dayOfWeek(); | ||
1364 | if ( dow <= 4 ) | ||
1365 | d = d.addDays( 1-dow ); | ||
1366 | else // 5,6,7 | ||
1367 | d = d.addDays( 8-dow ); | ||
1368 | // we have the first week of the year.we are on monday | ||
1369 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1370 | } | ||
1371 | //qDebug("weeknum %s ", QString::number( weekNum).latin1()); | ||
1372 | menuBarWeek-> changeItem(1, QString::number( weekNum) ); | ||
1319 | 1373 | ||
1374 | } | ||
1375 | void MainWindow::updateWeekNum(const DateList &selectedDates) | ||
1376 | { | ||
1377 | updateWeek( selectedDates.first() ); | ||
1378 | } | ||
1320 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1379 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1321 | { | 1380 | { |
1381 | |||
1322 | if ( !incidence ) { | 1382 | if ( !incidence ) { |
1323 | enableIncidenceActions( false ); | 1383 | enableIncidenceActions( false ); |
1324 | 1384 | ||
1325 | mNewSubTodoAction->setEnabled( false ); | 1385 | mNewSubTodoAction->setEnabled( false ); |
1326 | setCaptionToDates(); | 1386 | setCaptionToDates(); |
1327 | return; | 1387 | return; |
1328 | 1388 | ||
1329 | } | 1389 | } |
1330 | 1390 | ||
1331 | //KGlobal::locale()->formatDateTime(nextA, true); | 1391 | //KGlobal::locale()->formatDateTime(nextA, true); |
1332 | QString startString = ""; | 1392 | QString startString = ""; |
1333 | if ( incidence->type() != "Todo" ) { | 1393 | if ( incidence->type() != "Todo" ) { |
1334 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1394 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1335 | if ( incidence->doesFloat() ) { | 1395 | if ( incidence->doesFloat() ) { |
1336 | startString += ": "+incidence->dtStartDateStr( true ); | 1396 | startString += ": "+incidence->dtStartDateStr( true ); |
1337 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1397 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1338 | 1398 | ||
1339 | } else { | 1399 | } else { |
1340 | startString = ": "+incidence->dtStartStr(true); | 1400 | startString = ": "+incidence->dtStartStr(true); |
1341 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1401 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1342 | 1402 | ||
1343 | } | 1403 | } |
1344 | 1404 | ||
1345 | } else { | 1405 | } else { |
1346 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1406 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1407 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1408 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1349 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1409 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1350 | bool ok; | 1410 | bool ok; |
1351 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1411 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1352 | if ( ok ) { | 1412 | if ( ok ) { |
1353 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1413 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1354 | startString += i18n(" (%1 y.)"). arg( years ); | 1414 | startString += i18n(" (%1 y.)"). arg( years ); |
1355 | } | 1415 | } |
1356 | } | 1416 | } |
1357 | else | 1417 | else |
1358 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1418 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1359 | } | 1419 | } |
1360 | 1420 | ||
1361 | } | 1421 | } |
1362 | else | 1422 | else |
1363 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1423 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1364 | if ( !incidence->location().isEmpty() ) | 1424 | if ( !incidence->location().isEmpty() ) |
1365 | startString += " (" +incidence->location()+")"; | 1425 | startString += " (" +incidence->location()+")"; |
1366 | setCaption( incidence->summary()+startString); | 1426 | setCaption( incidence->summary()+startString); |
1367 | 1427 | ||
1368 | enableIncidenceActions( true ); | 1428 | enableIncidenceActions( true ); |
1369 | 1429 | ||
1370 | if ( incidence->type() == "Event" ) { | 1430 | if ( incidence->type() == "Event" ) { |
1371 | mShowAction->setText( i18n("Show Event...") ); | 1431 | mShowAction->setText( i18n("Show Event...") ); |
1372 | mEditAction->setText( i18n("Edit Event...") ); | 1432 | mEditAction->setText( i18n("Edit Event...") ); |
1373 | mDeleteAction->setText( i18n("Delete Event...") ); | 1433 | mDeleteAction->setText( i18n("Delete Event...") ); |
1374 | 1434 | ||
1375 | mNewSubTodoAction->setEnabled( false ); | 1435 | mNewSubTodoAction->setEnabled( false ); |
1376 | } else if ( incidence->type() == "Todo" ) { | 1436 | } else if ( incidence->type() == "Todo" ) { |
1377 | mShowAction->setText( i18n("Show Todo...") ); | 1437 | mShowAction->setText( i18n("Show Todo...") ); |
1378 | mEditAction->setText( i18n("Edit Todo...") ); | 1438 | mEditAction->setText( i18n("Edit Todo...") ); |
1379 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1439 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1380 | 1440 | ||
1381 | mNewSubTodoAction->setEnabled( true ); | 1441 | mNewSubTodoAction->setEnabled( true ); |
1382 | } else { | 1442 | } else { |
1383 | mShowAction->setText( i18n("Show...") ); | 1443 | mShowAction->setText( i18n("Show...") ); |
1384 | mShowAction->setText( i18n("Edit...") ); | 1444 | mShowAction->setText( i18n("Edit...") ); |
1385 | mShowAction->setText( i18n("Delete...") ); | 1445 | mShowAction->setText( i18n("Delete...") ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8dd55ac..076ab94 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,142 +1,147 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 9 | #include <qregexp.h> |
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 15 | #include <qcopchannel_qws.h> |
16 | #endif | 16 | #endif |
17 | class QAction; | 17 | class QAction; |
18 | class CalendarView; | 18 | class CalendarView; |
19 | class KSyncProfile; | 19 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 20 | #ifdef DESKTOP_VERSION |
21 | 21 | ||
22 | #define QPEToolBar QToolBar | 22 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | 23 | #define QPEMenuBar QMenuBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | class QPEMenuBar; | ||
26 | 27 | ||
27 | 28 | ||
28 | namespace KCal { | 29 | namespace KCal { |
29 | class CalendarLocal; | 30 | class CalendarLocal; |
30 | } | 31 | } |
31 | 32 | ||
32 | using namespace KCal; | 33 | using namespace KCal; |
33 | 34 | ||
34 | class MainWindow : public QMainWindow | 35 | class MainWindow : public QMainWindow |
35 | { | 36 | { |
36 | Q_OBJECT | 37 | Q_OBJECT |
37 | public: | 38 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 39 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
39 | ~MainWindow(); | 40 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 41 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | 42 | static QString defaultFileName(); |
42 | static QString syncFileName(); | 43 | static QString syncFileName(); |
43 | static QString resourcePath(); | 44 | static QString resourcePath(); |
44 | public slots: | 45 | public slots: |
46 | void updateWeekNum(const KCal::DateList &); | ||
47 | void updateWeek(QDate); | ||
45 | virtual void showMaximized (); | 48 | virtual void showMaximized (); |
46 | void configureAgenda( int ); | 49 | void configureAgenda( int ); |
47 | void recieve( const QCString& msg, const QByteArray& data ); | 50 | void recieve( const QCString& msg, const QByteArray& data ); |
48 | protected slots: | 51 | protected slots: |
49 | void setCaptionToDates(); | 52 | void setCaptionToDates(); |
50 | void about(); | 53 | void about(); |
51 | void licence(); | 54 | void licence(); |
52 | void faq(); | 55 | void faq(); |
53 | void usertrans(); | 56 | void usertrans(); |
54 | void features(); | 57 | void features(); |
55 | void synchowto(); | 58 | void synchowto(); |
56 | void kdesynchowto(); | 59 | void kdesynchowto(); |
57 | void multisynchowto(); | 60 | void multisynchowto(); |
58 | void whatsNew(); | 61 | void whatsNew(); |
59 | void keyBindings(); | 62 | void keyBindings(); |
60 | void aboutAutoSaving();; | 63 | void aboutAutoSaving();; |
61 | void aboutKnownBugs(); | 64 | void aboutKnownBugs(); |
62 | 65 | ||
63 | void processIncidenceSelection( Incidence * ); | 66 | void processIncidenceSelection( Incidence * ); |
64 | 67 | ||
65 | void importQtopia(); | 68 | void importQtopia(); |
66 | void importBday(); | 69 | void importBday(); |
67 | void importOL(); | 70 | void importOL(); |
68 | void importIcal(); | 71 | void importIcal(); |
69 | void importFile( QString, bool ); | 72 | void importFile( QString, bool ); |
70 | void quickImportIcal(); | 73 | void quickImportIcal(); |
71 | 74 | ||
72 | void slotModifiedChanged( bool ); | 75 | void slotModifiedChanged( bool ); |
73 | 76 | ||
74 | void save(); | 77 | void save(); |
75 | void saveStopTimer(); | 78 | void saveStopTimer(); |
76 | void configureToolBar( int ); | 79 | void configureToolBar( int ); |
77 | void printSel(); | 80 | void printSel(); |
78 | void printCal(); | 81 | void printCal(); |
79 | void saveCalendar(); | 82 | void saveCalendar(); |
80 | void loadCalendar(); | 83 | void loadCalendar(); |
81 | void exportVCalendar(); | 84 | void exportVCalendar(); |
82 | void fillFilterMenu(); | 85 | void fillFilterMenu(); |
83 | void selectFilter( int ); | 86 | void selectFilter( int ); |
84 | void exportToPhone( int ); | 87 | void exportToPhone( int ); |
85 | void toggleBeamReceive(); | 88 | void toggleBeamReceive(); |
86 | void disableBR(bool); | 89 | void disableBR(bool); |
87 | 90 | signals: | |
91 | void selectWeek ( int ); | ||
88 | private slots: | 92 | private slots: |
89 | void showConfigureAgenda(); | 93 | void showConfigureAgenda(); |
90 | void getFile( bool ); | 94 | void getFile( bool ); |
91 | void syncFileRequest(); | 95 | void syncFileRequest(); |
92 | 96 | ||
93 | protected: | 97 | protected: |
94 | void displayText( QString, QString); | 98 | void displayText( QString, QString); |
95 | void enableIncidenceActions( bool ); | 99 | void enableIncidenceActions( bool ); |
96 | 100 | ||
97 | private: | 101 | private: |
98 | bool mBRdisabled; | 102 | bool mBRdisabled; |
99 | #ifndef DESKTOP_VERSION | 103 | #ifndef DESKTOP_VERSION |
100 | QCopChannel* infrared; | 104 | QCopChannel* infrared; |
101 | #endif | 105 | #endif |
102 | QAction* brAction; | 106 | QAction* brAction; |
103 | KSyncManager* mSyncManager; | 107 | KSyncManager* mSyncManager; |
104 | bool mClosed; | 108 | bool mClosed; |
105 | void saveOnClose(); | 109 | void saveOnClose(); |
106 | bool mFlagKeyPressed; | 110 | bool mFlagKeyPressed; |
107 | bool mBlockAtStartup; | 111 | bool mBlockAtStartup; |
108 | QPEToolBar *iconToolBar; | 112 | QPEToolBar *iconToolBar; |
109 | void initActions(); | 113 | void initActions(); |
110 | void setDefaultPreferences(); | 114 | void setDefaultPreferences(); |
111 | void keyPressEvent ( QKeyEvent * ) ; | 115 | void keyPressEvent ( QKeyEvent * ) ; |
112 | void keyReleaseEvent ( QKeyEvent * ) ; | 116 | void keyReleaseEvent ( QKeyEvent * ) ; |
113 | QPopupMenu *configureToolBarMenu; | 117 | QPopupMenu *configureToolBarMenu; |
114 | QPopupMenu *selectFilterMenu; | 118 | QPopupMenu *selectFilterMenu; |
115 | QPopupMenu *configureAgendaMenu, *syncMenu; | 119 | QPopupMenu *configureAgendaMenu, *syncMenu; |
116 | CalendarLocal *mCalendar; | 120 | CalendarLocal *mCalendar; |
117 | CalendarView *mView; | 121 | CalendarView *mView; |
118 | QAction *mNewSubTodoAction; | 122 | QAction *mNewSubTodoAction; |
123 | QPEMenuBar *menuBarWeek; | ||
119 | 124 | ||
120 | QAction *mShowAction; | 125 | QAction *mShowAction; |
121 | QAction *mEditAction; | 126 | QAction *mEditAction; |
122 | QAction *mDeleteAction; | 127 | QAction *mDeleteAction; |
123 | QAction *mCloneAction; | 128 | QAction *mCloneAction; |
124 | QAction *mMoveAction; | 129 | QAction *mMoveAction; |
125 | QAction *mBeamAction; | 130 | QAction *mBeamAction; |
126 | QAction *mCancelAction; | 131 | QAction *mCancelAction; |
127 | 132 | ||
128 | QAction *mToggleNav; | 133 | QAction *mToggleNav; |
129 | QAction *mToggleFilter; | 134 | QAction *mToggleFilter; |
130 | QAction *mToggleAllday; | 135 | QAction *mToggleAllday; |
131 | 136 | ||
132 | 137 | ||
133 | void closeEvent( QCloseEvent* ce ); | 138 | void closeEvent( QCloseEvent* ce ); |
134 | SimpleAlarmClient mAlarmClient; | 139 | SimpleAlarmClient mAlarmClient; |
135 | QTimer mSaveTimer; | 140 | QTimer mSaveTimer; |
136 | //bool mBlockSaveFlag; | 141 | //bool mBlockSaveFlag; |
137 | bool mCalendarModifiedFlag; | 142 | bool mCalendarModifiedFlag; |
138 | QPixmap loadPixmap( QString ); | 143 | QPixmap loadPixmap( QString ); |
139 | }; | 144 | }; |
140 | 145 | ||
141 | 146 | ||
142 | #endif | 147 | #endif |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 24de01f..657f98d 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -11,226 +11,191 @@ | |||
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 "koprefs.h" | 43 | #include "koprefs.h" |
44 | #ifndef KORG_NOPLUGINS | 44 | #ifndef KORG_NOPLUGINS |
45 | #include "kocore.h" | 45 | #include "kocore.h" |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #include <kcalendarsystem.h> | 48 | #include <kcalendarsystem.h> |
49 | 49 | ||
50 | #include "navigatorbar.h" | 50 | #include "navigatorbar.h" |
51 | 51 | ||
52 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 52 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
53 | : QWidget( parent, name ) | 53 | : QWidget( parent, name ) |
54 | { | 54 | { |
55 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 55 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
56 | 56 | ||
57 | // Set up the control buttons and date label | 57 | // Set up the control buttons and date label |
58 | mCtrlFrame = new QFrame( this ); | 58 | mCtrlFrame = new QFrame( this ); |
59 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 59 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
60 | mCtrlFrame->setLineWidth(1); | 60 | mCtrlFrame->setLineWidth(1); |
61 | 61 | ||
62 | topLayout->addWidget( mCtrlFrame ); | 62 | topLayout->addWidget( mCtrlFrame ); |
63 | 63 | ||
64 | QFont tfont = font(); | 64 | QFont tfont = font(); |
65 | if ( QApplication::desktop()->width() >= 480 ) | 65 | if ( QApplication::desktop()->width() >= 480 ) |
66 | tfont.setPointSize(tfont.pointSize()+2); | 66 | tfont.setPointSize(tfont.pointSize()+2); |
67 | tfont.setBold(true); | 67 | tfont.setBold(true); |
68 | 68 | ||
69 | bool isRTL = KOGlobals::self()->reverseLayout(); | 69 | bool isRTL = KOGlobals::self()->reverseLayout(); |
70 | #ifndef DESKTOP_VERSION | 70 | #ifndef DESKTOP_VERSION |
71 | bool isDesktop = false; | 71 | bool isDesktop = false; |
72 | #else | 72 | #else |
73 | bool isDesktop = true; | 73 | bool isDesktop = true; |
74 | #endif | 74 | #endif |
75 | bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; | 75 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
76 | if ( insertWeek && QApplication::desktop()->width() > 320 ) | ||
77 | isDesktop = true; | 76 | isDesktop = true; |
78 | // Create backward navigation buttons | 77 | // Create backward navigation buttons |
79 | mPrevYear = new QPushButton( mCtrlFrame ); | 78 | mPrevYear = new QPushButton( mCtrlFrame ); |
80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 79 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 80 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
82 | 81 | ||
83 | mPrevMonth = new QPushButton( mCtrlFrame ); | 82 | mPrevMonth = new QPushButton( mCtrlFrame ); |
84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 83 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 84 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
86 | 85 | ||
87 | // Create forward navigation buttons | 86 | // Create forward navigation buttons |
88 | mNextMonth = new QPushButton( mCtrlFrame ); | 87 | mNextMonth = new QPushButton( mCtrlFrame ); |
89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 88 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
90 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 89 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
91 | 90 | ||
92 | QPushButton * selWeek = 0; | ||
93 | if ( insertWeek ) { | ||
94 | selWeek = new QPushButton( mCtrlFrame ); | ||
95 | QToolTip::add( selWeek, i18n("Select Week") ); | ||
96 | selWeek->setFocusPolicy(NoFocus); | ||
97 | } | ||
98 | |||
99 | mNextYear = new QPushButton( mCtrlFrame ); | 91 | mNextYear = new QPushButton( mCtrlFrame ); |
100 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 92 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
101 | QToolTip::add( mNextYear, i18n("Next Year") ); | 93 | QToolTip::add( mNextYear, i18n("Next Year") ); |
102 | mSelectMonth = new QPushButton( mCtrlFrame ); | 94 | mSelectMonth = new QPushButton( mCtrlFrame ); |
103 | // Create month name label | 95 | // Create month name label |
104 | //selectMonth->setFont( tfont ); | 96 | //selectMonth->setFont( tfont ); |
105 | // selectMonth->setAlignment( AlignCenter ); | 97 | // selectMonth->setAlignment( AlignCenter ); |
106 | //mDateLabel = new QLabel( selectMonth ); | 98 | //mDateLabel = new QLabel( selectMonth ); |
107 | //mDateLabel->setFont( tfont ); | 99 | //mDateLabel->setFont( tfont ); |
108 | //mDateLabel->setAlignment( AlignCenter ); | 100 | //mDateLabel->setAlignment( AlignCenter ); |
109 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 101 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
110 | mNextMonth->setFlat( true); | 102 | mNextMonth->setFlat( true); |
111 | mNextYear->setFlat( true); | 103 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 104 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 105 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 106 | mPrevMonth->setFlat( true); |
115 | if ( insertWeek ) | ||
116 | selWeek->setFlat( true); | ||
117 | } | 107 | } |
118 | mSelectMonth->setFont( tfont ); | 108 | mSelectMonth->setFont( tfont ); |
119 | // Set minimum width to width of widest month name label | 109 | // Set minimum width to width of widest month name label |
120 | int i; | 110 | int i; |
121 | int maxwidth = 0; | 111 | int maxwidth = 0; |
122 | QFontMetrics fm ( mSelectMonth->font() ); | 112 | QFontMetrics fm ( mSelectMonth->font() ); |
123 | int width = fm.width("September '00" ); | 113 | int width = fm.width("September '00" ); |
124 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 114 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
125 | // ++i ) { | 115 | // ++i ) { |
126 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | 116 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, |
127 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | 117 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); |
128 | // int width = fm.width("September 2000" ); | 118 | // int width = fm.width("September 2000" ); |
129 | // if ( width > maxwidth ) maxwidth = width; | 119 | // if ( width > maxwidth ) maxwidth = width; |
130 | // } | 120 | // } |
131 | maxwidth = width+2; | 121 | maxwidth = width+2; |
132 | int size = fm.height()+2; | 122 | int size = fm.height()+2; |
133 | if ( QApplication::desktop()->width() >= 480 ) { | 123 | if ( QApplication::desktop()->width() >= 480 ) { |
134 | size += 6; | 124 | size += 6; |
135 | maxwidth+= 6; | 125 | maxwidth+= 6; |
136 | } | 126 | } |
137 | 127 | ||
138 | if ( insertWeek ) { | ||
139 | QPopupMenu * wpo = new QPopupMenu (this); | ||
140 | QPopupMenu * all = new QPopupMenu (this); | ||
141 | //wpo->insertItem( i18n("W#"), 0 ); | ||
142 | int first = 1; | ||
143 | for ( i = 1; i < 50; ++i ) { | ||
144 | if ( !(i%10) ) { | ||
145 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
146 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
147 | first = i; | ||
148 | wpo = new QPopupMenu (this); | ||
149 | } | ||
150 | wpo->insertItem( QString::number(i), i ); | ||
151 | } | ||
152 | for ( i = 50; i < 53; ++i ) { | ||
153 | wpo->insertItem( QString::number(i), i); | ||
154 | } | ||
155 | all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); | ||
156 | selWeek->setPopup( all ); | ||
157 | selWeek->setFixedWidth( (size/5)*4 ); | ||
158 | selWeek->setFixedHeight( size ); | ||
159 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); | ||
160 | } | ||
161 | mSelectMonth->setFixedWidth( maxwidth ); | 128 | mSelectMonth->setFixedWidth( maxwidth ); |
162 | mSelectMonth->setFixedHeight( size ); | 129 | mSelectMonth->setFixedHeight( size ); |
163 | mPrevYear->setFixedHeight( size ); | 130 | mPrevYear->setFixedHeight( size ); |
164 | mPrevMonth->setFixedHeight( size ); | 131 | mPrevMonth->setFixedHeight( size ); |
165 | mNextMonth->setFixedHeight( size ); | 132 | mNextMonth->setFixedHeight( size ); |
166 | mNextYear->setFixedHeight ( size ); | 133 | mNextYear->setFixedHeight ( size ); |
167 | // set up control frame layout | 134 | // set up control frame layout |
168 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 135 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
169 | ctrlLayout->addWidget( mPrevYear, 3 ); | 136 | ctrlLayout->addWidget( mPrevYear, 3 ); |
170 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 137 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
171 | //ctrlLayout->addStretch( 1 ); | 138 | //ctrlLayout->addStretch( 1 ); |
172 | // ctrlLayout->addSpacing( 1 ); | 139 | // ctrlLayout->addSpacing( 1 ); |
173 | // ctrlLayout->addWidget( mDateLabel ); | 140 | // ctrlLayout->addWidget( mDateLabel ); |
174 | ctrlLayout->addWidget( mSelectMonth ); | 141 | ctrlLayout->addWidget( mSelectMonth ); |
175 | // ctrlLayout->addSpacing( 1 ); | 142 | // ctrlLayout->addSpacing( 1 ); |
176 | // ctrlLayout->addStretch( 1 ); | 143 | // ctrlLayout->addStretch( 1 ); |
177 | ctrlLayout->addWidget( mNextMonth, 3 ); | 144 | ctrlLayout->addWidget( mNextMonth, 3 ); |
178 | ctrlLayout->addWidget( mNextYear, 3 ); | 145 | ctrlLayout->addWidget( mNextYear, 3 ); |
179 | if ( insertWeek ) | ||
180 | ctrlLayout->addWidget( selWeek ); | ||
181 | 146 | ||
182 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 147 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
183 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 148 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
184 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 149 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
185 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 150 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
186 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 151 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
187 | mPrevYear->setFocusPolicy(NoFocus); | 152 | mPrevYear->setFocusPolicy(NoFocus); |
188 | mPrevMonth->setFocusPolicy(NoFocus); | 153 | mPrevMonth->setFocusPolicy(NoFocus); |
189 | mNextMonth->setFocusPolicy(NoFocus); | 154 | mNextMonth->setFocusPolicy(NoFocus); |
190 | mNextYear->setFocusPolicy(NoFocus); | 155 | mNextYear->setFocusPolicy(NoFocus); |
191 | mSelectMonth->setFocusPolicy(NoFocus); | 156 | mSelectMonth->setFocusPolicy(NoFocus); |
192 | 157 | ||
193 | } | 158 | } |
194 | 159 | ||
195 | NavigatorBar::~NavigatorBar() | 160 | NavigatorBar::~NavigatorBar() |
196 | { | 161 | { |
197 | } | 162 | } |
198 | 163 | ||
199 | void NavigatorBar::selectMonth() | 164 | void NavigatorBar::selectMonth() |
200 | { | 165 | { |
201 | 166 | ||
202 | int month; | 167 | int month; |
203 | KPopupFrame* popup = new KPopupFrame(this); | 168 | KPopupFrame* popup = new KPopupFrame(this); |
204 | int size = 12; | 169 | int size = 12; |
205 | if ( QApplication::desktop()->width() >= 480 ) | 170 | if ( QApplication::desktop()->width() >= 480 ) |
206 | size = 18; | 171 | size = 18; |
207 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); | 172 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); |
208 | // ----- | 173 | // ----- |
209 | picker->resize(picker->sizeHint()); | 174 | picker->resize(picker->sizeHint()); |
210 | popup->setMainWidget(picker); | 175 | popup->setMainWidget(picker); |
211 | picker->setFocus(); | 176 | picker->setFocus(); |
212 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 177 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
213 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 178 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
214 | { | 179 | { |
215 | month = picker->getResult(); | 180 | month = picker->getResult(); |
216 | emit monthSelected ( month ); | 181 | emit monthSelected ( month ); |
217 | } else { | 182 | } else { |
218 | KNotifyClient::beep(); | 183 | KNotifyClient::beep(); |
219 | } | 184 | } |
220 | delete popup; | 185 | delete popup; |
221 | } | 186 | } |
222 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 187 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
223 | { | 188 | { |
224 | if (dateList.count() > 0) { | 189 | if (dateList.count() > 0) { |
225 | QDate date = dateList.first(); | 190 | QDate date = dateList.first(); |
226 | 191 | ||
227 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 192 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
228 | 193 | ||
229 | // compute the label at the top of the navigator | 194 | // compute the label at the top of the navigator |
230 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 195 | QString dtstr = i18n(calSys->monthName( date )) + " '" + |
231 | QString::number( calSys->year( date ) ).right(2); | 196 | QString::number( calSys->year( date ) ).right(2); |
232 | 197 | ||
233 | mSelectMonth->setText( dtstr ); | 198 | mSelectMonth->setText( dtstr ); |
234 | } | 199 | } |
235 | } | 200 | } |
236 | 201 | ||