summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-06-29 11:59:46 (UTC)
committer zautrix <zautrix>2004-06-29 11:59:46 (UTC)
commitda43dbdc6c82453228f34766fc74585615cba938 (patch) (unidiff)
tree16576932cea08bf117b2d0320b0d5f66ee8ad093 /korganizer
parent627489ea2669d3997676bc3cee0f5d0d0c16c4d4 (diff)
downloadkdepimpi-da43dbdc6c82453228f34766fc74585615cba938.zip
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.gz
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.bz2
New lib ical.Some minor changes as well.
Diffstat (limited to 'korganizer') (more/less context) (ignore 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
@@ -1181,129 +1181,129 @@ bool CalendarView::importBday()
1181 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1181 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1182 KABC::AddressBook::Iterator it; 1182 KABC::AddressBook::Iterator it;
1183 int count = 0; 1183 int count = 0;
1184 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1184 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1185 ++count; 1185 ++count;
1186 } 1186 }
1187 QProgressBar bar(count,0 ); 1187 QProgressBar bar(count,0 );
1188 int w = 300; 1188 int w = 300;
1189 if ( QApplication::desktop()->width() < 320 ) 1189 if ( QApplication::desktop()->width() < 320 )
1190 w = 220; 1190 w = 220;
1191 int h = bar.sizeHint().height() ; 1191 int h = bar.sizeHint().height() ;
1192 int dw = QApplication::desktop()->width(); 1192 int dw = QApplication::desktop()->width();
1193 int dh = QApplication::desktop()->height(); 1193 int dh = QApplication::desktop()->height();
1194 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1194 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1195 bar.show(); 1195 bar.show();
1196 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1196 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1197 qApp->processEvents(); 1197 qApp->processEvents();
1198 count = 0; 1198 count = 0;
1199 int addCount = 0; 1199 int addCount = 0;
1200 KCal::Attendee* a = 0; 1200 KCal::Attendee* a = 0;
1201 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1201 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1202 if ( ! bar.isVisible() ) 1202 if ( ! bar.isVisible() )
1203 return false; 1203 return false;
1204 bar.setProgress( count++ ); 1204 bar.setProgress( count++ );
1205 qApp->processEvents(); 1205 qApp->processEvents();
1206 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1206 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1207 if ( (*it).birthday().date().isValid() ){ 1207 if ( (*it).birthday().date().isValid() ){
1208 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1208 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1209 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1209 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1210 ++addCount; 1210 ++addCount;
1211 } 1211 }
1212 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1212 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
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
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 )
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;
1278 if ( !categories.isEmpty() ) 1278 if ( !categories.isEmpty() )
1279 loadOk = qtopiaFormat.load( calendar, categories ); 1279 loadOk = qtopiaFormat.load( calendar, categories );
1280 if ( loadOk && !datebook.isEmpty() ) 1280 if ( loadOk && !datebook.isEmpty() )
1281 loadOk = qtopiaFormat.load( calendar, datebook ); 1281 loadOk = qtopiaFormat.load( calendar, datebook );
1282 if ( loadOk && !todolist.isEmpty() ) 1282 if ( loadOk && !todolist.isEmpty() )
1283 loadOk = qtopiaFormat.load( calendar, todolist ); 1283 loadOk = qtopiaFormat.load( calendar, todolist );
1284 1284
1285 if ( loadOk ) { 1285 if ( loadOk ) {
1286 getEventViewerDialog()->setSyncMode( true ); 1286 getEventViewerDialog()->setSyncMode( true );
1287 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1287 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1288 getEventViewerDialog()->setSyncMode( false ); 1288 getEventViewerDialog()->setSyncMode( false );
1289 qApp->processEvents(); 1289 qApp->processEvents();
1290 if ( syncOK ) { 1290 if ( syncOK ) {
1291 if ( KOPrefs::instance()->mWriteBackFile ) 1291 if ( KOPrefs::instance()->mWriteBackFile )
1292 { 1292 {
1293 // write back XML file 1293 // write back XML file
1294 1294
1295 } 1295 }
1296 setModified( true ); 1296 setModified( true );
1297 } 1297 }
1298 } else { 1298 } else {
1299 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1299 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1300 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1300 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1301 question, i18n("Ok")) ; 1301 question, i18n("Ok")) ;
1302 } 1302 }
1303 delete calendar; 1303 delete calendar;
1304 updateView(); 1304 updateView();
1305 return syncOK; 1305 return syncOK;
1306 1306
1307 1307
1308#endif 1308#endif
1309 1309
@@ -1977,149 +1977,149 @@ void CalendarView::edit_sync_options()
1977 case 3: 1977 case 3:
1978 ask.setChecked( true); 1978 ask.setChecked( true);
1979 break; 1979 break;
1980 case 4: 1980 case 4:
1981 f_loc.setChecked( true); 1981 f_loc.setChecked( true);
1982 break; 1982 break;
1983 case 5: 1983 case 5:
1984 f_rem.setChecked( true); 1984 f_rem.setChecked( true);
1985 break; 1985 break;
1986 case 6: 1986 case 6:
1987 // both.setChecked( true); 1987 // both.setChecked( true);
1988 break; 1988 break;
1989 default: 1989 default:
1990 break; 1990 break;
1991 } 1991 }
1992 if ( dia.exec() ) { 1992 if ( dia.exec() ) {
1993 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; 1993 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
1994 } 1994 }
1995 1995
1996} 1996}
1997 1997
1998void CalendarView::slotSelectPickerDate( QDate d) 1998void CalendarView::slotSelectPickerDate( QDate d)
1999{ 1999{
2000 mDateFrame->hide(); 2000 mDateFrame->hide();
2001 if ( mDatePickerMode == 1 ) { 2001 if ( mDatePickerMode == 1 ) {
2002 mNavigator->slotDaySelect( d ); 2002 mNavigator->slotDaySelect( d );
2003 } else if ( mDatePickerMode == 2 ) { 2003 } else if ( mDatePickerMode == 2 ) {
2004 if ( mMoveIncidence->type() == "Todo" ) { 2004 if ( mMoveIncidence->type() == "Todo" ) {
2005 Todo * to = (Todo *) mMoveIncidence; 2005 Todo * to = (Todo *) mMoveIncidence;
2006 QTime tim; 2006 QTime tim;
2007 if ( to->hasDueDate() ) 2007 if ( to->hasDueDate() )
2008 tim = to->dtDue().time(); 2008 tim = to->dtDue().time();
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
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() ) {
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! "));
2094 writeSettings(); 2094 writeSettings();
2095 } 2095 }
2096 } else { 2096 } else {
2097 removeCategories(); 2097 removeCategories();
2098 updateView(); 2098 updateView();
2099 } 2099 }
2100 delete cp; 2100 delete cp;
2101} 2101}
2102 2102
2103void CalendarView::beamIncidence(Incidence * Inc) 2103void CalendarView::beamIncidence(Incidence * Inc)
2104{ 2104{
2105 QPtrList<Incidence> delSel ; 2105 QPtrList<Incidence> delSel ;
2106 delSel.append(Inc); 2106 delSel.append(Inc);
2107 beamIncidenceList( delSel ); 2107 beamIncidenceList( delSel );
2108} 2108}
2109void CalendarView::beamCalendar() 2109void CalendarView::beamCalendar()
2110{ 2110{
2111 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2111 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2112 //qDebug("beamCalendar() "); 2112 //qDebug("beamCalendar() ");
2113 beamIncidenceList( delSel ); 2113 beamIncidenceList( delSel );
2114} 2114}
2115void CalendarView::beamFilteredCalendar() 2115void CalendarView::beamFilteredCalendar()
2116{ 2116{
2117 QPtrList<Incidence> delSel = mCalendar->incidences(); 2117 QPtrList<Incidence> delSel = mCalendar->incidences();
2118 //qDebug("beamFilteredCalendar() "); 2118 //qDebug("beamFilteredCalendar() ");
2119 beamIncidenceList( delSel ); 2119 beamIncidenceList( delSel );
2120} 2120}
2121void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2121void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2122{ 2122{
2123 if ( beamDialog->exec () == QDialog::Rejected ) 2123 if ( beamDialog->exec () == QDialog::Rejected )
2124 return; 2124 return;
2125 2125