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
@@ -344,77 +344,81 @@ void KOCalEditView::readConfig()
344 calb->setNum( kkf->mCalNumber ); 344 calb->setNum( kkf->mCalNumber );
345 calb->setPixmap ( SmallIcon("minus")); 345 calb->setPixmap ( SmallIcon("minus"));
346 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 346 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
347 int hei = calb->sizeHint().height(); 347 int hei = calb->sizeHint().height();
348 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 348 //calb->setMaximumSize( hei*9/10, hei*9/10 );
349 } 349 }
350 ++row; 350 ++row;
351 kkf = KOPrefs::instance()->mCalendars.next(); 351 kkf = KOPrefs::instance()->mCalendars.next();
352 } 352 }
353 if ( errorLoadStandard ) 353 if ( errorLoadStandard )
354 findNewStandard(); 354 findNewStandard();
355 lab = new QLabel ( "", mw ); 355 lab = new QLabel ( "", mw );
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 {
409 QString cd = KGlobalSettings::calendarDir(); 413 QString cd = KGlobalSettings::calendarDir();
410 if ( file.left( cd.length() ) == cd ) { 414 if ( file.left( cd.length() ) == cd ) {
411 isRelative = true; 415 isRelative = true;
412 file = fi.fileName (); 416 file = fi.fileName ();
413 fi.setFile( absFile ); 417 fi.setFile( absFile );
414 } 418 }
415 } 419 }
416 if (!fi.exists() ) { 420 if (!fi.exists() ) {
417 if ( ask ) 421 if ( ask )
418 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) 422 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No )
419 return 0; 423 return 0;
420 QFile fileIn( absFile ); 424 QFile fileIn( absFile );