summaryrefslogtreecommitdiff
authoreilers <eilers>2003-03-24 17:24:44 (UTC)
committer eilers <eilers>2003-03-24 17:24:44 (UTC)
commit84372ba20c0b1b09c1606212ec66c9d04588b90e (patch) (unidiff)
tree36c4d861596c80b537c765af3f0c16495a763cc6
parent38d8d91e11c191f89429f4a3da8c1ada84b2a885 (diff)
downloadopie-84372ba20c0b1b09c1606212ec66c9d04588b90e.zip
opie-84372ba20c0b1b09c1606212ec66c9d04588b90e.tar.gz
opie-84372ba20c0b1b09c1606212ec66c9d04588b90e.tar.bz2
Small anti-crash fix: Sync with QtopiaDesktop caused a big mess. But this
mess should't crash datebook. Therefore this fix prevents datebook to hang if rweekdays=="0"
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookdb.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp
index a26fe8f..0fedfa8 100644
--- a/library/datebookdb.cpp
+++ b/library/datebookdb.cpp
@@ -796,97 +796,102 @@ void DateBookDB::loadFile( const QString &strFile )
796#if 1 796#if 1
797 if ( !find ) { 797 if ( !find ) {
798 // custom field 798 // custom field
799 e.setCustomField(attr, value); 799 e.setCustomField(attr, value);
800 continue; 800 continue;
801 } 801 }
802 802
803 switch( *find ) { 803 switch( *find ) {
804 case FDescription: 804 case FDescription:
805 e.setDescription( value ); 805 e.setDescription( value );
806 break; 806 break;
807 case FLocation: 807 case FLocation:
808 e.setLocation( value ); 808 e.setLocation( value );
809 break; 809 break;
810 case FCategories: 810 case FCategories:
811 e.setCategories( Qtopia::Record::idsFromString( value ) ); 811 e.setCategories( Qtopia::Record::idsFromString( value ) );
812 break; 812 break;
813 case FUid: 813 case FUid:
814 e.setUid( value.toInt() ); 814 e.setUid( value.toInt() );
815 break; 815 break;
816 case FType: 816 case FType:
817 if ( value == "AllDay" ) 817 if ( value == "AllDay" )
818 e.setType( Event::AllDay ); 818 e.setType( Event::AllDay );
819 else 819 else
820 e.setType( Event::Normal ); 820 e.setType( Event::Normal );
821 break; 821 break;
822 case FAlarm: 822 case FAlarm:
823 alarmTime = value.toInt(); 823 alarmTime = value.toInt();
824 break; 824 break;
825 case FSound: 825 case FSound:
826 alarmSound = value == "loud" ? Event::Loud : Event::Silent; 826 alarmSound = value == "loud" ? Event::Loud : Event::Silent;
827 break; 827 break;
828 // recurrence stuff 828 // recurrence stuff
829 case FRType: 829 case FRType:
830 if ( value == "Daily" ) 830 if ( value == "Daily" )
831 rp.type = Event::Daily; 831 rp.type = Event::Daily;
832 else if ( value == "Weekly" ) 832 else if ( value == "Weekly" )
833 rp.type = Event::Weekly; 833 rp.type = Event::Weekly;
834 else if ( value == "MonthlyDay" ) 834 else if ( value == "MonthlyDay" )
835 rp.type = Event::MonthlyDay; 835 rp.type = Event::MonthlyDay;
836 else if ( value == "MonthlyDate" ) 836 else if ( value == "MonthlyDate" )
837 rp.type = Event::MonthlyDate; 837 rp.type = Event::MonthlyDate;
838 else if ( value == "Yearly" ) 838 else if ( value == "Yearly" )
839 rp.type = Event::Yearly; 839 rp.type = Event::Yearly;
840 else 840 else
841 rp.type = Event::NoRepeat; 841 rp.type = Event::NoRepeat;
842 break; 842 break;
843 case FRWeekdays: 843 case FRWeekdays:
844 rp.days = value.toInt(); 844 // QtopiaDesktop 1.6 sometimes creates 'rweekdays="0"'
845 // when it goes mad. This causes datebook to crash.. (se)
846 if ( value.toInt() != 0 )
847 rp.days = value.toInt();
848 else
849 rp.days = 1;
845 break; 850 break;
846 case FRPosition: 851 case FRPosition:
847 rp.position = value.toInt(); 852 rp.position = value.toInt();
848 break; 853 break;
849 case FRFreq: 854 case FRFreq:
850 rp.frequency = value.toInt(); 855 rp.frequency = value.toInt();
851 break; 856 break;
852 case FRHasEndDate: 857 case FRHasEndDate:
853 rp.hasEndDate = value.toInt(); 858 rp.hasEndDate = value.toInt();
854 break; 859 break;
855 case FREndDate: { 860 case FREndDate: {
856 rp.endDateUTC = (time_t) value.toLong(); 861 rp.endDateUTC = (time_t) value.toLong();
857 break; 862 break;
858 } 863 }
859 case FRStart: { 864 case FRStart: {
860 e.setStart( (time_t) value.toLong() ); 865 e.setStart( (time_t) value.toLong() );
861 break; 866 break;
862 } 867 }
863 case FREnd: { 868 case FREnd: {
864 e.setEnd( (time_t) value.toLong() ); 869 e.setEnd( (time_t) value.toLong() );
865 break; 870 break;
866 } 871 }
867 case FNote: 872 case FNote:
868 e.setNotes( value ); 873 e.setNotes( value );
869 break; 874 break;
870 case FCreated: 875 case FCreated:
871 rp.createTime = value.toInt(); 876 rp.createTime = value.toInt();
872 break; 877 break;
873 case FAction: 878 case FAction:
874 currentAction = value.toInt(); 879 currentAction = value.toInt();
875 break; 880 break;
876 case FActionKey: 881 case FActionKey:
877 journalKey = value.toInt(); 882 journalKey = value.toInt();
878 break; 883 break;
879 case FJournalOrigHadRepeat: 884 case FJournalOrigHadRepeat:
880 origHadRepeat = value.toInt(); 885 origHadRepeat = value.toInt();
881 break; 886 break;
882 default: 887 default:
883 qDebug( "huh??? missing enum? -- attr.: %s", attr ); 888 qDebug( "huh??? missing enum? -- attr.: %s", attr );
884 break; 889 break;
885 } 890 }
886#endif 891#endif
887 } 892 }
888 // "post processing" (dates, times, alarm, recurrence) 893 // "post processing" (dates, times, alarm, recurrence)
889 // start date/time 894 // start date/time
890 e.setRepeat( rp.type != Event::NoRepeat, rp ); 895 e.setRepeat( rp.type != Event::NoRepeat, rp );
891 896
892 if ( alarmTime != -1 ) 897 if ( alarmTime != -1 )