summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index c0a744a..7dcf156 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -614,140 +614,145 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
614 QDataStream ds(data,IO_ReadOnly); 614 QDataStream ds(data,IO_ReadOnly);
615 QDateTime when; int warn; 615 QDateTime when; int warn;
616 ds >> when >> warn; 616 ds >> when >> warn;
617 617
618 // check to make it's okay to continue, 618 // check to make it's okay to continue,
619 // this is the case that the time was set ahead, and 619 // this is the case that the time was set ahead, and
620 // we are forced given a stale alarm... 620 // we are forced given a stale alarm...
621 QDateTime current = QDateTime::currentDateTime(); 621 QDateTime current = QDateTime::currentDateTime();
622 if ( current.time().hour() != when.time().hour() 622 if ( current.time().hour() != when.time().hour()
623 && current.time().minute() != when.time().minute() ) 623 && current.time().minute() != when.time().minute() )
624 return; 624 return;
625 625
626 QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60)); 626 QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60));
627 if ( list.count() > 0 ) { 627 if ( list.count() > 0 ) {
628 QString msg; 628 QString msg;
629 bool bSound = FALSE; 629 bool bSound = FALSE;
630 int stopTimer = 0; 630 int stopTimer = 0;
631 bool found = FALSE; 631 bool found = FALSE;
632 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 632 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
633 it!=list.end(); ++it ) { 633 it!=list.end(); ++it ) {
634 if ( (*it).event().hasAlarm() ) { 634 if ( (*it).event().hasAlarm() ) {
635 found = TRUE; 635 found = TRUE;
636 msg += "<CENTER><B>" + (*it).description() + "</B>" 636 msg += "<CENTER><B>" + (*it).description() + "</B>"
637 + "<BR>" + (*it).location() + "<BR>" 637 + "<BR>" + (*it).location() + "<BR>"
638 + TimeString::dateString((*it).event().start(),ampm) 638 + TimeString::dateString((*it).event().start(),ampm)
639 + (warn 639 + (warn
640 ? tr(" (in " + QString::number(warn) 640 ? tr(" (in " + QString::number(warn)
641 + tr(" minutes)")) 641 + tr(" minutes)"))
642 : QString("")) 642 : QString(""))
643 + "<BR>" 643 + "<BR>"
644 + (*it).notes() + "</CENTER>"; 644 + (*it).notes() + "</CENTER>";
645 if ( (*it).event().alarmSound() != Event::Silent ) { 645 if ( (*it).event().alarmSound() != Event::Silent ) {
646 bSound = TRUE; 646 bSound = TRUE;
647 } 647 }
648 } 648 }
649 } 649 }
650 if ( found ) { 650 if ( found ) {
651 if ( bSound ) { 651 if ( bSound ) {
652 Sound::soundAlarm(); 652 Sound::soundAlarm();
653 alarmCounter = 0; 653 alarmCounter = 0;
654 stopTimer = startTimer( 5000 ); 654 stopTimer = startTimer( 5000 );
655 } 655 }
656 656
657 QDialog dlg( this, 0, TRUE ); 657 QDialog dlg( this, 0, TRUE );
658 QVBoxLayout *vb = new QVBoxLayout( &dlg ); 658 QVBoxLayout *vb = new QVBoxLayout( &dlg );
659 QScrollView *view = new QScrollView( &dlg, "scrollView"); 659 QScrollView *view = new QScrollView( &dlg, "scrollView");
660 view->setResizePolicy( QScrollView::AutoOneFit ); 660 view->setResizePolicy( QScrollView::AutoOneFit );
661 vb->addWidget( view ); 661 vb->addWidget( view );
662 QLabel *lblMsg = new QLabel( msg, &dlg ); 662 QLabel *lblMsg = new QLabel( msg, &dlg );
663 view->addChild( lblMsg ); 663 view->addChild( lblMsg );
664 QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg ); 664 QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
665 connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) ); 665 connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
666 vb->addWidget( cmdOk ); 666 vb->addWidget( cmdOk );
667 667
668#if defined(Q_WS_QWS) || defined(_WS_QWS_) 668#if defined(Q_WS_QWS) || defined(_WS_QWS_)
669 dlg.showMaximized(); 669 dlg.showMaximized();
670#endif 670#endif
671 needShow = dlg.exec(); 671 needShow = dlg.exec();
672 672
673 if ( bSound ) 673 if ( bSound )
674 killTimer( stopTimer ); 674 killTimer( stopTimer );
675 } 675 }
676 } 676 }
677 } else if ( msg == "nextView()" ) { 677 } else if ( msg == "nextView()" ) {
678 QWidget* cur = views->visibleWidget(); 678 if ( !qApp-> activeWindow ( )) {
679 if ( cur ) {
680 if ( cur == dayView )
681 viewWeek();
682 else if ( cur == weekView )
683 viewWeekLst();
684 else if ( cur == weekLstView )
685 viewMonth();
686 else if ( cur == monthView )
687 viewDay();
688 needShow = TRUE; 679 needShow = TRUE;
689 } 680 }
681 else {
682 QWidget* cur = views->visibleWidget();
683 if ( cur ) {
684 if ( cur == dayView )
685 viewWeek();
686 else if ( cur == weekView )
687 viewWeekLst();
688 else if ( cur == weekLstView )
689 viewMonth();
690 else if ( cur == monthView )
691 viewDay();
692 needShow = TRUE;
693 }
694 }
690 } 695 }
691 if ( needShow ) { 696 if ( needShow ) {
692#if defined(Q_WS_QWS) || defined(_WS_QWS_) 697#if defined(Q_WS_QWS) || defined(_WS_QWS_)
693 showMaximized(); 698 showMaximized();
694#else 699#else
695 show(); 700 show();
696#endif 701#endif
697 raise(); 702 raise();
698 QPEApplication::setKeepRunning(); 703 QPEApplication::setKeepRunning();
699 setActiveWindow(); 704 setActiveWindow();
700 } 705 }
701} 706}
702 707
703void DateBook::reload() 708void DateBook::reload()
704{ 709{
705 db->reload(); 710 db->reload();
706 if ( dayAction->isOn() ) 711 if ( dayAction->isOn() )
707 viewDay(); 712 viewDay();
708 else if ( weekAction->isOn() ) 713 else if ( weekAction->isOn() )
709 viewWeek(); 714 viewWeek();
710 else if ( monthAction->isOn() ) 715 else if ( monthAction->isOn() )
711 viewMonth(); 716 viewMonth();
712 syncing = FALSE; 717 syncing = FALSE;
713} 718}
714 719
715void DateBook::flush() 720void DateBook::flush()
716{ 721{
717 syncing = TRUE; 722 syncing = TRUE;
718 db->save(); 723 db->save();
719} 724}
720 725
721void DateBook::timerEvent( QTimerEvent *e ) 726void DateBook::timerEvent( QTimerEvent *e )
722{ 727{
723 if ( alarmCounter < 10 ) { 728 if ( alarmCounter < 10 ) {
724 alarmCounter++; 729 alarmCounter++;
725 Sound::soundAlarm(); 730 Sound::soundAlarm();
726 } 731 }
727 else 732 else
728 killTimer( e->timerId() ); 733 killTimer( e->timerId() );
729} 734}
730 735
731void DateBook::changeClock( bool newClock ) 736void DateBook::changeClock( bool newClock )
732{ 737{
733 ampm = newClock; 738 ampm = newClock;
734 // repaint the affected objects... 739 // repaint the affected objects...
735 if (dayView) dayView->redraw(); 740 if (dayView) dayView->redraw();
736 if (weekView) weekView->redraw(); 741 if (weekView) weekView->redraw();
737 if (weekLstView) weekLstView->redraw(); 742 if (weekLstView) weekLstView->redraw();
738} 743}
739 744
740void DateBook::changeWeek( bool m ) 745void DateBook::changeWeek( bool m )
741{ 746{
742 /* no need to redraw, each widget catches. Do need to 747 /* no need to redraw, each widget catches. Do need to
743 store though for widgets we haven't made yet */ 748 store though for widgets we haven't made yet */
744 onMonday = m; 749 onMonday = m;
745} 750}
746 751
747void DateBook::slotToday() 752void DateBook::slotToday()
748{ 753{
749 // we need to view today using default view 754 // we need to view today using default view
750 viewDefault(QDate::currentDate()); 755 viewDefault(QDate::currentDate());
751} 756}
752 757
753void DateBook::closeEvent( QCloseEvent *e ) 758void DateBook::closeEvent( QCloseEvent *e )