author | zautrix <zautrix> | 2004-06-29 11:59:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-29 11:59:46 (UTC) |
commit | da43dbdc6c82453228f34766fc74585615cba938 (patch) (unidiff) | |
tree | 16576932cea08bf117b2d0320b0d5f66ee8ad093 /korganizer | |
parent | 627489ea2669d3997676bc3cee0f5d0d0c16c4d4 (diff) | |
download | kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.zip kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.gz kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.bz2 |
New lib ical.Some minor changes as well.
-rw-r--r-- | korganizer/calendarview.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7292dcd..7ac5b11 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1213,65 +1213,65 @@ bool CalendarView::importBday() | |||
1213 | if ( anni.isValid() ){ | 1213 | if ( anni.isValid() ){ |
1214 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1214 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1215 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1215 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1216 | ++addCount; | 1216 | ++addCount; |
1217 | } | 1217 | } |
1218 | } | 1218 | } |
1219 | updateView(); | 1219 | updateView(); |
1220 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1220 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1221 | return true; | 1221 | return true; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1224 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1225 | { | 1225 | { |
1226 | //qDebug("addAnni "); | 1226 | //qDebug("addAnni "); |
1227 | Event * ev = new Event(); | 1227 | Event * ev = new Event(); |
1228 | if ( a ) { | 1228 | if ( a ) { |
1229 | ev->addAttendee( a ); | 1229 | ev->addAttendee( a ); |
1230 | } | 1230 | } |
1231 | QString kind; | 1231 | QString kind; |
1232 | if ( birthday ) | 1232 | if ( birthday ) |
1233 | kind = i18n( "Birthday" ); | 1233 | kind = i18n( "Birthday" ); |
1234 | else | 1234 | else |
1235 | kind = i18n( "Anniversary" ); | 1235 | kind = i18n( "Anniversary" ); |
1236 | ev->setSummary( name + " - " + kind ); | 1236 | ev->setSummary( name + " - " + kind ); |
1237 | ev->setOrganizer( "nobody@nowhere" ); | 1237 | ev->setOrganizer( "nobody@nowhere" ); |
1238 | ev->setCategories( kind ); | 1238 | ev->setCategories( kind ); |
1239 | ev->setDtStart( QDateTime(date) ); | 1239 | ev->setDtStart( QDateTime(date) ); |
1240 | ev->setDtEnd( QDateTime(date) ); | 1240 | ev->setDtEnd( QDateTime(date) ); |
1241 | ev->setFloats( true ); | 1241 | ev->setFloats( true ); |
1242 | Recurrence * rec = ev->recurrence(); | 1242 | Recurrence * rec = ev->recurrence(); |
1243 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1243 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1244 | rec->addYearlyNum( date.month() ); | 1244 | rec->addYearlyNum( date.month() ); |
1245 | if ( !mCalendar->addEventNoDup( ev ) ) { | 1245 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1246 | delete ev; | 1246 | delete ev; |
1247 | return false; | 1247 | return false; |
1248 | } | 1248 | } |
1249 | return true; | 1249 | return true; |
1250 | 1250 | ||
1251 | } | 1251 | } |
1252 | bool CalendarView::importQtopia( const QString &categories, | 1252 | bool CalendarView::importQtopia( const QString &categories, |
1253 | const QString &datebook, | 1253 | const QString &datebook, |
1254 | const QString &todolist ) | 1254 | const QString &todolist ) |
1255 | { | 1255 | { |
1256 | 1256 | ||
1257 | QtopiaFormat qtopiaFormat; | 1257 | QtopiaFormat qtopiaFormat; |
1258 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1258 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1259 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1259 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1260 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1260 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1261 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1261 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1262 | 1262 | ||
1263 | updateView(); | 1263 | updateView(); |
1264 | return true; | 1264 | return true; |
1265 | 1265 | ||
1266 | #if 0 | 1266 | #if 0 |
1267 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1267 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1268 | mCurrentSyncDevice = "qtopia-XML"; | 1268 | mCurrentSyncDevice = "qtopia-XML"; |
1269 | if ( KOPrefs::instance()->mAskForPreferences ) | 1269 | if ( KOPrefs::instance()->mAskForPreferences ) |
1270 | edit_sync_options(); | 1270 | edit_sync_options(); |
1271 | qApp->processEvents(); | 1271 | qApp->processEvents(); |
1272 | CalendarLocal* calendar = new CalendarLocal(); | 1272 | CalendarLocal* calendar = new CalendarLocal(); |
1273 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1273 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1274 | bool syncOK = false; | 1274 | bool syncOK = false; |
1275 | QtopiaFormat qtopiaFormat; | 1275 | QtopiaFormat qtopiaFormat; |
1276 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1276 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1277 | bool loadOk = true; | 1277 | bool loadOk = true; |
@@ -2009,85 +2009,85 @@ void CalendarView::slotSelectPickerDate( QDate d) | |||
2009 | else { | 2009 | else { |
2010 | tim = QTime ( 0,0,0 ); | 2010 | tim = QTime ( 0,0,0 ); |
2011 | to->setFloats( true ); | 2011 | to->setFloats( true ); |
2012 | to->setHasDueDate( true ); | 2012 | to->setHasDueDate( true ); |
2013 | } | 2013 | } |
2014 | QDateTime dt ( d,tim ); | 2014 | QDateTime dt ( d,tim ); |
2015 | to->setDtDue( dt ); | 2015 | to->setDtDue( dt ); |
2016 | todoChanged( to ); | 2016 | todoChanged( to ); |
2017 | } else { | 2017 | } else { |
2018 | QTime tim = mMoveIncidence->dtStart().time(); | 2018 | QTime tim = mMoveIncidence->dtStart().time(); |
2019 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2019 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2020 | QDateTime dt ( d,tim ); | 2020 | QDateTime dt ( d,tim ); |
2021 | mMoveIncidence->setDtStart( dt ); | 2021 | mMoveIncidence->setDtStart( dt ); |
2022 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2022 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2023 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2023 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2024 | } | 2024 | } |
2025 | 2025 | ||
2026 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2026 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2027 | } | 2027 | } |
2028 | } | 2028 | } |
2029 | 2029 | ||
2030 | void CalendarView::removeCategories() | 2030 | void CalendarView::removeCategories() |
2031 | { | 2031 | { |
2032 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2032 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2033 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2033 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2034 | QStringList catIncList; | 2034 | QStringList catIncList; |
2035 | QStringList newCatList; | 2035 | QStringList newCatList; |
2036 | Incidence* inc = incList.first(); | 2036 | Incidence* inc = incList.first(); |
2037 | int i; | 2037 | int i; |
2038 | int count = 0; | 2038 | int count = 0; |
2039 | while ( inc ) { | 2039 | while ( inc ) { |
2040 | newCatList.clear(); | 2040 | newCatList.clear(); |
2041 | catIncList = QStringList::split (",", inc->categoriesStr() ); | 2041 | catIncList = inc->categories() ; |
2042 | for( i = 0; i< catIncList.count(); ++i ) { | 2042 | for( i = 0; i< catIncList.count(); ++i ) { |
2043 | if ( catList.contains (catIncList[i])) | 2043 | if ( catList.contains (catIncList[i])) |
2044 | newCatList.append( catIncList[i] ); | 2044 | newCatList.append( catIncList[i] ); |
2045 | } | 2045 | } |
2046 | newCatList.sort(); | 2046 | newCatList.sort(); |
2047 | inc->setCategories( newCatList.join(",") ); | 2047 | inc->setCategories( newCatList.join(",") ); |
2048 | inc = incList.next(); | 2048 | inc = incList.next(); |
2049 | } | 2049 | } |
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | int CalendarView::addCategories() | 2052 | int CalendarView::addCategories() |
2053 | { | 2053 | { |
2054 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2054 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2055 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2055 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2056 | QStringList catIncList; | 2056 | QStringList catIncList; |
2057 | Incidence* inc = incList.first(); | 2057 | Incidence* inc = incList.first(); |
2058 | int i; | 2058 | int i; |
2059 | int count = 0; | 2059 | int count = 0; |
2060 | while ( inc ) { | 2060 | while ( inc ) { |
2061 | catIncList = QStringList::split (",", inc->categoriesStr() ); | 2061 | catIncList = inc->categories() ; |
2062 | for( i = 0; i< catIncList.count(); ++i ) { | 2062 | for( i = 0; i< catIncList.count(); ++i ) { |
2063 | if ( !catList.contains (catIncList[i])) { | 2063 | if ( !catList.contains (catIncList[i])) { |
2064 | catList.append( catIncList[i] ); | 2064 | catList.append( catIncList[i] ); |
2065 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2065 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2066 | ++count; | 2066 | ++count; |
2067 | } | 2067 | } |
2068 | } | 2068 | } |
2069 | inc = incList.next(); | 2069 | inc = incList.next(); |
2070 | } | 2070 | } |
2071 | catList.sort(); | 2071 | catList.sort(); |
2072 | KOPrefs::instance()->mCustomCategories = catList; | 2072 | KOPrefs::instance()->mCustomCategories = catList; |
2073 | return count; | 2073 | return count; |
2074 | } | 2074 | } |
2075 | 2075 | ||
2076 | void CalendarView::manageCategories() | 2076 | void CalendarView::manageCategories() |
2077 | { | 2077 | { |
2078 | KOCatPrefs* cp = new KOCatPrefs(); | 2078 | KOCatPrefs* cp = new KOCatPrefs(); |
2079 | cp->show(); | 2079 | cp->show(); |
2080 | int w =cp->sizeHint().width() ; | 2080 | int w =cp->sizeHint().width() ; |
2081 | int h = cp->sizeHint().height() ; | 2081 | int h = cp->sizeHint().height() ; |
2082 | int dw = QApplication::desktop()->width(); | 2082 | int dw = QApplication::desktop()->width(); |
2083 | int dh = QApplication::desktop()->height(); | 2083 | int dh = QApplication::desktop()->height(); |
2084 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2084 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2085 | if ( !cp->exec() ) { | 2085 | if ( !cp->exec() ) { |
2086 | delete cp; | 2086 | delete cp; |
2087 | return; | 2087 | return; |
2088 | } | 2088 | } |
2089 | int count = 0; | 2089 | int count = 0; |
2090 | if ( cp->addCat() ) { | 2090 | if ( cp->addCat() ) { |
2091 | count = addCategories(); | 2091 | count = addCategories(); |
2092 | if ( count ) { | 2092 | if ( count ) { |
2093 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2093 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |