-rw-r--r-- | libkcal/vcalformat.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 309c699..a6ae1bc 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -57,19 +57,17 @@ VCalFormat::~VCalFormat() | |||
57 | void VCalFormat::setLocalTime ( bool b ) | 57 | void VCalFormat::setLocalTime ( bool b ) |
58 | { | 58 | { |
59 | useLocalTime = b; | 59 | useLocalTime = b; |
60 | } | 60 | } |
61 | bool VCalFormat::load(Calendar *calendar, const QString &fileName) | 61 | bool VCalFormat::load(Calendar *calendar, const QString &fileName) |
62 | { | 62 | { |
63 | mCalendar = calendar; | 63 | mCalendar = calendar; |
64 | clearException(); | 64 | clearException(); |
65 | 65 | useLocalTime = mCalendar->isLocalTime(); | |
66 | kdDebug(5800) << "VCalFormat::load() " << fileName << endl; | ||
67 | |||
68 | VObject *vcal = 0; | 66 | VObject *vcal = 0; |
69 | 67 | ||
70 | // this is not necessarily only 1 vcal. Could be many vcals, or include | 68 | // this is not necessarily only 1 vcal. Could be many vcals, or include |
71 | // a vcard... | 69 | // a vcard... |
72 | vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data())); | 70 | vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data())); |
73 | 71 | ||
74 | if (!vcal) { | 72 | if (!vcal) { |
75 | setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); | 73 | setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); |
@@ -87,21 +85,21 @@ bool VCalFormat::load(Calendar *calendar, const QString &fileName) | |||
87 | 85 | ||
88 | return true; | 86 | return true; |
89 | } | 87 | } |
90 | 88 | ||
91 | 89 | ||
92 | bool VCalFormat::save(Calendar *calendar, const QString &fileName) | 90 | bool VCalFormat::save(Calendar *calendar, const QString &fileName) |
93 | { | 91 | { |
94 | mCalendar = calendar; | 92 | mCalendar = calendar; |
93 | useLocalTime = mCalendar->isLocalTime(); | ||
95 | 94 | ||
96 | QString tmpStr; | 95 | QString tmpStr; |
97 | VObject *vcal, *vo; | 96 | VObject *vcal, *vo; |
98 | 97 | ||
99 | kdDebug(5800) << "VCalFormat::save(): " << fileName << endl; | ||
100 | 98 | ||
101 | vcal = newVObject(VCCalProp); | 99 | vcal = newVObject(VCCalProp); |
102 | 100 | ||
103 | // addPropValue(vcal,VCLocationProp, "0.0"); | 101 | // addPropValue(vcal,VCLocationProp, "0.0"); |
104 | addPropValue(vcal,VCProdIdProp, productId()); | 102 | addPropValue(vcal,VCProdIdProp, productId()); |
105 | tmpStr = mCalendar->getTimeZoneStr(); | 103 | tmpStr = mCalendar->getTimeZoneStr(); |
106 | //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); | 104 | //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); |
107 | addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); | 105 | addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); |
@@ -123,20 +121,18 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName) | |||
123 | addVObjectProp(vcal, vo); | 121 | addVObjectProp(vcal, vo); |
124 | } | 122 | } |
125 | 123 | ||
126 | writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); | 124 | writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); |
127 | cleanVObjects(vcal); | 125 | cleanVObjects(vcal); |
128 | cleanStrTbl(); | 126 | cleanStrTbl(); |
129 | 127 | ||
130 | if (QFile::exists(fileName)) { | 128 | if (QFile::exists(fileName)) { |
131 | kdDebug(5800) << "No error" << endl; | ||
132 | return true; | 129 | return true; |
133 | } else { | 130 | } else { |
134 | kdDebug(5800) << "Error" << endl; | ||
135 | return false; // error | 131 | return false; // error |
136 | } | 132 | } |
137 | } | 133 | } |
138 | 134 | ||
139 | bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | 135 | bool VCalFormat::fromString( Calendar *calendar, const QString &text ) |
140 | { | 136 | { |
141 | // TODO: Factor out VCalFormat::fromString() | 137 | // TODO: Factor out VCalFormat::fromString() |
142 | 138 | ||
@@ -156,17 +152,17 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | |||
156 | curvo = nextVObject( &i ); | 152 | curvo = nextVObject( &i ); |
157 | } while ( strcmp( vObjectName( curvo ), VCEventProp ) && | 153 | } while ( strcmp( vObjectName( curvo ), VCEventProp ) && |
158 | strcmp( vObjectName( curvo ), VCTodoProp ) ); | 154 | strcmp( vObjectName( curvo ), VCTodoProp ) ); |
159 | 155 | ||
160 | if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { | 156 | if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { |
161 | Event *event = VEventToEvent( curvo ); | 157 | Event *event = VEventToEvent( curvo ); |
162 | calendar->addEvent( event ); | 158 | calendar->addEvent( event ); |
163 | } else { | 159 | } else { |
164 | kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl; | 160 | qDebug("VCalFormat::fromString(): Unknown object type. "); |
165 | deleteVObject( vcal ); | 161 | deleteVObject( vcal ); |
166 | return false; | 162 | return false; |
167 | } | 163 | } |
168 | 164 | ||
169 | deleteVObject( vcal ); | 165 | deleteVObject( vcal ); |
170 | 166 | ||
171 | return true; | 167 | return true; |
172 | } | 168 | } |