-rw-r--r-- | korganizer/mainwindow.cpp | 21 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 60 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 2 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 19 | ||||
-rw-r--r-- | libkcal/vcalformat.h | 2 |
5 files changed, 52 insertions, 52 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index cce182a..6c0aa9b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1070,7 +1070,26 @@ void MainWindow::usertrans() | |||
1070 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1070 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1071 | } | 1071 | } |
1072 | #if 0 | ||
1073 | #include <libkcal/vcalformat.h> | ||
1074 | #include <libkcal/event.h> | ||
1075 | #include <libkcal/todo.h> | ||
1076 | #include <libkcal/incidence.h> | ||
1077 | #endif | ||
1072 | void MainWindow::synchowto() | 1078 | void MainWindow::synchowto() |
1073 | { | 1079 | { |
1074 | 1080 | #if 0 | |
1081 | QPtrList<Incidence> er = mCalendar->rawIncidences(); | ||
1082 | Incidence* inR = er.first(); | ||
1083 | VCalFormat vf; | ||
1084 | QString strout; | ||
1085 | while ( inR ) { | ||
1086 | if ( inR->type() == "Todo" ) | ||
1087 | strout = vf.todoToString( (Todo *) inR ); | ||
1088 | if ( inR->type() == "Event" ) | ||
1089 | strout = vf.eventToString( (Event *) inR ); | ||
1090 | qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); | ||
1091 | inR = er.next(); | ||
1092 | } | ||
1093 | #endif | ||
1075 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1094 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1076 | } | 1095 | } |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 11c68c5..e6d4879 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -871,57 +871,15 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
871 | void PhoneFormat::event2GSM( Event* ev, GSM_CalendarEntry*Note ) | 871 | void PhoneFormat::event2GSM( Event* ev, GSM_CalendarEntry*Note ) |
872 | { | 872 | { |
873 | 873 | QString eText = vfconverter.eventToString( ev ); | |
874 | int pos = 0; | ||
875 | GSM_ToDoEntry dummy; | ||
876 | GSM_DecodeVCALENDAR_VTODO( (unsigned char*)eText.latin1(), &pos, Note , &dummy, Nokia_VCalendar, Nokia_VToDo ); | ||
874 | } | 877 | } |
875 | void PhoneFormat::todo2GSM( Todo* todo, GSM_ToDoEntry *gsm ) | 878 | void PhoneFormat::todo2GSM( Todo* todo, GSM_ToDoEntry *gsmTodo ) |
876 | { | 879 | { |
877 | #if 0 | 880 | QString tText = vfconverter.todoToString( todo ); |
878 | QStringList list; | 881 | int pos = 0; |
879 | list.append( QString::number( todo->zaurusId() ) ); | 882 | GSM_CalendarEntry dummy; |
880 | list.append( todo->categories().join(",") ); | 883 | GSM_DecodeVCALENDAR_VTODO( (unsigned char*)tText.latin1(), &pos, &dummy, gsmTodo, Nokia_VCalendar, Nokia_VToDo ); |
881 | |||
882 | if ( todo->hasStartDate() ) { | ||
883 | list.append( dtToString( todo->dtStart()) ); | ||
884 | } else | ||
885 | list.append( QString() ); | ||
886 | |||
887 | if ( todo->hasDueDate() ) { | ||
888 | QTime tim; | ||
889 | if ( todo->doesFloat()) { | ||
890 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; | ||
891 | } else { | ||
892 | list.append( dtToString(todo->dtDue() ) ); | ||
893 | } | ||
894 | } else | ||
895 | list.append( QString() ); | ||
896 | |||
897 | if ( todo->isCompleted() ) { | ||
898 | list.append( dtToString( todo->completed()) ); | ||
899 | list.append( "0" ); // yes 0 == completed | ||
900 | } else { | ||
901 | list.append( dtToString( todo->completed()) ); | ||
902 | list.append( "1" ); | ||
903 | } | ||
904 | list.append( QString::number( todo->priority() )); | ||
905 | if( ! todo->summary().isEmpty() ) | ||
906 | list.append( todo->summary() ); | ||
907 | else | ||
908 | list.append( "" ); | ||
909 | if (! todo->description().isEmpty() ) | ||
910 | list.append( todo->description() ); | ||
911 | else | ||
912 | list.append( "" ); | ||
913 | for(QStringList::Iterator it=list.begin(); | ||
914 | it!=list.end(); ++it){ | ||
915 | QString& s = (*it); | ||
916 | s.replace(QRegExp("\""), "\"\""); | ||
917 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | ||
918 | s.prepend('\"'); | ||
919 | s.append('\"'); | ||
920 | } else if(s.isEmpty() && !s.isNull()){ | ||
921 | s = "\"\""; | ||
922 | } | ||
923 | } | ||
924 | return list.join(","); | ||
925 | #endif | ||
926 | } | 884 | } |
927 | void PhoneFormat::afterSave( Incidence* inc) | 885 | void PhoneFormat::afterSave( Incidence* inc) |
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index 7b7dd04..33b2091 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h | |||
@@ -26,4 +26,5 @@ | |||
26 | #include "scheduler.h" | 26 | #include "scheduler.h" |
27 | 27 | ||
28 | #include "vcalformat.h" | ||
28 | #include "calformat.h" | 29 | #include "calformat.h" |
29 | extern "C" { | 30 | extern "C" { |
@@ -51,4 +52,5 @@ class PhoneFormat : public QObject { | |||
51 | static ulong getCsumEvent( Event* ev ); | 52 | static ulong getCsumEvent( Event* ev ); |
52 | private: | 53 | private: |
54 | VCalFormat vfconverter; | ||
53 | void event2GSM( Event* ev, GSM_CalendarEntry*Note ); | 55 | void event2GSM( Event* ev, GSM_CalendarEntry*Note ); |
54 | void todo2GSM( Todo* ev, GSM_ToDoEntry *ToDo ); | 56 | void todo2GSM( Todo* ev, GSM_ToDoEntry *ToDo ); |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 72a781a..1167e58 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -166,4 +166,23 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | QString VCalFormat::eventToString( Event * event) | ||
169 | { | ||
170 | if ( !event ) return QString::null; | ||
171 | VObject *vevent = eventToVEvent( event ); | ||
172 | char *buf = writeMemVObject( 0, 0, vevent ); | ||
173 | QString result( buf ); | ||
174 | cleanVObject( vevent ); | ||
175 | return result; | ||
176 | } | ||
177 | QString VCalFormat::todoToString( Todo * todo ) | ||
178 | { | ||
179 | if ( !todo ) return QString::null; | ||
180 | VObject *vevent = eventToVTodo( todo ); | ||
181 | char *buf = writeMemVObject( 0, 0, vevent ); | ||
182 | QString result( buf ); | ||
183 | cleanVObject( vevent ); | ||
184 | return result; | ||
185 | } | ||
186 | |||
168 | QString VCalFormat::toString( Calendar *calendar ) | 187 | QString VCalFormat::toString( Calendar *calendar ) |
169 | { | 188 | { |
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index d4cecbc..8490125 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -63,4 +63,6 @@ class VCalFormat : public CalFormat { | |||
63 | */ | 63 | */ |
64 | QString toString( Calendar * ); | 64 | QString toString( Calendar * ); |
65 | QString eventToString( Event * ); | ||
66 | QString todoToString( Todo * ); | ||
65 | 67 | ||
66 | protected: | 68 | protected: |