summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
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
@@ -1221,49 +1221,49 @@ bool CalendarView::importBday()
1221 return true; 1221 return true;
1222} 1222}
1223 1223
1224bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1224bool 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}
1252bool CalendarView::importQtopia( const QString &categories, 1252bool 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 )
@@ -2017,69 +2017,69 @@ void CalendarView::slotSelectPickerDate( QDate d)
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
2030void CalendarView::removeCategories() 2030void 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
2052int CalendarView::addCategories() 2052int 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
2076void CalendarView::manageCategories() 2076void 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() ) {