-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 | |||
@@ -671,32 +671,46 @@ void CalendarView::scrollBarValue(int val ) | |||
671 | int count = mNavigator->selectedDates().count(); | 671 | int count = mNavigator->selectedDates().count(); |
672 | int year = mNavigator->selectedDates().first().year(); | 672 | int year = mNavigator->selectedDates().first().year(); |
673 | int day = mNavigator->selectedDates().first().dayOfYear(); | 673 | int day = mNavigator->selectedDates().first().dayOfYear(); |
674 | if ( val == day -1 ) { | 674 | if ( val == day -1 ) { |
675 | block = false; | 675 | block = false; |
676 | return; | 676 | return; |
677 | } | 677 | } |
678 | QDate d ( year,1,1 ); | 678 | QDate d ( year,1,1 ); |
679 | mNavigator->selectDates( d.addDays( val ), count ); | 679 | mNavigator->selectDates( d.addDays( val ), count ); |
680 | block = false; | 680 | block = false; |
681 | #endif | 681 | #endif |
682 | 682 | ||
683 | } | 683 | } |
684 | 684 | ||
685 | void CalendarView::checkAlarms() | 685 | void CalendarView::checkAlarms() |
686 | { | 686 | { |
687 | |||
688 | QString message; | ||
689 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
690 | KopiCalendarFile * cal = calendars.first(); | ||
691 | while ( cal ) { | ||
692 | if ( cal->mErrorOnLoad ) { | ||
693 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | ||
694 | } | ||
695 | cal = calendars.next(); | ||
696 | } | ||
697 | if ( !message.isEmpty() ) { | ||
698 | 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); | ||
699 | KMessageBox::error(this,message); | ||
700 | } | ||
687 | KConfig *config = KOGlobals::config(); | 701 | KConfig *config = KOGlobals::config(); |
688 | config->setGroup( "AppRun" ); | 702 | config->setGroup( "AppRun" ); |
689 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 703 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
690 | int daysto = dt.daysTo( QDate::currentDate() ); | 704 | int daysto = dt.daysTo( QDate::currentDate() ); |
691 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 705 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
692 | dt = dt.addDays( days ); | 706 | dt = dt.addDays( days ); |
693 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 707 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
694 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 708 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
695 | //qDebug("KO: Reading program stop %d ", secs); | 709 | //qDebug("KO: Reading program stop %d ", secs); |
696 | //secs -= ( 3600 * 24*3 ); // debug only | 710 | //secs -= ( 3600 * 24*3 ); // debug only |
697 | QDateTime latest = dt.addSecs ( secs ); | 711 | QDateTime latest = dt.addSecs ( secs ); |
698 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 712 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
699 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 713 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
700 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 714 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
701 | QPtrList<Incidence> al; | 715 | QPtrList<Incidence> al; |
702 | Incidence* inL = el.first(); | 716 | Incidence* inL = el.first(); |
@@ -1910,43 +1924,43 @@ bool CalendarView::restoreCalendarSettings() | |||
1910 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 1924 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
1911 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 1925 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
1912 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 1926 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
1913 | if ( cal->isStandard ) | 1927 | if ( cal->isStandard ) |
1914 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 1928 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
1915 | cal = calendars.next(); | 1929 | cal = calendars.next(); |
1916 | } | 1930 | } |
1917 | setSyncEventsReadOnly(); | 1931 | setSyncEventsReadOnly(); |
1918 | mCalendar->reInitAlarmSettings(); | 1932 | mCalendar->reInitAlarmSettings(); |
1919 | updateUnmanagedViews(); | 1933 | updateUnmanagedViews(); |
1920 | updateView(); | 1934 | updateView(); |
1921 | return true; | 1935 | return true; |
1922 | } | 1936 | } |
1923 | void CalendarView::addCalendarId( int id ) | 1937 | void CalendarView::addCalendarId( int id ) |
1924 | { | 1938 | { |
1925 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | 1939 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); |
1926 | addCalendar( cal ); | 1940 | if ( cal ) |
1941 | addCalendar( cal ); | ||
1927 | } | 1942 | } |
1928 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 1943 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
1929 | { | 1944 | { |
1930 | cal->mErrorOnLoad = false; | 1945 | cal->mErrorOnLoad = false; |
1931 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { | 1946 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { |
1932 | cal->mLoadDt = QDateTime::currentDateTime(); | 1947 | cal->mLoadDt = QDateTime::currentDateTime(); |
1933 | return true; | 1948 | return true; |
1934 | } | 1949 | } |
1935 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); | 1950 | qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); |
1936 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); | ||
1937 | cal->mErrorOnLoad = true; | 1951 | cal->mErrorOnLoad = true; |
1938 | return false; | 1952 | return false; |
1939 | } | 1953 | } |
1940 | bool CalendarView::openCalendar(QString filename, bool merge) | 1954 | bool CalendarView::openCalendar(QString filename, bool merge) |
1941 | { | 1955 | { |
1942 | 1956 | ||
1943 | if (filename.isEmpty()) { | 1957 | if (filename.isEmpty()) { |
1944 | return false; | 1958 | return false; |
1945 | } | 1959 | } |
1946 | 1960 | ||
1947 | if (!QFile::exists(filename)) { | 1961 | if (!QFile::exists(filename)) { |
1948 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1962 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1949 | return false; | 1963 | return false; |
1950 | } | 1964 | } |
1951 | 1965 | ||
1952 | globalFlagBlockAgenda = 1; | 1966 | globalFlagBlockAgenda = 1; |