summaryrefslogtreecommitdiffabout
path: root/libkcal/sharpformat.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/sharpformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/sharpformat.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index 605a54d..e8934bf 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -81,26 +81,26 @@ class SharpParser : public QObject
}
if ( skip )
return false;
ulong cSum = SharpFormat::getCsum(attList );
if ( qName == "Event" ) {
Event *event;
event = existingCalendar->event( "Sharp_DTM",attList[0].toInt() );
if ( event )
event = (Event*)event->clone();
else
event = new Event;
- event->setID("Sharp_DTM", attList[0].toInt() );
- event->setZaurusUid( cSum );
+ event->setID("Sharp_DTM", attList[0] );
+ event->setCsum( "Sharp_DTM", QString::number( cSum ));
event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
event->setSummary( attList[2] );
event->setLocation( attList[3] );
event->setDescription( attList[4] );
if ( attList[7] == "1" ) {
event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) ));
event->setDtEnd( QDateTime(fromString( attList[18]+"000000", false ).date(),QTime(0,0,0 )));
event->setFloats( true );
} else {
event->setFloats( false );
event->setDtStart( fromString( attList[5] ) );
@@ -192,26 +192,26 @@ class SharpParser : public QObject
todo = existingCalendar->todo( "Sharp_DTM", attList[0].toInt() );
if (todo )
todo = (Todo*)todo->clone();
else
todo = new Todo;
//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1
// 0 1 2 3 4 5 6 7 8
//1,,,,,1,4,Loch zumachen,""
//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
- todo->setID( "Sharp_DTM", attList[0].toInt() );
- todo->setZaurusUid( cSum );
+ todo->setID( "Sharp_DTM", attList[0]);
+ todo->setCsum( "Sharp_DTM", QString::number( cSum ));
todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
todo->setSummary( attList[7] );
todo->setDescription( attList[8]);
int priority = attList[6].toInt();
if ( priority == 0 ) priority = 3;
todo->setPriority( priority );
QString categoryList = attList[1];
todo->setCategories( lookupCategories( categoryList ) );
@@ -457,26 +457,26 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
if ( tempString.right(1) =="\n" )
tempString = tempString.left( tempString.length()-1);
templist.append( tempString );
}
++ccc;
if ( ccc == 2 && loopCount < 25 ) {
start = 0;
bool ok;
int newnum = templist[0].toInt( &ok );
if ( ok && newnum > 0) {
retval = newnum;
- inc->setID( "Sharp_DTM",newnum );
- inc->setZaurusUid( getCsum( templist ) );
+ inc->setID( "Sharp_DTM",templist[0] );
+ inc->setCsum( "Sharp_DTM", QString::number( getCsum( templist ) ));
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
}
}
//qDebug("getNumFromRecord returning : %d ", retval);
return retval;
}
bool SharpFormat::save( Calendar *calendar)
{
QLabel status ( i18n("Processing/adding events ..."), 0 );
int w = status.sizeHint().width()+20 ;
@@ -511,25 +511,25 @@ bool SharpFormat::save( Calendar *calendar)
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getEventString( ev );
if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
- else if ( ev->getID("Sharp_DTM") == -1 ) { // add new
+ else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new
command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
system ( command.utf8() );
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
@@ -597,25 +597,25 @@ bool SharpFormat::save( Calendar *calendar)
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getTodoString( to );
if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
- else if ( to->getID("Sharp_DTM") == -1 ) { // add new
+ else if ( to->getID("Sharp_DTM").isEmpty() ) { // add new
command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName;
system ( command.utf8() );
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
@@ -687,25 +687,25 @@ QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ )
date.year(), date.month(), date.day());
}
if(dt.time().isValid()){
const QTime& time = dt.time();
timestr.sprintf("T%02d%02d%02d",
time.hour(), time.minute(), time.second());
}
return datestr + timestr;
}
QString SharpFormat::getEventString( Event* event )
{
QStringList list;
- list.append( QString::number(event->getID("Sharp_DTM") ) );
+ list.append( event->getID("Sharp_DTM") );
list.append( event->categories().join(",") );
if ( !event->summary().isEmpty() )
list.append( event->summary() );
else
list.append("" );
if ( !event->location().isEmpty() )
list.append( event->location() );
else
list.append("" );
if ( !event->description().isEmpty() )
list.append( event->description() );
else
@@ -851,25 +851,25 @@ QString SharpFormat::getEventString( Event* event )
s.append('\"');
} else if(s.isEmpty() && !s.isNull()){
s = "\"\"";
}
}
return list.join(",");
}
QString SharpFormat::getTodoString( Todo* todo )
{
QStringList list;
- list.append( QString::number( todo->getID("Sharp_DTM") ) );
+ list.append( todo->getID("Sharp_DTM") );
list.append( todo->categories().join(",") );
if ( todo->hasStartDate() ) {
list.append( dtToString( todo->dtStart()) );
} else
list.append( QString() );
if ( todo->hasDueDate() ) {
QTime tim;
if ( todo->doesFloat()) {
list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ;
} else {