diff options
-rw-r--r-- | src/backends/evolution/EvolutionCalendarSource.cpp | 14 | ||||
-rw-r--r-- | src/backends/evolution/EvolutionContactSource.cpp | 16 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/backends/evolution/EvolutionCalendarSource.cpp b/src/backends/evolution/EvolutionCalendarSource.cpp index 8c7a8b8e..9dff32d9 100644 --- a/src/backends/evolution/EvolutionCalendarSource.cpp +++ b/src/backends/evolution/EvolutionCalendarSource.cpp @@ -177,6 +177,7 @@ void EvolutionCalendarSource::open() string id = getDatabaseID(); ESource *source = findSource(sources, id); bool onlyIfExists = true; + bool created = false; if (!source) { // might have been special "<<system>>" or "<<default>>", try that and // creating address book from file:// URI before giving up @@ -187,6 +188,7 @@ void EvolutionCalendarSource::open() } else { throwError(string("not found: '") + id + "'"); } + created = true; onlyIfExists = false; } else { m_calendar.set(e_cal_new(source, m_type), m_typeName.c_str()); @@ -195,10 +197,14 @@ void EvolutionCalendarSource::open() e_cal_set_auth_func(m_calendar, eCalAuthFunc, this); if (!e_cal_open(m_calendar, onlyIfExists, &gerror)) { - // opening newly created address books often failed, perhaps that also applies to calendars - try again - g_clear_error(&gerror); - sleep(5); - if (!e_cal_open(m_calendar, onlyIfExists, &gerror)) { + if (created) { + // opening newly created address books often failed, perhaps that also applies to calendars - try again + g_clear_error(&gerror); + sleep(5); + if (!e_cal_open(m_calendar, onlyIfExists, &gerror)) { + throwError(string("opening ") + m_typeName, gerror ); + } + } else { throwError(string("opening ") + m_typeName, gerror ); } } diff --git a/src/backends/evolution/EvolutionContactSource.cpp b/src/backends/evolution/EvolutionContactSource.cpp index 4b59d47c..605fc1d7 100644 --- a/src/backends/evolution/EvolutionContactSource.cpp +++ b/src/backends/evolution/EvolutionContactSource.cpp @@ -156,6 +156,7 @@ void EvolutionContactSource::open() string id = getDatabaseID(); ESource *source = findSource(sources, id); bool onlyIfExists = true; + bool created = false; if (!source) { // might have been special "<<system>>" or "<<default>>", try that and // creating address book from file:// URI before giving up @@ -168,17 +169,22 @@ void EvolutionContactSource::open() } else { throwError(string(getName()) + ": no such address book: '" + id + "'"); } + created = true; onlyIfExists = false; } else { m_addressbook.set( e_book_new( source, &gerror ), "address book" ); } if (!e_book_open( m_addressbook, onlyIfExists, &gerror) ) { - // opening newly created address books often fails, try again once more - g_clear_error(&gerror); - sleep(5); - if (!e_book_open( m_addressbook, onlyIfExists, &gerror) ) { - throwError( "opening address book", gerror ); + if (created) { + // opening newly created address books often fails, try again once more + g_clear_error(&gerror); + sleep(5); + if (!e_book_open(m_addressbook, onlyIfExists, &gerror)) { + throwError("opening address book", gerror); + } + } else { + throwError("opening address book", gerror); } } |