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