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
@@ -1149,193 +1149,193 @@ void CalendarView::syncSharp()
1149 if ( loc ) { 1149 if ( loc ) {
1150 loc->setZaurusId( inc->zaurusId() ); 1150 loc->setZaurusId( inc->zaurusId() );
1151 loc->setZaurusUid( inc->zaurusUid() ); 1151 loc->setZaurusUid( inc->zaurusUid() );
1152 } 1152 }
1153 } 1153 }
1154 inc = iL.next(); 1154 inc = iL.next();
1155 } 1155 }
1156 Incidence* lse = getLastSyncEvent(); 1156 Incidence* lse = getLastSyncEvent();
1157 if ( lse ) { 1157 if ( lse ) {
1158 lse->setReadOnly( false ); 1158 lse->setReadOnly( false );
1159 lse->setDescription( "" ); 1159 lse->setDescription( "" );
1160 lse->setReadOnly( true ); 1160 lse->setReadOnly( true );
1161 } 1161 }
1162 } 1162 }
1163 } 1163 }
1164 setModified( true ); 1164 setModified( true );
1165 } else { 1165 } else {
1166 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1166 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1167 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1167 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1168 question, i18n("Ok")) ; 1168 question, i18n("Ok")) ;
1169 1169
1170 } 1170 }
1171 delete calendar; 1171 delete calendar;
1172 updateView(); 1172 updateView();
1173 return ;//syncOK; 1173 return ;//syncOK;
1174#endif 1174#endif
1175} 1175}
1176 1176
1177 1177
1178#include <kabc/stdaddressbook.h> 1178#include <kabc/stdaddressbook.h>
1179bool CalendarView::importBday() 1179bool CalendarView::importBday()
1180{ 1180{
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
1310} 1310}
1311 1311
1312void CalendarView::setSyncEventsReadOnly() 1312void CalendarView::setSyncEventsReadOnly()
1313{ 1313{
1314 Event * ev; 1314 Event * ev;
1315 QPtrList<Event> eL = mCalendar->rawEvents(); 1315 QPtrList<Event> eL = mCalendar->rawEvents();
1316 ev = eL.first(); 1316 ev = eL.first();
1317 while ( ev ) { 1317 while ( ev ) {
1318 if ( ev->uid().left(21) == QString("last-syncEvent-device") ) 1318 if ( ev->uid().left(21) == QString("last-syncEvent-device") )
1319 ev->setReadOnly( true ); 1319 ev->setReadOnly( true );
1320 ev = eL.next(); 1320 ev = eL.next();
1321 } 1321 }
1322} 1322}
1323bool CalendarView::openCalendar(QString filename, bool merge) 1323bool CalendarView::openCalendar(QString filename, bool merge)
1324{ 1324{
1325 1325
1326 if (filename.isEmpty()) { 1326 if (filename.isEmpty()) {
1327 return false; 1327 return false;
1328 } 1328 }
1329 1329
1330 if (!QFile::exists(filename)) { 1330 if (!QFile::exists(filename)) {
1331 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1331 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1332 return false; 1332 return false;
1333 } 1333 }
1334 1334
1335 globalFlagBlockAgenda = 1; 1335 globalFlagBlockAgenda = 1;
1336 if (!merge) mCalendar->close(); 1336 if (!merge) mCalendar->close();
1337 1337
1338 mStorage->setFileName( filename ); 1338 mStorage->setFileName( filename );
1339 1339
1340 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { 1340 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
1341 if ( merge ) ;//setModified( true ); 1341 if ( merge ) ;//setModified( true );
@@ -1945,213 +1945,213 @@ void CalendarView::edit_options()
1945} 1945}
1946void CalendarView::edit_sync_options() 1946void CalendarView::edit_sync_options()
1947{ 1947{
1948 //mDialogManager->showSyncOptions(); 1948 //mDialogManager->showSyncOptions();
1949 //KOPrefs::instance()->mSyncAlgoPrefs 1949 //KOPrefs::instance()->mSyncAlgoPrefs
1950 QDialog dia( this, "dia", true ); 1950 QDialog dia( this, "dia", true );
1951 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 1951 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
1952 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 1952 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
1953 QVBoxLayout lay ( &dia ); 1953 QVBoxLayout lay ( &dia );
1954 lay.setSpacing( 2 ); 1954 lay.setSpacing( 2 );
1955 lay.setMargin( 3 ); 1955 lay.setMargin( 3 );
1956 lay.addWidget(&gr); 1956 lay.addWidget(&gr);
1957 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 1957 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
1958 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 1958 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
1959 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 1959 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
1960 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 1960 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
1961 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 1961 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
1962 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 1962 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
1963 //QRadioButton both( i18n("Take both on conflict"), &gr ); 1963 //QRadioButton both( i18n("Take both on conflict"), &gr );
1964 QPushButton pb ( "OK", &dia); 1964 QPushButton pb ( "OK", &dia);
1965 lay.addWidget( &pb ); 1965 lay.addWidget( &pb );
1966 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1966 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1967 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { 1967 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) {
1968 case 0: 1968 case 0:
1969 loc.setChecked( true); 1969 loc.setChecked( true);
1970 break; 1970 break;
1971 case 1: 1971 case 1:
1972 rem.setChecked( true ); 1972 rem.setChecked( true );
1973 break; 1973 break;
1974 case 2: 1974 case 2:
1975 newest.setChecked( true); 1975 newest.setChecked( true);
1976 break; 1976 break;
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
2126 QString fn = "/tmp/kopibeamfile"; 2126 QString fn = "/tmp/kopibeamfile";
2127 QString mes; 2127 QString mes;
2128 bool createbup = true; 2128 bool createbup = true;
2129 if ( createbup ) { 2129 if ( createbup ) {
2130 QString description = "\n"; 2130 QString description = "\n";
2131 CalendarLocal* cal = new CalendarLocal(); 2131 CalendarLocal* cal = new CalendarLocal();
2132 if ( beamDialog->beamLocal() ) 2132 if ( beamDialog->beamLocal() )
2133 cal->setLocalTime(); 2133 cal->setLocalTime();
2134 else 2134 else
2135 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2135 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2136 Incidence *incidence = delSel.first(); 2136 Incidence *incidence = delSel.first();
2137 bool addText = false; 2137 bool addText = false;
2138 if ( delSel.count() < 10 ) 2138 if ( delSel.count() < 10 )
2139 addText = true; 2139 addText = true;
2140 else { 2140 else {
2141 description.sprintf(i18n(" %d items?"),delSel.count() ); 2141 description.sprintf(i18n(" %d items?"),delSel.count() );
2142 } 2142 }
2143 while ( incidence ) { 2143 while ( incidence ) {
2144 Incidence *in = incidence->clone(); 2144 Incidence *in = incidence->clone();
2145 if ( addText ) 2145 if ( addText )
2146 description += in->summary() + "\n"; 2146 description += in->summary() + "\n";
2147 cal->addIncidence( in ); 2147 cal->addIncidence( in );
2148 incidence = delSel.next(); 2148 incidence = delSel.next();
2149 } 2149 }
2150 if ( beamDialog->beamVcal() ) { 2150 if ( beamDialog->beamVcal() ) {
2151 fn += ".vcs"; 2151 fn += ".vcs";
2152 FileStorage storage( cal, fn, new VCalFormat ); 2152 FileStorage storage( cal, fn, new VCalFormat );
2153 storage.save(); 2153 storage.save();
2154 } else { 2154 } else {
2155 fn += ".ics"; 2155 fn += ".ics";
2156 FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 2156 FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
2157 storage.save(); 2157 storage.save();