author | zautrix <zautrix> | 2005-06-29 16:14:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-29 16:14:46 (UTC) |
commit | 77aa480c9891a90c9b492618ebfd2b20f2d0727a (patch) (unidiff) | |
tree | 4f2c278d016fe21f280f8ee6abbca34685aada96 /korganizer/mainwindow.cpp | |
parent | e0fa858c284dddf0d47146e666c4ece7158487be (diff) | |
download | kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.zip kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.tar.gz kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.tar.bz2 |
many sync fixes
-rw-r--r-- | korganizer/mainwindow.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 68233e8..d8373a6 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -472,247 +472,260 @@ void MainWindow::showMaximized () | |||
472 | if ( ! globalFlagBlockStartup ) | 472 | if ( ! globalFlagBlockStartup ) |
473 | if ( mClosed ) | 473 | if ( mClosed ) |
474 | mView->goToday(); | 474 | mView->goToday(); |
475 | #endif | 475 | #endif |
476 | QWidget::showMaximized () ; | 476 | QWidget::showMaximized () ; |
477 | mClosed = false; | 477 | mClosed = false; |
478 | } | 478 | } |
479 | void MainWindow::closeEvent( QCloseEvent* ce ) | 479 | void MainWindow::closeEvent( QCloseEvent* ce ) |
480 | { | 480 | { |
481 | 481 | ||
482 | 482 | ||
483 | 483 | ||
484 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 484 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
485 | saveOnClose(); | 485 | saveOnClose(); |
486 | mClosed = true; | 486 | mClosed = true; |
487 | ce->accept(); | 487 | ce->accept(); |
488 | return; | 488 | return; |
489 | 489 | ||
490 | } | 490 | } |
491 | 491 | ||
492 | switch( QMessageBox::information( this, "KO/Pi", | 492 | switch( QMessageBox::information( this, "KO/Pi", |
493 | i18n("Do you really want\nto close KO/Pi?"), | 493 | i18n("Do you really want\nto close KO/Pi?"), |
494 | i18n("Close"), i18n("No"), | 494 | i18n("Close"), i18n("No"), |
495 | 0, 0 ) ) { | 495 | 0, 0 ) ) { |
496 | case 0: | 496 | case 0: |
497 | saveOnClose(); | 497 | saveOnClose(); |
498 | mClosed = true; | 498 | mClosed = true; |
499 | ce->accept(); | 499 | ce->accept(); |
500 | break; | 500 | break; |
501 | case 1: | 501 | case 1: |
502 | ce->ignore(); | 502 | ce->ignore(); |
503 | break; | 503 | break; |
504 | case 2: | 504 | case 2: |
505 | 505 | ||
506 | default: | 506 | default: |
507 | break; | 507 | break; |
508 | } | 508 | } |
509 | 509 | ||
510 | 510 | ||
511 | } | 511 | } |
512 | 512 | ||
513 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 513 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
514 | { | 514 | { |
515 | QDataStream stream( data, IO_ReadOnly ); | 515 | QDataStream stream( data, IO_ReadOnly ); |
516 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 516 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
517 | //QString datamess; | 517 | //QString datamess; |
518 | //qDebug("message "); | 518 | //qDebug("message "); |
519 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 519 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
520 | 520 | ||
521 | if ( cmsg == "setDocument(QString)" ) { | 521 | if ( cmsg == "setDocument(QString)" ) { |
522 | QDataStream stream( data, IO_ReadOnly ); | 522 | QDataStream stream( data, IO_ReadOnly ); |
523 | QString fileName; | 523 | QString fileName; |
524 | stream >> fileName; | 524 | stream >> fileName; |
525 | //qDebug("filename %s ", fileName.latin1()); | 525 | //qDebug("filename %s ", fileName.latin1()); |
526 | showMaximized(); | 526 | showMaximized(); |
527 | raise(); | 527 | raise(); |
528 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 528 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
529 | mSyncManager->slotSyncMenu( 1002 ); | 529 | mSyncManager->slotSyncMenu( 1002 ); |
530 | return; | 530 | return; |
531 | } | 531 | } |
532 | 532 | ||
533 | if ( cmsg == "-writeFile" ) { | 533 | if ( cmsg == "-writeFile" ) { |
534 | // I made from the "-writeFile" an "-writeAlarm" | 534 | // I made from the "-writeFile" an "-writeAlarm" |
535 | mView->viewManager()->showWhatsNextView(); | 535 | mView->viewManager()->showWhatsNextView(); |
536 | mCalendar->checkAlarmForIncidence( 0, true); | 536 | mCalendar->checkAlarmForIncidence( 0, true); |
537 | showMaximized(); | 537 | showMaximized(); |
538 | raise(); | 538 | raise(); |
539 | return; | 539 | return; |
540 | 540 | ||
541 | } | 541 | } |
542 | if ( cmsg == "-writeFileSilent" ) { | 542 | if ( cmsg == "-writeFileSilent" ) { |
543 | // I made from the "-writeFile" an "-writeAlarm" | 543 | // I made from the "-writeFile" an "-writeAlarm" |
544 | // mView->viewManager()->showWhatsNextView(); | 544 | // mView->viewManager()->showWhatsNextView(); |
545 | mCalendar->checkAlarmForIncidence( 0, true); | 545 | mCalendar->checkAlarmForIncidence( 0, true); |
546 | //showMaximized(); | 546 | //showMaximized(); |
547 | //raise(); | 547 | //raise(); |
548 | hide(); | 548 | hide(); |
549 | return; | 549 | return; |
550 | } | 550 | } |
551 | if ( cmsg == "-newCountdown" ) { | 551 | if ( cmsg == "-newCountdown" ) { |
552 | qDebug("newCountdown "); | 552 | qDebug("newCountdown "); |
553 | 553 | ||
554 | } | 554 | } |
555 | QString msg ; | 555 | QString msg ; |
556 | QString allmsg = cmsg; | 556 | QString allmsg = cmsg; |
557 | while ( allmsg.length() > 0 ) { | 557 | while ( allmsg.length() > 0 ) { |
558 | int nextC = allmsg.find( "-", 1 ); | 558 | int nextC = allmsg.find( "-", 1 ); |
559 | if ( nextC == -1 ) { | 559 | if ( nextC == -1 ) { |
560 | msg = allmsg; | 560 | msg = allmsg; |
561 | allmsg = ""; | 561 | allmsg = ""; |
562 | } else{ | 562 | } else{ |
563 | msg = allmsg.left( nextC ); | 563 | msg = allmsg.left( nextC ); |
564 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 564 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
565 | } | 565 | } |
566 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 566 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
567 | if ( msg == "-newEvent" ) { | 567 | if ( msg == "-newEvent" ) { |
568 | mView->newEvent(); | 568 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
569 | } | 569 | } |
570 | if ( msg == "-newTodo" ) { | 570 | if ( msg == "-newTodo" ) { |
571 | mView->newTodo(); | 571 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
572 | |||
573 | } | 572 | } |
574 | if ( msg == "-showWN" ) { | 573 | if ( msg == "-showWN" ) { |
575 | mView->viewManager()->showWhatsNextView(); | 574 | mView->viewManager()->showWhatsNextView(); |
576 | } | 575 | } |
577 | if ( msg == "-showTodo" ) { | 576 | if ( msg == "-showTodo" ) { |
578 | mView->viewManager()->showTodoView(); | 577 | mView->viewManager()->showTodoView(); |
579 | } | 578 | } |
580 | if ( msg == "-showList" ) { | 579 | if ( msg == "-showList" ) { |
581 | mView->viewManager()->showListView(); | 580 | mView->viewManager()->showListView(); |
582 | } | 581 | } |
583 | else if ( msg == "-showDay" ) { | 582 | else if ( msg == "-showDay" ) { |
584 | mView->viewManager()->showDayView(); | 583 | mView->viewManager()->showDayView(); |
585 | } | 584 | } |
586 | else if ( msg == "-showWWeek" ) { | 585 | else if ( msg == "-showWWeek" ) { |
587 | mView->viewManager()->showWorkWeekView(); | 586 | mView->viewManager()->showWorkWeekView(); |
588 | } | 587 | } |
589 | else if ( msg == "-ringSync" ) { | 588 | else if ( msg == "-ringSync" ) { |
590 | mSyncManager->multiSync( false ); | 589 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
591 | } | 590 | } |
592 | else if ( msg == "-showWeek" ) { | 591 | else if ( msg == "-showWeek" ) { |
593 | mView->viewManager()->showWeekView(); | 592 | mView->viewManager()->showWeekView(); |
594 | } | 593 | } |
595 | else if ( msg == "-showTodo" ) { | 594 | else if ( msg == "-showTodo" ) { |
596 | mView->viewManager()->showTodoView(); | 595 | mView->viewManager()->showTodoView(); |
597 | } | 596 | } |
598 | else if ( msg == "-showJournal" ) { | 597 | else if ( msg == "-showJournal" ) { |
599 | mView->dateNavigator()->selectDates( 1 ); | 598 | mView->dateNavigator()->selectDates( 1 ); |
600 | mView->dateNavigator()->selectToday(); | 599 | mView->dateNavigator()->selectToday(); |
601 | mView->viewManager()->showJournalView(); | 600 | mView->viewManager()->showJournalView(); |
602 | } | 601 | } |
603 | else if ( msg == "-showKO" ) { | 602 | else if ( msg == "-showKO" ) { |
604 | mView->viewManager()->showNextXView(); | 603 | mView->viewManager()->showNextXView(); |
605 | } | 604 | } |
606 | else if ( msg == "-showWNext" ) { | 605 | else if ( msg == "-showWNext" ) { |
607 | mView->viewManager()->showWhatsNextView(); | 606 | mView->viewManager()->showWhatsNextView(); |
608 | } | 607 | } |
609 | else if ( msg == "nextView()" ) { | 608 | else if ( msg == "nextView()" ) { |
610 | mView->viewManager()->showNextView(); | 609 | mView->viewManager()->showNextView(); |
611 | } | 610 | } |
612 | else if ( msg == "-showNextXView" ) { | 611 | else if ( msg == "-showNextXView" ) { |
613 | mView->viewManager()->showNextXView(); | 612 | mView->viewManager()->showNextXView(); |
614 | } | 613 | } |
615 | 614 | ||
616 | 615 | ||
617 | } | 616 | } |
618 | 617 | ||
619 | showMaximized(); | 618 | showMaximized(); |
620 | raise(); | 619 | raise(); |
621 | } | 620 | } |
622 | 621 | void MainWindow::startMultiSync() | |
622 | { | ||
623 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | ||
624 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | ||
625 | question, | ||
626 | i18n("Yes"), i18n("No"), | ||
627 | 0, 0 ) != 0 ) { | ||
628 | setCaption(i18n("Aborted! Nothing synced!")); | ||
629 | return; | ||
630 | } | ||
631 | mSyncManager->multiSync( false ); | ||
632 | #ifndef DESKTOP_VERSION | ||
633 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | ||
634 | #endif | ||
635 | } | ||
623 | QPixmap MainWindow::loadPixmap( QString name ) | 636 | QPixmap MainWindow::loadPixmap( QString name ) |
624 | { | 637 | { |
625 | return SmallIcon( name ); | 638 | return SmallIcon( name ); |
626 | 639 | ||
627 | } | 640 | } |
628 | void MainWindow::setUsesBigPixmaps ( bool b ) | 641 | void MainWindow::setUsesBigPixmaps ( bool b ) |
629 | { | 642 | { |
630 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 643 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
631 | if ( b ) | 644 | if ( b ) |
632 | qDebug("KO: BigPixmaps are not supported "); | 645 | qDebug("KO: BigPixmaps are not supported "); |
633 | } | 646 | } |
634 | void MainWindow::initActions() | 647 | void MainWindow::initActions() |
635 | { | 648 | { |
636 | //KOPrefs::instance()->mShowFullMenu | 649 | //KOPrefs::instance()->mShowFullMenu |
637 | iconToolBar->clear(); | 650 | iconToolBar->clear(); |
638 | KOPrefs *p = KOPrefs::instance(); | 651 | KOPrefs *p = KOPrefs::instance(); |
639 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 652 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
640 | 653 | ||
641 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 654 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
642 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 655 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
643 | QPopupMenu *importMenu = new QPopupMenu( this ); | 656 | QPopupMenu *importMenu = new QPopupMenu( this ); |
644 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 657 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
645 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 658 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
646 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 659 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
647 | selectFilterMenu = new QPopupMenu( this ); | 660 | selectFilterMenu = new QPopupMenu( this ); |
648 | selectFilterMenu->setCheckable( true ); | 661 | selectFilterMenu->setCheckable( true ); |
649 | syncMenu = new QPopupMenu( this ); | 662 | syncMenu = new QPopupMenu( this ); |
650 | configureAgendaMenu = new QPopupMenu( this ); | 663 | configureAgendaMenu = new QPopupMenu( this ); |
651 | configureToolBarMenu = new QPopupMenu( this ); | 664 | configureToolBarMenu = new QPopupMenu( this ); |
652 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 665 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
653 | QIconSet icon; | 666 | QIconSet icon; |
654 | int pixWid = 22, pixHei = 22; | 667 | int pixWid = 22, pixHei = 22; |
655 | QString pathString = ""; | 668 | QString pathString = ""; |
656 | if ( !p->mToolBarMiniIcons ) { | 669 | if ( !p->mToolBarMiniIcons ) { |
657 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 670 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
658 | pathString += "icons16/"; | 671 | pathString += "icons16/"; |
659 | pixWid = 18; pixHei = 16; | 672 | pixWid = 18; pixHei = 16; |
660 | } | 673 | } |
661 | } else { | 674 | } else { |
662 | pathString += "iconsmini/"; | 675 | pathString += "iconsmini/"; |
663 | pixWid = 18; pixHei = 16; | 676 | pixWid = 18; pixHei = 16; |
664 | } | 677 | } |
665 | if ( KOPrefs::instance()->mShowFullMenu ) { | 678 | if ( KOPrefs::instance()->mShowFullMenu ) { |
666 | QMenuBar *menuBar1; | 679 | QMenuBar *menuBar1; |
667 | menuBar1 = menuBar(); | 680 | menuBar1 = menuBar(); |
668 | menuBar1->insertItem( i18n("File"), importMenu ); | 681 | menuBar1->insertItem( i18n("File"), importMenu ); |
669 | menuBar1->insertItem( i18n("View"), viewMenu ); | 682 | menuBar1->insertItem( i18n("View"), viewMenu ); |
670 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 683 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
671 | #ifdef DESKTOP_VERSION | 684 | #ifdef DESKTOP_VERSION |
672 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 685 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
673 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 686 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
674 | #else | 687 | #else |
675 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 688 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
676 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 689 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
677 | #endif | 690 | #endif |
678 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 691 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
679 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 692 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
680 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 693 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
681 | } else { | 694 | } else { |
682 | QPEMenuBar *menuBar1; | 695 | QPEMenuBar *menuBar1; |
683 | menuBar1 = new QPEMenuBar( iconToolBar ); | 696 | menuBar1 = new QPEMenuBar( iconToolBar ); |
684 | QPopupMenu *menuBar = new QPopupMenu( this ); | 697 | QPopupMenu *menuBar = new QPopupMenu( this ); |
685 | icon = loadPixmap( pathString + "z_menu" ); | 698 | icon = loadPixmap( pathString + "z_menu" ); |
686 | menuBar1->insertItem( icon.pixmap(), menuBar); | 699 | menuBar1->insertItem( icon.pixmap(), menuBar); |
687 | //menuBar1->insertItem( i18n("ME"), menuBar); | 700 | //menuBar1->insertItem( i18n("ME"), menuBar); |
688 | menuBar->insertItem( i18n("File"), importMenu ); | 701 | menuBar->insertItem( i18n("File"), importMenu ); |
689 | menuBar->insertItem( i18n("View"), viewMenu ); | 702 | menuBar->insertItem( i18n("View"), viewMenu ); |
690 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 703 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
691 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 704 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
692 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 705 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
693 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 706 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
694 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 707 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
695 | menuBar->insertItem( i18n("Help"), helpMenu ); | 708 | menuBar->insertItem( i18n("Help"), helpMenu ); |
696 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 709 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
697 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 710 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
698 | } | 711 | } |
699 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 712 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
700 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 713 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
701 | 714 | ||
702 | 715 | ||
703 | mWeekBgColor = iconToolBar->backgroundColor(); | 716 | mWeekBgColor = iconToolBar->backgroundColor(); |
704 | mWeekPixmap.resize( pixWid , pixHei ); | 717 | mWeekPixmap.resize( pixWid , pixHei ); |
705 | mWeekPixmap.fill( mWeekBgColor ); | 718 | mWeekPixmap.fill( mWeekBgColor ); |
706 | icon = mWeekPixmap; | 719 | icon = mWeekPixmap; |
707 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 720 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
708 | if ( p-> mShowIconWeekNum ) | 721 | if ( p-> mShowIconWeekNum ) |
709 | mWeekAction->addTo( iconToolBar ); | 722 | mWeekAction->addTo( iconToolBar ); |
710 | mWeekFont = font(); | 723 | mWeekFont = font(); |
711 | 724 | ||
712 | int fontPoint = mWeekFont.pointSize(); | 725 | int fontPoint = mWeekFont.pointSize(); |
713 | QFontMetrics f( mWeekFont ); | 726 | QFontMetrics f( mWeekFont ); |
714 | int fontWid = f.width( "30" ); | 727 | int fontWid = f.width( "30" ); |
715 | while ( fontWid > pixWid ) { | 728 | while ( fontWid > pixWid ) { |
716 | --fontPoint; | 729 | --fontPoint; |
717 | mWeekFont.setPointSize( fontPoint ); | 730 | mWeekFont.setPointSize( fontPoint ); |
718 | QFontMetrics f( mWeekFont ); | 731 | QFontMetrics f( mWeekFont ); |