summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.cpp
Unidiff
Diffstat (limited to 'korganizer/kofilterview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 7ce3f1f..6a6fff9 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -356,53 +356,57 @@ void KOCalEditView::readConfig()
356 mainLayout->addWidget( lab,row,0 ); 356 mainLayout->addWidget( lab,row,0 );
357 mw->show(); 357 mw->show();
358 358
359} 359}
360 360
361void KOCalEditView::defaultInfo() 361void KOCalEditView::defaultInfo()
362{ 362{
363 KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); 363 KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
364} 364}
365void KOCalEditView::addCal() 365void KOCalEditView::addCal()
366{ 366{
367 bool tryagain = true; 367 bool tryagain = true;
368 QString name, file; 368 QString name, file = KGlobalSettings::calendarDir()+"newCal.ics";
369 while ( tryagain ) { 369 while ( tryagain ) {
370 KONewCalPrefs prefs ( this ); 370 KONewCalPrefs prefs ( this );
371 prefs.nameE->setText( name ); 371 prefs.nameE->setText( name );
372 prefs.url->setURL( file ); 372 prefs.url->setURL( file );
373 if ( ! prefs.exec() ) 373 if ( ! prefs.exec() )
374 return; 374 return;
375 name = prefs.calName(); 375 name = prefs.calName();
376 file = prefs.calFileName(); 376 file = prefs.calFileName();
377 tryagain = false; 377 tryagain = false;
378 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 378 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
379 while ( kkf ) { 379 while ( kkf ) {
380 if ( kkf->mName == name ) { 380 if ( kkf->mName == name ) {
381 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); 381 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
382 name = ""; 382 name = "";
383 tryagain = true; 383 tryagain = true;
384 break; 384 break;
385 } 385 }
386 if ( kkf->mFileName == file ) { 386 if ( kkf->mFileName == file ) {
387 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); 387 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
388 tryagain = true; 388 tryagain = true;
389 file = ""; 389 file = KGlobalSettings::calendarDir()+"newCal.ics";
390 break; 390 break;
391 } 391 }
392 kkf = KOPrefs::instance()->mCalendars.next(); 392 kkf = KOPrefs::instance()->mCalendars.next();
393 }
394 QFileInfo fi ( file );
395 if ( fi.isDir() ) {
396 tryagain = true;
393 } 397 }
394 } 398 }
395 addCalendar ( name, file ); 399 addCalendar ( name, file );
396 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); 400 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
397} 401}
398int KOCalEditView::addCalendar( QString name, QString file, bool ask ) 402int KOCalEditView::addCalendar( QString name, QString file, bool ask )
399{ 403{
400 404
401 QFileInfo fi ( file ); 405 QFileInfo fi ( file );
402 QString absFile = file; 406 QString absFile = file;
403 bool isRelative = false; 407 bool isRelative = false;
404 if ( fi.isRelative() ) { 408 if ( fi.isRelative() ) {
405 isRelative = true; 409 isRelative = true;
406 absFile = KGlobalSettings::calendarDir()+file; 410 absFile = KGlobalSettings::calendarDir()+file;
407 fi.setFile( absFile ); 411 fi.setFile( absFile );
408 } else { 412 } else {