summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-15 14:26:07 (UTC)
committer zautrix <zautrix>2004-10-15 14:26:07 (UTC)
commit4f276d80bd977401d656851515474cc00c661e5b (patch) (unidiff)
tree0d3a747bef0431ef791b69876f5bda554f9ca83f
parentc2fb960297c4b08980921c818a4d347057732390 (diff)
downloadkdepimpi-4f276d80bd977401d656851515474cc00c661e5b.zip
kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.gz
kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.bz2
many phone and sync fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c20
-rw-r--r--kabc/addressee.cpp1
-rw-r--r--kabc/kabc.pro2
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--libkcal/event.cpp46
-rw-r--r--libkcal/event.h2
-rw-r--r--libkcal/phoneformat.cpp104
-rw-r--r--libkcal/phoneformat.h2
-rw-r--r--libkcal/todo.cpp58
-rw-r--r--libkcal/todo.h1
-rw-r--r--libkcal/vcalformat.cpp141
-rw-r--r--libkdepim/phoneaccess.cpp69
-rw-r--r--microkde/microkde.pro2
-rw-r--r--microkde/ofileselector_p.cpp7
14 files changed, 305 insertions, 154 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index 0375fee..7310755 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -110,9 +110,9 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
110 case GSM_CAL_CALL: 110 case GSM_CAL_CALL:
111 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); 111 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10);
112 break; 112 break;
113 case GSM_CAL_BIRTHDAY: 113 case GSM_CAL_BIRTHDAY:
114 *Length+=sprintf(Buffer+(*Length), "Special Occasion%c%c",13,10); 114 *Length+=sprintf(Buffer+(*Length), "Birthday%c%c",13,10);
115 break; 115 break;
116 case GSM_CAL_MEETING: 116 case GSM_CAL_MEETING:
117 default: 117 default:
118 *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10); 118 *Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10);
@@ -149,14 +149,14 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
149 } 149 }
150 } 150 }
151 151
152 /* Birthday is known to be recurranced */ 152 /* Birthday is known to be recurranced */
153 if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { 153 if (Recurrance != -1 ) {
154 switch(note->Entries[Recurrance].Number/24) { 154 switch(note->Entries[Recurrance].Number/24) {
155 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; 155 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break;
156 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; 156 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break;
157 case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break; 157 case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break;
158 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break; 158 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YM1 #0%c%c",13,10); break;
159 } 159 }
160 } 160 }
161 } else if (Version == Siemens_VCalendar) { 161 } else if (Version == Siemens_VCalendar) {
162 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 162 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
@@ -167,9 +167,9 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
167 case GSM_CAL_CALL: 167 case GSM_CAL_CALL:
168 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10); 168 *Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10);
169 break; 169 break;
170 case GSM_CAL_BIRTHDAY: 170 case GSM_CAL_BIRTHDAY:
171 *Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10); 171 *Length+=sprintf(Buffer+(*Length), "Birthday%c%c",13,10);
172 break; 172 break;
173 case GSM_CAL_MEMO: 173 case GSM_CAL_MEMO:
174 default: 174 default:
175 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); 175 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
@@ -187,9 +187,9 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
187 switch(note->Entries[Recurrance].Number/24) { 187 switch(note->Entries[Recurrance].Number/24) {
188 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; 188 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break;
189 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; 189 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break;
190 case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; 190 case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break;
191 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; 191 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YM1%c%c",13,10);break;
192 } 192 }
193 } 193 }
194 194
195 if (note->Type == GSM_CAL_CALL) { 195 if (note->Type == GSM_CAL_CALL) {
@@ -219,9 +219,9 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
219 case GSM_CAL_VACATION: 219 case GSM_CAL_VACATION:
220 *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); 220 *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10);
221 break; 221 break;
222 case GSM_CAL_BIRTHDAY: 222 case GSM_CAL_BIRTHDAY:
223 *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); 223 *Length+=sprintf(Buffer+(*Length), "Birthday%c%c",13,10);
224 break; 224 break;
225 case GSM_CAL_MEMO: 225 case GSM_CAL_MEMO:
226 default: 226 default:
227 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); 227 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
@@ -389,10 +389,10 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
389 if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE 389 if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE
390 if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE 390 if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE
391 if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; 391 if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO;
392 if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; 392 if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL;
393 if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY;
394 if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; 393 if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY;
394 if (strstr(Line,"CATEGORIES:Birthday")) Calendar->Type = GSM_CAL_BIRTHDAY;
395 if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; 395 if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING;
396 if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; 396 if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING;
397 if (strstr(Line,"RRULE:D1")) { 397 if (strstr(Line,"RRULE:D1")) {
398 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 398 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
@@ -419,8 +419,14 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
419 Calendar->Entries[Calendar->EntriesNum].Number = 365*24; 419 Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
420 Calendar->EntriesNum++; 420 Calendar->EntriesNum++;
421 } 421 }
422 // LR 422 // LR
423 if (strstr(Line,"RRULE:YM1")) {
424 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
425 Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
426 Calendar->EntriesNum++;
427 }
428 // LR
423 if ((ReadVCALText(Line, "SUMMARY", Buff)) ) { 429 if ((ReadVCALText(Line, "SUMMARY", Buff)) ) {
424 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; 430 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT;
425 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 431 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
426 Calendar->EntriesNum++; 432 Calendar->EntriesNum++;
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 2564894..40877ef 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -309,8 +309,9 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
310 if ( ( *phoneItAD ).contains( (*it) ) ) { 310 if ( ( *phoneItAD ).contains( (*it) ) ) {
311 found = true; 311 found = true;
312 (*it).setType( ( *phoneItAD ).type() ); 312 (*it).setType( ( *phoneItAD ).type() );
313 (*it).setNumber( ( *phoneItAD ).number() );
313 break; 314 break;
314 } 315 }
315 } 316 }
316 if ( isSubSet && ! found ) 317 if ( isSubSet && ! found )
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index d690acc..17ebff8 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -47,9 +47,8 @@ formats/vcardformatplugin2.h \
47 picture.h \ 47 picture.h \
48 secrecy.h \ 48 secrecy.h \
49 sound.h \ 49 sound.h \
50 addressbook.h \ 50 addressbook.h \
51 syncprefwidget.h \
52 timezone.h \ 51 timezone.h \
53 tmpaddressbook.h \ 52 tmpaddressbook.h \
54 addressee.h \ 53 addressee.h \
55 addresseedialog.h \ 54 addresseedialog.h \
@@ -159,9 +158,8 @@ formatfactory.cpp \
159 picture.cpp \ 158 picture.cpp \
160 secrecy.cpp \ 159 secrecy.cpp \
161 sound.cpp \ 160 sound.cpp \
162 addressbook.cpp \ 161 addressbook.cpp \
163 syncprefwidget.cpp \
164 timezone.cpp \ 162 timezone.cpp \
165 tmpaddressbook.cpp \ 163 tmpaddressbook.cpp \
166 addressee.cpp \ 164 addressee.cpp \
167 addresseelist.cpp \ 165 addresseelist.cpp \
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3e0a27d..e4a11f5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1129,10 +1129,12 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1129 } 1129 }
1130 inL = el.next(); 1130 inL = el.next();
1131 } 1131 }
1132 int delFut = 0; 1132 int delFut = 0;
1133 int remRem = 0;
1133 if ( mSyncManager->mWriteBackInFuture ) { 1134 if ( mSyncManager->mWriteBackInFuture ) {
1134 er = remote->rawIncidences(); 1135 er = remote->rawIncidences();
1136 remRem = er.count();
1135 inR = er.first(); 1137 inR = er.first();
1136 QDateTime dt; 1138 QDateTime dt;
1137 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1139 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1138 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1140 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
@@ -1174,9 +1176,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1174 QString mes; 1176 QString mes;
1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1177 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1176 QString delmess; 1178 QString delmess;
1177 if ( delFut ) { 1179 if ( delFut ) {
1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, mSyncManager->mWriteBackInFuture ); 1180 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1179 mes += delmess; 1181 mes += delmess;
1180 } 1182 }
1181 if ( mSyncManager->mShowSyncSummary ) { 1183 if ( mSyncManager->mShowSyncSummary ) {
1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1184 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index dfa265b..7256f05 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -55,8 +55,54 @@ bool KCal::operator==( const Event& e1, const Event& e2 )
55 e1.transparency() == e2.transparency(); 55 e1.transparency() == e2.transparency();
56} 56}
57 57
58 58
59bool Event::contains ( Event* from )
60{
61
62 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() ))
64 return false;
65 if ( from->dtStart().isValid() )
66 if (dtStart() != from->dtStart() )
67 return false;
68 if ( from->dtEnd().isValid() )
69 if ( dtEnd() != from->dtEnd() )
70 return false;
71 if ( !from->location().isEmpty() )
72 if ( !location().startsWith( from->location() ) )
73 return false;
74 if ( !from->description().isEmpty() )
75 if ( !description().startsWith( from->description() ))
76 return false;
77 if ( from->alarms().count() ) {
78 Alarm *a = from->alarms().first();
79 if ( a->enabled() ){
80 if ( !alarms().count() )
81 return false;
82 Alarm *b = alarms().first();
83 if( ! b->enabled() )
84 return false;
85 if ( ! (a->offset() == b->offset() ))
86 return false;
87 }
88 }
89 QStringList cat = categories();
90 QStringList catFrom = from->categories();
91 QString nCat;
92 int iii;
93 for ( iii = 0; iii < catFrom.count();++iii ) {
94 nCat = catFrom[iii];
95 if ( !nCat.isEmpty() )
96 if ( !cat.contains( nCat )) {
97 return false;
98 }
99 }
100 if ( from->doesRecur() )
101 if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) )
102 return false;
103 return true;
104}
59 105
60void Event::setDtEnd(const QDateTime &dtEnd) 106void Event::setDtEnd(const QDateTime &dtEnd)
61{ 107{
62 if (mReadOnly) return; 108 if (mReadOnly) return;
diff --git a/libkcal/event.h b/libkcal/event.h
index 2a8bd95..3bc8adc 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -70,8 +70,10 @@ class Event : public Incidence
70 Transparency transparency() const; 70 Transparency transparency() const;
71 71
72 void setDuration(int seconds); 72 void setDuration(int seconds);
73 73
74 bool contains ( Event*);
75
74 private: 76 private:
75 bool accept(Visitor &v) { return v.visit(this); } 77 bool accept(Visitor &v) { return v.visit(this); }
76 78
77 QDateTime mDtEnd; 79 QDateTime mDtEnd;
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 281434e..101db57 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -311,9 +311,18 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
311 while ( ev ) { 311 while ( ev ) {
312 QStringList cat = ev->categories(); 312 QStringList cat = ev->categories();
313 if ( cat.contains( "MeetingDEF" )) { 313 if ( cat.contains( "MeetingDEF" )) {
314 ev->setCategories( QStringList() ); 314 ev->setCategories( QStringList() );
315 } else
316 if ( cat.contains( "Birthday" )) {
317 ev->setFloats( true );
318 QDate da = ev->dtStart().date();
319 ev->setDtStart( QDateTime( da) );
320 ev->setDtEnd( QDateTime( da.addDays(1)) );
321
315 } 322 }
323 uint cSum;
324 cSum = PhoneFormat::getCsumEvent( ev );
316 int id = ev->pilotId(); 325 int id = ev->pilotId();
317 Event *event; 326 Event *event;
318 event = existingCal->event( mProfileName ,QString::number( id ) ); 327 event = existingCal->event( mProfileName ,QString::number( id ) );
319 if ( event ) { 328 if ( event ) {
@@ -323,10 +332,8 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
323 calendar->addEvent( event); 332 calendar->addEvent( event);
324 } 333 }
325 else 334 else
326 event = ev; 335 event = ev;
327 uint cSum;
328 cSum = PhoneFormat::getCsumEvent( event );
329 event->setCsum( mProfileName, QString::number( cSum )); 336 event->setCsum( mProfileName, QString::number( cSum ));
330 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 337 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
331 event->setID( mProfileName,QString::number( id ) ); 338 event->setID( mProfileName,QString::number( id ) );
332 ev = er.next(); 339 ev = er.next();
@@ -341,8 +348,10 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
341 if ( cat.contains( "MeetingDEF" )) { 348 if ( cat.contains( "MeetingDEF" )) {
342 ev->setCategories( QStringList() ); 349 ev->setCategories( QStringList() );
343 } 350 }
344 int id = ev->pilotId(); 351 int id = ev->pilotId();
352 uint cSum;
353 cSum = PhoneFormat::getCsumTodo( ev );
345 Todo *event; 354 Todo *event;
346 event = existingCal->todo( mProfileName ,QString::number( id ) ); 355 event = existingCal->todo( mProfileName ,QString::number( id ) );
347 if ( event ) { 356 if ( event ) {
348 //qDebug("copy todo %s ", event->summary().latin1()); 357 //qDebug("copy todo %s ", event->summary().latin1());
@@ -353,10 +362,8 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
353 calendar->addTodo( event); 362 calendar->addTodo( event);
354 } 363 }
355 else 364 else
356 event = ev; 365 event = ev;
357 uint cSum;
358 cSum = PhoneFormat::getCsumTodo( event );
359 event->setCsum( mProfileName, QString::number( cSum )); 366 event->setCsum( mProfileName, QString::number( cSum ));
360 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 367 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
361 event->setID( mProfileName,QString::number( id ) ); 368 event->setID( mProfileName,QString::number( id ) );
362 ev = tr.next(); 369 ev = tr.next();
@@ -381,13 +388,9 @@ void PhoneFormat::copyEvent( Event* to, Event* from )
381 to->clearAlarms(); 388 to->clearAlarms();
382 Alarm *a = from->alarms().first(); 389 Alarm *a = from->alarms().first();
383 Alarm *b = to->newAlarm( ); 390 Alarm *b = to->newAlarm( );
384 b->setEnabled( a->enabled() ); 391 b->setEnabled( a->enabled() );
385 if ( a->hasStartOffset() ) { 392 b->setStartOffset(Duration( a->offset() ) );
386 b->setStartOffset( a->startOffset() );
387 }
388 if ( a->hasTime() )
389 b->setTime( a->time() );
390 393
391 } 394 }
392 QStringList cat = to->categories(); 395 QStringList cat = to->categories();
393 QStringList catFrom = from->categories(); 396 QStringList catFrom = from->categories();
@@ -400,19 +403,25 @@ void PhoneFormat::copyEvent( Event* to, Event* from )
400 cat << nCat; 403 cat << nCat;
401 } 404 }
402 } 405 }
403 to->setCategories( cat ); 406 to->setCategories( cat );
404 Recurrence * r = new Recurrence( *from->recurrence(),to); 407 if ( from->doesRecur() ) {
405 to->setRecurrence( r ) ; 408 Recurrence * r = new Recurrence( *from->recurrence(),to);
409 to->setRecurrence( r ) ;
410 }
406 411
407 412
408} 413}
409void PhoneFormat::copyTodo( Todo* to, Todo* from ) 414void PhoneFormat::copyTodo( Todo* to, Todo* from )
410{ 415{
411 if ( from->dtStart().isValid() ) 416 if ( from->hasStartDate() ) {
417 to->setHasStartDate( true );
412 to->setDtStart( from->dtStart() ); 418 to->setDtStart( from->dtStart() );
413 if ( from->dtDue().isValid() ) 419 }
420 if ( from->hasDueDate() ){
421 to->setHasDueDate( true );
414 to->setDtDue( from->dtDue() ); 422 to->setDtDue( from->dtDue() );
423 }
415 if ( !from->location().isEmpty() ) 424 if ( !from->location().isEmpty() )
416 to->setLocation( from->location() ); 425 to->setLocation( from->location() );
417 if ( !from->description().isEmpty() ) 426 if ( !from->description().isEmpty() )
418 to->setDescription( from->description() ); 427 to->setDescription( from->description() );
@@ -423,12 +432,9 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
423 to->clearAlarms(); 432 to->clearAlarms();
424 Alarm *a = from->alarms().first(); 433 Alarm *a = from->alarms().first();
425 Alarm *b = to->newAlarm( ); 434 Alarm *b = to->newAlarm( );
426 b->setEnabled( a->enabled() ); 435 b->setEnabled( a->enabled() );
427 if ( a->hasStartOffset() ) 436 b->setStartOffset(Duration( a->offset() ) );
428 b->setStartOffset( a->startOffset() );
429 if ( a->hasTime() )
430 b->setTime( a->time() );
431 } 437 }
432 438
433 QStringList cat = to->categories(); 439 QStringList cat = to->categories();
434 QStringList catFrom = from->categories(); 440 QStringList catFrom = from->categories();
@@ -460,28 +466,22 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
460 466
461} 467}
462#include <qcstring.h> 468#include <qcstring.h>
463 469
464void PhoneFormat::afterSave( Incidence* inc) 470void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
465{ 471{
466 uint csum; 472 inc->setID( mProfileName, id );
467 inc->removeID( mProfileName ); 473 inc->setCsum( mProfileName, csum);
468 if ( inc->type() == "Event")
469 csum = PhoneFormat::getCsumEvent( (Event*) inc );
470 else
471 csum = PhoneFormat::getCsumTodo( (Todo*) inc );
472 inc->setCsum( mProfileName, QString::number( csum ));
473
474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
475 475
476} 476}
477 477
478bool PhoneFormat::writeToPhone( Calendar * calendar) 478bool PhoneFormat::writeToPhone( Calendar * calendar)
479{ 479{
480#ifdef _WIN32_ 480#ifdef _WIN32_
481 QString fileName = locateLocal("tmp", "tempfile.vcs"); 481 QString fileName = locateLocal("tmp", "phonefile.vcs");
482#else 482#else
483 QString fileName = "/tmp/kdepimtemp.vcs"; 483 QString fileName = "/tmp/phonefile.vcs";
484#endif 484#endif
485 485
486 VCalFormat vfsave; 486 VCalFormat vfsave;
487 vfsave.setLocalTime ( true ); 487 vfsave.setLocalTime ( true );
@@ -493,20 +493,9 @@ bool PhoneFormat::writeToPhone( Calendar * calendar)
493 return PhoneAccess::writeToPhone( fileName ); 493 return PhoneAccess::writeToPhone( fileName );
494} 494}
495bool PhoneFormat::save( Calendar *calendar) 495bool PhoneFormat::save( Calendar *calendar)
496{ 496{
497 QLabel status ( i18n(" Opening device ..."), 0 ); 497
498 int w = status.sizeHint().width()+20 ;
499 if ( w < 200 ) w = 230;
500 int h = status.sizeHint().height()+20 ;
501 int dw = QApplication::desktop()->width();
502 int dh = QApplication::desktop()->height();
503 status.setCaption(i18n("Writing to phone...") );
504 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
505 status.show();
506 status.raise();
507 qApp->processEvents();
508 QString message;
509 498
510 // 1 remove events which should be deleted 499 // 1 remove events which should be deleted
511 QPtrList<Event> er = calendar->rawEvents(); 500 QPtrList<Event> er = calendar->rawEvents();
512 Event* ev = er.first(); 501 Event* ev = er.first();
@@ -533,9 +522,20 @@ bool PhoneFormat::save( Calendar *calendar)
533 } 522 }
534 // 3 save file 523 // 3 save file
535 if ( !writeToPhone( calendar ) ) 524 if ( !writeToPhone( calendar ) )
536 return false; 525 return false;
537 526 QLabel status ( i18n(" Opening device ..."), 0 );
527 int w = status.sizeHint().width()+20 ;
528 if ( w < 200 ) w = 230;
529 int h = status.sizeHint().height()+20 ;
530 int dw = QApplication::desktop()->width();
531 int dh = QApplication::desktop()->height();
532 status.setCaption(i18n("Writing to phone...") );
533 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
534 QString message;
535 status.show();
536 status.raise();
537 qApp->processEvents();
538 // 5 reread data 538 // 5 reread data
539 message = i18n(" Rereading all data ... "); 539 message = i18n(" Rereading all data ... ");
540 status.setText ( message ); 540 status.setText ( message );
541 qApp->processEvents(); 541 qApp->processEvents();
@@ -558,21 +558,13 @@ bool PhoneFormat::save( Calendar *calendar)
558 while ( ev ) { 558 while ( ev ) {
559 //qDebug("event new ID %s",ev->summary().latin1()); 559 //qDebug("event new ID %s",ev->summary().latin1());
560 status.setText ( message + QString::number ( ++procCount ) ); 560 status.setText ( message + QString::number ( ++procCount ) );
561 qApp->processEvents(); 561 qApp->processEvents();
562 uint csum;
563 csum = PhoneFormat::getCsumEvent( ev );
564 QString cSum = QString::number( csum );
565 //ev->setCsum( mProfileName, cSum );
566 //qDebug("Event cSum %s ", cSum.latin1());
567 ev1 = er1.first(); 562 ev1 = er1.first();
568 while ( ev1 ) { 563 while ( ev1 ) {
569 if ( ev1->getCsum( mProfileName ) == cSum ) { 564 if ( ev->contains( ev1 ) ) {
565 afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName));
570 er1.remove( ev1 ); 566 er1.remove( ev1 );
571 afterSave( ev );
572 ev->setID(mProfileName, ev1->getID(mProfileName) );
573 //qDebug("Event found on phone for %s ", ev->summary().latin1());
574
575 break; 567 break;
576 } 568 }
577 ev1 = er1.next(); 569 ev1 = er1.next();
578 } 570 }
@@ -593,19 +585,13 @@ bool PhoneFormat::save( Calendar *calendar)
593 message = i18n(" Comparing todo # "); 585 message = i18n(" Comparing todo # ");
594 while ( to ) { 586 while ( to ) {
595 status.setText ( message + QString::number ( ++procCount ) ); 587 status.setText ( message + QString::number ( ++procCount ) );
596 qApp->processEvents(); 588 qApp->processEvents();
597 uint csum;
598 csum = PhoneFormat::getCsumTodo( to );
599 QString cSum = QString::number( csum );
600 //to->setCsum( mProfileName, cSum );
601 //qDebug("Todo cSum %s ", cSum.latin1());
602 Todo* to1 = tl1.first(); 589 Todo* to1 = tl1.first();
603 while ( to1 ) { 590 while ( to1 ) {
604 if ( to1->getCsum( mProfileName ) == cSum ) { 591 if ( to->contains( to1 ) ) {
592 afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName));
605 tl1.remove( to1 ); 593 tl1.remove( to1 );
606 afterSave( to );
607 to->setID(mProfileName, to1->getID(mProfileName) );
608 break; 594 break;
609 } 595 }
610 to1 = tl1.next(); 596 to1 = tl1.next();
611 } 597 }
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h
index 001fd81..d11f68b 100644
--- a/libkcal/phoneformat.h
+++ b/libkcal/phoneformat.h
@@ -53,9 +53,9 @@ class PhoneFormat : public QObject {
53 void copyEvent( Event* to, Event* from ); 53 void copyEvent( Event* to, Event* from );
54 void copyTodo( Todo* to, Todo* from ); 54 void copyTodo( Todo* to, Todo* from );
55 //int initDevice(GSM_StateMachine *s); 55 //int initDevice(GSM_StateMachine *s);
56 QString mProfileName; 56 QString mProfileName;
57 void afterSave( Incidence* ); 57 void afterSave( Incidence* ,const QString&,const QString&);
58}; 58};
59 59
60} 60}
61 61
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 0c1e3e4..3d2de61 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -55,9 +55,67 @@ Incidence *Todo::clone()
55{ 55{
56 return new Todo(*this); 56 return new Todo(*this);
57} 57}
58 58
59bool Todo::contains ( Todo* from )
60{
59 61
62 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() ))
64 return false;
65 if ( from->hasStartDate() ) {
66 if ( !hasStartDate() )
67 return false;
68 if ( from->dtStart() != dtStart())
69 return false;
70 }
71 if ( from->hasDueDate() ){
72 if ( !hasDueDate() )
73 return false;
74 if ( from->dtDue() != dtDue())
75 return false;
76 }
77 if ( !from->location().isEmpty() )
78 if ( !location().startsWith( from->location() ) )
79 return false;
80 if ( !from->description().isEmpty() )
81 if ( !description().startsWith( from->description() ))
82 return false;
83 if ( from->alarms().count() ) {
84 Alarm *a = from->alarms().first();
85 if ( a->enabled() ){
86 if ( !alarms().count() )
87 return false;
88 Alarm *b = alarms().first();
89 if( ! b->enabled() )
90 return false;
91 if ( ! (a->offset() == b->offset() ))
92 return false;
93 }
94 }
95
96 QStringList cat = categories();
97 QStringList catFrom = from->categories();
98 QString nCat;
99 int iii;
100 for ( iii = 0; iii < catFrom.count();++iii ) {
101 nCat = catFrom[iii];
102 if ( !nCat.isEmpty() )
103 if ( !cat.contains( nCat )) {
104 return false;
105 }
106 }
107 if ( from->isCompleted() ) {
108 if ( !isCompleted() )
109 return false;
110 }
111 if( priority() != from->priority() )
112 return false;
113
114
115 return true;
116
117}
60bool KCal::operator==( const Todo& t1, const Todo& t2 ) 118bool KCal::operator==( const Todo& t1, const Todo& t2 )
61{ 119{
62 120
63 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 121 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 9aa92f8..0f22c59 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -98,8 +98,9 @@ class Todo : public Incidence
98 void setCompleted(const QDateTime &completed); 98 void setCompleted(const QDateTime &completed);
99 99
100 /** Return true, if todo has a date associated with completion */ 100 /** Return true, if todo has a date associated with completion */
101 bool hasCompletedDate() const; 101 bool hasCompletedDate() const;
102 bool contains ( Todo*);
102 103
103 private: 104 private:
104 bool accept(Visitor &v) { return v.visit(this); } 105 bool accept(Visitor &v) { return v.visit(this); }
105 106
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index a6ae1bc..df93209 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -61,9 +61,10 @@ void VCalFormat::setLocalTime ( bool b )
61bool VCalFormat::load(Calendar *calendar, const QString &fileName) 61bool VCalFormat::load(Calendar *calendar, const QString &fileName)
62{ 62{
63 mCalendar = calendar; 63 mCalendar = calendar;
64 clearException(); 64 clearException();
65 useLocalTime = mCalendar->isLocalTime(); 65 if ( ! useLocalTime )
66 useLocalTime = mCalendar->isLocalTime();
66 VObject *vcal = 0; 67 VObject *vcal = 0;
67 68
68 // this is not necessarily only 1 vcal. Could be many vcals, or include 69 // this is not necessarily only 1 vcal. Could be many vcals, or include
69 // a vcard... 70 // a vcard...
@@ -89,9 +90,10 @@ bool VCalFormat::load(Calendar *calendar, const QString &fileName)
89 90
90bool VCalFormat::save(Calendar *calendar, const QString &fileName) 91bool VCalFormat::save(Calendar *calendar, const QString &fileName)
91{ 92{
92 mCalendar = calendar; 93 mCalendar = calendar;
93 useLocalTime = mCalendar->isLocalTime(); 94 if ( ! useLocalTime )
95 useLocalTime = mCalendar->isLocalTime();
94 96
95 QString tmpStr; 97 QString tmpStr;
96 VObject *vcal, *vo; 98 VObject *vcal, *vo;
97 99
@@ -1171,74 +1173,78 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
1171 } 1173 }
1172 1174
1173 /*********************** YEARLY-BY-MONTH *******************************/ 1175 /*********************** YEARLY-BY-MONTH *******************************/
1174 else if (tmpStr.left(2) == "YM") { 1176 else if (tmpStr.left(2) == "YM") {
1175 int index = tmpStr.find(' '); 1177 // we have to set this such that recurrence accepts addYearlyNum(tmpDay);
1176 int last = tmpStr.findRev(' ') + 1; 1178 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, 1, -1);
1177 int rFreq = tmpStr.mid(2, (index-1)).toInt(); 1179 int index = tmpStr.find(' ');
1178 index += 1; 1180 int last = tmpStr.findRev(' ') + 1;
1179 short tmpMonth; 1181 int rFreq = tmpStr.mid(2, (index-1)).toInt();
1180 if( index == last ) { 1182 index += 1;
1181 // e.g. YM1 #0 1183 short tmpMonth;
1182 tmpMonth = anEvent->dtStart().date().month(); 1184 if( index == last ) {
1183 anEvent->recurrence()->addYearlyNum(tmpMonth); 1185 // e.g. YM1 #0
1184 } 1186 tmpMonth = anEvent->dtStart().date().month();
1185 else { 1187 anEvent->recurrence()->addYearlyNum(tmpMonth);
1186 // e.g. YM1 3 #0 1188 }
1187 while (index < last) { 1189 else {
1188 int index2 = tmpStr.find(' ', index); 1190 // e.g. YM1 3 #0
1189 tmpMonth = tmpStr.mid(index, (index2-index)).toShort(); 1191 while (index < last) {
1190 index = index2+1; 1192 int index2 = tmpStr.find(' ', index);
1191 anEvent->recurrence()->addYearlyNum(tmpMonth); 1193 tmpMonth = tmpStr.mid(index, (index2-index)).toShort();
1192 } // while != # 1194 index = index2+1;
1193 } 1195 anEvent->recurrence()->addYearlyNum(tmpMonth);
1194 index = last; if (tmpStr.mid(index,1) == "#") index++; 1196 } // while != #
1195 if (tmpStr.find('T', index) != -1) { 1197 }
1196 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); 1198 index = last; if (tmpStr.mid(index,1) == "#") index++;
1197 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rEndDate); 1199 if (tmpStr.find('T', index) != -1) {
1198 } else { 1200 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date();
1199 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); 1201 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rEndDate);
1200 if (rDuration == 0) 1202 } else {
1201 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, -1); 1203 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt();
1202 else 1204 if (rDuration == 0)
1203 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rDuration); 1205 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, -1);
1204 } 1206 else
1207 anEvent->recurrence()->setYearly(Recurrence::rYearlyMonth, rFreq, rDuration);
1208 }
1205 } 1209 }
1206 1210
1207 /*********************** YEARLY-BY-DAY *********************************/ 1211 /*********************** YEARLY-BY-DAY *********************************/
1208 else if (tmpStr.left(2) == "YD") { 1212 else if (tmpStr.left(2) == "YD") {
1209 int index = tmpStr.find(' '); 1213 // we have to set this such that recurrence accepts addYearlyNum(tmpDay);
1210 int last = tmpStr.findRev(' ') + 1; 1214 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, 1, -1);
1211 int rFreq = tmpStr.mid(2, (index-1)).toInt(); 1215 int index = tmpStr.find(' ');
1212 index += 1; 1216 int last = tmpStr.findRev(' ') + 1;
1213 short tmpDay; 1217 int rFreq = tmpStr.mid(2, (index-1)).toInt();
1214 if( index == last ) { 1218 index += 1;
1215 // e.g. YD1 #0 1219 short tmpDay;
1216 tmpDay = anEvent->dtStart().date().dayOfYear(); 1220 if( index == last ) {
1217 anEvent->recurrence()->addYearlyNum(tmpDay); 1221 // e.g. YD1 #0
1218 } 1222 tmpDay = anEvent->dtStart().date().dayOfYear();
1219 else { 1223 anEvent->recurrence()->addYearlyNum(tmpDay);
1220 // e.g. YD1 123 #0 1224 }
1221 while (index < last) { 1225 else {
1222 int index2 = tmpStr.find(' ', index); 1226 // e.g. YD1 123 #0
1223 tmpDay = tmpStr.mid(index, (index2-index)).toShort(); 1227 while (index < last) {
1224 index = index2+1; 1228 int index2 = tmpStr.find(' ', index);
1225 anEvent->recurrence()->addYearlyNum(tmpDay); 1229 tmpDay = tmpStr.mid(index, (index2-index)).toShort();
1226 } // while != # 1230 index = index2+1;
1227 } 1231 anEvent->recurrence()->addYearlyNum(tmpDay);
1228 index = last; if (tmpStr.mid(index,1) == "#") index++; 1232 } // while != #
1229 if (tmpStr.find('T', index) != -1) { 1233 }
1230 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); 1234 index = last; if (tmpStr.mid(index,1) == "#") index++;
1231 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rEndDate); 1235 if (tmpStr.find('T', index) != -1) {
1232 } else { 1236 QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date();
1233 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); 1237 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rEndDate);
1234 if (rDuration == 0) 1238 } else {
1235 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, -1); 1239 int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt();
1236 else 1240 if (rDuration == 0)
1237 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rDuration); 1241 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, -1);
1238 } 1242 else
1243 anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rDuration);
1244 }
1239 } else { 1245 } else {
1240 kdDebug(5800) << "we don't understand this type of recurrence!" << endl; 1246 kdDebug(5800) << "we don't understand this type of recurrence!" << endl;
1241 } // if 1247 } // if
1242 } // repeats 1248 } // repeats
1243 1249
1244 1250
@@ -1535,14 +1541,15 @@ void VCalFormat::populate(VObject *vcal)
1535 } 1541 }
1536 1542
1537 // set the time zone 1543 // set the time zone
1538 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { 1544 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) {
1539 char *s = fakeCString(vObjectUStringZValue(curVO)); 1545 if ( vObjectUStringZValue(curVO) != 0 ) {
1540 mCalendar->setTimeZone(s); 1546 char *s = fakeCString(vObjectUStringZValue(curVO));
1541 deleteStr(s); 1547 mCalendar->setTimeZone(s);
1548 deleteStr(s);
1549 }
1542 } 1550 }
1543 1551
1544
1545 // Store all events with a relatedTo property in a list for post-processing 1552 // Store all events with a relatedTo property in a list for post-processing
1546 mEventsRelate.clear(); 1553 mEventsRelate.clear();
1547 mTodosRelate.clear(); 1554 mTodosRelate.clear();
1548 1555
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index 8298aa6..e24ad9e 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -24,8 +24,9 @@
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qlabel.h>
28#include <qtextstream.h> 29#include <qtextstream.h>
29#include <qtextcodec.h> 30#include <qtextcodec.h>
30#include <qdir.h> 31#include <qdir.h>
31#include <kmessagebox.h> 32#include <kmessagebox.h>
@@ -138,15 +139,35 @@ bool PhoneAccess::writeToPhone( QString fileName)
138#endif 139#endif
139#else 140#else
140 QString command ="kammu --restore " + fileName ; 141 QString command ="kammu --restore " + fileName ;
141#endif 142#endif
142 int ret; 143 int ret = 1;
143 while ( (ret = system ( command.latin1())) != 0 ) { 144 while ( ret != 0 ) {
144 qDebug("Error S::command returned %d.", ret); 145 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
145 int retval = KMessageBox::warningContinueCancel(0, 146 int w = 235;
146 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 147 int h = status->sizeHint().height()+20 ;
147 if ( retval != KMessageBox::Continue ) 148 int dw = QApplication::desktop()->width();
148 return false; 149 int dh = QApplication::desktop()->height();
150 if ( dw > 310 )
151 w = 310;
152 status->setCaption(i18n("Writing to phone...") );
153 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
154 status->show();
155 status->raise();
156 status->update();
157 qApp->processEvents();
158 status->update();
159 qApp->processEvents();
160 ret = system ( command.latin1());
161 delete status;
162 qApp->processEvents();
163 if ( ret ) {
164 qDebug("Error S::command returned %d.", ret);
165 int retval = KMessageBox::warningContinueCancel(0,
166 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
167 if ( retval != KMessageBox::Continue )
168 return false;
169 }
149 } 170 }
150 return true; 171 return true;
151} 172}
152bool PhoneAccess::readFromPhone( QString fileName) 173bool PhoneAccess::readFromPhone( QString fileName)
@@ -161,13 +182,35 @@ bool PhoneAccess::readFromPhone( QString fileName)
161#else 182#else
162 QString command ="kammu --backup " + fileName + " -yes" ; 183 QString command ="kammu --backup " + fileName + " -yes" ;
163#endif 184#endif
164 int ret; 185 int ret;
165 while ( (ret = system ( command.latin1())) != 0 ) { 186 while ( ret != 0 ) {
166 qDebug("Error reading from phone:Command returned %d", ret); 187 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
167 int retval = KMessageBox::warningContinueCancel(0, 188 int w = 235;
168 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 189 int h = status->sizeHint().height()+20 ;
169 if ( retval != KMessageBox::Continue ) 190 int dw = QApplication::desktop()->width();
170 return false; 191 int dh = QApplication::desktop()->height();
192 if ( dw > 310 )
193 w = 310;
194 status->setCaption(i18n("Reading from phone...") );
195 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
196 status->show();
197 status->raise();
198 status->update();
199 qApp->processEvents();
200 status->update();
201 qApp->processEvents();
202 ret = system ( command.latin1() );
203 delete status;
204 qApp->processEvents();
205 if ( ret ) {
206 qDebug("Error reading from phone:Command returned %d", ret);
207 int retval = KMessageBox::warningContinueCancel(0,
208 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
209 if ( retval != KMessageBox::Continue )
210 return false;
211
212 }
171 } 213 }
214 qApp->processEvents();
172 return true; 215 return true;
173} 216}
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 71d662b..21da158 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -80,9 +80,8 @@ KDGanttMinimizeSplitter.h \
80 kresources/configpage.h \ 80 kresources/configpage.h \
81 kresources/configwidget.h \ 81 kresources/configwidget.h \
82 kresources/configdialog.h \ 82 kresources/configdialog.h \
83 kresources/kcmkresources.h \ 83 kresources/kcmkresources.h \
84 kresources/syncwidget.h \
85 kdecore/kmdcodec.h \ 84 kdecore/kmdcodec.h \
86 kdecore/kconfigbase.h \ 85 kdecore/kconfigbase.h \
87 kdecore/klocale.h \ 86 kdecore/klocale.h \
88 kdecore/kcatalogue.h \ 87 kdecore/kcatalogue.h \
@@ -159,9 +158,8 @@ KDGanttMinimizeSplitter.cpp \
159 kresources/kcmkresources.cpp \ 158 kresources/kcmkresources.cpp \
160 kresources/managerimpl.cpp \ 159 kresources/managerimpl.cpp \
161 kresources/resource.cpp \ 160 kresources/resource.cpp \
162 kresources/selectdialog.cpp \ 161 kresources/selectdialog.cpp \
163 kresources/syncwidget.cpp \
164 kutils/kcmultidialog.cpp \ 162 kutils/kcmultidialog.cpp \
165 kdeui/kaction.cpp \ 163 kdeui/kaction.cpp \
166 kdeui/kactionclasses.cpp \ 164 kdeui/kactionclasses.cpp \
167 kdeui/kactioncollection.cpp \ 165 kdeui/kactioncollection.cpp \
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index cf6074d..fd5f965 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -19,8 +19,10 @@
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/mimetype.h> 20#include <qpe/mimetype.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/storage.h> 22#include <qpe/storage.h>
23#include <kglobal.h>
24#include <klocale.h>
23 25
24#include "ofileselector_p.h" 26#include "ofileselector_p.h"
25//US#include "ofileselector.h" 27//US#include "ofileselector.h"
26 28
@@ -466,9 +468,10 @@ void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
466 locked = true; pix = Resource::loadPixmap("locked"); 468 locked = true; pix = Resource::loadPixmap("locked");
467 } 469 }
468 } 470 }
469 (void)new OFileSelectorItem( m_view, pix, name, 471 (void)new OFileSelectorItem( m_view, pix, name,
470 info->lastModified().toString(), QString::number( info->size() ), 472 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
473 QString::number( info->size() ),
471 dir, locked ); 474 dir, locked );
472} 475}
473void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { 476void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
474 bool locked = false; QString name; QPixmap pix; 477 bool locked = false; QString name; QPixmap pix;
@@ -486,9 +489,9 @@ void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
486 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 489 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() :
487 info->fileName(); 490 info->fileName();
488 491
489 (void)new OFileSelectorItem( m_view, pix, name, 492 (void)new OFileSelectorItem( m_view, pix, name,
490 info->lastModified().toString(), 493 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
491 QString::number( info->size() ), 494 QString::number( info->size() ),
492 info->dirPath( true ), locked, true ); 495 info->dirPath( true ), locked, true );
493 496
494 497