summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp23
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 19 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
@@ -376,439 +376,452 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
376 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 376 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
377 mSyncManager->setDefaultFileName( sentSyncFile()); 377 mSyncManager->setDefaultFileName( sentSyncFile());
378 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 378 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
379 mSyncManager->fillSyncMenu(); 379 mSyncManager->fillSyncMenu();
380 380
381 381
382 382
383 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 383 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
384 if ( showWarning ) { 384 if ( showWarning ) {
385 KMessageBox::information( this, 385 KMessageBox::information( this,
386 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 386 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
387 qApp->processEvents(); 387 qApp->processEvents();
388 mView->dialogManager()->showSyncOptions(); 388 mView->dialogManager()->showSyncOptions();
389 } 389 }
390 390
391 //US listen for result adressed from Ka/Pi 391 //US listen for result adressed from Ka/Pi
392#ifndef DESKTOP_VERSION 392#ifndef DESKTOP_VERSION
393 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 393 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
394#endif 394#endif
395#ifndef DESKTOP_VERSION 395#ifndef DESKTOP_VERSION
396 infrared = 0; 396 infrared = 0;
397#endif 397#endif
398 updateFilterToolbar(); 398 updateFilterToolbar();
399 updateWeek( mView->startDate() ); 399 updateWeek( mView->startDate() );
400 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 400 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
401 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 401 SLOT( updateWeekNum( const KCal::DateList & ) ) );
402 mBRdisabled = false; 402 mBRdisabled = false;
403 //toggleBeamReceive(); 403 //toggleBeamReceive();
404 int tiint= 3000; 404 int tiint= 3000;
405#ifndef DESKTOP_VERSION 405#ifndef DESKTOP_VERSION
406 tiint = 5000; 406 tiint = 5000;
407#endif 407#endif
408 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); 408 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() ));
409} 409}
410MainWindow::~MainWindow() 410MainWindow::~MainWindow()
411{ 411{
412 //qDebug("MainWindow::~MainWindow() "); 412 //qDebug("MainWindow::~MainWindow() ");
413 //save toolbar location 413 //save toolbar location
414 delete mCalendar; 414 delete mCalendar;
415 delete mSyncManager; 415 delete mSyncManager;
416#ifndef DESKTOP_VERSION 416#ifndef DESKTOP_VERSION
417 if ( infrared ) 417 if ( infrared )
418 delete infrared; 418 delete infrared;
419#endif 419#endif
420 420
421 421
422} 422}
423 423
424void MainWindow::disableBR(bool b) 424void MainWindow::disableBR(bool b)
425{ 425{
426#ifndef DESKTOP_VERSION 426#ifndef DESKTOP_VERSION
427 if ( b ) { 427 if ( b ) {
428 if ( infrared ) { 428 if ( infrared ) {
429 toggleBeamReceive(); 429 toggleBeamReceive();
430 mBRdisabled = true; 430 mBRdisabled = true;
431 } 431 }
432 mBRdisabled = true; 432 mBRdisabled = true;
433 } else { 433 } else {
434 if ( mBRdisabled ) { 434 if ( mBRdisabled ) {
435 mBRdisabled = false; 435 mBRdisabled = false;
436 //makes no sense,because other cal ap is probably running 436 //makes no sense,because other cal ap is probably running
437 // toggleBeamReceive(); 437 // toggleBeamReceive();
438 } 438 }
439 } 439 }
440#endif 440#endif
441 441
442} 442}
443bool MainWindow::beamReceiveEnabled() 443bool MainWindow::beamReceiveEnabled()
444{ 444{
445#ifndef DESKTOP_VERSION 445#ifndef DESKTOP_VERSION
446 return ( infrared != 0 ); 446 return ( infrared != 0 );
447#endif 447#endif
448 return false; 448 return false;
449} 449}
450 450
451void MainWindow::toggleBeamReceive() 451void MainWindow::toggleBeamReceive()
452{ 452{
453 if ( mBRdisabled ) 453 if ( mBRdisabled )
454 return; 454 return;
455#ifndef DESKTOP_VERSION 455#ifndef DESKTOP_VERSION
456 if ( infrared ) { 456 if ( infrared ) {
457 qDebug("KO: Disable BeamReceive "); 457 qDebug("KO: Disable BeamReceive ");
458 delete infrared; 458 delete infrared;
459 infrared = 0; 459 infrared = 0;
460 brAction->setOn(false); 460 brAction->setOn(false);
461 return; 461 return;
462 } 462 }
463 qDebug("KO: Enable BeamReceive "); 463 qDebug("KO: Enable BeamReceive ");
464 brAction->setOn(true); 464 brAction->setOn(true);
465 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 465 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
466 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 466 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
467#endif 467#endif
468} 468}
469void MainWindow::showMaximized () 469void MainWindow::showMaximized ()
470{ 470{
471#ifndef DESKTOP_VERSION 471#ifndef DESKTOP_VERSION
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}
479void MainWindow::closeEvent( QCloseEvent* ce ) 479void 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
513void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 513void 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 621void 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}
623QPixmap MainWindow::loadPixmap( QString name ) 636QPixmap MainWindow::loadPixmap( QString name )
624{ 637{
625 return SmallIcon( name ); 638 return SmallIcon( name );
626 639
627} 640}
628void MainWindow::setUsesBigPixmaps ( bool b ) 641void 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}
634void MainWindow::initActions() 647void 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 );
719 fontWid = f.width( "30" ); 732 fontWid = f.width( "30" );
720 //qDebug("dec-- "); 733 //qDebug("dec-- ");
721 } 734 }
722 735
723 connect( mWeekAction, SIGNAL( activated() ), 736 connect( mWeekAction, SIGNAL( activated() ),
724 this, SLOT( weekAction() ) ); 737 this, SLOT( weekAction() ) );
725 738
726 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 739 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
727 if ( p->mShowIconFilterview ) { 740 if ( p->mShowIconFilterview ) {
728 icon = loadPixmap( pathString + "filter" ); 741 icon = loadPixmap( pathString + "filter" );
729 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 742 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
730 connect( actionFilterMenuTB, SIGNAL( activated() ), 743 connect( actionFilterMenuTB, SIGNAL( activated() ),
731 this, SLOT( fillFilterMenuTB() ) ); 744 this, SLOT( fillFilterMenuTB() ) );
732 actionFilterMenuTB->addTo( iconToolBar ); 745 actionFilterMenuTB->addTo( iconToolBar );
733 selectFilterMenuTB = new QPopupMenu( this ); 746 selectFilterMenuTB = new QPopupMenu( this );
734 selectFilterMenuTB->setCheckable( true ); 747 selectFilterMenuTB->setCheckable( true );
735 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 748 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
736 } 749 }
737 750
738 //#endif 751 //#endif
739 // ****************** 752 // ******************
740 QAction *action; 753 QAction *action;
741 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 754 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
742 configureToolBarMenu->setCheckable( true ); 755 configureToolBarMenu->setCheckable( true );
743 756
744 757
745 configureAgendaMenu->setCheckable( true ); 758 configureAgendaMenu->setCheckable( true );
746 int iii ; 759 int iii ;
747 for ( iii = 1;iii<= 10 ;++iii ){ 760 for ( iii = 1;iii<= 10 ;++iii ){
748 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 761 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
749 } 762 }
750 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 763 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
751 764
752 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 765 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
753 this, SLOT( showConfigureAgenda( ) ) ); 766 this, SLOT( showConfigureAgenda( ) ) );
754 767
755 icon = loadPixmap( pathString + "configure" ); 768 icon = loadPixmap( pathString + "configure" );
756 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 769 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
757 action->addTo( actionMenu ); 770 action->addTo( actionMenu );
758 connect( action, SIGNAL( activated() ), 771 connect( action, SIGNAL( activated() ),
759 mView, SLOT( edit_options() ) ); 772 mView, SLOT( edit_options() ) );
760 icon = loadPixmap( pathString + "configure" ); 773 icon = loadPixmap( pathString + "configure" );
761 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 774 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
762 action->addTo( actionMenu ); 775 action->addTo( actionMenu );
763 connect( action, SIGNAL( activated() ), 776 connect( action, SIGNAL( activated() ),
764 mView, SLOT( edit_global_options() ) ); 777 mView, SLOT( edit_global_options() ) );
765 actionMenu->insertSeparator(); 778 actionMenu->insertSeparator();
766 779
767 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 780 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
768 action->addTo( actionMenu ); 781 action->addTo( actionMenu );
769 connect( action, SIGNAL( activated() ), 782 connect( action, SIGNAL( activated() ),
770 mView, SLOT( undo_delete() ) ); 783 mView, SLOT( undo_delete() ) );
771 actionMenu->insertSeparator(); 784 actionMenu->insertSeparator();
772 785
773 icon = loadPixmap( pathString + "newevent" ); 786 icon = loadPixmap( pathString + "newevent" );
774 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 787 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
775 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 788 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
776 configureToolBarMenu->insertSeparator(); 789 configureToolBarMenu->insertSeparator();
777 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 790 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
778 configureToolBarMenu->insertSeparator(); 791 configureToolBarMenu->insertSeparator();
779 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 792 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
780 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 793 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
781 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 794 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
782 ne_action->addTo( actionMenu ); 795 ne_action->addTo( actionMenu );
783 connect( ne_action, SIGNAL( activated() ), 796 connect( ne_action, SIGNAL( activated() ),
784 mView, SLOT( newEvent() ) ); 797 mView, SLOT( newEvent() ) );
785 icon = loadPixmap( pathString + "newtodo" ); 798 icon = loadPixmap( pathString + "newtodo" );
786 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 799 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
787 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 800 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
788 nt_action->addTo( actionMenu ); 801 nt_action->addTo( actionMenu );
789 connect( nt_action, SIGNAL( activated() ), 802 connect( nt_action, SIGNAL( activated() ),
790 mView, SLOT( newTodo() ) ); 803 mView, SLOT( newTodo() ) );
791 804
792 icon = loadPixmap( pathString + "today" ); 805 icon = loadPixmap( pathString + "today" );
793 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 806 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
794 today_action->addTo( viewMenu ); 807 today_action->addTo( viewMenu );
795 connect( today_action, SIGNAL( activated() ), 808 connect( today_action, SIGNAL( activated() ),
796 mView, SLOT( goToday() ) ); 809 mView, SLOT( goToday() ) );
797 viewMenu->insertSeparator(); 810 viewMenu->insertSeparator();
798 811
799 // *********************** 812 // ***********************
800 if ( KOPrefs::instance()->mVerticalScreen ) { 813 if ( KOPrefs::instance()->mVerticalScreen ) {
801 icon = SmallIcon( "1updownarrow" ); 814 icon = SmallIcon( "1updownarrow" );
802 } else { 815 } else {
803 icon = SmallIcon("1leftrightarrow" ); 816 icon = SmallIcon("1leftrightarrow" );
804 } 817 }
805 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 818 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
806 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 819 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
807 FSaction->addTo( viewMenu ); 820 FSaction->addTo( viewMenu );
808 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 821 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
809 822
810 823
811 icon = loadPixmap( pathString + "filter" ); 824 icon = loadPixmap( pathString + "filter" );
812 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 825 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
813 icon = loadPixmap( pathString + "configure" ); 826 icon = loadPixmap( pathString + "configure" );
814 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 827 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index c9817c3..a4d0523 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,170 +1,171 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setUsesBigPixmaps ( bool ); 46 void setUsesBigPixmaps ( bool );
47 void setCaption ( const QString & ); 47 void setCaption ( const QString & );
48 void updateWeekNum(const KCal::DateList &); 48 void updateWeekNum(const KCal::DateList &);
49 void updateWeek(QDate); 49 void updateWeek(QDate);
50 void updateFilterToolbar(); 50 void updateFilterToolbar();
51 virtual void showMaximized (); 51 virtual void showMaximized ();
52 void configureAgenda( int ); 52 void configureAgenda( int );
53 void recieve( const QCString& msg, const QByteArray& data ); 53 void recieve( const QCString& msg, const QByteArray& data );
54 protected slots: 54 protected slots:
55 void startMultiSync();
55 void setCaptionToDates(); 56 void setCaptionToDates();
56 void weekAction(); 57 void weekAction();
57 void about(); 58 void about();
58 void licence(); 59 void licence();
59 void faq(); 60 void faq();
60 void usertrans(); 61 void usertrans();
61 void features(); 62 void features();
62 void synchowto(); 63 void synchowto();
63 void storagehowto(); 64 void storagehowto();
64 void timetrackinghowto(); 65 void timetrackinghowto();
65 void kdesynchowto(); 66 void kdesynchowto();
66 void multisynchowto(); 67 void multisynchowto();
67 void whatsNew(); 68 void whatsNew();
68 void keyBindings(); 69 void keyBindings();
69 void aboutAutoSaving();; 70 void aboutAutoSaving();;
70 void aboutKnownBugs(); 71 void aboutKnownBugs();
71 72
72 void processIncidenceSelection( Incidence * ); 73 void processIncidenceSelection( Incidence * );
73 74
74 void importQtopia(); 75 void importQtopia();
75 void importBday(); 76 void importBday();
76 void importOL(); 77 void importOL();
77 void importIcal(); 78 void importIcal();
78 void importFile( QString, bool ); 79 void importFile( QString, bool );
79 void quickImportIcal(); 80 void quickImportIcal();
80 81
81 void slotModifiedChanged( bool ); 82 void slotModifiedChanged( bool );
82 83
83 void save(); 84 void save();
84 void backupAllFiles(); 85 void backupAllFiles();
85 void saveStopTimer(); 86 void saveStopTimer();
86 void configureToolBar( int ); 87 void configureToolBar( int );
87 void printSel(); 88 void printSel();
88 void printCal(); 89 void printCal();
89 void printListView(); 90 void printListView();
90 void saveCalendar(); 91 void saveCalendar();
91 void loadCalendar(); 92 void loadCalendar();
92 void exportVCalendar(); 93 void exportVCalendar();
93 void fillFilterMenu(); 94 void fillFilterMenu();
94 void fillFilterMenuTB(); 95 void fillFilterMenuTB();
95 void selectFilter( int ); 96 void selectFilter( int );
96 void fillFilterMenuPopup(); 97 void fillFilterMenuPopup();
97 void selectFilterPopup( int ); 98 void selectFilterPopup( int );
98 void exportToPhone( int ); 99 void exportToPhone( int );
99 void toggleBeamReceive(); 100 void toggleBeamReceive();
100 void disableBR(bool); 101 void disableBR(bool);
101 signals: 102 signals:
102 void selectWeek ( int ); 103 void selectWeek ( int );
103 private slots: 104 private slots:
104 void showConfigureAgenda(); 105 void showConfigureAgenda();
105 void getFile( bool ); 106 void getFile( bool );
106 void syncFileRequest(); 107 void syncFileRequest();
107 108
108 protected: 109 protected:
109 void hideEvent ( QHideEvent * ); 110 void hideEvent ( QHideEvent * );
110 QString sentSyncFile(); 111 QString sentSyncFile();
111 void displayText( QString, QString); 112 void displayText( QString, QString);
112 void enableIncidenceActions( bool ); 113 void enableIncidenceActions( bool );
113 114
114 private: 115 private:
115 bool mBRdisabled; 116 bool mBRdisabled;
116#ifndef DESKTOP_VERSION 117#ifndef DESKTOP_VERSION
117 QCopChannel* infrared; 118 QCopChannel* infrared;
118#endif 119#endif
119 QAction* brAction; 120 QAction* brAction;
120 KSyncManager* mSyncManager; 121 KSyncManager* mSyncManager;
121 bool mClosed; 122 bool mClosed;
122 void saveOnClose(); 123 void saveOnClose();
123 bool mFlagKeyPressed; 124 bool mFlagKeyPressed;
124 bool mBlockAtStartup; 125 bool mBlockAtStartup;
125 QPEToolBar *iconToolBar; 126 QPEToolBar *iconToolBar;
126 QPEToolBar *viewToolBar; 127 QPEToolBar *viewToolBar;
127 QPEToolBar *navigatorToolBar; 128 QPEToolBar *navigatorToolBar;
128 QPEToolBar *filterToolBar; 129 QPEToolBar *filterToolBar;
129 QMenuBar *filterMenubar; 130 QMenuBar *filterMenubar;
130 QPopupMenu * filterPopupMenu; 131 QPopupMenu * filterPopupMenu;
131 void initActions(); 132 void initActions();
132 void setDefaultPreferences(); 133 void setDefaultPreferences();
133 void resizeEvent( QResizeEvent* e); 134 void resizeEvent( QResizeEvent* e);
134 void keyPressEvent ( QKeyEvent * ) ; 135 void keyPressEvent ( QKeyEvent * ) ;
135 void keyReleaseEvent ( QKeyEvent * ) ; 136 void keyReleaseEvent ( QKeyEvent * ) ;
136 QPopupMenu *configureToolBarMenu; 137 QPopupMenu *configureToolBarMenu;
137 QPopupMenu *selectFilterMenu; 138 QPopupMenu *selectFilterMenu;
138 QPopupMenu *selectFilterMenuTB; 139 QPopupMenu *selectFilterMenuTB;
139 QPopupMenu *configureAgendaMenu, *syncMenu; 140 QPopupMenu *configureAgendaMenu, *syncMenu;
140 CalendarLocal *mCalendar; 141 CalendarLocal *mCalendar;
141 CalendarView *mView; 142 CalendarView *mView;
142 QAction *mNewSubTodoAction; 143 QAction *mNewSubTodoAction;
143 QAction *mWeekAction; 144 QAction *mWeekAction;
144 QFont mWeekFont; 145 QFont mWeekFont;
145 QPixmap mWeekPixmap; 146 QPixmap mWeekPixmap;
146 QColor mWeekBgColor; 147 QColor mWeekBgColor;
147 148
148 QAction *mShowAction; 149 QAction *mShowAction;
149 QAction *mEditAction; 150 QAction *mEditAction;
150 QAction *mDeleteAction; 151 QAction *mDeleteAction;
151 QAction *mCloneAction; 152 QAction *mCloneAction;
152 QAction *mMoveAction; 153 QAction *mMoveAction;
153 QAction *mBeamAction; 154 QAction *mBeamAction;
154 QAction *mCancelAction; 155 QAction *mCancelAction;
155 156
156 QAction *mToggleNav; 157 QAction *mToggleNav;
157 QAction *mToggleFilter; 158 QAction *mToggleFilter;
158 QAction *mToggleAllday; 159 QAction *mToggleAllday;
159 QAction *actionFilterMenuTB; 160 QAction *actionFilterMenuTB;
160 161
161 void closeEvent( QCloseEvent* ce ); 162 void closeEvent( QCloseEvent* ce );
162 QTimer mSaveTimer; 163 QTimer mSaveTimer;
163 //bool mBlockSaveFlag; 164 //bool mBlockSaveFlag;
164 bool mCalendarModifiedFlag; 165 bool mCalendarModifiedFlag;
165 QPixmap loadPixmap( QString ); 166 QPixmap loadPixmap( QString );
166 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80; 167 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80;
167}; 168};
168 169
169 170
170#endif 171#endif