-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 23 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
3 files changed, 31 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 92fd59c..3a16fe6 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3481,271 +3481,277 @@ bool CalendarView::exportVCalendar( QString filename ) | |||
3481 | true); | 3481 | true); |
3482 | if (result != KMessageBox::Continue) return false; | 3482 | if (result != KMessageBox::Continue) return false; |
3483 | } | 3483 | } |
3484 | 3484 | ||
3485 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3485 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3486 | 3486 | ||
3487 | // Force correct extension | 3487 | // Force correct extension |
3488 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3488 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3489 | 3489 | ||
3490 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3490 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3491 | return storage.save(); | 3491 | return storage.save(); |
3492 | 3492 | ||
3493 | } | 3493 | } |
3494 | 3494 | ||
3495 | void CalendarView::eventUpdated(Incidence *) | 3495 | void CalendarView::eventUpdated(Incidence *) |
3496 | { | 3496 | { |
3497 | setModified(); | 3497 | setModified(); |
3498 | // Don't call updateView here. The code, which has caused the update of the | 3498 | // Don't call updateView here. The code, which has caused the update of the |
3499 | // event is responsible for updating the view. | 3499 | // event is responsible for updating the view. |
3500 | // updateView(); | 3500 | // updateView(); |
3501 | } | 3501 | } |
3502 | 3502 | ||
3503 | void CalendarView::adaptNavigationUnits() | 3503 | void CalendarView::adaptNavigationUnits() |
3504 | { | 3504 | { |
3505 | if (mViewManager->currentView()->isEventView()) { | 3505 | if (mViewManager->currentView()->isEventView()) { |
3506 | int days = mViewManager->currentView()->currentDateCount(); | 3506 | int days = mViewManager->currentView()->currentDateCount(); |
3507 | if (days == 1) { | 3507 | if (days == 1) { |
3508 | emit changeNavStringPrev(i18n("&Previous Day")); | 3508 | emit changeNavStringPrev(i18n("&Previous Day")); |
3509 | emit changeNavStringNext(i18n("&Next Day")); | 3509 | emit changeNavStringNext(i18n("&Next Day")); |
3510 | } else { | 3510 | } else { |
3511 | emit changeNavStringPrev(i18n("&Previous Week")); | 3511 | emit changeNavStringPrev(i18n("&Previous Week")); |
3512 | emit changeNavStringNext(i18n("&Next Week")); | 3512 | emit changeNavStringNext(i18n("&Next Week")); |
3513 | } | 3513 | } |
3514 | } | 3514 | } |
3515 | } | 3515 | } |
3516 | 3516 | ||
3517 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3517 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3518 | { | 3518 | { |
3519 | if ( incidence ) mTodoList->clearSelection(); | 3519 | if ( incidence ) mTodoList->clearSelection(); |
3520 | processIncidenceSelection( incidence ); | 3520 | processIncidenceSelection( incidence ); |
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3523 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3524 | { | 3524 | { |
3525 | if ( incidence && mViewManager->currentView() ) { | 3525 | if ( incidence && mViewManager->currentView() ) { |
3526 | mViewManager->currentView()->clearSelection(); | 3526 | mViewManager->currentView()->clearSelection(); |
3527 | } | 3527 | } |
3528 | processIncidenceSelection( incidence ); | 3528 | processIncidenceSelection( incidence ); |
3529 | } | 3529 | } |
3530 | 3530 | ||
3531 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3531 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3532 | { | 3532 | { |
3533 | if ( incidence == mSelectedIncidence ) return; | 3533 | if ( incidence == mSelectedIncidence ) return; |
3534 | 3534 | ||
3535 | mSelectedIncidence = incidence; | 3535 | mSelectedIncidence = incidence; |
3536 | 3536 | ||
3537 | emit incidenceSelected( mSelectedIncidence ); | 3537 | emit incidenceSelected( mSelectedIncidence ); |
3538 | 3538 | ||
3539 | if ( incidence && incidence->type() == "Event" ) { | 3539 | if ( incidence && incidence->type() == "Event" ) { |
3540 | Event *event = static_cast<Event *>( incidence ); | 3540 | Event *event = static_cast<Event *>( incidence ); |
3541 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3541 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3542 | emit organizerEventsSelected( true ); | 3542 | emit organizerEventsSelected( true ); |
3543 | } else { | 3543 | } else { |
3544 | emit organizerEventsSelected(false); | 3544 | emit organizerEventsSelected(false); |
3545 | } | 3545 | } |
3546 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3546 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3547 | KOPrefs::instance()->email() ) ) { | 3547 | KOPrefs::instance()->email() ) ) { |
3548 | emit groupEventsSelected( true ); | 3548 | emit groupEventsSelected( true ); |
3549 | } else { | 3549 | } else { |
3550 | emit groupEventsSelected(false); | 3550 | emit groupEventsSelected(false); |
3551 | } | 3551 | } |
3552 | return; | 3552 | return; |
3553 | } else { | 3553 | } else { |
3554 | if ( incidence && incidence->type() == "Todo" ) { | 3554 | if ( incidence && incidence->type() == "Todo" ) { |
3555 | emit todoSelected( true ); | 3555 | emit todoSelected( true ); |
3556 | Todo *event = static_cast<Todo *>( incidence ); | 3556 | Todo *event = static_cast<Todo *>( incidence ); |
3557 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3557 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3558 | emit organizerEventsSelected( true ); | 3558 | emit organizerEventsSelected( true ); |
3559 | } else { | 3559 | } else { |
3560 | emit organizerEventsSelected(false); | 3560 | emit organizerEventsSelected(false); |
3561 | } | 3561 | } |
3562 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3562 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3563 | KOPrefs::instance()->email() ) ) { | 3563 | KOPrefs::instance()->email() ) ) { |
3564 | emit groupEventsSelected( true ); | 3564 | emit groupEventsSelected( true ); |
3565 | } else { | 3565 | } else { |
3566 | emit groupEventsSelected(false); | 3566 | emit groupEventsSelected(false); |
3567 | } | 3567 | } |
3568 | return; | 3568 | return; |
3569 | } else { | 3569 | } else { |
3570 | emit todoSelected( false ); | 3570 | emit todoSelected( false ); |
3571 | emit organizerEventsSelected(false); | 3571 | emit organizerEventsSelected(false); |
3572 | emit groupEventsSelected(false); | 3572 | emit groupEventsSelected(false); |
3573 | } | 3573 | } |
3574 | return; | 3574 | return; |
3575 | } | 3575 | } |
3576 | 3576 | ||
3577 | /* if ( incidence && incidence->type() == "Todo" ) { | 3577 | /* if ( incidence && incidence->type() == "Todo" ) { |
3578 | emit todoSelected( true ); | 3578 | emit todoSelected( true ); |
3579 | } else { | 3579 | } else { |
3580 | emit todoSelected( false ); | 3580 | emit todoSelected( false ); |
3581 | }*/ | 3581 | }*/ |
3582 | } | 3582 | } |
3583 | 3583 | ||
3584 | 3584 | ||
3585 | void CalendarView::checkClipboard() | 3585 | void CalendarView::checkClipboard() |
3586 | { | 3586 | { |
3587 | #ifndef KORG_NODND | 3587 | #ifndef KORG_NODND |
3588 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3588 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3589 | emit pasteEnabled(true); | 3589 | emit pasteEnabled(true); |
3590 | } else { | 3590 | } else { |
3591 | emit pasteEnabled(false); | 3591 | emit pasteEnabled(false); |
3592 | } | 3592 | } |
3593 | #endif | 3593 | #endif |
3594 | } | 3594 | } |
3595 | 3595 | ||
3596 | void CalendarView::showDates(const DateList &selectedDates) | 3596 | void CalendarView::showDates(const DateList &selectedDates) |
3597 | { | 3597 | { |
3598 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3598 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3599 | 3599 | ||
3600 | 3600 | ||
3601 | if ( !mBlockShowDates ) { | 3601 | if ( !mBlockShowDates ) { |
3602 | if ( mViewManager->currentView() ) { | 3602 | if ( mViewManager->currentView() ) { |
3603 | updateView( selectedDates.first(), selectedDates.last() ); | 3603 | updateView( selectedDates.first(), selectedDates.last() ); |
3604 | } else { | 3604 | } else { |
3605 | mViewManager->showAgendaView(); | 3605 | mViewManager->showAgendaView(); |
3606 | } | 3606 | } |
3607 | } | 3607 | } |
3608 | 3608 | ||
3609 | QDate date = selectedDates.first(); | ||
3610 | if ( ! date.isValid() ) { | ||
3611 | topLevelWidget()->setCaption(""); | ||
3612 | return; | ||
3613 | } | ||
3614 | |||
3609 | QString selDates; | 3615 | QString selDates; |
3610 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3616 | selDates = KGlobal::locale()->formatDate( date, true); |
3611 | if (selectedDates.first() < selectedDates.last() ) | 3617 | if (selectedDates.first() < selectedDates.last() ) |
3612 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3618 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3613 | else { | 3619 | else { |
3614 | QString addString; | 3620 | QString addString; |
3615 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) | 3621 | if ( date == QDateTime::currentDateTime().date() ) |
3616 | addString = i18n("Today"); | 3622 | addString = i18n("Today"); |
3617 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 3623 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3618 | addString = i18n("Tomorrow"); | 3624 | addString = i18n("Tomorrow"); |
3619 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 3625 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3620 | addString = i18n("Yesterday"); | 3626 | addString = i18n("Yesterday"); |
3621 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 3627 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3622 | addString = i18n("Day before yesterday"); | 3628 | addString = i18n("Day before yesterday"); |
3623 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 3629 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3624 | addString = i18n("Day after tomorrow"); | 3630 | addString = i18n("Day after tomorrow"); |
3625 | if ( !addString.isEmpty() ) { | 3631 | if ( !addString.isEmpty() ) { |
3626 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3632 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3627 | return; | 3633 | return; |
3628 | } | 3634 | } |
3629 | } | 3635 | } |
3630 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3636 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3631 | 3637 | ||
3632 | } | 3638 | } |
3633 | 3639 | ||
3634 | QPtrList<CalFilter> CalendarView::filters() | 3640 | QPtrList<CalFilter> CalendarView::filters() |
3635 | { | 3641 | { |
3636 | return mFilters; | 3642 | return mFilters; |
3637 | 3643 | ||
3638 | } | 3644 | } |
3639 | void CalendarView::editFilters() | 3645 | void CalendarView::editFilters() |
3640 | { | 3646 | { |
3641 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3647 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3642 | 3648 | ||
3643 | CalFilter *filter = mFilters.first(); | 3649 | CalFilter *filter = mFilters.first(); |
3644 | while(filter) { | 3650 | while(filter) { |
3645 | kdDebug() << " Filter: " << filter->name() << endl; | 3651 | kdDebug() << " Filter: " << filter->name() << endl; |
3646 | filter = mFilters.next(); | 3652 | filter = mFilters.next(); |
3647 | } | 3653 | } |
3648 | 3654 | ||
3649 | mDialogManager->showFilterEditDialog(&mFilters); | 3655 | mDialogManager->showFilterEditDialog(&mFilters); |
3650 | } | 3656 | } |
3651 | void CalendarView::toggleFilter() | 3657 | void CalendarView::toggleFilter() |
3652 | { | 3658 | { |
3653 | showFilter(! mFilterView->isVisible()); | 3659 | showFilter(! mFilterView->isVisible()); |
3654 | } | 3660 | } |
3655 | 3661 | ||
3656 | KOFilterView *CalendarView::filterView() | 3662 | KOFilterView *CalendarView::filterView() |
3657 | { | 3663 | { |
3658 | return mFilterView; | 3664 | return mFilterView; |
3659 | } | 3665 | } |
3660 | void CalendarView::selectFilter( int fil ) | 3666 | void CalendarView::selectFilter( int fil ) |
3661 | { | 3667 | { |
3662 | mFilterView->setSelectedFilter( fil ); | 3668 | mFilterView->setSelectedFilter( fil ); |
3663 | } | 3669 | } |
3664 | void CalendarView::showFilter(bool visible) | 3670 | void CalendarView::showFilter(bool visible) |
3665 | { | 3671 | { |
3666 | if (visible) mFilterView->show(); | 3672 | if (visible) mFilterView->show(); |
3667 | else mFilterView->hide(); | 3673 | else mFilterView->hide(); |
3668 | } | 3674 | } |
3669 | void CalendarView::toggleFilerEnabled( ) | 3675 | void CalendarView::toggleFilerEnabled( ) |
3670 | { | 3676 | { |
3671 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3677 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3672 | if ( !mFilterView->filtersEnabled() ) | 3678 | if ( !mFilterView->filtersEnabled() ) |
3673 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3679 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3674 | 3680 | ||
3675 | } | 3681 | } |
3676 | void CalendarView::updateFilter() | 3682 | void CalendarView::updateFilter() |
3677 | { | 3683 | { |
3678 | CalFilter *filter = mFilterView->selectedFilter(); | 3684 | CalFilter *filter = mFilterView->selectedFilter(); |
3679 | if (filter) { | 3685 | if (filter) { |
3680 | QString mess; | 3686 | QString mess; |
3681 | if (mFilterView->filtersEnabled()) { | 3687 | if (mFilterView->filtersEnabled()) { |
3682 | mess = i18n("Filter selected: ")+filter->name(); | 3688 | mess = i18n("Filter selected: ")+filter->name(); |
3683 | filter->setEnabled(true); | 3689 | filter->setEnabled(true); |
3684 | } | 3690 | } |
3685 | else filter->setEnabled(false); | 3691 | else filter->setEnabled(false); |
3686 | mCalendar->setFilter(filter); | 3692 | mCalendar->setFilter(filter); |
3687 | updateView(); | 3693 | updateView(); |
3688 | if ( !mess.isEmpty() ) | 3694 | if ( !mess.isEmpty() ) |
3689 | topLevelWidget()->setCaption( mess ); | 3695 | topLevelWidget()->setCaption( mess ); |
3690 | 3696 | ||
3691 | } | 3697 | } |
3692 | } | 3698 | } |
3693 | 3699 | ||
3694 | void CalendarView::filterEdited() | 3700 | void CalendarView::filterEdited() |
3695 | { | 3701 | { |
3696 | mFilterView->updateFilters(); | 3702 | mFilterView->updateFilters(); |
3697 | updateFilter(); | 3703 | updateFilter(); |
3698 | writeSettings(); | 3704 | writeSettings(); |
3699 | } | 3705 | } |
3700 | 3706 | ||
3701 | 3707 | ||
3702 | void CalendarView::takeOverEvent() | 3708 | void CalendarView::takeOverEvent() |
3703 | { | 3709 | { |
3704 | Incidence *incidence = currentSelection(); | 3710 | Incidence *incidence = currentSelection(); |
3705 | 3711 | ||
3706 | if (!incidence) return; | 3712 | if (!incidence) return; |
3707 | 3713 | ||
3708 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3714 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3709 | incidence->recreate(); | 3715 | incidence->recreate(); |
3710 | incidence->setReadOnly(false); | 3716 | incidence->setReadOnly(false); |
3711 | 3717 | ||
3712 | updateView(); | 3718 | updateView(); |
3713 | } | 3719 | } |
3714 | 3720 | ||
3715 | void CalendarView::takeOverCalendar() | 3721 | void CalendarView::takeOverCalendar() |
3716 | { | 3722 | { |
3717 | // TODO: Create Calendar::allIncidences() function and use it here | 3723 | // TODO: Create Calendar::allIncidences() function and use it here |
3718 | 3724 | ||
3719 | QPtrList<Event> events = mCalendar->events(); | 3725 | QPtrList<Event> events = mCalendar->events(); |
3720 | for(uint i=0; i<events.count(); ++i) { | 3726 | for(uint i=0; i<events.count(); ++i) { |
3721 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3727 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3722 | events.at(i)->recreate(); | 3728 | events.at(i)->recreate(); |
3723 | events.at(i)->setReadOnly(false); | 3729 | events.at(i)->setReadOnly(false); |
3724 | } | 3730 | } |
3725 | 3731 | ||
3726 | QPtrList<Todo> todos = mCalendar->todos(); | 3732 | QPtrList<Todo> todos = mCalendar->todos(); |
3727 | for(uint i=0; i<todos.count(); ++i) { | 3733 | for(uint i=0; i<todos.count(); ++i) { |
3728 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3734 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3729 | todos.at(i)->recreate(); | 3735 | todos.at(i)->recreate(); |
3730 | todos.at(i)->setReadOnly(false); | 3736 | todos.at(i)->setReadOnly(false); |
3731 | } | 3737 | } |
3732 | 3738 | ||
3733 | QPtrList<Journal> journals = mCalendar->journals(); | 3739 | QPtrList<Journal> journals = mCalendar->journals(); |
3734 | for(uint i=0; i<journals.count(); ++i) { | 3740 | for(uint i=0; i<journals.count(); ++i) { |
3735 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3741 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3736 | journals.at(i)->recreate(); | 3742 | journals.at(i)->recreate(); |
3737 | journals.at(i)->setReadOnly(false); | 3743 | journals.at(i)->setReadOnly(false); |
3738 | } | 3744 | } |
3739 | 3745 | ||
3740 | updateView(); | 3746 | updateView(); |
3741 | } | 3747 | } |
3742 | 3748 | ||
3743 | void CalendarView::showIntro() | 3749 | void CalendarView::showIntro() |
3744 | { | 3750 | { |
3745 | kdDebug() << "To be implemented." << endl; | 3751 | kdDebug() << "To be implemented." << endl; |
3746 | } | 3752 | } |
3747 | 3753 | ||
3748 | QWidgetStack *CalendarView::viewStack() | 3754 | QWidgetStack *CalendarView::viewStack() |
3749 | { | 3755 | { |
3750 | return mRightFrame; | 3756 | return mRightFrame; |
3751 | } | 3757 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7faf675..7d5cf72 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -16,257 +16,257 @@ | |||
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
133 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
134 | { | 134 | { |
135 | 135 | ||
136 | mClosed = false; | 136 | mClosed = false; |
137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
138 | QString confFile = locateLocal("config","korganizerrc"); | 138 | QString confFile = locateLocal("config","korganizerrc"); |
139 | QFileInfo finf ( confFile ); | 139 | QFileInfo finf ( confFile ); |
140 | bool showWarning = !finf.exists(); | 140 | bool showWarning = !finf.exists(); |
141 | setIcon(SmallIcon( "ko24" ) ); | 141 | setIcon(SmallIcon( "ko24" ) ); |
142 | mBlockAtStartup = true; | 142 | mBlockAtStartup = true; |
143 | mFlagKeyPressed = false; | 143 | mFlagKeyPressed = false; |
144 | setCaption("KOrganizer/Pi"); | 144 | setCaption("KO/Pi"); |
145 | KOPrefs *p = KOPrefs::instance(); | 145 | KOPrefs *p = KOPrefs::instance(); |
146 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 146 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
147 | if ( p->mHourSize > 22 ) | 147 | if ( p->mHourSize > 22 ) |
148 | p->mHourSize = 22; | 148 | p->mHourSize = 22; |
149 | QMainWindow::ToolBarDock tbd; | 149 | QMainWindow::ToolBarDock tbd; |
150 | if ( p->mToolBarHor ) { | 150 | if ( p->mToolBarHor ) { |
151 | if ( p->mToolBarUp ) | 151 | if ( p->mToolBarUp ) |
152 | tbd = Bottom; | 152 | tbd = Bottom; |
153 | else | 153 | else |
154 | tbd = Top; | 154 | tbd = Top; |
155 | } | 155 | } |
156 | else { | 156 | else { |
157 | if ( p->mToolBarUp ) | 157 | if ( p->mToolBarUp ) |
158 | tbd = Right; | 158 | tbd = Right; |
159 | else | 159 | else |
160 | tbd = Left; | 160 | tbd = Left; |
161 | } | 161 | } |
162 | if ( KOPrefs::instance()->mUseAppColors ) | 162 | if ( KOPrefs::instance()->mUseAppColors ) |
163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
164 | globalFlagBlockStartup = 1; | 164 | globalFlagBlockStartup = 1; |
165 | iconToolBar = new QPEToolBar( this ); | 165 | iconToolBar = new QPEToolBar( this ); |
166 | addToolBar (iconToolBar , tbd ); | 166 | addToolBar (iconToolBar , tbd ); |
167 | mCalendarModifiedFlag = false; | 167 | mCalendarModifiedFlag = false; |
168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
169 | splash->setAlignment ( AlignCenter ); | 169 | splash->setAlignment ( AlignCenter ); |
170 | setCentralWidget( splash ); | 170 | setCentralWidget( splash ); |
171 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
172 | showMaximized(); | 172 | showMaximized(); |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
176 | setDefaultPreferences(); | 176 | setDefaultPreferences(); |
177 | mCalendar = new CalendarLocal(); | 177 | mCalendar = new CalendarLocal(); |
178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
179 | mView->hide(); | 179 | mView->hide(); |
180 | //mView->resize(splash->size() ); | 180 | //mView->resize(splash->size() ); |
181 | initActions(); | 181 | initActions(); |
182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
183 | mSyncManager->setBlockSave(false); | 183 | mSyncManager->setBlockSave(false); |
184 | mView->setSyncManager(mSyncManager); | 184 | mView->setSyncManager(mSyncManager); |
185 | #ifndef DESKTOP_VERSION | 185 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 186 | iconToolBar->show(); |
187 | qApp->processEvents(); | 187 | qApp->processEvents(); |
188 | #endif | 188 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 190 | int vh = height() ; |
191 | int vw = width(); | 191 | int vw = width(); |
192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
194 | vh -= iconToolBar->height(); | 194 | vh -= iconToolBar->height(); |
195 | } else { | 195 | } else { |
196 | vw -= iconToolBar->height(); | 196 | vw -= iconToolBar->height(); |
197 | } | 197 | } |
198 | //mView->setMaximumSize( splash->size() ); | 198 | //mView->setMaximumSize( splash->size() ); |
199 | //mView->resize( splash->size() ); | 199 | //mView->resize( splash->size() ); |
200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
201 | mView->readSettings(); | 201 | mView->readSettings(); |
202 | bool newFile = false; | 202 | bool newFile = false; |
203 | if( !QFile::exists( defaultFileName() ) ) { | 203 | if( !QFile::exists( defaultFileName() ) ) { |
204 | QFileInfo finfo ( defaultFileName() ); | 204 | QFileInfo finfo ( defaultFileName() ); |
205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
206 | qDebug("oldfile %s ", oldFile.latin1()); | 206 | qDebug("oldfile %s ", oldFile.latin1()); |
207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
208 | finfo.setFile( oldFile ); | 208 | finfo.setFile( oldFile ); |
209 | if (finfo.exists() ) { | 209 | if (finfo.exists() ) { |
210 | KMessageBox::information( this, message); | 210 | KMessageBox::information( this, message); |
211 | mView->openCalendar( oldFile ); | 211 | mView->openCalendar( oldFile ); |
212 | qApp->processEvents(); | 212 | qApp->processEvents(); |
213 | } else { | 213 | } else { |
214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
215 | finfo.setFile( oldFile ); | 215 | finfo.setFile( oldFile ); |
216 | if (finfo.exists() ) { | 216 | if (finfo.exists() ) { |
217 | KMessageBox::information( this, message); | 217 | KMessageBox::information( this, message); |
218 | mView->openCalendar( oldFile ); | 218 | mView->openCalendar( oldFile ); |
219 | qApp->processEvents(); | 219 | qApp->processEvents(); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | mView->saveCalendar( defaultFileName() ); | 222 | mView->saveCalendar( defaultFileName() ); |
223 | newFile = true; | 223 | newFile = true; |
224 | } | 224 | } |
225 | 225 | ||
226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
227 | mView->openCalendar( defaultFileName() ); | 227 | mView->openCalendar( defaultFileName() ); |
228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
230 | 230 | ||
231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
232 | KOPrefs::instance()->setAllDefaults(); | 232 | KOPrefs::instance()->setAllDefaults(); |
233 | int count = mView->addCategories(); | 233 | int count = mView->addCategories(); |
234 | } | 234 | } |
235 | processIncidenceSelection( 0 ); | 235 | processIncidenceSelection( 0 ); |
236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
237 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 237 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
239 | SLOT( slotModifiedChanged( bool ) ) ); | 239 | SLOT( slotModifiedChanged( bool ) ) ); |
240 | 240 | ||
241 | 241 | ||
242 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 242 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
243 | SLOT( disableBR(bool) ) ); | 243 | SLOT( disableBR(bool) ) ); |
244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
249 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
250 | mView->show(); | 250 | mView->show(); |
251 | delete splash; | 251 | delete splash; |
252 | if ( newFile ) | 252 | if ( newFile ) |
253 | mView->updateConfig(); | 253 | mView->updateConfig(); |
254 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
256 | //fillSyncMenu(); | 256 | //fillSyncMenu(); |
257 | 257 | ||
258 | 258 | ||
259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( sentSyncFile()); | 264 | mSyncManager->setDefaultFileName( sentSyncFile()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
@@ -1727,268 +1727,281 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
1727 | mView->showDatePicker( ); | 1727 | mView->showDatePicker( ); |
1728 | break; | 1728 | break; |
1729 | case Qt::Key_F: | 1729 | case Qt::Key_F: |
1730 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1730 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1731 | mView->editFilters(); | 1731 | mView->editFilters(); |
1732 | else | 1732 | else |
1733 | mView->toggleFilter(); | 1733 | mView->toggleFilter(); |
1734 | break; | 1734 | break; |
1735 | case Qt::Key_X: | 1735 | case Qt::Key_X: |
1736 | mView->toggleDateNavigatorWidget(); | 1736 | mView->toggleDateNavigatorWidget(); |
1737 | break; | 1737 | break; |
1738 | case Qt::Key_Space: | 1738 | case Qt::Key_Space: |
1739 | mView->toggleExpand(); | 1739 | mView->toggleExpand(); |
1740 | break; | 1740 | break; |
1741 | case Qt::Key_A: | 1741 | case Qt::Key_A: |
1742 | mView->toggleAllDaySize(); | 1742 | mView->toggleAllDaySize(); |
1743 | break; | 1743 | break; |
1744 | case Qt::Key_T: | 1744 | case Qt::Key_T: |
1745 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1745 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1746 | mView->newTodo(); | 1746 | mView->newTodo(); |
1747 | else { | 1747 | else { |
1748 | mView->goToday(); | 1748 | mView->goToday(); |
1749 | showSelectedDates = true; | 1749 | showSelectedDates = true; |
1750 | } | 1750 | } |
1751 | break; | 1751 | break; |
1752 | case Qt::Key_J: | 1752 | case Qt::Key_J: |
1753 | mView->viewManager()->showJournalView(); | 1753 | mView->viewManager()->showJournalView(); |
1754 | break; | 1754 | break; |
1755 | case Qt::Key_B: | 1755 | case Qt::Key_B: |
1756 | mView->editIncidenceDescription();; | 1756 | mView->editIncidenceDescription();; |
1757 | break; | 1757 | break; |
1758 | // case Qt::Key_Return: | 1758 | // case Qt::Key_Return: |
1759 | case Qt::Key_E: | 1759 | case Qt::Key_E: |
1760 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1760 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1761 | mView->newEvent(); | 1761 | mView->newEvent(); |
1762 | else | 1762 | else |
1763 | mView->editIncidence(); | 1763 | mView->editIncidence(); |
1764 | break; | 1764 | break; |
1765 | case Qt::Key_Plus: | 1765 | case Qt::Key_Plus: |
1766 | size = p->mHourSize +2; | 1766 | size = p->mHourSize +2; |
1767 | if ( size <= 22 ) | 1767 | if ( size <= 22 ) |
1768 | configureAgenda( size ); | 1768 | configureAgenda( size ); |
1769 | break; | 1769 | break; |
1770 | case Qt::Key_Minus: | 1770 | case Qt::Key_Minus: |
1771 | size = p->mHourSize - 2; | 1771 | size = p->mHourSize - 2; |
1772 | if ( size >= 4 ) | 1772 | if ( size >= 4 ) |
1773 | configureAgenda( size ); | 1773 | configureAgenda( size ); |
1774 | break; | 1774 | break; |
1775 | 1775 | ||
1776 | 1776 | ||
1777 | default: | 1777 | default: |
1778 | e->ignore(); | 1778 | e->ignore(); |
1779 | } | 1779 | } |
1780 | if ( pro > 0 ) { | 1780 | if ( pro > 0 ) { |
1781 | mView->selectFilter( pro-1 ); | 1781 | mView->selectFilter( pro-1 ); |
1782 | } | 1782 | } |
1783 | if ( showSelectedDates ) { | 1783 | if ( showSelectedDates ) { |
1784 | ;// setCaptionToDates(); | 1784 | ;// setCaptionToDates(); |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | } | 1787 | } |
1788 | 1788 | ||
1789 | void MainWindow::fillFilterMenu() | 1789 | void MainWindow::fillFilterMenu() |
1790 | { | 1790 | { |
1791 | selectFilterMenu->clear(); | 1791 | selectFilterMenu->clear(); |
1792 | bool disable = false; | 1792 | bool disable = false; |
1793 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1793 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1794 | selectFilterMenu->insertSeparator(); | 1794 | selectFilterMenu->insertSeparator(); |
1795 | if ( mView->filterView()->filtersEnabled() ) { | 1795 | if ( mView->filterView()->filtersEnabled() ) { |
1796 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1796 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1797 | } | 1797 | } |
1798 | else { | 1798 | else { |
1799 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1799 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1800 | disable = true; | 1800 | disable = true; |
1801 | } | 1801 | } |
1802 | selectFilterMenu->insertSeparator(); | 1802 | selectFilterMenu->insertSeparator(); |
1803 | QPtrList<CalFilter> fili = mView->filters(); | 1803 | QPtrList<CalFilter> fili = mView->filters(); |
1804 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1804 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1805 | CalFilter *filter = fili.first(); | 1805 | CalFilter *filter = fili.first(); |
1806 | int iii = 2; | 1806 | int iii = 2; |
1807 | while(filter) { | 1807 | while(filter) { |
1808 | selectFilterMenu->insertItem( filter->name(), iii ); | 1808 | selectFilterMenu->insertItem( filter->name(), iii ); |
1809 | if ( filter == curfilter) | 1809 | if ( filter == curfilter) |
1810 | selectFilterMenu->setItemChecked( iii, true ); | 1810 | selectFilterMenu->setItemChecked( iii, true ); |
1811 | if ( disable ) | 1811 | if ( disable ) |
1812 | selectFilterMenu->setItemEnabled( iii, false ); | 1812 | selectFilterMenu->setItemEnabled( iii, false ); |
1813 | filter = fili.next(); | 1813 | filter = fili.next(); |
1814 | ++iii; | 1814 | ++iii; |
1815 | } | 1815 | } |
1816 | } | 1816 | } |
1817 | void MainWindow::selectFilter( int fil ) | 1817 | void MainWindow::selectFilter( int fil ) |
1818 | { | 1818 | { |
1819 | if ( fil == 0 ) { | 1819 | if ( fil == 0 ) { |
1820 | mView->editFilters( ); | 1820 | mView->editFilters( ); |
1821 | } else if ( fil == 1 ){ | 1821 | } else if ( fil == 1 ){ |
1822 | mView->toggleFilerEnabled( ); | 1822 | mView->toggleFilerEnabled( ); |
1823 | } else { | 1823 | } else { |
1824 | mView->selectFilter( fil-2 ); | 1824 | mView->selectFilter( fil-2 ); |
1825 | } | 1825 | } |
1826 | } | 1826 | } |
1827 | void MainWindow::configureToolBar( int item ) | 1827 | void MainWindow::configureToolBar( int item ) |
1828 | { | 1828 | { |
1829 | 1829 | ||
1830 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1830 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1831 | KOPrefs *p = KOPrefs::instance(); | 1831 | KOPrefs *p = KOPrefs::instance(); |
1832 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1832 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1833 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1833 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1834 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1834 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1835 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1835 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1836 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1836 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1837 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1837 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1838 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1838 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1839 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 1839 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
1840 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1840 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1841 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1841 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1842 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1842 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1843 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1843 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1844 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1844 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1845 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1845 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1846 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1846 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1847 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1847 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1848 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1848 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1849 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1849 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1850 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1850 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1851 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1851 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1852 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 1852 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
1853 | // initActions(); | 1853 | // initActions(); |
1854 | } | 1854 | } |
1855 | 1855 | void MainWindow::setCaption ( const QString & c ) | |
1856 | { | ||
1857 | QString cap = c; | ||
1858 | cap.replace( QRegExp("\n"), " " ); | ||
1859 | cap = cap.stripWhiteSpace(); | ||
1860 | if ( cap.isEmpty() ) | ||
1861 | cap = "KO/Pi"; | ||
1862 | QWidget::setCaption( cap ); | ||
1863 | } | ||
1856 | void MainWindow::setCaptionToDates() | 1864 | void MainWindow::setCaptionToDates() |
1857 | { | 1865 | { |
1858 | QString selDates; | 1866 | QString selDates; |
1859 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1867 | QDate date = mView->startDate(); |
1868 | if ( ! date.isValid() ) { | ||
1869 | setCaption(""); | ||
1870 | return; | ||
1871 | } | ||
1872 | selDates = KGlobal::locale()->formatDate( date, true); | ||
1860 | if (mView->startDate() < mView->endDate() ) | 1873 | if (mView->startDate() < mView->endDate() ) |
1861 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1874 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1862 | else { | 1875 | else { |
1863 | QString addString; | 1876 | QString addString; |
1864 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1877 | if ( date == QDateTime::currentDateTime().date() ) |
1865 | addString = i18n("Today"); | 1878 | addString = i18n("Today"); |
1866 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1879 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
1867 | addString = i18n("Tomorrow"); | 1880 | addString = i18n("Tomorrow"); |
1868 | if ( !addString.isEmpty() ) | 1881 | if ( !addString.isEmpty() ) |
1869 | selDates = addString+", "+selDates ; | 1882 | selDates = addString+", "+selDates ; |
1870 | } | 1883 | } |
1871 | setCaption( i18n("Dates: ") + selDates ); | 1884 | setCaption( i18n("Dates: ") + selDates ); |
1872 | 1885 | ||
1873 | } | 1886 | } |
1874 | void MainWindow::showConfigureAgenda( ) | 1887 | void MainWindow::showConfigureAgenda( ) |
1875 | { | 1888 | { |
1876 | int iii; | 1889 | int iii; |
1877 | for ( iii = 1;iii<= 10 ;++iii ){ | 1890 | for ( iii = 1;iii<= 10 ;++iii ){ |
1878 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1891 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1879 | } | 1892 | } |
1880 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1893 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1881 | } | 1894 | } |
1882 | void MainWindow::configureAgenda( int item ) | 1895 | void MainWindow::configureAgenda( int item ) |
1883 | { | 1896 | { |
1884 | if ( KOPrefs::instance()->mHourSize == item ) | 1897 | if ( KOPrefs::instance()->mHourSize == item ) |
1885 | return; | 1898 | return; |
1886 | KOPrefs::instance()->mHourSize=item; | 1899 | KOPrefs::instance()->mHourSize=item; |
1887 | mView->viewManager()->agendaView()->updateConfig(); | 1900 | mView->viewManager()->agendaView()->updateConfig(); |
1888 | } | 1901 | } |
1889 | 1902 | ||
1890 | void MainWindow::saveCalendar() | 1903 | void MainWindow::saveCalendar() |
1891 | { | 1904 | { |
1892 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1905 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1893 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1906 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1894 | 1907 | ||
1895 | if ( fn == "" ) | 1908 | if ( fn == "" ) |
1896 | return; | 1909 | return; |
1897 | QFileInfo info; | 1910 | QFileInfo info; |
1898 | info.setFile( fn ); | 1911 | info.setFile( fn ); |
1899 | QString mes; | 1912 | QString mes; |
1900 | bool createbup = true; | 1913 | bool createbup = true; |
1901 | if ( info. exists() ) { | 1914 | if ( info. exists() ) { |
1902 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1915 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1903 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1916 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1904 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1917 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1905 | 0, 1 ); | 1918 | 0, 1 ); |
1906 | if ( result != 0 ) { | 1919 | if ( result != 0 ) { |
1907 | createbup = false; | 1920 | createbup = false; |
1908 | } | 1921 | } |
1909 | } | 1922 | } |
1910 | if ( createbup ) { | 1923 | if ( createbup ) { |
1911 | mView->saveCalendar( fn ); | 1924 | mView->saveCalendar( fn ); |
1912 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1925 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1913 | KOPrefs::instance()->mLastSaveFile = fn; | 1926 | KOPrefs::instance()->mLastSaveFile = fn; |
1914 | setCaption(mes); | 1927 | setCaption(mes); |
1915 | } | 1928 | } |
1916 | } | 1929 | } |
1917 | void MainWindow::loadCalendar() | 1930 | void MainWindow::loadCalendar() |
1918 | { | 1931 | { |
1919 | 1932 | ||
1920 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1933 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1921 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1934 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1922 | 1935 | ||
1923 | if ( fn == "" ) | 1936 | if ( fn == "" ) |
1924 | return; | 1937 | return; |
1925 | QFileInfo info; | 1938 | QFileInfo info; |
1926 | info.setFile( fn ); | 1939 | info.setFile( fn ); |
1927 | QString mess; | 1940 | QString mess; |
1928 | bool loadbup = true; | 1941 | bool loadbup = true; |
1929 | if ( info. exists() ) { | 1942 | if ( info. exists() ) { |
1930 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1943 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1931 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1944 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1932 | mess, | 1945 | mess, |
1933 | i18n("Load!"), i18n("Cancel"), 0, | 1946 | i18n("Load!"), i18n("Cancel"), 0, |
1934 | 0, 1 ); | 1947 | 0, 1 ); |
1935 | if ( result != 0 ) { | 1948 | if ( result != 0 ) { |
1936 | loadbup = false; | 1949 | loadbup = false; |
1937 | } | 1950 | } |
1938 | } else { | 1951 | } else { |
1939 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1952 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1940 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1953 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1941 | 0, 1 ); | 1954 | 0, 1 ); |
1942 | 1955 | ||
1943 | return; | 1956 | return; |
1944 | } | 1957 | } |
1945 | if ( loadbup ) { | 1958 | if ( loadbup ) { |
1946 | mView->openCalendar( fn ); | 1959 | mView->openCalendar( fn ); |
1947 | KOPrefs::instance()->mLastLoadFile = fn; | 1960 | KOPrefs::instance()->mLastLoadFile = fn; |
1948 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1961 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1949 | setCaption(mess); | 1962 | setCaption(mess); |
1950 | } | 1963 | } |
1951 | 1964 | ||
1952 | } | 1965 | } |
1953 | void MainWindow::quickImportIcal() | 1966 | void MainWindow::quickImportIcal() |
1954 | { | 1967 | { |
1955 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1968 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1956 | } | 1969 | } |
1957 | void MainWindow::importFile( QString fn, bool quick ) | 1970 | void MainWindow::importFile( QString fn, bool quick ) |
1958 | { | 1971 | { |
1959 | QFileInfo info; | 1972 | QFileInfo info; |
1960 | info.setFile( fn ); | 1973 | info.setFile( fn ); |
1961 | QString mess; | 1974 | QString mess; |
1962 | bool loadbup = true; | 1975 | bool loadbup = true; |
1963 | if ( !info. exists() ) { | 1976 | if ( !info. exists() ) { |
1964 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1977 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1965 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1978 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1966 | mess ); | 1979 | mess ); |
1967 | return; | 1980 | return; |
1968 | } | 1981 | } |
1969 | int result = 0; | 1982 | int result = 0; |
1970 | if ( !quick ) { | 1983 | if ( !quick ) { |
1971 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1984 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1972 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1985 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1973 | mess, | 1986 | mess, |
1974 | "Import", "Cancel", 0, | 1987 | "Import", "Cancel", 0, |
1975 | 0, 1 ); | 1988 | 0, 1 ); |
1976 | } | 1989 | } |
1977 | if ( result == 0 ) { | 1990 | if ( result == 0 ) { |
1978 | if ( mView->openCalendar( fn, true )) { | 1991 | if ( mView->openCalendar( fn, true )) { |
1979 | KOPrefs::instance()->mLastImportFile = fn; | 1992 | KOPrefs::instance()->mLastImportFile = fn; |
1980 | setCaption(i18n("Imported file successfully")); | 1993 | setCaption(i18n("Imported file successfully")); |
1981 | } else { | 1994 | } else { |
1982 | setCaption(i18n("Error importing file")); | 1995 | setCaption(i18n("Error importing file")); |
1983 | } | 1996 | } |
1984 | } | 1997 | } |
1985 | } | 1998 | } |
1986 | 1999 | ||
1987 | void MainWindow::importIcal() | 2000 | void MainWindow::importIcal() |
1988 | { | 2001 | { |
1989 | 2002 | ||
1990 | QString fn =KOPrefs::instance()->mLastImportFile; | 2003 | QString fn =KOPrefs::instance()->mLastImportFile; |
1991 | 2004 | ||
1992 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2005 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1993 | if ( fn == "" ) | 2006 | if ( fn == "" ) |
1994 | return; | 2007 | return; |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5808700..7604529 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,159 +1,160 @@ | |||
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 <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
25 | #endif | 25 | #endif |
26 | class QPEToolBar; | 26 | class QPEToolBar; |
27 | 27 | ||
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | class CalendarLocal; | 30 | class CalendarLocal; |
31 | } | 31 | } |
32 | 32 | ||
33 | class KOMenuBar : public QMenuBar | 33 | class KOMenuBar : public QMenuBar |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | 36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} |
37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | 37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} |
38 | }; | 38 | }; |
39 | 39 | ||
40 | using namespace KCal; | 40 | using namespace KCal; |
41 | 41 | ||
42 | class MainWindow : public QMainWindow | 42 | class MainWindow : public QMainWindow |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
47 | ~MainWindow(); | 47 | ~MainWindow(); |
48 | bool beamReceiveEnabled(); | 48 | bool beamReceiveEnabled(); |
49 | static QString defaultFileName(); | 49 | static QString defaultFileName(); |
50 | static QString syncFileName(); | 50 | static QString syncFileName(); |
51 | static QString resourcePath(); | 51 | static QString resourcePath(); |
52 | public slots: | 52 | public slots: |
53 | void setCaption ( const QString & ); | ||
53 | void updateWeekNum(const KCal::DateList &); | 54 | void updateWeekNum(const KCal::DateList &); |
54 | void updateWeek(QDate); | 55 | void updateWeek(QDate); |
55 | virtual void showMaximized (); | 56 | virtual void showMaximized (); |
56 | void configureAgenda( int ); | 57 | void configureAgenda( int ); |
57 | void recieve( const QCString& msg, const QByteArray& data ); | 58 | void recieve( const QCString& msg, const QByteArray& data ); |
58 | protected slots: | 59 | protected slots: |
59 | void setCaptionToDates(); | 60 | void setCaptionToDates(); |
60 | void weekAction(); | 61 | void weekAction(); |
61 | void about(); | 62 | void about(); |
62 | void licence(); | 63 | void licence(); |
63 | void faq(); | 64 | void faq(); |
64 | void usertrans(); | 65 | void usertrans(); |
65 | void features(); | 66 | void features(); |
66 | void synchowto(); | 67 | void synchowto(); |
67 | void kdesynchowto(); | 68 | void kdesynchowto(); |
68 | void multisynchowto(); | 69 | void multisynchowto(); |
69 | void whatsNew(); | 70 | void whatsNew(); |
70 | void keyBindings(); | 71 | void keyBindings(); |
71 | void aboutAutoSaving();; | 72 | void aboutAutoSaving();; |
72 | void aboutKnownBugs(); | 73 | void aboutKnownBugs(); |
73 | 74 | ||
74 | void processIncidenceSelection( Incidence * ); | 75 | void processIncidenceSelection( Incidence * ); |
75 | 76 | ||
76 | void importQtopia(); | 77 | void importQtopia(); |
77 | void importBday(); | 78 | void importBday(); |
78 | void importOL(); | 79 | void importOL(); |
79 | void importIcal(); | 80 | void importIcal(); |
80 | void importFile( QString, bool ); | 81 | void importFile( QString, bool ); |
81 | void quickImportIcal(); | 82 | void quickImportIcal(); |
82 | 83 | ||
83 | void slotModifiedChanged( bool ); | 84 | void slotModifiedChanged( bool ); |
84 | 85 | ||
85 | void save(); | 86 | void save(); |
86 | void saveStopTimer(); | 87 | void saveStopTimer(); |
87 | void configureToolBar( int ); | 88 | void configureToolBar( int ); |
88 | void printSel(); | 89 | void printSel(); |
89 | void printCal(); | 90 | void printCal(); |
90 | void saveCalendar(); | 91 | void saveCalendar(); |
91 | void loadCalendar(); | 92 | void loadCalendar(); |
92 | void exportVCalendar(); | 93 | void exportVCalendar(); |
93 | void fillFilterMenu(); | 94 | void fillFilterMenu(); |
94 | void selectFilter( int ); | 95 | void selectFilter( int ); |
95 | void exportToPhone( int ); | 96 | void exportToPhone( int ); |
96 | void toggleBeamReceive(); | 97 | void toggleBeamReceive(); |
97 | void disableBR(bool); | 98 | void disableBR(bool); |
98 | signals: | 99 | signals: |
99 | void selectWeek ( int ); | 100 | void selectWeek ( int ); |
100 | private slots: | 101 | private slots: |
101 | void showConfigureAgenda(); | 102 | void showConfigureAgenda(); |
102 | void getFile( bool ); | 103 | void getFile( bool ); |
103 | void syncFileRequest(); | 104 | void syncFileRequest(); |
104 | 105 | ||
105 | protected: | 106 | protected: |
106 | QString sentSyncFile(); | 107 | QString sentSyncFile(); |
107 | void displayText( QString, QString); | 108 | void displayText( QString, QString); |
108 | void enableIncidenceActions( bool ); | 109 | void enableIncidenceActions( bool ); |
109 | 110 | ||
110 | private: | 111 | private: |
111 | bool mBRdisabled; | 112 | bool mBRdisabled; |
112 | #ifndef DESKTOP_VERSION | 113 | #ifndef DESKTOP_VERSION |
113 | QCopChannel* infrared; | 114 | QCopChannel* infrared; |
114 | #endif | 115 | #endif |
115 | QAction* brAction; | 116 | QAction* brAction; |
116 | KSyncManager* mSyncManager; | 117 | KSyncManager* mSyncManager; |
117 | bool mClosed; | 118 | bool mClosed; |
118 | void saveOnClose(); | 119 | void saveOnClose(); |
119 | bool mFlagKeyPressed; | 120 | bool mFlagKeyPressed; |
120 | bool mBlockAtStartup; | 121 | bool mBlockAtStartup; |
121 | QPEToolBar *iconToolBar; | 122 | QPEToolBar *iconToolBar; |
122 | void initActions(); | 123 | void initActions(); |
123 | void setDefaultPreferences(); | 124 | void setDefaultPreferences(); |
124 | void keyPressEvent ( QKeyEvent * ) ; | 125 | void keyPressEvent ( QKeyEvent * ) ; |
125 | void keyReleaseEvent ( QKeyEvent * ) ; | 126 | void keyReleaseEvent ( QKeyEvent * ) ; |
126 | QPopupMenu *configureToolBarMenu; | 127 | QPopupMenu *configureToolBarMenu; |
127 | QPopupMenu *selectFilterMenu; | 128 | QPopupMenu *selectFilterMenu; |
128 | QPopupMenu *configureAgendaMenu, *syncMenu; | 129 | QPopupMenu *configureAgendaMenu, *syncMenu; |
129 | CalendarLocal *mCalendar; | 130 | CalendarLocal *mCalendar; |
130 | CalendarView *mView; | 131 | CalendarView *mView; |
131 | QAction *mNewSubTodoAction; | 132 | QAction *mNewSubTodoAction; |
132 | QAction *mWeekAction; | 133 | QAction *mWeekAction; |
133 | QFont mWeekFont; | 134 | QFont mWeekFont; |
134 | QPixmap mWeekPixmap; | 135 | QPixmap mWeekPixmap; |
135 | QColor mWeekBgColor; | 136 | QColor mWeekBgColor; |
136 | 137 | ||
137 | QAction *mShowAction; | 138 | QAction *mShowAction; |
138 | QAction *mEditAction; | 139 | QAction *mEditAction; |
139 | QAction *mDeleteAction; | 140 | QAction *mDeleteAction; |
140 | QAction *mCloneAction; | 141 | QAction *mCloneAction; |
141 | QAction *mMoveAction; | 142 | QAction *mMoveAction; |
142 | QAction *mBeamAction; | 143 | QAction *mBeamAction; |
143 | QAction *mCancelAction; | 144 | QAction *mCancelAction; |
144 | 145 | ||
145 | QAction *mToggleNav; | 146 | QAction *mToggleNav; |
146 | QAction *mToggleFilter; | 147 | QAction *mToggleFilter; |
147 | QAction *mToggleAllday; | 148 | QAction *mToggleAllday; |
148 | 149 | ||
149 | 150 | ||
150 | void closeEvent( QCloseEvent* ce ); | 151 | void closeEvent( QCloseEvent* ce ); |
151 | SimpleAlarmClient mAlarmClient; | 152 | SimpleAlarmClient mAlarmClient; |
152 | QTimer mSaveTimer; | 153 | QTimer mSaveTimer; |
153 | //bool mBlockSaveFlag; | 154 | //bool mBlockSaveFlag; |
154 | bool mCalendarModifiedFlag; | 155 | bool mCalendarModifiedFlag; |
155 | QPixmap loadPixmap( QString ); | 156 | QPixmap loadPixmap( QString ); |
156 | }; | 157 | }; |
157 | 158 | ||
158 | 159 | ||
159 | #endif | 160 | #endif |