summaryrefslogtreecommitdiffabout
path: root/libkcal/sharpformat.cpp
authorzautrix <zautrix>2004-09-14 01:03:08 (UTC)
committer zautrix <zautrix>2004-09-14 01:03:08 (UTC)
commit30762fe125216362e1a6c1d5ec5d22d9525aa336 (patch) (unidiff)
tree4ff0fbf43efa921c86d64ff3f50baa9e59d207d9 /libkcal/sharpformat.cpp
parent8ce7eae438dcd20f9c79fc0a36dfef0a6d3931eb (diff)
downloadkdepimpi-30762fe125216362e1a6c1d5ec5d22d9525aa336.zip
kdepimpi-30762fe125216362e1a6c1d5ec5d22d9525aa336.tar.gz
kdepimpi-30762fe125216362e1a6c1d5ec5d22d9525aa336.tar.bz2
Many bugfixes
Diffstat (limited to 'libkcal/sharpformat.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/sharpformat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index defdb09..89eb72f 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -159,50 +159,51 @@ class SharpParser : public QObject
159 days.setBit( startDate.dayOfWeek() - 1 ); 159 days.setBit( startDate.dayOfWeek() - 1 );
160 r->addMonthlyPos( pos, days ); 160 r->addMonthlyPos( pos, days );
161 } else if ( rtype == "4" ) { 161 } else if ( rtype == "4" ) {
162 if ( hasEndDate ) 162 if ( hasEndDate )
163 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 163 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
164 else 164 else
165 r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); 165 r->setYearly( Recurrence::rYearlyMonth, freq, -1 );
166 r->addYearlyNum( startDate.month() ); 166 r->addYearlyNum( startDate.month() );
167 } 167 }
168 } else { 168 } else {
169 event->recurrence()->unsetRecurs(); 169 event->recurrence()->unsetRecurs();
170 } 170 }
171 171
172 QString categoryList = attList[1] ; 172 QString categoryList = attList[1] ;
173 event->setCategories( lookupCategories( categoryList ) ); 173 event->setCategories( lookupCategories( categoryList ) );
174 174
175 // strange 0 semms to mean: alarm enabled 175 // strange 0 semms to mean: alarm enabled
176 if ( attList[8] == "0" ) { 176 if ( attList[8] == "0" ) {
177 Alarm *alarm; 177 Alarm *alarm;
178 if ( event->alarms().count() > 0 ) 178 if ( event->alarms().count() > 0 )
179 alarm = event->alarms().first(); 179 alarm = event->alarms().first();
180 else { 180 else {
181 alarm = new Alarm( event ); 181 alarm = new Alarm( event );
182 event->addAlarm( alarm ); 182 event->addAlarm( alarm );
183 }
184 alarm->setType( Alarm::Audio ); 183 alarm->setType( Alarm::Audio );
184 }
185 //alarm->setType( Alarm::Audio );
185 alarm->setEnabled( true ); 186 alarm->setEnabled( true );
186 int alarmOffset = attList[9].toInt(); 187 int alarmOffset = attList[9].toInt();
187 alarm->setStartOffset( alarmOffset * -60 ); 188 alarm->setStartOffset( alarmOffset * -60 );
188 } else { 189 } else {
189 Alarm *alarm; 190 Alarm *alarm;
190 if ( event->alarms().count() > 0 ) { 191 if ( event->alarms().count() > 0 ) {
191 alarm = event->alarms().first(); 192 alarm = event->alarms().first();
192 alarm->setType( Alarm::Audio ); 193 alarm->setType( Alarm::Audio );
193 alarm->setStartOffset( -60*15 ); 194 alarm->setStartOffset( -60*15 );
194 alarm->setEnabled( false ); 195 alarm->setEnabled( false );
195 } 196 }
196 } 197 }
197 198
198 mCalendar->addEvent( event); 199 mCalendar->addEvent( event);
199 } else if ( qName == "Todo" ) { 200 } else if ( qName == "Todo" ) {
200 Todo *todo; 201 Todo *todo;
201 202
202 todo = existingCalendar->todo( "Sharp_DTM", attList[0] ); 203 todo = existingCalendar->todo( "Sharp_DTM", attList[0] );
203 if (todo ) 204 if (todo )
204 todo = (Todo*)todo->clone(); 205 todo = (Todo*)todo->clone();
205 else 206 else
206 todo = new Todo; 207 todo = new Todo;
207 208
208//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 209//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1
@@ -347,55 +348,55 @@ SharpFormat::~SharpFormat()
347ulong SharpFormat::getCsum( const QStringList & attList) 348ulong SharpFormat::getCsum( const QStringList & attList)
348{ 349{
349 int max = attList.count() -1; 350 int max = attList.count() -1;
350 ulong cSum = 0; 351 ulong cSum = 0;
351 int j,k,i; 352 int j,k,i;
352 int add; 353 int add;
353 for ( i = 1; i < max ; ++i ) { 354 for ( i = 1; i < max ; ++i ) {
354 QString s = attList[i]; 355 QString s = attList[i];
355 if ( ! s.isEmpty() ){ 356 if ( ! s.isEmpty() ){
356 j = s.length(); 357 j = s.length();
357 for ( k = 0; k < j; ++k ) { 358 for ( k = 0; k < j; ++k ) {
358 int mul = k +1; 359 int mul = k +1;
359 add = s[k].unicode (); 360 add = s[k].unicode ();
360 if ( k < 16 ) 361 if ( k < 16 )
361 mul = mul * mul; 362 mul = mul * mul;
362 add = add * mul *i*i*i; 363 add = add * mul *i*i*i;
363 cSum += add; 364 cSum += add;
364 } 365 }
365 } 366 }
366 } 367 }
367 return cSum; 368 return cSum;
368 369
369} 370}
370#include <stdlib.h> 371#include <stdlib.h>
371#define DEBUGMODE false 372//#define DEBUGMODE false
373#define DEBUGMODE true
372bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) 374bool SharpFormat::load( Calendar *calendar, Calendar *existngCal )
373{ 375{
374 376
375 377
376 bool debug = DEBUGMODE; 378 bool debug = DEBUGMODE;
377 //debug = true;
378 QString text; 379 QString text;
379 QString codec = "utf8"; 380 QString codec = "utf8";
380 QLabel status ( i18n("Reading events ..."), 0 ); 381 QLabel status ( i18n("Reading events ..."), 0 );
381 382
382 int w = status.sizeHint().width()+20 ; 383 int w = status.sizeHint().width()+20 ;
383 if ( w < 200 ) w = 200; 384 if ( w < 200 ) w = 200;
384 int h = status.sizeHint().height()+20 ; 385 int h = status.sizeHint().height()+20 ;
385 int dw = QApplication::desktop()->width(); 386 int dw = QApplication::desktop()->width();
386 int dh = QApplication::desktop()->height(); 387 int dh = QApplication::desktop()->height();
387 status.setCaption(i18n("Reading DTM Data") ); 388 status.setCaption(i18n("Reading DTM Data") );
388 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 389 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
389 status.show(); 390 status.show();
390 status.raise(); 391 status.raise();
391 qApp->processEvents(); 392 qApp->processEvents();
392 QString fileName; 393 QString fileName;
393 if ( ! debug ) { 394 if ( ! debug ) {
394 fileName = "/tmp/kopitempout"; 395 fileName = "/tmp/kopitempout";
395 QString command ="db2file datebook -r -c "+ codec + " > " + fileName; 396 QString command ="db2file datebook -r -c "+ codec + " > " + fileName;
396 system ( command.latin1() ); 397 system ( command.latin1() );
397 } else { 398 } else {
398 fileName = "/tmp/events.txt"; 399 fileName = "/tmp/events.txt";
399 400
400 } 401 }
401 QFile file( fileName ); 402 QFile file( fileName );