summaryrefslogtreecommitdiffabout
path: root/libkcal/phoneformat.cpp
Unidiff
Diffstat (limited to 'libkcal/phoneformat.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 3555dc6..281434e 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -287,27 +287,25 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
287#include <stdlib.h> 287#include <stdlib.h>
288#define DEBUGMODE false 288#define DEBUGMODE false
289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) 289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
290{ 290{
291 291
292 QString fileName; 292 QString fileName;
293#ifdef _WIN32_ 293#ifdef _WIN32_
294 fileName = locateLocal("tmp", "phonefile.vcs"); 294 fileName = locateLocal("tmp", "phonefile.vcs");
295#else 295#else
296 fileName = "/tmp/phonefile.vcs"; 296 fileName = "/tmp/phonefile.vcs";
297#endif 297#endif
298 QString command; 298 QString command;
299 int ret = PhoneAccess::readFromPhone( fileName ); 299 if ( ! PhoneAccess::readFromPhone( fileName )) {
300 if ( ret != 0 ) {
301 qDebug("Error::command returned %d", ret);
302 return false; 300 return false;
303 } 301 }
304 VCalFormat vfload; 302 VCalFormat vfload;
305 vfload.setLocalTime ( true ); 303 vfload.setLocalTime ( true );
306 qDebug("loading file ..."); 304 qDebug("loading file ...");
307 305
308 if ( ! vfload.load( calendar, fileName ) ) 306 if ( ! vfload.load( calendar, fileName ) )
309 return false; 307 return false;
310 QPtrList<Event> er = calendar->rawEvents(); 308 QPtrList<Event> er = calendar->rawEvents();
311 Event* ev = er.first(); 309 Event* ev = er.first();
312 qDebug("reading events... "); 310 qDebug("reading events... ");
313 while ( ev ) { 311 while ( ev ) {
@@ -478,26 +476,29 @@ void PhoneFormat::afterSave( Incidence* inc)
478} 476}
479 477
480bool PhoneFormat::writeToPhone( Calendar * calendar) 478bool PhoneFormat::writeToPhone( Calendar * calendar)
481{ 479{
482#ifdef _WIN32_ 480#ifdef _WIN32_
483 QString fileName = locateLocal("tmp", "tempfile.vcs"); 481 QString fileName = locateLocal("tmp", "tempfile.vcs");
484#else 482#else
485 QString fileName = "/tmp/kdepimtemp.vcs"; 483 QString fileName = "/tmp/kdepimtemp.vcs";
486#endif 484#endif
487 485
488 VCalFormat vfsave; 486 VCalFormat vfsave;
489 vfsave.setLocalTime ( true ); 487 vfsave.setLocalTime ( true );
488 QString id = calendar->timeZoneId();
489 calendar->setLocalTime();
490 if ( ! vfsave.save( calendar, fileName ) ) 490 if ( ! vfsave.save( calendar, fileName ) )
491 return false; 491 return false;
492 calendar->setTimeZoneId( id );
492 return PhoneAccess::writeToPhone( fileName ); 493 return PhoneAccess::writeToPhone( fileName );
493} 494}
494bool PhoneFormat::save( Calendar *calendar) 495bool PhoneFormat::save( Calendar *calendar)
495{ 496{
496 QLabel status ( i18n(" Opening device ..."), 0 ); 497 QLabel status ( i18n(" Opening device ..."), 0 );
497 int w = status.sizeHint().width()+20 ; 498 int w = status.sizeHint().width()+20 ;
498 if ( w < 200 ) w = 230; 499 if ( w < 200 ) w = 230;
499 int h = status.sizeHint().height()+20 ; 500 int h = status.sizeHint().height()+20 ;
500 int dw = QApplication::desktop()->width(); 501 int dw = QApplication::desktop()->width();
501 int dh = QApplication::desktop()->height(); 502 int dh = QApplication::desktop()->height();
502 status.setCaption(i18n("Writing to phone...") ); 503 status.setCaption(i18n("Writing to phone...") );
503 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 504 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );