author | zautrix <zautrix> | 2005-07-01 14:47:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-01 14:47:16 (UTC) |
commit | f330b9d0a7f755660ddd59739e3ab9b98d60bc18 (patch) (side-by-side diff) | |
tree | c29630a799dc39906e57ba1d23cba6861f1cc0bb /korganizer/calendarview.cpp | |
parent | eee2e65aebe1c93a0c391a927b86ce87a278a4df (diff) | |
download | kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.zip kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.tar.gz kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.tar.bz2 |
fixii
-rw-r--r-- | korganizer/calendarview.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index c0f3be7..fd026fa 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -663,48 +663,62 @@ void CalendarView::scrollBarValue(int val ) { #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() < 800 ) return; static bool block = false; if ( block ) return; block = true; val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); //qDebug("VAL %d ",val ); int count = mNavigator->selectedDates().count(); int year = mNavigator->selectedDates().first().year(); int day = mNavigator->selectedDates().first().dayOfYear(); if ( val == day -1 ) { 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()); //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); QPtrList<Incidence> el = mCalendar->rawIncidences(); QPtrList<Incidence> al; Incidence* inL = el.first(); QDateTime cur = QDateTime::currentDateTime().addSecs(-59); qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); while ( inL ) { bool ok = false; int offset = 0; QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; if ( ok ) { //qDebug("OK %s",next.toString().latin1()); @@ -1902,59 +1916,59 @@ bool CalendarView::loadCalendars() restoreCalendarSettings(); return true; } bool CalendarView::restoreCalendarSettings() { QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); while ( cal ) { mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); if ( cal->isStandard ) 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 ); - addCalendar( cal ); + 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)); return false; } globalFlagBlockAgenda = 1; clearAllViews(); if (!merge) { mViewManager->setDocumentId( filename ); mCalendar->close(); } mStorage->setFileName( filename ); if ( mStorage->load() ) { |