summaryrefslogtreecommitdiffabout
path: root/libkcal/phoneformat.cpp
authorzautrix <zautrix>2004-10-15 14:26:07 (UTC)
committer zautrix <zautrix>2004-10-15 14:26:07 (UTC)
commit4f276d80bd977401d656851515474cc00c661e5b (patch) (side-by-side diff)
tree0d3a747bef0431ef791b69876f5bda554f9ca83f /libkcal/phoneformat.cpp
parentc2fb960297c4b08980921c818a4d347057732390 (diff)
downloadkdepimpi-4f276d80bd977401d656851515474cc00c661e5b.zip
kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.gz
kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.bz2
many phone and sync fixes
Diffstat (limited to 'libkcal/phoneformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp104
1 files changed, 45 insertions, 59 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 281434e..101db57 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -314,3 +314,12 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
ev->setCategories( QStringList() );
+ } else
+ if ( cat.contains( "Birthday" )) {
+ ev->setFloats( true );
+ QDate da = ev->dtStart().date();
+ ev->setDtStart( QDateTime( da) );
+ ev->setDtEnd( QDateTime( da.addDays(1)) );
+
}
+ uint cSum;
+ cSum = PhoneFormat::getCsumEvent( ev );
int id = ev->pilotId();
@@ -326,4 +335,2 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
event = ev;
- uint cSum;
- cSum = PhoneFormat::getCsumEvent( event );
event->setCsum( mProfileName, QString::number( cSum ));
@@ -344,2 +351,4 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
int id = ev->pilotId();
+ uint cSum;
+ cSum = PhoneFormat::getCsumTodo( ev );
Todo *event;
@@ -356,4 +365,2 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
event = ev;
- uint cSum;
- cSum = PhoneFormat::getCsumTodo( event );
event->setCsum( mProfileName, QString::number( cSum ));
@@ -384,7 +391,3 @@ void PhoneFormat::copyEvent( Event* to, Event* from )
b->setEnabled( a->enabled() );
- if ( a->hasStartOffset() ) {
- b->setStartOffset( a->startOffset() );
- }
- if ( a->hasTime() )
- b->setTime( a->time() );
+ b->setStartOffset(Duration( a->offset() ) );
@@ -403,4 +406,6 @@ void PhoneFormat::copyEvent( Event* to, Event* from )
to->setCategories( cat );
- Recurrence * r = new Recurrence( *from->recurrence(),to);
- to->setRecurrence( r ) ;
+ if ( from->doesRecur() ) {
+ Recurrence * r = new Recurrence( *from->recurrence(),to);
+ to->setRecurrence( r ) ;
+ }
@@ -410,6 +415,10 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
{
- if ( from->dtStart().isValid() )
+ if ( from->hasStartDate() ) {
+ to->setHasStartDate( true );
to->setDtStart( from->dtStart() );
- if ( from->dtDue().isValid() )
+ }
+ if ( from->hasDueDate() ){
+ to->setHasDueDate( true );
to->setDtDue( from->dtDue() );
+ }
if ( !from->location().isEmpty() )
@@ -426,6 +435,3 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
b->setEnabled( a->enabled() );
- if ( a->hasStartOffset() )
- b->setStartOffset( a->startOffset() );
- if ( a->hasTime() )
- b->setTime( a->time() );
+ b->setStartOffset(Duration( a->offset() ) );
}
@@ -463,12 +469,6 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
-void PhoneFormat::afterSave( Incidence* inc)
+void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
{
- uint csum;
- inc->removeID( mProfileName );
- if ( inc->type() == "Event")
- csum = PhoneFormat::getCsumEvent( (Event*) inc );
- else
- csum = PhoneFormat::getCsumTodo( (Todo*) inc );
- inc->setCsum( mProfileName, QString::number( csum ));
-
+ inc->setID( mProfileName, id );
+ inc->setCsum( mProfileName, csum);
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
@@ -480,5 +480,5 @@ bool PhoneFormat::writeToPhone( Calendar * calendar)
#ifdef _WIN32_
- QString fileName = locateLocal("tmp", "tempfile.vcs");
+ QString fileName = locateLocal("tmp", "phonefile.vcs");
#else
- QString fileName = "/tmp/kdepimtemp.vcs";
+ QString fileName = "/tmp/phonefile.vcs";
#endif
@@ -496,14 +496,3 @@ bool PhoneFormat::save( Calendar *calendar)
{
- QLabel status ( i18n(" Opening device ..."), 0 );
- int w = status.sizeHint().width()+20 ;
- if ( w < 200 ) w = 230;
- int h = status.sizeHint().height()+20 ;
- int dw = QApplication::desktop()->width();
- int dh = QApplication::desktop()->height();
- status.setCaption(i18n("Writing to phone...") );
- status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
- status.show();
- status.raise();
- qApp->processEvents();
- QString message;
+
@@ -536,3 +525,14 @@ bool PhoneFormat::save( Calendar *calendar)
return false;
-
+ QLabel status ( i18n(" Opening device ..."), 0 );
+ int w = status.sizeHint().width()+20 ;
+ if ( w < 200 ) w = 230;
+ int h = status.sizeHint().height()+20 ;
+ int dw = QApplication::desktop()->width();
+ int dh = QApplication::desktop()->height();
+ status.setCaption(i18n("Writing to phone...") );
+ status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
+ QString message;
+ status.show();
+ status.raise();
+ qApp->processEvents();
// 5 reread data
@@ -561,15 +561,7 @@ bool PhoneFormat::save( Calendar *calendar)
qApp->processEvents();
- uint csum;
- csum = PhoneFormat::getCsumEvent( ev );
- QString cSum = QString::number( csum );
- //ev->setCsum( mProfileName, cSum );
- //qDebug("Event cSum %s ", cSum.latin1());
ev1 = er1.first();
while ( ev1 ) {
- if ( ev1->getCsum( mProfileName ) == cSum ) {
+ if ( ev->contains( ev1 ) ) {
+ afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName));
er1.remove( ev1 );
- afterSave( ev );
- ev->setID(mProfileName, ev1->getID(mProfileName) );
- //qDebug("Event found on phone for %s ", ev->summary().latin1());
-
break;
@@ -596,13 +588,7 @@ bool PhoneFormat::save( Calendar *calendar)
qApp->processEvents();
- uint csum;
- csum = PhoneFormat::getCsumTodo( to );
- QString cSum = QString::number( csum );
- //to->setCsum( mProfileName, cSum );
- //qDebug("Todo cSum %s ", cSum.latin1());
Todo* to1 = tl1.first();
while ( to1 ) {
- if ( to1->getCsum( mProfileName ) == cSum ) {
+ if ( to->contains( to1 ) ) {
+ afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName));
tl1.remove( to1 );
- afterSave( to );
- to->setID(mProfileName, to1->getID(mProfileName) );
break;