author | zautrix <zautrix> | 2005-06-11 18:34:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-11 18:34:05 (UTC) |
commit | b56d3be87557510285d3381250faf9b7af300680 (patch) (unidiff) | |
tree | 887e24db261f56f78dda8397196a6125cc346fc5 | |
parent | 81370a5f955c2710b6e9336b6c412c8d630ef72a (diff) | |
download | kdepimpi-b56d3be87557510285d3381250faf9b7af300680.zip kdepimpi-b56d3be87557510285d3381250faf9b7af300680.tar.gz kdepimpi-b56d3be87557510285d3381250faf9b7af300680.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 39 | ||||
-rw-r--r-- | microkde/kfiledialog.cpp | 2 |
2 files changed, 31 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8f5de4d..753d81f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -453,391 +453,394 @@ void CalendarView::init() | |||
453 | // FIXME | 453 | // FIXME |
454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
455 | "CalendarView::DateNavigator", QDate::currentDate()); | 455 | "CalendarView::DateNavigator", QDate::currentDate()); |
456 | #endif | 456 | #endif |
457 | // mDateNavigator->blockSignals( true ); | 457 | // mDateNavigator->blockSignals( true ); |
458 | //leftFrameLayout->addWidget( mDateNavigator ); | 458 | //leftFrameLayout->addWidget( mDateNavigator ); |
459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
462 | mTodoList->setNavigator( mNavigator ); | 462 | mTodoList->setNavigator( mNavigator ); |
463 | #if 0 | 463 | #if 0 |
464 | if ( QApplication::desktop()->width() < 480 ) { | 464 | if ( QApplication::desktop()->width() < 480 ) { |
465 | leftFrameLayout->addWidget(mFilterView); | 465 | leftFrameLayout->addWidget(mFilterView); |
466 | leftFrameLayout->addWidget(mTodoList, 2 ); | 466 | leftFrameLayout->addWidget(mTodoList, 2 ); |
467 | 467 | ||
468 | } else { | 468 | } else { |
469 | leftFrameLayout->addWidget(mTodoList,2 ); | 469 | leftFrameLayout->addWidget(mTodoList,2 ); |
470 | leftFrameLayout->addWidget(mFilterView ); | 470 | leftFrameLayout->addWidget(mFilterView ); |
471 | } | 471 | } |
472 | #endif | 472 | #endif |
473 | mFilterView->hide(); | 473 | mFilterView->hide(); |
474 | mCalEditView->hide(); | 474 | mCalEditView->hide(); |
475 | QWidget *rightBox = new QWidget( mMainFrame ); | 475 | QWidget *rightBox = new QWidget( mMainFrame ); |
476 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 476 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
477 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 477 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
478 | mRightFrame = new QWidgetStack( rightBox ); | 478 | mRightFrame = new QWidgetStack( rightBox ); |
479 | rightLayout->addWidget( mRightFrame, 10 ); | 479 | rightLayout->addWidget( mRightFrame, 10 ); |
480 | 480 | ||
481 | //mLeftFrame = (QWidget *)leftFrame; | 481 | //mLeftFrame = (QWidget *)leftFrame; |
482 | if ( KOPrefs::instance()->mVerticalScreen ) { | 482 | if ( KOPrefs::instance()->mVerticalScreen ) { |
483 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 483 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
484 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 484 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
485 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 485 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
486 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 486 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
487 | } else { | 487 | } else { |
488 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 488 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
489 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 489 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
490 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 490 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
491 | } | 491 | } |
492 | if ( !KOPrefs::instance()->mShowDateNavigator) | 492 | if ( !KOPrefs::instance()->mShowDateNavigator) |
493 | mDateNavigator->hide(); | 493 | mDateNavigator->hide(); |
494 | //qDebug("Calendarview Size %d %d ", width(), height()); | 494 | //qDebug("Calendarview Size %d %d ", width(), height()); |
495 | #endif | 495 | #endif |
496 | 496 | ||
497 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 497 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
498 | SLOT( showDates( const KCal::DateList & ) ) ); | 498 | SLOT( showDates( const KCal::DateList & ) ) ); |
499 | 499 | ||
500 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 500 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
501 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 501 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
502 | 502 | ||
503 | 503 | ||
504 | 504 | ||
505 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 505 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
506 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 506 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
507 | 507 | ||
508 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 508 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
509 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 509 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
510 | 510 | ||
511 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 511 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
512 | mNavigator, SLOT( selectPreviousYear() ) ); | 512 | mNavigator, SLOT( selectPreviousYear() ) ); |
513 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 513 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
514 | mNavigator, SLOT( selectNextYear() ) ); | 514 | mNavigator, SLOT( selectNextYear() ) ); |
515 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 515 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
516 | mNavigator, SLOT( selectPreviousMonth() ) ); | 516 | mNavigator, SLOT( selectPreviousMonth() ) ); |
517 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 517 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
518 | mNavigator, SLOT( selectNextMonth() ) ); | 518 | mNavigator, SLOT( selectNextMonth() ) ); |
519 | 519 | ||
520 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 520 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
521 | mNavigator, SLOT( selectPrevious() ) ); | 521 | mNavigator, SLOT( selectPrevious() ) ); |
522 | connect( mDateNavigator, SIGNAL( goNext() ), | 522 | connect( mDateNavigator, SIGNAL( goNext() ), |
523 | mNavigator, SLOT( selectNext() ) ); | 523 | mNavigator, SLOT( selectNext() ) ); |
524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
529 | #if 0 | 529 | #if 0 |
530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
531 | SLOT( incidenceAdded( Incidence *) ) ); | 531 | SLOT( incidenceAdded( Incidence *) ) ); |
532 | #endif | 532 | #endif |
533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
534 | 534 | ||
535 | connect( this, SIGNAL( configChanged() ), | 535 | connect( this, SIGNAL( configChanged() ), |
536 | mDateNavigator, SLOT( updateConfig() ) ); | 536 | mDateNavigator, SLOT( updateConfig() ) ); |
537 | 537 | ||
538 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 538 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
539 | SLOT( newTodo() ) ); | 539 | SLOT( newTodo() ) ); |
540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
541 | SLOT( newSubTodo( Todo * ) ) ); | 541 | SLOT( newSubTodo( Todo * ) ) ); |
542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
543 | SLOT( editTodo( Todo * ) ) ); | 543 | SLOT( editTodo( Todo * ) ) ); |
544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
545 | SLOT( showTodo( Todo *) ) ); | 545 | SLOT( showTodo( Todo *) ) ); |
546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
547 | SLOT( deleteTodo( Todo *) ) ); | 547 | SLOT( deleteTodo( Todo *) ) ); |
548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
550 | SLOT( purgeCompleted() ) ); | 550 | SLOT( purgeCompleted() ) ); |
551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
552 | SIGNAL( todoModified( Todo *, int ) ) ); | 552 | SIGNAL( todoModified( Todo *, int ) ) ); |
553 | 553 | ||
554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
557 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 557 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
558 | 558 | ||
559 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 559 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
560 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 560 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
561 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 561 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
562 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 562 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
563 | 563 | ||
564 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 564 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
565 | this, SLOT ( todo_unsub( Todo * ) ) ); | 565 | this, SLOT ( todo_unsub( Todo * ) ) ); |
566 | 566 | ||
567 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 567 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
568 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 568 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
569 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 569 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
570 | SLOT( updateTodo( Todo *, int ) ) ); | 570 | SLOT( updateTodo( Todo *, int ) ) ); |
571 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 571 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
572 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 572 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
573 | 573 | ||
574 | 574 | ||
575 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 575 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
576 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 576 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
577 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 577 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
578 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 578 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
579 | 579 | ||
580 | 580 | ||
581 | 581 | ||
582 | 582 | ||
583 | 583 | ||
584 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 584 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
585 | SLOT(checkClipboard())); | 585 | SLOT(checkClipboard())); |
586 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 586 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
587 | SLOT( processTodoListSelection( Incidence * ) ) ); | 587 | SLOT( processTodoListSelection( Incidence * ) ) ); |
588 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 588 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
589 | 589 | ||
590 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 590 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
591 | 591 | ||
592 | mDateFrame = new QVBox(0,0,WType_Popup); | 592 | mDateFrame = new QVBox(0,0,WType_Popup); |
593 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 593 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
594 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 594 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
595 | mDateFrame->setLineWidth(3); | 595 | mDateFrame->setLineWidth(3); |
596 | mDateFrame->hide(); | 596 | mDateFrame->hide(); |
597 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 597 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
598 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 598 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
599 | 599 | ||
600 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 600 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
601 | 601 | ||
602 | mEventEditor = mDialogManager->getEventEditor(); | 602 | mEventEditor = mDialogManager->getEventEditor(); |
603 | mTodoEditor = mDialogManager->getTodoEditor(); | 603 | mTodoEditor = mDialogManager->getTodoEditor(); |
604 | 604 | ||
605 | mFlagEditDescription = false; | 605 | mFlagEditDescription = false; |
606 | 606 | ||
607 | mSuspendTimer = new QTimer( this ); | 607 | mSuspendTimer = new QTimer( this ); |
608 | mAlarmTimer = new QTimer( this ); | 608 | mAlarmTimer = new QTimer( this ); |
609 | mRecheckAlarmTimer = new QTimer( this ); | 609 | mRecheckAlarmTimer = new QTimer( this ); |
610 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 610 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
611 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 611 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
612 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 612 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
613 | mAlarmDialog = new AlarmDialog( this ); | 613 | mAlarmDialog = new AlarmDialog( this ); |
614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
615 | mAlarmDialog->setServerNotification( false ); | 615 | mAlarmDialog->setServerNotification( false ); |
616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
617 | 617 | ||
618 | 618 | ||
619 | #ifndef DESKTOP_VERSION | 619 | #ifndef DESKTOP_VERSION |
620 | //US listen for arriving address resultsets | 620 | //US listen for arriving address resultsets |
621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
623 | #endif | 623 | #endif |
624 | mDateNavigator->setCalendar( mCalendar ); | 624 | mDateNavigator->setCalendar( mCalendar ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | CalendarView::~CalendarView() | 628 | CalendarView::~CalendarView() |
629 | { | 629 | { |
630 | // kdDebug() << "~CalendarView()" << endl; | 630 | // kdDebug() << "~CalendarView()" << endl; |
631 | //qDebug("CalendarView::~CalendarView() "); | 631 | //qDebug("CalendarView::~CalendarView() "); |
632 | delete mDialogManager; | 632 | delete mDialogManager; |
633 | delete mViewManager; | 633 | delete mViewManager; |
634 | delete mStorage; | 634 | delete mStorage; |
635 | delete mDateFrame ; | 635 | delete mDateFrame ; |
636 | delete beamDialog; | 636 | delete beamDialog; |
637 | delete mEventViewerDialog; | 637 | delete mEventViewerDialog; |
638 | //kdDebug() << "~CalendarView() done" << endl; | 638 | //kdDebug() << "~CalendarView() done" << endl; |
639 | } | 639 | } |
640 | void CalendarView::checkAlarms() | 640 | void CalendarView::checkAlarms() |
641 | { | 641 | { |
642 | KConfig *config = KOGlobals::config(); | 642 | KConfig *config = KOGlobals::config(); |
643 | config->setGroup( "AppRun" ); | 643 | config->setGroup( "AppRun" ); |
644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
645 | int daysto = dt.daysTo( QDate::currentDate() ); | ||
646 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | ||
647 | dt = dt.addDays( days ); | ||
645 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 648 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
646 | int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; | 649 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
647 | qDebug("KO: Reading program stop %d ", secs); | 650 | //qDebug("KO: Reading program stop %d ", secs); |
648 | //secs -= ( 3600 * 24*3 ); // debug only | 651 | //secs -= ( 3600 * 24*3 ); // debug only |
649 | QDateTime latest = dt.addSecs ( secs ); | 652 | QDateTime latest = dt.addSecs ( secs ); |
650 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 653 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
651 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 654 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
652 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 655 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
653 | QPtrList<Incidence> al; | 656 | QPtrList<Incidence> al; |
654 | Incidence* inL = el.first(); | 657 | Incidence* inL = el.first(); |
655 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 658 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
656 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 659 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
657 | while ( inL ) { | 660 | while ( inL ) { |
658 | bool ok = false; | 661 | bool ok = false; |
659 | int offset = 0; | 662 | int offset = 0; |
660 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 663 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
661 | if ( ok ) { | 664 | if ( ok ) { |
662 | //qDebug("OK %s",next.toString().latin1()); | 665 | //qDebug("OK %s",next.toString().latin1()); |
663 | if ( next < cur ) { | 666 | if ( next < cur ) { |
664 | al.append( inL ); | 667 | al.append( inL ); |
665 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 668 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
666 | } | 669 | } |
667 | } | 670 | } |
668 | inL = el.next(); | 671 | inL = el.next(); |
669 | } | 672 | } |
670 | if ( al.count() ) { | 673 | if ( al.count() ) { |
671 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 674 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
672 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 675 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
673 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 676 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
674 | lay->setSpacing( 0 ); | 677 | lay->setSpacing( 0 ); |
675 | lay->setMargin( 0 ); | 678 | lay->setMargin( 0 ); |
676 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 679 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
677 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 680 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
678 | lay->addWidget( matb ); | 681 | lay->addWidget( matb ); |
679 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 682 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
680 | int wid = 210; | 683 | int wid = 210; |
681 | int x = QApplication::desktop()->width() - wid - 7; | 684 | int x = QApplication::desktop()->width() - wid - 7; |
682 | int y = QApplication::desktop()->height() - wid - 70; | 685 | int y = QApplication::desktop()->height() - wid - 70; |
683 | dia->setGeometry ( x,y,wid,wid); | 686 | dia->setGeometry ( x,y,wid,wid); |
684 | } else { | 687 | } else { |
685 | int si = 220; | 688 | int si = 220; |
686 | if ( QApplication::desktop()->width() > 470 ) | 689 | if ( QApplication::desktop()->width() > 470 ) |
687 | si = 400; | 690 | si = 400; |
688 | dia->resize(si,si/2); | 691 | dia->resize(si,si/2); |
689 | } | 692 | } |
690 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 693 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
691 | dia->show(); | 694 | dia->show(); |
692 | 695 | ||
693 | } | 696 | } |
694 | } | 697 | } |
695 | void CalendarView::showDay( QDate d ) | 698 | void CalendarView::showDay( QDate d ) |
696 | { | 699 | { |
697 | dateNavigator()->blockSignals( true ); | 700 | dateNavigator()->blockSignals( true ); |
698 | dateNavigator()->selectDate( d ); | 701 | dateNavigator()->selectDate( d ); |
699 | dateNavigator()->blockSignals( false ); | 702 | dateNavigator()->blockSignals( false ); |
700 | mViewManager->showDayView(); | 703 | mViewManager->showDayView(); |
701 | //dateNavigator()->selectDate( d ); | 704 | //dateNavigator()->selectDate( d ); |
702 | } | 705 | } |
703 | void CalendarView::timerAlarm() | 706 | void CalendarView::timerAlarm() |
704 | { | 707 | { |
705 | //qDebug("CalendarView::timerAlarm() "); | 708 | //qDebug("CalendarView::timerAlarm() "); |
706 | computeAlarm(mAlarmNotification ); | 709 | computeAlarm(mAlarmNotification ); |
707 | } | 710 | } |
708 | 711 | ||
709 | void CalendarView::suspendAlarm() | 712 | void CalendarView::suspendAlarm() |
710 | { | 713 | { |
711 | //qDebug(" CalendarView::suspendAlarm() "); | 714 | //qDebug(" CalendarView::suspendAlarm() "); |
712 | computeAlarm(mSuspendAlarmNotification ); | 715 | computeAlarm(mSuspendAlarmNotification ); |
713 | 716 | ||
714 | } | 717 | } |
715 | 718 | ||
716 | void CalendarView::startAlarm( QString mess , QString filename) | 719 | void CalendarView::startAlarm( QString mess , QString filename) |
717 | { | 720 | { |
718 | 721 | ||
719 | topLevelWidget()->showNormal(); | 722 | topLevelWidget()->showNormal(); |
720 | topLevelWidget()->setActiveWindow(); | 723 | topLevelWidget()->setActiveWindow(); |
721 | topLevelWidget()->raise(); | 724 | topLevelWidget()->raise(); |
722 | 725 | ||
723 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 726 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
724 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 727 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
725 | 728 | ||
726 | } | 729 | } |
727 | 730 | ||
728 | void CalendarView::checkNextTimerAlarm() | 731 | void CalendarView::checkNextTimerAlarm() |
729 | { | 732 | { |
730 | mCalendar->checkAlarmForIncidence( 0, true ); | 733 | mCalendar->checkAlarmForIncidence( 0, true ); |
731 | } | 734 | } |
732 | 735 | ||
733 | void CalendarView::computeAlarm( QString msg ) | 736 | void CalendarView::computeAlarm( QString msg ) |
734 | { | 737 | { |
735 | 738 | ||
736 | QString mess = msg; | 739 | QString mess = msg; |
737 | QString mAlarmMessage = mess.mid( 9 ); | 740 | QString mAlarmMessage = mess.mid( 9 ); |
738 | QString filename = MainWindow::resourcePath(); | 741 | QString filename = MainWindow::resourcePath(); |
739 | filename += "koalarm.wav"; | 742 | filename += "koalarm.wav"; |
740 | QString tempfilename; | 743 | QString tempfilename; |
741 | if ( mess.left( 13 ) == "suspend_alarm") { | 744 | if ( mess.left( 13 ) == "suspend_alarm") { |
742 | bool error = false; | 745 | bool error = false; |
743 | int len = mess.mid( 13 ).find("+++"); | 746 | int len = mess.mid( 13 ).find("+++"); |
744 | if ( len < 2 ) | 747 | if ( len < 2 ) |
745 | error = true; | 748 | error = true; |
746 | else { | 749 | else { |
747 | tempfilename = mess.mid( 13, len ); | 750 | tempfilename = mess.mid( 13, len ); |
748 | if ( !QFile::exists( tempfilename ) ) | 751 | if ( !QFile::exists( tempfilename ) ) |
749 | error = true; | 752 | error = true; |
750 | } | 753 | } |
751 | if ( ! error ) { | 754 | if ( ! error ) { |
752 | filename = tempfilename; | 755 | filename = tempfilename; |
753 | } | 756 | } |
754 | mAlarmMessage = mess.mid( 13+len+3 ); | 757 | mAlarmMessage = mess.mid( 13+len+3 ); |
755 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 758 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
756 | startAlarm( mAlarmMessage, filename); | 759 | startAlarm( mAlarmMessage, filename); |
757 | return; | 760 | return; |
758 | } | 761 | } |
759 | if ( mess.left( 11 ) == "timer_alarm") { | 762 | if ( mess.left( 11 ) == "timer_alarm") { |
760 | //mTimerTime = 0; | 763 | //mTimerTime = 0; |
761 | startAlarm( mess.mid( 11 ), filename ); | 764 | startAlarm( mess.mid( 11 ), filename ); |
762 | return; | 765 | return; |
763 | } | 766 | } |
764 | if ( mess.left( 10 ) == "proc_alarm") { | 767 | if ( mess.left( 10 ) == "proc_alarm") { |
765 | bool error = false; | 768 | bool error = false; |
766 | int len = mess.mid( 10 ).find("+++"); | 769 | int len = mess.mid( 10 ).find("+++"); |
767 | if ( len < 2 ) | 770 | if ( len < 2 ) |
768 | error = true; | 771 | error = true; |
769 | else { | 772 | else { |
770 | tempfilename = mess.mid( 10, len ); | 773 | tempfilename = mess.mid( 10, len ); |
771 | if ( !QFile::exists( tempfilename ) ) | 774 | if ( !QFile::exists( tempfilename ) ) |
772 | error = true; | 775 | error = true; |
773 | } | 776 | } |
774 | if ( error ) { | 777 | if ( error ) { |
775 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 778 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
776 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 779 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
777 | } else { | 780 | } else { |
778 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 781 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
779 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 782 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
780 | #ifndef _WIN32_ | 783 | #ifndef _WIN32_ |
781 | if ( vfork () == 0 ) { | 784 | if ( vfork () == 0 ) { |
782 | execl ( tempfilename.latin1(), 0 ); | 785 | execl ( tempfilename.latin1(), 0 ); |
783 | return; | 786 | return; |
784 | } | 787 | } |
785 | #else | 788 | #else |
786 | QProcess* p = new QProcess(); | 789 | QProcess* p = new QProcess(); |
787 | p->addArgument( tempfilename.latin1() ); | 790 | p->addArgument( tempfilename.latin1() ); |
788 | p->start(); | 791 | p->start(); |
789 | return; | 792 | return; |
790 | #endif | 793 | #endif |
791 | 794 | ||
792 | return; | 795 | return; |
793 | } | 796 | } |
794 | 797 | ||
795 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 798 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
796 | } | 799 | } |
797 | if ( mess.left( 11 ) == "audio_alarm") { | 800 | if ( mess.left( 11 ) == "audio_alarm") { |
798 | bool error = false; | 801 | bool error = false; |
799 | int len = mess.mid( 11 ).find("+++"); | 802 | int len = mess.mid( 11 ).find("+++"); |
800 | if ( len < 2 ) | 803 | if ( len < 2 ) |
801 | error = true; | 804 | error = true; |
802 | else { | 805 | else { |
803 | tempfilename = mess.mid( 11, len ); | 806 | tempfilename = mess.mid( 11, len ); |
804 | if ( !QFile::exists( tempfilename ) ) | 807 | if ( !QFile::exists( tempfilename ) ) |
805 | error = true; | 808 | error = true; |
806 | } | 809 | } |
807 | if ( ! error ) { | 810 | if ( ! error ) { |
808 | filename = tempfilename; | 811 | filename = tempfilename; |
809 | } | 812 | } |
810 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 813 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
811 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 814 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
812 | } | 815 | } |
813 | if ( mess.left( 9 ) == "cal_alarm") { | 816 | if ( mess.left( 9 ) == "cal_alarm") { |
814 | mAlarmMessage = mess.mid( 9 ) ; | 817 | mAlarmMessage = mess.mid( 9 ) ; |
815 | } | 818 | } |
816 | 819 | ||
817 | startAlarm( mAlarmMessage, filename ); | 820 | startAlarm( mAlarmMessage, filename ); |
818 | 821 | ||
819 | 822 | ||
820 | } | 823 | } |
821 | 824 | ||
822 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 825 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
823 | { | 826 | { |
824 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 827 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
825 | 828 | ||
826 | mSuspendAlarmNotification = noti; | 829 | mSuspendAlarmNotification = noti; |
827 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 830 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
828 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 831 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
829 | mSuspendTimer->start( ms , true ); | 832 | mSuspendTimer->start( ms , true ); |
830 | 833 | ||
831 | } | 834 | } |
832 | 835 | ||
833 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 836 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
834 | { | 837 | { |
835 | mNextAlarmDateTime = qdt; | 838 | mNextAlarmDateTime = qdt; |
836 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 839 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
837 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 840 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
838 | #ifndef DESKTOP_VERSION | 841 | #ifndef DESKTOP_VERSION |
839 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 842 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
840 | #endif | 843 | #endif |
841 | return; | 844 | return; |
842 | } | 845 | } |
843 | int maxSec; | 846 | int maxSec; |
@@ -1969,394 +1972,412 @@ bool CalendarView::saveCalendar( QString filename ) | |||
1969 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1972 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1970 | if ( mViewManager->currentView() ) | 1973 | if ( mViewManager->currentView() ) |
1971 | mViewManager->currentView()->flushView(); | 1974 | mViewManager->currentView()->flushView(); |
1972 | 1975 | ||
1973 | 1976 | ||
1974 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1977 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1975 | mStorage->setSaveFormat( new ICalFormat() ); | 1978 | mStorage->setSaveFormat( new ICalFormat() ); |
1976 | mStorage->setFileName( filename ); | 1979 | mStorage->setFileName( filename ); |
1977 | bool success; | 1980 | bool success; |
1978 | success = mStorage->save(); | 1981 | success = mStorage->save(); |
1979 | if ( !success ) { | 1982 | if ( !success ) { |
1980 | return false; | 1983 | return false; |
1981 | } | 1984 | } |
1982 | if ( filename == MainWindow::defaultFileName() ) { | 1985 | if ( filename == MainWindow::defaultFileName() ) { |
1983 | setLoadedFileVersion( lfv ); | 1986 | setLoadedFileVersion( lfv ); |
1984 | watchSavedFile(); | 1987 | watchSavedFile(); |
1985 | } | 1988 | } |
1986 | return true; | 1989 | return true; |
1987 | } | 1990 | } |
1988 | 1991 | ||
1989 | void CalendarView::closeCalendar() | 1992 | void CalendarView::closeCalendar() |
1990 | { | 1993 | { |
1991 | 1994 | ||
1992 | // child windows no longer valid | 1995 | // child windows no longer valid |
1993 | clearAllViews(); | 1996 | clearAllViews(); |
1994 | emit closingDown(); | 1997 | emit closingDown(); |
1995 | 1998 | ||
1996 | mCalendar->close(); | 1999 | mCalendar->close(); |
1997 | setModified(false); | 2000 | setModified(false); |
1998 | updateView(); | 2001 | updateView(); |
1999 | } | 2002 | } |
2000 | 2003 | ||
2001 | void CalendarView::archiveCalendar() | 2004 | void CalendarView::archiveCalendar() |
2002 | { | 2005 | { |
2003 | mDialogManager->showArchiveDialog(); | 2006 | mDialogManager->showArchiveDialog(); |
2004 | } | 2007 | } |
2005 | 2008 | ||
2006 | 2009 | ||
2007 | void CalendarView::readSettings() | 2010 | void CalendarView::readSettings() |
2008 | { | 2011 | { |
2009 | 2012 | ||
2010 | 2013 | ||
2011 | // mViewManager->showAgendaView(); | 2014 | // mViewManager->showAgendaView(); |
2012 | QString str; | 2015 | QString str; |
2013 | //qDebug("CalendarView::readSettings() "); | 2016 | //qDebug("CalendarView::readSettings() "); |
2014 | // read settings from the KConfig, supplying reasonable | 2017 | // read settings from the KConfig, supplying reasonable |
2015 | // defaults where none are to be found | 2018 | // defaults where none are to be found |
2016 | KConfig *config = KOGlobals::config(); | 2019 | KConfig *config = KOGlobals::config(); |
2017 | #ifndef KORG_NOSPLITTER | 2020 | #ifndef KORG_NOSPLITTER |
2018 | config->setGroup("KOrganizer Geometry"); | 2021 | config->setGroup("KOrganizer Geometry"); |
2019 | 2022 | ||
2020 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2023 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2021 | if (sizes.count() != 2) { | 2024 | if (sizes.count() != 2) { |
2022 | sizes << mDateNavigator->minimumSizeHint().width(); | 2025 | sizes << mDateNavigator->minimumSizeHint().width(); |
2023 | sizes << 300; | 2026 | sizes << 300; |
2024 | } | 2027 | } |
2025 | mPanner->setSizes(sizes); | 2028 | mPanner->setSizes(sizes); |
2026 | 2029 | ||
2027 | sizes = config->readIntListEntry("Separator2"); | 2030 | sizes = config->readIntListEntry("Separator2"); |
2028 | if ( ( mResourceView && sizes.count() == 4 ) || | 2031 | if ( ( mResourceView && sizes.count() == 4 ) || |
2029 | ( !mResourceView && sizes.count() == 3 ) ) { | 2032 | ( !mResourceView && sizes.count() == 3 ) ) { |
2030 | mLeftSplitter->setSizes(sizes); | 2033 | mLeftSplitter->setSizes(sizes); |
2031 | } | 2034 | } |
2032 | #endif | 2035 | #endif |
2033 | globalFlagBlockAgenda = 1; | 2036 | globalFlagBlockAgenda = 1; |
2034 | mViewManager->showAgendaView(); | 2037 | mViewManager->showAgendaView(); |
2035 | //mViewManager->readSettings( config ); | 2038 | //mViewManager->readSettings( config ); |
2036 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2039 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2037 | readFilterSettings(config); | 2040 | readFilterSettings(config); |
2038 | 2041 | ||
2039 | #ifdef DESKTOP_VERSION | 2042 | #ifdef DESKTOP_VERSION |
2040 | config->setGroup("WidgetLayout"); | 2043 | config->setGroup("WidgetLayout"); |
2041 | QStringList list; | 2044 | QStringList list; |
2042 | list = config->readListEntry("MainLayout"); | 2045 | list = config->readListEntry("MainLayout"); |
2043 | int x,y,w,h; | 2046 | int x,y,w,h; |
2044 | if ( ! list.isEmpty() ) { | 2047 | if ( ! list.isEmpty() ) { |
2045 | x = list[0].toInt(); | 2048 | x = list[0].toInt(); |
2046 | y = list[1].toInt(); | 2049 | y = list[1].toInt(); |
2047 | w = list[2].toInt(); | 2050 | w = list[2].toInt(); |
2048 | h = list[3].toInt(); | 2051 | h = list[3].toInt(); |
2049 | KApplication::testCoords( &x,&y,&w,&h ); | 2052 | KApplication::testCoords( &x,&y,&w,&h ); |
2050 | topLevelWidget()->setGeometry(x,y,w,h); | 2053 | topLevelWidget()->setGeometry(x,y,w,h); |
2051 | 2054 | ||
2052 | } else { | 2055 | } else { |
2053 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2056 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2054 | } | 2057 | } |
2055 | list = config->readListEntry("EditEventLayout"); | 2058 | list = config->readListEntry("EditEventLayout"); |
2056 | if ( ! list.isEmpty() ) { | 2059 | if ( ! list.isEmpty() ) { |
2057 | x = list[0].toInt(); | 2060 | x = list[0].toInt(); |
2058 | y = list[1].toInt(); | 2061 | y = list[1].toInt(); |
2059 | w = list[2].toInt(); | 2062 | w = list[2].toInt(); |
2060 | h = list[3].toInt(); | 2063 | h = list[3].toInt(); |
2061 | KApplication::testCoords( &x,&y,&w,&h ); | 2064 | KApplication::testCoords( &x,&y,&w,&h ); |
2062 | mEventEditor->setGeometry(x,y,w,h); | 2065 | mEventEditor->setGeometry(x,y,w,h); |
2063 | 2066 | ||
2064 | } | 2067 | } |
2065 | list = config->readListEntry("EditTodoLayout"); | 2068 | list = config->readListEntry("EditTodoLayout"); |
2066 | if ( ! list.isEmpty() ) { | 2069 | if ( ! list.isEmpty() ) { |
2067 | x = list[0].toInt(); | 2070 | x = list[0].toInt(); |
2068 | y = list[1].toInt(); | 2071 | y = list[1].toInt(); |
2069 | w = list[2].toInt(); | 2072 | w = list[2].toInt(); |
2070 | h = list[3].toInt(); | 2073 | h = list[3].toInt(); |
2071 | KApplication::testCoords( &x,&y,&w,&h ); | 2074 | KApplication::testCoords( &x,&y,&w,&h ); |
2072 | mTodoEditor->setGeometry(x,y,w,h); | 2075 | mTodoEditor->setGeometry(x,y,w,h); |
2073 | 2076 | ||
2074 | } | 2077 | } |
2075 | list = config->readListEntry("ViewerLayout"); | 2078 | list = config->readListEntry("ViewerLayout"); |
2076 | if ( ! list.isEmpty() ) { | 2079 | if ( ! list.isEmpty() ) { |
2077 | x = list[0].toInt(); | 2080 | x = list[0].toInt(); |
2078 | y = list[1].toInt(); | 2081 | y = list[1].toInt(); |
2079 | w = list[2].toInt(); | 2082 | w = list[2].toInt(); |
2080 | h = list[3].toInt(); | 2083 | h = list[3].toInt(); |
2081 | KApplication::testCoords( &x,&y,&w,&h ); | 2084 | KApplication::testCoords( &x,&y,&w,&h ); |
2082 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2085 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2083 | } | 2086 | } |
2084 | #endif | 2087 | #endif |
2085 | config->setGroup( "Views" ); | 2088 | config->setGroup( "Views" ); |
2086 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2089 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2087 | 2090 | ||
2088 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2091 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2089 | 2092 | ||
2090 | int resetval = 0; | 2093 | int resetval = 0; |
2091 | int maxVal = 0; | 2094 | int maxVal = 0; |
2092 | if (sizes.count() != 3) { | 2095 | if (sizes.count() != 3) { |
2093 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2096 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2094 | resetval = mDateNavigator->sizeHint().width()+2; | 2097 | resetval = mDateNavigator->sizeHint().width()+2; |
2095 | } else { | 2098 | } else { |
2096 | resetval = mDateNavigator->sizeHint().height()+2; | 2099 | resetval = mDateNavigator->sizeHint().height()+2; |
2097 | } | 2100 | } |
2098 | } | 2101 | } |
2099 | if ( resetval ) { | 2102 | if ( resetval ) { |
2100 | sizes.clear(); | 2103 | sizes.clear(); |
2101 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2104 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2102 | maxVal = QApplication::desktop()->width() -10; | 2105 | maxVal = QApplication::desktop()->width() -10; |
2103 | } else { | 2106 | } else { |
2104 | maxVal = QApplication::desktop()->height()-10; | 2107 | maxVal = QApplication::desktop()->height()-10; |
2105 | } | 2108 | } |
2106 | sizes << resetval; | 2109 | sizes << resetval; |
2107 | if ( maxVal < resetval + resetval) | 2110 | if ( maxVal < resetval + resetval) |
2108 | resetval = maxVal - resetval; | 2111 | resetval = maxVal - resetval; |
2109 | sizes << resetval; | 2112 | sizes << resetval; |
2110 | sizes << 100; | 2113 | sizes << 100; |
2111 | } | 2114 | } |
2112 | mLeftFrame->setSizes(sizes); | 2115 | mLeftFrame->setSizes(sizes); |
2113 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2116 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2114 | resetval = 0; | 2117 | resetval = 0; |
2115 | maxVal = 0; | 2118 | maxVal = 0; |
2116 | if (sizes.count() != 2) { | 2119 | if (sizes.count() != 2) { |
2117 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2120 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2118 | resetval = mDateNavigator->sizeHint().width()+2; | 2121 | resetval = mDateNavigator->sizeHint().width()+2; |
2119 | } else { | 2122 | } else { |
2120 | resetval = mDateNavigator->sizeHint().height()+2; | 2123 | resetval = mDateNavigator->sizeHint().height()+2; |
2121 | } | 2124 | } |
2122 | } | 2125 | } |
2123 | if ( resetval ) { | 2126 | if ( resetval ) { |
2124 | sizes.clear(); | 2127 | sizes.clear(); |
2125 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2128 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2126 | maxVal = QApplication::desktop()->width() -10; | 2129 | maxVal = QApplication::desktop()->width() -10; |
2127 | } else { | 2130 | } else { |
2128 | maxVal = QApplication::desktop()->height()-10; | 2131 | maxVal = QApplication::desktop()->height()-10; |
2129 | } | 2132 | } |
2130 | sizes << resetval; | 2133 | sizes << resetval; |
2131 | if ( maxVal < resetval + resetval) | 2134 | if ( maxVal < resetval + resetval) |
2132 | resetval = maxVal - resetval; | 2135 | resetval = maxVal - resetval; |
2133 | sizes << resetval; | 2136 | sizes << resetval; |
2134 | } | 2137 | } |
2135 | mMainFrame->setSizes(sizes); | 2138 | mMainFrame->setSizes(sizes); |
2136 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2139 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2137 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2140 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2138 | else mNavigator->selectDates( dateCount ); | 2141 | else mNavigator->selectDates( dateCount ); |
2139 | // mViewManager->readSettings( config ); | 2142 | // mViewManager->readSettings( config ); |
2140 | updateConfig(); | 2143 | updateConfig(); |
2141 | globalFlagBlockAgenda = 2; | 2144 | globalFlagBlockAgenda = 2; |
2142 | mViewManager->readSettings( config ); | 2145 | mViewManager->readSettings( config ); |
2143 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2146 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2144 | } | 2147 | } |
2145 | 2148 | ||
2146 | 2149 | ||
2147 | void CalendarView::writeSettings() | 2150 | void CalendarView::writeSettings() |
2148 | { | 2151 | { |
2149 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2152 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2150 | 2153 | ||
2151 | KConfig *config = KOGlobals::config(); | 2154 | KConfig *config = KOGlobals::config(); |
2152 | 2155 | ||
2153 | mViewManager->writeSettings( config ); | 2156 | mViewManager->writeSettings( config ); |
2154 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2157 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2155 | mDialogManager->writeSettings( config ); | 2158 | mDialogManager->writeSettings( config ); |
2156 | //KOPrefs::instance()->usrWriteConfig(); | 2159 | //KOPrefs::instance()->usrWriteConfig(); |
2157 | KOPrefs::instance()->writeConfig(); | 2160 | KOPrefs::instance()->writeConfig(); |
2158 | 2161 | ||
2159 | writeFilterSettings(config); | 2162 | writeFilterSettings(config); |
2160 | config->setGroup( "AppRun" ); | 2163 | config->setGroup( "AppRun" ); |
2161 | QDateTime dt ( QDate (2005,3,1), QTime( 0,0,0 ) ); | 2164 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2165 | int days = dt.daysTo( QDate::currentDate() ); | ||
2166 | dt = dt.addDays( days ); | ||
2162 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2167 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2163 | config->writeEntry( "LatestProgramStop", secs ); | 2168 | config->writeEntry( "LatestProgramStopDays", days ); |
2164 | qDebug("KO: Writing stop time: %d ", secs); | 2169 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2165 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2170 | //qDebug("KO: Writing stop time: %d ", secs); |
2166 | QDateTime latest = dt.addSecs ( secs ); | 2171 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2167 | qDebug("KO: Test termination on %s ", latest.toString().latin1()); | 2172 | //QDateTime latest = dt.addSecs ( secs ); |
2173 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | ||
2168 | config->setGroup( "Views" ); | 2174 | config->setGroup( "Views" ); |
2169 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2175 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2170 | 2176 | ||
2177 | #if 0 | ||
2178 | qDebug("********************* "); | ||
2179 | qDebug("Testcode secsto "); | ||
2180 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | ||
2181 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | ||
2182 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | ||
2183 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | ||
2184 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | ||
2185 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | ||
2186 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | ||
2187 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | ||
2188 | qDebug("********************* testcode end"); | ||
2189 | |||
2190 | #endif | ||
2191 | |||
2171 | QValueList<int> listINT = mLeftFrame->sizes(); | 2192 | QValueList<int> listINT = mLeftFrame->sizes(); |
2172 | config->writeEntry("Left Splitter Frame",listINT); | 2193 | config->writeEntry("Left Splitter Frame",listINT); |
2173 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2194 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2174 | config->writeEntry("Main Splitter Frame",listINT2); | 2195 | config->writeEntry("Main Splitter Frame",listINT2); |
2175 | #ifdef DESKTOP_VERSION | 2196 | #ifdef DESKTOP_VERSION |
2176 | config->setGroup("WidgetLayout"); | 2197 | config->setGroup("WidgetLayout"); |
2177 | QStringList list ;//= config->readListEntry("MainLayout"); | 2198 | QStringList list ;//= config->readListEntry("MainLayout"); |
2178 | int x,y,w,h; | 2199 | int x,y,w,h; |
2179 | QWidget* wid; | 2200 | QWidget* wid; |
2180 | wid = topLevelWidget(); | 2201 | wid = topLevelWidget(); |
2181 | x = wid->geometry().x(); | 2202 | x = wid->geometry().x(); |
2182 | y = wid->geometry().y(); | 2203 | y = wid->geometry().y(); |
2183 | w = wid->width(); | 2204 | w = wid->width(); |
2184 | h = wid->height(); | 2205 | h = wid->height(); |
2185 | list.clear(); | 2206 | list.clear(); |
2186 | list << QString::number( x ); | 2207 | list << QString::number( x ); |
2187 | list << QString::number( y ); | 2208 | list << QString::number( y ); |
2188 | list << QString::number( w ); | 2209 | list << QString::number( w ); |
2189 | list << QString::number( h ); | 2210 | list << QString::number( h ); |
2190 | config->writeEntry("MainLayout",list ); | 2211 | config->writeEntry("MainLayout",list ); |
2191 | 2212 | ||
2192 | wid = mEventEditor; | 2213 | wid = mEventEditor; |
2193 | x = wid->geometry().x(); | 2214 | x = wid->geometry().x(); |
2194 | y = wid->geometry().y(); | 2215 | y = wid->geometry().y(); |
2195 | w = wid->width(); | 2216 | w = wid->width(); |
2196 | h = wid->height(); | 2217 | h = wid->height(); |
2197 | list.clear(); | 2218 | list.clear(); |
2198 | list << QString::number( x ); | 2219 | list << QString::number( x ); |
2199 | list << QString::number( y ); | 2220 | list << QString::number( y ); |
2200 | list << QString::number( w ); | 2221 | list << QString::number( w ); |
2201 | list << QString::number( h ); | 2222 | list << QString::number( h ); |
2202 | config->writeEntry("EditEventLayout",list ); | 2223 | config->writeEntry("EditEventLayout",list ); |
2203 | 2224 | ||
2204 | wid = mTodoEditor; | 2225 | wid = mTodoEditor; |
2205 | x = wid->geometry().x(); | 2226 | x = wid->geometry().x(); |
2206 | y = wid->geometry().y(); | 2227 | y = wid->geometry().y(); |
2207 | w = wid->width(); | 2228 | w = wid->width(); |
2208 | h = wid->height(); | 2229 | h = wid->height(); |
2209 | list.clear(); | 2230 | list.clear(); |
2210 | list << QString::number( x ); | 2231 | list << QString::number( x ); |
2211 | list << QString::number( y ); | 2232 | list << QString::number( y ); |
2212 | list << QString::number( w ); | 2233 | list << QString::number( w ); |
2213 | list << QString::number( h ); | 2234 | list << QString::number( h ); |
2214 | config->writeEntry("EditTodoLayout",list ); | 2235 | config->writeEntry("EditTodoLayout",list ); |
2215 | wid = getEventViewerDialog(); | 2236 | wid = getEventViewerDialog(); |
2216 | x = wid->geometry().x(); | 2237 | x = wid->geometry().x(); |
2217 | y = wid->geometry().y(); | 2238 | y = wid->geometry().y(); |
2218 | w = wid->width(); | 2239 | w = wid->width(); |
2219 | h = wid->height(); | 2240 | h = wid->height(); |
2220 | list.clear(); | 2241 | list.clear(); |
2221 | list << QString::number( x ); | 2242 | list << QString::number( x ); |
2222 | list << QString::number( y ); | 2243 | list << QString::number( y ); |
2223 | list << QString::number( w ); | 2244 | list << QString::number( w ); |
2224 | list << QString::number( h ); | 2245 | list << QString::number( h ); |
2225 | config->writeEntry("ViewerLayout",list ); | 2246 | config->writeEntry("ViewerLayout",list ); |
2226 | wid = mDialogManager->getSearchDialog(); | 2247 | wid = mDialogManager->getSearchDialog(); |
2227 | if ( wid ) { | 2248 | if ( wid ) { |
2228 | x = wid->geometry().x(); | 2249 | x = wid->geometry().x(); |
2229 | y = wid->geometry().y(); | 2250 | y = wid->geometry().y(); |
2230 | w = wid->width(); | 2251 | w = wid->width(); |
2231 | h = wid->height(); | 2252 | h = wid->height(); |
2232 | list.clear(); | 2253 | list.clear(); |
2233 | list << QString::number( x ); | 2254 | list << QString::number( x ); |
2234 | list << QString::number( y ); | 2255 | list << QString::number( y ); |
2235 | list << QString::number( w ); | 2256 | list << QString::number( w ); |
2236 | list << QString::number( h ); | 2257 | list << QString::number( h ); |
2237 | config->writeEntry("SearchLayout",list ); | 2258 | config->writeEntry("SearchLayout",list ); |
2238 | } | 2259 | } |
2239 | #endif | 2260 | #endif |
2240 | 2261 | ||
2241 | 2262 | ||
2242 | config->sync(); | 2263 | config->sync(); |
2243 | } | 2264 | } |
2244 | 2265 | ||
2245 | void CalendarView::readFilterSettings(KConfig *config) | 2266 | void CalendarView::readFilterSettings(KConfig *config) |
2246 | { | 2267 | { |
2247 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2268 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2248 | 2269 | ||
2249 | mFilters.clear(); | 2270 | mFilters.clear(); |
2250 | 2271 | ||
2251 | config->setGroup("General"); | 2272 | config->setGroup("General"); |
2252 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2273 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2253 | 2274 | ||
2254 | QStringList::ConstIterator it = filterList.begin(); | 2275 | QStringList::ConstIterator it = filterList.begin(); |
2255 | QStringList::ConstIterator end = filterList.end(); | 2276 | QStringList::ConstIterator end = filterList.end(); |
2256 | while(it != end) { | 2277 | while(it != end) { |
2257 | // kdDebug() << " filter: " << (*it) << endl; | 2278 | // kdDebug() << " filter: " << (*it) << endl; |
2258 | 2279 | ||
2259 | CalFilter *filter; | 2280 | CalFilter *filter; |
2260 | filter = new CalFilter(*it); | 2281 | filter = new CalFilter(*it); |
2261 | config->setGroup("Filter_" + (*it).utf8()); | 2282 | config->setGroup("Filter_" + (*it).utf8()); |
2262 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2283 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2263 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2284 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2264 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2285 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2265 | mFilters.append(filter); | 2286 | mFilters.append(filter); |
2266 | 2287 | ||
2267 | ++it; | 2288 | ++it; |
2268 | } | 2289 | } |
2269 | 2290 | ||
2270 | if (mFilters.count() == 0) { | 2291 | if (mFilters.count() == 0) { |
2271 | CalFilter *filter = new CalFilter(i18n("Default")); | 2292 | CalFilter *filter = new CalFilter(i18n("Default")); |
2272 | mFilters.append(filter); | 2293 | mFilters.append(filter); |
2273 | } | 2294 | } |
2274 | mFilterView->updateFilters(); | 2295 | mFilterView->updateFilters(); |
2275 | config->setGroup("FilterView"); | 2296 | config->setGroup("FilterView"); |
2276 | 2297 | ||
2277 | mFilterView->blockSignals(true); | 2298 | mFilterView->blockSignals(true); |
2278 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2299 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2279 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2300 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2280 | mFilterView->blockSignals(false); | 2301 | mFilterView->blockSignals(false); |
2281 | // We do it manually to avoid it being done twice by the above calls | 2302 | // We do it manually to avoid it being done twice by the above calls |
2282 | updateFilter(); | 2303 | updateFilter(); |
2283 | } | 2304 | } |
2284 | 2305 | ||
2285 | void CalendarView::writeFilterSettings(KConfig *config) | 2306 | void CalendarView::writeFilterSettings(KConfig *config) |
2286 | { | 2307 | { |
2287 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2308 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2288 | 2309 | ||
2289 | QStringList filterList; | 2310 | QStringList filterList; |
2290 | 2311 | ||
2291 | CalFilter *filter = mFilters.first(); | 2312 | CalFilter *filter = mFilters.first(); |
2292 | while(filter) { | 2313 | while(filter) { |
2293 | // kdDebug() << " fn: " << filter->name() << endl; | 2314 | // kdDebug() << " fn: " << filter->name() << endl; |
2294 | filterList << filter->name(); | 2315 | filterList << filter->name(); |
2295 | config->setGroup("Filter_" + filter->name().utf8()); | 2316 | config->setGroup("Filter_" + filter->name().utf8()); |
2296 | config->writeEntry("Criteria",filter->criteria()); | 2317 | config->writeEntry("Criteria",filter->criteria()); |
2297 | config->writeEntry("CategoryList",filter->categoryList()); | 2318 | config->writeEntry("CategoryList",filter->categoryList()); |
2298 | filter = mFilters.next(); | 2319 | filter = mFilters.next(); |
2299 | } | 2320 | } |
2300 | config->setGroup("General"); | 2321 | config->setGroup("General"); |
2301 | config->writeEntry("CalendarFilters",filterList); | 2322 | config->writeEntry("CalendarFilters",filterList); |
2302 | 2323 | ||
2303 | config->setGroup("FilterView"); | 2324 | config->setGroup("FilterView"); |
2304 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2325 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2305 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2326 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2306 | } | 2327 | } |
2307 | 2328 | ||
2308 | 2329 | ||
2309 | void CalendarView::goToday() | 2330 | void CalendarView::goToday() |
2310 | { | 2331 | { |
2311 | if ( mViewManager->currentView()->isMonthView() ) | 2332 | if ( mViewManager->currentView()->isMonthView() ) |
2312 | mNavigator->selectTodayMonth(); | 2333 | mNavigator->selectTodayMonth(); |
2313 | else | 2334 | else |
2314 | mNavigator->selectToday(); | 2335 | mNavigator->selectToday(); |
2315 | } | 2336 | } |
2316 | 2337 | ||
2317 | void CalendarView::goNext() | 2338 | void CalendarView::goNext() |
2318 | { | 2339 | { |
2319 | mNavigator->selectNext(); | 2340 | mNavigator->selectNext(); |
2320 | } | 2341 | } |
2321 | 2342 | ||
2322 | void CalendarView::goPrevious() | 2343 | void CalendarView::goPrevious() |
2323 | { | 2344 | { |
2324 | mNavigator->selectPrevious(); | 2345 | mNavigator->selectPrevious(); |
2325 | } | 2346 | } |
2326 | void CalendarView::goNextMonth() | 2347 | void CalendarView::goNextMonth() |
2327 | { | 2348 | { |
2328 | mNavigator->selectNextMonth(); | 2349 | mNavigator->selectNextMonth(); |
2329 | } | 2350 | } |
2330 | 2351 | ||
2331 | void CalendarView::goPreviousMonth() | 2352 | void CalendarView::goPreviousMonth() |
2332 | { | 2353 | { |
2333 | mNavigator->selectPreviousMonth(); | 2354 | mNavigator->selectPreviousMonth(); |
2334 | } | 2355 | } |
2335 | void CalendarView::writeLocale() | 2356 | void CalendarView::writeLocale() |
2336 | { | 2357 | { |
2337 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2358 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2338 | #if 0 | 2359 | #if 0 |
2339 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2360 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2340 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2361 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2341 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2362 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2342 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2363 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2343 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2364 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2344 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2365 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2345 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2366 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2346 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2367 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2347 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2368 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2348 | KOPrefs::instance()->mDaylightsavingStart, | 2369 | KOPrefs::instance()->mDaylightsavingStart, |
2349 | KOPrefs::instance()->mDaylightsavingEnd ); | 2370 | KOPrefs::instance()->mDaylightsavingEnd ); |
2350 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2371 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2351 | #endif | 2372 | #endif |
2352 | } | 2373 | } |
2353 | void CalendarView::updateConfig() | 2374 | void CalendarView::updateConfig() |
2354 | { | 2375 | { |
2355 | writeLocale(); | 2376 | writeLocale(); |
2356 | if ( KOPrefs::instance()->mUseAppColors ) | 2377 | if ( KOPrefs::instance()->mUseAppColors ) |
2357 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2378 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2358 | emit configChanged(); | 2379 | emit configChanged(); |
2359 | mTodoList->updateConfig(); | 2380 | mTodoList->updateConfig(); |
2360 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2381 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2361 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2382 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2362 | // To make the "fill window" configurations work | 2383 | // To make the "fill window" configurations work |
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index c64f325..383e711 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -1,88 +1,88 @@ | |||
1 | #include <kfiledialog.h> | 1 | #include <kfiledialog.h> |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | #ifndef DESKTOP_VERSION | 8 | #ifndef DESKTOP_VERSION |
9 | //US orig#include <ofileselector.h> | 9 | //US orig#include <ofileselector.h> |
10 | #include <ofileselector_p.h> | 10 | #include <ofileselector_p.h> |
11 | QString KFileDialog::getSaveFileName( const QString & fn, | 11 | QString KFileDialog::getSaveFileName( const QString & fn, |
12 | const QString & cap , QWidget * par ) | 12 | const QString & cap , QWidget * par ) |
13 | { | 13 | { |
14 | QString retfile = ""; | 14 | QString retfile = ""; |
15 | QDialog dia ( par, "input-dialog", true ); | 15 | QDialog dia ( par, "input-dialog", true ); |
16 | QVBoxLayout lay( &dia ); | 16 | QVBoxLayout lay( &dia ); |
17 | lay.setMargin(7); | 17 | lay.setMargin(7); |
18 | lay.setSpacing(7); | 18 | lay.setSpacing(7); |
19 | QString file = fn; | 19 | QString file = fn; |
20 | if ( file.isEmpty() ) | 20 | if ( file.isEmpty() ) |
21 | file = QDir::homeDirPath()+"/*"; | 21 | file = QDir::homeDirPath()+"/*"; |
22 | QFileInfo fi ( file ); | 22 | QFileInfo fi ( file ); |
23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); | 23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); |
24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
25 | lay.addWidget( &o); | 25 | lay.addWidget( &o); |
26 | // o.setNewVisible( true ); | 26 | // o.setNewVisible( true ); |
27 | // o.setNameVisible( true ); | 27 | // o.setNameVisible( true ); |
28 | dia.showMaximized(); | 28 | dia.showMaximized(); |
29 | if ( cap.isEmpty() ) | 29 | if ( cap.isEmpty() ) |
30 | dia.setCaption( file ); | 30 | dia.setCaption( file ); |
31 | else | 31 | else |
32 | dia.setCaption( cap ); | 32 | dia.setCaption( cap ); |
33 | int res = dia.exec(); | 33 | int res = dia.exec(); |
34 | if ( res ) | 34 | if ( res ) |
35 | retfile = o.selectedName(); | 35 | retfile = o.selectedName(); |
36 | return retfile; | 36 | return retfile; |
37 | } | 37 | } |
38 | 38 | ||
39 | QString KFileDialog::getOpenFileName( const QString & fn, | 39 | QString KFileDialog::getOpenFileName( const QString & fn, |
40 | const QString & cap, QWidget * par ) | 40 | const QString & cap, QWidget * par ) |
41 | { | 41 | { |
42 | QString retfile = ""; | 42 | QString retfile = ""; |
43 | QDialog dia ( par, "input-dialog", true ); | 43 | QDialog dia ( par, "input-dialog", true ); |
44 | // QLineEdit lab ( &dia ); | 44 | // QLineEdit lab ( &dia ); |
45 | QVBoxLayout lay( &dia ); | 45 | QVBoxLayout lay( &dia ); |
46 | lay.setMargin(7); | 46 | lay.setMargin(7); |
47 | lay.setSpacing(7); | 47 | lay.setSpacing(7); |
48 | QString file = fn; | 48 | QString file = fn; |
49 | if ( file.isEmpty() ) | 49 | if ( file.isEmpty() ) |
50 | file = QDir::homeDirPath()+"/*";; | 50 | file = QDir::homeDirPath()+"/*";; |
51 | QFileInfo fi ( file ); | 51 | QFileInfo fi ( file ); |
52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
54 | lay.addWidget( &o); | 54 | lay.addWidget( &o); |
55 | dia.showMaximized(); | 55 | dia.showMaximized(); |
56 | dia.setCaption( cap ); | 56 | dia.setCaption( cap ); |
57 | int res = dia.exec(); | 57 | int res = dia.exec(); |
58 | if ( res ) | 58 | if ( res ) |
59 | retfile = o.selectedName(); | 59 | retfile = o.selectedName(); |
60 | return retfile; | 60 | return retfile; |
61 | } | 61 | } |
62 | QString KFileDialog::getExistingDirectory( const QString & fn, | 62 | QString KFileDialog::getExistingDirectory( const QString & fn, |
63 | const QString & cap, QWidget * par ) | 63 | const QString & cap, QWidget * par ) |
64 | { | 64 | { |
65 | return KFileDialog::getSaveFileName( fn, cap, pr ); | 65 | return KFileDialog::getSaveFileName( fn, cap, par ); |
66 | } | 66 | } |
67 | #else | 67 | #else |
68 | 68 | ||
69 | #include <qfiledialog.h> | 69 | #include <qfiledialog.h> |
70 | 70 | ||
71 | QString KFileDialog::getSaveFileName( const QString & fn, | 71 | QString KFileDialog::getSaveFileName( const QString & fn, |
72 | const QString & cap , QWidget * par ) | 72 | const QString & cap , QWidget * par ) |
73 | { | 73 | { |
74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); | 74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); |
75 | } | 75 | } |
76 | QString KFileDialog::getOpenFileName( const QString & fn, | 76 | QString KFileDialog::getOpenFileName( const QString & fn, |
77 | const QString & cap, QWidget * par ) | 77 | const QString & cap, QWidget * par ) |
78 | { | 78 | { |
79 | 79 | ||
80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); | 80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); |
81 | } | 81 | } |
82 | QString KFileDialog::getExistingDirectory( const QString & fn, | 82 | QString KFileDialog::getExistingDirectory( const QString & fn, |
83 | const QString & cap, QWidget * par ) | 83 | const QString & cap, QWidget * par ) |
84 | { | 84 | { |
85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); | 85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||