author | zautrix <zautrix> | 2004-08-06 15:59:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 15:59:59 (UTC) |
commit | 20918d06b98c5c2fef839d53b1b1d953da747cdf (patch) (unidiff) | |
tree | 761b98d9afd34e29886825728b14c11b5889fc0e | |
parent | f3307379ea27ad1394c9107c0129ecd3efd6bca6 (diff) | |
download | kdepimpi-20918d06b98c5c2fef839d53b1b1d953da747cdf.zip kdepimpi-20918d06b98c5c2fef839d53b1b1d953da747cdf.tar.gz kdepimpi-20918d06b98c5c2fef839d53b1b1d953da747cdf.tar.bz2 |
removed debug
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a93d8e5..c3c4c26 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -526,1526 +526,1524 @@ void MainWindow::initActions() | |||
526 | 526 | ||
527 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 527 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
528 | this ); | 528 | this ); |
529 | mNewSubTodoAction->addTo( actionMenu ); | 529 | mNewSubTodoAction->addTo( actionMenu ); |
530 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 530 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
531 | mView, SLOT( newSubTodo() ) ); | 531 | mView, SLOT( newSubTodo() ) ); |
532 | 532 | ||
533 | actionMenu->insertSeparator(); | 533 | actionMenu->insertSeparator(); |
534 | 534 | ||
535 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 535 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
536 | mShowAction->addTo( actionMenu ); | 536 | mShowAction->addTo( actionMenu ); |
537 | connect( mShowAction, SIGNAL( activated() ), | 537 | connect( mShowAction, SIGNAL( activated() ), |
538 | mView, SLOT( showIncidence() ) ); | 538 | mView, SLOT( showIncidence() ) ); |
539 | 539 | ||
540 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 540 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
541 | mEditAction->addTo( actionMenu ); | 541 | mEditAction->addTo( actionMenu ); |
542 | connect( mEditAction, SIGNAL( activated() ), | 542 | connect( mEditAction, SIGNAL( activated() ), |
543 | mView, SLOT( editIncidence() ) ); | 543 | mView, SLOT( editIncidence() ) ); |
544 | 544 | ||
545 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 545 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
546 | mDeleteAction->addTo( actionMenu ); | 546 | mDeleteAction->addTo( actionMenu ); |
547 | connect( mDeleteAction, SIGNAL( activated() ), | 547 | connect( mDeleteAction, SIGNAL( activated() ), |
548 | mView, SLOT( deleteIncidence() ) ); | 548 | mView, SLOT( deleteIncidence() ) ); |
549 | 549 | ||
550 | actionMenu->insertSeparator(); | 550 | actionMenu->insertSeparator(); |
551 | 551 | ||
552 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 552 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
553 | this ); | 553 | this ); |
554 | action->addTo( actionMenu ); | 554 | action->addTo( actionMenu ); |
555 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 555 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
556 | 556 | ||
557 | icon = loadPixmap( pathString + "search" ); | 557 | icon = loadPixmap( pathString + "search" ); |
558 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 558 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
559 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 559 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
560 | search_action->addTo( actionMenu ); | 560 | search_action->addTo( actionMenu ); |
561 | connect( search_action, SIGNAL( activated() ), | 561 | connect( search_action, SIGNAL( activated() ), |
562 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 562 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
563 | 563 | ||
564 | icon = loadPixmap( pathString + "today" ); | 564 | icon = loadPixmap( pathString + "today" ); |
565 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 565 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
566 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 566 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
567 | today_action->addTo( actionMenu ); | 567 | today_action->addTo( actionMenu ); |
568 | connect( today_action, SIGNAL( activated() ), | 568 | connect( today_action, SIGNAL( activated() ), |
569 | mView, SLOT( goToday() ) ); | 569 | mView, SLOT( goToday() ) ); |
570 | 570 | ||
571 | if ( KOPrefs::instance()->mShowFullMenu ) { | 571 | if ( KOPrefs::instance()->mShowFullMenu ) { |
572 | actionMenu->insertSeparator(); | 572 | actionMenu->insertSeparator(); |
573 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 573 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
574 | 574 | ||
575 | } | 575 | } |
576 | // actionMenu->insertSeparator(); | 576 | // actionMenu->insertSeparator(); |
577 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 577 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
578 | this ); | 578 | this ); |
579 | action->addTo( importMenu ); | 579 | action->addTo( importMenu ); |
580 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 580 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
581 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 581 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
582 | this ); | 582 | this ); |
583 | action->addTo( importMenu ); | 583 | action->addTo( importMenu ); |
584 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 584 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
585 | importMenu->insertSeparator(); | 585 | importMenu->insertSeparator(); |
586 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 586 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
587 | this ); | 587 | this ); |
588 | action->addTo( importMenu ); | 588 | action->addTo( importMenu ); |
589 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 589 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
590 | #ifndef DESKTOP_VERSION | 590 | #ifndef DESKTOP_VERSION |
591 | importMenu->insertSeparator(); | 591 | importMenu->insertSeparator(); |
592 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 592 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
593 | this ); | 593 | this ); |
594 | action->addTo( importMenu ); | 594 | action->addTo( importMenu ); |
595 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 595 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
596 | #else | 596 | #else |
597 | #ifdef _WIN32_ | 597 | #ifdef _WIN32_ |
598 | importMenu->insertSeparator(); | 598 | importMenu->insertSeparator(); |
599 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 599 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
600 | this ); | 600 | this ); |
601 | action->addTo( importMenu ); | 601 | action->addTo( importMenu ); |
602 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 602 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
603 | #endif | 603 | #endif |
604 | #endif | 604 | #endif |
605 | 605 | ||
606 | importMenu->insertSeparator(); | 606 | importMenu->insertSeparator(); |
607 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 607 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
608 | this ); | 608 | this ); |
609 | action->addTo( importMenu ); | 609 | action->addTo( importMenu ); |
610 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 610 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
611 | 611 | ||
612 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 612 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
613 | this ); | 613 | this ); |
614 | action->addTo( importMenu ); | 614 | action->addTo( importMenu ); |
615 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 615 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
616 | 616 | ||
617 | importMenu->insertSeparator(); | 617 | importMenu->insertSeparator(); |
618 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 618 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
619 | this ); | 619 | this ); |
620 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 620 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
621 | importMenu->insertSeparator(); | 621 | importMenu->insertSeparator(); |
622 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 622 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
623 | this ); | 623 | this ); |
624 | action->addTo( importMenu ); | 624 | action->addTo( importMenu ); |
625 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 625 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
626 | #ifndef DESKTOP_VERSION | 626 | #ifndef DESKTOP_VERSION |
627 | importMenu->insertSeparator(); | 627 | importMenu->insertSeparator(); |
628 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 628 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
629 | this ); | 629 | this ); |
630 | action->addTo( importMenu ); | 630 | action->addTo( importMenu ); |
631 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 631 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
632 | 632 | ||
633 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 633 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
634 | this ); | 634 | this ); |
635 | action->addTo( importMenu ); | 635 | action->addTo( importMenu ); |
636 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 636 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
637 | #else | 637 | #else |
638 | importMenu->insertSeparator(); | 638 | importMenu->insertSeparator(); |
639 | icon = loadPixmap( pathString + "print" ); | 639 | icon = loadPixmap( pathString + "print" ); |
640 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 640 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
641 | action->addTo( importMenu ); | 641 | action->addTo( importMenu ); |
642 | connect( action, SIGNAL( activated() ), | 642 | connect( action, SIGNAL( activated() ), |
643 | this, SLOT( printCal() ) ); | 643 | this, SLOT( printCal() ) ); |
644 | 644 | ||
645 | icon = loadPixmap( pathString + "print" ); | 645 | icon = loadPixmap( pathString + "print" ); |
646 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 646 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
647 | action->addTo( importMenu ); | 647 | action->addTo( importMenu ); |
648 | connect( action, SIGNAL( activated() ), | 648 | connect( action, SIGNAL( activated() ), |
649 | this, SLOT( printSel() ) ); | 649 | this, SLOT( printSel() ) ); |
650 | #endif | 650 | #endif |
651 | importMenu->insertSeparator(); | 651 | importMenu->insertSeparator(); |
652 | action = new QAction( "beam all", i18n("Save"), 0, | 652 | action = new QAction( "beam all", i18n("Save"), 0, |
653 | this ); | 653 | this ); |
654 | action->addTo( importMenu ); | 654 | action->addTo( importMenu ); |
655 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 655 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
656 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 656 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
657 | this ); | 657 | this ); |
658 | action->addTo( importMenu ); | 658 | action->addTo( importMenu ); |
659 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 659 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
660 | 660 | ||
661 | //menuBar->insertItem( "Configure",configureMenu ); | 661 | //menuBar->insertItem( "Configure",configureMenu ); |
662 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 662 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
663 | icon = loadPixmap( "korganizer/korganizer" ); | 663 | icon = loadPixmap( "korganizer/korganizer" ); |
664 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 664 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
665 | action->addTo( helpMenu ); | 665 | action->addTo( helpMenu ); |
666 | connect( action, SIGNAL( activated() ), | 666 | connect( action, SIGNAL( activated() ), |
667 | SLOT( keyBindings() ) ); | 667 | SLOT( keyBindings() ) ); |
668 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 668 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
669 | action->addTo( helpMenu ); | 669 | action->addTo( helpMenu ); |
670 | connect( action, SIGNAL( activated() ), | 670 | connect( action, SIGNAL( activated() ), |
671 | SLOT( features() ) ); | 671 | SLOT( features() ) ); |
672 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 672 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
673 | action->addTo( helpMenu ); | 673 | action->addTo( helpMenu ); |
674 | connect( action, SIGNAL( activated() ), | 674 | connect( action, SIGNAL( activated() ), |
675 | SLOT( aboutAutoSaving() ) ); | 675 | SLOT( aboutAutoSaving() ) ); |
676 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 676 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
677 | action->addTo( helpMenu ); | 677 | action->addTo( helpMenu ); |
678 | connect( action, SIGNAL( activated() ), | 678 | connect( action, SIGNAL( activated() ), |
679 | SLOT( aboutKnownBugs() ) ); | 679 | SLOT( aboutKnownBugs() ) ); |
680 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 680 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
681 | action->addTo( helpMenu ); | 681 | action->addTo( helpMenu ); |
682 | connect( action, SIGNAL( activated() ), | 682 | connect( action, SIGNAL( activated() ), |
683 | SLOT( usertrans() ) ); | 683 | SLOT( usertrans() ) ); |
684 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 684 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
685 | action->addTo( helpMenu ); | 685 | action->addTo( helpMenu ); |
686 | connect( action, SIGNAL( activated() ), | 686 | connect( action, SIGNAL( activated() ), |
687 | SLOT( synchowto() ) ); | 687 | SLOT( synchowto() ) ); |
688 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 688 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
689 | action->addTo( helpMenu ); | 689 | action->addTo( helpMenu ); |
690 | connect( action, SIGNAL( activated() ), | 690 | connect( action, SIGNAL( activated() ), |
691 | SLOT( whatsNew() ) ); | 691 | SLOT( whatsNew() ) ); |
692 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 692 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
693 | action->addTo( helpMenu ); | 693 | action->addTo( helpMenu ); |
694 | connect( action, SIGNAL( activated() ), | 694 | connect( action, SIGNAL( activated() ), |
695 | SLOT( faq() ) ); | 695 | SLOT( faq() ) ); |
696 | 696 | ||
697 | 697 | ||
698 | action = new QAction( "about", i18n("About..."), 0, this ); | 698 | action = new QAction( "about", i18n("About..."), 0, this ); |
699 | action->addTo( helpMenu ); | 699 | action->addTo( helpMenu ); |
700 | connect( action, SIGNAL( activated() ), | 700 | connect( action, SIGNAL( activated() ), |
701 | SLOT( about() ) ); | 701 | SLOT( about() ) ); |
702 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 702 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
703 | action->addTo( helpMenu ); | 703 | action->addTo( helpMenu ); |
704 | connect( action, SIGNAL( activated() ), | 704 | connect( action, SIGNAL( activated() ), |
705 | SLOT( licence() ) ); | 705 | SLOT( licence() ) ); |
706 | //menuBar->insertSeparator(); | 706 | //menuBar->insertSeparator(); |
707 | 707 | ||
708 | // ****************************************************** | 708 | // ****************************************************** |
709 | // menubar icons | 709 | // menubar icons |
710 | 710 | ||
711 | 711 | ||
712 | iconToolBar->setHorizontalStretchable (true ); | 712 | iconToolBar->setHorizontalStretchable (true ); |
713 | //menuBar->insertItem( iconToolBar ); | 713 | //menuBar->insertItem( iconToolBar ); |
714 | //xdays_action | 714 | //xdays_action |
715 | if (p-> mShowIconNewEvent) | 715 | if (p-> mShowIconNewEvent) |
716 | ne_action->addTo( iconToolBar ); | 716 | ne_action->addTo( iconToolBar ); |
717 | if (p->mShowIconNewTodo ) | 717 | if (p->mShowIconNewTodo ) |
718 | nt_action->addTo( iconToolBar ); | 718 | nt_action->addTo( iconToolBar ); |
719 | if (p-> mShowIconSearch) | 719 | if (p-> mShowIconSearch) |
720 | search_action->addTo( iconToolBar ); | 720 | search_action->addTo( iconToolBar ); |
721 | if (p-> mShowIconNext) | 721 | if (p-> mShowIconNext) |
722 | whatsnext_action->addTo( iconToolBar ); | 722 | whatsnext_action->addTo( iconToolBar ); |
723 | if (p-> mShowIconNextDays) | 723 | if (p-> mShowIconNextDays) |
724 | xdays_action->addTo( iconToolBar ); | 724 | xdays_action->addTo( iconToolBar ); |
725 | if (p-> mShowIconList) | 725 | if (p-> mShowIconList) |
726 | showlist_action->addTo( iconToolBar ); | 726 | showlist_action->addTo( iconToolBar ); |
727 | if (p-> mShowIconDay1) | 727 | if (p-> mShowIconDay1) |
728 | day1_action->addTo( iconToolBar ); | 728 | day1_action->addTo( iconToolBar ); |
729 | if (p-> mShowIconDay5) | 729 | if (p-> mShowIconDay5) |
730 | day5_action->addTo( iconToolBar ); | 730 | day5_action->addTo( iconToolBar ); |
731 | if (p-> mShowIconDay7) | 731 | if (p-> mShowIconDay7) |
732 | day7_action->addTo( iconToolBar ); | 732 | day7_action->addTo( iconToolBar ); |
733 | if (p-> mShowIconMonth) | 733 | if (p-> mShowIconMonth) |
734 | month_action->addTo( iconToolBar ); | 734 | month_action->addTo( iconToolBar ); |
735 | if (p-> mShowIconTodoview) | 735 | if (p-> mShowIconTodoview) |
736 | todoview_action->addTo( iconToolBar ); | 736 | todoview_action->addTo( iconToolBar ); |
737 | if (p-> mShowIconJournal) | 737 | if (p-> mShowIconJournal) |
738 | viewjournal_action->addTo( iconToolBar ); | 738 | viewjournal_action->addTo( iconToolBar ); |
739 | icon = loadPixmap( pathString + "2leftarrowB" ); | 739 | icon = loadPixmap( pathString + "2leftarrowB" ); |
740 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 740 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
741 | if (p-> mShowIconBackFast) { | 741 | if (p-> mShowIconBackFast) { |
742 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 742 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
743 | connect( action, SIGNAL( activated() ), | 743 | connect( action, SIGNAL( activated() ), |
744 | mView, SLOT( goPreviousMonth() ) ); | 744 | mView, SLOT( goPreviousMonth() ) ); |
745 | action->addTo( iconToolBar ); | 745 | action->addTo( iconToolBar ); |
746 | } | 746 | } |
747 | icon = loadPixmap( pathString + "1leftarrowB" ); | 747 | icon = loadPixmap( pathString + "1leftarrowB" ); |
748 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 748 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
749 | if (p-> mShowIconBack) { | 749 | if (p-> mShowIconBack) { |
750 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 750 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
751 | connect( action, SIGNAL( activated() ), | 751 | connect( action, SIGNAL( activated() ), |
752 | mView, SLOT( goPrevious() ) ); | 752 | mView, SLOT( goPrevious() ) ); |
753 | action->addTo( iconToolBar ); | 753 | action->addTo( iconToolBar ); |
754 | } | 754 | } |
755 | if (p-> mShowIconToday) | 755 | if (p-> mShowIconToday) |
756 | today_action->addTo( iconToolBar ); | 756 | today_action->addTo( iconToolBar ); |
757 | icon = loadPixmap( pathString + "1rightarrowB" ); | 757 | icon = loadPixmap( pathString + "1rightarrowB" ); |
758 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 758 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
759 | if (p-> mShowIconForward) { | 759 | if (p-> mShowIconForward) { |
760 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 760 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
761 | connect( action, SIGNAL( activated() ), | 761 | connect( action, SIGNAL( activated() ), |
762 | mView, SLOT( goNext() ) ); | 762 | mView, SLOT( goNext() ) ); |
763 | action->addTo( iconToolBar ); | 763 | action->addTo( iconToolBar ); |
764 | } | 764 | } |
765 | icon = loadPixmap( pathString + "2rightarrowB" ); | 765 | icon = loadPixmap( pathString + "2rightarrowB" ); |
766 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 766 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
767 | if (p-> mShowIconForwardFast) { | 767 | if (p-> mShowIconForwardFast) { |
768 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 768 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
769 | connect( action, SIGNAL( activated() ), | 769 | connect( action, SIGNAL( activated() ), |
770 | mView, SLOT( goNextMonth() ) ); | 770 | mView, SLOT( goNextMonth() ) ); |
771 | action->addTo( iconToolBar ); | 771 | action->addTo( iconToolBar ); |
772 | } | 772 | } |
773 | 773 | ||
774 | 774 | ||
775 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 775 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
776 | 776 | ||
777 | if (p-> mShowIconNewEvent) | 777 | if (p-> mShowIconNewEvent) |
778 | configureToolBarMenu->setItemChecked( 10, true ); | 778 | configureToolBarMenu->setItemChecked( 10, true ); |
779 | if (p->mShowIconNewTodo ) | 779 | if (p->mShowIconNewTodo ) |
780 | configureToolBarMenu->setItemChecked( 20, true ); | 780 | configureToolBarMenu->setItemChecked( 20, true ); |
781 | if (p-> mShowIconSearch) | 781 | if (p-> mShowIconSearch) |
782 | configureToolBarMenu->setItemChecked( 120, true ); | 782 | configureToolBarMenu->setItemChecked( 120, true ); |
783 | if (p-> mShowIconList) | 783 | if (p-> mShowIconList) |
784 | configureToolBarMenu->setItemChecked( 30, true ); | 784 | configureToolBarMenu->setItemChecked( 30, true ); |
785 | if (p-> mShowIconDay1) | 785 | if (p-> mShowIconDay1) |
786 | configureToolBarMenu->setItemChecked( 40, true ); | 786 | configureToolBarMenu->setItemChecked( 40, true ); |
787 | if (p-> mShowIconDay5) | 787 | if (p-> mShowIconDay5) |
788 | configureToolBarMenu->setItemChecked( 50, true ); | 788 | configureToolBarMenu->setItemChecked( 50, true ); |
789 | if (p-> mShowIconDay7) | 789 | if (p-> mShowIconDay7) |
790 | configureToolBarMenu->setItemChecked( 60, true ); | 790 | configureToolBarMenu->setItemChecked( 60, true ); |
791 | if (p-> mShowIconMonth) | 791 | if (p-> mShowIconMonth) |
792 | configureToolBarMenu->setItemChecked( 70, true ); | 792 | configureToolBarMenu->setItemChecked( 70, true ); |
793 | if (p-> mShowIconTodoview) | 793 | if (p-> mShowIconTodoview) |
794 | configureToolBarMenu->setItemChecked( 80, true ); | 794 | configureToolBarMenu->setItemChecked( 80, true ); |
795 | if (p-> mShowIconBackFast) | 795 | if (p-> mShowIconBackFast) |
796 | configureToolBarMenu->setItemChecked( 200, true ); | 796 | configureToolBarMenu->setItemChecked( 200, true ); |
797 | if (p-> mShowIconBack) | 797 | if (p-> mShowIconBack) |
798 | configureToolBarMenu->setItemChecked( 210, true ); | 798 | configureToolBarMenu->setItemChecked( 210, true ); |
799 | if (p-> mShowIconToday) | 799 | if (p-> mShowIconToday) |
800 | configureToolBarMenu->setItemChecked( 130, true ); | 800 | configureToolBarMenu->setItemChecked( 130, true ); |
801 | if (p-> mShowIconForward) | 801 | if (p-> mShowIconForward) |
802 | configureToolBarMenu->setItemChecked( 220, true ); | 802 | configureToolBarMenu->setItemChecked( 220, true ); |
803 | if (p-> mShowIconForwardFast) | 803 | if (p-> mShowIconForwardFast) |
804 | configureToolBarMenu->setItemChecked( 230, true ); | 804 | configureToolBarMenu->setItemChecked( 230, true ); |
805 | if (p-> mShowIconNextDays) | 805 | if (p-> mShowIconNextDays) |
806 | configureToolBarMenu->setItemChecked( 100, true ); | 806 | configureToolBarMenu->setItemChecked( 100, true ); |
807 | if (p-> mShowIconNext) | 807 | if (p-> mShowIconNext) |
808 | configureToolBarMenu->setItemChecked( 110, true ); | 808 | configureToolBarMenu->setItemChecked( 110, true ); |
809 | if (p-> mShowIconJournal) | 809 | if (p-> mShowIconJournal) |
810 | configureToolBarMenu->setItemChecked( 90, true ); | 810 | configureToolBarMenu->setItemChecked( 90, true ); |
811 | if (p-> mShowIconWhatsThis) | 811 | if (p-> mShowIconWhatsThis) |
812 | configureToolBarMenu->setItemChecked( 300, true ); | 812 | configureToolBarMenu->setItemChecked( 300, true ); |
813 | 813 | ||
814 | QLabel* dummy = new QLabel( iconToolBar ); | 814 | QLabel* dummy = new QLabel( iconToolBar ); |
815 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 815 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
816 | if (!p-> mShowIconStretch) | 816 | if (!p-> mShowIconStretch) |
817 | iconToolBar->setStretchableWidget ( dummy ) ; | 817 | iconToolBar->setStretchableWidget ( dummy ) ; |
818 | else | 818 | else |
819 | configureToolBarMenu->setItemChecked( 5, true ); | 819 | configureToolBarMenu->setItemChecked( 5, true ); |
820 | if (p-> mShowIconWhatsThis) | 820 | if (p-> mShowIconWhatsThis) |
821 | QWhatsThis::whatsThisButton ( iconToolBar ); | 821 | QWhatsThis::whatsThisButton ( iconToolBar ); |
822 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 822 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
823 | configureAgenda( p->mHourSize ); | 823 | configureAgenda( p->mHourSize ); |
824 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 824 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
825 | } | 825 | } |
826 | void MainWindow::fillSyncMenu() | 826 | void MainWindow::fillSyncMenu() |
827 | { | 827 | { |
828 | syncMenu->clear(); | 828 | syncMenu->clear(); |
829 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 829 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
830 | syncMenu->insertSeparator(); | 830 | syncMenu->insertSeparator(); |
831 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 831 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
832 | syncMenu->insertSeparator(); | 832 | syncMenu->insertSeparator(); |
833 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 833 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
834 | config.setGroup("General"); | 834 | config.setGroup("General"); |
835 | QStringList prof = config.readListEntry("SyncProfileNames"); | 835 | QStringList prof = config.readListEntry("SyncProfileNames"); |
836 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 836 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
837 | if ( prof.count() < 3 ) { | 837 | if ( prof.count() < 3 ) { |
838 | prof.clear(); | 838 | prof.clear(); |
839 | prof << i18n("Sharp_DTM"); | 839 | prof << i18n("Sharp_DTM"); |
840 | prof << i18n("Local_file"); | 840 | prof << i18n("Local_file"); |
841 | prof << i18n("Last_file"); | 841 | prof << i18n("Last_file"); |
842 | KSyncProfile* temp = new KSyncProfile (); | 842 | KSyncProfile* temp = new KSyncProfile (); |
843 | temp->setName( prof[0] ); | 843 | temp->setName( prof[0] ); |
844 | temp->writeConfig(&config); | 844 | temp->writeConfig(&config); |
845 | temp->setName( prof[1] ); | 845 | temp->setName( prof[1] ); |
846 | temp->writeConfig(&config); | 846 | temp->writeConfig(&config); |
847 | temp->setName( prof[2] ); | 847 | temp->setName( prof[2] ); |
848 | temp->writeConfig(&config); | 848 | temp->writeConfig(&config); |
849 | config.setGroup("General"); | 849 | config.setGroup("General"); |
850 | config.writeEntry("SyncProfileNames",prof); | 850 | config.writeEntry("SyncProfileNames",prof); |
851 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 851 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
852 | config.sync(); | 852 | config.sync(); |
853 | delete temp; | 853 | delete temp; |
854 | } | 854 | } |
855 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 855 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
856 | KOPrefs::instance()->mSyncProfileNames = prof; | 856 | KOPrefs::instance()->mSyncProfileNames = prof; |
857 | int i; | 857 | int i; |
858 | for ( i = 0; i < prof.count(); ++i ) { | 858 | for ( i = 0; i < prof.count(); ++i ) { |
859 | 859 | ||
860 | syncMenu->insertItem( prof[i], 1000+i ); | 860 | syncMenu->insertItem( prof[i], 1000+i ); |
861 | if ( i == 2 ) | 861 | if ( i == 2 ) |
862 | syncMenu->insertSeparator(); | 862 | syncMenu->insertSeparator(); |
863 | } | 863 | } |
864 | QDir app_dir; | 864 | QDir app_dir; |
865 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 865 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
866 | syncMenu->setItemEnabled( false , 1000 ); | 866 | syncMenu->setItemEnabled( false , 1000 ); |
867 | } | 867 | } |
868 | mView->setupExternSyncProfiles(); | 868 | mView->setupExternSyncProfiles(); |
869 | } | 869 | } |
870 | 870 | ||
871 | int MainWindow::ringSync() | 871 | int MainWindow::ringSync() |
872 | { | 872 | { |
873 | int syncedProfiles = 0; | 873 | int syncedProfiles = 0; |
874 | int i; | 874 | int i; |
875 | QTime timer; | 875 | QTime timer; |
876 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 876 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
877 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 877 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
878 | KSyncProfile* temp = new KSyncProfile (); | 878 | KSyncProfile* temp = new KSyncProfile (); |
879 | KOPrefs::instance()->mAskForPreferences = false; | 879 | KOPrefs::instance()->mAskForPreferences = false; |
880 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 880 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
881 | mCurrentSyncProfile = i; | 881 | mCurrentSyncProfile = i; |
882 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 882 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
883 | temp->readConfig(&config); | 883 | temp->readConfig(&config); |
884 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 884 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
885 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 885 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
886 | ++syncedProfiles; | 886 | ++syncedProfiles; |
887 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 887 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
888 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 888 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
889 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 889 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
890 | KOPrefs::instance()->mShowSyncSummary = false; | 890 | KOPrefs::instance()->mShowSyncSummary = false; |
891 | mView->setSyncDevice(syncProfileNames[i] ); | 891 | mView->setSyncDevice(syncProfileNames[i] ); |
892 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 892 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
893 | if ( i == 0 ) { | 893 | if ( i == 0 ) { |
894 | syncSharp(); | 894 | syncSharp(); |
895 | } else { | 895 | } else { |
896 | if ( temp->getIsLocalFileSync() ) { | 896 | if ( temp->getIsLocalFileSync() ) { |
897 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 897 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
898 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 898 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
899 | } else { | 899 | } else { |
900 | syncRemote( temp, false ); | 900 | syncRemote( temp, false ); |
901 | 901 | ||
902 | } | 902 | } |
903 | } | 903 | } |
904 | timer.start(); | 904 | timer.start(); |
905 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 905 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
906 | while ( timer.elapsed () < 2000 ) { | 906 | while ( timer.elapsed () < 2000 ) { |
907 | qApp->processEvents(); | 907 | qApp->processEvents(); |
908 | #ifndef _WIN32_ | 908 | #ifndef _WIN32_ |
909 | sleep (1); | 909 | sleep (1); |
910 | #endif | 910 | #endif |
911 | } | 911 | } |
912 | 912 | ||
913 | } | 913 | } |
914 | 914 | ||
915 | } | 915 | } |
916 | delete temp; | 916 | delete temp; |
917 | return syncedProfiles; | 917 | return syncedProfiles; |
918 | } | 918 | } |
919 | 919 | ||
920 | void MainWindow::multiSync( bool askforPrefs ) | 920 | void MainWindow::multiSync( bool askforPrefs ) |
921 | { | 921 | { |
922 | if (mBlockSaveFlag) | 922 | if (mBlockSaveFlag) |
923 | return; | 923 | return; |
924 | mBlockSaveFlag = true; | 924 | mBlockSaveFlag = true; |
925 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 925 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
926 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 926 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
927 | question, | 927 | question, |
928 | i18n("Yes"), i18n("No"), | 928 | i18n("Yes"), i18n("No"), |
929 | 0, 0 ) != 0 ) { | 929 | 0, 0 ) != 0 ) { |
930 | mBlockSaveFlag = false; | 930 | mBlockSaveFlag = false; |
931 | setCaption(i18n("Aborted! Nothing synced!")); | 931 | setCaption(i18n("Aborted! Nothing synced!")); |
932 | return; | 932 | return; |
933 | } | 933 | } |
934 | mView->setSyncDevice(i18n("Multiple profiles") ); | 934 | mView->setSyncDevice(i18n("Multiple profiles") ); |
935 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 935 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
936 | if ( askforPrefs ) { | 936 | if ( askforPrefs ) { |
937 | mView->edit_sync_options(); | 937 | mView->edit_sync_options(); |
938 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 938 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
939 | } | 939 | } |
940 | setCaption(i18n("Multiple sync started.") ); | 940 | setCaption(i18n("Multiple sync started.") ); |
941 | qApp->processEvents(); | 941 | qApp->processEvents(); |
942 | int num = ringSync() ; | 942 | int num = ringSync() ; |
943 | if ( num > 1 ) | 943 | if ( num > 1 ) |
944 | ringSync(); | 944 | ringSync(); |
945 | mBlockSaveFlag = false; | 945 | mBlockSaveFlag = false; |
946 | if ( num ) | 946 | if ( num ) |
947 | save(); | 947 | save(); |
948 | if ( num ) | 948 | if ( num ) |
949 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 949 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
950 | else | 950 | else |
951 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 951 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
952 | return; | 952 | return; |
953 | } | 953 | } |
954 | void MainWindow::slotSyncMenu( int action ) | 954 | void MainWindow::slotSyncMenu( int action ) |
955 | { | 955 | { |
956 | //qDebug("syncaction %d ", action); | 956 | //qDebug("syncaction %d ", action); |
957 | if ( action == 0 ) { | 957 | if ( action == 0 ) { |
958 | 958 | ||
959 | confSync(); | 959 | confSync(); |
960 | 960 | ||
961 | return; | 961 | return; |
962 | } | 962 | } |
963 | if ( action == 1 ) { | 963 | if ( action == 1 ) { |
964 | multiSync( true ); | 964 | multiSync( true ); |
965 | return; | 965 | return; |
966 | } | 966 | } |
967 | 967 | ||
968 | if (mBlockSaveFlag) | 968 | if (mBlockSaveFlag) |
969 | return; | 969 | return; |
970 | mBlockSaveFlag = true; | 970 | mBlockSaveFlag = true; |
971 | mCurrentSyncProfile = action - 1000 ; | 971 | mCurrentSyncProfile = action - 1000 ; |
972 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 972 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
973 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 973 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
974 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 974 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
975 | KSyncProfile* temp = new KSyncProfile (); | 975 | KSyncProfile* temp = new KSyncProfile (); |
976 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 976 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
977 | temp->readConfig(&config); | 977 | temp->readConfig(&config); |
978 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 978 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
979 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 979 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
980 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 980 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
981 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 981 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
982 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 982 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
983 | if ( action == 1000 ) { | 983 | if ( action == 1000 ) { |
984 | syncSharp(); | 984 | syncSharp(); |
985 | 985 | ||
986 | } else if ( action == 1001 ) { | 986 | } else if ( action == 1001 ) { |
987 | syncLocalFile(); | 987 | syncLocalFile(); |
988 | 988 | ||
989 | } else if ( action == 1002 ) { | 989 | } else if ( action == 1002 ) { |
990 | quickSyncLocalFile(); | 990 | quickSyncLocalFile(); |
991 | 991 | ||
992 | } else if ( action >= 1003 ) { | 992 | } else if ( action >= 1003 ) { |
993 | if ( temp->getIsLocalFileSync() ) { | 993 | if ( temp->getIsLocalFileSync() ) { |
994 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 994 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
995 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 995 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
996 | } else { | 996 | } else { |
997 | syncRemote( temp ); | 997 | syncRemote( temp ); |
998 | 998 | ||
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | delete temp; | 1001 | delete temp; |
1002 | mBlockSaveFlag = false; | 1002 | mBlockSaveFlag = false; |
1003 | } | 1003 | } |
1004 | void MainWindow::setDefaultPreferences() | 1004 | void MainWindow::setDefaultPreferences() |
1005 | { | 1005 | { |
1006 | KOPrefs *p = KOPrefs::instance(); | 1006 | KOPrefs *p = KOPrefs::instance(); |
1007 | 1007 | ||
1008 | p->mCompactDialogs = true; | 1008 | p->mCompactDialogs = true; |
1009 | p->mConfirm = true; | 1009 | p->mConfirm = true; |
1010 | // p->mEnableQuickTodo = false; | 1010 | // p->mEnableQuickTodo = false; |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | QString MainWindow::resourcePath() | 1013 | QString MainWindow::resourcePath() |
1014 | { | 1014 | { |
1015 | return KGlobal::iconLoader()->iconPath(); | 1015 | return KGlobal::iconLoader()->iconPath(); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void MainWindow::displayText( QString text ,QString cap ) | 1018 | void MainWindow::displayText( QString text ,QString cap ) |
1019 | { | 1019 | { |
1020 | QDialog dia( this, "name", true ); ; | 1020 | QDialog dia( this, "name", true ); ; |
1021 | dia.setCaption( cap ); | 1021 | dia.setCaption( cap ); |
1022 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1022 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1023 | lay->setSpacing( 3 ); | 1023 | lay->setSpacing( 3 ); |
1024 | lay->setMargin( 3 ); | 1024 | lay->setMargin( 3 ); |
1025 | QTextBrowser tb ( &dia ); | 1025 | QTextBrowser tb ( &dia ); |
1026 | lay->addWidget( &tb ); | 1026 | lay->addWidget( &tb ); |
1027 | tb.setText( text ); | 1027 | tb.setText( text ); |
1028 | #ifdef DESKTOP_VERSION | 1028 | #ifdef DESKTOP_VERSION |
1029 | dia.resize( 640, 480); | 1029 | dia.resize( 640, 480); |
1030 | #else | 1030 | #else |
1031 | dia.showMaximized(); | 1031 | dia.showMaximized(); |
1032 | #endif | 1032 | #endif |
1033 | dia.exec(); | 1033 | dia.exec(); |
1034 | } | 1034 | } |
1035 | void MainWindow::displayFile( QString fn, QString cap ) | 1035 | void MainWindow::displayFile( QString fn, QString cap ) |
1036 | { | 1036 | { |
1037 | QString fileName = resourcePath() + fn; | 1037 | QString fileName = resourcePath() + fn; |
1038 | QString text; | 1038 | QString text; |
1039 | QFile file( fileName ); | 1039 | QFile file( fileName ); |
1040 | if (!file.open( IO_ReadOnly ) ) { | 1040 | if (!file.open( IO_ReadOnly ) ) { |
1041 | return ; | 1041 | return ; |
1042 | 1042 | ||
1043 | } | 1043 | } |
1044 | QTextStream ts( &file ); | 1044 | QTextStream ts( &file ); |
1045 | text = ts.read(); | 1045 | text = ts.read(); |
1046 | file.close(); | 1046 | file.close(); |
1047 | displayText( text, cap); | 1047 | displayText( text, cap); |
1048 | } | 1048 | } |
1049 | void MainWindow::features() | 1049 | void MainWindow::features() |
1050 | { | 1050 | { |
1051 | 1051 | ||
1052 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1052 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | void MainWindow::usertrans() | 1055 | void MainWindow::usertrans() |
1056 | { | 1056 | { |
1057 | 1057 | ||
1058 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1058 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1059 | } | 1059 | } |
1060 | void MainWindow::synchowto() | 1060 | void MainWindow::synchowto() |
1061 | { | 1061 | { |
1062 | 1062 | ||
1063 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1063 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1064 | } | 1064 | } |
1065 | void MainWindow::faq() | 1065 | void MainWindow::faq() |
1066 | { | 1066 | { |
1067 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1067 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1068 | 1068 | ||
1069 | } | 1069 | } |
1070 | void MainWindow::whatsNew() | 1070 | void MainWindow::whatsNew() |
1071 | { | 1071 | { |
1072 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1072 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1073 | 1073 | ||
1074 | } | 1074 | } |
1075 | void MainWindow::licence() | 1075 | void MainWindow::licence() |
1076 | { | 1076 | { |
1077 | KApplication::showLicence(); | 1077 | KApplication::showLicence(); |
1078 | 1078 | ||
1079 | } | 1079 | } |
1080 | void MainWindow::about() | 1080 | void MainWindow::about() |
1081 | { | 1081 | { |
1082 | QString version; | 1082 | QString version; |
1083 | #include <../version> | 1083 | #include <../version> |
1084 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1084 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1085 | i18n("KOrganizer/Platform-independent\n") + | 1085 | i18n("KOrganizer/Platform-independent\n") + |
1086 | "(KO/Pi) " + version + " - " + | 1086 | "(KO/Pi) " + version + " - " + |
1087 | 1087 | ||
1088 | #ifdef DESKTOP_VERSION | 1088 | #ifdef DESKTOP_VERSION |
1089 | i18n("Desktop Edition\n") + | 1089 | i18n("Desktop Edition\n") + |
1090 | #else | 1090 | #else |
1091 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1091 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1092 | #endif | 1092 | #endif |
1093 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1093 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1094 | } | 1094 | } |
1095 | void MainWindow::keyBindings() | 1095 | void MainWindow::keyBindings() |
1096 | { | 1096 | { |
1097 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1097 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1098 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1098 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1099 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1099 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1100 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1100 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1101 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1101 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1102 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1102 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1103 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1103 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1104 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1104 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1105 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1105 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1106 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1106 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1107 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1107 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1108 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1108 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1109 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1109 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1110 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1110 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1111 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1111 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1112 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1112 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1113 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1113 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1114 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1114 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1115 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1115 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1116 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1116 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1117 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1117 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1118 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1118 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1119 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1119 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1120 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1120 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1121 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1121 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1122 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1122 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1123 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1123 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1124 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1124 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1125 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1125 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1126 | i18n("<p><h3>In list view:</h3></p>\n") + | 1126 | i18n("<p><h3>In list view:</h3></p>\n") + |
1127 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1127 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1128 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1128 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1129 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1129 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1130 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1130 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1131 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1131 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1132 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1132 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1133 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1133 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1134 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1134 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1135 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1135 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1136 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1136 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1137 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1137 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1138 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1138 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1139 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1139 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1140 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1140 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1141 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1141 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1142 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1142 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1143 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1143 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1144 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1144 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1145 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1145 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1146 | displayText( text, cap); | 1146 | displayText( text, cap); |
1147 | 1147 | ||
1148 | } | 1148 | } |
1149 | void MainWindow::aboutAutoSaving() | 1149 | void MainWindow::aboutAutoSaving() |
1150 | { | 1150 | { |
1151 | QMessageBox* msg; | 1151 | QMessageBox* msg; |
1152 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1152 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1153 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1153 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1154 | QMessageBox::Ok, | 1154 | QMessageBox::Ok, |
1155 | QMessageBox::NoButton, | 1155 | QMessageBox::NoButton, |
1156 | QMessageBox::NoButton); | 1156 | QMessageBox::NoButton); |
1157 | msg->exec(); | 1157 | msg->exec(); |
1158 | delete msg; | 1158 | delete msg; |
1159 | 1159 | ||
1160 | 1160 | ||
1161 | } | 1161 | } |
1162 | void MainWindow::aboutKnownBugs() | 1162 | void MainWindow::aboutKnownBugs() |
1163 | { | 1163 | { |
1164 | QMessageBox* msg; | 1164 | QMessageBox* msg; |
1165 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1165 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1166 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1166 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1167 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1167 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1168 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1168 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1169 | i18n("\nor report them in the bugtracker on\n") + | 1169 | i18n("\nor report them in the bugtracker on\n") + |
1170 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1170 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1171 | QMessageBox::NoIcon, | 1171 | QMessageBox::NoIcon, |
1172 | QMessageBox::Ok, | 1172 | QMessageBox::Ok, |
1173 | QMessageBox::NoButton, | 1173 | QMessageBox::NoButton, |
1174 | QMessageBox::NoButton); | 1174 | QMessageBox::NoButton); |
1175 | msg->exec(); | 1175 | msg->exec(); |
1176 | delete msg; | 1176 | delete msg; |
1177 | 1177 | ||
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | QString MainWindow::defaultFileName() | 1180 | QString MainWindow::defaultFileName() |
1181 | { | 1181 | { |
1182 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1182 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1185 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1186 | { | 1186 | { |
1187 | if ( !incidence ) { | 1187 | if ( !incidence ) { |
1188 | enableIncidenceActions( false ); | 1188 | enableIncidenceActions( false ); |
1189 | 1189 | ||
1190 | mNewSubTodoAction->setEnabled( false ); | 1190 | mNewSubTodoAction->setEnabled( false ); |
1191 | setCaptionToDates(); | 1191 | setCaptionToDates(); |
1192 | return; | 1192 | return; |
1193 | 1193 | ||
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | //KGlobal::locale()->formatDateTime(nextA, true); | 1196 | //KGlobal::locale()->formatDateTime(nextA, true); |
1197 | QString startString = ""; | 1197 | QString startString = ""; |
1198 | if ( incidence->type() != "Todo" ) { | 1198 | if ( incidence->type() != "Todo" ) { |
1199 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1199 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1200 | if ( incidence->doesFloat() ) { | 1200 | if ( incidence->doesFloat() ) { |
1201 | startString += ": "+incidence->dtStartDateStr( true ); | 1201 | startString += ": "+incidence->dtStartDateStr( true ); |
1202 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1202 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1203 | 1203 | ||
1204 | } else { | 1204 | } else { |
1205 | startString = ": "+incidence->dtStartStr(true); | 1205 | startString = ": "+incidence->dtStartStr(true); |
1206 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1206 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1207 | 1207 | ||
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | } else { | 1210 | } else { |
1211 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1211 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1212 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1212 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1213 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1213 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1214 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1214 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | } | 1217 | } |
1218 | else | 1218 | else |
1219 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1219 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1220 | if ( !incidence->location().isEmpty() ) | 1220 | if ( !incidence->location().isEmpty() ) |
1221 | startString += " (" +incidence->location()+")"; | 1221 | startString += " (" +incidence->location()+")"; |
1222 | setCaption( incidence->summary()+startString); | 1222 | setCaption( incidence->summary()+startString); |
1223 | 1223 | ||
1224 | enableIncidenceActions( true ); | 1224 | enableIncidenceActions( true ); |
1225 | 1225 | ||
1226 | if ( incidence->type() == "Event" ) { | 1226 | if ( incidence->type() == "Event" ) { |
1227 | mShowAction->setText( i18n("Show Event...") ); | 1227 | mShowAction->setText( i18n("Show Event...") ); |
1228 | mEditAction->setText( i18n("Edit Event...") ); | 1228 | mEditAction->setText( i18n("Edit Event...") ); |
1229 | mDeleteAction->setText( i18n("Delete Event...") ); | 1229 | mDeleteAction->setText( i18n("Delete Event...") ); |
1230 | 1230 | ||
1231 | mNewSubTodoAction->setEnabled( false ); | 1231 | mNewSubTodoAction->setEnabled( false ); |
1232 | } else if ( incidence->type() == "Todo" ) { | 1232 | } else if ( incidence->type() == "Todo" ) { |
1233 | mShowAction->setText( i18n("Show Todo...") ); | 1233 | mShowAction->setText( i18n("Show Todo...") ); |
1234 | mEditAction->setText( i18n("Edit Todo...") ); | 1234 | mEditAction->setText( i18n("Edit Todo...") ); |
1235 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1235 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1236 | 1236 | ||
1237 | mNewSubTodoAction->setEnabled( true ); | 1237 | mNewSubTodoAction->setEnabled( true ); |
1238 | } else { | 1238 | } else { |
1239 | mShowAction->setText( i18n("Show...") ); | 1239 | mShowAction->setText( i18n("Show...") ); |
1240 | mShowAction->setText( i18n("Edit...") ); | 1240 | mShowAction->setText( i18n("Edit...") ); |
1241 | mShowAction->setText( i18n("Delete...") ); | 1241 | mShowAction->setText( i18n("Delete...") ); |
1242 | 1242 | ||
1243 | mNewSubTodoAction->setEnabled( false ); | 1243 | mNewSubTodoAction->setEnabled( false ); |
1244 | } | 1244 | } |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | void MainWindow::enableIncidenceActions( bool enabled ) | 1247 | void MainWindow::enableIncidenceActions( bool enabled ) |
1248 | { | 1248 | { |
1249 | mShowAction->setEnabled( enabled ); | 1249 | mShowAction->setEnabled( enabled ); |
1250 | mEditAction->setEnabled( enabled ); | 1250 | mEditAction->setEnabled( enabled ); |
1251 | mDeleteAction->setEnabled( enabled ); | 1251 | mDeleteAction->setEnabled( enabled ); |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | void MainWindow::importOL() | 1254 | void MainWindow::importOL() |
1255 | { | 1255 | { |
1256 | #ifdef _WIN32_ | 1256 | #ifdef _WIN32_ |
1257 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1257 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1258 | id->exec(); | 1258 | id->exec(); |
1259 | delete id; | 1259 | delete id; |
1260 | mView->updateView(); | 1260 | mView->updateView(); |
1261 | #endif | 1261 | #endif |
1262 | } | 1262 | } |
1263 | void MainWindow::importBday() | 1263 | void MainWindow::importBday() |
1264 | { | 1264 | { |
1265 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1265 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1266 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1266 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1267 | i18n("Import!"), i18n("Cancel"), 0, | 1267 | i18n("Import!"), i18n("Cancel"), 0, |
1268 | 0, 1 ); | 1268 | 0, 1 ); |
1269 | if ( result == 0 ) { | 1269 | if ( result == 0 ) { |
1270 | mView->importBday(); | 1270 | mView->importBday(); |
1271 | 1271 | ||
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | 1274 | ||
1275 | } | 1275 | } |
1276 | void MainWindow::importQtopia() | 1276 | void MainWindow::importQtopia() |
1277 | { | 1277 | { |
1278 | #ifndef DESKTOP_VERSION | 1278 | #ifndef DESKTOP_VERSION |
1279 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1279 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1280 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1280 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1281 | i18n("Import!"), i18n("Cancel"), 0, | 1281 | i18n("Import!"), i18n("Cancel"), 0, |
1282 | 0, 1 ); | 1282 | 0, 1 ); |
1283 | if ( result == 0 ) { | 1283 | if ( result == 0 ) { |
1284 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1284 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1285 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1285 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1286 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1286 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1287 | mView->importQtopia( categories, datebook, todolist ); | 1287 | mView->importQtopia( categories, datebook, todolist ); |
1288 | } | 1288 | } |
1289 | #else | 1289 | #else |
1290 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1290 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1291 | i18n("Not supported \non desktop!\n"), | 1291 | i18n("Not supported \non desktop!\n"), |
1292 | i18n("Ok"), i18n("Cancel"), 0, | 1292 | i18n("Ok"), i18n("Cancel"), 0, |
1293 | 0, 1 ); | 1293 | 0, 1 ); |
1294 | 1294 | ||
1295 | #endif | 1295 | #endif |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | void MainWindow::saveOnClose() | 1298 | void MainWindow::saveOnClose() |
1299 | { | 1299 | { |
1300 | KOPrefs *p = KOPrefs::instance(); | 1300 | KOPrefs *p = KOPrefs::instance(); |
1301 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1301 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1302 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1302 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1303 | iconToolBar->y() > height()/2; | 1303 | iconToolBar->y() > height()/2; |
1304 | mView->writeSettings(); | 1304 | mView->writeSettings(); |
1305 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1305 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1306 | save(); | 1306 | save(); |
1307 | } | 1307 | } |
1308 | void MainWindow::slotModifiedChanged( bool changed ) | 1308 | void MainWindow::slotModifiedChanged( bool changed ) |
1309 | { | 1309 | { |
1310 | if ( mBlockAtStartup ) | 1310 | if ( mBlockAtStartup ) |
1311 | return; | 1311 | return; |
1312 | int msec; | 1312 | int msec; |
1313 | // we store the changes after 1 minute, | 1313 | // we store the changes after 1 minute, |
1314 | // and for safety reasons after 10 minutes again | 1314 | // and for safety reasons after 10 minutes again |
1315 | if ( !mBlockSaveFlag ) | 1315 | if ( !mBlockSaveFlag ) |
1316 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1316 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1317 | else | 1317 | else |
1318 | msec = 1000 * 600; | 1318 | msec = 1000 * 600; |
1319 | mSaveTimer.start( msec, true ); // 1 minute | 1319 | mSaveTimer.start( msec, true ); // 1 minute |
1320 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1320 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1321 | mCalendarModifiedFlag = true; | 1321 | mCalendarModifiedFlag = true; |
1322 | } | 1322 | } |
1323 | #include <qfileinfo.h> | 1323 | #include <qfileinfo.h> |
1324 | void MainWindow::save() | 1324 | void MainWindow::save() |
1325 | { | 1325 | { |
1326 | if ( mBlockSaveFlag ) | 1326 | if ( mBlockSaveFlag ) |
1327 | return; | 1327 | return; |
1328 | bool store = mBlockSaveFlag; | 1328 | bool store = mBlockSaveFlag; |
1329 | mBlockSaveFlag = true; | 1329 | mBlockSaveFlag = true; |
1330 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1330 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1331 | 1331 | ||
1332 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1332 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1333 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1333 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1334 | qDebug("KO: Start saving data to file!"); | 1334 | qDebug("KO: Start saving data to file!"); |
1335 | mView->saveCalendar( defaultFileName() ); | 1335 | mView->saveCalendar( defaultFileName() ); |
1336 | 1336 | ||
1337 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1337 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1338 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); | 1338 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); |
1339 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1339 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1340 | QString savemes; | 1340 | QString savemes; |
1341 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1341 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1342 | setCaption(savemes); | 1342 | setCaption(savemes); |
1343 | } else | 1343 | } else |
1344 | setCaption(i18n("Saving cancelled!")); | 1344 | setCaption(i18n("Saving cancelled!")); |
1345 | mCalendarModifiedFlag = false; | 1345 | mCalendarModifiedFlag = false; |
1346 | mBlockSaveFlag = store; | 1346 | mBlockSaveFlag = store; |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1349 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1350 | { | 1350 | { |
1351 | if ( !e->isAutoRepeat() ) { | 1351 | if ( !e->isAutoRepeat() ) { |
1352 | mFlagKeyPressed = false; | 1352 | mFlagKeyPressed = false; |
1353 | } | 1353 | } |
1354 | } | 1354 | } |
1355 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1355 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1356 | { | 1356 | { |
1357 | qApp->processEvents(); | 1357 | qApp->processEvents(); |
1358 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1358 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1359 | e->ignore(); | 1359 | e->ignore(); |
1360 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1360 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1361 | return; | 1361 | return; |
1362 | } | 1362 | } |
1363 | if (! e->isAutoRepeat() ) | 1363 | if (! e->isAutoRepeat() ) |
1364 | mFlagKeyPressed = true; | 1364 | mFlagKeyPressed = true; |
1365 | KOPrefs *p = KOPrefs::instance(); | 1365 | KOPrefs *p = KOPrefs::instance(); |
1366 | bool showSelectedDates = false; | 1366 | bool showSelectedDates = false; |
1367 | int size; | 1367 | int size; |
1368 | int pro = 0; | 1368 | int pro = 0; |
1369 | //qDebug("MainWindow::keyPressEvent "); | 1369 | //qDebug("MainWindow::keyPressEvent "); |
1370 | switch ( e->key() ) { | 1370 | switch ( e->key() ) { |
1371 | case Qt::Key_Right: | 1371 | case Qt::Key_Right: |
1372 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1372 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1373 | mView->goNextMonth(); | 1373 | mView->goNextMonth(); |
1374 | else | 1374 | else |
1375 | mView->goNext(); | 1375 | mView->goNext(); |
1376 | showSelectedDates = true; | 1376 | showSelectedDates = true; |
1377 | break; | 1377 | break; |
1378 | case Qt::Key_Left: | 1378 | case Qt::Key_Left: |
1379 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1379 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1380 | mView->goPreviousMonth(); | 1380 | mView->goPreviousMonth(); |
1381 | else | 1381 | else |
1382 | mView->goPrevious(); | 1382 | mView->goPrevious(); |
1383 | showSelectedDates = true; | 1383 | showSelectedDates = true; |
1384 | break; | 1384 | break; |
1385 | case Qt::Key_Down: | 1385 | case Qt::Key_Down: |
1386 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1386 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1387 | break; | 1387 | break; |
1388 | case Qt::Key_Up: | 1388 | case Qt::Key_Up: |
1389 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1389 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1390 | break; | 1390 | break; |
1391 | case Qt::Key_I: | 1391 | case Qt::Key_I: |
1392 | mView->showIncidence(); | 1392 | mView->showIncidence(); |
1393 | break; | 1393 | break; |
1394 | case Qt::Key_Delete: | 1394 | case Qt::Key_Delete: |
1395 | case Qt::Key_Backspace: | 1395 | case Qt::Key_Backspace: |
1396 | mView->deleteIncidence(); | 1396 | mView->deleteIncidence(); |
1397 | break; | 1397 | break; |
1398 | case Qt::Key_D: | 1398 | case Qt::Key_D: |
1399 | mView->viewManager()->showDayView(); | 1399 | mView->viewManager()->showDayView(); |
1400 | showSelectedDates = true; | 1400 | showSelectedDates = true; |
1401 | break; | 1401 | break; |
1402 | case Qt::Key_O: | 1402 | case Qt::Key_O: |
1403 | mView->toggleFilerEnabled( ); | 1403 | mView->toggleFilerEnabled( ); |
1404 | break; | 1404 | break; |
1405 | case Qt::Key_0: | 1405 | case Qt::Key_0: |
1406 | case Qt::Key_1: | 1406 | case Qt::Key_1: |
1407 | case Qt::Key_2: | 1407 | case Qt::Key_2: |
1408 | case Qt::Key_3: | 1408 | case Qt::Key_3: |
1409 | case Qt::Key_4: | 1409 | case Qt::Key_4: |
1410 | case Qt::Key_5: | 1410 | case Qt::Key_5: |
1411 | case Qt::Key_6: | 1411 | case Qt::Key_6: |
1412 | case Qt::Key_7: | 1412 | case Qt::Key_7: |
1413 | case Qt::Key_8: | 1413 | case Qt::Key_8: |
1414 | case Qt::Key_9: | 1414 | case Qt::Key_9: |
1415 | pro = e->key()-48; | 1415 | pro = e->key()-48; |
1416 | if ( pro == 0 ) | 1416 | if ( pro == 0 ) |
1417 | pro = 10; | 1417 | pro = 10; |
1418 | if ( e->state() == Qt::ControlButton) | 1418 | if ( e->state() == Qt::ControlButton) |
1419 | pro += 10; | 1419 | pro += 10; |
1420 | break; | 1420 | break; |
1421 | case Qt::Key_M: | 1421 | case Qt::Key_M: |
1422 | mView->viewManager()->showMonthView(); | 1422 | mView->viewManager()->showMonthView(); |
1423 | showSelectedDates = true; | 1423 | showSelectedDates = true; |
1424 | break; | 1424 | break; |
1425 | case Qt::Key_Insert: | 1425 | case Qt::Key_Insert: |
1426 | mView->newEvent(); | 1426 | mView->newEvent(); |
1427 | break; | 1427 | break; |
1428 | case Qt::Key_S : | 1428 | case Qt::Key_S : |
1429 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1429 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1430 | mView->newSubTodo(); | 1430 | mView->newSubTodo(); |
1431 | else | 1431 | else |
1432 | mView->dialogManager()->showSearchDialog(); | 1432 | mView->dialogManager()->showSearchDialog(); |
1433 | break; | 1433 | break; |
1434 | case Qt::Key_Y : | 1434 | case Qt::Key_Y : |
1435 | case Qt::Key_Z : | 1435 | case Qt::Key_Z : |
1436 | mView->viewManager()->showWorkWeekView(); | 1436 | mView->viewManager()->showWorkWeekView(); |
1437 | showSelectedDates = true; | 1437 | showSelectedDates = true; |
1438 | break; | 1438 | break; |
1439 | case Qt::Key_U : | 1439 | case Qt::Key_U : |
1440 | mView->viewManager()->showWeekView(); | 1440 | mView->viewManager()->showWeekView(); |
1441 | showSelectedDates = true; | 1441 | showSelectedDates = true; |
1442 | break; | 1442 | break; |
1443 | case Qt::Key_H : | 1443 | case Qt::Key_H : |
1444 | keyBindings(); | 1444 | keyBindings(); |
1445 | break; | 1445 | break; |
1446 | case Qt::Key_W: | 1446 | case Qt::Key_W: |
1447 | mView->viewManager()->showWhatsNextView(); | 1447 | mView->viewManager()->showWhatsNextView(); |
1448 | break; | 1448 | break; |
1449 | case Qt::Key_L: | 1449 | case Qt::Key_L: |
1450 | mView->viewManager()->showListView(); | 1450 | mView->viewManager()->showListView(); |
1451 | break; | 1451 | break; |
1452 | case Qt::Key_N: | 1452 | case Qt::Key_N: |
1453 | mView->viewManager()->showNextXView(); | 1453 | mView->viewManager()->showNextXView(); |
1454 | showSelectedDates = true; | 1454 | showSelectedDates = true; |
1455 | break; | 1455 | break; |
1456 | case Qt::Key_V: | 1456 | case Qt::Key_V: |
1457 | mView->viewManager()->showTodoView(); | 1457 | mView->viewManager()->showTodoView(); |
1458 | break; | 1458 | break; |
1459 | case Qt::Key_C: | 1459 | case Qt::Key_C: |
1460 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1460 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1461 | break; | 1461 | break; |
1462 | case Qt::Key_P: | 1462 | case Qt::Key_P: |
1463 | mView->showDatePicker( ); | 1463 | mView->showDatePicker( ); |
1464 | break; | 1464 | break; |
1465 | case Qt::Key_F: | 1465 | case Qt::Key_F: |
1466 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1466 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1467 | mView->editFilters(); | 1467 | mView->editFilters(); |
1468 | else | 1468 | else |
1469 | mView->toggleFilter(); | 1469 | mView->toggleFilter(); |
1470 | break; | 1470 | break; |
1471 | case Qt::Key_X: | 1471 | case Qt::Key_X: |
1472 | mView->toggleDateNavigatorWidget(); | 1472 | mView->toggleDateNavigatorWidget(); |
1473 | break; | 1473 | break; |
1474 | case Qt::Key_Space: | 1474 | case Qt::Key_Space: |
1475 | mView->toggleExpand(); | 1475 | mView->toggleExpand(); |
1476 | break; | 1476 | break; |
1477 | case Qt::Key_A: | 1477 | case Qt::Key_A: |
1478 | mView->toggleAllDaySize(); | 1478 | mView->toggleAllDaySize(); |
1479 | break; | 1479 | break; |
1480 | case Qt::Key_T: | 1480 | case Qt::Key_T: |
1481 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1481 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1482 | mView->newTodo(); | 1482 | mView->newTodo(); |
1483 | else { | 1483 | else { |
1484 | mView->goToday(); | 1484 | mView->goToday(); |
1485 | showSelectedDates = true; | 1485 | showSelectedDates = true; |
1486 | } | 1486 | } |
1487 | break; | 1487 | break; |
1488 | case Qt::Key_J: | 1488 | case Qt::Key_J: |
1489 | mView->viewManager()->showJournalView(); | 1489 | mView->viewManager()->showJournalView(); |
1490 | break; | 1490 | break; |
1491 | case Qt::Key_B: | 1491 | case Qt::Key_B: |
1492 | mView->editIncidenceDescription();; | 1492 | mView->editIncidenceDescription();; |
1493 | break; | 1493 | break; |
1494 | // case Qt::Key_Return: | 1494 | // case Qt::Key_Return: |
1495 | case Qt::Key_E: | 1495 | case Qt::Key_E: |
1496 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1496 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1497 | mView->newEvent(); | 1497 | mView->newEvent(); |
1498 | else | 1498 | else |
1499 | mView->editIncidence(); | 1499 | mView->editIncidence(); |
1500 | break; | 1500 | break; |
1501 | case Qt::Key_Plus: | 1501 | case Qt::Key_Plus: |
1502 | size = p->mHourSize +2; | 1502 | size = p->mHourSize +2; |
1503 | if ( size <= 18 ) | 1503 | if ( size <= 18 ) |
1504 | configureAgenda( size ); | 1504 | configureAgenda( size ); |
1505 | break; | 1505 | break; |
1506 | case Qt::Key_Minus: | 1506 | case Qt::Key_Minus: |
1507 | size = p->mHourSize - 2; | 1507 | size = p->mHourSize - 2; |
1508 | if ( size >= 4 ) | 1508 | if ( size >= 4 ) |
1509 | configureAgenda( size ); | 1509 | configureAgenda( size ); |
1510 | break; | 1510 | break; |
1511 | 1511 | ||
1512 | 1512 | ||
1513 | default: | 1513 | default: |
1514 | e->ignore(); | 1514 | e->ignore(); |
1515 | } | 1515 | } |
1516 | if ( pro > 0 ) { | 1516 | if ( pro > 0 ) { |
1517 | mView->selectFilter( pro-1 ); | 1517 | mView->selectFilter( pro-1 ); |
1518 | } | 1518 | } |
1519 | if ( showSelectedDates ) { | 1519 | if ( showSelectedDates ) { |
1520 | ;// setCaptionToDates(); | 1520 | ;// setCaptionToDates(); |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | void MainWindow::fillFilterMenu() | 1525 | void MainWindow::fillFilterMenu() |
1526 | { | 1526 | { |
1527 | selectFilterMenu->clear(); | 1527 | selectFilterMenu->clear(); |
1528 | bool disable = false; | 1528 | bool disable = false; |
1529 | if ( mView->filterView()->filtersEnabled() ) { | 1529 | if ( mView->filterView()->filtersEnabled() ) { |
1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | 1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); |
1531 | } | 1531 | } |
1532 | else { | 1532 | else { |
1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | 1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); |
1534 | disable = true; | 1534 | disable = true; |
1535 | } | 1535 | } |
1536 | selectFilterMenu->insertSeparator(); | 1536 | selectFilterMenu->insertSeparator(); |
1537 | QPtrList<CalFilter> fili = mView->filters(); | 1537 | QPtrList<CalFilter> fili = mView->filters(); |
1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1539 | CalFilter *filter = fili.first(); | 1539 | CalFilter *filter = fili.first(); |
1540 | int iii = 1; | 1540 | int iii = 1; |
1541 | while(filter) { | 1541 | while(filter) { |
1542 | selectFilterMenu->insertItem( filter->name(), iii ); | 1542 | selectFilterMenu->insertItem( filter->name(), iii ); |
1543 | if ( filter == curfilter) | 1543 | if ( filter == curfilter) |
1544 | selectFilterMenu->setItemChecked( iii, true ); | 1544 | selectFilterMenu->setItemChecked( iii, true ); |
1545 | if ( disable ) | 1545 | if ( disable ) |
1546 | selectFilterMenu->setItemEnabled( iii, false ); | 1546 | selectFilterMenu->setItemEnabled( iii, false ); |
1547 | filter = fili.next(); | 1547 | filter = fili.next(); |
1548 | ++iii; | 1548 | ++iii; |
1549 | } | 1549 | } |
1550 | qDebug("rettich "); | ||
1551 | } | 1550 | } |
1552 | void MainWindow::selectFilter( int fil ) | 1551 | void MainWindow::selectFilter( int fil ) |
1553 | { | 1552 | { |
1554 | qDebug("selectFilter %d ", fil); | ||
1555 | if ( fil == 0 ) { | 1553 | if ( fil == 0 ) { |
1556 | mView->toggleFilerEnabled( ); | 1554 | mView->toggleFilerEnabled( ); |
1557 | } else { | 1555 | } else { |
1558 | mView->selectFilter( fil-1 ); | 1556 | mView->selectFilter( fil-1 ); |
1559 | } | 1557 | } |
1560 | } | 1558 | } |
1561 | void MainWindow::configureToolBar( int item ) | 1559 | void MainWindow::configureToolBar( int item ) |
1562 | { | 1560 | { |
1563 | 1561 | ||
1564 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1562 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1565 | KOPrefs *p = KOPrefs::instance(); | 1563 | KOPrefs *p = KOPrefs::instance(); |
1566 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1564 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1567 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1565 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1568 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1566 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1569 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1567 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1570 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1568 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1571 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1569 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1572 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1570 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1573 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1571 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1574 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1572 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1575 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1573 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1576 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1574 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1577 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1575 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1578 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1576 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1579 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1577 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1580 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1578 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1581 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1579 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1582 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1580 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1583 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1581 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1584 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1582 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1585 | // initActions(); | 1583 | // initActions(); |
1586 | } | 1584 | } |
1587 | 1585 | ||
1588 | void MainWindow::setCaptionToDates() | 1586 | void MainWindow::setCaptionToDates() |
1589 | { | 1587 | { |
1590 | QString selDates; | 1588 | QString selDates; |
1591 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1589 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1592 | if (mView->startDate() < mView->endDate() ) | 1590 | if (mView->startDate() < mView->endDate() ) |
1593 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1591 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1594 | setCaption( i18n("Dates: ") + selDates ); | 1592 | setCaption( i18n("Dates: ") + selDates ); |
1595 | 1593 | ||
1596 | } | 1594 | } |
1597 | // parameter item == 0: reinit | 1595 | // parameter item == 0: reinit |
1598 | void MainWindow::configureAgenda( int item ) | 1596 | void MainWindow::configureAgenda( int item ) |
1599 | { | 1597 | { |
1600 | 1598 | ||
1601 | KOPrefs *p = KOPrefs::instance(); | 1599 | KOPrefs *p = KOPrefs::instance(); |
1602 | 1600 | ||
1603 | int i; | 1601 | int i; |
1604 | if ( item == 1 ) { | 1602 | if ( item == 1 ) { |
1605 | mView->toggleAllDaySize(); | 1603 | mView->toggleAllDaySize(); |
1606 | return; | 1604 | return; |
1607 | } | 1605 | } |
1608 | // do not allow 4 for widgets higher than 480 | 1606 | // do not allow 4 for widgets higher than 480 |
1609 | // if ( QApplication::desktop()->height() > 480 ) { | 1607 | // if ( QApplication::desktop()->height() > 480 ) { |
1610 | // if ( item == 4 ) | 1608 | // if ( item == 4 ) |
1611 | // item = 6; | 1609 | // item = 6; |
1612 | // } | 1610 | // } |
1613 | for ( i = 4; i <= 18; i= i+2 ) | 1611 | for ( i = 4; i <= 18; i= i+2 ) |
1614 | configureAgendaMenu->setItemChecked( i, false ); | 1612 | configureAgendaMenu->setItemChecked( i, false ); |
1615 | configureAgendaMenu->setItemChecked( item, true ); | 1613 | configureAgendaMenu->setItemChecked( item, true ); |
1616 | if ( p->mHourSize == item ) | 1614 | if ( p->mHourSize == item ) |
1617 | return; | 1615 | return; |
1618 | p->mHourSize=item; | 1616 | p->mHourSize=item; |
1619 | mView->viewManager()->agendaView()->updateConfig(); | 1617 | mView->viewManager()->agendaView()->updateConfig(); |
1620 | } | 1618 | } |
1621 | 1619 | ||
1622 | void MainWindow::saveCalendar() | 1620 | void MainWindow::saveCalendar() |
1623 | { | 1621 | { |
1624 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1622 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1623 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1626 | 1624 | ||
1627 | if ( fn == "" ) | 1625 | if ( fn == "" ) |
1628 | return; | 1626 | return; |
1629 | QFileInfo info; | 1627 | QFileInfo info; |
1630 | info.setFile( fn ); | 1628 | info.setFile( fn ); |
1631 | QString mes; | 1629 | QString mes; |
1632 | bool createbup = true; | 1630 | bool createbup = true; |
1633 | if ( info. exists() ) { | 1631 | if ( info. exists() ) { |
1634 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1632 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1633 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1636 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1634 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1637 | 0, 1 ); | 1635 | 0, 1 ); |
1638 | if ( result != 0 ) { | 1636 | if ( result != 0 ) { |
1639 | createbup = false; | 1637 | createbup = false; |
1640 | } | 1638 | } |
1641 | } | 1639 | } |
1642 | if ( createbup ) { | 1640 | if ( createbup ) { |
1643 | mView->saveCalendar( fn ); | 1641 | mView->saveCalendar( fn ); |
1644 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1642 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1645 | KOPrefs::instance()->mLastSaveFile = fn; | 1643 | KOPrefs::instance()->mLastSaveFile = fn; |
1646 | setCaption(mes); | 1644 | setCaption(mes); |
1647 | } | 1645 | } |
1648 | } | 1646 | } |
1649 | void MainWindow::loadCalendar() | 1647 | void MainWindow::loadCalendar() |
1650 | { | 1648 | { |
1651 | 1649 | ||
1652 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1650 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1653 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1651 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1654 | 1652 | ||
1655 | if ( fn == "" ) | 1653 | if ( fn == "" ) |
1656 | return; | 1654 | return; |
1657 | QFileInfo info; | 1655 | QFileInfo info; |
1658 | info.setFile( fn ); | 1656 | info.setFile( fn ); |
1659 | QString mess; | 1657 | QString mess; |
1660 | bool loadbup = true; | 1658 | bool loadbup = true; |
1661 | if ( info. exists() ) { | 1659 | if ( info. exists() ) { |
1662 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1660 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1663 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1661 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1664 | mess, | 1662 | mess, |
1665 | i18n("Load!"), i18n("Cancel"), 0, | 1663 | i18n("Load!"), i18n("Cancel"), 0, |
1666 | 0, 1 ); | 1664 | 0, 1 ); |
1667 | if ( result != 0 ) { | 1665 | if ( result != 0 ) { |
1668 | loadbup = false; | 1666 | loadbup = false; |
1669 | } | 1667 | } |
1670 | } else { | 1668 | } else { |
1671 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1669 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1672 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1670 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1673 | 0, 1 ); | 1671 | 0, 1 ); |
1674 | 1672 | ||
1675 | return; | 1673 | return; |
1676 | } | 1674 | } |
1677 | if ( loadbup ) { | 1675 | if ( loadbup ) { |
1678 | mView->openCalendar( fn ); | 1676 | mView->openCalendar( fn ); |
1679 | KOPrefs::instance()->mLastLoadFile = fn; | 1677 | KOPrefs::instance()->mLastLoadFile = fn; |
1680 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1678 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1681 | setCaption(mess); | 1679 | setCaption(mess); |
1682 | } | 1680 | } |
1683 | 1681 | ||
1684 | } | 1682 | } |
1685 | void MainWindow::quickImportIcal() | 1683 | void MainWindow::quickImportIcal() |
1686 | { | 1684 | { |
1687 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1685 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1688 | } | 1686 | } |
1689 | void MainWindow::importFile( QString fn, bool quick ) | 1687 | void MainWindow::importFile( QString fn, bool quick ) |
1690 | { | 1688 | { |
1691 | QFileInfo info; | 1689 | QFileInfo info; |
1692 | info.setFile( fn ); | 1690 | info.setFile( fn ); |
1693 | QString mess; | 1691 | QString mess; |
1694 | bool loadbup = true; | 1692 | bool loadbup = true; |
1695 | if ( !info. exists() ) { | 1693 | if ( !info. exists() ) { |
1696 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1694 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1697 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1695 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1698 | mess ); | 1696 | mess ); |
1699 | return; | 1697 | return; |
1700 | } | 1698 | } |
1701 | int result = 0; | 1699 | int result = 0; |
1702 | if ( !quick ) { | 1700 | if ( !quick ) { |
1703 | 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 )); | 1701 | 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 )); |
1704 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1702 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1705 | mess, | 1703 | mess, |
1706 | "Import", "Cancel", 0, | 1704 | "Import", "Cancel", 0, |
1707 | 0, 1 ); | 1705 | 0, 1 ); |
1708 | } | 1706 | } |
1709 | if ( result == 0 ) { | 1707 | if ( result == 0 ) { |
1710 | if ( mView->openCalendar( fn, true )) { | 1708 | if ( mView->openCalendar( fn, true )) { |
1711 | KOPrefs::instance()->mLastImportFile = fn; | 1709 | KOPrefs::instance()->mLastImportFile = fn; |
1712 | setCaption(i18n("Imported file successfully")); | 1710 | setCaption(i18n("Imported file successfully")); |
1713 | } else { | 1711 | } else { |
1714 | setCaption(i18n("Error importing file")); | 1712 | setCaption(i18n("Error importing file")); |
1715 | } | 1713 | } |
1716 | } | 1714 | } |
1717 | } | 1715 | } |
1718 | 1716 | ||
1719 | void MainWindow::importIcal() | 1717 | void MainWindow::importIcal() |
1720 | { | 1718 | { |
1721 | 1719 | ||
1722 | QString fn =KOPrefs::instance()->mLastImportFile; | 1720 | QString fn =KOPrefs::instance()->mLastImportFile; |
1723 | 1721 | ||
1724 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1722 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1725 | if ( fn == "" ) | 1723 | if ( fn == "" ) |
1726 | return; | 1724 | return; |
1727 | importFile( fn, true ); | 1725 | importFile( fn, true ); |
1728 | 1726 | ||
1729 | } | 1727 | } |
1730 | 1728 | ||
1731 | void MainWindow::exportVCalendar() | 1729 | void MainWindow::exportVCalendar() |
1732 | { | 1730 | { |
1733 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1731 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1734 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1732 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1735 | if ( fn == "" ) | 1733 | if ( fn == "" ) |
1736 | return; | 1734 | return; |
1737 | QFileInfo info; | 1735 | QFileInfo info; |
1738 | info.setFile( fn ); | 1736 | info.setFile( fn ); |
1739 | QString mes; | 1737 | QString mes; |
1740 | bool createbup = true; | 1738 | bool createbup = true; |
1741 | if ( info. exists() ) { | 1739 | if ( info. exists() ) { |
1742 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1740 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1743 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1741 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1744 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1742 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1745 | 0, 1 ); | 1743 | 0, 1 ); |
1746 | if ( result != 0 ) { | 1744 | if ( result != 0 ) { |
1747 | createbup = false; | 1745 | createbup = false; |
1748 | } | 1746 | } |
1749 | } | 1747 | } |
1750 | if ( createbup ) { | 1748 | if ( createbup ) { |
1751 | if ( mView->exportVCalendar( fn ) ) { | 1749 | if ( mView->exportVCalendar( fn ) ) { |
1752 | KOPrefs::instance()->mLastVcalFile = fn; | 1750 | KOPrefs::instance()->mLastVcalFile = fn; |
1753 | if ( fn.length() > 20 ) | 1751 | if ( fn.length() > 20 ) |
1754 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1752 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1755 | else | 1753 | else |
1756 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1754 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1757 | setCaption(mes); | 1755 | setCaption(mes); |
1758 | } | 1756 | } |
1759 | } | 1757 | } |
1760 | 1758 | ||
1761 | } | 1759 | } |
1762 | #include <qpushbutton.h> | 1760 | #include <qpushbutton.h> |
1763 | QString MainWindow::getPassword( ) | 1761 | QString MainWindow::getPassword( ) |
1764 | { | 1762 | { |
1765 | QString retfile = ""; | 1763 | QString retfile = ""; |
1766 | QDialog dia ( this, "input-dialog", true ); | 1764 | QDialog dia ( this, "input-dialog", true ); |
1767 | QLineEdit lab ( &dia ); | 1765 | QLineEdit lab ( &dia ); |
1768 | lab.setEchoMode( QLineEdit::Password ); | 1766 | lab.setEchoMode( QLineEdit::Password ); |
1769 | QVBoxLayout lay( &dia ); | 1767 | QVBoxLayout lay( &dia ); |
1770 | lay.setMargin(7); | 1768 | lay.setMargin(7); |
1771 | lay.setSpacing(7); | 1769 | lay.setSpacing(7); |
1772 | lay.addWidget( &lab); | 1770 | lay.addWidget( &lab); |
1773 | dia.setFixedSize( 230,50 ); | 1771 | dia.setFixedSize( 230,50 ); |
1774 | dia.setCaption( i18n("Enter password") ); | 1772 | dia.setCaption( i18n("Enter password") ); |
1775 | QPushButton pb ( "OK", &dia); | 1773 | QPushButton pb ( "OK", &dia); |
1776 | lay.addWidget( &pb ); | 1774 | lay.addWidget( &pb ); |
1777 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1775 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1778 | dia.show(); | 1776 | dia.show(); |
1779 | int res = dia.exec(); | 1777 | int res = dia.exec(); |
1780 | if ( res ) | 1778 | if ( res ) |
1781 | retfile = lab.text(); | 1779 | retfile = lab.text(); |
1782 | dia.hide(); | 1780 | dia.hide(); |
1783 | qApp->processEvents(); | 1781 | qApp->processEvents(); |
1784 | return retfile; | 1782 | return retfile; |
1785 | 1783 | ||
1786 | } | 1784 | } |
1787 | 1785 | ||
1788 | void MainWindow::syncLocalFile() | 1786 | void MainWindow::syncLocalFile() |
1789 | { | 1787 | { |
1790 | 1788 | ||
1791 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 1789 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; |
1792 | 1790 | ||
1793 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 1791 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
1794 | if ( fn == "" ) | 1792 | if ( fn == "" ) |
1795 | return; | 1793 | return; |
1796 | //mView->setSyncDevice("local-file" ); | 1794 | //mView->setSyncDevice("local-file" ); |
1797 | if ( syncWithFile( fn, false ) ) { | 1795 | if ( syncWithFile( fn, false ) ) { |
1798 | // Event* e = mView->getLastSyncEvent(); | 1796 | // Event* e = mView->getLastSyncEvent(); |
1799 | // e->setReadOnly( false ); | 1797 | // e->setReadOnly( false ); |
1800 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1798 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1801 | // e->setReadOnly( true ); | 1799 | // e->setReadOnly( true ); |
1802 | } | 1800 | } |
1803 | 1801 | ||
1804 | } | 1802 | } |
1805 | 1803 | ||
1806 | bool MainWindow::syncWithFile( QString fn , bool quick ) | 1804 | bool MainWindow::syncWithFile( QString fn , bool quick ) |
1807 | { | 1805 | { |
1808 | bool ret = false; | 1806 | bool ret = false; |
1809 | QFileInfo info; | 1807 | QFileInfo info; |
1810 | info.setFile( fn ); | 1808 | info.setFile( fn ); |
1811 | QString mess; | 1809 | QString mess; |
1812 | bool loadbup = true; | 1810 | bool loadbup = true; |
1813 | if ( !info. exists() ) { | 1811 | if ( !info. exists() ) { |
1814 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 1812 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
1815 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1813 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1816 | mess ); | 1814 | mess ); |
1817 | return ret; | 1815 | return ret; |
1818 | } | 1816 | } |
1819 | int result = 0; | 1817 | int result = 0; |
1820 | if ( !quick ) { | 1818 | if ( !quick ) { |
1821 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1819 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1822 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1820 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1823 | mess, | 1821 | mess, |
1824 | i18n("Sync"), i18n("Cancel"), 0, | 1822 | i18n("Sync"), i18n("Cancel"), 0, |
1825 | 0, 1 ); | 1823 | 0, 1 ); |
1826 | if ( result ) | 1824 | if ( result ) |
1827 | return false; | 1825 | return false; |
1828 | } | 1826 | } |
1829 | if ( KOPrefs::instance()->mAskForPreferences ) | 1827 | if ( KOPrefs::instance()->mAskForPreferences ) |
1830 | mView->edit_sync_options(); | 1828 | mView->edit_sync_options(); |
1831 | if ( result == 0 ) { | 1829 | if ( result == 0 ) { |
1832 | //qDebug("Now sycing ... "); | 1830 | //qDebug("Now sycing ... "); |
1833 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) | 1831 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) |
1834 | setCaption( i18n("Synchronization successful") ); | 1832 | setCaption( i18n("Synchronization successful") ); |
1835 | else | 1833 | else |
1836 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 1834 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
1837 | if ( ! quick ) | 1835 | if ( ! quick ) |
1838 | KOPrefs::instance()->mLastSyncedLocalFile = fn; | 1836 | KOPrefs::instance()->mLastSyncedLocalFile = fn; |
1839 | slotModifiedChanged( true ); | 1837 | slotModifiedChanged( true ); |
1840 | } | 1838 | } |
1841 | return ret; | 1839 | return ret; |
1842 | } | 1840 | } |
1843 | void MainWindow::quickSyncLocalFile() | 1841 | void MainWindow::quickSyncLocalFile() |
1844 | { | 1842 | { |
1845 | //mView->setSyncDevice("local-file" ); | 1843 | //mView->setSyncDevice("local-file" ); |
1846 | //qDebug("quickSyncLocalFile() "); | 1844 | //qDebug("quickSyncLocalFile() "); |
1847 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { | 1845 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { |
1848 | // Event* e = mView->getLastSyncEvent(); | 1846 | // Event* e = mView->getLastSyncEvent(); |
1849 | // e->setReadOnly( false ); | 1847 | // e->setReadOnly( false ); |
1850 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1848 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1851 | // e->setReadOnly( true ); | 1849 | // e->setReadOnly( true ); |
1852 | 1850 | ||
1853 | } | 1851 | } |
1854 | } | 1852 | } |
1855 | 1853 | ||
1856 | void MainWindow::confSync() | 1854 | void MainWindow::confSync() |
1857 | { | 1855 | { |
1858 | mView->confSync(); | 1856 | mView->confSync(); |
1859 | fillSyncMenu(); | 1857 | fillSyncMenu(); |
1860 | //mView->writeSettings(); | 1858 | //mView->writeSettings(); |
1861 | 1859 | ||
1862 | 1860 | ||
1863 | } | 1861 | } |
1864 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | 1862 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) |
1865 | { | 1863 | { |
1866 | QString question; | 1864 | QString question; |
1867 | if ( ask ) { | 1865 | if ( ask ) { |
1868 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 1866 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
1869 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1867 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1870 | question, | 1868 | question, |
1871 | i18n("Yes"), i18n("No"), | 1869 | i18n("Yes"), i18n("No"), |
1872 | 0, 0 ) != 0 ) | 1870 | 0, 0 ) != 0 ) |
1873 | return; | 1871 | return; |
1874 | } | 1872 | } |
1875 | QString command = prof->getPreSyncCommand(); | 1873 | QString command = prof->getPreSyncCommand(); |
1876 | int fi; | 1874 | int fi; |
1877 | if ( (fi = command.find("$PWD$")) > 0 ) { | 1875 | if ( (fi = command.find("$PWD$")) > 0 ) { |
1878 | QString pwd = getPassword(); | 1876 | QString pwd = getPassword(); |
1879 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 1877 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
1880 | 1878 | ||
1881 | } | 1879 | } |
1882 | int maxlen = 30; | 1880 | int maxlen = 30; |
1883 | if ( QApplication::desktop()->width() > 320 ) | 1881 | if ( QApplication::desktop()->width() > 320 ) |
1884 | maxlen += 25; | 1882 | maxlen += 25; |
1885 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1883 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1886 | int fileSize = 0; | 1884 | int fileSize = 0; |
1887 | int result = system ( command ); | 1885 | int result = system ( command ); |
1888 | // 0 : okay | 1886 | // 0 : okay |
1889 | // 256: no such file or dir | 1887 | // 256: no such file or dir |
1890 | // | 1888 | // |
1891 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1889 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1892 | if ( result != 0 ) { | 1890 | if ( result != 0 ) { |
1893 | int len = maxlen; | 1891 | int len = maxlen; |
1894 | while ( len < command.length() ) { | 1892 | while ( len < command.length() ) { |
1895 | command.insert( len , "\n" ); | 1893 | command.insert( len , "\n" ); |
1896 | len += maxlen +2; | 1894 | len += maxlen +2; |
1897 | } | 1895 | } |
1898 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1896 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1899 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1897 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1900 | question, | 1898 | question, |
1901 | i18n("Okay!")) ; | 1899 | i18n("Okay!")) ; |
1902 | setCaption ("KO/Pi"); | 1900 | setCaption ("KO/Pi"); |
1903 | return; | 1901 | return; |
1904 | } | 1902 | } |
1905 | setCaption ( i18n( "Copying succeed." ) ); | 1903 | setCaption ( i18n( "Copying succeed." ) ); |
1906 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 1904 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
1907 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | 1905 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { |
1908 | // Event* e = mView->getLastSyncEvent(); | 1906 | // Event* e = mView->getLastSyncEvent(); |
1909 | // e->setReadOnly( false ); | 1907 | // e->setReadOnly( false ); |
1910 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1908 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1911 | // e->setReadOnly( true ); | 1909 | // e->setReadOnly( true ); |
1912 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1910 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1913 | command = prof->getPostSyncCommand(); | 1911 | command = prof->getPostSyncCommand(); |
1914 | setCaption ( i18n( "Writing back file ..." ) ); | 1912 | setCaption ( i18n( "Writing back file ..." ) ); |
1915 | result = system ( command ); | 1913 | result = system ( command ); |
1916 | qDebug("KO: Writing back file result: %d ", result); | 1914 | qDebug("KO: Writing back file result: %d ", result); |
1917 | if ( result != 0 ) { | 1915 | if ( result != 0 ) { |
1918 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 1916 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
1919 | return; | 1917 | return; |
1920 | } else { | 1918 | } else { |
1921 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 1919 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
1922 | } | 1920 | } |
1923 | } | 1921 | } |
1924 | } | 1922 | } |
1925 | return; | 1923 | return; |
1926 | } | 1924 | } |
1927 | void MainWindow::syncSSH() | 1925 | void MainWindow::syncSSH() |
1928 | { | 1926 | { |
1929 | // not used anymore | 1927 | // not used anymore |
1930 | QTime timer; | 1928 | QTime timer; |
1931 | timer.start(); | 1929 | timer.start(); |
1932 | //qDebug("MainWindow::syncssh() "); | 1930 | //qDebug("MainWindow::syncssh() "); |
1933 | KOPrefs *p = KOPrefs::instance(); | 1931 | KOPrefs *p = KOPrefs::instance(); |
1934 | QString localFile = p->mLocalTempFile; | 1932 | QString localFile = p->mLocalTempFile; |
1935 | QString remoteIP = p->mRemoteIP; | 1933 | QString remoteIP = p->mRemoteIP; |
1936 | QString remoteUser = p->mRemoteUser; | 1934 | QString remoteUser = p->mRemoteUser; |
1937 | QString remoteFile = p->mRemoteFile; | 1935 | QString remoteFile = p->mRemoteFile; |
1938 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) | 1936 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) |
1939 | remoteUser += ":" + p->mRemotePassWd; | 1937 | remoteUser += ":" + p->mRemotePassWd; |
1940 | 1938 | ||
1941 | QString question = i18n("Do you really want\nto remote sync?\n \n") + | 1939 | QString question = i18n("Do you really want\nto remote sync?\n \n") + |
1942 | i18n("IP: " ) +remoteIP +"\n" + | 1940 | i18n("IP: " ) +remoteIP +"\n" + |
1943 | i18n("User: " ) + remoteUser +"\n" ; | 1941 | i18n("User: " ) + remoteUser +"\n" ; |
1944 | int maxlen = 30; | 1942 | int maxlen = 30; |
1945 | if ( QApplication::desktop()->width() > 320 ) | 1943 | if ( QApplication::desktop()->width() > 320 ) |
1946 | maxlen += 25; | 1944 | maxlen += 25; |
1947 | if ( remoteFile.length() > maxlen ) | 1945 | if ( remoteFile.length() > maxlen ) |
1948 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; | 1946 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; |
1949 | else | 1947 | else |
1950 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; | 1948 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; |
1951 | if ( localFile.length() > maxlen ) | 1949 | if ( localFile.length() > maxlen ) |
1952 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; | 1950 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; |
1953 | else | 1951 | else |
1954 | question += i18n("Local temp file:\n " ) + localFile +"\n"; | 1952 | question += i18n("Local temp file:\n " ) + localFile +"\n"; |
1955 | 1953 | ||
1956 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1954 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1957 | question, | 1955 | question, |
1958 | i18n("Yes"), i18n("No"), | 1956 | i18n("Yes"), i18n("No"), |
1959 | 0, 0 ) != 0 ) | 1957 | 0, 0 ) != 0 ) |
1960 | return; | 1958 | return; |
1961 | // if ( !p->mUsePassWd ) { | 1959 | // if ( !p->mUsePassWd ) { |
1962 | // QString pass = getPassword(); | 1960 | // QString pass = getPassword(); |
1963 | // if ( pass.length() > 0 ) | 1961 | // if ( pass.length() > 0 ) |
1964 | // remoteUser += ":" + pass; | 1962 | // remoteUser += ":" + pass; |
1965 | // } | 1963 | // } |
1966 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; | 1964 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; |
1967 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1965 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1968 | int fileSize = 0; | 1966 | int fileSize = 0; |
1969 | int result = system ( command ); | 1967 | int result = system ( command ); |
1970 | // 0 : okay | 1968 | // 0 : okay |
1971 | // 256: no such file or dir | 1969 | // 256: no such file or dir |
1972 | // | 1970 | // |
1973 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1971 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1974 | if ( result != 0 ) { | 1972 | if ( result != 0 ) { |
1975 | int len = maxlen; | 1973 | int len = maxlen; |
1976 | while ( len < command.length() ) { | 1974 | while ( len < command.length() ) { |
1977 | command.insert( len , "\n" ); | 1975 | command.insert( len , "\n" ); |
1978 | len += maxlen +2; | 1976 | len += maxlen +2; |
1979 | } | 1977 | } |
1980 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1978 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1981 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1979 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1982 | question, | 1980 | question, |
1983 | i18n("Okay!")) ; | 1981 | i18n("Okay!")) ; |
1984 | setCaption ("KO/Pi"); | 1982 | setCaption ("KO/Pi"); |
1985 | return; | 1983 | return; |
1986 | } | 1984 | } |
1987 | 1985 | ||
1988 | 1986 | ||
1989 | setCaption ( i18n( "Copying succeed." ) ); | 1987 | setCaption ( i18n( "Copying succeed." ) ); |
1990 | //mView->setSyncDevice("ssh-scp" ); | 1988 | //mView->setSyncDevice("ssh-scp" ); |
1991 | if ( syncWithFile(localFile , true ) ) { | 1989 | if ( syncWithFile(localFile , true ) ) { |
1992 | // Event* e = mView->getLastSyncEvent(); | 1990 | // Event* e = mView->getLastSyncEvent(); |
1993 | // e->setReadOnly( false ); | 1991 | // e->setReadOnly( false ); |
1994 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1992 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1995 | // e->setReadOnly( true ); | 1993 | // e->setReadOnly( true ); |
1996 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1994 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1997 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; | 1995 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; |
1998 | setCaption ( i18n( "Writing back file ..." ) ); | 1996 | setCaption ( i18n( "Writing back file ..." ) ); |
1999 | result = system ( command ); | 1997 | result = system ( command ); |
2000 | if ( result != 0 ) { | 1998 | if ( result != 0 ) { |
2001 | int len = maxlen; | 1999 | int len = maxlen; |
2002 | while ( len < command.length() ) { | 2000 | while ( len < command.length() ) { |
2003 | command.insert( len , "\n" ); | 2001 | command.insert( len , "\n" ); |
2004 | len += maxlen +2; | 2002 | len += maxlen +2; |
2005 | } | 2003 | } |
2006 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 2004 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
2007 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 2005 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
2008 | question, | 2006 | question, |
2009 | i18n("Okay!")) ; | 2007 | i18n("Okay!")) ; |
2010 | setCaption ("KO/Pi"); | 2008 | setCaption ("KO/Pi"); |
2011 | return; | 2009 | return; |
2012 | } else { | 2010 | } else { |
2013 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 2011 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
2014 | } | 2012 | } |
2015 | } | 2013 | } |
2016 | } | 2014 | } |
2017 | return; | 2015 | return; |
2018 | #if 0 | 2016 | #if 0 |
2019 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); | 2017 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); |
2020 | while ( timer.elapsed() < 5000 ) | 2018 | while ( timer.elapsed() < 5000 ) |
2021 | qApp->processEvents(); | 2019 | qApp->processEvents(); |
2022 | 2020 | ||
2023 | qDebug("MainWindow::merging) "); | 2021 | qDebug("MainWindow::merging) "); |
2024 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); | 2022 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); |
2025 | while ( mBlockSaveFlag ) | 2023 | while ( mBlockSaveFlag ) |
2026 | qApp->processEvents(); | 2024 | qApp->processEvents(); |
2027 | save(); | 2025 | save(); |
2028 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); | 2026 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); |
2029 | #endif | 2027 | #endif |
2030 | 2028 | ||
2031 | } | 2029 | } |
2032 | 2030 | ||
2033 | 2031 | ||
2034 | void MainWindow::syncSharp() | 2032 | void MainWindow::syncSharp() |
2035 | { | 2033 | { |
2036 | if ( mCalendarModifiedFlag ) | 2034 | if ( mCalendarModifiedFlag ) |
2037 | save(); | 2035 | save(); |
2038 | mView->syncSharp(); | 2036 | mView->syncSharp(); |
2039 | slotModifiedChanged( true ); | 2037 | slotModifiedChanged( true ); |
2040 | 2038 | ||
2041 | } | 2039 | } |
2042 | 2040 | ||
2043 | void MainWindow::printSel( ) | 2041 | void MainWindow::printSel( ) |
2044 | { | 2042 | { |
2045 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2043 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2046 | } | 2044 | } |
2047 | 2045 | ||
2048 | void MainWindow::printCal() | 2046 | void MainWindow::printCal() |
2049 | { | 2047 | { |
2050 | mView->print();//mCp->showDialog(); | 2048 | mView->print();//mCp->showDialog(); |
2051 | } | 2049 | } |