summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.cpp
Unidiff
Diffstat (limited to 'korganizer/kofilterview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index a8a3052..3cde103 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -379,12 +379,18 @@ void KOCalEditView::addCal()
379 } 379 }
380 } 380 }
381 addCalendar ( name, file );
382}
383int KOCalEditView::addCalendar( QString name, QString file, bool ask )
384{
385
381 QFileInfo fi ( file ); 386 QFileInfo fi ( file );
382 if (!fi.exists() ) { 387 if (!fi.exists() ) {
388 if ( ask )
383 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) 389 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
384 return; 390 return 0;
385 QFile fileIn( file ); 391 QFile fileIn( file );
386 if (!fileIn.open( IO_WriteOnly ) ) { 392 if (!fileIn.open( IO_WriteOnly ) ) {
387 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 393 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
388 return; 394 return 0;
389 } 395 }
390 QTextStream tsIn( &fileIn ); 396 QTextStream tsIn( &fileIn );
@@ -397,7 +403,21 @@ void KOCalEditView::addCal()
397 kkf->mFileName = file; 403 kkf->mFileName = file;
398 emit calendarAdded( kkf->mCalNumber ); 404 emit calendarAdded( kkf->mCalNumber );
405 if ( ask )
399 emit needsUpdate(); 406 emit needsUpdate();
400 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 407 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
408 return kkf->mCalNumber;
409}
410int KOCalEditView::getBirtdayID()
411{
412 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
413 while ( kkf ) {
414 if ( kkf->mName == i18n("Birthdays") )
415 return kkf->mCalNumber;
416 kkf = KOPrefs::instance()->mCalendars.next();
417 }
418 QString file = locateLocal( "data", "korganizer/birthdays.ics" );
419 return addCalendar( i18n("Birthdays"), file, false );
401} 420}
421
402void KOCalEditView::enableAll() 422void KOCalEditView::enableAll()
403{ 423{