-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 | |||
@@ -976,195 +976,214 @@ void MainWindow::slotSyncMenu( int action ) | |||
976 | mBlockSaveFlag = true; | 976 | mBlockSaveFlag = true; |
977 | mCurrentSyncProfile = action - 1000 ; | 977 | mCurrentSyncProfile = action - 1000 ; |
978 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 978 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
979 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 979 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
980 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 980 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
981 | KSyncProfile* temp = new KSyncProfile (); | 981 | KSyncProfile* temp = new KSyncProfile (); |
982 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 982 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
983 | temp->readConfig(&config); | 983 | temp->readConfig(&config); |
984 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 984 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
985 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 985 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
986 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 986 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
987 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 987 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
988 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 988 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
989 | if ( action == 1000 ) { | 989 | if ( action == 1000 ) { |
990 | syncSharp(); | 990 | syncSharp(); |
991 | 991 | ||
992 | } else if ( action == 1001 ) { | 992 | } else if ( action == 1001 ) { |
993 | syncLocalFile(); | 993 | syncLocalFile(); |
994 | 994 | ||
995 | } else if ( action == 1002 ) { | 995 | } else if ( action == 1002 ) { |
996 | quickSyncLocalFile(); | 996 | quickSyncLocalFile(); |
997 | 997 | ||
998 | } else if ( action >= 1003 ) { | 998 | } else if ( action >= 1003 ) { |
999 | if ( temp->getIsLocalFileSync() ) { | 999 | if ( temp->getIsLocalFileSync() ) { |
1000 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 1000 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
1001 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1001 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1002 | } else { | 1002 | } else { |
1003 | if ( temp->getIsPhoneSync() ) { | 1003 | if ( temp->getIsPhoneSync() ) { |
1004 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1004 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1005 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1005 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1006 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1006 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1007 | syncPhone(); | 1007 | syncPhone(); |
1008 | } else | 1008 | } else |
1009 | syncRemote( temp ); | 1009 | syncRemote( temp ); |
1010 | 1010 | ||
1011 | } | 1011 | } |
1012 | } | 1012 | } |
1013 | delete temp; | 1013 | delete temp; |
1014 | mBlockSaveFlag = false; | 1014 | mBlockSaveFlag = false; |
1015 | } | 1015 | } |
1016 | void MainWindow::setDefaultPreferences() | 1016 | void MainWindow::setDefaultPreferences() |
1017 | { | 1017 | { |
1018 | KOPrefs *p = KOPrefs::instance(); | 1018 | KOPrefs *p = KOPrefs::instance(); |
1019 | 1019 | ||
1020 | p->mCompactDialogs = true; | 1020 | p->mCompactDialogs = true; |
1021 | p->mConfirm = true; | 1021 | p->mConfirm = true; |
1022 | // p->mEnableQuickTodo = false; | 1022 | // p->mEnableQuickTodo = false; |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | QString MainWindow::resourcePath() | 1025 | QString MainWindow::resourcePath() |
1026 | { | 1026 | { |
1027 | return KGlobal::iconLoader()->iconPath(); | 1027 | return KGlobal::iconLoader()->iconPath(); |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | void MainWindow::displayText( QString text ,QString cap ) | 1030 | void MainWindow::displayText( QString text ,QString cap ) |
1031 | { | 1031 | { |
1032 | QDialog dia( this, "name", true ); ; | 1032 | QDialog dia( this, "name", true ); ; |
1033 | dia.setCaption( cap ); | 1033 | dia.setCaption( cap ); |
1034 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1034 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1035 | lay->setSpacing( 3 ); | 1035 | lay->setSpacing( 3 ); |
1036 | lay->setMargin( 3 ); | 1036 | lay->setMargin( 3 ); |
1037 | QTextBrowser tb ( &dia ); | 1037 | QTextBrowser tb ( &dia ); |
1038 | lay->addWidget( &tb ); | 1038 | lay->addWidget( &tb ); |
1039 | tb.setText( text ); | 1039 | tb.setText( text ); |
1040 | #ifdef DESKTOP_VERSION | 1040 | #ifdef DESKTOP_VERSION |
1041 | dia.resize( 640, 480); | 1041 | dia.resize( 640, 480); |
1042 | #else | 1042 | #else |
1043 | dia.showMaximized(); | 1043 | dia.showMaximized(); |
1044 | #endif | 1044 | #endif |
1045 | dia.exec(); | 1045 | dia.exec(); |
1046 | } | 1046 | } |
1047 | void MainWindow::displayFile( QString fn, QString cap ) | 1047 | void MainWindow::displayFile( QString fn, QString cap ) |
1048 | { | 1048 | { |
1049 | QString fileName = resourcePath() + fn; | 1049 | QString fileName = resourcePath() + fn; |
1050 | QString text; | 1050 | QString text; |
1051 | QFile file( fileName ); | 1051 | QFile file( fileName ); |
1052 | if (!file.open( IO_ReadOnly ) ) { | 1052 | if (!file.open( IO_ReadOnly ) ) { |
1053 | return ; | 1053 | return ; |
1054 | 1054 | ||
1055 | } | 1055 | } |
1056 | QTextStream ts( &file ); | 1056 | QTextStream ts( &file ); |
1057 | text = ts.read(); | 1057 | text = ts.read(); |
1058 | file.close(); | 1058 | file.close(); |
1059 | displayText( text, cap); | 1059 | displayText( text, cap); |
1060 | } | 1060 | } |
1061 | void MainWindow::features() | 1061 | void MainWindow::features() |
1062 | { | 1062 | { |
1063 | 1063 | ||
1064 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1064 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | void MainWindow::usertrans() | 1067 | void MainWindow::usertrans() |
1068 | { | 1068 | { |
1069 | 1069 | ||
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 | } |
1077 | void MainWindow::faq() | 1096 | void MainWindow::faq() |
1078 | { | 1097 | { |
1079 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1098 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1080 | 1099 | ||
1081 | } | 1100 | } |
1082 | void MainWindow::whatsNew() | 1101 | void MainWindow::whatsNew() |
1083 | { | 1102 | { |
1084 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1103 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1085 | 1104 | ||
1086 | } | 1105 | } |
1087 | void MainWindow::licence() | 1106 | void MainWindow::licence() |
1088 | { | 1107 | { |
1089 | KApplication::showLicence(); | 1108 | KApplication::showLicence(); |
1090 | 1109 | ||
1091 | } | 1110 | } |
1092 | void MainWindow::about() | 1111 | void MainWindow::about() |
1093 | { | 1112 | { |
1094 | QString version; | 1113 | QString version; |
1095 | #include <../version> | 1114 | #include <../version> |
1096 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1115 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1097 | i18n("KOrganizer/Platform-independent\n") + | 1116 | i18n("KOrganizer/Platform-independent\n") + |
1098 | "(KO/Pi) " + version + " - " + | 1117 | "(KO/Pi) " + version + " - " + |
1099 | 1118 | ||
1100 | #ifdef DESKTOP_VERSION | 1119 | #ifdef DESKTOP_VERSION |
1101 | i18n("Desktop Edition\n") + | 1120 | i18n("Desktop Edition\n") + |
1102 | #else | 1121 | #else |
1103 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1122 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1104 | #endif | 1123 | #endif |
1105 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1124 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1106 | } | 1125 | } |
1107 | void MainWindow::keyBindings() | 1126 | void MainWindow::keyBindings() |
1108 | { | 1127 | { |
1109 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1128 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1110 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1129 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1111 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1130 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1112 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1131 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1113 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1132 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1114 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1133 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1115 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1134 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1116 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1135 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1117 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1136 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1118 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1137 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1119 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1138 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1120 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1139 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1121 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1140 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1122 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1141 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1123 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1142 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1124 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1143 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1125 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1144 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1126 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1145 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1127 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1146 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1128 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1147 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1129 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1148 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1130 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1149 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1131 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1150 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1132 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1151 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1133 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1152 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1134 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1153 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1135 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1154 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1136 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1155 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1137 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1156 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1138 | i18n("<p><h3>In list view:</h3></p>\n") + | 1157 | i18n("<p><h3>In list view:</h3></p>\n") + |
1139 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1158 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1140 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1159 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1141 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1160 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1142 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1161 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1143 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1162 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1144 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1163 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1145 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1164 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1146 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1165 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1147 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1166 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1148 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1167 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1149 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1168 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1150 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1169 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1151 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1170 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1152 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1171 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1153 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1172 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1154 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1173 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1155 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1174 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1156 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1175 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1157 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1176 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1158 | displayText( text, cap); | 1177 | displayText( text, cap); |
1159 | 1178 | ||
1160 | } | 1179 | } |
1161 | void MainWindow::aboutAutoSaving() | 1180 | void MainWindow::aboutAutoSaving() |
1162 | { | 1181 | { |
1163 | QMessageBox* msg; | 1182 | QMessageBox* msg; |
1164 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1183 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1165 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1184 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1166 | QMessageBox::Ok, | 1185 | QMessageBox::Ok, |
1167 | QMessageBox::NoButton, | 1186 | QMessageBox::NoButton, |
1168 | QMessageBox::NoButton); | 1187 | QMessageBox::NoButton); |
1169 | msg->exec(); | 1188 | msg->exec(); |
1170 | delete msg; | 1189 | delete msg; |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 11c68c5..e6d4879 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -777,245 +777,203 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
777 | int dw = QApplication::desktop()->width(); | 777 | int dw = QApplication::desktop()->width(); |
778 | int dh = QApplication::desktop()->height(); | 778 | int dh = QApplication::desktop()->height(); |
779 | status.setCaption(i18n("Reading Phone Data") ); | 779 | status.setCaption(i18n("Reading Phone Data") ); |
780 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 780 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
781 | status.show(); | 781 | status.show(); |
782 | status.raise(); | 782 | status.raise(); |
783 | qApp->processEvents(); | 783 | qApp->processEvents(); |
784 | #if 0 | 784 | #if 0 |
785 | static char*cp; | 785 | static char*cp; |
786 | static INI_Section *cfg = NULL; | 786 | static INI_Section *cfg = NULL; |
787 | cfg=GSM_FindGammuRC(); | 787 | cfg=GSM_FindGammuRC(); |
788 | int i; | 788 | int i; |
789 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 789 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
790 | if (cfg!=NULL) { | 790 | if (cfg!=NULL) { |
791 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); | 791 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); |
792 | if (cp) di.coding = cp; | 792 | if (cp) di.coding = cp; |
793 | 793 | ||
794 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); | 794 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); |
795 | if (s.Config[i].Localize) { | 795 | if (s.Config[i].Localize) { |
796 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | 796 | s.msg=INI_ReadFile(s.Config[i].Localize, true); |
797 | } else { | 797 | } else { |
798 | #if !defined(WIN32) && defined(LOCALE_PATH) | 798 | #if !defined(WIN32) && defined(LOCALE_PATH) |
799 | locale = setlocale(LC_MESSAGES, NULL); | 799 | locale = setlocale(LC_MESSAGES, NULL); |
800 | if (locale != NULL) { | 800 | if (locale != NULL) { |
801 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | 801 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", |
802 | LOCALE_PATH, | 802 | LOCALE_PATH, |
803 | tolower(locale[0]), | 803 | tolower(locale[0]), |
804 | tolower(locale[1])); | 804 | tolower(locale[1])); |
805 | s.msg = INI_ReadFile(locale_file, true); | 805 | s.msg = INI_ReadFile(locale_file, true); |
806 | } | 806 | } |
807 | #endif | 807 | #endif |
808 | } | 808 | } |
809 | } | 809 | } |
810 | 810 | ||
811 | /* Wanted user specific configuration? */ | 811 | /* Wanted user specific configuration? */ |
812 | 812 | ||
813 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 813 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
814 | 814 | ||
815 | s.ConfigNum++; | 815 | s.ConfigNum++; |
816 | 816 | ||
817 | /* We want to use only one file descriptor for global and state machine debug output */ | 817 | /* We want to use only one file descriptor for global and state machine debug output */ |
818 | s.Config[i].UseGlobalDebugFile = true; | 818 | s.Config[i].UseGlobalDebugFile = true; |
819 | 819 | ||
820 | 820 | ||
821 | 821 | ||
822 | /* We wanted to read just user specified configuration. */ | 822 | /* We wanted to read just user specified configuration. */ |
823 | {break;} | 823 | {break;} |
824 | } | 824 | } |
825 | 825 | ||
826 | #endif | 826 | #endif |
827 | int error=initDevice(&s); | 827 | int error=initDevice(&s); |
828 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); | 828 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); |
829 | if ( error != ERR_NONE ) | 829 | if ( error != ERR_NONE ) |
830 | return false; | 830 | return false; |
831 | GSM_Phone_Functions*Phone; | 831 | GSM_Phone_Functions*Phone; |
832 | GSM_CalendarEntrynote; | 832 | GSM_CalendarEntrynote; |
833 | bool start = true; | 833 | bool start = true; |
834 | Phone=s.Phone.Functions; | 834 | Phone=s.Phone.Functions; |
835 | bool gshutdown = false; | 835 | bool gshutdown = false; |
836 | PhoneParser handler( calendar, mProfileName ); | 836 | PhoneParser handler( calendar, mProfileName ); |
837 | int ccc = 0; | 837 | int ccc = 0; |
838 | QString message = i18n("Processing event # "); | 838 | QString message = i18n("Processing event # "); |
839 | int procCount = 0; | 839 | int procCount = 0; |
840 | qDebug("Debug: only 10 calender items are downloaded "); | 840 | qDebug("Debug: only 10 calender items are downloaded "); |
841 | while (!gshutdown && ccc++ < 10) { | 841 | while (!gshutdown && ccc++ < 10) { |
842 | status.setText ( message + QString::number ( ++procCount ) ); | 842 | status.setText ( message + QString::number ( ++procCount ) ); |
843 | qApp->processEvents(); | 843 | qApp->processEvents(); |
844 | qDebug("readEvent %d ", ccc); | 844 | qDebug("readEvent %d ", ccc); |
845 | error=Phone->GetNextCalendar(&s,¬e,start); | 845 | error=Phone->GetNextCalendar(&s,¬e,start); |
846 | if (error == ERR_EMPTY) break; | 846 | if (error == ERR_EMPTY) break; |
847 | start = false; | 847 | start = false; |
848 | handler.readEvent( existingCal, ¬e ); | 848 | handler.readEvent( existingCal, ¬e ); |
849 | } | 849 | } |
850 | 850 | ||
851 | start = true; | 851 | start = true; |
852 | GSM_ToDoEntry ToDo; | 852 | GSM_ToDoEntry ToDo; |
853 | ccc = 0; | 853 | ccc = 0; |
854 | message = i18n("Processing todo # "); | 854 | message = i18n("Processing todo # "); |
855 | procCount = 0; | 855 | procCount = 0; |
856 | while (!gshutdown) { | 856 | while (!gshutdown) { |
857 | status.setText ( message + QString::number ( ++procCount ) ); | 857 | status.setText ( message + QString::number ( ++procCount ) ); |
858 | qApp->processEvents(); | 858 | qApp->processEvents(); |
859 | error = Phone->GetNextToDo(&s, &ToDo, start); | 859 | error = Phone->GetNextToDo(&s, &ToDo, start); |
860 | if (error == ERR_EMPTY) break; | 860 | if (error == ERR_EMPTY) break; |
861 | start = false; | 861 | start = false; |
862 | qDebug("ReadTodo %d ", ++ccc); | 862 | qDebug("ReadTodo %d ", ++ccc); |
863 | handler.readTodo( existingCal, &ToDo, &s); | 863 | handler.readTodo( existingCal, &ToDo, &s); |
864 | 864 | ||
865 | } | 865 | } |
866 | 866 | ||
867 | error=GSM_TerminateConnection(&s); | 867 | error=GSM_TerminateConnection(&s); |
868 | 868 | ||
869 | return true; | 869 | return true; |
870 | } | 870 | } |
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) |
928 | { | 886 | { |
929 | uint csum; | 887 | uint csum; |
930 | if ( inc->type() == "Event") | 888 | if ( inc->type() == "Event") |
931 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); | 889 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); |
932 | else | 890 | else |
933 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); | 891 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); |
934 | inc->setCsum( mProfileName, QString::number( csum )); | 892 | inc->setCsum( mProfileName, QString::number( csum )); |
935 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 893 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
936 | 894 | ||
937 | } | 895 | } |
938 | bool PhoneFormat::save( Calendar *calendar) | 896 | bool PhoneFormat::save( Calendar *calendar) |
939 | { | 897 | { |
940 | GSM_StateMachines; | 898 | GSM_StateMachines; |
941 | qDebug(" save "); | 899 | qDebug(" save "); |
942 | s.opened = false; | 900 | s.opened = false; |
943 | s.msg = NULL; | 901 | s.msg = NULL; |
944 | s.ConfigNum = 0; | 902 | s.ConfigNum = 0; |
945 | QLabel status ( i18n("Writing data. Opening device ..."), 0 ); | 903 | QLabel status ( i18n("Writing data. Opening device ..."), 0 ); |
946 | int w = status.sizeHint().width()+20 ; | 904 | int w = status.sizeHint().width()+20 ; |
947 | if ( w < 200 ) w = 200; | 905 | if ( w < 200 ) w = 200; |
948 | int h = status.sizeHint().height()+20 ; | 906 | int h = status.sizeHint().height()+20 ; |
949 | int dw = QApplication::desktop()->width(); | 907 | int dw = QApplication::desktop()->width(); |
950 | int dh = QApplication::desktop()->height(); | 908 | int dh = QApplication::desktop()->height(); |
951 | status.setCaption(i18n("Writing Phone Data") ); | 909 | status.setCaption(i18n("Writing Phone Data") ); |
952 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 910 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
953 | status.show(); | 911 | status.show(); |
954 | status.raise(); | 912 | status.raise(); |
955 | qApp->processEvents(); | 913 | qApp->processEvents(); |
956 | 914 | ||
957 | int error=initDevice(&s); | 915 | int error=initDevice(&s); |
958 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); | 916 | qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); |
959 | if ( error != ERR_NONE ) | 917 | if ( error != ERR_NONE ) |
960 | return false; | 918 | return false; |
961 | GSM_Phone_Functions*Phone; | 919 | GSM_Phone_Functions*Phone; |
962 | GSM_CalendarEntryNote; | 920 | GSM_CalendarEntryNote; |
963 | bool start = true; | 921 | bool start = true; |
964 | Phone=s.Phone.Functions; | 922 | Phone=s.Phone.Functions; |
965 | bool gshutdown = false; | 923 | bool gshutdown = false; |
966 | QPtrList<Event> er = calendar->rawEvents(); | 924 | QPtrList<Event> er = calendar->rawEvents(); |
967 | Event* ev = er.first(); | 925 | Event* ev = er.first(); |
968 | QString message = i18n("Processing event # "); | 926 | QString message = i18n("Processing event # "); |
969 | int procCount = 0; | 927 | int procCount = 0; |
970 | while ( ev ) { | 928 | while ( ev ) { |
971 | //qDebug("i %d ", ++i); | 929 | //qDebug("i %d ", ++i); |
972 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { // event was changed during sync or is a new one | 930 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { // event was changed during sync or is a new one |
973 | 931 | ||
974 | status.setText ( message + QString::number ( ++procCount ) ); | 932 | status.setText ( message + QString::number ( ++procCount ) ); |
975 | qApp->processEvents(); | 933 | qApp->processEvents(); |
976 | event2GSM( ev, &Note ); | 934 | event2GSM( ev, &Note ); |
977 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete | 935 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete |
978 | error = Phone->DeleteCalendar(&s, &Note); | 936 | error = Phone->DeleteCalendar(&s, &Note); |
979 | } | 937 | } |
980 | else if ( ev->getID(mProfileName).isEmpty() ) { // add new | 938 | else if ( ev->getID(mProfileName).isEmpty() ) { // add new |
981 | // we have to do this later after deleting | 939 | // we have to do this later after deleting |
982 | 940 | ||
983 | } | 941 | } |
984 | else { // change existing | 942 | else { // change existing |
985 | error = Phone->SetCalendar(&s, &Note); | 943 | error = Phone->SetCalendar(&s, &Note); |
986 | } | 944 | } |
987 | } | 945 | } |
988 | ev = er.next(); | 946 | ev = er.next(); |
989 | } | 947 | } |
990 | ev = er.first(); | 948 | ev = er.first(); |
991 | // pending get empty slots | 949 | // pending get empty slots |
992 | while ( ev ) { | 950 | while ( ev ) { |
993 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL && ev->tempSyncStat() != SYNC_TEMPSTATE_DELETE) { | 951 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL && ev->tempSyncStat() != SYNC_TEMPSTATE_DELETE) { |
994 | if ( ev->getID(mProfileName).isEmpty() ) { | 952 | if ( ev->getID(mProfileName).isEmpty() ) { |
995 | status.setText ( message + QString::number ( ++procCount ) ); | 953 | status.setText ( message + QString::number ( ++procCount ) ); |
996 | qApp->processEvents(); | 954 | qApp->processEvents(); |
997 | //int newID ;//= pending | 955 | //int newID ;//= pending |
998 | //ev->setID(mProfileName, QString::number( newID )); | 956 | //ev->setID(mProfileName, QString::number( newID )); |
999 | event2GSM( ev, &Note ); | 957 | event2GSM( ev, &Note ); |
1000 | Note.Location = 0; | 958 | Note.Location = 0; |
1001 | error = Phone->AddCalendar(&s, &Note); | 959 | error = Phone->AddCalendar(&s, &Note); |
1002 | ev->setID( mProfileName, QString::number( Note.Location ) ); | 960 | ev->setID( mProfileName, QString::number( Note.Location ) ); |
1003 | qDebug("New Calendar. Location %d ",Note.Location ); | 961 | qDebug("New Calendar. Location %d ",Note.Location ); |
1004 | afterSave( ev ); | 962 | afterSave( ev ); |
1005 | } else { | 963 | } else { |
1006 | afterSave( ev ); // setting temp sync stat for changed items | 964 | afterSave( ev ); // setting temp sync stat for changed items |
1007 | } | 965 | } |
1008 | } | 966 | } |
1009 | ev = er.next(); | 967 | ev = er.next(); |
1010 | } | 968 | } |
1011 | GSM_ToDoEntry ToDoEntry; | 969 | GSM_ToDoEntry ToDoEntry; |
1012 | QPtrList<Todo> tl = calendar->rawTodos(); | 970 | QPtrList<Todo> tl = calendar->rawTodos(); |
1013 | Todo* to = tl.first(); | 971 | Todo* to = tl.first(); |
1014 | 972 | ||
1015 | message = i18n("Processing todo # "); | 973 | message = i18n("Processing todo # "); |
1016 | procCount = 0; | 974 | procCount = 0; |
1017 | while ( to ) { | 975 | while ( to ) { |
1018 | if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 976 | if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
1019 | status.setText ( message + QString::number ( ++procCount ) ); | 977 | status.setText ( message + QString::number ( ++procCount ) ); |
1020 | qApp->processEvents(); | 978 | qApp->processEvents(); |
1021 | todo2GSM( to, &ToDoEntry ); | 979 | todo2GSM( to, &ToDoEntry ); |
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index 7b7dd04..33b2091 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h | |||
@@ -1,65 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #ifndef PHONEFORMAT_H | 21 | #ifndef PHONEFORMAT_H |
22 | #define PHONEFORMAT_H | 22 | #define PHONEFORMAT_H |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | 25 | ||
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" { |
30 | #include "../gammu/emb/common/gammu.h" | 31 | #include "../gammu/emb/common/gammu.h" |
31 | } | 32 | } |
32 | namespace KCal { | 33 | namespace KCal { |
33 | 34 | ||
34 | /** | 35 | /** |
35 | This class implements the calendar format used by Phone. | 36 | This class implements the calendar format used by Phone. |
36 | */ | 37 | */ |
37 | class Event; | 38 | class Event; |
38 | class Todo; | 39 | class Todo; |
39 | class PhoneFormat : public QObject { | 40 | class PhoneFormat : public QObject { |
40 | public: | 41 | public: |
41 | /** Create new iCalendar format. */ | 42 | /** Create new iCalendar format. */ |
42 | PhoneFormat(QString profileName, QString device,QString connection, QString model); | 43 | PhoneFormat(QString profileName, QString device,QString connection, QString model); |
43 | virtual ~PhoneFormat(); | 44 | virtual ~PhoneFormat(); |
44 | 45 | ||
45 | bool load( Calendar * ,Calendar * ); | 46 | bool load( Calendar * ,Calendar * ); |
46 | bool save( Calendar * ); | 47 | bool save( Calendar * ); |
47 | bool fromString( Calendar *, const QString & ); | 48 | bool fromString( Calendar *, const QString & ); |
48 | QString toString( Calendar * ); | 49 | QString toString( Calendar * ); |
49 | static ulong getCsum( const QStringList & ); | 50 | static ulong getCsum( const QStringList & ); |
50 | static ulong getCsumTodo( Todo* to ); | 51 | static ulong getCsumTodo( Todo* to ); |
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 ); |
55 | int initDevice(GSM_StateMachine *s); | 57 | int initDevice(GSM_StateMachine *s); |
56 | QString getEventString( Event* ); | 58 | QString getEventString( Event* ); |
57 | QString getTodoString( Todo* ); | 59 | QString getTodoString( Todo* ); |
58 | QString dtToGSM( const QDateTime& dt, bool useTZ = true ); | 60 | QString dtToGSM( const QDateTime& dt, bool useTZ = true ); |
59 | QString mProfileName, mDevice, mConnection, mModel; | 61 | QString mProfileName, mDevice, mConnection, mModel; |
60 | void afterSave( Incidence* ); | 62 | void afterSave( Incidence* ); |
61 | }; | 63 | }; |
62 | 64 | ||
63 | } | 65 | } |
64 | 66 | ||
65 | #endif | 67 | #endif |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 72a781a..1167e58 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -72,192 +72,211 @@ bool VCalFormat::load(Calendar *calendar, const QString &fileName) | |||
72 | 72 | ||
73 | // any other top-level calendar stuff should be added/initialized here | 73 | // any other top-level calendar stuff should be added/initialized here |
74 | 74 | ||
75 | // put all vobjects into their proper places | 75 | // put all vobjects into their proper places |
76 | populate(vcal); | 76 | populate(vcal); |
77 | 77 | ||
78 | // clean up from vcal API stuff | 78 | // clean up from vcal API stuff |
79 | cleanVObjects(vcal); | 79 | cleanVObjects(vcal); |
80 | cleanStrTbl(); | 80 | cleanStrTbl(); |
81 | 81 | ||
82 | return true; | 82 | return true; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | bool VCalFormat::save(Calendar *calendar, const QString &fileName) | 86 | bool VCalFormat::save(Calendar *calendar, const QString &fileName) |
87 | { | 87 | { |
88 | mCalendar = calendar; | 88 | mCalendar = calendar; |
89 | 89 | ||
90 | QString tmpStr; | 90 | QString tmpStr; |
91 | VObject *vcal, *vo; | 91 | VObject *vcal, *vo; |
92 | 92 | ||
93 | kdDebug(5800) << "VCalFormat::save(): " << fileName << endl; | 93 | kdDebug(5800) << "VCalFormat::save(): " << fileName << endl; |
94 | 94 | ||
95 | vcal = newVObject(VCCalProp); | 95 | vcal = newVObject(VCCalProp); |
96 | 96 | ||
97 | // addPropValue(vcal,VCLocationProp, "0.0"); | 97 | // addPropValue(vcal,VCLocationProp, "0.0"); |
98 | addPropValue(vcal,VCProdIdProp, productId()); | 98 | addPropValue(vcal,VCProdIdProp, productId()); |
99 | tmpStr = mCalendar->getTimeZoneStr(); | 99 | tmpStr = mCalendar->getTimeZoneStr(); |
100 | //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); | 100 | //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); |
101 | addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); | 101 | addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); |
102 | addPropValue(vcal,VCVersionProp, _VCAL_VERSION); | 102 | addPropValue(vcal,VCVersionProp, _VCAL_VERSION); |
103 | 103 | ||
104 | // TODO STUFF | 104 | // TODO STUFF |
105 | QPtrList<Todo> todoList = mCalendar->rawTodos(); | 105 | QPtrList<Todo> todoList = mCalendar->rawTodos(); |
106 | QPtrListIterator<Todo> qlt(todoList); | 106 | QPtrListIterator<Todo> qlt(todoList); |
107 | for (; qlt.current(); ++qlt) { | 107 | for (; qlt.current(); ++qlt) { |
108 | vo = eventToVTodo(qlt.current()); | 108 | vo = eventToVTodo(qlt.current()); |
109 | addVObjectProp(vcal, vo); | 109 | addVObjectProp(vcal, vo); |
110 | } | 110 | } |
111 | 111 | ||
112 | // EVENT STUFF | 112 | // EVENT STUFF |
113 | QPtrList<Event> events = mCalendar->rawEvents(); | 113 | QPtrList<Event> events = mCalendar->rawEvents(); |
114 | Event *ev; | 114 | Event *ev; |
115 | for(ev=events.first();ev;ev=events.next()) { | 115 | for(ev=events.first();ev;ev=events.next()) { |
116 | vo = eventToVEvent(ev); | 116 | vo = eventToVEvent(ev); |
117 | addVObjectProp(vcal, vo); | 117 | addVObjectProp(vcal, vo); |
118 | } | 118 | } |
119 | 119 | ||
120 | writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); | 120 | writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); |
121 | cleanVObjects(vcal); | 121 | cleanVObjects(vcal); |
122 | cleanStrTbl(); | 122 | cleanStrTbl(); |
123 | 123 | ||
124 | if (QFile::exists(fileName)) { | 124 | if (QFile::exists(fileName)) { |
125 | kdDebug(5800) << "No error" << endl; | 125 | kdDebug(5800) << "No error" << endl; |
126 | return true; | 126 | return true; |
127 | } else { | 127 | } else { |
128 | kdDebug(5800) << "Error" << endl; | 128 | kdDebug(5800) << "Error" << endl; |
129 | return false; // error | 129 | return false; // error |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | 133 | bool VCalFormat::fromString( Calendar *calendar, const QString &text ) |
134 | { | 134 | { |
135 | // TODO: Factor out VCalFormat::fromString() | 135 | // TODO: Factor out VCalFormat::fromString() |
136 | 136 | ||
137 | QCString data = text.utf8(); | 137 | QCString data = text.utf8(); |
138 | 138 | ||
139 | if ( !data.size() ) return false; | 139 | if ( !data.size() ) return false; |
140 | 140 | ||
141 | VObject *vcal = Parse_MIME( data.data(), data.size()); | 141 | VObject *vcal = Parse_MIME( data.data(), data.size()); |
142 | if ( !vcal ) return false; | 142 | if ( !vcal ) return false; |
143 | 143 | ||
144 | VObjectIterator i; | 144 | VObjectIterator i; |
145 | VObject *curvo; | 145 | VObject *curvo; |
146 | initPropIterator( &i, vcal ); | 146 | initPropIterator( &i, vcal ); |
147 | 147 | ||
148 | // we only take the first object. TODO: parse all incidences. | 148 | // we only take the first object. TODO: parse all incidences. |
149 | do { | 149 | do { |
150 | curvo = nextVObject( &i ); | 150 | curvo = nextVObject( &i ); |
151 | } while ( strcmp( vObjectName( curvo ), VCEventProp ) && | 151 | } while ( strcmp( vObjectName( curvo ), VCEventProp ) && |
152 | strcmp( vObjectName( curvo ), VCTodoProp ) ); | 152 | strcmp( vObjectName( curvo ), VCTodoProp ) ); |
153 | 153 | ||
154 | if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { | 154 | if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { |
155 | Event *event = VEventToEvent( curvo ); | 155 | Event *event = VEventToEvent( curvo ); |
156 | calendar->addEvent( event ); | 156 | calendar->addEvent( event ); |
157 | } else { | 157 | } else { |
158 | kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl; | 158 | kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl; |
159 | deleteVObject( vcal ); | 159 | deleteVObject( vcal ); |
160 | return false; | 160 | return false; |
161 | } | 161 | } |
162 | 162 | ||
163 | deleteVObject( vcal ); | 163 | deleteVObject( vcal ); |
164 | 164 | ||
165 | return true; | 165 | return true; |
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 | { |
170 | // TODO: Factor out VCalFormat::asString() | 189 | // TODO: Factor out VCalFormat::asString() |
171 | 190 | ||
172 | VObject *vcal = newVObject(VCCalProp); | 191 | VObject *vcal = newVObject(VCCalProp); |
173 | 192 | ||
174 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); | 193 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); |
175 | QString tmpStr = mCalendar->getTimeZoneStr(); | 194 | QString tmpStr = mCalendar->getTimeZoneStr(); |
176 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); | 195 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); |
177 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); | 196 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); |
178 | 197 | ||
179 | // TODO: Use all data. | 198 | // TODO: Use all data. |
180 | QPtrList<Event> events = calendar->events(); | 199 | QPtrList<Event> events = calendar->events(); |
181 | Event *event = events.first(); | 200 | Event *event = events.first(); |
182 | if ( !event ) return QString::null; | 201 | if ( !event ) return QString::null; |
183 | 202 | ||
184 | VObject *vevent = eventToVEvent( event ); | 203 | VObject *vevent = eventToVEvent( event ); |
185 | 204 | ||
186 | addVObjectProp( vcal, vevent ); | 205 | addVObjectProp( vcal, vevent ); |
187 | 206 | ||
188 | char *buf = writeMemVObject( 0, 0, vcal ); | 207 | char *buf = writeMemVObject( 0, 0, vcal ); |
189 | 208 | ||
190 | QString result( buf ); | 209 | QString result( buf ); |
191 | 210 | ||
192 | cleanVObject( vcal ); | 211 | cleanVObject( vcal ); |
193 | 212 | ||
194 | return result; | 213 | return result; |
195 | } | 214 | } |
196 | 215 | ||
197 | VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | 216 | VObject *VCalFormat::eventToVTodo(const Todo *anEvent) |
198 | { | 217 | { |
199 | VObject *vtodo; | 218 | VObject *vtodo; |
200 | QString tmpStr; | 219 | QString tmpStr; |
201 | QStringList tmpStrList; | 220 | QStringList tmpStrList; |
202 | 221 | ||
203 | vtodo = newVObject(VCTodoProp); | 222 | vtodo = newVObject(VCTodoProp); |
204 | 223 | ||
205 | // due date | 224 | // due date |
206 | if (anEvent->hasDueDate()) { | 225 | if (anEvent->hasDueDate()) { |
207 | tmpStr = qDateTimeToISO(anEvent->dtDue(), | 226 | tmpStr = qDateTimeToISO(anEvent->dtDue(), |
208 | !anEvent->doesFloat()); | 227 | !anEvent->doesFloat()); |
209 | addPropValue(vtodo, VCDueProp, tmpStr.local8Bit()); | 228 | addPropValue(vtodo, VCDueProp, tmpStr.local8Bit()); |
210 | } | 229 | } |
211 | 230 | ||
212 | // start date | 231 | // start date |
213 | if (anEvent->hasStartDate()) { | 232 | if (anEvent->hasStartDate()) { |
214 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 233 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
215 | !anEvent->doesFloat()); | 234 | !anEvent->doesFloat()); |
216 | addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit()); | 235 | addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit()); |
217 | } | 236 | } |
218 | 237 | ||
219 | // creation date | 238 | // creation date |
220 | tmpStr = qDateTimeToISO(anEvent->created()); | 239 | tmpStr = qDateTimeToISO(anEvent->created()); |
221 | addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit()); | 240 | addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit()); |
222 | 241 | ||
223 | // unique id | 242 | // unique id |
224 | addPropValue(vtodo, VCUniqueStringProp, | 243 | addPropValue(vtodo, VCUniqueStringProp, |
225 | anEvent->uid().local8Bit()); | 244 | anEvent->uid().local8Bit()); |
226 | 245 | ||
227 | // revision | 246 | // revision |
228 | tmpStr.sprintf("%i", anEvent->revision()); | 247 | tmpStr.sprintf("%i", anEvent->revision()); |
229 | addPropValue(vtodo, VCSequenceProp, tmpStr.local8Bit()); | 248 | addPropValue(vtodo, VCSequenceProp, tmpStr.local8Bit()); |
230 | 249 | ||
231 | // last modification date | 250 | // last modification date |
232 | tmpStr = qDateTimeToISO(anEvent->lastModified()); | 251 | tmpStr = qDateTimeToISO(anEvent->lastModified()); |
233 | addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit()); | 252 | addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit()); |
234 | 253 | ||
235 | // organizer stuff | 254 | // organizer stuff |
236 | tmpStr = "MAILTO:" + anEvent->organizer(); | 255 | tmpStr = "MAILTO:" + anEvent->organizer(); |
237 | addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); | 256 | addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); |
238 | 257 | ||
239 | // attendees | 258 | // attendees |
240 | if (anEvent->attendeeCount() != 0) { | 259 | if (anEvent->attendeeCount() != 0) { |
241 | QPtrList<Attendee> al = anEvent->attendees(); | 260 | QPtrList<Attendee> al = anEvent->attendees(); |
242 | QPtrListIterator<Attendee> ai(al); | 261 | QPtrListIterator<Attendee> ai(al); |
243 | Attendee *curAttendee; | 262 | Attendee *curAttendee; |
244 | 263 | ||
245 | for (; ai.current(); ++ai) { | 264 | for (; ai.current(); ++ai) { |
246 | curAttendee = ai.current(); | 265 | curAttendee = ai.current(); |
247 | if (!curAttendee->email().isEmpty() && | 266 | if (!curAttendee->email().isEmpty() && |
248 | !curAttendee->name().isEmpty()) | 267 | !curAttendee->name().isEmpty()) |
249 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + | 268 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + |
250 | curAttendee->email() + ">"; | 269 | curAttendee->email() + ">"; |
251 | else if (curAttendee->name().isEmpty()) | 270 | else if (curAttendee->name().isEmpty()) |
252 | tmpStr = "MAILTO: " + curAttendee->email(); | 271 | tmpStr = "MAILTO: " + curAttendee->email(); |
253 | else if (curAttendee->email().isEmpty()) | 272 | else if (curAttendee->email().isEmpty()) |
254 | tmpStr = "MAILTO: " + curAttendee->name(); | 273 | tmpStr = "MAILTO: " + curAttendee->name(); |
255 | else if (curAttendee->name().isEmpty() && | 274 | else if (curAttendee->name().isEmpty() && |
256 | curAttendee->email().isEmpty()) | 275 | curAttendee->email().isEmpty()) |
257 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; | 276 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; |
258 | VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit()); | 277 | VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit()); |
259 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); | 278 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); |
260 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); | 279 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); |
261 | } | 280 | } |
262 | } | 281 | } |
263 | 282 | ||
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index d4cecbc..8490125 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -1,108 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef _VCALFORMAT_H | 22 | #ifndef _VCALFORMAT_H |
23 | #define _VCALFORMAT_H | 23 | #define _VCALFORMAT_H |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | #define _VCAL_VERSION "1.0" | 27 | #define _VCAL_VERSION "1.0" |
28 | 28 | ||
29 | class VObject; | 29 | class VObject; |
30 | 30 | ||
31 | namespace KCal { | 31 | namespace KCal { |
32 | 32 | ||
33 | /** | 33 | /** |
34 | This class implements the vCalendar format. It provides methods for | 34 | This class implements the vCalendar format. It provides methods for |
35 | loading/saving/converting vCalendar format data into the internal KOrganizer | 35 | loading/saving/converting vCalendar format data into the internal KOrganizer |
36 | representation as Calendar and Events. | 36 | representation as Calendar and Events. |
37 | 37 | ||
38 | @short vCalendar format implementation | 38 | @short vCalendar format implementation |
39 | */ | 39 | */ |
40 | class VCalFormat : public CalFormat { | 40 | class VCalFormat : public CalFormat { |
41 | public: | 41 | public: |
42 | VCalFormat(); | 42 | VCalFormat(); |
43 | virtual ~VCalFormat(); | 43 | virtual ~VCalFormat(); |
44 | 44 | ||
45 | /** loads a calendar on disk in vCalendar format into the current calendar. | 45 | /** loads a calendar on disk in vCalendar format into the current calendar. |
46 | * any information already present is lost. Returns TRUE if successful, | 46 | * any information already present is lost. Returns TRUE if successful, |
47 | * else returns FALSE. | 47 | * else returns FALSE. |
48 | * @param fileName the name of the calendar on disk. | 48 | * @param fileName the name of the calendar on disk. |
49 | */ | 49 | */ |
50 | bool load(Calendar *,const QString &fileName); | 50 | bool load(Calendar *,const QString &fileName); |
51 | /** writes out the calendar to disk in vCalendar format. Returns true if | 51 | /** writes out the calendar to disk in vCalendar format. Returns true if |
52 | * successful and false on error. | 52 | * successful and false on error. |
53 | * @param fileName the name of the file | 53 | * @param fileName the name of the file |
54 | */ | 54 | */ |
55 | bool save(Calendar *,const QString &fileName); | 55 | bool save(Calendar *,const QString &fileName); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | Parse string and populate calendar with that information. | 58 | Parse string and populate calendar with that information. |
59 | */ | 59 | */ |
60 | bool fromString( Calendar *, const QString & ); | 60 | bool fromString( Calendar *, const QString & ); |
61 | /** | 61 | /** |
62 | Return calendar information as string. | 62 | Return calendar information as string. |
63 | */ | 63 | */ |
64 | QString toString( Calendar * ); | 64 | QString toString( Calendar * ); |
65 | QString eventToString( Event * ); | ||
66 | QString todoToString( Todo * ); | ||
65 | 67 | ||
66 | protected: | 68 | protected: |
67 | /** translates a VObject of the TODO type into a Event */ | 69 | /** translates a VObject of the TODO type into a Event */ |
68 | Todo *VTodoToEvent(VObject *vtodo); | 70 | Todo *VTodoToEvent(VObject *vtodo); |
69 | /** translates a VObject into a Event and returns a pointer to it. */ | 71 | /** translates a VObject into a Event and returns a pointer to it. */ |
70 | Event *VEventToEvent(VObject *vevent); | 72 | Event *VEventToEvent(VObject *vevent); |
71 | /** translate a Event into a VTodo-type VObject and return pointer */ | 73 | /** translate a Event into a VTodo-type VObject and return pointer */ |
72 | VObject *eventToVTodo(const Todo *anEvent); | 74 | VObject *eventToVTodo(const Todo *anEvent); |
73 | /** translate a Event into a VObject and returns a pointer to it. */ | 75 | /** translate a Event into a VObject and returns a pointer to it. */ |
74 | VObject* eventToVEvent(const Event *anEvent); | 76 | VObject* eventToVEvent(const Event *anEvent); |
75 | 77 | ||
76 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ | 78 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ |
77 | QString qDateToISO(const QDate &); | 79 | QString qDateToISO(const QDate &); |
78 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ | 80 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ |
79 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); | 81 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); |
80 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a | 82 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a |
81 | * valid QDateTime. */ | 83 | * valid QDateTime. */ |
82 | QDateTime ISOToQDateTime(const QString & dtStr); | 84 | QDateTime ISOToQDateTime(const QString & dtStr); |
83 | /** takes a string in the format YYYYMMDD and returns a | 85 | /** takes a string in the format YYYYMMDD and returns a |
84 | * valid QDate. */ | 86 | * valid QDate. */ |
85 | QDate ISOToQDate(const QString & dtStr); | 87 | QDate ISOToQDate(const QString & dtStr); |
86 | /** takes a vCalendar tree of VObjects, and puts all of them that have | 88 | /** takes a vCalendar tree of VObjects, and puts all of them that have |
87 | * the "event" property into the dictionary, todos in the todo-list, etc. */ | 89 | * the "event" property into the dictionary, todos in the todo-list, etc. */ |
88 | void populate(VObject *vcal); | 90 | void populate(VObject *vcal); |
89 | 91 | ||
90 | /** takes a number 0 - 6 and returns the two letter string of that day, | 92 | /** takes a number 0 - 6 and returns the two letter string of that day, |
91 | * i.e. MO, TU, WE, etc. */ | 93 | * i.e. MO, TU, WE, etc. */ |
92 | const char *dayFromNum(int day); | 94 | const char *dayFromNum(int day); |
93 | /** the reverse of the above function. */ | 95 | /** the reverse of the above function. */ |
94 | int numFromDay(const QString &day); | 96 | int numFromDay(const QString &day); |
95 | 97 | ||
96 | Attendee::PartStat readStatus(const char *s) const; | 98 | Attendee::PartStat readStatus(const char *s) const; |
97 | QCString writeStatus(Attendee::PartStat status) const; | 99 | QCString writeStatus(Attendee::PartStat status) const; |
98 | 100 | ||
99 | private: | 101 | private: |
100 | Calendar *mCalendar; | 102 | Calendar *mCalendar; |
101 | 103 | ||
102 | QPtrList<Event> mEventsRelate; // events with relations | 104 | QPtrList<Event> mEventsRelate; // events with relations |
103 | QPtrList<Todo> mTodosRelate; // todos with relations | 105 | QPtrList<Todo> mTodosRelate; // todos with relations |
104 | }; | 106 | }; |
105 | 107 | ||
106 | } | 108 | } |
107 | 109 | ||
108 | #endif | 110 | #endif |