summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.cpp
Side-by-side diff
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()
calb->setNum( kkf->mCalNumber );
calb->setPixmap ( SmallIcon("minus"));
connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
int hei = calb->sizeHint().height();
//calb->setMaximumSize( hei*9/10, hei*9/10 );
}
++row;
kkf = KOPrefs::instance()->mCalendars.next();
}
if ( errorLoadStandard )
findNewStandard();
lab = new QLabel ( "", mw );
mainLayout->addWidget( lab,row,0 );
mw->show();
}
void KOCalEditView::defaultInfo()
{
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.") );
}
void KOCalEditView::addCal()
{
bool tryagain = true;
- QString name, file;
+ QString name, file = KGlobalSettings::calendarDir()+"newCal.ics";
while ( tryagain ) {
KONewCalPrefs prefs ( this );
prefs.nameE->setText( name );
prefs.url->setURL( file );
if ( ! prefs.exec() )
return;
name = prefs.calName();
file = prefs.calFileName();
tryagain = false;
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
if ( kkf->mName == name ) {
KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
name = "";
tryagain = true;
break;
}
if ( kkf->mFileName == file ) {
KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
tryagain = true;
- file = "";
+ file = KGlobalSettings::calendarDir()+"newCal.ics";
break;
}
kkf = KOPrefs::instance()->mCalendars.next();
+ }
+ QFileInfo fi ( file );
+ if ( fi.isDir() ) {
+ tryagain = true;
}
}
addCalendar ( name, file );
- QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
+ QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
}
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( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No )
return 0;
QFile fileIn( absFile );