summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2003-03-23 22:48:20 (UTC)
committer umopapisdn <umopapisdn>2003-03-23 22:48:20 (UTC)
commitaff270316219558bd00cbcc3ffc275213080fcd3 (patch) (unidiff)
tree00db2515fbf81a44dda904dc9b4b2e769b3fb49b
parent90772042f0d726149093675cede488676a94562b (diff)
downloadopie-aff270316219558bd00cbcc3ffc275213080fcd3.zip
opie-aff270316219558bd00cbcc3ffc275213080fcd3.tar.gz
opie-aff270316219558bd00cbcc3ffc275213080fcd3.tar.bz2
Bugfix: (bug #0000735) New events added in WeekListView are no longer defaulting to 01-01-1970.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 7dcf156..db2058b 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -763,97 +763,102 @@ void DateBook::closeEvent( QCloseEvent *e )
763 return; 763 return;
764 } 764 }
765 765
766 // save settings will generate it's own error messages, no 766 // save settings will generate it's own error messages, no
767 // need to do checking ourselves. 767 // need to do checking ourselves.
768 saveSettings(); 768 saveSettings();
769 if ( db->save() ) 769 if ( db->save() )
770 e->accept(); 770 e->accept();
771 else { 771 else {
772 if ( QMessageBox::critical( this, tr( "Out of space" ), 772 if ( QMessageBox::critical( this, tr( "Out of space" ),
773 tr("Calendar was unable to save\n" 773 tr("Calendar was unable to save\n"
774 "your changes.\n" 774 "your changes.\n"
775 "Free up some space and try again.\n" 775 "Free up some space and try again.\n"
776 "\nQuit anyway?"), 776 "\nQuit anyway?"),
777 QMessageBox::Yes|QMessageBox::Escape, 777 QMessageBox::Yes|QMessageBox::Escape,
778 QMessageBox::No|QMessageBox::Default ) 778 QMessageBox::No|QMessageBox::Default )
779 != QMessageBox::No ) 779 != QMessageBox::No )
780 e->accept(); 780 e->accept();
781 else 781 else
782 e->ignore(); 782 e->ignore();
783 } 783 }
784} 784}
785 785
786// Entering directly from the "keyboard" 786// Entering directly from the "keyboard"
787void DateBook::slotNewEventFromKey( const QString &str ) 787void DateBook::slotNewEventFromKey( const QString &str )
788{ 788{
789 if (syncing) { 789 if (syncing) {
790 QMessageBox::warning( this, tr("Calendar"), 790 QMessageBox::warning( this, tr("Calendar"),
791 tr( "Can not edit data, currently syncing") ); 791 tr( "Can not edit data, currently syncing") );
792 return; 792 return;
793 } 793 }
794 794
795 // We get to here from a key pressed in the Day View 795 // We get to here from a key pressed in the Day View
796 // So we can assume some things. We want the string 796 // So we can assume some things. We want the string
797 // passed in to be part of the description. 797 // passed in to be part of the description.
798 QDateTime start, end; 798 QDateTime start, end;
799 if ( views->visibleWidget() == dayView ) { 799 if ( views->visibleWidget() == dayView ) {
800 dayView->selectedDates( start, end ); 800 dayView->selectedDates( start, end );
801 } else if ( views->visibleWidget() == monthView ) { 801 } else if ( views->visibleWidget() == monthView ) {
802 QDate d = monthView->selectedDate(); 802 QDate d = monthView->selectedDate();
803 start = end = d; 803 start = end = d;
804 start.setTime( QTime( 10, 0 ) ); 804 start.setTime( QTime( 10, 0 ) );
805 end.setTime( QTime( 12, 0 ) ); 805 end.setTime( QTime( 12, 0 ) );
806 } else if ( views->visibleWidget() == weekView ) { 806 } else if ( views->visibleWidget() == weekView ) {
807 QDate d = weekView->date(); 807 QDate d = weekView->date();
808 start = end = d; 808 start = end = d;
809 start.setTime( QTime( 10, 0 ) ); 809 start.setTime( QTime( 10, 0 ) );
810 end.setTime( QTime( 12, 0 ) ); 810 end.setTime( QTime( 12, 0 ) );
811 } 811 } else if ( views->visibleWidget() == weekLstView ) {
812 QDate d = weekLstView->date();
813 start = end = d;
814 start.setTime( QTime( 10, 0 ) );
815 end.setTime( QTime( 12, 0 ) );
816 }
812 slotNewEntry(start, end, str); 817 slotNewEntry(start, end, str);
813} 818}
814void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) { 819void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) {
815 // argh! This really needs to be encapsulated in a class 820 // argh! This really needs to be encapsulated in a class
816 // or function. 821 // or function.
817 QDialog newDlg( this, 0, TRUE ); 822 QDialog newDlg( this, 0, TRUE );
818 newDlg.setCaption( DateEntryBase::tr("New Event") ); 823 newDlg.setCaption( DateEntryBase::tr("New Event") );
819 DateEntry *e; 824 DateEntry *e;
820 QVBoxLayout *vb = new QVBoxLayout( &newDlg ); 825 QVBoxLayout *vb = new QVBoxLayout( &newDlg );
821 QScrollView *sv = new QScrollView( &newDlg ); 826 QScrollView *sv = new QScrollView( &newDlg );
822 sv->setResizePolicy( QScrollView::AutoOneFit ); 827 sv->setResizePolicy( QScrollView::AutoOneFit );
823 sv->setFrameStyle( QFrame::NoFrame ); 828 sv->setFrameStyle( QFrame::NoFrame );
824 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 829 sv->setHScrollBarMode( QScrollView::AlwaysOff );
825 vb->addWidget( sv ); 830 vb->addWidget( sv );
826 831
827 Event ev; 832 Event ev;
828 ev.setDescription( str ); 833 ev.setDescription( str );
829 // When the new gui comes in, change this... 834 // When the new gui comes in, change this...
830 ev.setLocation( tr("(Unknown)") ); 835 ev.setLocation( tr("(Unknown)") );
831 ev.setStart( start ); 836 ev.setStart( start );
832 ev.setEnd( end ); 837 ev.setEnd( end );
833 838
834 e = new DateEntry( onMonday, ev, ampm, &newDlg ); 839 e = new DateEntry( onMonday, ev, ampm, &newDlg );
835 e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); 840 e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
836 sv->addChild( e ); 841 sv->addChild( e );
837#if defined(Q_WS_QWS) || defined(_WS_QWS_) 842#if defined(Q_WS_QWS) || defined(_WS_QWS_)
838 newDlg.showMaximized(); 843 newDlg.showMaximized();
839#endif 844#endif
840 while (newDlg.exec()) { 845 while (newDlg.exec()) {
841 ev = e->event(); 846 ev = e->event();
842 ev.assignUid(); 847 ev.assignUid();
843 QString error = checkEvent( ev ); 848 QString error = checkEvent( ev );
844 if ( !error.isNull() ) { 849 if ( !error.isNull() ) {
845 if ( QMessageBox::warning( this, tr("Error!"), 850 if ( QMessageBox::warning( this, tr("Error!"),
846 error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) 851 error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
847 continue; 852 continue;
848 } 853 }
849 db->addEvent( ev ); 854 db->addEvent( ev );
850 emit newEvent(); 855 emit newEvent();
851 break; 856 break;
852 } 857 }
853} 858}
854 859
855void DateBook::setDocument( const QString &filename ) 860void DateBook::setDocument( const QString &filename )
856{ 861{
857 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; 862 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
858 863
859 QValueList<Event> tl = Event::readVCalendar( filename ); 864 QValueList<Event> tl = Event::readVCalendar( filename );