summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.cpp
authorzautrix <zautrix>2005-07-05 10:58:25 (UTC)
committer zautrix <zautrix>2005-07-05 10:58:25 (UTC)
commitea75d46072630883fae6ededd4af1d3c427ff59f (patch) (side-by-side diff)
tree60c96620f59441cf0ff998e7e4edd5b2bc8007d9 /korganizer/kofilterview.cpp
parent7e49703511de87f624cc8813b18ebbfcc01752cd (diff)
downloadkdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.zip
kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.tar.gz
kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.tar.bz2
fixx
Diffstat (limited to 'korganizer/kofilterview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp23
1 files changed, 20 insertions, 3 deletions
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 <kiconloader.h>
#include <kglobal.h>
+#include <kglobalsettings.h>
#include <kcolorbutton.h>
#include <kmessagebox.h>
@@ -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();