summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c0f3be7..fd026fa 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -675,24 +675,38 @@ void CalendarView::scrollBarValue(int val )
block = false;
return;
}
QDate d ( year,1,1 );
mNavigator->selectDates( d.addDays( val ), count );
block = false;
#endif
}
void CalendarView::checkAlarms()
{
+
+ QString message;
+ QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ KopiCalendarFile * cal = calendars.first();
+ while ( cal ) {
+ if ( cal->mErrorOnLoad ) {
+ message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
+ }
+ cal = calendars.next();
+ }
+ if ( !message.isEmpty() ) {
+ message = KGlobal::formatMessage( i18n("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
+ KMessageBox::error(this,message);
+ }
KConfig *config = KOGlobals::config();
config->setGroup( "AppRun" );
QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
int daysto = dt.daysTo( QDate::currentDate() );
int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
dt = dt.addDays( days );
int secto = dt.secsTo( QDateTime::currentDateTime() );
int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
//qDebug("KO: Reading program stop %d ", secs);
//secs -= ( 3600 * 24*3 ); // debug only
QDateTime latest = dt.addSecs ( secs );
qDebug("KO: Last termination on %s ", latest.toString().latin1());
@@ -1914,35 +1928,35 @@ bool CalendarView::restoreCalendarSettings()
mCalendar->setDefaultCalendar( cal->mCalNumber );
cal = calendars.next();
}
setSyncEventsReadOnly();
mCalendar->reInitAlarmSettings();
updateUnmanagedViews();
updateView();
return true;
}
void CalendarView::addCalendarId( int id )
{
KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
+ if ( cal )
addCalendar( cal );
}
bool CalendarView::addCalendar( KopiCalendarFile * cal )
{
cal->mErrorOnLoad = false;
if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) {
cal->mLoadDt = QDateTime::currentDateTime();
return true;
}
- qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() );
- KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName));
+ qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() );
cal->mErrorOnLoad = true;
return false;
}
bool CalendarView::openCalendar(QString filename, bool merge)
{
if (filename.isEmpty()) {
return false;
}
if (!QFile::exists(filename)) {
KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));