From ea75d46072630883fae6ededd4af1d3c427ff59f Mon Sep 17 00:00:00 2001 From: zautrix Date: Tue, 05 Jul 2005 10:58:25 +0000 Subject: fixx --- (limited to 'korganizer/kofilterview.cpp') diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index ff80afc..7ce3f1f 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -37,6 +37,7 @@ #include "koprefs.h" #include #include +#include #include #include @@ -398,11 +399,25 @@ int KOCalEditView::addCalendar( QString name, QString file, bool ask ) { QFileInfo fi ( file ); + QString absFile = file; + bool isRelative = false; + if ( fi.isRelative() ) { + isRelative = true; + absFile = KGlobalSettings::calendarDir()+file; + fi.setFile( absFile ); + } else { + QString cd = KGlobalSettings::calendarDir(); + if ( file.left( cd.length() ) == cd ) { + isRelative = true; + file = fi.fileName (); + fi.setFile( absFile ); + } + } if (!fi.exists() ) { if ( ask ) - if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) + 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 ) return 0; - QFile fileIn( file ); + QFile fileIn( absFile ); if (!fileIn.open( IO_WriteOnly ) ) { KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); return 0; @@ -414,7 +429,9 @@ int KOCalEditView::addCalendar( QString name, QString file, bool ask ) } KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); kkf->mName = name; - kkf->mFileName = file; + kkf->mFileName = absFile; + kkf->mSavedFileName = file; + kkf->isRelative = isRelative; emit calendarAdded( kkf->mCalNumber ); if ( ask ) emit needsUpdate(); -- cgit v0.9.0.2