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