Commit 9b5e7e85 authored by David Jarvie's avatar David Jarvie

Bug 296383: during startup, check that resources calendar opens ok

[KResources build option]: Prevent crash in program initialisation by
checking that the resources calendar has opened successfully.

BUG:296383
parent f1d3c6cd
......@@ -223,12 +223,27 @@ AlarmCalendar::~AlarmCalendar()
close();
}
/******************************************************************************
* Check whether the calendar is open.
*/
bool AlarmCalendar::isOpen()
{
#ifndef USE_AKONADI
if (mOpen && mCalType == RESOURCES && !AlarmResources::instance())
{
mCalendar = 0;
mOpen = false;
}
#endif
return mOpen;
}
/******************************************************************************
* Open the calendar if not already open, and load it into memory.
*/
bool AlarmCalendar::open()
{
if (mOpen)
if (isOpen())
return true;
if (mCalType == RESOURCES)
{
......@@ -287,7 +302,7 @@ bool AlarmCalendar::open()
mCalendar = 0;
#endif
}
return mOpen;
return isOpen();
}
/******************************************************************************
......
......@@ -120,7 +120,7 @@ class AlarmCalendar : public QObject
bool deleteEvent(const QString& eventID, bool save = false);
#endif
void purgeEvents(const KAEvent::List&);
bool isOpen() const { return mOpen; }
bool isOpen();
QString path() const { return (mCalType == RESOURCES) ? QString() : mUrl.prettyUrl(); }
QString urlString() const { return (mCalType == RESOURCES) ? QString() : mUrl.url(); }
void adjustStartOfDay();
......
......@@ -2229,7 +2229,8 @@ bool KAlarmApp::initCheck(bool calendarOnly)
*/
AlarmCalendar::displayCalendar()->open();
AlarmCalendar::resources()->open();
if (!AlarmCalendar::resources()->open())
return false;
setArchivePurgeDays();
firstTime = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment